From a4a381090eae6a3e2a16e76ba157736db21fa137 Mon Sep 17 00:00:00 2001 From: pissang Date: Fri, 6 Aug 2021 12:30:48 +0800 Subject: [PATCH] release 2.0.8 --- dist/echarts-gl.js | 12 ++++++++++-- dist/echarts-gl.js.map | 2 +- dist/echarts-gl.min.js | 2 +- package.json | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dist/echarts-gl.js b/dist/echarts-gl.js index d02b7dd5..3de1bc6f 100644 --- a/dist/echarts-gl.js +++ b/dist/echarts-gl.js @@ -25130,8 +25130,15 @@ graphicGL.BoundingBox = math_BoundingBox; graphicGL.Frustum = math_Frustum; // Texture utilities +var blankImage = null; -var blankImage = util_texture.createBlank('rgba(255,255,255,0)').image; +function getBlankImage() { + if (blankImage !== null) { + return blankImage; + } + blankImage = util_texture.createBlank('rgba(255,255,255,0)').image; + return blankImage; +} function graphicGL_nearestPowerOfTwo(val) { @@ -25279,7 +25286,7 @@ graphicGL.loadTexture = function (imgValue, api, textureOpts, cb) { originalImage.crossOrigin = 'Anonymous'; originalImage.src = imgValue; // Use blank image as place holder. - texture.image = blankImage; + texture.image = getBlankImage(); textureCache.put(prefix + imgValue, textureObj); } @@ -25615,6 +25622,7 @@ graphicGL.updateVertexAnimation = function ( }; /* harmony default export */ const util_graphicGL = (graphicGL); + ;// CONCATENATED MODULE: ./node_modules/zrender/lib/animation/requestAnimationFrame.js var requestAnimationFrame; requestAnimationFrame = (typeof window !== 'undefined' diff --git a/dist/echarts-gl.js.map b/dist/echarts-gl.js.map index e614ef40..153f3364 100644 --- a/dist/echarts-gl.js.map +++ b/dist/echarts-gl.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://echarts-gl/webpack/universalModuleDefinition","webpack://echarts-gl/./node_modules/claygl/src/core/mixin/extend.js","webpack://echarts-gl/./node_modules/claygl/src/core/mixin/notifier.js","webpack://echarts-gl/./node_modules/claygl/src/core/util.js","webpack://echarts-gl/./node_modules/claygl/src/core/Base.js","webpack://echarts-gl/./node_modules/claygl/src/core/GLInfo.js","webpack://echarts-gl/./node_modules/claygl/src/core/glenum.js","webpack://echarts-gl/./node_modules/claygl/src/core/request.js","webpack://echarts-gl/./node_modules/claygl/src/core/vendor.js","webpack://echarts-gl/./node_modules/claygl/src/core/LinkedList.js","webpack://echarts-gl/./node_modules/claygl/src/core/LRU.js","webpack://echarts-gl/./node_modules/claygl/src/core/color.js","webpack://echarts-gl/./node_modules/claygl/src/Material.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/common.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/vec2.js","webpack://echarts-gl/./node_modules/claygl/src/math/Vector2.js","webpack://echarts-gl/./node_modules/claygl/src/gpu/GLProgram.js","webpack://echarts-gl/./node_modules/claygl/src/gpu/ProgramManager.js","webpack://echarts-gl/./node_modules/claygl/src/Shader.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/prez.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/mat4.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/vec3.js","webpack://echarts-gl/./node_modules/claygl/src/Renderer.js","webpack://echarts-gl/./node_modules/claygl/src/math/Vector3.js","webpack://echarts-gl/./node_modules/claygl/src/math/Ray.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/vec4.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/mat3.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/quat.js","webpack://echarts-gl/./node_modules/claygl/src/math/Matrix4.js","webpack://echarts-gl/./node_modules/claygl/src/math/Quaternion.js","webpack://echarts-gl/./node_modules/claygl/src/math/BoundingBox.js","webpack://echarts-gl/./node_modules/claygl/src/Node.js","webpack://echarts-gl/./node_modules/claygl/src/Renderable.js","webpack://echarts-gl/./node_modules/claygl/src/picking/RayPicking.js","webpack://echarts-gl/./node_modules/claygl/src/core/Cache.js","webpack://echarts-gl/./node_modules/claygl/src/Texture.js","webpack://echarts-gl/./node_modules/claygl/src/Mesh.js","webpack://echarts-gl/./node_modules/claygl/src/math/util.js","webpack://echarts-gl/./node_modules/claygl/src/Texture2D.js","webpack://echarts-gl/./node_modules/claygl/src/GeometryBase.js","webpack://echarts-gl/./node_modules/claygl/src/Geometry.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/header/calcAmbientSHLight.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/header/light.js","webpack://echarts-gl/./node_modules/claygl/src/Light.js","webpack://echarts-gl/./node_modules/claygl/src/math/Plane.js","webpack://echarts-gl/./node_modules/claygl/src/math/Frustum.js","webpack://echarts-gl/./node_modules/claygl/src/Camera.js","webpack://echarts-gl/./node_modules/claygl/src/Scene.js","webpack://echarts-gl/./node_modules/zrender/lib/core/LRU.js","webpack://echarts-gl/./node_modules/claygl/src/TextureCube.js","webpack://echarts-gl/./node_modules/claygl/src/camera/Perspective.js","webpack://echarts-gl/./node_modules/claygl/src/FrameBuffer.js","webpack://echarts-gl/./node_modules/claygl/src/prePass/EnvironmentMap.js","webpack://echarts-gl/./node_modules/claygl/src/geometry/Plane.js","webpack://echarts-gl/./node_modules/claygl/src/geometry/Cube.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/skybox.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/plugin/Skybox.js","webpack://echarts-gl/./node_modules/claygl/src/plugin/Skydome.js","webpack://echarts-gl/./node_modules/claygl/src/util/dds.js","webpack://echarts-gl/./node_modules/claygl/src/util/hdr.js","webpack://echarts-gl/./node_modules/claygl/src/util/texture.js","webpack://echarts-gl/./src/util/EChartsSurface.js","webpack://echarts-gl/./node_modules/claygl/src/camera/Orthographic.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/vertex.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/Pass.js","webpack://echarts-gl/./node_modules/claygl/src/util/shader/integrateBRDF.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/util/shader/prefilter.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/util/cubemap.js","webpack://echarts-gl/./node_modules/claygl/src/light/AmbientCubemap.js","webpack://echarts-gl/./node_modules/claygl/src/light/AmbientSH.js","webpack://echarts-gl/./node_modules/claygl/src/util/shader/projectEnvMap.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/util/sh.js","webpack://echarts-gl/./src/util/retrieve.js","webpack://echarts-gl/./node_modules/claygl/src/geometry/Sphere.js","webpack://echarts-gl/./node_modules/claygl/src/light/Ambient.js","webpack://echarts-gl/./node_modules/claygl/src/light/Directional.js","webpack://echarts-gl/./node_modules/claygl/src/light/Point.js","webpack://echarts-gl/./node_modules/claygl/src/light/Spot.js","webpack://echarts-gl/./node_modules/claygl/src/math/Vector4.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/mat2.js","webpack://echarts-gl/./node_modules/claygl/src/math/Matrix2.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/mat2d.js","webpack://echarts-gl/./node_modules/claygl/src/math/Matrix2d.js","webpack://echarts-gl/./node_modules/claygl/src/math/Matrix3.js","webpack://echarts-gl/./node_modules/zrender/lib/animation/easing.js","webpack://echarts-gl/./node_modules/zrender/lib/animation/Clip.js","webpack://echarts-gl/./node_modules/zrender/lib/tool/color.js","webpack://echarts-gl/./node_modules/zrender/lib/core/util.js","webpack://echarts-gl/./node_modules/zrender/lib/animation/Animator.js","webpack://echarts-gl/./src/util/animatableMixin.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/util.glsl.js","webpack://echarts-gl/./src/util/shader/common.glsl.js","webpack://echarts-gl/./src/util/shader/color.glsl.js","webpack://echarts-gl/./src/util/shader/lambert.glsl.js","webpack://echarts-gl/./src/util/shader/realistic.glsl.js","webpack://echarts-gl/./src/util/shader/hatching.glsl.js","webpack://echarts-gl/./src/util/shader/shadow.glsl.js","webpack://echarts-gl/./src/util/graphicGL.js","webpack://echarts-gl/./node_modules/zrender/lib/animation/requestAnimationFrame.js","webpack://echarts-gl/./src/core/LayerGL.js","webpack://echarts-gl/./src/preprocessor/backwardCompat.js","webpack://echarts-gl/./src/echarts-gl.js","webpack://echarts-gl/./src/component/common/componentViewControlMixin.js","webpack://echarts-gl/./src/component/common/componentPostEffectMixin.js","webpack://echarts-gl/./src/component/common/componentLightMixin.js","webpack://echarts-gl/./src/component/grid3D/Grid3DModel.js","webpack://echarts-gl/./node_modules/zrender/node_modules/tslib/tslib.es6.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/image.js","webpack://echarts-gl/./node_modules/zrender/lib/core/matrix.js","webpack://echarts-gl/./node_modules/zrender/lib/core/Point.js","webpack://echarts-gl/./node_modules/zrender/lib/core/BoundingRect.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/text.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/parseText.js","webpack://echarts-gl/./node_modules/zrender/lib/core/vector.js","webpack://echarts-gl/./node_modules/zrender/lib/core/Transformable.js","webpack://echarts-gl/./node_modules/zrender/lib/core/Eventful.js","webpack://echarts-gl/./node_modules/zrender/lib/config.js","webpack://echarts-gl/./node_modules/zrender/lib/core/env.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/constants.js","webpack://echarts-gl/./node_modules/zrender/lib/Element.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Displayable.js","webpack://echarts-gl/./node_modules/zrender/lib/core/curve.js","webpack://echarts-gl/./node_modules/zrender/lib/core/bbox.js","webpack://echarts-gl/./node_modules/zrender/lib/core/PathProxy.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/line.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/cubic.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/quadratic.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/util.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/arc.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/windingLine.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/path.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Path.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/TSpan.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Image.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/roundRect.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/subPixelOptimize.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Rect.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Text.js","webpack://echarts-gl/./node_modules/echarts/lib/util/number.js","webpack://echarts-gl/./node_modules/echarts/lib/util/log.js","webpack://echarts-gl/./node_modules/echarts/lib/util/model.js","webpack://echarts-gl/./node_modules/echarts/lib/util/innerStore.js","webpack://echarts-gl/./node_modules/echarts/lib/util/states.js","webpack://echarts-gl/./node_modules/zrender/lib/tool/transformPath.js","webpack://echarts-gl/./node_modules/zrender/lib/tool/path.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Group.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Circle.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Ellipse.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/roundSector.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Sector.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Ring.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/smoothSpline.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/smoothBezier.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/poly.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Polygon.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Polyline.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Line.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/BezierCurve.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Arc.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/CompoundPath.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Gradient.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/LinearGradient.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/RadialGradient.js","webpack://echarts-gl/./node_modules/zrender/lib/core/OrientedBoundingRect.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/IncrementalDisplayable.js","webpack://echarts-gl/./node_modules/echarts/lib/util/graphic.js","webpack://echarts-gl/./node_modules/echarts/lib/label/labelStyle.js","webpack://echarts-gl/./src/util/OrbitControl.js","webpack://echarts-gl/./src/util/geometry/dynamicConvertMixin.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/index.js","webpack://echarts-gl/./node_modules/claygl/src/dep/glmatrix.js","webpack://echarts-gl/./src/util/geometry/Lines3D.js","webpack://echarts-gl/./src/util/ZRTextureAtlasSurface.js","webpack://echarts-gl/./src/component/common/SceneHelper.js","webpack://echarts-gl/./src/util/geometry/Quads.js","webpack://echarts-gl/./src/component/grid3D/Grid3DFace.js","webpack://echarts-gl/./src/util/geometry/Sprites.js","webpack://echarts-gl/./src/util/shader/labels.glsl.js","webpack://echarts-gl/./src/util/mesh/LabelsMesh.js","webpack://echarts-gl/./src/component/grid3D/Grid3DAxis.js","webpack://echarts-gl/./src/util/shader/lines3D.glsl.js","webpack://echarts-gl/./src/component/grid3D/Grid3DView.js","webpack://echarts-gl/./node_modules/echarts/lib/coord/cartesian/Cartesian.js","webpack://echarts-gl/./src/coord/grid3D/Cartesian3D.js","webpack://echarts-gl/./src/coord/grid3D/Axis3D.js","webpack://echarts-gl/./node_modules/echarts/node_modules/tslib/tslib.es6.js","webpack://echarts-gl/./node_modules/echarts/lib/util/clazz.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/makeStyleMapper.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/areaStyle.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/textStyle.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/lineStyle.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/itemStyle.js","webpack://echarts-gl/./node_modules/echarts/lib/model/Model.js","webpack://echarts-gl/./node_modules/echarts/lib/i18n/langEN.js","webpack://echarts-gl/./node_modules/echarts/lib/i18n/langZH.js","webpack://echarts-gl/./node_modules/echarts/lib/core/locale.js","webpack://echarts-gl/./node_modules/echarts/lib/util/time.js","webpack://echarts-gl/./node_modules/echarts/lib/legacy/getTextRect.js","webpack://echarts-gl/./node_modules/echarts/lib/util/format.js","webpack://echarts-gl/./node_modules/echarts/lib/util/layout.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/TexturePool.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/shadowmap.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/prePass/ShadowMap.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/CompositorNode.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/Graph.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/Compositor.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/SceneNode.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/TextureNode.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/FilterNode.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/coloradjust.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/blur.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/lum.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/lut.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/vignette.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/output.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/bright.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/downsample.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/upsample.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/hdr.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/lensflare.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/blend.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/fxaa.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/registerBuiltinCompositor.js","webpack://echarts-gl/./node_modules/claygl/src/createCompositor.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/createCompositor.js","webpack://echarts-gl/./src/effect/halton.js","webpack://echarts-gl/./src/effect/SSAO.glsl.js","webpack://echarts-gl/./src/effect/SSAOPass.js","webpack://echarts-gl/./src/effect/SSR.glsl.js","webpack://echarts-gl/./src/effect/SSRPass.js","webpack://echarts-gl/./src/effect/poissonKernel.js","webpack://echarts-gl/./src/util/shader/normal.glsl.js","webpack://echarts-gl/./src/effect/NormalPass.js","webpack://echarts-gl/./src/effect/EdgePass.js","webpack://echarts-gl/./src/effect/composite.js","webpack://echarts-gl/./src/effect/DOF.glsl.js","webpack://echarts-gl/./src/effect/edge.glsl.js","webpack://echarts-gl/./src/effect/EffectCompositor.js","webpack://echarts-gl/./src/effect/TemporalSuperSampling.js","webpack://echarts-gl/./src/core/ViewGL.js","webpack://echarts-gl/./src/coord/grid3DCreator.js","webpack://echarts-gl/./src/component/grid3D/Axis3DModel.js","webpack://echarts-gl/./src/component/grid3D/axis3DDefault.js","webpack://echarts-gl/./node_modules/echarts/lib/data/OrdinalMeta.js","webpack://echarts-gl/./src/component/grid3D/createAxis3DModel.js","webpack://echarts-gl/./src/component/grid3D/install.js","webpack://echarts-gl/./src/component/grid3D.js","webpack://echarts-gl/./src/component/common/componentShadingMixin.js","webpack://echarts-gl/./src/coord/geo3D/geo3DModelMixin.js","webpack://echarts-gl/./src/component/geo3D/Geo3DModel.js","webpack://echarts-gl/./src/util/earcut.js","webpack://echarts-gl/./src/util/ProgressiveQuickSort.js","webpack://echarts-gl/./src/util/geometry/trianglesSortMixin.js","webpack://echarts-gl/./src/util/visual.js","webpack://echarts-gl/./src/component/common/LabelsBuilder.js","webpack://echarts-gl/./src/component/common/Geo3DBuilder.js","webpack://echarts-gl/./src/component/geo3D/Geo3DView.js","webpack://echarts-gl/./node_modules/echarts/lib/coord/geo/fix/textCoord.js","webpack://echarts-gl/./node_modules/echarts/lib/coord/geo/fix/geoCoord.js","webpack://echarts-gl/./src/coord/geo3D/Geo3D.js","webpack://echarts-gl/./src/coord/geo3DCreator.js","webpack://echarts-gl/./src/component/geo3D/install.js","webpack://echarts-gl/./src/component/geo3D.js","webpack://echarts-gl/./src/component/globe/GlobeModel.js","webpack://echarts-gl/./src/util/sunCalc.js","webpack://echarts-gl/./src/component/globe/atmosphere.glsl.js","webpack://echarts-gl/./src/component/globe/GlobeView.js","webpack://echarts-gl/./src/coord/globe/Globe.js","webpack://echarts-gl/./src/coord/globeCreator.js","webpack://echarts-gl/./src/component/globe/install.js","webpack://echarts-gl/./src/component/globe.js","webpack://echarts-gl/./src/component/mapbox3D/Mapbox3DModel.js","webpack://echarts-gl/./src/component/mapbox3D/Mapbox3DLayer.js","webpack://echarts-gl/./src/util/shader/displayShadow.glsl.js","webpack://echarts-gl/./src/component/mapbox3D/Mapbox3DView.js","webpack://echarts-gl/./src/coord/mapServiceCommon/MapService3D.js","webpack://echarts-gl/./src/coord/mapbox3D/Mapbox3D.js","webpack://echarts-gl/./src/coord/mapServiceCommon/createMapService3DCreator.js","webpack://echarts-gl/./src/coord/mapbox3DCreator.js","webpack://echarts-gl/./src/component/mapbox3D/install.js","webpack://echarts-gl/./src/component/mapbox3D.js","webpack://echarts-gl/./src/component/maptalks3D/Maptalks3DModel.js","webpack://echarts-gl/./src/component/maptalks3D/Maptalks3DLayer.js","webpack://echarts-gl/./src/component/maptalks3D/Maptalks3DView.js","webpack://echarts-gl/./src/coord/maptalks3D/Maptalks3D.js","webpack://echarts-gl/./src/coord/maptalks3DCreator.js","webpack://echarts-gl/./src/component/maptalks3D/install.js","webpack://echarts-gl/./src/component/maptalks3D.js","webpack://echarts-gl/./src/chart/bar3D/cartesian3DLayout.js","webpack://echarts-gl/./src/chart/bar3D/evaluateBarSparseness.js","webpack://echarts-gl/./src/chart/bar3D/bar3DLayout.js","webpack://echarts-gl/./src/util/format.js","webpack://echarts-gl/./src/chart/common/formatTooltip.js","webpack://echarts-gl/./src/chart/common/createList.js","webpack://echarts-gl/./src/chart/bar3D/Bar3DSeries.js","webpack://echarts-gl/./src/util/geometry/Bars3DGeometry.js","webpack://echarts-gl/./src/chart/bar3D/Bar3DView.js","webpack://echarts-gl/./src/chart/bar3D/install.js","webpack://echarts-gl/./src/chart/bar3D.js","webpack://echarts-gl/./src/chart/line3D/Line3DSeries.js","webpack://echarts-gl/./src/chart/line3D/Line3DView.js","webpack://echarts-gl/./src/chart/line3D/install.js","webpack://echarts-gl/./src/chart/line3D.js","webpack://echarts-gl/./src/chart/scatter3D/Scatter3DSeries.js","webpack://echarts-gl/./src/util/sprite.js","webpack://echarts-gl/./src/util/geometry/verticesSortMixin.js","webpack://echarts-gl/./src/chart/common/sdfSprite.glsl.js","webpack://echarts-gl/./src/chart/common/PointsMesh.js","webpack://echarts-gl/./src/chart/common/PointsBuilder.js","webpack://echarts-gl/./src/chart/scatter3D/Scatter3DView.js","webpack://echarts-gl/./src/chart/scatter3D/install.js","webpack://echarts-gl/./src/chart/scatter3D.js","webpack://echarts-gl/./src/chart/lines3D/lines3DLayout.js","webpack://echarts-gl/./src/chart/lines3D/Lines3DSeries.js","webpack://echarts-gl/./src/chart/lines3D/shader/trail2.glsl.js","webpack://echarts-gl/./src/chart/lines3D/TrailMesh2.js","webpack://echarts-gl/./src/chart/lines3D/Lines3DView.js","webpack://echarts-gl/./src/chart/lines3D/install.js","webpack://echarts-gl/./src/chart/lines3D.js","webpack://echarts-gl/./src/chart/polygons3D/Polygons3DSeries.js","webpack://echarts-gl/./src/chart/polygons3D/Polygons3DView.js","webpack://echarts-gl/./src/chart/polygons3D/install.js","webpack://echarts-gl/./src/chart/polygons3D.js","webpack://echarts-gl/./src/chart/surface/SurfaceSeries.js","webpack://echarts-gl/./src/chart/surface/SurfaceView.js","webpack://echarts-gl/./src/chart/surface/install.js","webpack://echarts-gl/./src/chart/surface.js","webpack://echarts-gl/./src/chart/map3D/Map3DSeries.js","webpack://echarts-gl/./src/chart/map3D/Map3DView.js","webpack://echarts-gl/./src/chart/map3D/install.js","webpack://echarts-gl/./src/chart/map3D.js","webpack://echarts-gl/./src/chart/scatterGL/ScatterGLSeries.js","webpack://echarts-gl/./src/chart/common/GLViewHelper.js","webpack://echarts-gl/./src/chart/scatterGL/ScatterGLView.js","webpack://echarts-gl/./src/chart/scatterGL/install.js","webpack://echarts-gl/./src/chart/scatterGL.js","webpack://echarts-gl/./node_modules/echarts/lib/data/Graph.js","webpack://echarts-gl/./node_modules/echarts/lib/data/helper/linkList.js","webpack://echarts-gl/./src/chart/graphGL/createGraphFromNodeEdge.js","webpack://echarts-gl/./src/chart/graphGL/GraphGLSeries.js","webpack://echarts-gl/./src/util/geometry/Lines2D.js","webpack://echarts-gl/./src/chart/graphGL/forceAtlas2.glsl.js","webpack://echarts-gl/./src/chart/graphGL/ForceAtlas2GPU.js","webpack://echarts-gl/./src/chart/graphGL/forceAtlas2Worker.js","webpack://echarts-gl/./src/chart/graphGL/ForceAtlas2.js","webpack://echarts-gl/./src/util/Roam2DControl.js","webpack://echarts-gl/./src/util/shader/lines2D.glsl.js","webpack://echarts-gl/./src/chart/graphGL/GraphGLView.js","webpack://echarts-gl/./src/chart/graphGL/install.js","webpack://echarts-gl/./src/chart/graphGL.js","webpack://echarts-gl/./src/chart/flowGL/FlowGLSeries.js","webpack://echarts-gl/./src/chart/flowGL/Line2D.js","webpack://echarts-gl/./src/chart/flowGL/vectorFieldParticle.glsl.js","webpack://echarts-gl/./src/chart/flowGL/VectorFieldParticleSurface.js","webpack://echarts-gl/./src/chart/flowGL/FlowGLView.js","webpack://echarts-gl/./src/chart/flowGL/install.js","webpack://echarts-gl/./src/chart/flowGL.js","webpack://echarts-gl/./src/chart/linesGL/LinesGLSeries.js","webpack://echarts-gl/./src/chart/linesGL/LinesGLView.js","webpack://echarts-gl/./src/chart/linesGL/install.js","webpack://echarts-gl/./src/chart/linesGL.js","webpack://echarts-gl/./src/export/all.js","webpack://echarts-gl/external \"echarts\"","webpack://echarts-gl/webpack/bootstrap","webpack://echarts-gl/webpack/runtime/global","webpack://echarts-gl/webpack/runtime/make namespace object","webpack://echarts-gl/webpack/startup"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;ACVA;AACA;AACA,WAAW,gBAAgB;AAC3B,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,yBAAyB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mDAAe;;AAEf;;AAEA;AACA;AACA,CAAC,EAAC;;;ACzGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;;AAEA,iEAAiE;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA,qDAAe,QAAQ,E;;AC1MvB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,eAAe;AAC/B,gBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,eAAe;AAC/B,gBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,SAAS;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;;AAEA,gDAAe,IAAI,EAAC;;;AC1MqB;AACI;AACnB;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,mBAAmB,iBAAY;AAC/B;;AAEA;AACA;AACA,QAAQ,gBAAW;AACnB;AACA;;AAEA,gBAAW,OAAO,YAAW;AAC7B,gBAAW,iBAAiB,cAAa;;AAEzC,gDAAe,IAAI,EAAC;;;AC1BpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kDAAe,MAAM,EAAC;;;AC/DtB;AACA;AACA;AACA;AACA,6CAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAC;;;ACnaF;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAAe;AACf;AACA,CAAC,EAAC;;;ACvC8B;;AAEhC;;AAEA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,qBAAM;AACtB,QAAQ,qBAAM;AACd;;;AAGA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;;AAE7C;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS,WAAW;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kDAAe,MAAM,EAAC;;;AC5EtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa;AACb,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,SAAS;AACrB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA,sDAAe,UAAU,EAAC;;;ACjQY;;AAEtC;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,eAAU;;AAE/B;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA,YAAY,OAAO;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+CAAe,GAAG,EAAC;;;AChFnB;AACA;AACA;AAC8B;;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;AAC1B,sBAAsB;AACtB;AACA;;AAEA,2BAA2B;AAC3B,sBAAsB;AACtB;AACA;;AAEA,2BAA2B;AAC3B;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,eAAe,YAAY,YAAY;AACvC;AACA;AACA;AACA,kBAAkB,eAAe,eAAe;AAChD;AACA;;AAEA,qBAAqB,QAAG;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,eAAe;AAC1B,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,eAAe;AAC1B,YAAY,eAAe;AAC3B;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,eAAe;AAC1B,YAAY,eAAe;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iCAAiC;AACjC,iCAAiC;AACjC,4BAA4B;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,uBAAuB;AAClC,WAAW,eAAe;AAC1B,YAAY,eAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,WAAW,OAAO;AAClB,WAAW,eAAe;AAC1B,WAAW,SAAS;AACpB,YAAY,gBAAgB;AAC5B,qCAAqC,wDAAwD;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,eAAe;AAC1B,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA,4CAAe,SAAS,E;;ACjiBO;AACA;AACM;AACrC,iBAAiB,kBAAsB;;AAEvC;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,aAAa,iBAAY;AACzB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,eAAe,gBAAW;AAC1B;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB,yBAAyB;AACzB,2BAA2B;AAC3B,0BAA0B;;AAE1B;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,0CAA0C;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,0CAA0C;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,YAAY;AAC5B,gBAAgB,QAAQ;AACxB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA,6BAA6B,eAAU;AACvC,+BAA+B,eAAU;;AAEzC;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,kBAAa;AACzB,YAAY,kBAAa;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,eAAU;AAC3C,mCAAmC,eAAU;AAC7C;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,mDAAe,QAAQ,EAAC;;;;ACjfjB;;AAEP;AACO;AACP;AACA;AACA;;AAEO,IAAI,mBAAY;;;;ACRvB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,MAAM;AACjB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA,uBAAuB,OAAO;AAC9B,0BAA0B;AAC1B;AACA,0BAA0B;AAC1B;;AAEA;AACA;AACA,CAAC;;AAED,oDAAe,IAAI,E;;ACpgBiB;;AAEpC;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,wBAAe;;AAEhC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAsB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,kBAAS;AACxB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,sBAAa;AAC5B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,qBAAY;AAC3B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,6BAAoB;AACnC,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,2BAAkB;AACjC,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,4BAAmB;AAC3B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,sBAAa;AACxB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,iBAAQ;AACnB;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,yBAAgB;AACpB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,qBAAY;AACvB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,4BAAmB;AACvB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;ACxtBa;AACJ;;AAEhC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,wBAAmB;;AAE/C,gBAAgB,gBAAW;;AAE3B,wBAAwB;AACxB;;AAEA,CAAC;AACD;;AAEA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,wBAAmB;AACvD;AACA,mCAAmC,kBAAkB;AACrD;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,0CAA0C;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;;AAEA;AACA,CAAC;;AAED,oDAAe,SAAS,E;;ACjVY;;AAEpC,wDAAwD,wBAAwB,yBAAyB,EAAE,eAAe,EAAE,GAAG,EAAE;;AAEjI;AACA;AACA;;AAEA;AACA,aAAa,GAAG;AAChB;AACA,0BAA0B,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uCAAuC,qBAAqB;AAC5D;AACA,wBAAwB;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,4BAAa;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA;AACA,2DAA2D;AAC3D,wDAAwD;AACxD;AACA,8DAA8D;AAC9D;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,4BAAa;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,4BAAa;AACzD;AACA,8CAA8C,4BAAa;;AAE3D;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,aAAS;AAC/B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,yDAAe,cAAc,E;;AC1L7B;AACA;AACA;AACA;AACA;AACA;AACA;AAC+B;AACI;;AAEnC,kIAAkI;AAClI,0EAA0E;AAC1E;AACA,oDAAoD;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,aAAa,EAAE;AACxC,wBAAwB,UAAU,EAAE;AACpC,0BAA0B,UAAU,EAAE;AACtC,8BAA8B,aAAa,EAAE;AAC7C,gCAAgC,aAAa,EAAE;;AAE/C,yBAAyB,2BAA2B,EAAE;AACtD,yBAAyB,2BAA2B,EAAE;AACtD,yBAAyB,2BAA2B,EAAE;;AAEtD,0BAA0B,2BAA2B,EAAE;AACvD,0BAA0B,2BAA2B,EAAE;AACvD,0BAA0B,2BAA2B,EAAE;;AAEvD,yBAAyB,2BAA2B,EAAE;AACtD,yBAAyB,2BAA2B,EAAE;AACtD,yBAAyB,4BAA4B,EAAE;;AAEvD,0BAA0B,WAAW;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,iBAAY;AACzB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iDAAiD;AACjD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,mBAAmB;AACtC;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yDAAyD,wBAAmB;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,gDAAgD,cAAc,EAAE;AAChE;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8EAA8E;AAC9E;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAe,MAAM,EAAC;;;ACvqBtB,gDAAe,kEAAkE,gCAAgC,iCAAiC,qCAAqC,qCAAqC,oGAAoG,gBAAgB,2BAA2B,0EAA0E,yFAAyF,iCAAiC,yCAAyC,GAAG,+DAA+D,iCAAiC,0BAA0B,gBAAgB,2BAA2B,0DAA0D,WAAW,IAAI,IAAI,wCAAwC,GAAG,OAAO,EAAC;;;;ACCh4B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE0D;;AAE1D;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,WAAW,WAAW;AACpC;AACA;AACA;AACA;;AAEA,cAAc,WAAW,YAAY;AACrC;AACA;AACA;AACA;;AAEA,eAAe,YAAY,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,WAAW;AACzB;AACA;AACA;AACA;;AAEA,cAAc,WAAW;AACzB;AACA;AACA;AACA;;AAEA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,mBAAmB,YAAY,YAAY;AAC3C,mBAAmB,YAAY,YAAY;AAC3C,mBAAmB,YAAY,aAAa;;AAE5C,qBAAqB,cAAc,cAAc;AACjD,qBAAqB,cAAc,cAAc;AACjD,qBAAqB,cAAc,eAAe;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,aAAa,GAAG,aAAa;;AAErD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,eAAe,YAAY,YAAY;AACvC,eAAe,YAAY,YAAY;AACvC,eAAe,YAAY,aAAa;;AAExC;AACA,wBAAwB,yBAAyB;AACjD,4BAA4B,qBAAqB;AACjD,4BAA4B,yBAAyB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,MAAM;AACjB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,aAAa;AAChD,mCAAmC,aAAa;AAChD,mCAAmC,aAAa;AAChD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA,oDAAe,IAAI,E;;;AC96BnB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE0D;;AAE1D;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA,YAAY,mBAAY;AACxB,aAAa,mBAAY;AACzB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA,uBAAuB,OAAO;AAC9B,0BAA0B,iBAAiB;AAC3C;AACA,0BAA0B,iBAAiB;AAC3C;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,oDAAe,IAAI,E;;AC1oBnB;AACA;AAC+B;AACI;AACA;AACA;;AAED;AACG;AACa;;AAElD;AAC8B;;AAEsB;AACpD,iBAAgB,CAAC,SAAQ;;AAEU;AACA;;AAEnC,iBAAiB,oBAAW;;AAE5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,WAAW,YAAY;AACvB,UAAU,WAAW;AACrB,WAAW,oBAAoB;AAC/B,WAAW,YAAY;AACvB,YAAY,qBAAqB;AACjC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,wBAAmB;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAW;AAC1B;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,oBAAoB;;AAEpB;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA,sBAAsB,wBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B,WAAM;;AAEjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,kBAAc;;AAEzC;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,WAAW;AAC3B,gBAAgB,YAAY;AAC5B,gBAAgB,QAAQ;AACxB,gBAAgB,QAAQ;AACxB,gBAAgB;AAChB;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,oBAAW;AACtC,uBAAuB,4BAA4B;AACnD;AACA,YAAY,4BAAmB;AAC/B,YAAY,2BAAkB;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,kBAAkB;AACjC,eAAe,YAAY;AAC3B,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,kBAAS;AACrB,YAAY,kBAAS;AACrB,YAAY,kBAAS;AACrB;AACA;AACA,YAAY,sBAAa;AACzB,YAAY,sBAAa;AACzB,YAAY,sBAAa;AACzB;AACA,QAAQ,sBAAa;AACrB,QAAQ,oBAAW;AACnB,QAAQ,oBAAW;;AAEnB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB,iBAAiB;AACxC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAS;AACzB,gBAAgB,sBAAa;AAC7B,gBAAgB,4BAAmB;AACnC;AACA;AACA,oBAAoB,oBAAW;AAC/B;AACA;AACA;AACA,oBAAoB,oBAAW;AAC/B;AACA;AACA;AACA,oBAAoB,oBAAW;AAC/B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,+BAA+B,+BAA+B;AAC9D;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAc;AACtC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,mCAAmC;AAC9D;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,uBAAuB,6BAA6B;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA,kDAAkD;AAClD;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,yBAAyB;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,yBAAyB;AAChE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,yBAAyB;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,gCAAgC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,yDAAyD,YAAQ;AACjE,wBAAwB,UAAM,CAAC,iBAAa,sBAAsB,iBAAa;AAC/E,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,4BAA4B;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,gBAAgB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA,sBAAsB,YAAO;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA,4BAA4B,uBAAuB;AACnD;AACA;AACA,UAAU;AACV;AACA,4BAA4B,uBAAuB;AACnD;AACA;AACA,UAAU;AACV;AACA,8BAA8B,yBAAyB;;AAEvD,mDAAe,QAAQ,EAAC;;;AC/3CY;;AAEpC;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,wBAAe;;AAEhC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAsB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,kBAAS;AACxB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,sBAAa;AAC5B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;AACL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,qBAAY;AAC3B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,6BAAoB;AACnC,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,2BAAkB;AACjC,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,QAAQ,aAAK;AACb;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,mBAAmB,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,mBAAmB,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,mBAAmB,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,sBAAa;AACxB;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,iBAAQ;AACnB;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,yBAAgB;AACpB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,qBAAY;AACvB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,mDAAe,OAAO,EAAC;;;ACv+BS;AACI;;AAEpC;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB;AACA;AACA;AACA,cAAc;AACd;AACA,gCAAgC,YAAO;AACvC;AACA,cAAc;AACd;AACA,sCAAsC,YAAO;AAC7C;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,iBAAQ;AAC9B;AACA;AACA;AACA;AACA;AACA,sBAAsB,YAAO;AAC7B;AACA,iBAAiB,iBAAQ;AACzB,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA,gBAAgB,iBAAQ;AACxB,QAAQ,yBAAgB;AACxB;AACA,KAAK;;AAEL;AACA,gBAAgB,oBAAW;AAC3B;AACA,YAAY,iBAAQ;AACpB;AACA,oBAAoB,iBAAQ;AAC5B;AACA,uBAAuB,sBAAa;AACpC;AACA;AACA,qBAAqB,wBAAe;AACpC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,gBAAgB,oBAAW;AAC3B;AACA;AACA;AACA;AACA,YAAY,iBAAQ;AACpB;AACA,oBAAoB,iBAAQ;AAC5B;AACA,qBAAqB,2BAAkB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,YAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,yBAAgB;AACpC;AACA;AACA;AACA;AACA,gBAAgB,yBAAgB;AAChC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,iBAAiB;AAChC,eAAe;AACf,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB,YAAO;AAC7B;AACA,QAAQ,yBAAgB;AACxB;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,QAAQ;AACvB,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,gBAAgB;AAChB;AACA;;AAEA,kBAAkB,oBAAW;AAC7B,kBAAkB,oBAAW;AAC7B,iBAAiB,oBAAW;AAC5B,qBAAqB,oBAAW;;AAEhC;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;;AAEpB,YAAY,mBAAU;;AAEtB,sBAAsB,iBAAQ;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,iBAAQ;AACpB,oBAAoB,iBAAQ;AAC5B;AACA;AACA;;AAEA,YAAY,mBAAU;AACtB,oBAAoB,iBAAQ;;AAE5B;AACA;AACA;;AAEA,YAAY,mBAAU;AACtB,qBAAqB,iBAAQ;;AAE7B;AACA;AACA;;AAEA;AACA,0BAA0B,YAAO;AACjC;AACA;AACA,gBAAgB,gBAAW;AAC3B;AACA,YAAY,yBAAgB;;AAE5B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA,QAAQ,gBAAW;AACnB,QAAQ,0BAAqB;AAC7B,QAAQ,0BAAqB;;AAE7B,QAAQ,gBAAW;AACnB,QAAQ,sBAAiB;AACzB,KAAK;;AAEL;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,QAAQ,iBAAY;AACpB,QAAQ,iBAAY;AACpB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+CAAe,GAAG,EAAC;;;;AC7TnB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE0D;;AAE1D;AACA;AACA;AACA;;AAEO;;AAEP;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA,aAAa,mBAAY;AACzB,aAAa,mBAAY;AACzB,aAAa,mBAAY;AACzB,aAAa,mBAAY;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA,uBAAuB,OAAO;AAC9B,0BAA0B,iBAAiB,iBAAiB;AAC5D;AACA,0BAA0B,iBAAiB,iBAAiB;AAC5D;;AAEA;AACA;AACA,CAAC;;AAED,oDAAe,IAAI,E;;;AChhBnB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,MAAM;AACjB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,KAAK;AACf,UAAU,KAAK;AACf;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,UAAU,KAAK;AACf,UAAU,KAAK;AACf;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;;AAGA,oDAAe,IAAI,E;;;;AC5dnB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;AAClB;AACA;AACA;;;AAG1B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,oBAAW;AAC7B,oBAAoB,wBAAe;AACnC,oBAAoB,wBAAe;;AAEnC;AACA,kBAAkB,iBAAQ;AAC1B;AACA,YAAY,mBAAU;AACtB,gBAAgB,oBAAW;AAC3B,gBAAgB,mBAAU;AAC1B,YAAY,uBAAc;AAC1B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,YAAY,mBAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,eAAe,oBAAW;;AAE1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,aAAa,mBAAU;;AAEvB;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,wBAAe;;AAEjC;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,YAAY,kBAAS;;AAErB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,WAAW,iBAAQ;;AAEnB;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,WAAW,iBAAQ;;AAEnB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,aAAa,mBAAU;;AAEvB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA,WAAW,iBAAQ;;AAEnB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,YAAY,kBAAS;;AAErB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA,cAAc,oBAAW;;AAEzB;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA,qBAAqB,2BAAkB;;AAEvC;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,iBAAiB,uBAAc;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC;AACxC;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,oDAAe,IAAI,E;;AC5gBiB;AACA;AACA;AACA;AACJ;;AAEhC;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,YAAO;AAC7B,sBAAsB,YAAO;AAC7B,sBAAsB,YAAO;;AAE7B;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,oBAAW;;AAE5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,yBAAgB;AAC/B,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,qCAA4B;AACpC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,gBAAgB;AAC/B,eAAe,YAAY;AAC3B;AACA;AACA;;AAEA,gBAAgB,oBAAW;AAC3B,gBAAgB,oBAAW;AAC3B,gBAAgB,oBAAW;;AAE3B,iBAAiB,oBAAW;;AAE5B;;AAEA;AACA,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;;AAEpB,qBAAqB,oBAAW;AAChC,qBAAqB,oBAAW;AAChC,qBAAqB,oBAAW;;AAEhC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,YAAY,sBAAa;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,YAAY,sBAAa;AACzB,YAAY,uBAAc;;AAE1B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,IAAI,sBAAc;;AAElB,IAAI,sBAAc;AAClB,QAAQ,aAAK;AACb;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,yBAAgB;AAC3B;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,yBAAgB;AACpB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,qCAA4B;AAChC;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;AC9sBa;AACA;;AAEpC;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,wBAAe;;AAEhC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,wBAAe;AACvB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAsB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,iBAAiB,oBAAW;AAC5B;AACA,YAAY,sBAAa;AACzB;AACA,YAAY,uBAAc;AAC1B,YAAY,sBAAa;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,wBAAe;AACvB;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,0BAAiB;AACzB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,2BAAkB;AACjC,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,IAAI,yBAAc;AAClB;AACA,IAAI,yBAAc;;AAElB,QAAQ,gBAAK;AACb;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,yBAAc,CAAC,gBAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,yBAAc,CAAC,gBAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,yBAAc,CAAC,gBAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,yBAAc,CAAC,gBAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,wBAAe;AACnB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,WAAW,iBAAQ;AACnB;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,0BAAiB;AACrB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,wBAAe;AACnB;AACA;AACA;;AAEA;AACA;AACA,WAAW,gBAAgB;AAC3B,WAAW,aAAa;AACxB,WAAW,OAAO;AAClB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sDAAe,UAAU,EAAC;;;ACrwBM;AACI;;AAEpC,cAAc,iBAAQ;AACtB,eAAe,kBAAS;;AAExB;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA,0BAA0B,YAAO;;AAEjC;AACA;AACA,cAAc;AACd;AACA,0BAA0B,YAAO;;AAEjC;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;;AAEA,4CAA4C,uBAAuB;AACnE,4CAA4C,uBAAuB;AACnE,4CAA4C,uBAAuB;;AAEnE,4CAA4C,uBAAuB;AACnE,4CAA4C,uBAAuB;AACnE,4CAA4C,uBAAuB;AACnE;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,QAAQ,iBAAQ;AAChB,QAAQ,iBAAQ;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,QAAQ,iBAAQ;AAChB,QAAQ,iBAAQ;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,iBAAiB;AACjC,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,iBAAiB;AACjC,gBAAgB;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,iBAAiB;AAChC,eAAe,aAAa;AAC5B;AACA;AACA;AACA,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;;AAE5B;AACA;AACA;;AAEA;;AAEA,kCAAkC,uBAAuB;AACzD,kCAAkC,uBAAuB;;AAEzD,kCAAkC,uBAAuB;AACzD,kCAAkC,uBAAuB;;AAEzD,kCAAkC,uBAAuB;AACzD,kCAAkC,uBAAuB;;AAEzD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC,8BAA8B,wBAAe;AAC7C;;AAEA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uDAAe,WAAW,EAAC;;;ACrTI;AACM;AACM;AACN;AACF;AACU;;AAE7C;;AAEA;AACA;AACA;AACA;AACA,WAAW,gBAAW;AACtB;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;;AAEA;AACA,4BAA4B,YAAO;AACnC;AACA;AACA,4BAA4B,eAAU;AACtC;AACA;AACA,yBAAyB,YAAO;AAChC;;AAEA,8BAA8B,YAAO;AACrC,8BAA8B,YAAO;;AAErC;;AAEA,CAAC;AACD;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,uBAAuB;AAChD;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA,8CAA8C,SAAS;AACvD;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,KAAK;AACpB;AACA;AACA;AACA,8CAA8C,SAAS;AACvD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA,QAAQ,kBAAS;AACjB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA,QAAQ,kBAAS;AACjB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,oBAAW;;AAE7B;AACA;AACA;AACA;AACA;AACA,gBAAgB,oBAAW;AAC3B,gBAAgB,sBAAa;AAC7B,aAAa;AACb,gBAAgB,kBAAS;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,YAAY,qCAA4B;;AAExC,YAAY,mBAAU;;AAEtB;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,4BAAmB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,kBAAS;AACrB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,6CAA6C,SAAS;AACtD;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,SAAS;AACzB,gBAAgB,iBAAiB;AACjC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,gBAAW;AACrC,0BAA0B,YAAO;AACjC,oCAAoC,YAAO;AAC3C;AACA,6BAA6B,gBAAW;AACxC;;AAEA;AACA,gBAAgB,mBAAc;AAC9B;AACA;AACA,gBAAgB,qBAAgB;AAChC;;AAEA;AACA;AACA;AACA,oBAAoB,qBAAgB;AACpC;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAO;AAC9B;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,oBAAoB,YAAO;AAC3B,2BAA2B,YAAO;;AAElC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA,oBAAoB,YAAO;AAC3B;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,CAAC;;AAED,+CAAe,IAAI,EAAC;;;ACzpBM;AACS;;AAEnC;AACA;AACA;AACA;AACA;AACA,iBAAiB,eAAW;AAC5B;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA,UAAU,gBAAgB;;AAE1B;AACA,CAAC;AACD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX;AACA,cAAc;AACd;AACA,cAAc,WAAW;AACzB;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX;AACA,cAAc;AACd;AACA,eAAe,UAAU;;AAEzB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA,mCAAmC;;AAEnC;AACA;AACA,cAAc;AACd;AACA,8CAA8C;;AAE9C;AACA,cAAc,sCAAkC;AAChD;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,6BAAyB;;AAEtD;AACA;;AAEA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA,UAAU;AACV;AACA,oBAAoB,aAAa;AACjC;AACA,UAAU;AACV;AACA,mBAAmB,YAAY;AAC/B;AACA,UAAU;AACV;AACA,uBAAuB,gBAAgB;AACvC;AACA,UAAU;AACV;AACA,wBAAwB,iBAAiB;AACzC;AACA,UAAU;AACV;AACA,uBAAuB,gBAAgB;AACvC;AACA,UAAU;AACV;AACA,4BAA4B,qBAAqB;AACjD;AACA,UAAU;AACV;AACA,0BAA0B,mBAAmB;AAC7C;AACA,UAAU;AACV;AACA,kBAAkB,WAAW;AAC7B;AACA,UAAU;AACV;AACA,mBAAmB,YAAY;AAC/B;AACA,UAAU;AACV;AACA,4BAA4B,qBAAqB;AACjD;AACA,UAAU;AACV;AACA,gBAAgB,SAAS;AACzB;AACA,UAAU;AACV;AACA,iBAAiB,UAAU;;AAE3B,qDAAe,UAAU,EAAC;;;AClNM;AACF;AACQ;AACA;AACA;AACC;AACH;AACA;;AAEpC;AACA;AACA;AACA;AACA,iBAAiB,gBAAW;AAC5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD,oBAAoB,QAAG;AACvB,oBAAoB,YAAO;AAC3B,CAAC;AACD;AACA;;AAEA;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,QAAQ;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,MAAM;AACtB,gBAAgB,QAAQ;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,6BAA6B,cAAU;AACvC;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA,KAAK;;AAEL;;AAEA,qBAAqB,YAAO;AAC5B,qBAAqB,YAAO;AAC5B,qBAAqB,YAAO;AAC5B,sBAAsB,QAAG;AACzB,+BAA+B,YAAO;;AAEtC;;AAEA;AACA;AACA,YAAY,mBAAc;;AAE1B;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oDAAoD,WAAW,6BAA6B,UAAU;AACtG,oDAAoD,YAAY,6BAA6B,SAAS;;AAEtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,8BAA8B;AAC7D;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,0BAA0B;AACzD;AACA;AACA;AACA;AACA,oBAAoB,iBAAQ;AAC5B,mCAAmC,OAAO;AAC1C;AACA,4BAA4B,2BAAkB;AAC9C,4BAA4B,yBAAgB;AAC5C;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,YAAO;AAC5C;AACA,wBAAwB,0BAAqB;AAC7C;AACA;AACA;AACA,wBAAwB,iBAAY;AACpC;AACA;AACA;AACA,wBAAwB,iBAAY;AACpC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB,WAAW,UAAU;AACrB,WAAW,eAAe;AAC1B,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA,yDAAe,UAAU,EAAC;;;ACpQ1B;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,iDAAe,KAAK,EAAC;;;AC5GrB;AACA;AACA;AACA;AAC+B;AACI;AACF;;AAEjC;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAW;AACzB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,UAAU,oBAAoB;AAC9B;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,WAAW,aAAa;AACxB;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,eAAe,2BAA2B;AAC1C;AACA;AACA,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,eAAe,aAAa;AAC5B;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC;AACD,sBAAsB,UAAK;AAC3B,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL,wBAAwB;AACxB,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,kCAAkC;;AAElC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,sBAAsB;AAClD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA,KAAK;AACL;AACA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,8BAA8B,6BAA6B;AAC3D,8BAA8B,4BAA4B;AAC1D;AACA,uBAAuB,cAAc;AACrC;AACA,mCAAmC,2BAA2B;AAC9D,8BAA8B,4BAA4B;AAC1D;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,uBAAuB,QAAQ;AAC/B;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,cAAc;AAC9B;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA,gCAAgC;;AAEhC;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA,UAAU;AACV;AACA,eAAe,WAAW;AAC1B;AACA,UAAU;AACV;AACA,wBAAwB,oBAAoB;AAC5C;AACA,UAAU;AACV;AACA,gBAAgB,YAAY;AAC5B;AACA,UAAU;AACV;AACA,yBAAyB,qBAAqB;AAC9C;AACA,UAAU;AACV;AACA,cAAc,UAAU;AACxB;AACA,UAAU;AACV;AACA,uBAAuB,mBAAmB;AAC1C;AACA,UAAU;AACV;AACA,gBAAgB,YAAY;AAC5B;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA,0BAA0B,sBAAsB;AAChD;AACA,UAAU;AACV;AACA,wBAAwB,oBAAoB;AAC5C;AACA,UAAU;AACV;AACA,gBAAgB,YAAY;AAC5B;AACA,UAAU;AACV;AACA,cAAc,UAAU;AACxB;AACA,UAAU;AACV;AACA,eAAe,WAAW;AAC1B;AACA,UAAU;AACV;AACA,oBAAoB,gBAAgB;AACpC;AACA,UAAU;AACV;AACA,0BAA0B,sBAAsB;;AAEhD;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA,kBAAkB,cAAc;AAChC;AACA,UAAU;AACV;AACA,iBAAiB,aAAa;;AAE9B;AACA;AACA,UAAU;AACV;AACA,iCAAiC,6BAA6B;AAC9D;AACA,UAAU;AACV;AACA,gCAAgC,4BAA4B;AAC5D;AACA,UAAU;AACV;AACA,gCAAgC,4BAA4B;AAC5D;AACA,UAAU;AACV;AACA,+BAA+B,2BAA2B;;AAE1D;AACA;AACA,UAAU;AACV;AACA,iBAAiB,aAAa;AAC9B;AACA,UAAU;AACV;AACA,wBAAwB,oBAAoB;AAC5C;AACA,UAAU;AACV;AACA,0BAA0B,sBAAsB;;;AAGhD,kDAAe,OAAO,EAAC;;;AC9Ze;AACH;;AAEnC;AACA;AACA;AACA;AACA,WAAW,qBAAiB;AAC5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,cAAc;AACd;AACA;;AAEA,kCAAkC,cAAc,EAAE;;AAElD;AACA;AACA,KAAK;;AAEL;AACA,mBAAmB,mCAA+B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,cAAc,aAAa;AAC3B,aAAa,YAAY;AACzB,iBAAiB,gBAAgB;AACjC,kBAAkB,iBAAiB;AACnC,iBAAiB,gBAAgB;AACjC,sBAAsB,qBAAqB;AAC3C,oBAAoB,mBAAmB;;AAEvC,YAAY,WAAW;AACvB,aAAa,YAAY;AACzB,sBAAsB,qBAAqB;AAC3C,UAAU,SAAS;AACnB,WAAW,UAAU;;AAErB,+CAAe,IAAI,EAAC;;;AC9DpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,gDAAe,QAAQ,EAAC;;;ACtBQ;AACG;AACA;AACA;AACnC,mBAAmB,sBAAqB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ,QAAQ;AACR;AACA,gBAAgB,kBAAc;AAC9B;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,kBAAc,mBAAmB,kBAAc;AAC9E;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB,YAAY;AACrC;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,yBAAyB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,yCAAqC;AACjE,+BAA+B,wCAAoC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA,oBAAoB,uBAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,oDAAe,SAAS,EAAC;;;AC3PM;AACI;AACF;AACE;;AAEnC;AACA;AACA,gBAAgB,qBAAgB;AAChC,iBAAiB,sBAAiB;AAClC,iBAAiB,sBAAiB;AAClC,kBAAkB,uBAAkB;AACpC,KAAK,WAAW,wBAAmB;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,gBAAgB;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC,2BAA2B,UAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA,mBAAmB,gBAAW;AAC9B;AACA;AACA;AACA,kBAAkB;AAClB;AACA,sBAAsB;;AAEtB;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA,sBAAsB,UAAK;;AAE3B;;AAEA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,eAAe;AAC9B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA,cAAc,uBAAkB,GAAG,uBAAkB;AACrD;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,kBAAkB;AAC7C,+BAA+B,UAAU;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,0BAA0B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;;AAEA;;AAEA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;;AAEA,+BAA+B,mCAAmC;AAClE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,2BAA2B,kBAAkB;AAC7C,4BAA4B,mBAAmB;AAC/C,2BAA2B,kBAAkB;;AAE7C;AACA;;AAEA;;AAEA,uDAAe,YAAY,EAAC;;;AC3pBO;AACA;AACA;AACU;AACH;;AAE1C,iBAAiB,oBAAW;AAC5B,cAAc,iBAAQ;AACtB,IAAI,gBAAO,GAAG,iBAAQ;;AAEtB,IAAI,kBAAS,GAAG,0BAAsB;;AAEtC;AACA,mHAAmH,kBAAkB;AACrI,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,0DAA0D,uBAAuB,gCAAgC,2BAA2B;AAC5I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,uBAAmB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,0BAA0B,kBAAS;AACnC,2BAA2B,kBAAS;AACpC,2BAA2B,kBAAS;AACpC,wBAAwB,kBAAS;AACjC,yBAAyB,kBAAS;AAClC,uBAAuB,kBAAS;AAChC;AACA;AACA;AACA;AACA,wBAAwB,kBAAS;AACjC,uBAAuB,kBAAS;AAChC;AACA;AACA,6BAA6B,kBAAS;AACtC,SAAS;AACT;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,gBAAW;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;AACpB,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA,oCAAoC,eAAe;AACnD,oCAAoC,eAAe;AACnD,oCAAoC,eAAe;;AAEnD,oCAAoC,eAAe;AACnD,oCAAoC,eAAe;AACnD,oCAAoC,eAAe;AACnD;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oDAAoD,wBAAmB;AACvE;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,gBAAO;AACnB,YAAY,gBAAO;AACnB,YAAY,gBAAO;;AAEnB,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;AACpB,YAAY,mBAAU;AACtB;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,oBAAoB;AAC3C,YAAY,gBAAO;AACnB,YAAY,uBAAc;AAC1B;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,gBAAO;AACnB,YAAY,gBAAO;AACnB,YAAY,gBAAO;;AAEnB,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;AACpB,YAAY,mBAAU;;AAEtB,YAAY,uBAAc;;AAE1B,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;AACA;;AAEA;AACA,YAAY,mBAAU,SAAS,iBAAQ;AACvC,YAAY,iBAAQ;AACpB,YAAY,uBAAc;AAC1B;AACA,YAAY,mBAAU;AACtB;AACA;AACA;AACA;AACA,kCAAkC,iBAAQ;AAC1C;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,uBAAkB;AACjD;;AAEA;AACA;;AAEA;;AAEA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,oBAAoB;AAC3C;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA;;AAEA,+BAA+B,UAAU;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,uDAAuD;AAC9E,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,oBAAW;AAChD,QAAQ,oBAAW;AACnB,QAAQ,uBAAc;;AAEtB,gCAAgC,2BAAkB;AAClD,0BAA0B,qBAAY;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;;AAEA;;AAEA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;;AAEA,+BAA+B,mCAAmC;AAClE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED,uBAAuB,4BAAwB;AAC/C,wBAAwB,6BAAyB;AACjD,uBAAuB,4BAAwB;;AAE/C,2BAA2B,gCAA4B;AACvD,yBAAyB,8BAA0B;;AAEnD,qBAAqB,kBAAS;;AAE9B,mDAAe,QAAQ,EAAC;;;AC3jBxB,8DAAe,2CAA2C,wBAAwB,kaAAka,GAAG,CAAC,EAAC;;;ACAvb;;AAElE;AACA;AACA;AACA;AACA,sCAAsC;AACtC,4CAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI,uBAAsB;AAC1B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,EAAC;;;AC5Ca;AACI;;AAEyB;AACvD,iBAAgB,CAAC,KAAW;;AAE5B;AACA;AACA;AACA;AACA,YAAY,eAAW;AACvB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB,6BAAyB;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,gDAAe,KAAK,EAAC;;;ACtEW;AACI;AACA;AACA;;AAEpC;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,gCAAgC,YAAO;;AAEvC;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA,sBAAsB,YAAO;AAC7B;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,yBAAyB,iBAAQ;AACjC,QAAQ,mBAAU;AAClB;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,sBAAsB,iBAAQ;AAC9B,uBAAuB,OAAO;AAC9B,iBAAiB,iBAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,gBAAgB;AAChB;AACA;AACA,iBAAiB,oBAAW;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAQ;AACpB,YAAY,uBAAc;;AAE1B,0BAA0B,iBAAQ;AAClC;AACA;AACA;AACA;AACA;AACA,0BAA0B,YAAO;AACjC;AACA,qBAAqB,iBAAQ;AAC7B,YAAY,yBAAgB;AAC5B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,+BAA+B,oBAAW;AAC1C,uBAAuB,oBAAW;AAClC,sBAAsB,oBAAW;AACjC;AACA;AACA;AACA;AACA,YAAY,mBAAU;AACtB,YAAY,2BAAkB;AAC9B,4BAA4B,iBAAQ;AACpC;AACA,YAAY,oBAAW;AACvB,YAAY,uBAAc;AAC1B;AACA,YAAY,kBAAS;AACrB,YAAY,2BAAkB;AAC9B,YAAY,kBAAS;AACrB;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAe,KAAK,EAAC;;;ACtKmB;AACZ;;AAEQ;;AAEpC,IAAI,eAAO,GAAG,iBAAQ;AACtB,IAAI,gBAAQ,GAAG,kBAAS;AACxB,uBAAuB,2BAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA,mBAAmB,OAAO;AAC1B,6BAA6B,UAAK;AAClC;;AAEA;AACA;AACA,cAAc;AACd;AACA,2BAA2B,gBAAW;;AAEtC;AACA;AACA,cAAc;AACd;AACA;AACA,mBAAmB,OAAO;AAC1B,2BAA2B,wBAAe;AAC1C;AACA;;AAEA;;AAEA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe;AACf,eAAe;AACf,gBAAgB;AAChB;AACA;;AAEA,sBAAsB,oBAAW;;AAEjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,gBAAQ;AACpB,YAAY,gBAAQ;;AAEpB,2BAA2B,OAAO;AAClC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,mDAAe,OAAO,EAAC;;;ACtLG;AACW;AACA;AACR;;AAEM;AACA;;;AAGnC;AACA;AACA;AACA;AACA,aAAa,eAAW;AACxB;AACA;AACA;AACA,kBAAkB;AAClB;AACA,8BAA8B,YAAO;;AAErC;AACA;AACA,kBAAkB;AAClB;AACA,iCAAiC,YAAO;;AAExC;AACA;AACA,kBAAkB;AAClB;AACA,wBAAwB,YAAO;;AAE/B;AACA;AACA,kBAAkB;AAClB;AACA,qBAAqB,YAAO;AAC5B;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;;AAEA;AACA,QAAQ,8BAA0B;AAClC,QAAQ,mBAAc;;AAEtB;AACA,QAAQ,mBAAc;;AAEtB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,QAAQ,iBAAY;AACpB,QAAQ,mBAAc;AACtB;AACA,KAAK;;AAEL;AACA;AACA;AACA,6CAA6C;;AAE7C;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA,QAAQ,iBAAY;AACpB,QAAQ,mBAAc;AACtB;AACA,KAAK;AACL;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA,iBAAiB,oBAAW;AAC5B;AACA,oDAAoD,QAAG;AACvD;AACA;AACA,YAAY,iBAAQ;AACpB,YAAY,2BAAkB;AAC9B,YAAY,2BAAkB;AAC9B,YAAY,mBAAU;;AAEtB,YAAY,iBAAQ;AACpB,YAAY,2BAAkB;AAC9B,YAAY,2BAAkB;AAC9B,YAAY,mBAAU;AACtB,YAAY,iBAAQ;;AAEpB,YAAY,uBAAc;AAC1B;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED,iDAAe,MAAM,EAAC;;;AC3HI;AACE;AACE;AACe;AACd;AACI;AACD;AACG;;AAErC,eAAe,oBAAW;AAC1B,gBAAgB,oBAAW;;AAE3B,IAAI,qBAAe;;AAEnB,SAAS,mBAAa;AACtB;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;;AAEA,QAAQ,qBAAe;AACvB,eAAe,qBAAe;AAC9B;;AAEA,aAAa,iBAAY;AACzB,IAAI,qBAAe;AACnB;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,aAAa,OAAO;AACpB,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC;;AAEA;AACA;AACA;AACA;AACA,YAAY,eAAW;AACvB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,sCAAsC,gBAAW;;AAEjD;AACA,0BAA0B;;AAE1B;;AAEA;AACA;AACA,0BAA0B;;AAE1B,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,6BAA6B;;AAE7B,2BAA2B;;AAE3B,0BAA0B,QAAQ;;AAElC;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA,4BAA4B,UAAM;AAClC;AACA;AACA;AACA;AACA;AACA,iCAAiC,SAAK;AACtC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,4BAA4B,UAAM;AAClC;AACA;AACA;AACA;AACA;AACA,iCAAiC,SAAK;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8CAA8C,mBAAa;AAC3D;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,oCAAoC;AACpC,eAAe,YAAY;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,uBAAuB,6BAA6B;AACpD;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,4BAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,YAAY;AAC3B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA,qCAAqC,gBAAW;AAChD,gCAAgC,YAAO;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;;AAE1C;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kBAAkB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,qBAAqB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA,gDAAe,KAAK,EAAC;;;AC5iBrB;AACA;AACA;AACA;AACA;AACA,CAAC;AACgB;AACjB,IAAI,cAAU;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACqB;AACtB,IAAI,OAAG;AACP;AACA,yBAAyB,cAAU;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,mDAAe,OAAG,EAAC;;;AC7Ga;AACG;AACJ;AACI;AACA;AACnC,IAAI,wBAAY,GAAG,sBAAqB;;AAExC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ,QAAQ;AACR;AACA,kBAAkB,kBAAc;AAChC;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;AAEA;AACA,kBAAkB;AAClB,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,kBAAkB;AAClB,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB,YAAY;AACrC;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,yBAAyB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,mBAAmB,wBAAY;AAC/B,mBAAmB,wBAAY;AAC/B;AACA;AACA,mBAAmB,wBAAY;AAC/B,mBAAmB,wBAAY;AAC/B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,QAAQ,cAAS;AACjB,wBAAwB,uBAAkB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA,sDAAe,WAAW,EAAC;;;AC7QI;;AAE/B;AACA;AACA;AACA;AACA,kBAAkB,iBAAa;AAC/B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA,qBAAqB,+BAA2B;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,yDAAe,WAAW,EAAC;;;ACzDI;AACC;AACQ;AACL;AACF;;AAEjC;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,kBAAkB;AACvC,sBAAsB,mBAAmB;AACzC,0BAA0B,uBAAuB;AACjD,2BAA2B,wBAAwB;AACnD;AACA;AACA;AACA;AACA,kBAAkB,gBAAW;AAC7B;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,CAAC;AACD;AACA,sBAAsB,UAAK;;AAE3B;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,gCAA4B;AACzE,yEAAyE,uBAAuB,GAAG,iBAAiB;AACpH;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;;AAE5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iEAAiE,+BAA+B;AAChG;;AAEA;AACA;AACA;AACA;AACA,mCAAmC,sBAAsB;AACzD,sCAAsC,oBAAoB;AAC1D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iEAAiE,+BAA+B;AAChG;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA,iCAAiC,yBAAyB;AAC1D,uCAAuC,+BAA+B;;AAEtE,sDAAe,WAAW,EAAC;;;ACvYK;AACM;AACgB;AACb;;AAEzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,yBAAyB,gBAAW;AACpC;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,sBAAsB,YAAO;AAC7B;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C;AACA,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;;AAE5D;AACA,2BAA2B,eAAW;;AAEtC;AACA,CAAC;AACD;AACA,gBAAgB,OAAO;AACvB,iBAAiB;AACjB;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,WAAW;AAC3B,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,OAAO;AAC9B;AACA;AACA,YAAY,iBAAY;;AAExB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA,CAAC;;AAED,qDAAe,kBAAkB,EAAC;;;AC9IC;AACW;;AAE9C;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,IAAI,WAAK,GAAG,mBAAe;AAC3B;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA,2BAA2B,oBAAoB;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,+BAA+B,gBAAW;AAC1C;AACA;AACA;AACA,CAAC;;AAED,qDAAe,WAAK,EAAC;;;ACvEc;AACP;AACU;AACA;AACQ;AACV;;AAEpC,sBAAsB,YAAO;;AAE7B;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA,WAAW,mBAAe;AAC1B;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA,2BAA2B,uBAAkB;AAC7C;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,gBAAW;AAC1C;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;AAEA,oBAAoB,cAAK;AACzB;AACA;AACA,KAAK;;AAEL;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA;AACA;AACA;;AAEA,oDAAe,IAAI,EAAC;;;ACzIpB,kDAAe,oFAAoF,yDAAyD,qCAAqC,+BAA+B,gBAAgB,uDAAuD,2DAA2D,GAAG,mGAAmG,2DAA2D,4CAA4C,iCAAiC,+BAA+B,wFAAwF,oCAAoC,gDAAgD,iDAAiD,4CAA4C,8CAA8C,gEAAgE,+HAA+H,kEAAkE,oEAAoE,sEAAsE,2DAA2D,0DAA0D,GAAG,OAAO,EAAC;;;ACAj7C;AAC2B;AACiB;AACb;AACI;AACF;AACqB;AAChB;;AAEmB;AACzD,iBAAa,CAAC,WAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA,aAAa,eAAW;;AAExB,2BAA2B,UAAM;AACjC,gBAAgB,iBAAa;AAC7B,kBAAkB,iBAAa;AAC/B,KAAK;AACL,uBAAuB,YAAQ;AAC/B;AACA;AACA,KAAK;;AAEL;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA,sBAAsB,aAAY;;AAElC;;AAEA;;AAEA;;AAEA,0BAA0B,kBAAiB;AAC3C;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA,+BAA+B,kBAAc;AAC7C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAc;AACtB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,oDAAe,MAAM,EAAC;;;ACrJQ;;AAE9B,8CAAe,aAAM,E;;ACFY;AACI;AACI;;AAEzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,wCAAoC;AACrE;AACA;AACA;AACA,iCAAiC,yCAAqC;AACtE;AACA;AACA;AACA,iCAAiC,yCAAqC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA,aAAa;AACb;AACA,2BAA2B,iBAAiB;AAC5C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAAe,GAAG,EAAC;;;AC3Jc;AACI;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,UAAU;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,OAAO;AAC7D;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,IAAI,OAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,WAAW;AAClC;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,aAAS;AACnC;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAa;AACpC;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA,0CAAe,OAAG,EAAC;;;AChLkB;AACI;AACL;AACuB;AACnB;AACX;;AAEL;AACA;;AAExB;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,SAAS;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,wBAAwB,aAAa;AACrC;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,wBAAwB,SAAS;AACjC;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,eAAW;AACrC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,OAAO;AACvB,gBAAgB,iBAAiB;AACjC,gBAAgB,OAAO;AACvB,gBAAgB,QAAQ;AACxB,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,SAAS;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,eAAe;AAC/B,gBAAgB,iBAAiB;AACjC,gBAAgB,OAAO;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA,qCAAqC,cAAkB;AACvD,0BAA0B,OAAO;AACjC,uBAAuB,SAAK;AAC5B,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,mCAAmC;AAClD,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,mCAAmC;AAClD,eAAe,QAAQ;AACvB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,QAAQ,uBAAkB;AAC1B;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,YAAY;AACnC,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,aAAS;AACnC;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,aAAS;AACnC;AACA,SAAS;;AAET;AACA;AACA;;AAEA,mDAAe,WAAW,EAAC;;;ACvT3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAE6C;AACC;AACA;;AAE9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA;AACA;AACA,wBAAwB,aAAS;AACjC;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,oCAAgC;AAC5C;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB,eAAe,eAAe;AAC9B,eAAe,kBAAkB;AACjC;AACA;;AAEA,qBAAqB,YAAO;AAC5B,qBAAqB,YAAO;AAC5B,qBAAqB,YAAO;AAC5B,sBAAsB,YAAO;AAC7B,sBAAsB,YAAO;AAC7B,sBAAsB,YAAO;AAC7B,qBAAqB,YAAO;;AAE5B,yBAAyB,YAAO;;AAEhC;AACA;AACA;AACA;AACA,sBAAsB,gBAAW;AACjC,wBAAwB,kBAAa;;AAErC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,kBAAa;AACzB,YAAY,wBAAmB;AAC/B,YAAY,wBAAmB;;AAE/B;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,0DAAe,cAAc,E;;AChLE;AAC/B;AACA;AACA;AACA;AACA,mBAAmB,iBAAa;AAChC;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA,qBAAqB,+BAA2B;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,0DAAe,YAAY,EAAC;;;ACjE5B,kDAAe,0FAA0F,qCAAqC,uCAAuC,0BAA0B,gBAAgB,yBAAyB,2DAA2D,GAAG,OAAO,EAAC;;;ACA9R;AACiB;AACX;AACP;AACI;AACR;AACS;AACgC;;AAEpE,iBAAgB,CAAC,WAAU;;AAE3B,mBAAmB,cAAK;AACxB,eAAe,QAAI;AACnB;AACA;AACA,CAAC;AACD,iBAAiB,mBAAW;;AAE5B;AACA;AACA;AACA;AACA,WAAW,gBAAW;AACtB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;;AAED,qBAAqB,UAAM,CAAC,iBAAa;AACzC,uBAAuB,YAAQ;AAC/B;AACA,KAAK;AACL;;AAEA;;AAEA,CAAC;AACD;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA,mCAAmC,wBAAwB;AAC3D;AACA,KAAK;AACL;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,iBAAiB;AACjC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA,CAAC;;AAED,sDAAe,IAAI,EAAC;;;AC3MpB,yDAAe,+FAA+F,yCAAyC,qCAAqC,mDAAmD,iEAAiE,kEAAkE,gFAAgF,iDAAiD,sCAAsC,+DAA+D,GAAG,wDAAwD,yCAAyC,2CAA2C,2CAA2C,oBAAoB,GAAG,eAAe,4CAA4C,oBAAoB,0BAA0B,UAAU,+BAA+B,aAAa,aAAa,iBAAiB,iBAAiB,kBAAkB,mBAAmB,OAAO,2EAA2E,2BAA2B,oCAAoC,oCAAoC,0CAA0C,mBAAmB,0CAA0C,uCAAuC,kCAAkC,2BAA2B,mBAAmB,IAAI,IAAI,6DAA6D,GAAG,GAAG,EAAC;;;ACA3/C,qDAAe,gIAAgI,qCAAqC,uCAAuC,gCAAgC,0BAA0B,+BAA+B,yFAAyF,kEAAkE,gFAAgF,iDAAiD,sCAAsC,+DAA+D,GAAG,eAAe,oCAAoC,gDAAgD,cAAc,qCAAqC,2BAA2B,iDAAiD,kBAAkB,mBAAmB,OAAO,8EAA8E,2BAA2B,0CAA0C,mBAAmB,2EAA2E,sBAAsB,IAAI,IAAI,uEAAuE,GAAG,GAAG,EAAC;;;ACAnyC;AACA;AACA;AACqC;AACI;AACR;AACQ;AACH;AACH;AACJ;AACO;AACT;AAC8B;AACvB;AACA;;AAEiC;AACV;;AAE3D;;AAEA,IAAI,eAAO;;AAEX;AACA;AACA;AACA,YAAY,cAAc;AAC1B,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,eAAe;AAC3B,YAAY,eAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,iCAAiC,eAAW;AAC5C;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA,gCAAgC,YAAQ;AACxC,oBAAoB,UAAM;AAC1B,oBAAoB,iBAAa;AACjC,sBAAsB,cAAiB;AACvC,SAAS;AACT,KAAK;AACL;;AAEA;AACA;;AAEA,yBAAyB,SAAK;AAC9B;;AAEA;AACA;AACA,6BAA6B,eAAW;AACxC;AACA;AACA;AACA,kCAAkC,iBAAa;AAC/C,gBAAgB,sBAAkB;AAClC,SAAS;AACT,QAAQ,8BAA6B;AACrC;AACA;AACA,SAAS;AACT;AACA;AACA,iBAAiB,aAAM;AACvB;AACA;AACA,KAAK;AACL;;AAEA,yBAAyB,cAAkB;AAC3C;AACA,KAAK;;AAEL;AACA;AACA,gDAAgD,yBAAqB;AACrE;;AAEA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA,KAAK;AACL,0BAA0B,eAAW;AACrC;AACA,KAAK;AACL,oBAAoB,WAAM,iBAAiB,yBAAqB;AAChE,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,KAAK,eAAO,QAAQ;AAC3C;AACA;AACA;;AAEA,8CAA8C,eAAO;AACrD;AACA;AACA;AACA;AACA,gBAAgB,gBAAY;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,mBAAmB;AACjD;AACA;AACA;AACA;;AAEA;AACA,iDAAiD,eAAO;AACxD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,eAAW;AACrC;AACA,KAAK;AACL,mBAAmB,eAAI;AACvB,kBAAkB,kBAAuB;AACzC,KAAK;;AAEL,sBAAsB,aAAS;AAC/B;AACA;AACA,cAAc,sBAAkB;AAChC,eAAe,yBAAqB;AACpC,eAAe,yBAAqB;AACpC,mBAAmB,mBAAe;AAClC,mBAAmB,mBAAe;AAClC;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,aAAS;AAC1C;AACA;AACA,cAAc,iBAAa;AAC3B,mBAAmB,mBAAe;AAClC,mBAAmB,mBAAe;AAClC,eAAe,yBAAqB;AACpC,eAAe,yBAAqB;AACpC;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;AACA;;AAEA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,mDAAe,WAAW,EAAC;;;AC9R3B;AAC6B;AACa;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,gBAAY;;AAEtC;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC;;AAED;;AAEA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,uCAAsC;AAC7E,+BAA+B,0BAAyB;AACxD;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,oCAAmC;AACxD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED,qDAAe,mBAAmB,EAAC;;;AClGN;AACO;;AAEpC;AACA;AACA;AACA;AACA;AACA,qBAAqB,gBAAY;;AAEjC;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA,CAAC;AACD,mCAAmC,wBAAmB;AACtD,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,+BAA+B,kCAAkC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED,gDAAe,cAAc,EAAC;;;ACtD9B,yDAAe,oCAAoC,0BAA0B,mGAAmG,2EAA2E,0EAA0E,2EAA2E,wEAAwE,0EAA0E,+BAA+B,mCAAmC,sBAAsB,sBAAsB,sBAAsB,gBAAgB,cAAc,IAAI,qBAAqB,YAAY,IAAI,qBAAqB,YAAY,IAAI,qBAAqB,YAAY,IAAI,qBAAqB,cAAc,IAAI,qBAAqB,cAAc,IAAI,qBAAqB,cAAc,IAAI,qBAAqB,wBAAwB,IAAI,QAAQ,oBAAoB,IAAI,GAAG,8BAA8B,2BAA2B,uBAAuB,kBAAkB,iCAAiC,OAAO,gDAAgD,qCAAqC,qFAAqF,kDAAkD,mCAAmC,6DAA6D,wDAAwD,wBAAwB,IAAI,2BAA2B,GAAG,gBAAgB,yJAAyJ,oCAAoC,GAAG,CAAC,EAAC;;;ACA1wD;AACiC;AACQ;AACJ;AACC;AACF;AACE;AACE;AACmB;AAC9B;AACO;AACpC;;AAEqE;;AAErE,IAAI,UAAO;;AAEX;AACA;AACA,wBAAwB,aAAS;AACjC;AACA;AACA,cAAc,iBAAa;AAC3B,KAAK;AACL,mBAAmB,eAAI;AACvB,kBAAkB,kBAAuB;AACzC,KAAK;AACL;AACA;;AAEA,0BAA0B,eAAW;AACrC;AACA;;AAEA;AACA;AACA,qBAAqB,wBAAmB;AACxC,uCAAuC,gBAAY,EAAE,iBAAa;;AAElE,oBAAoB,wBAAmB;AACvC,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,wBAAmB;AACvC,iBAAiB,oBAAW;AAC5B,gBAAgB,oBAAW;AAC3B,sBAAsB,oBAAW;AACjC,mBAAmB,OAAO;AAC1B,qBAAqB,oBAAW;AAChC,uBAAuB,KAAK,UAAO,QAAQ;AAC3C,oCAAoC,UAAO;;AAE3C,6BAA6B,oBAAW;AACxC;AACA;AACA,4CAA4C,UAAO;AACnD,2BAA2B,YAAY;AACvC,+BAA+B,WAAW;;AAE1C;AACA;AACA;AACA;AACA,oBAAoB,uBAAc;;AAElC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,yBAAgB;AACpC;AACA;AACA;AACA;AACA,YAAY,yBAAgB;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,yBAAyB,SAAK;AAC9B;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,qBAAqB,aAAM;AAC3B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,0BAA0B,aAAS;AACnC;AACA;AACA,KAAK;AACL,0BAA0B,eAAW;AACrC;AACA;AACA;AACA;AACA;AACA,yBAAyB,cAAkB;AAC3C;AACA,KAAK;AACL;AACA,mBAAmB,KAAK,UAAO,QAAQ;AACvC,mBAAmB,UAAO;AAC1B,0CAA0C,UAAO;AACjD;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,gBAAY,EAAE,yBAAqB,aAAa,UAAO;AACnE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,8CAAe,EAAE,EAAC;;;ACvN6B;;AAE/C;;AAEA;AACA,+CAA+C,SAAS;AACxD;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,yBAAyB;AACxC,eAAe,OAAO;AACtB;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,8BAAoB;AACvC,kBAAkB,0BAAgB;AAClC;AACA,iBAAiB;AACjB;AACA;AACA;AACA,mBAAmB,8BAAoB;AACvC,kBAAkB,0BAAgB;AAClC;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA,oDAAe,QAAQ,E;;ACvCY;AACW;;AAE9C;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,aAAa,mBAAe;AAC5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC,uBAAuB,oBAAoB;AAC3C;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA2B,YAAY;AACvC,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,mBAAmB,oBAAoB;AACvC,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,gBAAW;AAC1C;AACA;AACA;AACA,CAAC;;AAED,sDAAe,MAAM,EAAC;;;AC1IO;;AAE7B;AACA;AACA;AACA;AACA,mBAAmB,gBAAY;;AAE/B;;AAEA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED,8CAAe,YAAY,EAAC;;;AChCC;AACS;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,uBAAuB,gBAAY;AACnC;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA,uDAAuD,YAAO;AAC9D;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB,8BAA0B;AAC9C;AACA;AACA;AACA;AACA,CAAC;;AAED,kDAAe,gBAAgB,EAAC;;;ACvEH;;AAE7B;AACA;AACA;AACA;AACA,iBAAiB,gBAAY;AAC7B;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB,8BAA0B;AAC9C;AACA;AACA;AACA,CAAC;;AAED,4CAAe,UAAU,EAAC;;;ACrDG;AACS;;AAEtC;AACA;AACA;AACA;AACA,gBAAgB,gBAAY;AAC5B;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,uDAAuD,YAAO;AAC9D;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB,8BAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,2CAAe,SAAS,EAAC;;;ACpGW;;AAEpC;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,wBAAe;;AAEhC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAsB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,kBAAS;AACxB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,sBAAa;AAC5B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;AACL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,qBAAY;AAC3B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,6BAAoB;AACnC,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,2BAAkB;AACjC,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,IAAI,sBAAc;AAClB;AACA,IAAI,sBAAc;;AAElB,QAAQ,aAAK;AACb;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,sBAAa;AACxB;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,iBAAQ;AACnB;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,yBAAgB;AACpB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,qBAAY;AACvB;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;;;AC5sBvB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,oDAAe,IAAI,E;;AChQiB;;AAEpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,oBAAW;;AAE5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,yBAAgB;AAC/B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,yBAAgB;AAC3B;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;;AC7RvB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,KAAK;AAChB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,KAAK;AAChB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;;AAGA,qDAAe,KAAK,E;;ACvPkB;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,qBAAY;;AAE7B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,0BAAiB;AAChC,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,wBAAe;AACvB;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,WAAW,0BAAiB;AAC5B;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,wBAAe;AACnB;AACA;AACA;;AAEA,oDAAe,QAAQ,EAAC;;;AC5QY;;AAEpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,oBAAW;;AAE5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,yBAAgB;AAC/B,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA,QAAQ,4BAAmB;AAC3B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,yBAAgB;AAC3B;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,4BAAmB;AACvB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;AC3YvB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAe,MAAM,EAAC;;;AClMa;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,qDAAe,IAAI,EAAC;;;AC7DU;AAC9B,IAAI,oBAAc;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAY;AACrB;AACA;AACA;AACA,SAAS,mBAAa;AACtB;AACA;AACA;AACA,SAAS,mBAAa;AACtB;AACA;AACA,SAAS,iBAAW;AACpB;AACA;AACA,eAAe,kBAAY;AAC3B;AACA,WAAW,kBAAY;AACvB;AACA,SAAS,mBAAa;AACtB;AACA;AACA,eAAe,mBAAa;AAC5B;AACA,WAAW,mBAAa;AACxB;AACA,SAAS,iBAAW;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gBAAU;AACnB;AACA;AACA,SAAS,aAAO;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAQ;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAU,OAAO,YAAG;AACxB,IAAI,oBAAc;AAClB,SAAS,gBAAU;AACnB,QAAQ,oBAAc;AACtB,QAAQ,cAAQ,CAAC,oBAAc;AAC/B;AACA,IAAI,oBAAc,GAAG,gBAAU,eAAe,oBAAc;AAC5D;AACO;AACP;AACA;AACA;AACA;AACA,iBAAiB,gBAAU;AAC3B;AACA,eAAe,cAAQ;AACvB;AACA;AACA;AACA,eAAe,oBAAc;AAC7B,QAAQ,cAAQ,UAAU,oBAAc;AACxC,QAAQ,gBAAU;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAO;AACvB;AACA;AACA,YAAY,aAAO;AACnB,YAAY,gBAAU;AACtB;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAO;AACvB;AACA;AACA,YAAY,aAAO;AACnB,YAAY,gBAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,aAAO;AACjC,0BAA0B,aAAO;AACjC;AACA,wBAAwB,mBAAa;AACrC;AACA;AACA,oBAAoB,aAAO;AAC3B;AACA;AACA,gBAAgB,aAAO,UAAU,iBAAW,aAAa,iBAAW,aAAa,iBAAW;AAC5F,gBAAgB,gBAAU;AAC1B;AACA;AACA;AACA,oBAAoB,aAAO;AAC3B;AACA;AACA,4BAA4B,mBAAa;AACzC,gBAAgB,eAAS;AACzB,gBAAgB,gBAAU;AAC1B;AACA;AACA;AACA,oBAAoB,aAAO;AAC3B;AACA;AACA,gBAAgB,eAAS;AACzB,gBAAgB,gBAAU;AAC1B;AACA;AACA;AACA;AACA;AACA,IAAI,aAAO;AACX;AACA;AACA,SAAS,eAAS;AAClB;AACA,YAAY,mBAAa;AACzB,YAAY,mBAAa;AACzB;AACA;AACA;AACA,IAAI,aAAO,OAAO,kBAAY,CAAC,iBAAW,4BAA4B,kBAAY,CAAC,iBAAW,oBAAoB,kBAAY,CAAC,iBAAW;AAC1I;AACA;AACA;AACA;AACA;AACA,SAAS,eAAS;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,kBAAY,CAAC,gBAAU;AACpC,aAAa,kBAAY,CAAC,gBAAU;AACpC,aAAa,kBAAY,CAAC,gBAAU;AACpC,aAAa,mBAAa,CAAC,gBAAU;AACrC;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kBAAY,CAAC,gBAAU;AAC/B,QAAQ,kBAAY,CAAC,gBAAU;AAC/B,QAAQ,kBAAY,CAAC,gBAAU;AAC/B,QAAQ,mBAAa,CAAC,gBAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA,mBAAmB,eAAS;AAC5B,oCAAoC,mBAAa;AACjD,oCAAoC,mBAAa;AACjD,oCAAoC,mBAAa;AACjD,yBAAyB,eAAS;AAClC;AACA;AACO;AACP;AACA;AACA,sBAAsB,mBAAa;AACnC;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;;ACpZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,kBAAa;AACjB;AACA;AACA;AACA,gCAAgC,EAAE;AAClC;AACA;AACO;AACP;AACA;AACA;AACO,SAAS,SAAI;AACpB;AACA;AACO;AACP;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,SAAS;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,SAAS;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,kDAAkD,SAAS;AAC3D;AACA;AACA;AACA;AACO,SAAS,WAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAQ;AACxB;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,2CAA2C,SAAS;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,aAAQ;AAChB;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,uCAAuC,kBAAa;AACpD;AACA;AACA;AACA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACiB;AACV;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO,SAAS,kBAAQ;AACxB;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACkB;AACZ;AACP;AACA;AACO;AACP;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA,QAAQ,WAAM;AACd;AACA;AACA;AACO;AACP;AACA;AACO,SAAS,SAAI,IAAI;;;AC5eE;AACa;AACoB;AAC3D;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACO;AACP;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,aAAa;AAC9C;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,UAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACO;AACP,QAAQ,WAAW;AACnB;AACA,YAAY,WAAW;AACvB;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,KAAW;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,eAAe;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,IAAI;AAClD;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,wBAAwB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,cAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,8BAA8B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,mBAAmB;AACtD;AACA;AACA;AACA;AACA,uCAAuC,wBAAwB;AAC/D;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,IAAI;AACrC,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,yDAAe,QAAQ,EAAC;;;ACvuB8B;;AAEtD;;AAEA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,oDAAoD,OAAO;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,2BAA2B,kBAAQ;AACnC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;;AAEA,2DAAe,eAAe,E;;AC5F9B,gDAAe,sDAAsD,6DAA6D,2EAA2E,6BAA6B,GAAG,uFAAuF,oDAAoD,2BAA2B,6CAA6C,mCAAmC,6CAA6C,2BAA2B,qCAAqC,8BAA8B,uCAAuC,GAAG,4GAA4G,kCAAkC,6DAA6D,qCAAqC,GAAG,yCAAyC,cAAc,GAAG,yFAAyF,2EAA2E,oEAAoE,uCAAuC,8BAA8B,cAAc,GAAG,iFAAiF,2FAA2F,gCAAgC,GAAG,+KAA+K,oCAAoC,GAAG,iFAAiF,kCAAkC,oBAAoB,IAAI,aAAa,kBAAkB,4EAA4E,yCAAyC,6BAA6B,eAAe,GAAG,2HAA2H,wFAAwF,uBAAuB,WAAW,+BAA+B,iFAAiF,uBAAuB,WAAW,kEAAkE,qKAAqK,GAAG,oCAAoC,sJAAsJ,GAAG,4FAA4F,+BAA+B,mFAAmF,gDAAgD,gDAAgD,uBAAuB,6CAA6C,sDAAsD,8CAA8C,mMAAmM,GAAG,iCAAiC,kDAAkD,GAAG,4DAA4D,iCAAiC,+BAA+B,GAAG,8GAA8G,yBAAyB,qDAAqD,GAAG,yBAAyB,qDAAqD,GAAG,iDAAiD,wBAAwB,oDAAoD,GAAG,6FAA6F,8BAA8B,8BAA8B,2OAA2O,4HAA4H,qCAAqC,sCAAsC,qCAAqC,0DAA0D,oCAAoC,4CAA4C,0CAA0C,GAAG,4GAA4G,uDAAuD,0EAA0E,iEAAiE,mDAAmD,GAAG,mEAAmE,wBAAwB,wBAAwB,wBAAwB,wBAAwB,wBAAwB,oEAAoE,GAAG,OAAO,EAAC;;;ACA17K,kDAAe,iGAAiG,6DAA6D,6BAA6B,6EAA6E,uCAAuC,iCAAiC,4EAA4E,qCAAqC,2CAA2C,2CAA2C,4BAA4B,gCAAgC,mFAAmF,gEAAgE,yEAAyE,gCAAgC,6EAA6E,8EAA8E,gEAAgE,0GAA0G,gEAAgE,mFAAmF,yEAAyE,oHAAoH,6BAA6B,gEAAgE,6BAA6B,yJAAyJ,2GAA2G,kDAAkD,sDAAsD,uBAAuB,kCAAkC,0EAA0E,gDAAgD,GAAG,gEAAgE,uBAAuB,kCAAkC,0EAA0E,qCAAqC,GAAG,+JAA+J,uCAAuC,2DAA2D,yGAAyG,IAAI,gHAAgH,gCAAgC,wEAAwE,iCAAiC,iCAAiC,8DAA8D,0EAA0E,0EAA0E,kCAAkC,gCAAgC,wBAAwB,kCAAkC,gCAAgC,mCAAmC,qDAAqD,oDAAoD,KAAK,6HAA6H,yBAAyB,2BAA2B,6HAA6H,+EAA+E,mEAAmE,IAAI,4HAA4H,yBAAyB,2BAA2B,iIAAiI,iEAAiE,6CAA6C,6BAA6B,qDAAqD,0BAA0B,IAAI,IAAI,yHAAyH,4BAA4B,wBAAwB,0IAA0I,gDAAgD,8BAA8B,sBAAsB,4GAA4G,mCAAmC,oEAAoE,oGAAoG,iKAAiK,4DAA4D,iKAAiK,8DAA8D,iPAAiP,gCAAgC,YAAY,kDAAkD,+DAA+D,sDAAsD,qFAAqF,+DAA+D,KAAK,qHAAqH,iCAAiC,cAAc,gGAAgG,sDAAsD,4DAA4D,yDAAyD,KAAK,mBAAmB,EAAC;;;ACA3oN,iDAAe,qFAAqF,0EAA0E,oCAAoC,sGAAsG,uBAAuB,iEAAiE,8BAA8B,qEAAqE,6DAA6D,wBAAwB,0BAA0B,4EAA4E,8BAA8B,gEAAgE,4EAA4E,8GAA8G,0DAA0D,+IAA+I,8BAA8B,8CAA8C,yEAAyE,yBAAyB,0BAA0B,wBAAwB,sDAAsD,kLAAkL,0DAA0D,+BAA+B,0DAA0D,uHAAuH,0IAA0I,iDAAiD,uGAAuG,OAAO,EAAC;;;ACA3oE,mDAAe,oQAAoQ,uBAAuB,oFAAoF,+BAA+B,kBAAkB,qIAAqI,yEAAyE,kDAAkD,4CAA4C,wDAAwD,8OAA8O,+BAA+B,iCAAiC,8BAA8B,8EAA8E,8CAA8C,2CAA2C,yEAAyE,yBAAyB,0BAA0B,6RAA6R,4NAA4N,0DAA0D,+BAA+B,6FAA6F,mCAAmC,gIAAgI,uBAAuB,yDAAyD,gDAAgD,2BAA2B,UAAU,IAAI,uCAAuC,0EAA0E,oCAAoC,0EAA0E,6CAA6C,oFAAoF,yBAAyB,SAAS,6DAA6D,IAAI,4DAA4D,gCAAgC,cAAc,mFAAmF,KAAK,4IAA4I,wBAAwB,wEAAwE,IAAI,yBAAyB,6BAA6B,SAAS,uDAAuD,8CAA8C,+BAA+B,yEAAyE,wCAAwC,IAAI,2EAA2E,uDAAuD,IAAI,8CAA8C,0IAA0I,iDAAiD,qGAAqG,SAAS,EAAC;;;ACAxgI,qDAAe,kPAAkP,uBAAuB,uEAAuE,yBAAyB,2BAA2B,gFAAgF,+BAA+B,kBAAkB,qIAAqI,yEAAyE,kDAAkD,4CAA4C,mHAAmH,mEAAmE,0DAA0D,kTAAkT,2EAA2E,+BAA+B,iCAAiC,gCAAgC,iCAAiC,iCAAiC,8EAA8E,8CAA8C,kCAAkC,gCAAgC,2CAA2C,yEAAyE,yBAAyB,0BAA0B,8nBAA8nB,oDAAoD,GAAG,uCAAuC,4BAA4B,wCAAwC,GAAG,kBAAkB,4BAA4B,sCAAsC,gDAAgD,kFAAkF,kCAAkC,+HAA+H,yBAAyB,yGAAyG,6CAA6C,8CAA8C,2CAA2C,mDAAmD,+BAA+B,+GAA+G,6CAA6C,+BAA+B,gDAAgD,UAAU,IAAI,uCAAuC,0EAA0E,oCAAoC,wHAAwH,kCAAkC,iCAAiC,4CAA4C,iDAAiD,wFAAwF,6BAA6B,cAAc,gEAAgE,KAAK,8DAA8D,gCAAgC,cAAc,kFAAkF,KAAK,8IAA8I,wBAAwB,wEAAwE,IAAI,6BAA6B,iCAAiC,cAAc,8CAA8C,0CAA0C,+BAA+B,qDAAqD,0CAA0C,+BAA+B,yEAAyE,4CAA4C,IAAI,gDAAgD,uBAAuB,sDAAsD,KAAK,2EAA2E,0DAA0D,2CAA2C,8BAA8B,uFAAuF,8DAA8D,kBAAkB,qBAAqB,qCAAqC,cAAc,gGAAgG,iFAAiF,KAAK,6EAA6E,kCAAkC,0IAA0I,iDAAiD,2EAA2E,qGAAqG,SAAS,EAAC;;;ACA91M,oDAAe,sOAAsO,+BAA+B,8CAA8C,iDAAiD,2CAA2C,qRAAqR,uOAAuO,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,gCAAgC,iCAAiC,wBAAwB,8BAA8B,4BAA4B,wDAAwD,IAAI,2BAA2B,oEAAoE,IAAI,wCAAwC,8EAA8E,IAAI,6CAA6C,kFAAkF,IAAI,6CAA6C,kFAAkF,IAAI,6CAA6C,kFAAkF,IAAI,wBAAwB,qEAAqE,IAAI,gBAAgB,GAAG,gDAAgD,kBAAkB,2DAA2D,gCAAgC,yFAAyF,+BAA+B,wCAAwC,yDAAyD,gDAAgD,2BAA2B,UAAU,IAAI,8BAA8B,+BAA+B,0EAA0E,oCAAoC,0EAA0E,oFAAoF,yBAAyB,SAAS,6DAA6D,IAAI,4DAA4D,gCAAgC,cAAc,mFAAmF,KAAK,4IAA4I,wBAAwB,wEAAwE,IAAI,yBAAyB,6BAA6B,SAAS,uDAAuD,sDAAsD,+BAA+B,yEAAyE,wCAAwC,IAAI,2EAA2E,8CAA8C,IAAI,oFAAoF,IAAI,SAAS,EAAC;;;ACAtxH,kDAAe,wFAAwF,uCAAuC,uCAAuC,yDAAyD,8BAA8B,wCAAwC,0BAA0B,gBAAgB,8EAA8E,8BAA8B,mEAAmE,gCAAgC,2BAA2B,KAAK,uFAAuF,EAAC;;;ACAloB;AACQ;AACE;AACJ;AACF;AACI;AACN;AACM;AACI;AACV;AACO;AACM;AACJ;AACoB;AACV;AAChB;AACN;;AAEsB;AACF;AACF;;AAEA;AACQ;AACZ;AACF;;AAEgB;AACE;;AAEhE;AAC8C;AACA;AACA;;AAEM;;AAEN;AACE;AACF;AACA;;AAEJ;AACJ;AACgB;AACR;;AAEE;AAChD;;AAE6D;AACA;AACZ;AACF;AACI;AACI;AACF;AACJ;;AAEjD,cAAc,kBAAgB,EAAE,oBAAe;;AAE/C,iBAAa,CAAC,SAAQ;AACtB,iBAAa,CAAC,SAAQ;AACtB,iBAAa,CAAC,WAAU;AACxB,iBAAa,CAAC,UAAS;AACvB,iBAAa,CAAC,YAAW;AACzB,iBAAa,CAAC,cAAa;AAC3B,iBAAa,CAAC,aAAY;AAC1B,iBAAa,CAAC,WAAU;;AAExB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,oBAAoB,8BAA0B;AAC9C,yBAAyB,mCAA+B;;AAExD,8BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,mCAA+B;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,WAAW,OAAO;AAClB,WAAW,0CAA0C;AACrD,WAAW,4BAA4B;AACvC,WAAW,OAAO;AAClB;AACA,sCAAkC;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,qBAAqB,YAAQ;;AAE7B,iBAAiB,QAAM;;AAEvB,iBAAiB,QAAI;;AAErB,mBAAmB,UAAM;;AAEzB,qBAAqB,YAAQ;;AAE7B,oBAAoB,WAAO;;AAE3B,sBAAsB,aAAS;;AAE/B;AACA,qBAAqB,YAAQ;AAC7B,2BAA2B,eAAc;AACzC,0BAA0B,cAAa;AACvC,yBAAyB,aAAY;;AAErC;AACA,yBAAyB,OAAY;AACrC,6BAA6B,WAAgB;AAC7C,uBAAuB,KAAU;AACjC,sBAAsB,IAAS;;AAE/B;AACA,8BAA8B,kBAAiB;AAC/C,+BAA+B,mBAAkB;;AAEjD;AACA,oBAAoB,YAAO;AAC3B,oBAAoB,YAAO;AAC3B,oBAAoB,YAAO;;AAE3B,uBAAuB,eAAU;;AAEjC,oBAAoB,YAAO;AAC3B,qBAAqB,aAAQ;AAC7B,oBAAoB,YAAO;AAC3B,oBAAoB,YAAO;;AAE3B,kBAAkB,UAAK;AACvB,gBAAgB,QAAG;AACnB,wBAAwB,gBAAW;AACnC,oBAAoB,YAAO;;AAE3B;;AAEA,iBAAiB,wBAAuB;;;AAGxC,SAAS,2BAAiB;AAC1B;AACA;AACA,SAAS,oCAA0B;AACnC,2BAA2B,kBAAc,sBAAsB,kBAAc;AAC7E;AACA,oBAAoB,2BAAiB;AACrC,qBAAqB,2BAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0CAA0C;AACrD,WAAW,4BAA4B;AACvC,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;;AAEA,sEAAsE,YAAQ;;AAE9E;AACA;AACA;AACA;AACA,8BAA8B,mBAAc;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;;AAEA,YAAY,oCAA0B;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wBAAuB;AACrD;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,+BAA+B,iBAAiB;AAChD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,oCAA0B;;AAE9C;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO,EAAE;AACrB;AACA;AACA;AACA;AACA,mBAAmB,0BAAqB;;AAExC,6BAA6B,cAAmB;AAChD,mBAAmB,0BAAqB;AACxC,KAAK;AACL,wBAAwB,SAAc;AACtC,mBAAmB,0BAAqB;AACxC;AACA,KAAK;;;AAGL;AACA;AACA,KAAK;AACL;AACA;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA,iCAAiC,6BAA4B;AAC7D;AACA,SAAS;;AAET;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,wBAAuB;;AAEtD;AACA;AACA,WAAW;AACX,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,WAAW,sBAAsB;AACjC,WAAW,eAAe;AAC1B,YAAY,eAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,WAAW,6BAAmB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA,0BAA0B,iBAAa;AACvC,4BAA4B,iBAAa;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,UAAM;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAQ;AAC/B;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,2BAA2B;AACtC,WAAW,4BAA4B;AACvC;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,0BAAqB;AACxC,mBAAmB,0BAAqB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,0BAAqB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,0BAAqB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qDAAe,SAAS,E;;ACrqBxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAe,qBAAqB,EAAC;;;ACRrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE+C;AACJ;AACY;AACd;AACC;;AAE1C;AACsD;AAC0B;;AAEhF;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,uBAAuB;AAClC;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA,4BAA4B,YAAQ;AACpC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,oDAAoD,SAAS,QAAQ,UAAU,WAAW;AAC1F;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA,wBAAwB,kBAAU;AAClC;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA,6BAA6B,8BAAoB;AACjD,gBAAgB,kCAAkC;AAClD;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;;AAEA;AACA,WAAW,8BAA8B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,8BAA8B;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sCAAsC,yBAAoB;AAC1D;;AAEA,mBAAmB,uBAAuB;AAC1C;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,mBAAmB,iCAAiC;AACpD;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,+BAAqB;AACrC;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,uBAAuB;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,4BAA4B;AAC3D;AACA;AACA;AACA;AACA;AACA,uCAAuC,WAAO;AAC9C;AACA;AACA;AACA,uCAAuC,gBAAgB;AACvD,kDAAkD,WAAO;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,kCAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,cAAQ;;AAEzC,mDAAe,OAAO,E;;ACrqByB;;AAE/C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,2BAAiB;AACrB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,6BAAe,SAAS,eAAC;AACzB,IAAI,2BAAiB;AACrB,YAAY,8BAAoB;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,E;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,+BAA+B;AAC3C;AACA;AACA;AACA;;AAE+C;AACV;AACsB;;AAE3D;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2CAA2C,YAAO;;AAElD;AACA;AACA;AACA;AACA,8BAA8B,+BAAqB;AACnD;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA,kCAAwB;AACxB;AACA;;AAEA;AACA;AACA,iCAAiC,YAAO;AACxC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,CAAC;;AAED,oCAA0B;AAC1B;;AAEA;;AAEA;AACA,CAAC;;AAED,sCAA4B,CAAC,cAAc;;;AAG3C,iDAAe,SAAS,E;;ACjQxB,gEAAe;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;AC7ED,+DAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,aAAa;;AAEb;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;AC9DD,0DAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;ACjC8C;AAC6B;AACF;AACV;;AAEhE,kBAAkB,uCAA6B;;AAE/C;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,wBAAwB,yBAAyB;AACnE,4BAAkB,wBAAwB,wBAAwB;AAClE,4BAAkB,wBAAwB,mBAAmB;;AAE7D,yDAAe,WAAW,EAAC;;;;AC/I3B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,8EAA8E;AACvG;AACA;;AAEO;AACP;AACA,mBAAmB,sBAAsB;AACzC;AACA;;AAEO;AACP;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;;AAEO;AACP,mCAAmC,oCAAoC;AACvE;;AAEO;AACP;AACA;;AAEO;AACP,2BAA2B,+DAA+D,gBAAgB,EAAE,EAAE;AAC9G;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,qFAAqF;AACpH;AACA,KAAK;AACL;;AAEO;AACP,aAAa,6BAA6B,0BAA0B,aAAa,EAAE,qBAAqB;AACxG,gBAAgB,qDAAqD,oEAAoE,aAAa,EAAE;AACxJ,sBAAsB,sBAAsB,qBAAqB,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,kCAAkC,SAAS;AAC3C,kCAAkC,WAAW,UAAU;AACvD,yCAAyC,cAAc;AACvD;AACA,6GAA6G,OAAO,UAAU;AAC9H,gFAAgF,iBAAiB,OAAO;AACxG,wDAAwD,gBAAgB,QAAQ,OAAO;AACvF,8CAA8C,gBAAgB,gBAAgB,OAAO;AACrF;AACA,iCAAiC;AACjC;AACA;AACA,SAAS,YAAY,aAAa,OAAO,EAAE,UAAU,WAAW;AAChE,mCAAmC,SAAS;AAC5C;AACA;;AAEO;AACP;AACA,kCAAkC,oCAAoC,aAAa,EAAE,EAAE;AACvF,CAAC;AACD;AACA;AACA,CAAC;;AAEM;AACP;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM,gBAAgB;AACzC;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;;AAEO;AACP,4BAA4B,sBAAsB;AAClD;AACA;AACA;;AAEO;AACP,iDAAiD,QAAQ;AACzD,wCAAwC,QAAQ;AAChD,wDAAwD,QAAQ;AAChE;AACA;AACA;;AAEO;AACP;AACA;;AAEO;AACP;AACA;AACA,iBAAiB,sFAAsF,aAAa,EAAE;AACtH,sBAAsB,gCAAgC,qCAAqC,0CAA0C,EAAE,EAAE,GAAG;AAC5I,2BAA2B,MAAM,eAAe,EAAE,YAAY,oBAAoB,EAAE;AACpF,sBAAsB,oGAAoG;AAC1H,6BAA6B,uBAAuB;AACpD,4BAA4B,wBAAwB;AACpD,2BAA2B,yDAAyD;AACpF;;AAEO;AACP;AACA,iBAAiB,4CAA4C,SAAS,EAAE,qDAAqD,aAAa,EAAE;AAC5I,yBAAyB,6BAA6B,oBAAoB,gDAAgD,gBAAgB,EAAE,KAAK;AACjJ;;AAEO;AACP;AACA;AACA,2GAA2G,sFAAsF,aAAa,EAAE;AAChN,sBAAsB,8BAA8B,gDAAgD,uDAAuD,EAAE,EAAE,GAAG;AAClK,4CAA4C,sCAAsC,UAAU,oBAAoB,EAAE,EAAE,UAAU;AAC9H;;AAEO;AACP,gCAAgC,uCAAuC,aAAa,EAAE,EAAE,OAAO,kBAAkB;AACjH;AACA;;AAEA;AACA,yCAAyC,6BAA6B;AACtE,CAAC;AACD;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,4CAA4C;AAC5C;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;;AClOiC;AACjC,2BAA2B,YAAG;AACvB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iCAAiC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;;;ACrDO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAK;AACrB;AACA;AACA;AACA;;;ACjGA,IAAI,WAAK;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,iDAAe,WAAK,EAAC;;;AChIc;AACP;AAC5B,IAAI,oBAAO;AACX,IAAI,oBAAO;AACX,aAAa,UAAK;AAClB,aAAa,UAAK;AAClB,aAAa,UAAK;AAClB,aAAa,UAAK;AAClB,gBAAgB,UAAK;AACrB,gBAAgB,UAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,oBAAO;AACvB,gBAAgB,oBAAO;AACvB;AACA,yBAAyB,oBAAO;AAChC;AACA;AACA;AACA;AACA;AACA,0BAA0B,oBAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAa;AAC7B,QAAQ,SAAgB;AACxB,QAAQ,KAAY;AACpB,QAAQ,SAAgB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA,YAAY,eAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,oBAAO;AAC1B,mBAAmB,oBAAO;AAC1B,mBAAmB,oBAAO;AAC1B,mBAAmB,oBAAO;AAC1B;AACA;AACA;AACA;AACA,CAAC;AACD,wDAAe,YAAY,EAAC;;;ACtNoB;AACJ;AACd;AAC9B;AACO;AACP;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,YAAO;AACX;AACA;AACO,SAAS,cAAS;AACzB,IAAI,YAAO;AACX;AACO;AACP;AACA;AACA;AACA,iDAAiD,YAAG;AACpD;AACA;AACA;AACA,gBAAgB,YAAO;AACvB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,mBAAmB,iBAAY;AAC/B;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAY;AACzC,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP,WAAW,YAAO;AAClB;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3L+C;AACwB;AACI;AAC3E,mBAAmB,qBAAqB,KAAK;AACtC;AACP;AACA;AACA;AACA;AACA;AACA,2CAA2C,SAAS;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,WAAM,GAAG;AAChC;AACA,eAAe,SAAS;AACxB,iCAAiC,SAAS;AAC1C,yCAAyC,SAAS;AAClD,+BAA+B,QAAQ;AACvC,mDAAmD,QAAQ;AAC3D,+BAA+B,SAAS;AACxC;AACA,mBAAmB,6CAA6C;AAChE;AACA;AACA,wBAAwB,QAAQ;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iCAAiC;AAChE;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,+BAA+B,aAAa;AAC5C,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC,gCAAgC,QAAQ;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAC+B;AACzB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,+BAA+B;AACzD;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA,kCAAkC,aAAa;AAC/C,8BAA8B,SAAS;AACvC;AACA;AACA;AACA,+BAA+B,SAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,cAA0B;AAC1D,4BAA4B,YAAwB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kHAAkH,iCAAiC;AACnJ,2DAA2D,QAAQ;AACnE;AACA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,SAAS;AAC5D,qDAAqD,SAAS;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,YAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM,OAAO;AAChC;AACA;AACA,CAAC,IAAI;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC7cO,SAAS,aAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAI;AACpB;AACA;AACA;AACA;AACO,SAAS,YAAK;AACrB;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO,IAAI,aAAM;AACV;AACP;AACA;AACO;AACA,SAAS,UAAG;AACnB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO,SAAS,YAAK;AACrB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAQ;AACxB;AACA;AACA;AACO,WAAW,eAAQ;AACnB;AACP;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACO,SAAS,WAAI;AACpB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAG;AACnB;AACA;AACA;AACA;AACO,SAAS,UAAG;AACnB;AACA;AACA;AACA;;;AC/GmC;AACA;AACnC,gBAAgB,QAAe;AAC/B,IAAI,qBAAO;AACX;AACA,iBAAiB,qBAAO,WAAW,qBAAO;AAC1C;AACA;AACA;AACA,sBAAsB,MAAa;AACnC,IAAI,iBAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,MAAa;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,GAAU;AAC1B;AACA;AACA,gBAAgB,IAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,MAAa;AAC9D,QAAQ,aAAa;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,GAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,GAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,cAAqB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,cAAqB;AACjC;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAG,sBAAsB,iBAAG;AAChD,wBAAwB,iBAAG;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,MAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA,yDAAe,aAAa,EAAC;;;AC5N7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,OAAO;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,oDAAe,QAAQ,EAAC;;;AC9JxB;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACA;AACA;AACA;AACA;;;ACXP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAAe,GAAG,EAAC;;;AClFZ;AACA;AACA;;;ACF0C;AACW;AACb;AACR;AAC8B;AAC2C;AACjD;AACf;AACnB;AACqB;AAC3C;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,iBAAY;AACtC;AACA;AACA,kBAAkB,SAAI;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,qBAAqB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,YAAY;AACjD,qCAAqC,YAAY;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wGAAwG;AACxG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,WAAW;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,iBAAiB,GAAG,gBAAgB;AACzF;AACA;AACA;AACA,8DAA8D,KAAK;AACnE;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA,0BAA0B,IAAI;AAC9B,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,WAAW;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,SAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,WAAW;AAC5C;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB,6BAA6B,OAAO;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA,YAAY,WAAM;AAClB;AACA;AACA,gBAAgB,WAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,WAAM,GAAG;AACvC,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,gCAAgC;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kBAAa;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,WAAM;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,WAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAQ;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,uCAAuC,mBAAc,IAAI,wBAAmB;AAC5E;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD,KAAK,UAAU,aAAQ;AACvB,KAAK,UAAU,kBAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA,QAAQ,WAAW;AACnB,aAAa,WAAW;AACxB;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,UAAU;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,IAAI;AACzB;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA,gBAAgB,QAAQ,uBAAuB,WAAW;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA,2BAA2B,wCAAwC;AACnE;AACA;AACA,8BAA8B,OAAO;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,YAAY;AACvC;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA,2BAA2B,kBAAQ;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAe,OAAO,EAAC;;;ACp/BW;AACD;AACe;AACU;AACG;AAC7D;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,+BAAmB;AACvB;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA,sBAAsB,IAAI;AAC1B,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA,qDAAqD;AACrD,oDAAoD;AACpD,0DAA0D;AAC1D,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,iBAAY;AACzE;AACA,gBAAgB,gCAA2B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,iBAAY;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,iBAAiB;AAClD;AACA;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,+BAAmB;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uEAAuE;AACvE;AACA,sCAAsC,IAAI;AAC1C,mCAAmC,wBAAwB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,IAAI;AACrC,+BAA+B,uBAAuB;AACtD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,+EAA+E,+BAAmB;AAClG,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,WAAM;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,WAAW,GAAG,iBAAiB;AAC3D,KAAK;AACL;AACA,CAAC,CAAC,WAAO;AACT,kBAAkB,iBAAY;AAC9B,mBAAmB,iBAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAAe,WAAW,EAAC;;;ACnU+C;AAC1E;AACA;AACA,IAAI,aAAO;AACX;AACA;AACA;AACA,UAAU,aAAQ;AAClB,UAAU,aAAQ;AAClB,UAAU,aAAQ;AAClB;AACA,kBAAkB,aAAO,UAAU,aAAO;AAC1C;AACA,SAAS,qBAAe;AACxB,iBAAiB,aAAO,WAAW,aAAO;AAC1C;AACO,SAAS,aAAO;AACvB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAY;AAC5B;AACA;AACA;AACA;AACA;AACA,YAAY,qBAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B,iBAAiB,aAAO;AACxB,iBAAiB,aAAO;AACxB,aAAa,UAAY;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA,iBAAiB,aAAO;AACxB,iBAAiB,aAAO;AACxB,aAAa,UAAY;AACzB;AACA;AACA;AACA;AACA;AACA,qBAAqB,aAAO;AAC5B,qBAAqB,aAAO;AAC5B,iBAAiB,UAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,aAAO;AACxB,iBAAiB,aAAO;AACxB;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA,gBAAgB,aAAO;AACvB,gBAAgB,aAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAW;AAC3B;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,YAAY,qBAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B,iBAAiB,iBAAW;AAC5B,iBAAiB,iBAAW;AAC5B,iBAAiB,UAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAW;AAC5B,iBAAiB,iBAAW;AAC5B,iBAAiB,UAAY;AAC7B;AACA;AACA;AACA;AACA;AACA,qBAAqB,iBAAW;AAChC,qBAAqB,iBAAW;AAChC,qBAAqB,UAAY;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAW;AAC5B,iBAAiB,iBAAW;AAC5B;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA,gBAAgB,iBAAW;AAC3B,gBAAgB,iBAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACxViC;AACA;AACjC,IAAI,YAAO;AACX,IAAI,YAAO;AACX;AACA;AACA;AACA,YAAY,aAAW;AACvB,UAAU,aAAW;AACrB,gBAAgB,aAAW;AACpB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA,eAAe,YAAO;AACtB,gBAAgB,YAAO;AACvB,cAAc,YAAO;AACrB,iBAAiB,YAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACO;AACP,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB;AACA;AACA;AACO;AACP,uBAAuB,kBAAkB;AACzC,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA,iBAAiB,YAAO;AACxB,iBAAiB,YAAO;AACxB;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA,iBAAiB,YAAO;AACxB,iBAAiB,YAAO;AACxB;AACA,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB;AACO;AACP,4BAA4B,uBAAuB;AACnD,sBAAsB,iBAAiB;AACvC,aAAa,YAAO,CAAC,YAAO;AAC5B,aAAa,YAAO,CAAC,YAAO;AAC5B;AACA;AACA,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB;AACO;AACP,kBAAkB,UAAQ;AAC1B,kBAAkB,UAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3HiC;AACS;AACU;AACiB;AAC+B;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iBAAO;AACX,IAAI,iBAAO;AACX,IAAI,iBAAO;AACX,IAAI,iBAAO;AACX,IAAI,kBAAQ;AACZ;AACA;AACA,IAAI,aAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,yBAAyB,aAAG;AAC5B;AACA;AACA;AACA;AACA,yDAAyD,aAAG;AAC5D,sCAAsC,aAAG;AACzC;AACA,6DAA6D,aAAG;AAChE,sCAAsC,aAAG;AACzC;AACA;AACA,uCAAuC,aAAG;AAC1C;AACA;AACA,uCAAuC,aAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,gBAAG;AAC3D,wDAAwD,gBAAG;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAO;AAC1B,mBAAmB,iBAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,eAAe;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,iBAAO,UAAU,iBAAO,mBAAmB,iBAAO,UAAU,iBAAO;AAC5H;AACA;AACA;AACA,4BAA4B,kBAAQ;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,aAAO;AACxB,kBAAkB,aAAO;AACzB,iBAAiB,aAAO;AACxB,kBAAkB,aAAO;AACzB,yBAAyB,kBAAQ;AACjC;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAO;AACvB,gBAAgB,aAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,kBAAQ;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA;AACA,oBAAoB,aAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAO;AACpC,6BAA6B,iBAAO;AACpC;AACA,oBAAoB,OAAO;AAC3B,yBAAyB,iBAAO;AAChC,yBAAyB,iBAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,UAAQ;AACpB,YAAY,UAAQ;AACpB;AACA;AACA;AACA;AACA,mBAAmB,iBAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,WAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAO;AACpC,6BAA6B,iBAAO;AACpC;AACA,wBAAwB,iBAAO,WAAW,iBAAO,CAAC,aAAG;AACrD,yBAAyB,iBAAO;AAChC,yBAAyB,iBAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,cAAc;AAC1C,4BAA4B,cAAc;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,kBAAkB;AAC9C,4BAA4B,kBAAkB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAO;AACpC,6BAA6B,iBAAO;AACpC;AACA,yBAAyB,iBAAO;AAChC,yBAAyB,iBAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,iBAAO;AAClD;AACA;AACA,0DAA0D,iBAAO;AACjE;AACA;AACA;AACA,+CAA+C,iBAAO;AACtD;AACA;AACA;AACA,kDAAkD,iBAAO;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD,qDAAe,SAAS,EAAC;;;ACnzBlB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACvBuC;AAChC,SAAS,mBAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAuB;AACnC;AACA;;;ACdsD;AAC/C,SAAS,uBAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,qBAAqB;AACjC;AACA;;;ACdA,IAAI,QAAG;AACA;AACP,aAAa,QAAG;AAChB;AACA,iBAAiB,QAAG;AACpB;AACA;AACA;;;ACPyC;AACzC,IAAI,OAAG;AACA,SAAS,iBAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAG;AAC7C;AACA;AACA;AACA;AACA,qBAAqB,eAAe;AACpC,mBAAmB,eAAe;AAClC;AACA;AACA,qBAAqB,eAAe;AACpC,mBAAmB,eAAe;AAClC;AACA;AACA,oBAAoB,OAAG;AACvB;AACA;AACA;AACA,iBAAiB,OAAG;AACpB;AACA;AACA,oBAAoB,OAAG,0BAA0B,OAAG;AACpD;;;AClCe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACd0C;AACX;AACE;AACQ;AACZ;AACU;AACC;AACxC,IAAI,QAAG,GAAG,kBAAa;AACvB,IAAI,QAAG;AACP,IAAI,YAAO;AACX;AACA,6BAA6B,YAAO;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAiB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA,qBAAqB,aAAa;AAClC;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA,sBAAsB,aAAa;AACnC;AACA,0BAA0B,aAAa;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,eAAqB;AACtC;AACA;AACA;AACA;AACA,gBAAgB,uBAAuB;AACvC;AACA;AACA,qBAAqB,iBAAiB;AACtC,2BAA2B,YAAY;AACvC;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAG;AACrB;AACA,mBAAmB,QAAG;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAG;AACzB,oBAAoB,QAAG;AACvB;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA,wBAAwB,QAAG;AAC3B;AACA;AACA,4BAA4B,QAAG,0BAA0B,QAAG;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,oBAAoB,QAAG;AACvB;AACA,qBAAqB,WAAW;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA,wBAAwB,aAAkB;AAC1C;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,aAAkB;AAC1C,2BAA2B,aAAkB;AAC7C,2BAA2B,aAAkB;AAC7C,2BAA2B,aAAkB;AAC7C;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC,yBAAyB,WAAW;AACpC;AACA;AACA,iBAAiB,QAAG;AACpB;AACA,wBAAwB,aAAkB;AAC1C;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACO;AACP;AACA;AACO,SAAS,kBAAa;AAC7B;AACA;;;AClTkC;AACgE;AACxD;AACK;AACsC;AACjD;AACsE;AAC1B;AACzE,yBAAyB,aAAQ;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,oBAAoB;AAChB;AACP,WAAW,aAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,EAAE,oCAAoC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA,+BAA+B,WAAW;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,IAAI;AAC1B;AACA;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,WAAM;AAC1B;AACA;AACA;AACA,gBAAgB,WAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB,8BAA8B,GAAG;AACjC;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA,8BAA8B,GAAG,gBAAgB,mBAAmB;AACpE;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,iBAAiB;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAyB;AACjD;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA,iCAAiC,iBAAiB;AAClD;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA,gCAAgC,WAAM,GAAG;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,WAAM,GAAG;AAC3C,oBAAoB,WAAM;AAC1B;AACA;AACA;AACA,8BAA8B,WAAM,GAAG;AACvC,gBAAgB,WAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,WAAM,GAAG;AACtC;AACA,gCAAgC,IAAI;AACpC,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,KAAK;AAC5B;AACA;AACA,uBAAuB,KAAK;AAC5B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,WAAW,GAAG,iBAAiB,GAAG,iBAAiB;AAC/E,KAAK;AACL;AACA,CAAC,CAAC,mBAAW;AACb,mDAAe,IAAI,EAAC;;;ACvYc;AACM;AACwB;AACpB;AACU;AAC/C,0BAA0B,aAAQ;AACzC;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,kBAAkB;AACrB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC,CAAC,mBAAW;AACb;AACA,oDAAe,KAAK,EAAC;;;AC7Da;AACgE;AAClD;AACM;AAC/C,0BAA0B,aAAQ;AACzC;AACA;AACA,CAAC,EAAE,oBAAoB;AAChB;AACP,WAAW,aAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,EAAE,oCAAoC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAY;AACzC;AACA;AACA;AACA;AACA,CAAC,CAAC,mBAAW;AACb;AACA,oDAAe,OAAO,EAAC;;;ACxEhB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC1EA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACvDkC;AACP;AAC4B;AACW;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACoB;AACrB;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,oBAAoB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,SAAyB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,iDAAe,IAAI,EAAC;;;ACxDc;AACiC;AACvC;AAC+E;AAClC;AAC3C;AACE;AACgB;AACV;AACsC;AAC5E;AACA;AACA;AACA;AACO;AACP,WAAW,aAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,EAAE,oCAAoC;AAC3C;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAI;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,iBAAY;AAC1C;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D,QAAQ,WAAM;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,IAAI;AAC5B,uBAAuB,sBAAsB;AAC7C;AACA;AACA,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,YAAY;AACjD;AACA;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,WAAW;AAC/B;AACA;AACA;AACA,uBAAuB,WAAW;AAClC,uBAAuB,WAAW;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C,4CAA4C,aAAK;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,iBAAY,CAAC,WAAW,mDAAmD,WAAW;AAC7H;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,WAAW;AAC9B,mBAAmB,WAAW;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,aAAK;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,YAAY;AACpD,6BAA6B,SAAS;AACtC;AACA,mCAAmC,SAAS;AAC5C,kCAAkC,SAAS;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iBAAY,CAAC,WAAW,iDAAiD,WAAW;AACnH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,UAAI;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,SAAS;AAC7C;AACA;AACA,2CAA2C,aAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,SAAS;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,IAAI;AAC3B;AACA;AACA,CAAC,CAAC,mBAAW;AACb,wBAAwB;AACxB,iCAAiC;AAC1B;AACP;AACA,IAAI,IAAI;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,iBAAiB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAAe,MAAM,EAAC;;;;AC/gBtB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AAChD,0BAA0B;AAC1B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAAS,mBAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACO,SAAS,YAAK;AACrB;AACA;AACA,GAAG;;;AAGH,8EAA8E;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEO;AACP;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,yCAAyC;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA,uFAAuF;;AAEvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA,YAAY,MAAa;AACzB;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA,sBAAsB,GAAU;AAChC;AACA,GAAG;AACH;AACA,cAAc,GAAU;AACxB;AACA;AACA,GAAG;AACH,mBAAmB,MAAa;AAChC;AACA,GAAG;AACH,kBAAkB,GAAU;AAC5B;AACA,GAAG,EAAE;;AAEL;AACA;AACA;AACA;;AAEA,2CAA2C,SAAS;AACpD;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,sEAAsE;AACtE;;AAEA,wBAAwB;;AAExB,8DAA8D,YAAK;AACnE,CAAC;;AAEM;AACP;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,YAAY;AACZ;;AAEO;AACP;AACA,CAAC;;AAED,wBAAwB,EAAE,aAAa,IAAI,aAAa,IAAI,YAAY,IAAI,SAAS,IAAI,SAAS,IAAI,mDAAmD;;AAEzJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,oDAAoD;AACpD,oDAAoD;AACpD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,sBAAsB;;AAEtB;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA,mBAAmB;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kCAAkC;AAC1C,QAAQ,0CAA0C;AAClD,QAAQ,oCAAoC;AAC5C,QAAQ,mCAAmC;AAC3C,QAAQ,mCAAmC;AAC3C,QAAQ,oCAAoC;AAC5C,QAAQ;AACR;AACA,QAAQ,0CAA0C;AAClD,QAAQ,oCAAoC;AAC5C,QAAQ,mCAAmC;AAC3C,QAAQ,kCAAkC;AAC1C,QAAQ,mCAAmC;AAC3C,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,GAAG;AACH;AACA;;AAEA,iBAAiB,iBAAiB;AAClC;AACA;;AAEA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,C;;;ACjmBA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACmF;AACnF;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP,MAAM,IAAqC;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO;AACP,MAAM,IAAqC;AAC3C;AACA;AACA;AACO;AACP;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA,MAAM,IAAqC;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;;AAEA,MAAM,IAAqC;AAC3C;AACA;AACA;AACA,8GAA8G,KAAK,0EAA0E,UAAU,sBAAsB,MAAM,IAAI,QAAQ;AAC/O;;AAEA,UAAU,GAAG;AACb,UAAU,QAAQ;AAClB;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,C;;;AC5JA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC6H;AACtF;AACoC;AACR;AACtC;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,EAAE;AACd,YAAY,MAAM;AAClB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,oBAAoB;AACpB;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,gDAAgD;;AAEhD,yCAAyC,SAAS;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,8aAA8a;AACrb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,WAAW,eAAe,eAAe;AACtE;AACA;;AAEO;AACP,SAAS,QAAQ,eAAe,OAAO;AACvC;AACA;AACA,6BAA6B,WAAW,eAAe,eAAe;AACtE;AACA;;AAEO;AACP,SAAS,QAAQ,2CAA2C;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,yBAAyB,aAAa,GAAG;;AAEzC,EAAE,IAAI;AACN,SAAS,QAAQ;AACjB;AACA;AACA;;AAEA,QAAQ,IAAqC;AAC7C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA,wBAAwB;AACxB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;;AAGA,qBAAqB,0BAA0B;AAC/C,oCAAoC;;AAEpC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA,EAAE,IAAI;AACN;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAM,MAAM;AACZ,wCAAwC;AACxC;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,EAAE,IAAI;AACN;AACA;AACA;;AAEA,mBAAmB,mBAAmB;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA,EAAE,IAAI;AACN;AACA;AACA,KAAK;;;AAGL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA,GAAG;AACH;;AAEA;AACA,EAAE,IAAI;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B,EAAE,IAAI;AACN;AACA;AACA,GAAG;AACH,EAAE,IAAI;AACN,6BAA6B;;AAE7B,IAAI,MAAM;AACV;AACA,uCAAuC;AACvC,GAAG,EAAE;;AAEL,EAAE,IAAI;AACN;AACA;AACA;;AAEA,SAAS,QAAQ;AACjB;AACA,KAAK;AACL;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,qBAAqB,UAAU,GAAG,UAAU,GAAG,GAAG;AAClD,oBAAoB,GAAG,GAAG,UAAU,GAAG,UAAU;AACjD;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA,mDAAmD;;AAEnD;AACA;AACA;AACA;AACA;;;AAGA;AACA,MAAM,IAAqC;AAC3C;AACA;AACA;AACA;;AAEA;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA,6DAA6D,YAAY;AACzE;;AAEA;AACA,MAAM,IAAqC;AAC3C,IAAI,IAAI;AACR;AACA;;AAEA;AACA,SAAS,YAAY,cAAc,SAAS;AAC5C;;AAEO;AACP,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;;AAEO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA,EAAE,IAAI;AACN;;AAEA,QAAQ,QAAQ;AAChB;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,iEAAiE;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,mCAAmC;AAC5D,yBAAyB,mCAAmC;AAC5D;AACA;;;AAGO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,6CAA6C,SAAS;AACtD;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,gDAAgD,UAAU;AAC1D;;AAEA;AACA;AACA,SAAS;AACT,+CAA+C;AAC/C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,GAAG;AACH,WAAW,OAAO,sBAAsB,GAAG;AAC3C;AACA,KAAK;AACL,GAAG;AACH,WAAW,OAAO,iBAAiB,GAAG;AACtC;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEO;AACP;AACA;AACA,6CAA6C;AAC7C;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0CAA0C;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACO;AACP;;AAEA,MAAM,QAAQ;AACd;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA,uBAAuB,aAAa;AACpC;AACA;AACA,EAAE,IAAI;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kEAAkE,OAAO;AACzE;AACA;;AAEA;AACA,qFAAqF;AACrF;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI,MAAM;AACV;AACA;AACA,GAAG;AACH;;;AAGA;AACA,IAAI,MAAM;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA,WAAW,qBAAgB;AAC3B,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,gBAAgB,aAAa;AAC7B;AACA,EAAE,IAAI;AACN;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,iBAAiB;AACjC,WAAW,YAAK,mCAAmC,YAAY,oBAAoB,YAAY;AAC/F,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA,mBAAmB,cAAc;AACjC,0CAA0C;;AAE1C;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,oBAAoB,iBAAiB;AACrC,0BAA0B,YAAK,mCAAmC,YAAY,WAAW,YAAY;AACrG;AACA;;AAEA;AACA;AACA,C;;;AC9vBA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACoC;AAC7B,gBAAgB,SAAS,G;;;AC3ChC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACuC;AAC6D;AAC3D;AACW;AACA;AACR;AACd;;AAE9B;AACA;AACA,qBAAqB,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEP;AACA;AACA,CAAC;;;AAGD,2BAA2B,YAAG;;AAE9B;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kBAAkB,IAAc;AAChC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA,iBAAiB,yBAAyB;AAC1C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kCAAkC,OAAO;AACzC;;AAEA,oBAAoB,YAAI;AACxB;AACA;AACA;;AAEA;AACA,0BAA0B;;AAE1B;;AAEA;AACA,sBAAsB;;AAEtB,gBAAgB,WAAM,GAAG;AACzB,wBAAwB,WAAM,GAAG,iBAAiB;;AAElD;AACA,OAAO;AACP;AACA;AACA,oBAAoB,WAAM,GAAG;AAC7B,4BAA4B,WAAM,GAAG;AACrC;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,WAAM,GAAG;AACzB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,WAAM,GAAG;AACvB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,YAAY,WAAM,GAAG;AACrB,gBAAgB,WAAM;AACtB;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;;AAEA;AACA;AACA;;AAEO;AACP;AACA;AACA,mIAAmI;;AAEnI;AACA;AACA,KAAK;AACL,GAAG;AACH;AACO;AACP;AACA;;AAEA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6FAA6F;;AAE7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP,UAAU,WAAW;AACrB;AACA,OAAO,UAAU,QAAQ;AACzB,wBAAwB,IAAI;;AAE5B,uBAAuB,sBAAsB;AAC7C;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACO;AACP;AACA;AACA,kBAAkB,cAAc,gBAAgB;;AAEhD,eAAe,OAAO;AACtB;;AAEA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,SAAS;AAC1B;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,uDAAuD;AACvD;;AAEA;;AAEA,iBAAiB,wBAAwB;AACzC,QAAQ,KAAqC;AAC7C,MAAM,KAAK;AACX;;AAEA,QAAQ,SAAS;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP,MAAM,KAAqC;AAC3C,IAAI,KAAK;AACT;;AAEA,eAAe,SAAS;;AAExB;AACA;AACA,+BAA+B;AAC/B;;;AAGA;AACA;AACA;AACA;;AAEA,IAAI,IAAI;AACR;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;;AAGA;AACA;AACA;AACO;AACP,MAAM,KAAqC;AAC3C,IAAI,KAAK;AACT;;AAEA;AACA,eAAe,SAAS;AACxB;;AAEA;AACA,IAAI,IAAI;AACR;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACO;AACP;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,cAAc;;AAEhC,OAAO,OAAO;AACd;AACA;;AAEA;AACA;AACO;AACP;AACA,EAAE,IAAI;AACN;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACO;AACP;AACA;AACA;AACA,IAAI,IAAI;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACO;AACP,eAAe,SAAS;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;;AAEA,iBAAiB,yBAAyB;AAC1C;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;;AAEO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,C;;AC3vB0C;AAC0B;AACpE,IAAI,iBAAG,GAAG,kBAAa;AACvB;AACA,IAAI,sBAAQ;AACZ;AACe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,sBAAQ;AACjC,yBAAyB,sBAAQ;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAgB;AAChC;AACA;AACA;AACA;AACA,gBAAgB,cAAgB;AAChC;AACA;AACA;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;AACA,YAAY,cAAgB;AAC5B;AACA;AACA;AACA;AACA;AACA;;;AC7EkC;AACC;AACO;AACE;AACN;AACtC,IAAI,aAAQ;AACZ,IAAI,YAAO;AACX,IAAI,YAAO;AACX,IAAI,OAAE;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAE;AAC1B,aAAa,YAAO;AACpB,UAAU,YAAO;AACjB,kBAAkB,YAAO;AACzB,UAAU,YAAO;AACjB;AACA;AACA,cAAc,aAAQ;AACtB,cAAc,aAAQ;AACtB;AACA;AACA,UAAU,aAAQ;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,YAAO;AACjB,UAAU,YAAO;AACjB;AACA,UAAU,YAAO;AACjB,UAAU,YAAO;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAE;AACnB;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAE;AACtC,iBAAiB,OAAE,iBAAiB,OAAE;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,cAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,kBAAa;AAC3B;AACA;AACA;AACA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA,qDAAqD;AACrD;AACA,CAAC,CAAC,YAAI;AACN;AACA;AACA;AACA;AACA;AACA,oBAAoB,WAAM,GAAG;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,aAAa;AACrB;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA,QAAQ,SAAS;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACO;AACP;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,YAAI;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AChWkC;AACK;AACN;AACe;AAChD;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA,0BAA0B,iBAAY;AACtC;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,gCAA2B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,WAAO;AACT;AACA,oDAAe,KAAK,EAAC;;;ACzKa;AACP;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACsB;AACvB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA;AACA,mDAAe,MAAM,EAAC;;;AC7BY;AACP;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACuB;AACxB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,oDAAe,OAAO,EAAC;;;ACtCmC;AAC1D,IAAI,cAAE;AACN,IAAI,eAAG,GAAG,cAAE;AACZ,IAAI,mBAAO;AACX,IAAI,mBAAO;AACX;AACA;AACA,IAAI,mBAAO;AACX,IAAI,oBAAQ;AACZ,IAAI,mBAAO;AACX,IAAI,mBAAO;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,oBAAQ;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,oBAAQ,CAAC,mBAAO;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,qBAAS;AACzB,iBAAiB,mBAAO;AACxB,sBAAsB,mBAAO;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kBAAkB;AAC1B,cAAc,mBAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,eAAG;AACtB,gCAAgC,mBAAO,2BAA2B,mBAAO;AACzE;AACA;AACA,yCAAyC,mBAAO,8BAA8B,mBAAO;AACrF;AACA;AACA;AACA;AACA,qBAAqB,mBAAO;AAC5B,iBAAiB,mBAAO;AACxB,kBAAkB,mBAAO;AACzB;AACA;AACA,2BAA2B,mBAAO;AAClC,2BAA2B,mBAAO;AAClC,iCAAiC,mBAAO;AACxC,iCAAiC,mBAAO;AACxC;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAO;AAClC,2BAA2B,mBAAO;AAClC,iCAAiC,mBAAO;AACxC,iCAAiC,mBAAO;AACxC,sBAAsB,cAAE;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,mBAAO,iCAAiC,oBAAQ,sBAAsB,oBAAQ;AAC9G,4BAA4B,oBAAQ;AACpC,0BAA0B,mBAAO;AACjC,0BAA0B,mBAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACtLkC;AACP;AACgC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACsB;AACvB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,qBAA2B;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,mDAAe,MAAM,EAAC;;;ACpCY;AACP;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACoB;AACrB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,iDAAe,IAAI,EAAC;;;AChCuC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B,oBAAoB,eAAU;AAC9B;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3CuJ;AACxI;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,SAAS;AACrD,YAAY,UAAK;AACjB,YAAY,UAAK;AACjB;AACA,QAAQ,UAAK;AACb,QAAQ,UAAK;AACb;AACA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,YAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,GAAK;AACb,QAAQ,YAAO;AACf,iBAAiB,eAAU;AAC3B,iBAAiB,eAAU;AAC3B;AACA;AACA;AACA;AACA;AACA,QAAQ,YAAO;AACf,QAAQ,YAAO;AACf,kBAAkB,GAAK;AACvB,kBAAkB,GAAK;AACvB;AACA,YAAY,UAAK;AACjB,YAAY,UAAK;AACjB,YAAY,UAAK;AACjB,YAAY,UAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC9D0C;AACA;AACnC,SAAS,cAAS;AACzB;AACA;AACA;AACA;AACA,gCAAgC,YAAY;AAC5C;AACA;AACA,2BAA2B,iCAAiC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,YAAY;AACrC;AACA;AACA,8CAA8C,OAAO;AACrD;AACA;AACA;AACA;AACA;AACA;;;AC5BkC;AACP;AACkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACuB;AACxB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,cAAoB;AAC5B;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA;AACA,oDAAe,OAAO,EAAC;;;AC3BW;AACP;AACkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACwB;AACzB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,cAAoB;AAC5B;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,qDAAe,QAAQ,EAAC;;;ACjCU;AACP;AACuC;AAClE,IAAI,gCAA2B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACoB;AACrB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,oBAAoB,CAAC,gCAA2B;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,iDAAe,IAAI,EAAC;;;ACpEc;AACP;AACe;AAC4F;AACtI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAC2B;AAC5B;AACA;AACA;AACA;AACA;AACA,yBAAyB,iBAAiB,GAAG,aAAO;AACpD,yBAAyB,iBAAiB,GAAG,aAAO;AACpD;AACA;AACA;AACA;AACA,yBAAyB,qBAAqB,GAAG,iBAAW;AAC5D,yBAAyB,qBAAqB,GAAG,iBAAW;AAC5D;AACA;AACA;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAc;AAC7B;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA;AACA,wDAAe,WAAW,EAAC;;;AClGO;AACP;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACmB;AACpB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,gDAAe,GAAG,EAAC;;;AC3Ce;AACR;AAC1B;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA,eAAe,2CAAmC;AAClD;AACA;AACA,CAAC,CAAC,YAAI;AACN,2DAAe,YAAY,EAAC;;;AChD5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;AACD,uDAAe,QAAQ,EAAC;;;ACZU;AACA;AAClC;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,gBAAQ;AACV,6DAAe,cAAc,EAAC;AAC9B;;;ACjBkC;AACA;AAClC;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,gBAAQ;AACV,6DAAe,cAAc,EAAC;;;ACfF;AAC5B;AACA;AACA,IAAI,0BAAK,OAAO,UAAK;AACrB,IAAI,0BAAK,OAAO,UAAK;AACrB;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B,mCAAmC,UAAK;AACxC;AACA,uBAAuB,OAAO;AAC9B,gCAAgC,UAAK;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA,QAAQ,cAAS;AACjB,QAAQ,cAAS;AACjB;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,0BAAK;AACb,QAAQ,0BAAK;AACb,sDAAsD,0BAAK,EAAE,0BAAK;AAClE;AACA;AACA;AACA;AACA;AACA,sDAAsD,0BAAK,EAAE,0BAAK;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,eAAU,mBAAmB,0BAAK,GAAG,0BAAK;AACtD;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAW;AACnC;AACA;AACA,wBAAwB,gBAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAW;AACnC;AACA;AACA,wBAAwB,gBAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,gEAAe,oBAAoB,EAAC;;;ACvHF;AACK;AACS;AAChD;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,+BAA+B;AACjE;AACA;AACA,uBAAuB,wCAAwC;AAC/D;AACA;AACA;AACA;AACA;AACA,kCAAkC,+BAA+B;AACjE;AACA;AACA;AACA;AACA;AACA,uBAAuB,wCAAwC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAY;AACvC,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,mBAAU;AACZ,qEAAe,sBAAsB,EAAC;;;;AC9GtC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkD;AACA;AACA;AACN;AACe;AACX;AACF;AACA;AACQ;AACE;AACF;AACJ;AACM;AACE;AACR;AACA;AACc;AAChB;AACY;AACI;AACA;AACP;AACgB;AAC9B;AACqC;AACI;AAC0C;AACrF;AACzC,IAAI,eAAO;AACX,IAAI,eAAO;AACX;AACA;AACA;AACA;;AAEO;AACP,SAAS,mBAAW;AACpB;AACA,2BAA2B,gBAAyB;AACpD;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,WAAW;AACjD;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,YAAY;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,aAAa,gBAAyB;;AAEtC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,kBAAkB,aAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAI,iBAAS,GAAG,SAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAAS,4BAAoB;AACpC,EAAE,oBAAyC;AAC3C;AACA;AACA;AACA;AACA;;AAEO,SAAS,4BAAoB;AACpC,EAAE,oBAAyC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAI,wBAAgB,GAAG,gBAAqC;;AAEnE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG,UAAU,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB;AACvB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,iBAAiB,SAAS;AAC1B,wBAAwB,SAAS;AACjC;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,8BAA8B;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,uCAAuC,gCAAgC,EAAE;AACjF;AACA;AACA;AACA,QAAQ,4BAA4B,gCAAgC,EAAE;AACtE;;;AAGA;AACA;AACA;AACA;;AAEuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEO;AACP;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA,iBAAiB,yBAAyB;AAC1C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,YAAY,QAAe;;AAE3B;AACA,IAAI,GAAU;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0BAA0B;AACrC;AACA;AACA;;AAEO,SAAS,sBAAc;AAC9B,oBAAoB,WAAW;AAC/B,gBAAgB,oCAA+B;AAC/C;;AAEA;AACA,gBAAgB,aAAa;AAC7B;;AAEA,SAAS,cAAqB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,WAAW,sBAAc;AACzB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,WAAM,GAAG;AAC3B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kDAAkD,SAAS;AAC3D;AACA;AACA,GAAG;AACH;AACO;AACP;AACA;AACA,SAAS,GAAG;AACZ;AACA,QAAQ,eAAO;AACf,QAAQ,eAAO;AACf;AACA,QAAQ,eAAO;AACf,QAAQ,eAAO;AACf;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEO;AACP,UAAU,eAAO;AACjB,WAAW,eAAO;AAClB,UAAU,eAAO;AACjB,WAAW,eAAO,yDAAyD;AAC3E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,kBAAkB,WAAM;AACxB;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gFAAgF,aAAQ,mBAAmB,aAAO;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,iDAAiD,mBAAmB;AACpE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA,6BAA6B,QAAQ;AACrC;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI,IAAI,CAAC,IAAI;AACb,WAAW,MAAM;AACjB;AACA;AACA;AACA,KAAK;AACL;;AAEA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA,YAAY,aAAQ;AACpB;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;;AAEA,wBAAwB,YAAM;AAC9B,yBAAyB,aAAO;AAChC,wBAAwB,YAAM;AAC9B,sBAAsB,UAAI;AAC1B,yBAAyB,aAAO;AAChC,0BAA0B,cAAQ;AAClC,sBAAsB,UAAI;AAC1B,sBAAsB,UAAI;AAC1B,6BAA6B,iBAAW;AACxC,qBAAqB,SAAG;;;;AC5tBxB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC8C;AACoC;AAClB;AACd;AACc;AACP;AACzD;AACO;AACP,iBAAiB,KAAK,qBAAqB,CAAC;AAC5C,oBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,eAAe,UAAU;AACzB;;AAEA;AACA;AACA;;AAEA,iBAAiB,KAAK,qBAAqB,CAAC;AAC5C,oBAAoB,cAAc;AAClC;AACA,4BAA4B,SAAS;AACrC;;AAEA;AACA;;AAEA;AACA;AACA;AACA,wCAAwC,IAAM;AAC9C;;AAEA,iBAAiB,KAAK,qBAAqB,CAAC;AAC5C,uCAAuC,cAAc;;AAErD;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,IAAM;AAChC;AACA,OAAO;;;AAGP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,KAAK,qBAAqB,CAAC;AAC9C,sBAAsB,cAAc;AACpC;;AAEA;AACA;AACA,0BAA0B,SAAS;;AAEnC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;AAGA,4DAA4D;;AAE5D;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qCAAqC;;AAErC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEyB;AAClB;AACP;AACA;AACA;AACA;;AAEA,iBAAiB,KAAK,qBAAqB,CAAC;AAC5C,oBAAoB,cAAc;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,wBAAwB,WAAM,gCAAgC;;AAE9D;AACA;AACO;AACP;AACA;AACA;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA,2FAA2F;AAC3F;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,sEAAsE;AACtE,oCAAoC,aAAa,KAAK,yBAAyB,OAAO;AACtF;AACA;AACA;;AAEA,iDAAiD;AACjD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,eAAe;AACf;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,IAAI;;AAEzB,qBAAqB,qBAAqB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;;AAEzB;AACA,QAAQ,IAAqC;AAC7C;AACA,QAAQ,mBAAmB;AAC3B;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,QAAQ,IAAqC;AAC7C;AACA,QAAQ,mBAAmB;AAC3B;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wBAAwB,SAAS;;AAEjC;AACA;AACA;;AAEA,uBAAuB,SAAS;;AAEhC;AACA;AACA;;AAEA,6BAA6B,SAAS;;AAEtC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA,iBAAiB,mCAAmC;AACpD;AACA,cAAc,SAAS;;AAEvB;AACA;AACA;AACA;;AAEA,iBAAiB,4BAA4B;AAC7C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,UAAU,IAAqC;AAC/C;AACA,UAAU,mBAAmB;AAC7B;AACA;;AAEA;AACA;;AAEA;AACA,UAAU,IAAqC;AAC/C;AACA,UAAU,mBAAmB;AAC7B;AACA;;AAEA;AACA;AACA;AACA;;AAEO;AACP;AACA,SAAS,IAAI;AACb;AACA;AACO,iBAAiB,SAAS;AAC1B;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;;AAEA;AACA;AACA;;AAEA,wEAAwE;AACxE;;AAEA,kBAAkB,SAAS;AAC3B;;AAEA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,uBAAuB,SAAS,GAAG,WAAW,YAAY;AAC1D,C;;ACnjBA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACwC;AACM;AACA;AACM;AAClB;AAClC,mBAAmB,0BAAqB;;;AAGxC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,gBAAW;;AAE9B;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA,qBAAqB,YAAO;;AAE5B;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,6BAA6B,YAAO;;AAEpC,0BAA0B,YAAO;;AAEjC;;AAEA;;AAEA;;AAEA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,8BAA8B;AAC7C;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;;AAGL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA,sBAAsB,YAAO;AAC7B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;;AAED;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,CAAC;;;AAGD,wDAAe,YAAY,E;;ACl0B3B,0DAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,E;;ACtCD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE0B;AACA;AACA;AACA;AACE;AACF;AACA;AACA;;AAE1B,+CAAe;AACf,UAAU,aAAI;AACd,UAAU,aAAI;AACd,UAAU,aAAI;AACd,UAAU,aAAI;AACd,WAAW,cAAK;AAChB,UAAU,aAAI;AACd,UAAU,aAAI;AACd,UAAU,aAAI;AACd,CAAC,EAAC;;;AC/CF;AACmC;;AAEnC,mDAAe,QAAQ,EAAC;;;ACHxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAE2C;AACI;AACS;AACT;AAC/C,IAAI,YAAI,GAAG,iBAAa;;AAExB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,mBAAe;AACnC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C,8BAA8B,sBAAkB;AAChD,8BAA8B,sBAAkB;AAChD,kCAAkC,sBAAkB;AACpD,8BAA8B,sBAAkB;AAChD,kCAAkC,sBAAkB;AACpD,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;AACzC;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kBAAkB,YAAI,gBAAgB,YAAI,gBAAgB,YAAI;AAC9D;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc,aAAa;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc,aAAa;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;;AAEA,sBAAsB,WAAW;AACjC,wBAAwB,aAAa;AACrC,0BAA0B,eAAe;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,+BAA+B;AAC9C,eAAe,+BAA+B;AAC9C,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,iCAAiC,iBAAiB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,eAAe;AAChD;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,CAAC;;AAED,+BAAqB,0BAA0B,mBAAmB;;AAElE,8CAAe,aAAa,E;;AC/c5B;AACA;AACA;AACA;AACA;;AAEA;AAC+C;AACF;;AAE7C;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,mCAAmC;AAClD,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,mCAAmC;AAClD,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,wBAAwB,aAAS;AACjC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc;AACd;AACA,eAAe,8BAAoB;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,oCAAoC;AAC3D;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,iEAAe,qBAAqB,E;;AC7WS;AACC;AACC;;AAE/C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,kBAAkB;AAClB;AACA,6BAA6B,+BAA0B;AACvD;AACA,SAAS;;AAET;AACA,kBAAkB;AAClB;AACA,gCAAgC,2BAAsB;;AAEtD;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,yBAAoB;AAC9C,6BAA6B,yBAAoB;;AAEjD;AACA;AACA,oCAAoC,qCAAgC;AACpE,yBAAyB,2BAAsB;;AAE/C;AACA,qCAAqC,kCAA6B;AAClE,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mCAA8B;AACpD;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,+CAA+C,aAAM;AACrD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,6BAAmB;AAC7E;AACA;AACA,kCAAkC,wBAAmB;AACrD;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,+BAA+B,8BAAoB;AACnD,4BAA4B,oCAAoC;AAChE,4BAA4B;AAC5B,iBAAiB;AACjB,gBAAgB,0CAAgC;;AAEhD;AACA;AACA;AACA;AACA;AACA,8BAA8B,0BAAqB;AACnD;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yDAAe,WAAW,E;;ACtL1B;AACA;AACA;AACA;;AAE2C;AACI;AACS;AACT;AAC/C,IAAI,UAAI,GAAG,iBAAa;;AAExB;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,mBAAe;AACnC;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;AACzC;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAI;AACpB,gBAAgB,UAAI;AACpB,qBAAqB,UAAI;AACzB;AACA;AACA;AACA;AACA;;AAEA,YAAY,UAAI;AAChB,YAAY,UAAI;AAChB,YAAY,UAAI;AAChB,YAAY,UAAI;;AAEhB,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;;AAED,+BAAqB,0BAA0B,mBAAmB;;AAElE,4CAAe,aAAa,E;;AC3GmB;AACF;AACF;AACe;AACJ;AACtD,IAAI,uBAAY,GAAG,0BAAqB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,wBAAwB,mBAAc;;AAEtC,wBAAwB,mBAAc;AACtC,sBAAsB,OAAe,EAAE,uBAAuB;AAC9D;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,wBAAwB,mBAAc;AACtC,sBAAsB,KAAa;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,oBAAoB,oBAAe;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uBAAY;AACtC,4BAA4B,uBAAY;;AAExC,yBAAyB,8BAAoB;;AAE7C;AACA;AACA,aAAa;;AAEb;AACA,2BAA2B,wBAAwB;AACnD;AACA,gCAAgC,yBAAoB;AACpD;;AAEA,mCAAmC;AACnC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uBAAY;;AAEtC,qBAAqB,8BAAoB;;AAEzC;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,2BAA2B,wBAAwB;AACnD;;AAEA,mCAAmC;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,yBAAoB;AAChD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA,wDAAe,UAAU,E;;ACjMzB;AACA;AACA;AACA;AACA;AACA;AAC+C;AACJ;AACa;;AAExD;AACA;AACA;;AAEA,sBAAsB,mBAAe;AACrC;AACA;AACA,0BAA0B,sBAAkB;AAC5C,0BAA0B,sBAAkB;AAC5C,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;AACzC;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,cAAc;AAC7B,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,+BAAqB,4BAA4B,mBAAmB;;AAEpE,8CAAe,eAAe,E;;ACzI9B,kDAAe,iEAAiE,sCAAsC,wBAAwB,sDAAsD,uBAAuB,mEAAmE,mCAAmC,4BAA4B,kBAAkB,yDAAyD,qEAAqE,sBAAsB,gEAAgE,sBAAsB,0CAA0C,iCAAiC,GAAG,iFAAiF,4BAA4B,iCAAiC,mCAAmC,8CAA8C,gCAAgC,4BAA4B,kBAAkB,qFAAqF,gDAAgD,WAAW,SAAS,EAAC;;;ACAzkC;AACa;;AAEA;AAClD,4BAAuB,CAAC,WAAU;;AAElC,iDAAe,0BAAqB;AACpC,uBAAuB,OAAe;AACtC;AACA,KAAK;AACL,uBAAuB,uBAAkB;AACzC,gBAAgB,2BAAsB;AACtC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;ACvB6C;AACc;;AAEhB;AACa;AACf;AACS;;AAEpD,IAAI,uBAAY,GAAG,0BAAqB;;AAExC,IAAI,wBAAa;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,mBAAc;AACtC,sBAAsB,OAAe,EAAE,uBAAuB;AAC9D;AACA;AACA;AACA,KAAK;AACL,6BAA6B,UAAU;AACvC;;AAEA,uBAAuB,mBAAc;AACrC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,kBAAkB,wBAAa;AAC/B;AACA;;AAEA;AACA;;AAEA,oBAAoB,yBAAoB;AACxC,wBAAwB,uBAAY;AACpC,sBAAsB,uBAAY;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,yBAAoB;AAC5C,YAAY,uBAAY;AACxB;AACA,wBAAwB,uBAAY;AACpC,wBAAwB,uBAAY;AACpC;AACA;;AAEA,uBAAuB,wBAAwB;AAC/C;;AAEA,+BAA+B;AAC/B,sBAAsB,wBAAa;AACnC,2BAA2B,wBAAa;AACxC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB,wBAAa;AACnC,2BAA2B,wBAAa;AACxC;AACA;AACA;;AAEA;AACA;AACA,yCAAyC,uBAAa;AACtD;AACA;AACA;AACA,4BAA4B,uBAAY;;AAExC,6BAA6B,8BAAoB;AACjD,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,wBAAa;AAC/B,uBAAuB,wBAAa;AACpC,yBAAyB,uBAAY;AACrC;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,8BAAoB;AAC7C,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,+BAA+B;AAClD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wDAAe,UAAU,E;;AC9NzB,mDAAe,uFAAuF,sCAAsC,iCAAiC,uBAAuB,kBAAkB,2DAA2D,qBAAqB,GAAG,uFAAuF,yBAAyB,4CAA4C,oEAAoE,yCAAyC,WAAW,gFAAgF,2CAA2C,kDAAkD,GAAG,qKAAqK,yFAAyF,iGAAiG,wEAAwE,6DAA6D,iEAAiE,oCAAoC,0BAA0B,2CAA2C,IAAI,+BAA+B,2CAA2C,IAAI,IAAI,iFAAiF,+EAA+E,+EAA+E,cAAc,sBAAsB,kCAAkC,4CAA4C,IAAI,uCAAuC,4CAA4C,IAAI,SAAS,kDAAkD,kDAAkD,0CAA0C,qDAAqD,gBAAgB,gBAAgB,IAAI,qCAAqC,qBAAqB,4EAA4E,iFAAiF,8BAA8B,8BAA8B,yBAAyB,iCAAiC,yDAAyD,kCAAkC,kCAAkC,8BAA8B,mEAAmE,mCAAmC,4BAA4B,yBAAyB,iGAAiG,8DAA8D,uBAAuB,gDAAgD,2FAA2F,yBAAyB,4FAA4F,oEAAoE,yCAAyC,0DAA0D,SAAS,EAAC;;;ACAv2G;;AAE+C;AACc;AAChB;AACM;AACO;AACf;AAC3C,IAAI,uBAAY,GAAG,0BAAqB;AAC6B;AACrB;AACV;AACA;AACc;;AAEQ;AAC5D,4BAAuB,CAAC,YAAW;;AAEnC,IAAI,wBAAa;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,gCAAgC,uBAAkB;AAClD;AACA,oBAAoB,2BAAsB;AAC1C;AACA;AACA,SAAS;AACT,gCAAgC,uBAAkB;AAClD;AACA,oBAAoB,2BAAsB;AAC1C;AACA;AACA,SAAS;AACT;AACA;;AAEA,2BAA2B,mBAAc;;AAEzC,4BAA4B,iBAAY;AACxC;AACA,SAAS;AACT;;AAEA;AACA;AACA,2BAA2B,iBAAU;AACrC;AACA;AACA,SAAS;;AAET;AACA;AACA,2BAA2B,iBAAU;AACrC;AACA;AACA,SAAS;;AAET;AACA;AACA,qCAAqC,0BAAqB;AAC1D;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,wCAAwC,mBAAc;AACtD,0BAA0B,OAAe,EAAE,uBAAuB;AAClE;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,6CAA6C,0BAAqB;AAClE;AACA;AACA,SAAS;AACT,0CAA0C,UAAU;AACpD;AACA;AACA,SAAS;AACT;AACA;;AAEA,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2DAA2D,kBAAa;;AAExE;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAa;AACpC,uBAAuB,wBAAa;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAiB;AAChD;AACA,yBAAyB,8BAA8B;AACvD;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8DAA8D;AAC9D,8DAA8D;;AAE9D;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,sBAAiB,QAAQ,sBAAiB;AACpE,yBAAyB,sBAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA,mBAAmB,0BAAqB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,yBAAoB;AAC5C,4BAA4B,uBAAY;AACxC,0BAA0B,uBAAY;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,wBAAa;;AAE3C;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mCAAmC;AACnC,6BAA6B,wBAAa;AAC1C,sCAAsC,wBAAa;AACnD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,aAAa;AACzD;AACA;AACA;AACA;AACA;AACA,oCAAoC,yCAA+B;AACnE;AACA;AACA;;AAEA;AACA,6BAA6B,8BAAoB;AACjD,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;AACA;AACA;AACA,2BAA2B,wBAAa;AACxC;AACA,gBAAgB,wBAAa;;AAE7B;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;;ACzkBF;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,WAAW,GAAU;AACrB;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,MAAa;AACxB;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,CAAC;;AAED;AACA,0DAAe,SAAS,E;;ACnFuB;AACe;;AAE9D;;AAEA,IAAI,wBAAc;;AAElB;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAAqB,cAAc,mBAAS;;AAE5C,yDAAe,WAAW,E;;ACpDqB;;AAE/C;;AAEA,IAAI,2BAAiB;AACrB;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,+BAAqB,SAAS,sBAAY;;AAE1C,oDAAe,MAAM,E;;AC5BrB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAI,uBAAa;AACjB,IAAI,uBAAa;AACjB,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,8EAA8E;AACvG,WAAW,uBAAa;AACxB;;AAEO,SAAS,iBAAS;AACzB,IAAI,uBAAa;AACjB,mBAAmB,sBAAsB;AACzC;AACA;;AAEO,IAAI,gBAAQ;AACnB,IAAI,gBAAQ;AACZ,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAQ;AACnB;;AAEO,SAAS,cAAM;AACtB;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;AACA;AACA;;AAEO,SAAS,kBAAU;AAC1B;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;;AAEO,SAAS,eAAO;AACvB,mCAAmC,oCAAoC;AACvE;;AAEO,SAAS,kBAAU;AAC1B;AACA;;AAEO,SAAS,iBAAS;AACzB,2BAA2B,+DAA+D,gBAAgB,EAAE,EAAE;AAC9G;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,qFAAqF;AACpH;AACA,KAAK;AACL;;AAEO,SAAS,mBAAW;AAC3B,aAAa,6BAA6B,0BAA0B,aAAa,EAAE,qBAAqB;AACxG,gBAAgB,qDAAqD,oEAAoE,aAAa,EAAE;AACxJ,sBAAsB,sBAAsB,qBAAqB,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,kCAAkC,SAAS;AAC3C,kCAAkC,WAAW,UAAU;AACvD,yCAAyC,cAAc;AACvD;AACA,6GAA6G,OAAO,UAAU;AAC9H,gFAAgF,iBAAiB,OAAO;AACxG,wDAAwD,gBAAgB,QAAQ,OAAO;AACvF,8CAA8C,gBAAgB,gBAAgB,OAAO;AACrF;AACA,iCAAiC;AACjC;AACA;AACA,SAAS,YAAY,aAAa,OAAO,EAAE,UAAU,WAAW;AAChE,mCAAmC,SAAS;AAC5C;AACA;;AAEO,IAAI,uBAAe;AAC1B;AACA,kCAAkC,oCAAoC,aAAa,EAAE,EAAE;AACvF,CAAC;AACD;AACA;AACA,CAAC;;AAEM,SAAS,oBAAY;AAC5B,yFAAyF,uBAAe;AACxG;;AAEO,SAAS,gBAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEO,SAAS,cAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM,gBAAgB;AACzC;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;;AAEO,SAAS,gBAAQ;AACxB,4BAA4B,sBAAsB;AAClD,uBAAuB,cAAM;AAC7B;AACA;;AAEO,SAAS,sBAAc;AAC9B,iDAAiD,QAAQ;AACzD,wCAAwC,QAAQ;AAChD,wDAAwD,QAAQ;AAChE;AACA;AACA;;AAEO,SAAS,eAAO;AACvB,2BAA2B,eAAO,4BAA4B,eAAO;AACrE;;AAEO,SAAS,wBAAgB;AAChC;AACA;AACA,iBAAiB,sFAAsF,aAAa,EAAE;AACtH,sBAAsB,gCAAgC,qCAAqC,0CAA0C,EAAE,EAAE,GAAG;AAC5I,2BAA2B,MAAM,eAAe,EAAE,YAAY,oBAAoB,EAAE;AACpF,sBAAsB,oBAAoB,eAAO,yEAAyE;AAC1H,6BAA6B,uBAAuB;AACpD,4BAA4B,wBAAwB;AACpD,2BAA2B,yDAAyD;AACpF;;AAEO,SAAS,wBAAgB;AAChC;AACA,iBAAiB,4CAA4C,SAAS,EAAE,qDAAqD,aAAa,EAAE;AAC5I,yBAAyB,6BAA6B,oBAAoB,QAAQ,eAAO,iCAAiC,gBAAgB,EAAE,KAAK;AACjJ;;AAEO,SAAS,qBAAa;AAC7B;AACA;AACA,uCAAuC,gBAAQ,kBAAkB,gBAAQ,kCAAkC,sFAAsF,aAAa,EAAE;AAChN,sBAAsB,8BAA8B,gDAAgD,uDAAuD,EAAE,EAAE,GAAG;AAClK,4CAA4C,sCAAsC,UAAU,oBAAoB,EAAE,EAAE,UAAU;AAC9H;;AAEO,SAAS,4BAAoB;AACpC,gCAAgC,uCAAuC,aAAa,EAAE,EAAE,OAAO,kBAAkB;AACjH;AACA;;AAEA,IAAI,0BAAkB;AACtB,yCAAyC,6BAA6B;AACtE,CAAC;AACD;AACA;;AAEO,SAAS,oBAAY;AAC5B;AACA;AACA,6GAA6G,uBAAe;AAC5H,IAAI,0BAAkB;AACtB;AACA;;AAEO,SAAS,uBAAe;AAC/B,4CAA4C;AAC5C;;AAEO,SAAS,8BAAsB;AACtC;AACA;AACA;AACA;AACA;;AAEO,SAAS,8BAAsB;AACtC;AACA;AACA;AACA;AACA;AACA;;;;ACjOA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACuC;AACS;AAChD;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE,MAAa;AACf;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,iCAAiC;;AAEjC;AACA,QAAQ,IAAqC;AAC7C,MAAM,IAAW;AACjB;AACA;AACA;AACA,OAAO;AACP;;AAEA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,uBAAuB;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,oBAAoB,YAAmB;AACvC,0EAA0E,sBAAc;AACxF;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA,IAAI,WAAa;AACjB;AACA;AACA;AACA,IAAI,QAAe;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,+CAA+C,yBAAyB;AACxE;AACA,mCAAmC;AACnC;AACA;AACA;AACA;;;AAGO;AACP;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;;AAEA,MAAM,IAAqC;AAC3C,IAAI,MAAa;AACjB;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC;;AAExC;AACA;;AAEA;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;;AAEA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,MAAM,IAAW;AACjB;AACA,OAAO;AACP,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,IAAI,IAAW;AACf;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,IAAI;AACJ,I;;;AC5VA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACjC;AACf;AACA,iBAAiB,uBAAuB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,uBAAuB;AAC1C;;AAEA,sBAAsB,OAAc,yCAAyC,OAAc;AAC3F;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA,C;;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACzC;AACP;AACA;AACA,mBAAmB,eAAe;;AAElC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;;;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACiD;AACH;AAC9C,wCAAwC;;AAExC,sBAAsB,IAAM;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;;;AAGA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA,gDAAe,cAAc,E;;;ACjG7B;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACzC;AACP;AACA;AACA,mBAAmB,eAAe;;AAElC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;;;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACzC;AACP;AACA;AACA,mBAAmB,eAAe;;AAElC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;;;;AC1DD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACuC;AAC6B;AACjB;AACJ;AACI;AACA;AACS;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,IAAI,KAAK;AACT,IAAI;AACJ;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA,+CAA+C;;;AAG/C;AACA;AACA,oBAAoB,KAAK;AACzB,IAAI;AACJ;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;;AAGA;AACA;AACA,IAAI;;;AAGJ;AACA,SAAS,aAAQ;AACjB;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA,OAAO;;;AAGP;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,CAAC;;AAED,CAAC;;AAED,iBAAiB;AACjB,gBAAgB;AAChB,KAAK,QAAQ,cAAc;AAC3B,KAAK,QAAQ,cAAc;AAC3B,KAAK,QAAQ,cAAc;AAC3B,KAAK,QAAQ,SAAc;AAC3B,kDAAe,KAAK,E;;;ACrPpB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6CAAe;AACf;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,0CAA0C,MAAM;AAChD;AACA,KAAK;AACL;AACA;AACA;AACA,+BAA+B,WAAW,QAAQ,WAAW;AAC7D,kCAAkC,WAAW;AAC7C,OAAO;AACP;AACA,mCAAmC,YAAY;AAC/C,yBAAyB,SAAS,cAAc,WAAW,eAAe,WAAW;AACrF,4BAA4B,SAAS,cAAc,WAAW;AAC9D;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,+BAA+B,WAAW;AAC1C,+BAA+B,KAAK,KAAK,MAAM;AAC/C,qBAAqB,MAAM;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;;AC1JD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAAe;AACf;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,0BAA0B,MAAM;AAChC;AACA,KAAK;AACL;AACA;AACA;AACA,yBAAyB,WAAW,IAAI,WAAW;AACnD,4BAA4B,WAAW;AACvC,OAAO;AACP;AACA,oBAAoB,YAAY;AAChC,qBAAqB,SAAS,SAAS,WAAW,EAAE,WAAW;AAC/D,wBAAwB,SAAS,OAAO,WAAW;AACnD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,yBAAyB,WAAW;AACpC,kBAAkB,KAAK,KAAK,MAAM;AAClC,qBAAqB,MAAM;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;;ACtJD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACmC;AACI;;AAEH;AACA;AAC2B;AAC/D;AACA;AACA;AACA;AACA;AACO,mBAAmB,qBAAgB;AAC1C;AACA;AACA;AACA;AACA,CAAC;AACM;AACP;AACA,6BAA6B,WAAK;AAClC;AACA,CAAC;AACD;AACA;;AAEO;AACP,MAAM,QAAQ;AACd;;AAEA;AACA,aAAa,KAAK;AAClB,KAAK;AACL,aAAa,KAAK,CAAC,KAAK,aAAa,KAAK;AAC1C;AACA,GAAG;AACH,WAAW,KAAK,CAAC,KAAK,UAAU,KAAK;AACrC;AACA;AACO;AACP;AACA;AACO;AACP;AACA,CAAC;;AAED,0BAA0B,MAAM;AAChC,0BAA0B,MAAM,E;;;ACxFhC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACT;AAC6C;AACjD;AAC5B;AACA;AACA;AACA;AACA;AACA;AACP,UAAU,KAAK;AACf,WAAW,IAAI;AACf,SAAS,EAAE;AACX,UAAU,GAAG,EAAE,GAAG;AAClB,YAAY,GAAG,EAAE,GAAG;AACpB,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG;AACzB,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI;AACpC,UAAU,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI;AAC9C;AACA,yBAAyB,KAAK,EAAE,GAAG,EAAE,GAAG;AACjC;AACP,UAAU,KAAK;AACf,WAAW,KAAK,EAAE,GAAG;AACrB;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACA;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,aAAa,SAAoB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,WAAK,UAAU,cAAc,SAAS,WAAW,KAAK,qBAAqB;AAC/G;AACA;AACA;AACA;AACA;AACA,oCAAoC,KAAK,sBAAsB,GAAG,4BAA4B,EAAE,sBAAsB,KAAK,4BAA4B,IAAI,gCAAgC,GAAG,yBAAyB,EAAE,sBAAsB,GAAG,yBAAyB,EAAE,sBAAsB,KAAK,4BAA4B,GAAG,gCAAgC,EAAE,sBAAsB,GAAG,yBAAyB,EAAE,sBAAsB,GAAG,8BAA8B,EAAE,sBAAsB,GAAG,yBAAyB,EAAE,sBAAsB,GAAG,yBAAyB,EAAE,sBAAsB,IAAI,yBAAyB,EAAE;AACnnB;AACO;AACP;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH,mBAAmB,WAAa,GAAG;;AAEnC;AACA,qBAAqB,6BAA6B;AAClD,0CAA0C,8CAA8C;AACxF;AACA;;AAEA;AACA,MAAM,aAAe;AACrB;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA,gCAAgC,QAAQ;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,QAAQ,OAAc;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACO;AACP,aAAa,SAAoB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACO;AACP,yCAAyC,SAAoB;AAC7D;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA,C;;;ACpSA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACuC;AACI;AACpC;AACP,EAAE,YAAY;AACd,mBAAmB,IAAI;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,C;;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACiB;AACd;AACP;AAC5C;AACA;AACA;;AAEO;AACP,OAAO,SAAS;AAChB,WAAW,QAAe;AAC1B;;AAEA;AACA,+BAA+B,IAAI,UAAU,EAAE;AAC/C;AACO;AACP;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACO,IAAI,wBAAiB,GAAG,iBAAwB;AACvD;AACA;AACA,aAAa;AACb,YAAY;AACZ,YAAY;AACZ,cAAc;AACd,cAAc;AACd;AACO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,6CAA6C,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;;AAE3E;AACA,kBAAkB,IAAW;AAC7B;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,4BAA4B,SAAS;;AAErC;AACA,aAAa,MAAU;AACvB,KAAK;AACL;AACA,KAAK;;AAEL;;AAEA;AACA,WAAW,YAAmB,wCAAwC,QAAe;AACrF,GAAG;;;AAGH,sBAAsB,eAAe;AACrC,0EAA0E,YAAmB;AAC7F;AACA;;AAEA;AACA,WAAW,uDAAuD;AAClE;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;;;AAGO;AACP,OAAO,OAAc;AACrB;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,iBAAiB,kBAAkB;AACnC;AACA;AACA;;AAEA,yBAAyB,uBAAuB;AAChD,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEO;AACP,EAAE,IAAW;AACb,wBAAwB,YAAY;AACpC,GAAG;AACH;AACA;AACO;AACP,YAAY,QAAe;AAC3B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mEAAmE,sBAAsB,iBAAiB,gBAAgB,uBAAuB,UAAU,WAAW;AACtK,4BAA4B,4EAA4E,iBAAiB,wBAAwB,WAAW,YAAY,2CAA2C;AACnN,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEO;AACP,MAAM,IAAqC;AAC3C,IAAI,mBAAmB;AACvB;;AAEA;AACA;AACA;;AAEA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,GAAG,qFAAqF,GAAG,sCAAsC,GAAG,sCAAsC,GAAG,sCAAsC,GAAG,uCAAuC,GAAG;AAC1R;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,SAAS,QAAe,kBAAkB,QAAe,wDAAwD;AACjH;AACoE;AACpE;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;ACrRA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACS;AACjB;AACD;AACvC,IAAI,WAAI,GAAG,IAAW;AACtB;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,6BAA6B;AACxC,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;;AAGO;AACP;AACA;AACA,WAAW,6BAA6B;AACxC,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;AAEO,WAAW,KAAY;AAC9B;AACA;AACA,WAAW,6BAA6B;AACxC,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;AAEO,WAAW,KAAY;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,UAAU,mBAAY;AACtB,UAAU,mBAAY;AACtB,WAAW,mBAAY;AACvB,WAAW,mBAAY;AACvB;AACA;AACA;AACA;AACA,WAAW,wBAA4B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,WAAW,wBAA4B;AACvC;AACA;AACA,aAAa,mBAAY;AACzB,YAAY,mBAAY;AACxB,cAAc,mBAAY;AAC1B,eAAe,mBAAY;AAC3B,cAAc,mBAAY;AAC1B,eAAe,mBAAY;AAC3B;AACA;AACA,mCAAmC;;AAEnC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;;AAGL;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;;AAEA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,iBAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,UAAU,GAAG;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,qCAAqC,iBAAY;AACjD,GAAG;AACH;;AAEA;AACA,6CAA6C;AAC7C;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH,iCAAiC,aAAe;AAChD;AACA;AACA,GAAG,wCAAwC;AAC3C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;AAEO;AACP;AACA;AACO;AACP;AACA,SAAS,QAAe;AACxB;AACA,GAAG;AACH;AACA;AACA;AACA,4BAA4B,oBAAoB,cAAc;AAC9D;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,GAAG,OAAc;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,WAAI;AACR;AACA,KAAK;AACL,IAAI,WAAI;AACR;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK,sBAAsB,uBAAuB;AAClD,yBAAyB,WAAW,iBAAiB,WAAW;AAChE;AACA;;;AAGA;AACA;AACA,KAAK,sBAAsB,uBAAuB;AAClD;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,uBAAuB,kBAAkB;AACzC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI,WAAI;AACR;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEO;AACP,4BAA4B;AAC5B;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;;AAEO;AACP,sBAAsB,WAAI;AAC1B;AACA,GAAG;AACH;AACA,C;;ACzeqC;AACD;AACJ;;AAEhC;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,uBAAuB,oCAAoC;AAC3D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,oBAAoB;AAC9B,YAAY,WAAW;AACvB,WAAW,oBAAoB;AAC/B,WAAW,oBAAoB;AAC/B,eAAe,2BAA2B;AAC1C,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,IAAI,8BAAyB;AAC7B;;AAEA;AACA,mBAAmB,iCAAiC;AACpD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,eAAe,wBAAY;;AAE3B,0BAA0B,sBAAsB;AAChD;AACA;;AAEA;AACA,gCAAgC,6BAA6B;AAC7D,gCAAgC,4BAA4B;AAC5D,+BAA+B,cAAc;AAC7C,SAAS;AACT,gCAAgC,2BAA2B;AAC3D,gCAAgC,4BAA4B;AAC5D;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C,uBAAuB,oBAAoB;AAC3C;AACA;;AAEA,SAAS,wBAAY;AACrB;AACA;AACA;;AAEA,6DAAe,WAAW,EAAC;;;AC5G3B,qDAAe,sFAAsF,qCAAqC,uCAAuC,yCAAyC,yCAAyC,wGAAwG,0BAA0B,cAAc,gCAAgC,0EAA0E,yFAAyF,oDAAoD,gCAAgC,+CAA+C,GAAG,oEAAoE,0BAA0B,6BAA6B,iCAAiC,6BAA6B,iCAAiC,8CAA8C,qDAAqD,2BAA2B,0DAA0D,WAAW,IAAI,IAAI,6CAA6C,yBAAyB,iCAAiC,gEAAgE,0BAA0B,iCAAiC,4DAA4D,uEAAuE,0BAA0B,oDAAoD,yBAAyB,0DAA0D,WAAW,gEAAgE,0BAA0B,+CAA+C,8CAA8C,qDAAqD,yCAAyC,iDAAiD,WAAW,gGAAgG,6BAA6B,qCAAqC,mEAAmE,eAAe,gCAAgC,0EAA0E,yFAAyF,iDAAiD,qCAAqC,GAAG,sEAAsE,4BAA4B,+BAA+B,8CAA8C,yDAAyD,oEAAoE,8BAA8B,oCAAoC,WAAW,mIAAmI,iCAAiC,gDAAgD,GAAG,6EAA6E,kDAAkD,iDAAiD,8CAA8C,yBAAyB,YAAY,yEAAyE,KAAK,qDAAqD,wEAAwE,sEAAsE,uEAAuE,iEAAiE,kEAAkE,wEAAwE,uEAAuE,kEAAkE,8BAA8B,WAAW,iEAAiE,kDAAkD,GAAG,mDAAmD,iBAAiB,qBAAqB,wBAAwB,WAAW,IAAI,sDAAsD,uCAAuC,4BAA4B,gDAAgD,gDAAgD,uBAAuB,GAAG,4HAA4H,yDAAyD,4CAA4C,+BAA+B,sIAAsI,4CAA4C,0EAA0E,0CAA0C,uEAAuE,aAAa,cAAc,GAAG,8FAA8F,2FAA2F,GAAG,iFAAiF,kCAAkC,gDAAgD,+CAA+C,sDAAsD,+BAA+B,6CAA6C,gCAAgC,6BAA6B,IAAI,KAAK,cAAc,IAAI,uEAAuE,WAAW,mSAAmS,4EAA4E,mFAAmF,gJAAgJ,uEAAuE,iEAAiE,sEAAsE,qEAAqE,wGAAwG,0FAA0F,iGAAiG,2IAA2I,4CAA4C,kEAAkE,wLAAwL,uBAAuB,qBAAqB,oCAAoC,YAAY,gJAAgJ,yCAAyC,KAAK,8CAA8C,0BAA0B,WAAW,+BAA+B,KAAK,GAAG,2LAA2L,8HAA8H,uBAAuB,2BAA2B,sBAAsB,wBAAwB,YAAY,iGAAiG,0PAA0P,qCAAqC,IAAI,KAAK,qDAAqD,iCAAiC,YAAY,+BAA+B,KAAK,GAAG,mHAAmH,uBAAuB,qBAAqB,2CAA2C,YAAY,qKAAqK,yCAAyC,KAAK,qDAAqD,iCAAiC,YAAY,+BAA+B,KAAK,GAAG,2JAA2J,sBAAsB,kBAAkB,qBAAqB,qCAAqC,YAAY,6CAA6C,wCAAwC,oHAAoH,KAAK,+CAA+C,2BAA2B,YAAY,+BAA+B,KAAK,GAAG,uBAAuB,EAAC;;;ACA30T;AACI;AACE;AACQ;AACR;AACA;AACH;AACJ;AACI;AACM;AACR;AACI;AACI;AACa;AACL;;AAEX;AACc;;AAEhB;;AAEpC,IAAI,iBAAO;;AAEoD;AAC/D,iBAAgB,CAAC,cAAa;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,oBAAoB,gBAAW;AAC/B;AACA;AACA;AACA,mBAAmB,iCAAiC,KAAK;AACzD,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,0BAA0B,eAAW;;AAErC,qBAAqB;AACrB;AACA;AACA;AACA;AACA,SAAS;;AAET,2BAA2B;AAC3B,8BAA8B;;AAE9B;AACA;;AAEA,yBAAyB;AACzB,2BAA2B;;AAE3B,0BAA0B,sBAAW;AACrC;AACA,CAAC;AACD;AACA,8BAA8B,eAAI;AAClC,kBAAkB,iBAAa;AAC/B,KAAK;AACL,8BAA8B,eAAI;AAClC,kBAAkB,iBAAa;AAC/B,KAAK;AACL;AACA;AACA;AACA;;AAEA,gCAAgC,eAAI;AACpC,kBAAkB,iBAAa;AAC/B,KAAK;AACL,CAAC;AACD;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,WAAW;AAC3B,gBAAgB,YAAY;AAC5B,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,mCAAmC;AAC1D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD,uDAAuD;AACvD,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD,wDAAwD;AACxD;AACA;;AAEA;AACA;AACA;AACA,kDAAkD;AAClD,gDAAgD;AAChD,sDAAsD;AACtD;;AAEA;AACA,mDAAmD;AACnD;AACA,KAAK;;AAEL;;AAEA,+BAA+B,YAAO;AACtC,kCAAkC,YAAO;AACzC,2BAA2B,gBAAW;AACtC,6BAA6B,YAAO;AACpC,kCAAkC,YAAO;AACzC,sCAAsC,YAAO;AAC7C,kCAAkC,YAAO;;AAEzC;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB,6BAA6B,8BAA0B;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,oBAAW;AACvB,YAAY,sBAAa;AACzB,YAAY,sBAAa;;AAEzB;AACA,uDAAuD,kBAAiB;;AAExE;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA2B,yBAAyB;AACpD;AACA;AACA;AACA;AACA,oBAAoB,yBAAgB;AACpC;AACA;AACA,oBAAoB,mBAAU;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iCAAiC,YAAO;AACxC;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb,yBAAyB,8BAA0B;AACnD;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,yBAAyB,YAAO;AAChC;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,yBAAyB,8BAA0B;AACnD;;AAEA;AACA;AACA;AACA,uBAAuB,gBAAW;AAClC;AACA,4BAA4B,gBAAW;AACvC;AACA;AACA;AACA,yBAAyB,YAAO;AAChC;AACA;;AAEA,iCAAiC;AACjC;AACA;AACA;AACA;AACA,mCAAmC,KAAK,iBAAO,QAAQ;AACvD,2CAA2C,iBAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,KAAK,iBAAO,QAAQ;AACnD,sCAAsC,iBAAO;AAC7C;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,KAAK,iBAAO,QAAQ;AACnD,0CAA0C,iBAAO;AACjD,2CAA2C,iBAAO;AAClD;AACA;AACA;AACA,SAAS;;AAET,uBAAuB,OAAO;AAC9B,yBAAyB,iBAAO;AAChC;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,iCAAiC,YAAQ;AACzC;AACA,4BAA4B,UAAM,CAAC,iBAAa,2BAA2B,iBAAa;AACxF,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,kBAAkB,iBAAa;AAC/B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,eAAW;AACzC;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iBAAa;AAC5C;AACA;AACA;AACA,oCAAoC,cAAc;AAClD,oCAAoC,cAAc;AAClD;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,kCAAkC,YAAO;AACzC,uCAAuC,gBAAW;AAClD,gCAAgC,gBAAW;AAC3C;AACA;AACA;AACA;AACA,qDAAqD,mBAAW;AAChE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,mBAAc;AAC1B,YAAY,qBAAgB;;AAE5B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,0CAA0C,kBAAiB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,oBAAW;;AAEnB;AACA,KAAK;;AAEL;AACA,gBAAgB,oCAAoC;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;;AAEA,gDAAe,aAAa,EAAC;;;ACt4BG;;AAEhC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,gBAAW;AAChC;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,uBAAuB;;AAEvB;AACA;AACA,+BAA+B;AAC/B,2BAA2B;;AAE3B,qBAAqB;AACrB,6BAA6B;;AAE7B;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA,2CAA2C;AAC3C;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA,oCAAoC;AACpC;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6GAA6G;AAC7G;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,gEAAe,cAAc,EAAC;;;ACrPE;AACS;;AAEzC;AACA;AACA;AACA;AACA,YAAY,gBAAW;AACvB;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,eAAe,+BAA+B;AAC9C;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;AACL;AACA,gBAAgB,sCAAsC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,0DAA0D,yBAAS;AACnE;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,uDAAe,KAAK,EAAC;;;AC3IO;AACY;AACC;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,uBAAY;AAC7B;AACA;AACA;;AAEA,0BAA0B,sBAAW;;AAErC,0BAA0B,eAAW;AACrC;AACA,SAAS;AACT;AACA,CAAC;AACD;AACA;AACA;AACA,QAAQ,uCAA4B;AACpC;AACA,KAAK;AACL;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;;AAEA,uBAAuB,0BAA0B;AACjD;AACA;;AAEA,uBAAuB,0BAA0B;AACjD;AACA;;AAEA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA,CAAC;;AAED,4DAAe,UAAU,EAAC;;;ACrFoB;AACV;AACK;;AAEzC;AACA;AACA;AACA;AACA,gBAAgB,gCAAqB;AACrC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA,CAAC;AACD,2BAA2B,eAAW;AACtC,CAAC;AACD;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gCAAgC,uBAAuB,GAAG,uBAAuB;AACjF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,CAAC;;AAED,2DAAe,SAAS,EAAC;;;AC9FqB;;AAE9C;AACA;AACA;AACA;AACA,kBAAkB,gCAAqB;AACvC;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC;;AAED;AACA;AACA,KAAK;;AAEL;AACA,+BAA+B;AAC/B;AACA,CAAC;;AAED,6DAAe,WAAW,EAAC;;;AC9B3B;AAC0B;AACoB;;AAE9C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,gCAAqB;AACtC;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA,kBAAkB;;AAElB;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,uBAAuB;;AAEvB;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,+BAA+B;AAC/B,2BAA2B;;AAE3B,qBAAqB;AACrB,6BAA6B;;AAE7B;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,mBAAmB,eAAI;AACvB;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,QAAQ,8CAAmC;;AAE3C;AACA;AACA;AACA,CAAC;;AAED,4DAAe,UAAU,EAAC;;;AChT1B,uDAAe,8DAA8D,4BAA4B,iCAAiC,+BAA+B,+BAA+B,4BAA4B,iCAAiC,8CAA8C,gBAAgB,8CAA8C,4DAA4D,kEAAkE,wDAAwD,qDAAqD,qCAAqC,mDAAmD,qCAAqC,GAAG,oEAAoE,4BAA4B,iCAAiC,gBAAgB,8CAA8C,2CAA2C,qCAAqC,GAAG,kEAAkE,4BAA4B,+BAA+B,gBAAgB,8CAA8C,uDAAuD,qCAAqC,GAAG,kEAAkE,4BAA4B,+BAA+B,gBAAgB,6CAA6C,6CAA6C,qCAAqC,GAAG,+DAA+D,4BAA4B,4BAA4B,gBAAgB,6CAA6C,0CAA0C,qCAAqC,GAAG,oEAAoE,4BAA4B,iCAAiC,8CAA8C,gBAAgB,6CAA6C,wBAAwB,mCAAmC,mDAAmD,qCAAqC,GAAG,OAAO,EAAC;;;ACAvqE,gDAAe,oEAAoE,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,6EAA6E,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,4BAA4B,4BAA4B,4BAA4B,4GAA4G,wBAAwB,+BAA+B,4CAA4C,8BAA8B,6EAA6E,iFAAiF,uCAAuC,wBAAwB,yBAAyB,kBAAkB,OAAO,OAAO,+BAA+B,iFAAiF,oBAAoB,kBAAkB,IAAI,wDAAwD,GAAG,SAAS,EAAC;;;ACAv9C,+CAAe,8DAA8D,4BAA4B,8CAA8C,wCAAwC,wDAAwD,qCAAqC,sCAAsC,wDAAwD,GAAG,0EAA0E,+BAA+B,+BAA+B,iCAAiC,wCAAwC,0EAA0E,+EAA+E,oFAAoF,0DAA0D,GAAG,6DAA6D,4BAA4B,8CAA8C,gBAAgB,+CAA+C,qCAAqC,6CAA6C,GAAG,OAAO,EAAC;;;ACA3pC,+CAAe,wDAAwD,4BAA4B,2BAA2B,gBAAgB,6CAA6C,kCAAkC,cAAc,2CAA2C,gDAAgD,cAAc,0CAA0C,+CAA+C,gBAAgB,6EAA6E,6EAA6E,gBAAgB,6EAA6E,6EAA6E,+CAA+C,+CAA+C,+DAA+D,4CAA4C,GAAG,OAAO,EAAC;;;ACAr9B,oDAAe,iFAAiF,4BAA4B,4BAA4B,0BAA0B,wCAAwC,0DAA0D,gCAAgC,qDAAqD,8FAA8F,GAAG,OAAO,EAAC;;;ACAld,kDAAe,+EAA+E,4BAA4B,wCAAwC,wDAAwD,8BAA8B,+CAA+C,+BAA+B,kDAAkD,gEAAgE,WAAW,OAAO,EAAC;;;ACA3c,kDAAe,2DAA2D,8BAA8B,4BAA4B,uCAAuC,0BAA0B,sDAAsD,gEAAgE,4DAA4D,GAAG,gBAAgB,0DAA0D,6EAA6E,8DAA8D,8DAA8D,8DAA8D,8DAA8D,iDAAiD,kDAAkD,cAAc,4CAA4C,oDAAoD,IAAI,WAAW,qBAAqB,IAAI,mCAAmC,GAAG,SAAS,EAAC;;;ACAljC,sDAAe,+DAA+D,wCAAwC,0BAA0B,qDAAqD,kCAAkC,GAAG,gDAAgD,0DAA0D,yFAAyF,oEAAoE,oEAAoE,oEAAoE,4CAA4C,4CAA4C,4CAA4C,4CAA4C,sDAAsD,8FAA8F,0EAA0E,+DAA+D,+DAA+D,+DAA+D,iBAAiB,2CAA2C,GAAG,OAAO,EAAC;;;ACA3wC,oDAAe,qFAAqF,wCAAwC,iCAAiC,0BAA0B,wEAAwE,4FAA4F,UAAU,0DAA0D,iEAAiE,2DAA2D,iEAAiE,2DAA2D,iEAAiE,2DAA2D,iEAAiE,2DAA2D,sCAAsC,mEAAmE,UAAU,0DAA0D,2DAA2D,2DAA2D,2DAA2D,qCAAqC,WAAW,OAAO,EAAC;;;ACArzC,+CAAe,uFAAuF,gDAAgD,gEAAgE,6BAA6B,oDAAoD,oDAAoD,kEAAkE,+BAA+B,iCAAiC,+DAA+D,oCAAoC,uCAAuC,sCAAsC,uCAAuC,0BAA0B,6DAA6D,wBAAwB,wBAAwB,wBAAwB,wBAAwB,wBAAwB,oEAAoE,GAAG,kCAAkC,8BAA8B,GAAG,qDAAqD,oCAAoC,cAAc,2CAA2C,gDAAgD,cAAc,0CAA0C,+CAA+C,gBAAgB,+EAA+E,+EAA+E,gBAAgB,+EAA+E,+EAA+E,4CAA4C,4CAA4C,+DAA+D,uBAAuB,GAAG,gDAAgD,0BAA0B,kCAAkC,6EAA6E,yBAAyB,2FAA2F,gDAAgD,4CAA4C,iJAAiJ,uCAAuC,qEAAqE,yEAAyE,kDAAkD,wCAAwC,yDAAyD,0CAA0C,uCAAuC,sFAAsF,8FAA8F,2EAA2E,4DAA4D,qDAAqD,sFAAsF,yEAAyE,2CAA2C,sGAAsG,yGAAyG,iHAAiH,2EAA2E,wEAAwE,IAAI,gEAAgE,WAAW,OAAO,EAAC;;;ACA11H,qDAAe,uFAAuF,8BAA8B,wCAAwC,gCAAgC,gCAAgC,iCAAiC,0BAA0B,mHAAmH,kPAAkP,GAAG,gBAAgB,2CAA2C,wCAAwC,sDAAsD,kDAAkD,4FAA4F,2BAA2B,kBAAkB,mBAAmB,SAAS,uDAAuD,iEAAiE,oCAAoC,gFAAgF,IAAI,0FAA0F,oFAAoF,oCAAoC,2CAA2C,gFAAgF,yBAAyB,GAAG,OAAO,EAAC;;;ACAhmD,iDAAe,+GAA+G,8BAA8B,8DAA8D,8BAA8B,8DAA8D,8BAA8B,8DAA8D,8BAA8B,8DAA8D,8BAA8B,8DAA8D,8BAA8B,kCAAkC,wCAAwC,wBAAwB,wFAAwF,gGAAgG,gGAAgG,gGAAgG,gGAAgG,gGAAgG,yCAAyC,GAAG,OAAO,EAAC;;;ACAtzC,gDAAe,yDAAyD,mCAAmC,0BAA0B,2IAA2I,uCAAuC,6GAA6G,4GAA4G,4GAA4G,2GAA2G,gFAAgF,yBAAyB,2BAA2B,2CAA2C,qCAAqC,qCAAqC,qCAAqC,qCAAqC,mCAAmC,qFAAqF,qFAAqF,YAAY,oDAAoD,mDAAmD,gHAAgH,6EAA6E,iIAAiI,+GAA+G,2GAA2G,eAAe,gGAAgG,2FAA2F,gBAAgB,sBAAsB,mCAAmC,wDAAwD,wCAAwC,IAAI,SAAS,wCAAwC,IAAI,GAAG,OAAO,EAAC;;;ACAnvE;AACd;AACF;AACA;AACU;AACJ;AACA;AACQ;AACJ;AACV;AACY;AACR;AACF;AACxD;;AAEA;AACe;AACf;AACA,qBAAqB,gBAAe;AACpC,qBAAqB,SAAQ;AAC7B,qBAAqB,QAAO;AAC5B,qBAAqB,QAAO;AAC5B,qBAAqB,aAAY;AACjC,qBAAqB,WAAU;AAC/B,qBAAqB,WAAU;AAC/B,qBAAqB,eAAc;AACnC,qBAAqB,aAAY;AACjC,qBAAqB,QAAO;AAC5B,qBAAqB,cAAa;AAClC,qBAAqB,UAAS;;AAE9B,qBAAqB,SAAQ;;AAE7B,C;;ACjC+B;AACkB;AACG;AACI;AACF;AACxB;AACE;AACI;AACI;;AAEmC;;AAE3E,QAAyB,CAAC,UAAM;;AAEhC;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA,yBAAyB,qBAAU;AACnC;;AAEA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,iBAAa;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,oBAAc;AACjC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,mBAAmB,sBAAgB;AACnC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,mBAAmB,qBAAe;AAClC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,WAAO;AACjC;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI,cAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAAsB;AACjD,iBAAiB;AACjB;AACA,0BAA0B,eAAW;AACrC;AACA;AACA;AACA,uBAAuB,2BAAsB;AAC7C;AACA,0BAA0B,aAAS;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2DAAe,gBAAgB,EAAC;;;ACpThC;AACmD;AACnD,kEAAe,oBAAgB,E;;;ACD/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,oDAAe,MAAM,E;;ACjBrB,gDAAe,0DAA0D,gCAAgC,+BAA+B,8BAA8B,8BAA8B,4BAA4B,+BAA+B,sCAAsC,qCAAqC,6BAA6B,4BAA4B,6BAA6B,iCAAiC,4BAA4B,iEAAiE,yBAAyB,oBAAoB,iBAAiB,OAAO,8BAA8B,iEAAiE,sDAAsD,uDAAuD,6BAA6B,oEAAoE,kDAAkD,iCAAiC,wFAAwF,IAAI,SAAS,qEAAqE,IAAI,uFAAuF,mEAAmE,IAAI,8EAA8E,0FAA0F,wCAAwC,GAAG,kBAAkB,uDAAuD,2EAA2E,sCAAsC,4BAA4B,UAAU,IAAI,gCAAgC,iDAAiD,yEAAyE,kEAAkE,+CAA+C,oCAAoC,qCAAqC,uCAAuC,4BAA4B,UAAU,IAAI,oBAAoB,gDAAgD,8DAA8D,0CAA0C,mCAAmC,qDAAqD,sDAAsD,sCAAsC,GAAG,qGAAqG,0DAA0D,oCAAoC,6BAA6B,+BAA+B,+BAA+B,wDAAwD,0BAA0B,iCAAiC,uCAAuC,0DAA0D,2EAA2E,GAAG,0BAA0B,mBAAmB,wBAAwB,wBAAwB,wBAAwB,wBAAwB,wBAAwB,0BAA0B,wBAAwB,qCAAqC,IAAI,SAAS,qCAAqC,IAAI,6BAA6B,qBAAqB,yBAAyB,oGAAoG,yFAAyF,4BAA4B,OAAO,OAAO,qFAAqF,yBAAyB,uFAAuF,mDAAmD,oEAAoE,wEAAwE,4BAA4B,8CAA8C,IAAI,qDAAqD,GAAG,WAAW,EAAC;;;ACA1nI;AACA;AACD;AACJ;AACK;AACP;AACU;AACnB;;AAEQ;AACtC,iBAAa,CAAC,SAAQ;;AAEtB;AACA;AACA;AACA,iBAAiB,YAAO;;AAExB,mBAAmB,UAAU;AAC7B,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,aAAS;AACxB;AACA,eAAe,kBAAc;AAC7B,eAAe,kBAAc;AAC7B;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B,kBAAkB,aAAM;AACxB,oBAAoB,aAAM;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,yBAAyB,eAAI;AAC7B,kBAAkB,iBAAa;AAC/B,KAAK;AACL,yBAAyB,eAAI;AAC7B,kBAAkB,iBAAa;AAC/B,KAAK;AACL,4BAA4B,eAAW;AACvC;AACA,KAAK;;AAEL,4BAA4B,aAAS;AACrC,4BAA4B,aAAS;AACrC,6BAA6B,aAAS;;AAEtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,YAAO;AAC1C,IAAI,sBAAiB;;AAErB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sDAAe,QAAQ,E;;ACnOvB,+CAAe,4EAA4E,6BAA6B,4BAA4B,oCAAoC,oCAAoC,oCAAoC,oCAAoC,sCAAsC,qCAAqC,4BAA4B,6BAA6B,2BAA2B,4BAA4B,sCAAsC,kCAAkC,uCAAuC,0CAA0C,oCAAoC,+BAA+B,oCAAoC,sCAAsC,wBAAwB,4CAA4C,kCAAkC,4BAA4B,mIAAmI,gCAAgC,sCAAsC,0CAA0C,2EAA2E,iDAAiD,sCAAsC,+DAA+D,GAAG,oEAAoE,8DAA8D,iEAAiE,gCAAgC,GAAG,gDAAgD,6BAA6B,yCAAyC,2CAA2C,2CAA2C,oBAAoB,GAAG,wCAAwC,oDAAoD,GAAG,gEAAgE,iDAAiD,mCAAmC,GAAG,qCAAqC,iCAAiC,2EAA2E,IAAI,SAAS,wDAAwD,IAAI,GAAG,2EAA2E,8BAA8B,qBAAqB,oBAAoB,cAAc,IAAI,sEAAsE,0EAA0E,GAAG,mJAAmJ,iIAAiI,kDAAkD,iDAAiD,4CAA4C,4CAA4C,gDAAgD,uDAAuD,qDAAqD,uDAAuD,wBAAwB,0BAA0B,qCAAqC,kBAAkB,oBAAoB,cAAc,cAAc,IAAI,iCAAiC,mCAAmC,iCAAiC,gCAAgC,8CAA8C,4EAA4E,sDAAsD,qBAAqB,iBAAiB,iBAAiB,mCAAmC,kCAAkC,0BAA0B,mEAAmE,kBAAkB,4BAA4B,yCAAyC,0BAA0B,oBAAoB,mBAAmB,SAAS,eAAe,wBAAwB,6DAA6D,0CAA0C,yBAAyB,gEAAgE,2BAA2B,iBAAiB,qBAAqB,SAAS,IAAI,IAAI,qCAAqC,gBAAgB,yBAAyB,sBAAsB,GAAG,mIAAmI,+CAA+C,0DAA0D,2CAA2C,8EAA8E,6FAA6F,wCAAwC,kCAAkC,qCAAqC,2BAA2B,+BAA+B,uBAAuB,IAAI,gEAAgE,2EAA2E,2DAA2D,kBAAkB,GAAG,sEAAsE,gEAAgE,qDAAqD,WAAW,IAAI,gCAAgC,8DAA8D,WAAW,IAAI,8EAA8E,wDAAwD,mDAAmD,oGAAoG,2CAA2C,oCAAoC,kCAAkC,4CAA4C,wBAAwB,yDAAyD,kEAAkE,iEAAiE,qCAAqC,+BAA+B,0CAA0C,0CAA0C,oEAAoE,oBAAoB,sBAAsB,OAAO,sEAAsE,2CAA2C,kDAAkD,yBAAyB,iBAAiB,yGAAyG,gDAAgD,2EAA2E,mEAAmE,0EAA0E,0CAA0C,0CAA0C,6BAA6B,mDAAmD,qDAAqD,6DAA6D,MAAM,SAAS,mGAAmG,yGAAyG,YAAY,iHAAiH,IAAI,wCAAwC,sFAAsF,WAAW,IAAI,oBAAoB,WAAW,IAAI,yHAAyH,mDAAmD,sBAAsB,oGAAoG,2CAA2C,+BAA+B,gIAAgI,uDAAuD,GAAG,6DAA6D,oCAAoC,oCAAoC,0BAA0B,kCAAkC,4BAA4B,6BAA6B,+BAA+B,qEAAqE,2CAA2C,+CAA+C,iEAAiE,2EAA2E,GAAG,8CAA8C,4GAA4G,4BAA4B,2DAA2D,sEAAsE,4DAA4D,qCAAqC,0BAA0B,yBAAyB,4CAA4C,yCAAyC,kBAAkB,OAAO,OAAO,iFAAiF,+GAA+G,mCAAmC,+DAA+D,oBAAoB,mDAAmD,IAAI,wCAAwC,wEAAwE,yHAAyH,oDAAoD,WAAW,SAAS,EAAC;;;ACApnU;AACA;AACD;AACJ;AACK;AACP;AACU;AACnB;AACoB;;AAEV;;AAExC,iBAAa,CAAC,QAAW;;AAEzB;AACA;;AAEA,wBAAwB,eAAI;AAC5B,kBAAkB,iBAAa;AAC/B;AACA,KAAK;AACL,0BAA0B,eAAI;AAC9B,kBAAkB,iBAAa;AAC/B;AACA,KAAK;AACL,0BAA0B,eAAI;AAC9B,kBAAkB,iBAAa;AAC/B;AACA,KAAK;AACL,0BAA0B,eAAI;AAC9B,kBAAkB,iBAAa;AAC/B,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,2BAA2B,aAAS;AACpC,cAAc,sBAAkB;AAChC,KAAK;AACL,yBAAyB,aAAS;AAClC,cAAc,sBAAkB;AAChC,KAAK;AACL,yBAAyB,aAAS;AAClC,cAAc,sBAAkB;AAChC,KAAK;AACL,4BAA4B,aAAS;AACrC,cAAc,sBAAkB;AAChC,KAAK;AACL,+BAA+B,aAAS;AACxC,cAAc,sBAAkB;AAChC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,0BAA0B,YAAO;AACjC,2BAA2B,YAAO;AAClC,IAAI,sBAAiB;AACrB,IAAI,sBAAiB;;AAErB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,uCAAsC;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qDAAe,OAAO,E;;AC5NtB;;AAEA,oDAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;ACnCD,kDAAe,iKAAiK,+BAA+B,8GAA8G,wJAAwJ,kDAAkD,qGAAqG,KAAK,sGAAsG,+BAA+B,0BAA0B,0BAA0B,mEAAmE,+BAA+B,2CAA2C,uHAAuH,kBAAkB,qBAAqB,8BAA8B,oBAAoB,oCAAoC,gDAAgD,2BAA2B,qBAAqB,IAAI,IAAI,qEAAqE,gDAAgD,IAAI,+BAA+B,2BAA2B,gFAAgF,6CAA6C,IAAI,sBAAsB,UAAU,IAAI,4CAA4C,sBAAsB,GAAG,OAAO,EAAC;;;ACAxrD;;AAEA;AAC6C;AACJ;AACF;AACU;AACN;AACG;AACI;;AAEK;AACvD,iBAAa,CAAC,WAAU;;AAExB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,yBAAyB,aAAS;AAClC,gBAAgB,2BAAuB;AACvC,cAAc,wBAAoB;AAClC,KAAK;AACL,0BAA0B,aAAS;AACnC,cAAc,sBAAkB;AAChC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA,6CAA6C,gCAA4B;;AAEzE,+BAA+B,YAAQ;AACvC,oBAAoB,UAAM;AAC1B,YAAY,iBAAa;AACzB,YAAY,iBAAa;AACzB;AACA,KAAK;AACL;;AAEA,6BAA6B,wBAAuB;AACpD,2BAA2B,wBAAuB;AAClD,+BAA+B,wBAAuB;;;AAGtD,0BAA0B,eAAI;AAC9B,kBAAkB,iBAAa;AAC/B,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wDAAe,UAAU,E;;AC9MqB;AACA;AACD;AACJ;AACK;AACP;AACU;;AAEjD;AACA;;AAEA,yBAAyB,eAAI;AAC7B,kBAAkB,iBAAa;AAC/B,KAAK;;AAEL;AACA;;AAEA,8BAA8B,aAAS;AACvC,cAAc,sBAAkB;AAChC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sDAAe,QAAQ,E;;ACxDvB,gDAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;;;;AAIT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;;;;;AAMT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;;;AAIT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;ACjkBD,+CAAe,iDAAiD,6BAA6B,2BAA2B,mCAAmC,8BAA8B,gCAAgC,2BAA2B,4BAA4B,oDAAoD,wDAAwD,2EAA2E,0CAA0C,eAAe,+CAA+C,4CAA4C,yCAAyC,aAAa,IAAI,SAAS,wDAAwD,2GAA2G,wCAAwC,wBAAwB,cAAc,IAAI,yBAAyB,IAAI,qCAAqC,GAAG,wFAAwF,4BAA4B,8BAA8B,wBAAwB,4BAA4B,0BAA0B,qEAAqE,sDAAsD,wDAAwD,0DAA0D,kCAAkC,+CAA+C,uFAAuF,gEAAgE,wCAAwC,qIAAqI,6EAA6E,aAAa,4EAA4E,8BAA8B,wBAAwB,0BAA0B,oCAAoC,4CAA4C,oDAAoD,0BAA0B,kCAAkC,mEAAmE,GAAG,uEAAuE,0CAA0C,+DAA+D,yBAAyB,yBAAyB,8CAA8C,4HAA4H,iDAAiD,iCAAiC,qCAAqC,oBAAoB,yBAAyB,OAAO,+BAA+B,wDAAwD,yCAAyC,uCAAuC,mBAAmB,gEAAgE,wCAAwC,wBAAwB,2FAA2F,kBAAkB,iCAAiC,sBAAsB,4BAA4B,IAAI,mGAAmG,6BAA6B,mCAAmC,wBAAwB,WAAW,SAAS,EAAC;;;ACA3jH,gDAAe,gDAAgD,oCAAoC,iCAAiC,+BAA+B,6BAA6B,wCAAwC,4BAA4B,gCAAgC,0DAA0D,iDAAiD,+BAA+B,iFAAiF,GAAG,iBAAiB,wBAAwB,+BAA+B,yEAAyE,mCAAmC,mCAAmC,gBAAgB,+CAA+C,2CAA2C,+CAA+C,4CAA4C,4CAA4C,iDAAiD,6CAA6C,iDAAiD,0EAA0E,wEAAwE,8CAA8C,uCAAuC,sGAAsG,GAAG,OAAO,EAAC;;;ACA14C;AACM;AACJ;AACQ;AACqB;AACpC;AACF;AACY;AACF;AACJ;AACJ;;AAEM;;AAEgC;AACF;AACM;AACA;AACQ;AACJ;AACV;AACI;AACF;AACpC;AACE;;AAEtC,iBAAgB,CAAC,SAAQ;AACzB,iBAAgB,CAAC,QAAO;AACxB,iBAAgB,CAAC,WAAU;AAC3B,iBAAgB,CAAC,WAAU;AAC3B,iBAAgB,CAAC,eAAc;AAC/B,iBAAgB,CAAC,aAAY;AAC7B,iBAAgB,CAAC,QAAO;AACxB,iBAAgB,CAAC,UAAS;AAC1B,iBAAgB,CAAC,SAAQ;AACzB,iBAAgB,CAAC,QAAO;AACxB,iBAAgB,CAAC,SAAQ;;;AAGzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA,8BAA8B,aAAS;AACvC,cAAc,sBAAkB;AAChC,KAAK;AACL,6BAA6B,aAAS;AACtC,gBAAgB,2BAAuB;AACvC,cAAc,wBAAoB;AAClC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA,iDAAiD,gCAA4B;;AAE7E,2BAA2B,iBAAU;;AAErC,uBAAuB,2BAAgB,CAAC,SAAU;;AAElD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,yBAAyB,eAAQ;AACjC,wBAAwB,cAAO;AAC/B,yBAAyB,eAAQ;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,yBAAoB;AACpC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,8BAAyB;AAC5C,mBAAmB,8BAAyB;AAC5C;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,mBAAmB;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,8BAA8B,oBAAoB;AAClD;;AAEA,mBAAmB,wBAAwB;AAC3C,wBAAwB,aAAa;AACrC;;AAEA,mBAAmB,+BAA+B;AAClD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,8DAAe,gBAAgB,E;;AC3hB/B;AAC8B;AACgB;AACG;AACJ;AACN;AACO;;AAE9C;AACA;;AAEA,mBAAmB,QAAQ;AAC3B,6BAA6B,aAAM,QAAQ,aAAM;AACjD;;AAEA;;AAEA;;AAEA,0BAA0B,aAAS;AACnC,yBAAyB,eAAW;AACpC;;AAEA;AACA,6BAA6B,aAAS;AACtC,0BAA0B,aAAS;;AAEnC,0CAA0C,eAAI;AAC9C,kBAAkB,iBAAa;AAC/B,KAAK;AACL;AACA;;AAEA,wBAAwB,eAAW;AACnC;AACA,KAAK;;AAEL,2BAA2B,eAAI;AAC/B,kBAAkB,iBAAa;AAC/B;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,iCAAiC,YAAO;AACxC;AACA;;AAEA,QAAQ,gBAAW;;AAEnB,QAAQ,mBAAc;AACtB,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mEAAe,qBAAqB,E;;ACrKpC;AACA;AACA;AACA;;AAE+C;;AAEV;AACoB;AACK;AACE;AAClB;AACA;AACA;;AAEQ;;AAEI;AACU;AAC9B;;AAEtC;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA,qBAAqB,SAAK;;AAE1B;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,2BAA2B,uBAAgB;;AAE3C,2BAA2B,4BAAqB;;AAEhD,8BAA8B,SAAa;;AAE3C;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA,uBAAuB,OAAO;AAC9B,2BAA2B,aAAM;AACjC,2BAA2B,aAAM;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA,qCAAqC,kBAAiB;AACtD,8BAA8B,kBAAiB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,mBAAkB;AACvD,8BAA8B,mBAAkB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA,+BAA+B,kBAAiB;AAChD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,YAAY;AACZ;AACA,cAAc,YAAO;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,mCAAmC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,iBAAiB,YAAO;AACxB,gCAAgC,YAAO;AACvC;AACA;;AAEA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,QAAQ,mBAAc;AACtB,QAAQ,0BAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,8BAA8B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC,cAAQ;;AAExC,kDAAe,MAAM,E;;ACpc0B;AACV;AACU;AACO;AAClB;AACI;;AAExC;AACA;AACA;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,QAAQ,IAAqC;AAC7C;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA;AACA;AACA;AACA,wBAAwB,oCAA0B;AAClD;AACA;AACA,uBAAuB,aAAM;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;;AAEA,gBAAgB,uCAAgC;;AAEhD;;AAEA;;AAEA;AACA;AACA,+DAA+D,WAAM;;AAErE,kCAAkC,kBAAW;AAC7C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA,0DAA0D,0BAAqB;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA,6CAA6C,0BAAqB;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA,0DAAe,aAAa,E;;AC5LmB;;AAE/C,kBAAkB,uCAA6B;;AAE/C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,CAAC;;AAED,oDAA0C;;AAE1C,yDAAe,WAAW,E;;ACtBqB;;AAE/C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA,mBAAmB;;AAEnB,gBAAgB;AAChB;AACA,gBAAgB;AAChB,iBAAiB;AACjB;AACA;AACA;;AAEA,mBAAmB,4BAAkB;AACrC;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,gBAAgB,4BAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,eAAe,+BAAqB;AACpC;AACA;AACA;AACA,CAAC;AACD,cAAc,+BAAqB;AACnC;AACA,CAAC;AACD;;AAEA,oDAAe;AACf;AACA;AACA;AACA;AACA,CAAC,E;;;ACzFD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACqE;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B,GAAG;AAChC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC;;;AAGrC;;AAEA;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA,IAAI;;;AAGJ;AACA,qCAAqC,aAAa;AAClD;;AAEA;AACA,CAAC;;AAED;AACA,MAAM,QAAQ;AACd;AACA,GAAG;AACH;AACA;AACA;;AAEA,uDAAe,WAAW,E;;AC1IqB;AACL;;AAEa;;AAEvD;AACA;AACA;AACA,YAAY;AACZ,WAAW,OAAO;AAClB,WAAW,+BAA+B;AAC1C,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA,6BAAe,SAAS,kBAAC;;AAEzB;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gBAAgB,4BAAkB;AAClC,gBAAgB,4BAAkB;;AAElC;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;;AAEA;AACA,yCAAyC,kCAA6B;AACtE;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA,aAAa;;AAEb,2BAA2B,4BAAkB;AAC7C,gBAAgB,4BAAkB,CAAC,aAAW;AAC9C,wCAAwC;AACxC;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA,QAAQ,4BAAkB;AAC1B;AACA,E;;ACxEA;AAC0B;;AAEc;AACF;AACgB;AACd;AACY;;;AAGpD;AACA;AACA;AACA;AACO;AACP,qCAAqC,kBAAW;AAChD,oCAAoC,UAAU;;AAE9C,iDAAiD,mBAAa;;;AAG9D;AACA,QAAQ,iBAAiB,iBAAiB,kBAAW;AACrD;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;;;;ACzD0C;AACC;AAC3C,yBAAG,CAAC,OAAO,E;;ACFX,4DAAe;AACf;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC,E;;AChC8C;;AAE/C,sDAAe;;AAEf;AACA;;AAEA;AACA;AACA,sBAAsB,wBAAc;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA,YAAY;;;AAGZ;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,CAAC,E;;ACzI8C;AAC6B;AACF;AACV;AACI;AACJ;;AAEhE,iBAAiB,uCAA6B;;AAE9C;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,yBAAyB,yCAA+B;AACxD;AACA;AACA;AACA,SAAS;AACT,uBAAuB,sBAAY;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,iDAAiD,uBAAa;AAC9D,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,EAAE;AACzC;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,uBAAuB,eAAe;;AAExD,4BAAkB,uBAAuB,yBAAyB;AAClE,4BAAkB,uBAAuB,wBAAwB;AACjE,4BAAkB,uBAAuB,mBAAmB;AAC5D,4BAAkB,uBAAuB,qBAAqB;;AAE9D,uDAAe,UAAU,E;;ACtGzB;;AAEA,6CAAe,aAAM,EAAC;;AAEtB,SAAS,aAAM;;AAEf;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,0EAA0E;AAC1E;AACA;AACA;;AAEA,yBAAyB,cAAc;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB,SAAS;AAChC,KAAK;AACL,2BAA2B,YAAY;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gDAAgD,WAAI;AACpD;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;;AAEA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,WAAI,6BAA6B;;AAEzC;AACA;;AAEA;AACA;AACA,YAAY,WAAI;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,QAAQ,WAAI,6BAA6B;;AAEzC,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,WAAI;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,WAAI;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,iCAAiC,+BAA+B;;AAEhE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS,WAAI;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,WAAI,qBAAqB,WAAI;AACxC,WAAW,WAAI,qBAAqB,WAAI;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,WAAW,WAAI;AACf,QAAQ,WAAI,uBAAuB,WAAI;AACvC,QAAQ,WAAI,sBAAsB,WAAI;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,2CAA2C;AAC3C;AACA;AACA,iBAAiB,WAAI;AACrB,iBAAiB,WAAI;AACrB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gBAAgB,WAAI;;AAEpB;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS,WAAI;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAM;AACN;AACA;;AAEA;AACA;AACA,iDAAiD,SAAS;AAC1D;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA,C;;;ACxmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,WAAW;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mCAAmC;AAC1D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,gEAAe,oBAAoB,E;;AChIwB;AACZ;AAC/C,IAAI,uBAAI,GAAG,iBAAa;;AAExB,SAAS,uBAAI;AACb,SAAS,uBAAI;AACb,SAAS,uBAAI;AACb;;AAEA,yDAAe;;AAEf;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,uBAAI;AAC7B,yBAAyB,uBAAI;AAC7B,yBAAyB,uBAAI;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,uBAAuB,kCAAkC;AACzD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,8BAAyB;AACrC;AACA,KAAK;;AAEL;AACA;AACA;;AAEA,iDAAiD,yBAAoB;;AAErE;AACA;AACA,SAAS;AACT;AACA,CAAC,E;;ACtIM;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,C;;ACrB+C;AACsB;AACjB;AACT;AACkC;;AAEhB;;AAE7D;AACA;;AAEA;;AAEA,2BAA2B,UAAU;;AAErC,oCAAoC,0BAAqB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,iCAAiC;AACpD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC,uBAAuB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,8BAAoB;AAC7C,mBAAmB,eAAe;AAClC;AACA,iDAAiD,kBAAkB;AACnE;AACA;AACA,yBAAyB,0BAAqB,4BAA4B,oBAAoB;AAC9F,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,iDAAiD;;AAEjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2DAAe,aAAa,E;;ACnLmB;AACF;AACN;AACY;AACR;AACI;AACyB;AAC5B;AACgB;AACiB;;AAE7E,IAAI,iBAAI,GAAG,iBAAa;;AAExB,4BAAuB,CAAC,YAAW;;AAEnC;;AAEA,wBAAwB,mBAAc;;AAEtC;AACA;;AAEA,uBAAuB,oCAA+B;AACtD;AACA,KAAK;AACL,0BAA0B,2BAAsB;AAChD;AACA,KAAK,IAAI;;AAET,wBAAwB,2BAAsB;;AAE9C;AACA,IAAI,qCAAgC;AACpC,uCAAuC,uBAAkB;AACzD,oBAAoB,2BAAsB;AAC1C,SAAS;AACT,KAAK;AACL;;AAEA,2BAA2B,mBAAc;AACzC,sBAAsB,4BAAuB,EAAE,gBAAgB;AAC/D;AACA;AACA;AACA,KAAK;AACL;;AAEA,8BAA8B,oBAAa;;AAE3C;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,2BAA2B,mBAAc;AACzC;AACA,8BAA8B,uBAAkB;AAChD;AACA,iBAAiB;AACjB,8BAA8B,uBAAkB;AAChD;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,yCAAyC,kBAAkB;AAC3D;AACA;;AAEA;;AAEA,4BAA4B,mBAAc;AAC1C,0BAA0B,uBAAkB;AAC5C;AACA,aAAa;AACb;AACA;AACA;AACA,0BAA0B,OAAQ;AAClC;AACA,aAAa;AACb,SAAS;;AAET;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,WAAW;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,QAAQ,mCAA8B;;AAEtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,mCAAmC,iBAAiB;AACpD;AACA;AACA;;AAEA,wBAAwB,0BAAqB;AAC7C,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA,0BAA0B,0BAAqB,CAAC,oBAAoB;;AAEpE,2BAA2B,yBAAoB;AAC/C,iCAAiC,yBAAoB;;AAErD;AACA;;AAEA;;AAEA;AACA;;AAEA,+BAA+B,0BAAqB;;AAEpD;AACA;AACA;AACA;;AAEA,sCAAsC,6BAA6B;AACnE;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;;AAEA,gDAAgD,uBAAkB,GAAG,sBAAiB;;AAEtF;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,wBAAwB,yBAAoB;AAC5C;AACA;AACA,wBAAwB,0BAAqB;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA,QAAQ,mCAA8B;AACtC;AACA;AACA;;AAEA;AACA,+CAA+C,yBAAoB;;AAEnE;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;;AAEA,6BAA6B,WAAW;AACxC;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;;AAEA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA,mCAAmC,yBAAyB;AAC5D;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC,MAAM;;AAEtC;AACA;AACA;AACA;AACA;AACA,+BAA+B,mBAAmB;AAClD,oBAAoB,iBAAI;AACxB;AACA,wBAAwB,iBAAI;AAC5B;AACA,oBAAoB,iBAAI;AACxB,oBAAoB,iBAAI;AACxB;AACA;AACA;AACA;AACA,gBAAgB,iBAAI;AACpB,gBAAgB,iBAAI;AACpB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAI;AACtB,kBAAkB,iBAAI;AACtB;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B,eAAe;AAC1C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,iBAAI;AAC/B,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;;AAEA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAI;AACpB,gBAAgB,iBAAI;AACpB,gBAAgB,iBAAI;AACpB,gBAAgB,iBAAI;;AAEpB,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,OAAO;AACtC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,iBAAI;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,2BAA2B,sBAAsB;AACjD;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,0BAAqB;AACnD;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C,4BAA4B,4BAAkB;AAC9C;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA,oBAAoB,0BAAqB;AACzC,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA,sBAAsB,0BAAqB,CAAC,oBAAoB;;AAEhE,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,iEAAiE,qDAAqD;AACtH;AACA;AACA;AACA;AACA;AACA;;AAEA,0DAAe,YAAY,E;;ACjwBuB;AACH;;AAEF;AACM;AACH;;AAEhD,gDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;;AAEA,iCAAiC,mBAAY;AAC7C,2BAA2B,mBAAc;;AAEzC,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;;AAEA,4BAA4B,iBAAY;AACxC;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;;AC9FF;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,C;;ACzD+C;AACA;AAC/C,IAAI,UAAI,GAAG,iBAAa;AACxB,IAAI,UAAI,GAAG,iBAAa;;AAEoC;AACF;AAC1D;AACA,mBAAmB,aAAS,EAAE,YAAQ;;AAEtC;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,qBAAqB,UAAI;;AAEzB,wBAAwB,UAAI;;AAE5B;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,gCAAgC;;AAEhC;AACA,2BAA2B,8BAAoB,IAAI,8BAAoB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA,4CAA4C,sCAA4B;AACxE,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,eAAe;AAC9B;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,QAAQ,UAAI;AACZ,QAAQ,UAAI;AACZ,QAAQ,UAAI;;AAEZ,QAAQ,UAAI;AACZ,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,UAAI;;AAEZ;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,kDAAe,KAAK,E;;ACvLc;AACa;AACO;AAClB;AACI;;AAExC;AACA;AACA;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,oBAAoB,oCAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,sBAAY;AAC5C;AACA;AACA;AACA;;;AAGA,IAAI,IAAqC;AACzC;AACA;AACA;AACA;;;AAGA,IAAI,oBAAO;;AAEX;;AAEA,gBAAgB,gCAA0B;;AAE1C;;AAEA;;AAEA,aAAa,wBAAc;AAC3B;AACA;;AAEA;;AAEA;;AAEA;AACA,qEAAqE,WAAM;;AAE3E;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8CAA8C,0BAAqB;AACnE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,wBAAc;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,oBAAO;AAC7C;;AAEA,mBAAmB,WAAK;AACxB,mBAAmB,oBAAO;AAC1B;AACA;AACA;AACA;AACA;;AAEA,yDAAe,YAAY,E;;AChN3B;AAC0B;;AAEY;AACF;AACgB;;AAE7C,SAAS,eAAO;AACvB,qCAAqC,gBAAU;AAC/C,oCAAoC,SAAS;;AAE7C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;;AAEL,gDAAgD,kBAAY;;AAE5D,C;;ACzB0C;AACA;AAC1C,yBAAG,CAAC,eAAO,E;;ACFoC;AAC6B;AACF;AACV;AACI;;;AAGpE;AACA;AACA;AACA,iBAAiB,uCAA6B;;AAE9C;;AAEA;;AAEA;;AAEA;AACA;;AAEA,QAAQ,2BAAiB;AACzB,YAAY,4BAAkB;AAC9B;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,6BAAmB;AACtC;AACA;AACA;AACA,aAAa,IAAI;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,4BAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,2BAAiB;AACzB,YAAY,4BAAkB;AAC9B,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,uBAAuB,yBAAyB;AAClE,4BAAkB,uBAAuB,wBAAwB;AACjE,4BAAkB,uBAAuB,mBAAmB;AAC5D,4BAAkB,uBAAuB,qBAAqB;;AAE9D,uDAAe,UAAU,E;;AC/MzB;AACA;AACA;AACA;AACA;;AAEA;;AAEA,IAAI,UAAE;AACN;AACA;AACA;AACA,IAAI,YAAI;AACR;AACA,WAAW,UAAE;;AAEb;;;AAGA;;AAEA;AACA;AACA;;AAEA,0BAA0B,6CAA6C;AACvE,0BAA0B,+BAA+B;;;AAGzD;;AAEA,IAAI,SAAC,iBAAiB;;AAEtB,+BAA+B,0BAA0B,SAAC,iBAAiB,SAAC,WAAW;AACvF,+BAA+B,QAAQ,YAAI,cAAc,SAAC,iBAAiB,SAAC,YAAY;;AAExF,gCAAgC,8DAA8D;AAC9F,gCAAgC,QAAQ,YAAI,qDAAqD;;AAEjG,8BAA8B,8CAA8C;;;AAG5E;;AAEA,8BAA8B,0CAA0C;;AAExE;;AAEA;AACA,2BAA2B;;AAE3B,uBAAuB,UAAE;AACzB;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,8CAAe,OAAO,E;;ACpFtB,sDAAe,mEAAmE,iCAAiC,yDAAyD,oDAAoD,0BAA0B,iBAAiB,gEAAgE,2DAA2D,GAAG,wFAAwF,0BAA0B,yBAAyB,0BAA0B,iBAAiB,yGAAyG,yDAAyD,GAAG,OAAO,EAAC;;;ACA7rB;;AAEF;AACM;AACH;;AAEP;AACE;;AAEwB;AACX;;AAExD,4BAA0B,CAAC,SAAc;AACzC,4BAA0B,CAAC,eAAoB;;AAE/C,gDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;;AAEA;AACA,2BAA2B,mBAAc;;AAEzC;AACA,kBAAkB;AAClB;AACA;AACA,mCAAmC,6BAAwB;AAC3D;AACA;AACA;AACA,SAAS;AACT,oCAAoC,6BAAwB;AAC5D;AACA;AACA,SAAS;;AAET;AACA,kBAAkB;AAClB;AACA,kCAAkC,4BAAuB;;AAEzD;AACA,kBAAkB;AAClB;AACA,8BAA8B,mBAAc;AAC5C;AACA,SAAS;;AAET;AACA,kBAAkB;AAClB;AACA,mCAAmC,mBAAc;AACjD,uCAAuC,6BAAwB;AAC/D;AACA;AACA,SAAS;AACT,uCAAuC,uBAAkB;AACzD,wBAAwB,qBAAgB;AACxC,gBAAgB,4BAAuB;AACvC,gBAAgB,4BAAuB;AACvC;AACA;AACA,SAAS;AACT;AACA;AACA,yCAAyC,sBAAiB;;AAE1D,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;;AAEA;AACA;;AAEA,4BAA4B,iBAAY;AACxC;AACA,SAAS;;AAET;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,iCAAiC,6BAAwB;AACzD;;AAEA,QAAQ,mCAA8B;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,wCAAwC,yBAAoB;AAC5D;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;;AAGL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,QAAQ,2BAAiB;AACzB,iCAAiC,uBAAa;AAC9C;;AAEA,0BAA0B,0BAAqB;AAC/C;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA,gCAAgC,0BAAqB;AACrD;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,8DAA8D,mBAAc;AAC5E;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA,gFAAgF,uBAAkB;AAClG;AACA,gCAAgC,2BAAsB;AACtD;AACA;AACA,qBAAqB;AACrB;AACA;AACA,sBAAsB;AACtB,8EAA8E,uBAAkB;AAChG;AACA,gCAAgC,2BAAsB;AACtD;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,+EAA+E,iCAA4B;AAC3G;;AAEA,gBAAgB,0BAAqB;AACrC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,yBAAoB;AAC5C;AACA;AACA,wBAAwB,0BAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB,0BAA0B;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,mBAAmB,CAAC,kCAAwB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;ACxc6C;AAC/C,IAAI,UAAI,GAAG,iBAAa;;;AAGxB;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,kBAAkB,UAAI;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kDAAe,KAAK,E;;ACrGc;AACa;AACO;AAClB;AACI;AACE;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,oBAAoB,oCAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,sBAAY;AAC5C;AACA;AACA;AACA;;AAEA;;AAEA,gBAAgB,gCAA0B;;AAE1C;;AAEA;;AAEA;;AAEA;AACA,6DAA6D,WAAM;;AAEnE,4BAA4B,WAAK;AACjC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,0BAAqB;AACrE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,0BAAqB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA,yDAAe,YAAY,E;;AChL3B;AAC0B;;AAEY;AACF;AACgB;;AAE7C,SAAS,qBAAO;AACvB,qCAAqC,gBAAU;AAC/C,oCAAoC,SAAS;;AAE7C,gDAAgD,kBAAY;;AAE5D;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;;AAEL,C;;ACjC0C;AACA;AAC1C,yBAAG,CAAC,qBAAO,E;;ACFoC;;AAE2B;AACV;;AAEhE;;AAEA,oBAAoB,uCAA6B;;AAEjD;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI;AACb,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,0BAA0B,wBAAwB;AACpE,4BAAkB,0BAA0B,mBAAmB;;AAE/D,6DAAe,aAAa,E;;ACzE5B;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,uBAAuB;AAClC;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,OAAO,QAAQ,MAAM,SAAS;;AAE9E;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA,6DAAe,aAAa,E;;AC7E5B,yDAAe,iLAAiL,0BAA0B,kBAAkB,uGAAuG,yDAAyD,2DAA2D,GAAG,oHAAoH,+BAA+B,iCAAiC,mLAAmL,sBAAsB,+KAA+K,wBAAwB,wEAAwE,IAAI,kBAAkB,6BAA6B,OAAO,0DAA0D,IAAI,sCAAsC,oCAAoC,kDAAkD,GAAG,SAAS,EAAC;;;ACAxyC;AACH;AACI;AACH;;AAE2B;;AAExE,4BAAuB,CAAC,kBAAiB;;AAEzC;;AAEA,mDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;AACA;AACA,4BAA4B,sBAAa;AACzC;;AAEA,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET,+BAA+B,mBAAc;AAC7C,0BAA0B,4BAAuB;AACjD,0BAA0B,uBAAkB;AAC5C,4BAA4B,qBAAgB;AAC5C,4BAA4B,4BAAuB;AACnD,8BAA8B,4BAAuB;AACrD,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,oBAAe,KAAK,sBAAiB;AACjE,0DAA0D,sBAAiB;AAC3E,0DAA0D,sBAAiB;AAC3E;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;AClJ6C;AAC/C,IAAI,iBAAI,GAAG,iBAAa;;AAExB,IAAI,sBAAS;AACb;AACA,IAAI,eAAE;;AAEN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,gCAAgC;;AAEhC;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oEAAoE,sBAAS;AAC7E;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,2BAA2B,QAAQ;;AAEnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAQ,iBAAI;AACZ;AACA;;AAEA,gBAAgB,iBAAI;AACpB;AACA;AACA,QAAQ,iBAAI;AACZ;AACA,QAAQ,iBAAI;AACZ,QAAQ,iBAAI;AACZ,QAAQ,iBAAI;AACZ;AACA,QAAQ,iBAAI;;AAEZ;AACA;AACA,QAAQ,iBAAI;AACZ;AACA;;AAEA;AACA;AACA,wBAAwB,sBAAS;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA,mEAAmE,sBAAS;AAC5E,KAAK;;AAEL;AACA;AACA;AACA,4BAA4B,eAAE;AAC9B,yBAAyB,eAAE;AAC3B,mCAAmC,eAAE,SAAS,eAAE;AAChD,yBAAyB,eAAE,qBAAqB,eAAE,4BAA4B,eAAE;AAChF;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,sEAAsE,sBAAS;AAC/E,KAAK;;AAEL;AACA;AACA;AACA,yCAAyC,eAAE,IAAI,eAAE;AACjD,2CAA2C,eAAE,sBAAsB,eAAE,MAAM,eAAE;AAC7E;AACA,iCAAiC,eAAE;AACnC,8BAA8B,eAAE;AAChC;AACA,KAAK;;AAEL;AACA,gDAAgD,sBAAS;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mDAAe,oBAAoB,E;;AC3LyB;;AAE5D;AACA,IAAI,kBAAkB;AACtB;;AAEA,yBAAyB,YAAY;AACrC;AACA;;AAEA,wDAAe,QAAQ,E;;ACVoB;AACE;AACN;;AAEvC,6BAAe,SAAS,0BAAC;;AAEzB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,8DAA8D,WAAM;AACpE,2CAA2C,mBAAc;AACzD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sEAAsE,0BAAqB;AAC3F;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;;AAEA;AACA;AACA;AACA;;;AC3G2C;AAC0C;;AAErF,sBAAsB,yBAAyB,aAAa,iBAAQ;AACpE;AACA;AACA,KAAK;AACL,CAAC;;AAED,4DAAe,eAAe,E;;ACT9B;AAC0B;;AAEkB;AACF;AACgB;;AAEnD,SAAS,wBAAO;AACvB,qCAAqC,sBAAa;AAClD,oCAAoC,YAAY;;AAEhD,mDAAmD,qBAAe;;AAElE;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;AACL,C;;ACxB0C;AACG;AAC7C,yBAAG,CAAC,wBAAO,E;;ACFoC;;AAE2B;AACV;;AAEhE;;AAEA,sBAAsB,uCAA6B;;AAEnD;;AAEA;;AAEA;;AAEA;AACA;;AAEA,8BAA8B,EAAE,kCAAkC,EAAE,EAAE,EAAE,EAAE,EAAE;AAC5E,4BAA4B,gEAAgE;;AAE5F;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI;AACb,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,4BAA4B,wBAAwB;AACtE,4BAAkB,4BAA4B,mBAAmB;;AAEjE,iEAAe,eAAe,E;;AC1E9B;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,uBAAuB;AAClC;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,OAAO,QAAQ,MAAM,SAAS;;AAE9E;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,IAAI,sBAAM;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAM;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,IAAI,sBAAM;AACV;AACA,KAAK;AACL;AACA;;AAEA,iEAAe,eAAe,EAAC;;;ACxFgB;AACC;AACA;AACH;;AAE2B;;AAExE,4BAAuB,CAAC,kBAAiB;;AAEzC,qDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;AACA,+BAA+B,mBAAc;AAC7C,0BAA0B,4BAAuB;AACjD,0BAA0B,uBAAkB;AAC5C,4BAA4B,qBAAgB;AAC5C,4BAA4B,4BAAuB;AACnD,8BAA8B,4BAAuB;AACrD,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,4BAA4B,0BAAe;AAC3C;;AAEA,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA,kDAAkD,mBAAmB;AACrE;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,oBAAe,KAAK,sBAAiB;AACjE,0DAA0D,sBAAiB;AAC3E,0DAA0D,sBAAiB;AAC3E;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,EAAC;;AAEH;AACA;AACA;AACA;;;AC1K4D;;AAE5D;AACA,IAAI,kBAAkB;;AAEtB;AACA;AACA;;AAEA,2BAA2B,YAAY;AACvC;AACA;;AAEA,4DAAe,UAAU,E;;ACbwB;AACoC;;AAErF,wBAAwB,yBAAyB,eAAe,qBAAU;AAC1E;AACA;AACA,KAAK;AACL,CAAC;;AAED,8DAAe,iBAAiB,E;;ACThC;AAC0B;;AAEsB;AACF;AACgB;;AAEvD,SAAS,0BAAO;AACvB,qCAAqC,0BAAe;AACpD,oCAAoC,cAAc;;AAElD,qDAAqD,uBAAiB;;AAEtE;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;AACL,C;;ACxBA;AAC0C;AACK;AAC/C,yBAAG,CAAC,0BAAO,E;;ACHoC;AACA;AAC/C,IAAI,sBAAI,GAAG,iBAAa;AACxB,yBAAyB,qDAA2C;;AAEpE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,8BAAoB;AAClC;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,sBAAI;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,8DAAe,iBAAiB,E;;AC/EhC,6BAAe,SAAS,sBAAC;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA,E;;ACxB+C;AACD;AACC;AACK;AACQ;;AAE5D,IAAI,gBAAI,GAAG,iBAAa;AACxB,IAAI,8BAAkB,GAAG,qDAA2C;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA,cAAc,8BAAoB;AAClC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAI;AACtB,QAAQ,gBAAI;AACZ;AACA;AACA,KAAK;;AAEL,6BAA6B,qBAAgB;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA,cAAc,8BAAoB;AAClC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,8BAAoB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,oBAAoB,8BAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,uBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL,C;;AC/K+C;;AAE/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,kCAAwB;AACvC;AACA;AACA;;AAEA;AACA;AACA,YAAY,EAAE;AACd,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kDAAe,UAAU,E;;ACzCsB;AACQ;;AAEvD;AACA;AACA,IAAI,2BAAiB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,6BAAe,SAAS,cAAC;AACzB;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,2BAAiB;AAC/B;AACA,aAAa;AACb;AACA,cAAc,2BAAiB;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,mCAAyB;AACtE,sBAAsB,kCAAwB;AAC9C;AACA,kCAAkC,mCAAyB;AAC3D;;AAEA;AACA;;AAEA;;AAEA;AACA,yBAAyB,8BAAoB;AAC7C,oCAAoC,mCAAyB,CAAC,kCAAwB;AACtF;;AAEA,gBAAgB,kBAAkB;AAClC,QAAQ,+BAAqB;AAC7B,0CAA0C;AAC1C;AACA;;AAEA,kBAAkB,yCAA+B;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,mCAAyB;AACnC;AACA;AACA;AACA;AACA,kBAAkB,mCAAyB;AAC3C;AACA;AACA;AACA,E;;ACjF+C;;AAE/C,6BAAe,SAAS,WAAC;AACzB;;AAEA,qCAAqC,+CAAqC;;AAE1E,qBAAqB,yCAA+B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,+BAA+B,kDAAwC;AACvE;AACA,kCAAkC;AAClC;;AAEA,mBAAmB,sBAAY;;AAE/B;;AAEA;;AAEA;AACA,C;;AC3C+C;AACkC;AACtC;AACS;AACN;;AAE9C,kBAAkB,oCAA0B;;AAE5C;;AAEA;;AAEA;;AAEA;AACA,eAAe,UAAU;AACzB,KAAK;;AAEL;AACA,mBAAmB,6BAA4B;AAC/C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED,4BAAkB,wBAAwB,qBAAqB;;AAE/D,wDAAe,WAAW,E;;ACpF1B;AACA;AACA;AACA;AACA;AACA;;AAE+C;AACS;AACF;AACX;;AAEI;AAC/C,IAAI,mBAAI,GAAG,iBAAa;AACxB,IAAI,mBAAI,GAAG,iBAAa;;AAExB;AACA;AACA;AACA;AACA;AACA,mBAAmB,mBAAe;AAClC;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;;AAEzC,8BAA8B,sBAAkB;AAChD,4BAA4B,sBAAkB;AAC9C,SAAS;;AAET;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA,uBAAuB,mBAAI;AAC3B,4BAA4B,mBAAI;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA,2BAA2B,OAAO;AAClC;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;AACpB;AACA,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;AACpB;AACA,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;;AAEpB,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,uBAAuB;AAC1D;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,uBAAuB;AAC1D;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,uBAAuB;AAC1D;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;;AAEA,mCAAmC,gBAAgB;AACnD;AACA;AACA;AACA;AACA;;AAEA;;AAEA,qCAAqC,cAAc;AACnD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,eAAe;AAC9B;AACA;AACA,iBAAiB,mBAAI;AACrB,iBAAiB,mBAAI;AACrB,iBAAiB,mBAAI;;AAErB,wBAAwB,mBAAI;;AAE5B;;AAEA;AACA;AACA;;AAEA;AACA,YAAY,mBAAI;AAChB,YAAY,mBAAI;AAChB;AACA,YAAY,mBAAI;AAChB,YAAY,mBAAI;AAChB;AACA,YAAY,mBAAI;AAChB,YAAY,mBAAI;;AAEhB,iCAAiC,sBAAsB;AACvD,iCAAiC,sBAAsB;AACvD,iCAAiC,sBAAsB;;AAEvD;;AAEA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,2BAA2B,OAAO;AAClC;;AAEA,+BAA+B,oBAAoB;AACnD,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA,uCAAuC,oBAAoB;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,mBAAI;;AAEhC,4BAA4B,mBAAI;AAChC,4BAA4B,mBAAI;AAChC,4BAA4B,mBAAI;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,2BAA2B,oBAAoB;AAC/C,+BAA+B,oBAAoB;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,CAAC;;AAED,+BAAqB,yBAAyB,mBAAmB;AACjE,+BAAqB,yBAAyB,kBAAkB;;AAEhE,qDAAe,YAAY,E;;ACxYoB;AACF;AACF;AACJ;AACuB;AACG;AAClB;AAC4B;;AAE3E,IAAI,cAAI,GAAG,iBAAa;;AAExB,gDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;;AAEzC;;AAEA,kCAAkC,oBAAa;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,cAAI;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,mBAAc;AAC9C,8BAA8B,cAAY;AAC1C,yCAAyC,uBAAkB;AAC3D,gCAAgC,qBAAgB;AAChD,wBAAwB,4BAAuB;AAC/C,wBAAwB,4BAAuB;AAC/C;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,QAAQ,oCAA+B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,6BAAwB;AACvD;;AAEA,QAAQ,mCAA8B;AACtC;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;;AAE1C,0BAA0B,oBAAoB;AAC9C;AACA;AACA;;AAEA,YAAY,yBAAoB;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C,4BAA4B,4BAAkB;AAC9C;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA,uBAAuB,yBAAoB;AAC3C;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,kBAAkB;AACtC,sBAAsB,oBAAoB;;AAE1C,uBAAuB,yBAAoB;AAC3C;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,wBAAwB,4BAAuB;;AAE/C;AACA;AACA,YAAY,2BAAiB,CAAC,4BAAuB;AACrD;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;ACnUF;AAC0B;;;AAGoB;AACN;AACJ;;AAE7B,SAAS,qBAAO;AACvB,gCAAgC,SAAS;AACzC,kCAAkC,iBAAW;;AAE7C,IAAI,iBAAiB;;AAErB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL,C;;ACtB0C;AACA;AAC1C,yBAAG,CAAC,qBAAO,E;;ACFoC;AACK;AACN;;AAE9C,mBAAmB,oCAA0B;;AAE7C;;AAEA;;AAEA;AACA;;AAEA;AACA,eAAe,UAAU;AACzB,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED,0DAAe,YAAY,E;;ACpCoB;AACF;AACF;AACe;AACZ;AACA;AACU;AACT;AAC8B;;AAEjB;;AAE5D,IAAI,eAAI,GAAG,iBAAa;;AAExB,4BAAuB,CAAC,YAAW;;AAEnC,iDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;;AAEzC;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,mBAAc;AACjD,8BAA8B,OAAe;AAC7C;AACA;AACA,iBAAiB;AACjB,8BAA8B,uBAAkB;AAChD,4BAA4B,2BAAsB;AAClD,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,kBAAkB;AAC1C,0BAA0B,oBAAoB;AAC9C;AACA;AACA;;AAEA,YAAY,yBAAoB;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,0BAAqB;AACjC;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,yBAAoB;AAC1D;AACA;AACA;AACA;AACA,sCAAsC,0BAAqB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,QAAQ,oCAA+B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;;;AAGA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,QAAQ;;AAER;AACA;AACA;AACA;AACA;AACA,QAAQ;;AAER;;AAEA,sCAAsC,YAAO;AAC7C;AACA,QAAQ,qBAAgB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,eAAI;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;;AAEA,gBAAgB,aAAyB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,YAAO;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;ACvSF;AAC0B;;AAEgB;AACJ;;AAE/B,SAAS,sBAAO;AACvB,gCAAgC,UAAU;AAC1C,kCAAkC,mBAAY;;AAE9C;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL,C;;AChD0C;AACC;AAC3C,yBAAG,CAAC,sBAAO,E;;ACFoC;AACJ;AACS;AACN;;AAE9C,sDAAe,oCAA0B;;AAEzC;;AAEA;;AAEA;;AAEA;;AAEA;AACA,eAAe,UAAU;AACzB,KAAK;;AAEL;AACA,mBAAmB,6BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC,CAAC,E;;AC9E6C;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,SAAS,eAAQ;AACjB,SAAS,8BAAoB;AAC7B;AACA;AACA;AACA;AACA;AACA,eAAe,qCAA2B;;AAE1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,wCAAwC;AACrF,iDAAiD,uCAAuC;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,YAAY;AAC/B,uBAAuB,WAAW;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,wBAAwB;AACvC,eAAe,OAAO;AACtB;AACA;AACA,mBAAmB,eAAQ;;AAE3B;;AAEA;AACA;AACA,gBAAgB,0CAAgC;AAChD,aAAa;AACb;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,6CAAe,UAAU,E;;ACnLkC;AACZ;AAC/C,IAAI,sBAAI,GAAG,iBAAa;;AAExB,wDAAe;;AAEf;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAI;;AAEpB;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA,wBAAwB,sBAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,8BAAyB;AACrC;AACA,KAAK;;AAEL;AACA;AACA;;AAEA,iDAAiD,yBAAoB;;AAErE;AACA;AACA,SAAS;AACT;AACA,CAAC,E;;ACvGD,qDAAe,yFAAyF,gCAAgC,uCAAuC,6CAA6C,8BAA8B,mEAAmE,uBAAuB,iEAAiE,2BAA2B,8BAA8B,gFAAgF,iCAAiC,kBAAkB,sIAAsI,sFAAsF,+BAA+B,+DAA+D,gGAAgG,wBAAwB,kCAAkC,wDAAwD,oCAAoC,GAAG,gFAAgF,yCAAyC,gCAAgC,iCAAiC,8CAA8C,iCAAiC,6BAA6B,4CAA4C,wBAAwB,qCAAqC,kDAAkD,kFAAkF,qEAAqE,2BAA2B,sCAAsC,+CAA+C,yDAAyD,yDAAyD,6CAA6C,0DAA0D,4BAA4B,+BAA+B,6DAA6D,IAAI,SAAS,6DAA6D,IAAI,kFAAkF,mDAAmD,IAAI,IAAI,2EAA2E,WAAW,OAAO,EAAC;;;ACAz6E;AACyB;AACvB;AACA;AAC/C,IAAI,eAAI,GAAG,iBAAa;;AAEwB;AAChD,4BAAuB,CAAC,cAAa;;AAErC,iBAAiB,0BAAqB;AACtC,uBAAuB,uBAAkB;AACzC;AACA;AACA,uBAAuB,iCAA4B;AACnD,0BAA0B,iCAA4B;AACtD,sBAAsB,iCAA4B;AAClD,8BAA8B,iCAA4B;AAC1D,0BAA0B,iCAA4B;AACtD;AACA,KAAK;AACL,4BAA4B,iBAAiB;;AAE7C,uBAAuB,uBAAkB;AACzC,gBAAgB,2BAAsB;AACtC;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,yBAAyB,wBAAmB;AAC5C;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAc,0BAAqB;;AAEnC;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mDAAmD,QAAQ;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gCAAgC,sBAAiB;AACjD,qCAAqC,sBAAiB;AACtD;AACA,gBAAgB,oCAA+B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,eAAI;AACtB,uBAAuB,0BAA0B;AACjD;AACA;AACA,YAAY,eAAI;AAChB,YAAY,eAAI;;AAEhB;AACA;AACA;AACA;AACA,CAAC;;AAED,wDAAe,UAAU,E;;AClHsB;AACF;AACF;AACL;AAC2B;AACnB;AACH;AACkC;AACR;;AAErE;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAc;;AAEtC;AACA,cAAc;AACd;AACA;;AAEA,8BAA8B,oBAAa;;AAE3C;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,iBAAU;AACvC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,cAAc;AACtC,0BAA0B,gBAAgB;AAC1C,YAAY,yBAAoB;AAChC;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,kBAAkB;AAC9C,8BAA8B,oBAAoB;AAClD,gBAAgB,yBAAoB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,yBAA6B;AACzC;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb,YAAY,0BAA8B;AAC1C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA,cAAc,4BAAuB;AACrC;AACA;;AAEA;;AAEA,0BAA0B,yBAAoB;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA,QAAQ,oCAA+B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,sCAAsC,YAAO;AAC7C,QAAQ,gBAAW;AACnB,QAAQ,gBAAW;;AAEnB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C,4BAA4B,4BAAkB;AAC9C;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,oBAAoB,kBAAkB;AACtC,sBAAsB,oBAAoB;;AAE1C,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,kCAAkC;AACrE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,6BAA6B,0BAAqB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA6B,WAAW;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2DAAe,aAAa,EAAC;;;ACxkBkB;AACF;AACF;AACJ;;AAEa;;AAEpD,oDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;;AAEzC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,iEAAiE,oBAAa;AAC9E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,oBAAa;AAC7C;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,wBAAwB,4BAAuB;;AAE/C;AACA;AACA,YAAY,2BAAiB,CAAC,4BAAuB;AACrD,+BAA+B,oCAAoC;AACnE;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,+BAA+B,oCAAoC;AACnE;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;ACrIF;AAC0B;;AAEsB;AACJ;;AAErC,SAAS,yBAAO;AACvB,gCAAgC,aAAa;AAC7C,kCAAkC,eAAe;;AAEjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;;AAEA;AACA;AACA;AACA,oDAAoD,kBAAkB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,C;;ACjD0C;AACI;AAC9C,yBAAG,CAAC,yBAAO,E;;ACFoC;AACA;AAC/C,IAAI,kBAAI,GAAG,iBAAa;AACxB,IAAI,kBAAI,GAAG,iBAAa;AACxB,IAAI,uBAAS,GAAG,kBAAI;AACpB,YAAY,kBAAI;AAChB,IAAI,iBAAG,GAAG,kBAAI;AACd,IAAI,iBAAG,GAAG,kBAAI;AACd,IAAI,oBAAM,GAAG,kBAAI;;AAEjB,aAAa,oBAAM;AACnB,cAAc,oBAAM;AACpB,gBAAgB,oBAAM;AACtB,iBAAiB,oBAAM;;AAEvB;AACA;;AAEA;AACA,IAAI,kBAAI;AACR,IAAI,kBAAI;;AAER;AACA,sBAAsB,oBAAM;AAC5B,sBAAsB,oBAAM;AAC5B,sBAAsB,oBAAM;AAC5B,sBAAsB,oBAAM;AAC5B;AACA;AACA;AACA,IAAI,uBAAS;AACb;AACA,IAAI,iBAAG;AACP,IAAI,uBAAS;AACb;AACA,IAAI,uBAAS;AACb;AACA;AACA,IAAI,iBAAG;AACP,IAAI,uBAAS;;AAEb;AACA,IAAI,uBAAS;AACb,IAAI,iBAAG;AACP,IAAI,uBAAS;AACb;AACA,IAAI,uBAAS;AACb;AACA;AACA,IAAI,iBAAG;AACP,IAAI,uBAAS;;AAEb;AACA,IAAI,iBAAG;AACP,IAAI,uBAAS;AACb,mBAAmB,kBAAI;AACvB;AACA,mBAAmB,kBAAI;;AAEvB,wBAAwB,kBAAI,UAAU,kBAAI;;AAE1C,IAAI,kBAAI;AACR,IAAI,kBAAI;;AAER;AACA;;AAEA;AACA;AACA,sBAAsB,kBAAI;AAC1B,sBAAsB,kBAAI;AAC1B,sBAAsB,kBAAI;AAC1B,sBAAsB,kBAAI;;AAE1B;AACA;;AAEA,cAAc,kBAAI;AAClB,IAAI,kBAAI;AACR,IAAI,kBAAI;;AAER,IAAI,kBAAI;AACR,IAAI,kBAAI;;AAER;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,E;;ACrK+C;;AAE/C,oDAAe,oCAA0B;;AAEzC;;AAEA;;AAEA;AACA;;AAEA;AACA,2BAA2B,sBAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;AChEF,kDAAe,+DAA+D,8BAA8B,8BAA8B,yBAAyB,uBAAuB,0BAA0B,wBAAwB,mCAAmC,2DAA2D,mCAAmC,4BAA4B,4BAA4B,iCAAiC,qBAAqB,6BAA6B,8BAA8B,yBAAyB,0BAA0B,8BAA8B,iGAAiG,8DAA8D,uBAAuB,yJAAyJ,iFAAiF,oDAAoD,iDAAiD,wCAAwC,MAAM,sFAAsF,iCAAiC,yBAAyB,0BAA0B,8BAA8B,4FAA4F,4CAA4C,WAAW,IAAI,4BAA4B,sEAAsE,yCAAyC,oGAAoG,qCAAqC,IAAI,4BAA4B,GAAG,SAAS,EAAC;;;ACA3wD;AACF;AACE;;AAEW;AACT;AAC4B;;AAE7E,IAAI,eAAI,GAAG,iBAAa;;AAExB;AACA;AACA;;AAEA,4BAAuB,CAAC,WAAU;;AAElC,iDAAe,0BAAqB;;AAEpC,uBAAuB,uBAAkB;AACzC,oBAAoB,qBAAgB;AACpC,YAAY,4BAAuB;AACnC,YAAY,4BAAuB;AACnC;AACA;AACA;AACA,KAAK;;AAEL,uBAAuB,OAAe;AACtC;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,6DAA6D,oBAAoB;AACjF,wBAAwB,kBAAkB;;AAE1C;AACA;AACA;AACA,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,sCAAsC,gCAAgC;AACtE;AACA;AACA;AACA;AACA;AACA,4BAA4B,eAAI;AAChC;AACA;AACA,gBAAgB,eAAI;AACpB;;AAEA;;AAEA;AACA,sCAAsC,gCAAgC;AACtE;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;AC1J6C;AACF;AACW;AACxD;AACsC;AACuC;;AAEjB;AAC5D,4BAAuB,CAAC,YAAW;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,2BAA2B,mBAAc;;AAEzC,sCAAsC,uBAAkB;AACxD,oBAAoB,2BAAsB;AAC1C;AACA;AACA,SAAS;AACT,8BAA8B,mBAAc;AAC5C,0BAA0B,OAAa;AACvC;AACA;AACA,SAAS;;AAET;AACA,8BAA8B,UAAU;AACxC,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,mCAAmC;AACnC,gEAAgE,aAAa;AAC7E;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,4BAAuB;AACrC,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;;AAEA,uBAAuB,yBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;AC3LF;AAC0B;;AAEkB;AACA;AACJ;;AAEjC,SAAS,uBAAO;AACvB,gCAAgC,WAAW;AAC3C,kCAAkC,aAAa;;AAE/C,6BAA6B,aAAa;;AAE1C;AACA;AACA;AACA;AACA,KAAK,gBAAgB;;AAErB;AACA;AACA;AACA;AACA,KAAK,gBAAgB;;AAErB;AACA;AACA;AACA;AACA,KAAK,gBAAgB;AACrB,C;;AC9B0C;AACE;AAC5C,yBAAG,CAAC,uBAAO,E;;ACFoC;AACkC;;AAEjF;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA,uBAAuB,oCAA0B;;AAEjD;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;;AAEL;AACA,+BAA+B,sBAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,6BAA6B,qBAAqB;;AAEpE,kEAAe,gBAAgB,E;;AC7GgB;AACgB;AAClB;;AAE7C,qDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,2BAA2B,mBAAc;;AAEzC;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,mBAAY;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,+BAA+B,mBAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,CAAC,CAAC,E;;AC9FF;AAC0B;;AAEwB;AACJ;;AAEvC,SAAS,0BAAO;AACvB,gCAAgC,cAAc;AAC9C,kCAAkC,2BAAgB;AAClD,C;;ACT0C;AACK;AAC/C,yBAAG,CAAC,0BAAO,E;;ACFoC;AACkC;AAC7B;AACN;;AAE9C,oBAAoB,oCAA0B;;AAE9C;;AAEA;;AAEA;;AAEA;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA,+BAA+B,yCAA+B;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,IAAqC;AACjE;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,+BAA+B,YAAY;AAC3C,mCAAmC,YAAY;AAC/C;AACA;AACA,iCAAiC,8BAAoB;AACrD,iCAAiC,8BAAoB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,IAAqC;AACjE;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,4BAA4B,IAAqC;AACjE;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;;AAGA;AACA;AACA;AACA,+BAA+B,YAAY;AAC3C,mCAAmC,YAAY;AAC/C;AACA;AACA,iCAAiC,8BAAoB;AACrD,iCAAiC,8BAAoB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED,4BAAkB,0BAA0B,qBAAqB;;AAEjE,4DAAe,aAAa,E;;AC3MmB;AACF;AACE;AACyB;AACK;;AAE7E,IAAI,gBAAI,GAAG,iBAAa;;AAExB;AACA;AACA;;AAEA,kDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;AACzC,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,yCAAyC,6BAAwB;AACjE;;AAEA,QAAQ,mCAA8B;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+CAA+C,yBAAoB;AACnE;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,QAAQ,oCAA+B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,uBAAuB,mBAAc;AACrC,0BAA0B,uBAAkB;AAC5C;AACA;AACA,aAAa;AACb,qCAAqC,uBAAkB;AACvD,4BAA4B,qBAAgB,CAAC,4BAAuB,0BAA0B,4BAAuB;AACrH,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,qCAAqC,kBAAkB;;AAEvD;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA,2BAA2B,gBAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA,+BAA+B,gBAAI;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,gBAAI;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,kBAAkB;AAC7C;AACA,kCAAkC,yBAAoB,CAAC,kBAAkB;AACzE,kCAAkC,oBAAoB;AACtD;AACA;AACA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa;AACxC,+BAA+B,gBAAgB;AAC/C;AACA;;AAEA;;AAEA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA,uCAAuC,OAAO;AAC9C;;AAEA,2CAA2C,OAAO;AAClD;AACA;AACA;;AAEA,4BAA4B,gBAAI;AAChC,4BAA4B,gBAAI;AAChC,4BAA4B,gBAAI;AAChC;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,8BAA8B;AAC7D;AACA,oBAAoB,gBAAI;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa;AACxC,+BAA+B,gBAAgB;AAC/C;AACA;;AAEA;AACA,mCAAmC,OAAO;AAC1C,uCAAuC,OAAO;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA,8BAA8B,yBAAoB,CAAC,kBAAkB;AACrE,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa;AACxC,+BAA+B,gBAAgB;;AAE/C;;AAEA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;AC3eF;AAC0B;;AAEkB;AACJ;;AAEjC,SAAS,uBAAO;AACvB,gCAAgC,WAAW;AAC3C,kCAAkC,qBAAa;;AAE/C;AACA;AACA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;AACT,KAAK;AACL,C;;AC3C0C;AACE;AAC5C,yBAAG,CAAC,uBAAO,E;;ACFoC;AAC0C;AACF;AACV;AACI;AACjB;AACrB;AACS;AACA;;AAEpD,SAAS,4BAAgB;AACzB;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA,kBAAkB,oCAA0B;;AAE5C;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,yBAAyB,yCAA+B;AACxD;AACA,SAAS;AACT,uBAAuB,sBAAY;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;AACA;AACA,iDAAiD,uBAAa;AAC9D,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,8BAAwB;AACpD;AACA;AACA;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA,+BAA+B,4BAAgB;AAC/C;AACA,mCAAmC,0BAA0B;AAC7D,uCAAuC,4BAAgB;AACvD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,mBAAmB,6BAA4B;AAC/C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,wBAAwB,eAAe;;AAEzD,4BAAkB,wBAAwB,yBAAyB;AACnE,4BAAkB,wBAAwB,wBAAwB;AAClE,4BAAkB,wBAAwB,mBAAmB;AAC7D,4BAAkB,wBAAwB,qBAAqB;;AAE/D,wDAAe,WAAW,E;;AC7JqB;;AAEF;AACM;AACU;AACE;;AAE/D,gDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,iCAAiC,mBAAY;AAC7C,2BAA2B,mBAAc;AACzC,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,wCAAwC,kBAAW;AACnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,8CAA8C,iBAAY;AAC1D;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;AC9GF;AAC0B;;AAEc;AACJ;;AAEkC;;AAE/D,SAAS,qBAAO;AACvB;AACA,IAAI,eAAY;;AAEhB,gCAAgC,SAAS;AACzC,kCAAkC,iBAAW;AAC7C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;AACL,C;;ACzB0C;AACA;AAC1C,yBAAG,CAAC,qBAAO,E;;ACFoC;;AAE/C,sDAAe,oCAA0B;;AAEzC;;AAEA;;AAEA;;AAEA;;AAEA;AACA,eAAe,mCAAyB;AACxC,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC,CAAC,E;;;AC5DgD;AACA;;AAElD;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,MAAa;AACvC;AACA;;AAEA;AACA;;AAEA;;AAEA,QAAQ,aAAa;;AAErB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,cAAqB;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ,cAAqB;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0DAAe,YAAY,E;;AClFoB;AACF;AACN;AACa;;AAEF;;AAElD,oDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;AACzC,0BAA0B,WAAM;;AAEhC;;AAEA;AACA;;AAEA;;AAEA,iCAAiC,mBAAY;AAC7C,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,6DAA6D,oBAAa;AAC1E;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC,oBAAa;AAC7C;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;ACxHF;AAC0B;;AAEsB;AACJ;;AAErC,SAAS,yBAAO;AACvB,gCAAgC,aAAa;AAC7C,kCAAkC,eAAe;;AAEjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,oDAAoD,kBAAkB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,kBAAkB;AACtE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA,KAAK;AACL,C;;ACzD0C;AACI;AAC9C,yBAAG,CAAC,yBAAO,E;;;ACDX;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;;AAEhD;AACA;AACA;;AAEA,IAAI,WAAK;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,UAAU,IAAqC;AAC/C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kCAAkC;;AAElC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,mBAAmB,uBAAuB;AAC1C;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,qBAAqB,kBAAkB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;;AAEA;AACA;AACA;AACA,KAAK,EAAE;;AAEP,uCAAuC,SAAS;AAChD;AACA;;AAEA,2CAA2C,SAAS;AACpD;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;;;AAGA;AACA;AACA;AACA;AACA,cAAc;AACd;;;AAGA;AACA;AACA;AACA;AACA,aAAa;AACb;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,uBAAuB;AAC1C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAY;AACZ,KAAY;AACZ,iDAAe,WAAK,EAAC;;;;AC1drB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AAC+E;AAClC;AAC7C,YAAY,SAAS;;AAErB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC;;AAEhC,EAAE,IAAI;AACN,IAAI,IAAI;AACR,kCAAkC,KAAK;AACvC,KAAK;AACL,GAAG,EAAE;;AAEL,sCAAsC,KAAK,8BAA8B;AACzE;;AAEA,EAAE,IAAI;AACN,oCAAoC,KAAK;AACzC,GAAG,EAAE;;AAEL,EAAE,MAAM;AACR;;AAEA;AACA;AACA;AACA,gBAAgB,WAAM,GAAG;AACzB;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE,IAAI;AACN;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,GAAG,IAAI,GAAG,CAAC,IAAI;AACf;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE,IAAI;AACN;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;;AAEA,sDAAe,QAAQ,E;;ACvKwB;AACJ;AACa;AACb;;AAE3C,6BAAe,SAAS,wBAAC;AACzB,oBAAoB,UAAK;AACzB,mBAAmB,kBAAkB;AACrC,sBAAsB,0BAAqB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,0BAAqB;AACnD;AACA;AACA;;AAEA;;AAEA;AACA,yBAAyB,yCAA+B;AACxD;AACA;AACA;AACA;AACA,mBAAmB,sBAAY;AAC/B;;AAEA,uBAAuB,sBAAY;AACnC;;AAEA;;AAEA,IAAI,eAAQ;AACZ;AACA;AACA;AACA,gBAAgB,+BAA+B;AAC/C,oBAAoB;AACpB,KAAK;;AAEL;AACA;;AAEA;AACA,E;;ACzD+C;AACiB;AACrB;;AAE3C,kBAAkB,oCAA0B;;AAE5C;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,mBAAmB,6BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,uBAAuB;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,mCAAyB;;AAE5C;AACA,gCAAgC,mCAAyB;AACzD;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,iCAAiC,sBAAY;AAC7C;;AAEA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,uBAAuB,uBAAuB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,EAAE;AAC3B;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,qBAAqB;;AAErB;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED,oDAAe,WAAW,E;;ACxR1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAE2C;AACI;AACS;AACT;AAC/C,IAAI,YAAI,GAAG,iBAAa;;AAExB;AACA;;AAEA,IAAI,wBAAgB;AACpB;AACA;AACA;AACA;AACA;;AAEA,IAAI,qBAAa,GAAG,mBAAe;AACnC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C,wBAAwB,sBAAkB;AAC1C,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;AACzC;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kBAAkB,YAAI,gBAAgB,YAAI,gBAAgB,YAAI;AAC9D;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,2CAA2C,wBAAgB;AAC3D,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,6CAA6C,wBAAgB;AAC7D,KAAK;;AAEL;AACA;AACA,cAAc,aAAa;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc,aAAa;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;;AAEA,sBAAsB;AACtB,wBAAwB;AACxB,0BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,+BAA+B;AAC9C,eAAe,+BAA+B;AAC9C,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,mBAAmB,YAAI;AACvB,mBAAmB,YAAI;AACvB,qBAAqB,YAAI;AACzB,sBAAsB,YAAI;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,YAAI;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,qEAAqE,YAAI;AACzE;AACA;;AAEA;AACA;AACA;AACA,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;;AAEhC;AACA;;AAEA;AACA;;AAEA;AACA;AACA,wBAAwB,YAAI;AAC5B,wBAAwB,YAAI;;AAE5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,YAAI;;AAExB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,eAAe;AAChD;AACA;AACA;AACA;AACA,CAAC;;AAED,+BAAqB,CAAC,qBAAa,YAAY,mBAAmB;;AAElE,8CAAe,qBAAa,E;;ACjd5B,uDAAe,uGAAuG,6BAA6B,wBAAwB,wBAAwB,6BAA6B,mCAAmC,8BAA8B,4BAA4B,iBAAiB,kDAAkD,4BAA4B,kBAAkB,gBAAgB,OAAO,yIAAyI,wCAAwC,8BAA8B,4BAA4B,oBAAoB,sBAAsB,wBAAwB,sBAAsB,uBAAuB,iBAAiB,4CAA4C,IAAI,sBAAsB,0CAA0C,IAAI,IAAI,SAAS,uCAAuC,IAAI,yBAAyB,IAAI,IAAI,sCAAsC,iBAAiB,4BAA4B,mBAAmB,IAAI,+CAA+C,0CAA0C,GAAG,uFAAuF,uBAAuB,yBAAyB,kCAAkC,oCAAoC,8BAA8B,0BAA0B,yCAAyC,yBAAyB,iBAAiB,6CAA6C,2CAA2C,8BAA8B,yBAAyB,WAAW,oCAAoC,WAAW,IAAI,yCAAyC,cAAc,IAAI,SAAS,wCAAwC,IAAI,8DAA8D,+FAA+F,wCAAwC,8CAA8C,sBAAsB,kBAAkB,wBAAwB,uBAAuB,IAAI,kBAAkB,uBAAuB,UAAU,IAAI,sBAAsB,2BAA2B,IAAI,SAAS,cAAc,IAAI,0BAA0B,GAAG,yFAAyF,iBAAiB,0CAA0C,GAAG,iFAAiF,0BAA0B,iBAAiB,qBAAqB,0CAA0C,sBAAsB,GAAG,qFAAqF,kCAAkC,6BAA6B,iCAAiC,iBAAiB,iDAAiD,yDAAyD,qDAAqD,kDAAkD,2DAA2D,oDAAoD,GAAG,2FAA2F,mCAAmC,gCAAgC,iBAAiB,8DAA8D,sEAAsE,2FAA2F,+BAA+B,2EAA2E,IAAI,mDAAmD,GAAG,gFAAgF,iCAAiC,gCAAgC,mCAAmC,4BAA4B,iBAAiB,mDAAmD,2DAA2D,kDAAkD,gEAAgE,2CAA2C,uEAAuE,8BAA8B,kBAAkB,sCAAsC,2DAA2D,IAAI,SAAS,uBAAuB,IAAI,GAAG,wGAAwG,wBAAwB,iCAAiC,uBAAuB,kCAAkC,kBAAkB,+FAA+F,qBAAqB,GAAG,6FAA6F,uBAAuB,eAAe,kCAAkC,GAAG,OAAO,EAAC;;;ACAr8J;AACC;AACG;;AAEG;AACpD,4BAAuB,CAAC,gBAAe;;AAEvC;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA,cAAc,4BAAuB;AACrC,mBAAmB,8BAAyB;AAC5C,mBAAmB,8BAAyB;AAC5C;;AAEA,kCAAkC,wBAAmB;AACrD;;AAEA,4BAA4B,wBAAmB;AAC/C,gCAAgC,wBAAmB;AACnD,yBAAyB,wBAAmB;AAC5C,6BAA6B,wBAAmB;;AAEhD,+BAA+B,wBAAmB;AAClD;;AAEA,+BAA+B,wBAAmB;AAClD,mCAAmC,wBAAmB;AACtD;AACA;;AAEA,kCAAkC,eAAI;AACtC,kBAAkB,4BAAuB;AACzC,KAAK;AACL,6BAA6B,eAAI;AACjC,kBAAkB,4BAAuB;AACzC,KAAK;AACL,gCAAgC,eAAI;AACpC,kBAAkB,4BAAuB;AACzC,KAAK;AACL,yBAAyB,eAAI;AAC7B,kBAAkB,4BAAuB;AACzC,KAAK;;AAEL;AACA;AACA;AACA;AACA,8BAA8B,mBAAc;AAC5C,sBAAsB,uBAAkB;AACxC;AACA,2BAA2B,iCAA4B;AACvD,2BAA2B,iCAA4B;AACvD,4BAA4B,iCAA4B;AACxD,aAAa;AACb;AACA;AACA,SAAS;AACT,sBAAsB,uBAAkB;AACxC;AACA,oBAAoB,2BAAsB;AAC1C;AACA;AACA;AACA,SAAS;AACT,cAAc,0BAAqB;AACnC,KAAK;AACL,gCAAgC,mBAAc;AAC9C,sBAAsB,uBAAkB;AACxC;AACA,0BAA0B,iCAA4B;AACtD,aAAa;AACb;AACA;AACA,SAAS;AACT,sBAAsB,uBAAkB;AACxC;AACA,oBAAoB,2BAAsB;AAC1C;AACA;AACA;AACA,SAAS;AACT,cAAc,0BAAqB;AACnC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA,KAAK;;AAEL,4BAA4B,iCAA4B;AACxD;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe,GAAG,aAAa;AAC1C,WAAW,eAAe,GAAG,uBAAuB;AACpD;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,WAAW;AAC9B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6DAAe,cAAc,E;;ACld7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA,mCAAmC,YAAY;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,YAAY;AACnC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,wBAAwB;AAC3D;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,WAAW;AAC9C;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,YAAY;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;;AAEA,gEAAe,iBAAiB,E;;ACppBa;AACJ;AACO;AAChD,gBAAgB,kCAAmB;AACnC,gDAAgD,gCAAgC;;AAEhF,IAAI,0BAAc;;AAElB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,qBAAqB,0BAAc;AACnC,qBAAqB,0BAAc;AACnC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,4BAA4B,aAAS;AACrC,cAAc,iBAAa;AAC3B;AACA,mBAAmB,mBAAe;AAClC,mBAAmB,mBAAe;AAClC,KAAK;AACL;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,0BAAc;AACnC,uBAAuB,0BAAc;AACrC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,0BAAc;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,kBAAkB;AACrC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,0DAAe,WAAW,E;;;ACvRc;AACN;;AAElC;AACA;AACA;AACA,oBAAoB,gBAAW;;AAE/B;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,yDAAe,aAAa,E;;ACpM5B,mDAAe,uFAAuF,sCAAsC,iCAAiC,uBAAuB,sEAAsE,0BAA0B,kEAAkE,uBAAuB,GAAG,uFAAuF,yBAAyB,kBAAkB,kCAAkC,GAAG,iFAAiF,wBAAwB,yBAAyB,iCAAiC,2DAA2D,mCAAmC,yBAAyB,wBAAwB,kBAAkB,uEAAuE,kEAAkE,mBAAmB,mCAAmC,gDAAgD,oDAAoD,qCAAqC,uBAAuB,GAAG,2FAA2F,yBAAyB,wBAAwB,kBAAkB,kCAAkC,GAAG,SAAS,EAAC;;;ACA32C;AACO;AACT;AACN;AACmB;AACf;AACG;AACN;AACwC;AACjC;AAC8B;;AAE7E,IAAI,gBAAI,GAAG,iBAAa;;AAE6B;;AAED;;AAEQ;AAC5D,4BAAuB,CAAC,YAAW;;AAEnC;;AAEA,kDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;AACzC,0BAA0B,WAAM;AAChC;;AAEA;;AAEA,kCAAkC,oBAAa;;AAE/C;AACA,mCAAmC,mBAAc;AACjD,0BAA0B,uBAAkB;AAC5C,wBAAwB,2BAAsB;AAC9C;AACA;AACA;AACA,aAAa;AACb;AACA,0BAA0B,uBAAkB;AAC5C;AACA,8BAA8B,iCAA4B;AAC1D,+BAA+B,iCAA4B;AAC3D,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA,kBAAkB,yBAAoB;AACtC,SAAS;;AAET;AACA,8BAA8B,mBAAc;AAC5C,0BAA0B,uBAAkB;AAC5C,wBAAwB,2BAAsB;AAC9C;AACA;AACA;AACA,aAAa;AACb;AACA,0BAA0B,OAAe;AACzC;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;;AAET;;AAEA,4BAA4B,kBAAa;AACzC;AACA;AACA,SAAS;AACT;AACA;;;AAGA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,mDAAmD,sBAAc;AACjE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA,SAAS;;AAET,8BAA8B,0BAAqB;AACnD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,kBAAkB;AAC1C,2BAA2B,yBAAoB;AAC/C,2BAA2B,0BAAqB;AAChD,gBAAgB,oBAAoB;AACpC;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,kBAAkB;AAC1C,2BAA2B,yBAAoB;AAC/C,2BAA2B,0BAAqB,CAAC,oBAAoB;AACrE;AACA,4BAA4B,0BAAqB;;AAEjD;;AAEA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA,SAAS;;AAET;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kCAAkC,0BAAqB;AACvD,kCAAkC,0BAAqB;AACvD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,kCAAwB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;;AAEA;AACA;AACA;AACA,6BAA6B,kCAAwB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA,yEAAyE,sBAAc;AACvF,6EAA6E,mBAAW;AACxF;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,sBAAc;AACxC,0BAA0B,mBAAW;AACrC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,+BAAqB;AACrC;AACA,iBAAiB;AACjB,aAAa;AACb;;AAEA,QAAQ,+BAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,6BAA6B,yBAAoB;AACjD,8BAA8B,0BAAqB;AACnD;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAI;AACtB,kBAAkB,gBAAI;AACtB;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA,YAAY,gBAAI;AAChB,YAAY,gBAAI;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;AC1tBF;AAC0B;;AAEqB;;AAEH;AACJ;;AAExC,SAAS,iBAAS;AAClB;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAO;;AAEvB,gCAAgC,WAAW;AAC3C,kCAAkC,aAAa;;AAE/C;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,6BAAmB;;AAE3C;;AAEA,uCAAuC,uBAAuB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,6BAA6B,iBAAS;AACtC,6BAA6B,iBAAS;;AAEtC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iCAAiC,iBAAS;AAC1C,iCAAiC,iBAAS;AAC1C;AACA;;AAEA;AACA,gBAAgB,6BAAmB;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA,KAAK;AACL,C;;ACxK0C;AACE;AAC5C,yBAAG,CAAC,uBAAO,E;;ACFoC;;AAE/C,mDAAe,oCAA0B;;AAEzC;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,eAAe,+CAAqC;AACpD,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA,yBAAyB,yCAA+B;AACxD;AACA;AACA;AACA,SAAS;AACT,uBAAuB,sBAAY;AACnC;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;ACvDF;AACA;AACA;AACA;AACA;AACA;AACA;;AAE2C;AACI;;AAE/C;AACA;AACA;AACA;AACA;;AAEA,IAAI,oBAAa,GAAG,mBAAe;AACnC;;AAEA;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,6CAAe,oBAAa,E;;AChF5B,+DAAe,gFAAgF,iCAAiC,oCAAoC,4BAA4B,4BAA4B,qCAAqC,6BAA6B,qCAAqC,+BAA+B,4BAA4B,oBAAoB,mDAAmD,sBAAsB,oBAAoB,uEAAuE,yBAAyB,gBAAgB,IAAI,+EAA+E,uBAAuB,mBAAmB,+CAA+C,oBAAoB,wCAAwC,aAAa,IAAI,sBAAsB,sBAAsB,GAAG,sHAAsH,sCAAsC,yDAAyD,6BAA6B,wBAAwB,oBAAoB,kBAAkB,iDAAiD,mCAAmC,wEAAwE,IAAI,SAAS,yDAAyD,IAAI,iBAAiB,eAAe,yBAAyB,GAAG,uGAAuG,oCAAoC,iCAAiC,kCAAkC,wBAAwB,oBAAoB,kBAAkB,wBAAwB,yFAAyF,wBAAwB,WAAW,IAAI,wGAAwG,sFAAsF,WAAW,qHAAqH,sCAAsC,wCAAwC,6BAA6B,4BAA4B,yDAAyD,wBAAwB,oBAAoB,4CAA4C,oDAAoD,yDAAyD,6BAA6B,6BAA6B,mCAAmC,sCAAsC,2EAA2E,gCAAgC,6CAA6C,eAAe,eAAe,IAAI,SAAS,8CAA8C,gBAAgB,gBAAgB,IAAI,mDAAmD,IAAI,SAAS,yDAAyD,IAAI,GAAG,sGAAsG,oCAAoC,iCAAiC,wBAAwB,oBAAoB,kBAAkB,wBAAwB,iGAAiG,sFAAsF,WAAW,WAAW,EAAC;;;ACAz/G;AACH;AACR;AACQ;AACJ;AACM;AACJ;AACgB;AACH;;AAEL;AACX;AACtC;;AAEoE;;AAEpE,iBAAgB,CAAC,wBAAuB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,kCAAkC,aAAS;AAC3C,cAAc,iBAAa;AAC3B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;;AAEA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,kBAAkB,iBAAa;AAC/B,uBAAuB,mBAAe;AACtC,uBAAuB,mBAAe;AACtC;AACA;AACA,iCAAiC,aAAS;;AAE1C,qCAAqC,aAAS;AAC9C,qCAAqC,aAAS;;AAE9C,gCAAgC,eAAW;AAC3C;AACA,SAAS;AACT,iCAAiC,eAAI;AACrC,sBAAsB,iBAAa;AACnC,SAAS;AACT;AACA;;AAEA,mCAAmC,eAAI;AACvC,sBAAsB,iBAAa;AACnC,SAAS;;AAET,qCAAqC,QAAI;AACzC;AACA;AACA,0BAA0B,YAAQ;AAClC,4BAA4B,UAAM;AAClC,oBAAoB,iBAAa;AACjC,oBAAoB,iBAAa;AACjC;AACA,aAAa;AACb,kBAAkB,eAAW;AAC7B,0BAA0B,YAAQ;AAClC;AACA;AACA,aAAa;AACb,SAAS;AACT,oCAAoC,QAAI;AACxC;AACA;AACA,0BAA0B,YAAQ;AAClC,4BAA4B,UAAM;AAClC,oBAAoB,iBAAa;AACjC,oBAAoB,iBAAa;AACjC;AACA,aAAa;AACb,0BAA0B,MAAc;AACxC;AACA,SAAS;AACT,oCAAoC,QAAI;AACxC,0BAA0B,YAAQ;AAClC,4BAA4B,UAAM;AAClC,oBAAoB,iBAAa;AACjC,oBAAoB,iBAAa;AACjC;AACA;AACA;AACA,aAAa;AACb,0BAA0B,cAAa;AACvC,SAAS;AACT;;AAEA;AACA;AACA;;AAEA,2BAA2B,mBAAW;AACtC,qCAAqC,aAAS;AAC9C,qCAAqC,aAAS;AAC9C,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,WAAW;AAClC,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,WAAW;AAClC,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,uBAAuB,WAAW;AAClC,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,aAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC,iEAAiE,aAAS;AAC1E;AACA;AACA;AACA;AACA,cAAc,8BAA8B;AAC5C;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA,wEAAe,0BAA0B,E;;ACzbM;AACF;AACF;AACJ;;AAE+B;;;AAGtE;AACA,iDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,0BAA0B,WAAM;AAChC,2BAA2B,mBAAc;AACzC;;AAEA,oCAAoC,iCAA0B;;AAE9D,4BAA4B,mBAAc;AAC1C,0BAA0B,4BAAuB;AACjD,0BAA0B,uBAAkB;AAC5C,4BAA4B,qBAAgB;AAC5C,4BAA4B,4BAAuB;AACnD,8BAA8B,4BAAuB;AACrD,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;;AAEA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,8BAA8B,0BAAqB;AACnD;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA,oBAAoB,yBAAoB;AACxC,oBAAoB,0BAAqB;AACzC;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,YAAY;AACnC,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA,iCAAiC;AACjC;AACA;AACA,iCAAiC;AACjC;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,wBAAmB;AAChF;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,EAAC;;;ACrWH;AAC0B;;AAEgB;AACJ;;AAE/B,SAAS,sBAAO;AACvB,gCAAgC,UAAU;AAC1C,kCAAkC,YAAY;AAC9C,C;;ACT0C;AACC;AAC3C,yBAAG,CAAC,sBAAO,E;;ACFoC;AACK;;AAEpD,oBAAoB,oCAA0B;;AAE9C;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,WAAW;AAC9C,yCAAyC,WAAW;AACpD;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,WAAW;AAC1C;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,IAAqC;AACjE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,2BAA2B,sBAAY;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,4DAAe,aAAa,E;;AC1MmB;AACF;AACN;AACmB;AACR;AAC2B;;AAElC;;AAE3C,kDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,2BAA2B,mBAAc;AACzC,0BAA0B,WAAM;AAChC;;AAEA,iCAAiC,mBAAY;;AAE7C,kCAAkC,2BAAsB;AACxD,gCAAgC,2BAAsB;;AAEtD;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,4BAA4B,mBAAc;AAC1C;AACA,0BAA0B,uBAAkB;AAC5C,wBAAwB,2BAAsB;AAC9C;AACA;AACA;AACA,aAAa;AACb,0BAA0B,OAAe;AACzC;AACA;AACA;AACA,aAAa;AACb,kBAAkB,yBAAoB;AACtC;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc,4BAAuB;AACrC;AACA;AACA;AACA;;AAEA,wBAAwB,0BAAqB;;AAE7C;AACA;AACA;AACA;AACA,6BAA6B,6BAAwB;AACrD;AACA;AACA;AACA;AACA;AACA,6BAA6B,yBAAoB;AACjD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,WAAW;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,WAAW;AACxC,YAAY,yBAAoB,CAAC,kBAAkB;AACnD,0BAA0B,0BAAqB,CAAC,oBAAoB;AACpE;;AAEA;AACA,2BAA2B,WAAW;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;ACzMF;AAC0B;;AAEkB;AACJ;;AAEjC,SAAS,uBAAO;AACvB,gCAAgC,WAAW;AAC3C,kCAAkC,qBAAa;AAC/C,C;;ACT0C;AACE;AAC5C,yBAAG,CAAC,uBAAO,E;;ACFY;;AAEM;AACD;AACA;AACG;AACE;;AAET;AACC;AACG;AACF;AACG;AACH;AACF;;AAEI;AACF;AACD;;;;;;;;;;;AClBzB,iE;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,EAAE;WACF;WACA;WACA,CAAC,I;;;;;WCPD;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"echarts-gl.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"echarts\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"echarts\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"echarts-gl\"] = factory(require(\"echarts\"));\n\telse\n\t\troot[\"echarts-gl\"] = factory(root[\"echarts\"]);\n})(self, function(__WEBPACK_EXTERNAL_MODULE_echarts_lib_echarts__) {\nreturn ","/**\n * Extend a sub class from base class\n * @param {object|Function} makeDefaultOpt default option of this sub class, method of the sub can use this.xxx to access this option\n * @param {Function} [initialize] Initialize after the sub class is instantiated\n * @param {Object} [proto] Prototype methods/properties of the sub class\n * @memberOf clay.core.mixin.extend\n * @return {Function}\n */\nfunction derive(makeDefaultOpt, initialize/*optional*/, proto/*optional*/) {\n\n if (typeof initialize == 'object') {\n proto = initialize;\n initialize = null;\n }\n\n var _super = this;\n\n var propList;\n if (!(makeDefaultOpt instanceof Function)) {\n // Optimize the property iterate if it have been fixed\n propList = [];\n for (var propName in makeDefaultOpt) {\n if (makeDefaultOpt.hasOwnProperty(propName)) {\n propList.push(propName);\n }\n }\n }\n\n var sub = function(options) {\n\n // call super constructor\n _super.apply(this, arguments);\n\n if (makeDefaultOpt instanceof Function) {\n // Invoke makeDefaultOpt each time if it is a function, So we can make sure each\n // property in the object will not be shared by mutiple instances\n extend(this, makeDefaultOpt.call(this, options));\n }\n else {\n extendWithPropList(this, makeDefaultOpt, propList);\n }\n\n if (this.constructor === sub) {\n // Initialize function will be called in the order of inherit\n var initializers = sub.__initializers__;\n for (var i = 0; i < initializers.length; i++) {\n initializers[i].apply(this, arguments);\n }\n }\n };\n // save super constructor\n sub.__super__ = _super;\n // Initialize function will be called after all the super constructor is called\n if (!_super.__initializers__) {\n sub.__initializers__ = [];\n } else {\n sub.__initializers__ = _super.__initializers__.slice();\n }\n if (initialize) {\n sub.__initializers__.push(initialize);\n }\n\n var Ctor = function() {};\n Ctor.prototype = _super.prototype;\n sub.prototype = new Ctor();\n sub.prototype.constructor = sub;\n extend(sub.prototype, proto);\n\n // extend the derive method as a static method;\n sub.extend = _super.extend;\n\n // DEPCRATED\n sub.derive = _super.extend;\n\n return sub;\n}\n\nfunction extend(target, source) {\n if (!source) {\n return;\n }\n for (var name in source) {\n if (source.hasOwnProperty(name)) {\n target[name] = source[name];\n }\n }\n}\n\nfunction extendWithPropList(target, source, propList) {\n for (var i = 0; i < propList.length; i++) {\n var propName = propList[i];\n target[propName] = source[propName];\n }\n}\n\n/**\n * @alias clay.core.mixin.extend\n * @mixin\n */\nexport default {\n\n extend: derive,\n\n // DEPCRATED\n derive: derive\n};\n","function Handler(action, context) {\n this.action = action;\n this.context = context;\n}\n/**\n * @mixin\n * @alias clay.core.mixin.notifier\n */\nvar notifier = {\n /**\n * Trigger event\n * @param {string} name\n */\n trigger: function(name) {\n if (!this.hasOwnProperty('__handlers__')) {\n return;\n }\n if (!this.__handlers__.hasOwnProperty(name)) {\n return;\n }\n\n var hdls = this.__handlers__[name];\n var l = hdls.length, i = -1, args = arguments;\n // Optimize advise from backbone\n switch (args.length) {\n case 1:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context);\n }\n return;\n case 2:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context, args[1]);\n }\n return;\n case 3:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context, args[1], args[2]);\n }\n return;\n case 4:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context, args[1], args[2], args[3]);\n }\n return;\n case 5:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context, args[1], args[2], args[3], args[4]);\n }\n return;\n default:\n while (++i < l) {\n hdls[i].action.apply(hdls[i].context, Array.prototype.slice.call(args, 1));\n }\n return;\n }\n },\n /**\n * Register event handler\n * @param {string} name\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n on: function(name, action, context) {\n if (!name || !action) {\n return;\n }\n var handlers = this.__handlers__ || (this.__handlers__={});\n if (!handlers[name]) {\n handlers[name] = [];\n }\n else {\n if (this.has(name, action)) {\n return;\n }\n }\n var handler = new Handler(action, context || this);\n handlers[name].push(handler);\n\n return this;\n },\n\n /**\n * Register event, event will only be triggered once and then removed\n * @param {string} name\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n once: function(name, action, context) {\n if (!name || !action) {\n return;\n }\n var self = this;\n function wrapper() {\n self.off(name, wrapper);\n action.apply(this, arguments);\n }\n return this.on(name, wrapper, context);\n },\n\n /**\n * Alias of once('before' + name)\n * @param {string} name\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n before: function(name, action, context) {\n if (!name || !action) {\n return;\n }\n name = 'before' + name;\n return this.on(name, action, context);\n },\n\n /**\n * Alias of once('after' + name)\n * @param {string} name\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n after: function(name, action, context) {\n if (!name || !action) {\n return;\n }\n name = 'after' + name;\n return this.on(name, action, context);\n },\n\n /**\n * Alias of on('success')\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n success: function(action, context) {\n return this.once('success', action, context);\n },\n\n /**\n * Alias of on('error')\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n error: function(action, context) {\n return this.once('error', action, context);\n },\n\n /**\n * Remove event listener\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n off: function(name, action) {\n\n var handlers = this.__handlers__ || (this.__handlers__={});\n\n if (!action) {\n handlers[name] = [];\n return;\n }\n if (handlers[name]) {\n var hdls = handlers[name];\n var retains = [];\n for (var i = 0; i < hdls.length; i++) {\n if (action && hdls[i].action !== action) {\n retains.push(hdls[i]);\n }\n }\n handlers[name] = retains;\n }\n\n return this;\n },\n\n /**\n * If registered the event handler\n * @param {string} name\n * @param {Function} action\n * @return {boolean}\n */\n has: function(name, action) {\n var handlers = this.__handlers__;\n\n if (! handlers ||\n ! handlers[name]) {\n return false;\n }\n var hdls = handlers[name];\n for (var i = 0; i < hdls.length; i++) {\n if (hdls[i].action === action) {\n return true;\n }\n }\n }\n};\n\nexport default notifier;","var guid = 0;\n\nvar ArrayProto = Array.prototype;\nvar nativeForEach = ArrayProto.forEach;\n\n/**\n * Util functions\n * @namespace clay.core.util\n */\nvar util = {\n\n /**\n * Generate GUID\n * @return {number}\n * @memberOf clay.core.util\n */\n genGUID: function () {\n return ++guid;\n },\n /**\n * Relative path to absolute path\n * @param {string} path\n * @param {string} basePath\n * @return {string}\n * @memberOf clay.core.util\n */\n relative2absolute: function (path, basePath) {\n if (!basePath || path.match(/^\\//)) {\n return path;\n }\n var pathParts = path.split('/');\n var basePathParts = basePath.split('/');\n\n var item = pathParts[0];\n while(item === '.' || item === '..') {\n if (item === '..') {\n basePathParts.pop();\n }\n pathParts.shift();\n item = pathParts[0];\n }\n return basePathParts.join('/') + '/' + pathParts.join('/');\n },\n\n /**\n * Extend target with source\n * @param {Object} target\n * @param {Object} source\n * @return {Object}\n * @memberOf clay.core.util\n */\n extend: function (target, source) {\n if (source) {\n for (var name in source) {\n if (source.hasOwnProperty(name)) {\n target[name] = source[name];\n }\n }\n }\n return target;\n },\n\n /**\n * Extend properties to target if not exist.\n * @param {Object} target\n * @param {Object} source\n * @return {Object}\n * @memberOf clay.core.util\n */\n defaults: function (target, source) {\n if (source) {\n for (var propName in source) {\n if (target[propName] === undefined) {\n target[propName] = source[propName];\n }\n }\n }\n return target;\n },\n /**\n * Extend properties with a given property list to avoid for..in.. iteration.\n * @param {Object} target\n * @param {Object} source\n * @param {Array.} propList\n * @return {Object}\n * @memberOf clay.core.util\n */\n extendWithPropList: function (target, source, propList) {\n if (source) {\n for (var i = 0; i < propList.length; i++) {\n var propName = propList[i];\n target[propName] = source[propName];\n }\n }\n return target;\n },\n /**\n * Extend properties to target if not exist. With a given property list avoid for..in.. iteration.\n * @param {Object} target\n * @param {Object} source\n * @param {Array.} propList\n * @return {Object}\n * @memberOf clay.core.util\n */\n defaultsWithPropList: function (target, source, propList) {\n if (source) {\n for (var i = 0; i < propList.length; i++) {\n var propName = propList[i];\n if (target[propName] == null) {\n target[propName] = source[propName];\n }\n }\n }\n return target;\n },\n /**\n * @param {Object|Array} obj\n * @param {Function} iterator\n * @param {Object} [context]\n * @memberOf clay.core.util\n */\n each: function (obj, iterator, context) {\n if (!(obj && iterator)) {\n return;\n }\n if (obj.forEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n }\n else if (obj.length === + obj.length) {\n for (var i = 0, len = obj.length; i < len; i++) {\n iterator.call(context, obj[i], i, obj);\n }\n }\n else {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n },\n\n /**\n * Is object\n * @param {} obj\n * @return {boolean}\n * @memberOf clay.core.util\n */\n isObject: function (obj) {\n return obj === Object(obj);\n },\n\n /**\n * Is array ?\n * @param {} obj\n * @return {boolean}\n * @memberOf clay.core.util\n */\n isArray: function (obj) {\n return Array.isArray(obj);\n },\n\n /**\n * Is array like, which have a length property\n * @param {} obj\n * @return {boolean}\n * @memberOf clay.core.util\n */\n isArrayLike: function (obj) {\n if (!obj) {\n return false;\n }\n else {\n return obj.length === + obj.length;\n }\n },\n\n /**\n * @param {} obj\n * @return {}\n * @memberOf clay.core.util\n */\n clone: function (obj) {\n if (!util.isObject(obj)) {\n return obj;\n }\n else if (util.isArray(obj)) {\n return obj.slice();\n }\n else if (util.isArrayLike(obj)) { // is typed array\n var ret = new obj.constructor(obj.length);\n for (var i = 0; i < obj.length; i++) {\n ret[i] = obj[i];\n }\n return ret;\n }\n else {\n return util.extend({}, obj);\n }\n }\n};\n\nexport default util;\n","import extendMixin from './mixin/extend';\nimport notifierMixin from './mixin/notifier';\nimport util from './util';\n\n/**\n * Base class of all objects\n * @constructor\n * @alias clay.core.Base\n * @mixes clay.core.mixin.notifier\n */\nvar Base = function () {\n /**\n * @type {number}\n */\n this.__uid__ = util.genGUID();\n};\n\nBase.__initializers__ = [\n function (opts) {\n util.extend(this, opts);\n }\n];\n\nutil.extend(Base, extendMixin);\nutil.extend(Base.prototype, notifierMixin);\n\nexport default Base;\n","var EXTENSION_LIST = [\n 'OES_texture_float',\n 'OES_texture_half_float',\n 'OES_texture_float_linear',\n 'OES_texture_half_float_linear',\n 'OES_standard_derivatives',\n 'OES_vertex_array_object',\n 'OES_element_index_uint',\n 'WEBGL_compressed_texture_s3tc',\n 'WEBGL_depth_texture',\n 'EXT_texture_filter_anisotropic',\n 'EXT_shader_texture_lod',\n 'WEBGL_draw_buffers',\n 'EXT_frag_depth',\n 'EXT_sRGB',\n 'ANGLE_instanced_arrays'\n];\n\nvar PARAMETER_NAMES = [\n 'MAX_TEXTURE_SIZE',\n 'MAX_CUBE_MAP_TEXTURE_SIZE'\n];\n\nfunction GLInfo(_gl) {\n var extensions = {};\n var parameters = {};\n\n // Get webgl extension\n for (var i = 0; i < EXTENSION_LIST.length; i++) {\n var extName = EXTENSION_LIST[i];\n createExtension(extName);\n }\n // Get parameters\n for (var i = 0; i < PARAMETER_NAMES.length; i++) {\n var name = PARAMETER_NAMES[i];\n parameters[name] = _gl.getParameter(_gl[name]);\n }\n\n this.getExtension = function (name) {\n if (!(name in extensions)) {\n createExtension(name);\n }\n return extensions[name];\n };\n\n this.getParameter = function (name) {\n return parameters[name];\n };\n\n function createExtension(name) {\n if (_gl.getExtension) {\n var ext = _gl.getExtension(name);\n if (!ext) {\n ext = _gl.getExtension('MOZ_' + name);\n }\n if (!ext) {\n ext = _gl.getExtension('WEBKIT_' + name);\n }\n extensions[name] = ext;\n }\n }\n}\n\nexport default GLInfo;\n","/**\n * @namespace clay.core.glenum\n * @see http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14\n */\nexport default {\n /* ClearBufferMask */\n DEPTH_BUFFER_BIT : 0x00000100,\n STENCIL_BUFFER_BIT : 0x00000400,\n COLOR_BUFFER_BIT : 0x00004000,\n\n /* BeginMode */\n POINTS : 0x0000,\n LINES : 0x0001,\n LINE_LOOP : 0x0002,\n LINE_STRIP : 0x0003,\n TRIANGLES : 0x0004,\n TRIANGLE_STRIP : 0x0005,\n TRIANGLE_FAN : 0x0006,\n\n /* AlphaFunction (not supported in ES20) */\n /* NEVER */\n /* LESS */\n /* EQUAL */\n /* LEQUAL */\n /* GREATER */\n /* NOTEQUAL */\n /* GEQUAL */\n /* ALWAYS */\n\n /* BlendingFactorDest */\n ZERO : 0,\n ONE : 1,\n SRC_COLOR : 0x0300,\n ONE_MINUS_SRC_COLOR : 0x0301,\n SRC_ALPHA : 0x0302,\n ONE_MINUS_SRC_ALPHA : 0x0303,\n DST_ALPHA : 0x0304,\n ONE_MINUS_DST_ALPHA : 0x0305,\n\n /* BlendingFactorSrc */\n /* ZERO */\n /* ONE */\n DST_COLOR : 0x0306,\n ONE_MINUS_DST_COLOR : 0x0307,\n SRC_ALPHA_SATURATE : 0x0308,\n /* SRC_ALPHA */\n /* ONE_MINUS_SRC_ALPHA */\n /* DST_ALPHA */\n /* ONE_MINUS_DST_ALPHA */\n\n /* BlendEquationSeparate */\n FUNC_ADD : 0x8006,\n BLEND_EQUATION : 0x8009,\n BLEND_EQUATION_RGB : 0x8009, /* same as BLEND_EQUATION */\n BLEND_EQUATION_ALPHA : 0x883D,\n\n /* BlendSubtract */\n FUNC_SUBTRACT : 0x800A,\n FUNC_REVERSE_SUBTRACT : 0x800B,\n\n /* Separate Blend Functions */\n BLEND_DST_RGB : 0x80C8,\n BLEND_SRC_RGB : 0x80C9,\n BLEND_DST_ALPHA : 0x80CA,\n BLEND_SRC_ALPHA : 0x80CB,\n CONSTANT_COLOR : 0x8001,\n ONE_MINUS_CONSTANT_COLOR : 0x8002,\n CONSTANT_ALPHA : 0x8003,\n ONE_MINUS_CONSTANT_ALPHA : 0x8004,\n BLEND_COLOR : 0x8005,\n\n /* Buffer Objects */\n ARRAY_BUFFER : 0x8892,\n ELEMENT_ARRAY_BUFFER : 0x8893,\n ARRAY_BUFFER_BINDING : 0x8894,\n ELEMENT_ARRAY_BUFFER_BINDING : 0x8895,\n\n STREAM_DRAW : 0x88E0,\n STATIC_DRAW : 0x88E4,\n DYNAMIC_DRAW : 0x88E8,\n\n BUFFER_SIZE : 0x8764,\n BUFFER_USAGE : 0x8765,\n\n CURRENT_VERTEX_ATTRIB : 0x8626,\n\n /* CullFaceMode */\n FRONT : 0x0404,\n BACK : 0x0405,\n FRONT_AND_BACK : 0x0408,\n\n /* DepthFunction */\n /* NEVER */\n /* LESS */\n /* EQUAL */\n /* LEQUAL */\n /* GREATER */\n /* NOTEQUAL */\n /* GEQUAL */\n /* ALWAYS */\n\n /* EnableCap */\n /* TEXTURE_2D */\n CULL_FACE : 0x0B44,\n BLEND : 0x0BE2,\n DITHER : 0x0BD0,\n STENCIL_TEST : 0x0B90,\n DEPTH_TEST : 0x0B71,\n SCISSOR_TEST : 0x0C11,\n POLYGON_OFFSET_FILL : 0x8037,\n SAMPLE_ALPHA_TO_COVERAGE : 0x809E,\n SAMPLE_COVERAGE : 0x80A0,\n\n /* ErrorCode */\n NO_ERROR : 0,\n INVALID_ENUM : 0x0500,\n INVALID_VALUE : 0x0501,\n INVALID_OPERATION : 0x0502,\n OUT_OF_MEMORY : 0x0505,\n\n /* FrontFaceDirection */\n CW : 0x0900,\n CCW : 0x0901,\n\n /* GetPName */\n LINE_WIDTH : 0x0B21,\n ALIASED_POINT_SIZE_RANGE : 0x846D,\n ALIASED_LINE_WIDTH_RANGE : 0x846E,\n CULL_FACE_MODE : 0x0B45,\n FRONT_FACE : 0x0B46,\n DEPTH_RANGE : 0x0B70,\n DEPTH_WRITEMASK : 0x0B72,\n DEPTH_CLEAR_VALUE : 0x0B73,\n DEPTH_FUNC : 0x0B74,\n STENCIL_CLEAR_VALUE : 0x0B91,\n STENCIL_FUNC : 0x0B92,\n STENCIL_FAIL : 0x0B94,\n STENCIL_PASS_DEPTH_FAIL : 0x0B95,\n STENCIL_PASS_DEPTH_PASS : 0x0B96,\n STENCIL_REF : 0x0B97,\n STENCIL_VALUE_MASK : 0x0B93,\n STENCIL_WRITEMASK : 0x0B98,\n STENCIL_BACK_FUNC : 0x8800,\n STENCIL_BACK_FAIL : 0x8801,\n STENCIL_BACK_PASS_DEPTH_FAIL : 0x8802,\n STENCIL_BACK_PASS_DEPTH_PASS : 0x8803,\n STENCIL_BACK_REF : 0x8CA3,\n STENCIL_BACK_VALUE_MASK : 0x8CA4,\n STENCIL_BACK_WRITEMASK : 0x8CA5,\n VIEWPORT : 0x0BA2,\n SCISSOR_BOX : 0x0C10,\n /* SCISSOR_TEST */\n COLOR_CLEAR_VALUE : 0x0C22,\n COLOR_WRITEMASK : 0x0C23,\n UNPACK_ALIGNMENT : 0x0CF5,\n PACK_ALIGNMENT : 0x0D05,\n MAX_TEXTURE_SIZE : 0x0D33,\n MAX_VIEWPORT_DIMS : 0x0D3A,\n SUBPIXEL_BITS : 0x0D50,\n RED_BITS : 0x0D52,\n GREEN_BITS : 0x0D53,\n BLUE_BITS : 0x0D54,\n ALPHA_BITS : 0x0D55,\n DEPTH_BITS : 0x0D56,\n STENCIL_BITS : 0x0D57,\n POLYGON_OFFSET_UNITS : 0x2A00,\n /* POLYGON_OFFSET_FILL */\n POLYGON_OFFSET_FACTOR : 0x8038,\n TEXTURE_BINDING_2D : 0x8069,\n SAMPLE_BUFFERS : 0x80A8,\n SAMPLES : 0x80A9,\n SAMPLE_COVERAGE_VALUE : 0x80AA,\n SAMPLE_COVERAGE_INVERT : 0x80AB,\n\n /* GetTextureParameter */\n /* TEXTURE_MAG_FILTER */\n /* TEXTURE_MIN_FILTER */\n /* TEXTURE_WRAP_S */\n /* TEXTURE_WRAP_T */\n\n COMPRESSED_TEXTURE_FORMATS : 0x86A3,\n\n /* HintMode */\n DONT_CARE : 0x1100,\n FASTEST : 0x1101,\n NICEST : 0x1102,\n\n /* HintTarget */\n GENERATE_MIPMAP_HINT : 0x8192,\n\n /* DataType */\n BYTE : 0x1400,\n UNSIGNED_BYTE : 0x1401,\n SHORT : 0x1402,\n UNSIGNED_SHORT : 0x1403,\n INT : 0x1404,\n UNSIGNED_INT : 0x1405,\n FLOAT : 0x1406,\n\n /* PixelFormat */\n DEPTH_COMPONENT : 0x1902,\n ALPHA : 0x1906,\n RGB : 0x1907,\n RGBA : 0x1908,\n LUMINANCE : 0x1909,\n LUMINANCE_ALPHA : 0x190A,\n\n /* PixelType */\n /* UNSIGNED_BYTE */\n UNSIGNED_SHORT_4_4_4_4 : 0x8033,\n UNSIGNED_SHORT_5_5_5_1 : 0x8034,\n UNSIGNED_SHORT_5_6_5 : 0x8363,\n\n /* Shaders */\n FRAGMENT_SHADER : 0x8B30,\n VERTEX_SHADER : 0x8B31,\n MAX_VERTEX_ATTRIBS : 0x8869,\n MAX_VERTEX_UNIFORM_VECTORS : 0x8DFB,\n MAX_VARYING_VECTORS : 0x8DFC,\n MAX_COMBINED_TEXTURE_IMAGE_UNITS : 0x8B4D,\n MAX_VERTEX_TEXTURE_IMAGE_UNITS : 0x8B4C,\n MAX_TEXTURE_IMAGE_UNITS : 0x8872,\n MAX_FRAGMENT_UNIFORM_VECTORS : 0x8DFD,\n SHADER_TYPE : 0x8B4F,\n DELETE_STATUS : 0x8B80,\n LINK_STATUS : 0x8B82,\n VALIDATE_STATUS : 0x8B83,\n ATTACHED_SHADERS : 0x8B85,\n ACTIVE_UNIFORMS : 0x8B86,\n ACTIVE_ATTRIBUTES : 0x8B89,\n SHADING_LANGUAGE_VERSION : 0x8B8C,\n CURRENT_PROGRAM : 0x8B8D,\n\n /* StencilFunction */\n NEVER : 0x0200,\n LESS : 0x0201,\n EQUAL : 0x0202,\n LEQUAL : 0x0203,\n GREATER : 0x0204,\n NOTEQUAL : 0x0205,\n GEQUAL : 0x0206,\n ALWAYS : 0x0207,\n\n /* StencilOp */\n /* ZERO */\n KEEP : 0x1E00,\n REPLACE : 0x1E01,\n INCR : 0x1E02,\n DECR : 0x1E03,\n INVERT : 0x150A,\n INCR_WRAP : 0x8507,\n DECR_WRAP : 0x8508,\n\n /* StringName */\n VENDOR : 0x1F00,\n RENDERER : 0x1F01,\n VERSION : 0x1F02,\n\n /* TextureMagFilter */\n NEAREST : 0x2600,\n LINEAR : 0x2601,\n\n /* TextureMinFilter */\n /* NEAREST */\n /* LINEAR */\n NEAREST_MIPMAP_NEAREST : 0x2700,\n LINEAR_MIPMAP_NEAREST : 0x2701,\n NEAREST_MIPMAP_LINEAR : 0x2702,\n LINEAR_MIPMAP_LINEAR : 0x2703,\n\n /* TextureParameterName */\n TEXTURE_MAG_FILTER : 0x2800,\n TEXTURE_MIN_FILTER : 0x2801,\n TEXTURE_WRAP_S : 0x2802,\n TEXTURE_WRAP_T : 0x2803,\n\n /* TextureTarget */\n TEXTURE_2D : 0x0DE1,\n TEXTURE : 0x1702,\n\n TEXTURE_CUBE_MAP : 0x8513,\n TEXTURE_BINDING_CUBE_MAP : 0x8514,\n TEXTURE_CUBE_MAP_POSITIVE_X : 0x8515,\n TEXTURE_CUBE_MAP_NEGATIVE_X : 0x8516,\n TEXTURE_CUBE_MAP_POSITIVE_Y : 0x8517,\n TEXTURE_CUBE_MAP_NEGATIVE_Y : 0x8518,\n TEXTURE_CUBE_MAP_POSITIVE_Z : 0x8519,\n TEXTURE_CUBE_MAP_NEGATIVE_Z : 0x851A,\n MAX_CUBE_MAP_TEXTURE_SIZE : 0x851C,\n\n /* TextureUnit */\n TEXTURE0 : 0x84C0,\n TEXTURE1 : 0x84C1,\n TEXTURE2 : 0x84C2,\n TEXTURE3 : 0x84C3,\n TEXTURE4 : 0x84C4,\n TEXTURE5 : 0x84C5,\n TEXTURE6 : 0x84C6,\n TEXTURE7 : 0x84C7,\n TEXTURE8 : 0x84C8,\n TEXTURE9 : 0x84C9,\n TEXTURE10 : 0x84CA,\n TEXTURE11 : 0x84CB,\n TEXTURE12 : 0x84CC,\n TEXTURE13 : 0x84CD,\n TEXTURE14 : 0x84CE,\n TEXTURE15 : 0x84CF,\n TEXTURE16 : 0x84D0,\n TEXTURE17 : 0x84D1,\n TEXTURE18 : 0x84D2,\n TEXTURE19 : 0x84D3,\n TEXTURE20 : 0x84D4,\n TEXTURE21 : 0x84D5,\n TEXTURE22 : 0x84D6,\n TEXTURE23 : 0x84D7,\n TEXTURE24 : 0x84D8,\n TEXTURE25 : 0x84D9,\n TEXTURE26 : 0x84DA,\n TEXTURE27 : 0x84DB,\n TEXTURE28 : 0x84DC,\n TEXTURE29 : 0x84DD,\n TEXTURE30 : 0x84DE,\n TEXTURE31 : 0x84DF,\n ACTIVE_TEXTURE : 0x84E0,\n\n /* TextureWrapMode */\n REPEAT : 0x2901,\n CLAMP_TO_EDGE : 0x812F,\n MIRRORED_REPEAT : 0x8370,\n\n /* Uniform Types */\n FLOAT_VEC2 : 0x8B50,\n FLOAT_VEC3 : 0x8B51,\n FLOAT_VEC4 : 0x8B52,\n INT_VEC2 : 0x8B53,\n INT_VEC3 : 0x8B54,\n INT_VEC4 : 0x8B55,\n BOOL : 0x8B56,\n BOOL_VEC2 : 0x8B57,\n BOOL_VEC3 : 0x8B58,\n BOOL_VEC4 : 0x8B59,\n FLOAT_MAT2 : 0x8B5A,\n FLOAT_MAT3 : 0x8B5B,\n FLOAT_MAT4 : 0x8B5C,\n SAMPLER_2D : 0x8B5E,\n SAMPLER_CUBE : 0x8B60,\n\n /* Vertex Arrays */\n VERTEX_ATTRIB_ARRAY_ENABLED : 0x8622,\n VERTEX_ATTRIB_ARRAY_SIZE : 0x8623,\n VERTEX_ATTRIB_ARRAY_STRIDE : 0x8624,\n VERTEX_ATTRIB_ARRAY_TYPE : 0x8625,\n VERTEX_ATTRIB_ARRAY_NORMALIZED : 0x886A,\n VERTEX_ATTRIB_ARRAY_POINTER : 0x8645,\n VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F,\n\n /* Shader Source */\n COMPILE_STATUS : 0x8B81,\n\n /* Shader Precision-Specified Types */\n LOW_FLOAT : 0x8DF0,\n MEDIUM_FLOAT : 0x8DF1,\n HIGH_FLOAT : 0x8DF2,\n LOW_INT : 0x8DF3,\n MEDIUM_INT : 0x8DF4,\n HIGH_INT : 0x8DF5,\n\n /* Framebuffer Object. */\n FRAMEBUFFER : 0x8D40,\n RENDERBUFFER : 0x8D41,\n\n RGBA4 : 0x8056,\n RGB5_A1 : 0x8057,\n RGB565 : 0x8D62,\n DEPTH_COMPONENT16 : 0x81A5,\n STENCIL_INDEX : 0x1901,\n STENCIL_INDEX8 : 0x8D48,\n DEPTH_STENCIL : 0x84F9,\n\n RENDERBUFFER_WIDTH : 0x8D42,\n RENDERBUFFER_HEIGHT : 0x8D43,\n RENDERBUFFER_INTERNAL_FORMAT : 0x8D44,\n RENDERBUFFER_RED_SIZE : 0x8D50,\n RENDERBUFFER_GREEN_SIZE : 0x8D51,\n RENDERBUFFER_BLUE_SIZE : 0x8D52,\n RENDERBUFFER_ALPHA_SIZE : 0x8D53,\n RENDERBUFFER_DEPTH_SIZE : 0x8D54,\n RENDERBUFFER_STENCIL_SIZE : 0x8D55,\n\n FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE : 0x8CD0,\n FRAMEBUFFER_ATTACHMENT_OBJECT_NAME : 0x8CD1,\n FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL : 0x8CD2,\n FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE : 0x8CD3,\n\n COLOR_ATTACHMENT0 : 0x8CE0,\n DEPTH_ATTACHMENT : 0x8D00,\n STENCIL_ATTACHMENT : 0x8D20,\n DEPTH_STENCIL_ATTACHMENT : 0x821A,\n\n NONE : 0,\n\n FRAMEBUFFER_COMPLETE : 0x8CD5,\n FRAMEBUFFER_INCOMPLETE_ATTACHMENT : 0x8CD6,\n FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : 0x8CD7,\n FRAMEBUFFER_INCOMPLETE_DIMENSIONS : 0x8CD9,\n FRAMEBUFFER_UNSUPPORTED : 0x8CDD,\n\n FRAMEBUFFER_BINDING : 0x8CA6,\n RENDERBUFFER_BINDING : 0x8CA7,\n MAX_RENDERBUFFER_SIZE : 0x84E8,\n\n INVALID_FRAMEBUFFER_OPERATION : 0x0506,\n\n /* WebGL-specific enums */\n UNPACK_FLIP_Y_WEBGL : 0x9240,\n UNPACK_PREMULTIPLY_ALPHA_WEBGL : 0x9241,\n CONTEXT_LOST_WEBGL : 0x9242,\n UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243,\n BROWSER_DEFAULT_WEBGL : 0x9244,\n};\n","function get(options) {\n\n var xhr = new XMLHttpRequest();\n\n xhr.open('get', options.url);\n // With response type set browser can get and put binary data\n // https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Sending_and_Receiving_Binary_Data\n // Default is text, and it can be set\n // arraybuffer, blob, document, json, text\n xhr.responseType = options.responseType || 'text';\n\n if (options.onprogress) {\n //https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest\n xhr.onprogress = function(e) {\n if (e.lengthComputable) {\n var percent = e.loaded / e.total;\n options.onprogress(percent, e.loaded, e.total);\n }\n else {\n options.onprogress(null);\n }\n };\n }\n xhr.onload = function(e) {\n if (xhr.status >= 400) {\n options.onerror && options.onerror();\n }\n else {\n options.onload && options.onload(xhr.response);\n }\n };\n if (options.onerror) {\n xhr.onerror = options.onerror;\n }\n xhr.send(null);\n}\n\nexport default {\n get: get\n};\n","import request from './request';\n\nvar supportWebGL;\n\nvar vendor = {};\n\n/**\n * If support WebGL\n * @return {boolean}\n */\nvendor.supportWebGL = function () {\n if (supportWebGL == null) {\n try {\n var canvas = document.createElement('canvas');\n var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');\n if (!gl) {\n throw new Error();\n }\n }\n catch (e) {\n supportWebGL = false;\n }\n\n }\n return supportWebGL;\n};\n\nvendor.Int8Array = typeof Int8Array === 'undefined' ? Array : Int8Array;\n\nvendor.Uint8Array = typeof Uint8Array === 'undefined' ? Array : Uint8Array;\n\nvendor.Uint16Array = typeof Uint16Array === 'undefined' ? Array : Uint16Array;\n\nvendor.Uint32Array = typeof Uint32Array === 'undefined' ? Array : Uint32Array;\n\nvendor.Int16Array = typeof Int16Array === 'undefined' ? Array : Int16Array;\n\nvendor.Float32Array = typeof Float32Array === 'undefined' ? Array : Float32Array;\n\nvendor.Float64Array = typeof Float64Array === 'undefined' ? Array : Float64Array;\n\nvar g = {};\nif (typeof window !== 'undefined') {\n g = window;\n}\nelse if (typeof global !== 'undefined') {\n g = global;\n}\n\n\nvendor.requestAnimationFrame = g.requestAnimationFrame\n || g.msRequestAnimationFrame\n || g.mozRequestAnimationFrame\n || g.webkitRequestAnimationFrame\n || function (func){ setTimeout(func, 16); };\n\nvendor.createCanvas = function () {\n return document.createElement('canvas');\n};\n\nvendor.createImage = function () {\n return new g.Image();\n};\n\nvendor.request = {\n get: request.get\n};\n\nvendor.addEventListener = function (dom, type, func, useCapture) {\n dom.addEventListener(type, func, useCapture);\n};\n\nvendor.removeEventListener = function (dom, type, func) {\n dom.removeEventListener(type, func);\n};\n\nexport default vendor;\n","/**\n * Simple double linked list. Compared with array, it has O(1) remove operation.\n * @constructor\n * @alias clay.core.LinkedList\n */\nvar LinkedList = function () {\n\n /**\n * @type {clay.core.LinkedList.Entry}\n */\n this.head = null;\n\n /**\n * @type {clay.core.LinkedList.Entry}\n */\n this.tail = null;\n\n this._length = 0;\n};\n\n/**\n * Insert a new value at the tail\n * @param {} val\n * @return {clay.core.LinkedList.Entry}\n */\nLinkedList.prototype.insert = function (val) {\n var entry = new LinkedList.Entry(val);\n this.insertEntry(entry);\n return entry;\n};\n\n/**\n * Insert a new value at idx\n * @param {number} idx\n * @param {} val\n * @return {clay.core.LinkedList.Entry}\n */\nLinkedList.prototype.insertAt = function (idx, val) {\n if (idx < 0) {\n return;\n }\n var next = this.head;\n var cursor = 0;\n while (next && cursor != idx) {\n next = next.next;\n cursor++;\n }\n if (next) {\n var entry = new LinkedList.Entry(val);\n var prev = next.prev;\n if (!prev) { //next is head\n this.head = entry;\n }\n else {\n prev.next = entry;\n entry.prev = prev;\n }\n entry.next = next;\n next.prev = entry;\n }\n else {\n this.insert(val);\n }\n};\n\nLinkedList.prototype.insertBeforeEntry = function (val, next) {\n var entry = new LinkedList.Entry(val);\n var prev = next.prev;\n if (!prev) { //next is head\n this.head = entry;\n }\n else {\n prev.next = entry;\n entry.prev = prev;\n }\n entry.next = next;\n next.prev = entry;\n\n this._length++;\n};\n\n/**\n * Insert an entry at the tail\n * @param {clay.core.LinkedList.Entry} entry\n */\nLinkedList.prototype.insertEntry = function (entry) {\n if (!this.head) {\n this.head = this.tail = entry;\n }\n else {\n this.tail.next = entry;\n entry.prev = this.tail;\n this.tail = entry;\n }\n this._length++;\n};\n\n/**\n * Remove entry.\n * @param {clay.core.LinkedList.Entry} entry\n */\nLinkedList.prototype.remove = function (entry) {\n var prev = entry.prev;\n var next = entry.next;\n if (prev) {\n prev.next = next;\n }\n else {\n // Is head\n this.head = next;\n }\n if (next) {\n next.prev = prev;\n }\n else {\n // Is tail\n this.tail = prev;\n }\n entry.next = entry.prev = null;\n this._length--;\n};\n\n/**\n * Remove entry at index.\n * @param {number} idx\n * @return {}\n */\nLinkedList.prototype.removeAt = function (idx) {\n if (idx < 0) {\n return;\n }\n var curr = this.head;\n var cursor = 0;\n while (curr && cursor != idx) {\n curr = curr.next;\n cursor++;\n }\n if (curr) {\n this.remove(curr);\n return curr.value;\n }\n};\n/**\n * Get head value\n * @return {}\n */\nLinkedList.prototype.getHead = function () {\n if (this.head) {\n return this.head.value;\n }\n};\n/**\n * Get tail value\n * @return {}\n */\nLinkedList.prototype.getTail = function () {\n if (this.tail) {\n return this.tail.value;\n }\n};\n/**\n * Get value at idx\n * @param {number} idx\n * @return {}\n */\nLinkedList.prototype.getAt = function (idx) {\n if (idx < 0) {\n return;\n }\n var curr = this.head;\n var cursor = 0;\n while (curr && cursor != idx) {\n curr = curr.next;\n cursor++;\n }\n return curr.value;\n};\n\n/**\n * @param {} value\n * @return {number}\n */\nLinkedList.prototype.indexOf = function (value) {\n var curr = this.head;\n var cursor = 0;\n while (curr) {\n if (curr.value === value) {\n return cursor;\n }\n curr = curr.next;\n cursor++;\n }\n};\n\n/**\n * @return {number}\n */\nLinkedList.prototype.length = function () {\n return this._length;\n};\n\n/**\n * If list is empty\n */\nLinkedList.prototype.isEmpty = function () {\n return this._length === 0;\n};\n\n/**\n * @param {Function} cb\n * @param {} context\n */\nLinkedList.prototype.forEach = function (cb, context) {\n var curr = this.head;\n var idx = 0;\n var haveContext = typeof(context) != 'undefined';\n while (curr) {\n if (haveContext) {\n cb.call(context, curr.value, idx);\n }\n else {\n cb(curr.value, idx);\n }\n curr = curr.next;\n idx++;\n }\n};\n\n/**\n * Clear the list\n */\nLinkedList.prototype.clear = function () {\n this.tail = this.head = null;\n this._length = 0;\n};\n\n/**\n * @constructor\n * @param {} val\n */\nLinkedList.Entry = function (val) {\n /**\n * @type {}\n */\n this.value = val;\n\n /**\n * @type {clay.core.LinkedList.Entry}\n */\n this.next = null;\n\n /**\n * @type {clay.core.LinkedList.Entry}\n */\n this.prev = null;\n};\n\nexport default LinkedList;\n","import LinkedList from './LinkedList';\n\n/**\n * LRU Cache\n * @constructor\n * @alias clay.core.LRU\n */\nvar LRU = function (maxSize) {\n\n this._list = new LinkedList();\n\n this._map = {};\n\n this._maxSize = maxSize || 10;\n};\n\n/**\n * Set cache max size\n * @param {number} size\n */\nLRU.prototype.setMaxSize = function (size) {\n this._maxSize = size;\n};\n\n/**\n * @param {string} key\n * @param {} value\n */\nLRU.prototype.put = function (key, value) {\n if (!this._map.hasOwnProperty(key)) {\n var len = this._list.length();\n if (len >= this._maxSize && len > 0) {\n // Remove the least recently used\n var leastUsedEntry = this._list.head;\n this._list.remove(leastUsedEntry);\n delete this._map[leastUsedEntry.key];\n }\n\n var entry = this._list.insert(value);\n entry.key = key;\n this._map[key] = entry;\n }\n};\n\n/**\n * @param {string} key\n * @return {}\n */\nLRU.prototype.get = function (key) {\n var entry = this._map[key];\n if (this._map.hasOwnProperty(key)) {\n // Put the latest used entry in the tail\n if (entry !== this._list.tail) {\n this._list.remove(entry);\n this._list.insertEntry(entry);\n }\n\n return entry.value;\n }\n};\n\n/**\n * @param {string} key\n */\nLRU.prototype.remove = function (key) {\n var entry = this._map[key];\n if (typeof(entry) !== 'undefined') {\n delete this._map[key];\n this._list.remove(entry);\n }\n};\n\n/**\n * Clear the cache\n */\nLRU.prototype.clear = function () {\n this._list.clear();\n this._map = {};\n};\n\nexport default LRU;\n","/**\n * @namespace clay.core.color\n */\nimport LRU from '../core/LRU';\n\nvar colorUtil = {};\n\nvar kCSSColorTable = {\n 'transparent': [0,0,0,0], 'aliceblue': [240,248,255,1],\n 'antiquewhite': [250,235,215,1], 'aqua': [0,255,255,1],\n 'aquamarine': [127,255,212,1], 'azure': [240,255,255,1],\n 'beige': [245,245,220,1], 'bisque': [255,228,196,1],\n 'black': [0,0,0,1], 'blanchedalmond': [255,235,205,1],\n 'blue': [0,0,255,1], 'blueviolet': [138,43,226,1],\n 'brown': [165,42,42,1], 'burlywood': [222,184,135,1],\n 'cadetblue': [95,158,160,1], 'chartreuse': [127,255,0,1],\n 'chocolate': [210,105,30,1], 'coral': [255,127,80,1],\n 'cornflowerblue': [100,149,237,1], 'cornsilk': [255,248,220,1],\n 'crimson': [220,20,60,1], 'cyan': [0,255,255,1],\n 'darkblue': [0,0,139,1], 'darkcyan': [0,139,139,1],\n 'darkgoldenrod': [184,134,11,1], 'darkgray': [169,169,169,1],\n 'darkgreen': [0,100,0,1], 'darkgrey': [169,169,169,1],\n 'darkkhaki': [189,183,107,1], 'darkmagenta': [139,0,139,1],\n 'darkolivegreen': [85,107,47,1], 'darkorange': [255,140,0,1],\n 'darkorchid': [153,50,204,1], 'darkred': [139,0,0,1],\n 'darksalmon': [233,150,122,1], 'darkseagreen': [143,188,143,1],\n 'darkslateblue': [72,61,139,1], 'darkslategray': [47,79,79,1],\n 'darkslategrey': [47,79,79,1], 'darkturquoise': [0,206,209,1],\n 'darkviolet': [148,0,211,1], 'deeppink': [255,20,147,1],\n 'deepskyblue': [0,191,255,1], 'dimgray': [105,105,105,1],\n 'dimgrey': [105,105,105,1], 'dodgerblue': [30,144,255,1],\n 'firebrick': [178,34,34,1], 'floralwhite': [255,250,240,1],\n 'forestgreen': [34,139,34,1], 'fuchsia': [255,0,255,1],\n 'gainsboro': [220,220,220,1], 'ghostwhite': [248,248,255,1],\n 'gold': [255,215,0,1], 'goldenrod': [218,165,32,1],\n 'gray': [128,128,128,1], 'green': [0,128,0,1],\n 'greenyellow': [173,255,47,1], 'grey': [128,128,128,1],\n 'honeydew': [240,255,240,1], 'hotpink': [255,105,180,1],\n 'indianred': [205,92,92,1], 'indigo': [75,0,130,1],\n 'ivory': [255,255,240,1], 'khaki': [240,230,140,1],\n 'lavender': [230,230,250,1], 'lavenderblush': [255,240,245,1],\n 'lawngreen': [124,252,0,1], 'lemonchiffon': [255,250,205,1],\n 'lightblue': [173,216,230,1], 'lightcoral': [240,128,128,1],\n 'lightcyan': [224,255,255,1], 'lightgoldenrodyellow': [250,250,210,1],\n 'lightgray': [211,211,211,1], 'lightgreen': [144,238,144,1],\n 'lightgrey': [211,211,211,1], 'lightpink': [255,182,193,1],\n 'lightsalmon': [255,160,122,1], 'lightseagreen': [32,178,170,1],\n 'lightskyblue': [135,206,250,1], 'lightslategray': [119,136,153,1],\n 'lightslategrey': [119,136,153,1], 'lightsteelblue': [176,196,222,1],\n 'lightyellow': [255,255,224,1], 'lime': [0,255,0,1],\n 'limegreen': [50,205,50,1], 'linen': [250,240,230,1],\n 'magenta': [255,0,255,1], 'maroon': [128,0,0,1],\n 'mediumaquamarine': [102,205,170,1], 'mediumblue': [0,0,205,1],\n 'mediumorchid': [186,85,211,1], 'mediumpurple': [147,112,219,1],\n 'mediumseagreen': [60,179,113,1], 'mediumslateblue': [123,104,238,1],\n 'mediumspringgreen': [0,250,154,1], 'mediumturquoise': [72,209,204,1],\n 'mediumvioletred': [199,21,133,1], 'midnightblue': [25,25,112,1],\n 'mintcream': [245,255,250,1], 'mistyrose': [255,228,225,1],\n 'moccasin': [255,228,181,1], 'navajowhite': [255,222,173,1],\n 'navy': [0,0,128,1], 'oldlace': [253,245,230,1],\n 'olive': [128,128,0,1], 'olivedrab': [107,142,35,1],\n 'orange': [255,165,0,1], 'orangered': [255,69,0,1],\n 'orchid': [218,112,214,1], 'palegoldenrod': [238,232,170,1],\n 'palegreen': [152,251,152,1], 'paleturquoise': [175,238,238,1],\n 'palevioletred': [219,112,147,1], 'papayawhip': [255,239,213,1],\n 'peachpuff': [255,218,185,1], 'peru': [205,133,63,1],\n 'pink': [255,192,203,1], 'plum': [221,160,221,1],\n 'powderblue': [176,224,230,1], 'purple': [128,0,128,1],\n 'red': [255,0,0,1], 'rosybrown': [188,143,143,1],\n 'royalblue': [65,105,225,1], 'saddlebrown': [139,69,19,1],\n 'salmon': [250,128,114,1], 'sandybrown': [244,164,96,1],\n 'seagreen': [46,139,87,1], 'seashell': [255,245,238,1],\n 'sienna': [160,82,45,1], 'silver': [192,192,192,1],\n 'skyblue': [135,206,235,1], 'slateblue': [106,90,205,1],\n 'slategray': [112,128,144,1], 'slategrey': [112,128,144,1],\n 'snow': [255,250,250,1], 'springgreen': [0,255,127,1],\n 'steelblue': [70,130,180,1], 'tan': [210,180,140,1],\n 'teal': [0,128,128,1], 'thistle': [216,191,216,1],\n 'tomato': [255,99,71,1], 'turquoise': [64,224,208,1],\n 'violet': [238,130,238,1], 'wheat': [245,222,179,1],\n 'white': [255,255,255,1], 'whitesmoke': [245,245,245,1],\n 'yellow': [255,255,0,1], 'yellowgreen': [154,205,50,1]\n};\n\nfunction clampCssByte(i) { // Clamp to integer 0 .. 255.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\n\nfunction clampCssAngle(i) { // Clamp to integer 0 .. 360.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 360 ? 360 : i;\n}\n\nfunction clampCssFloat(f) { // Clamp to float 0.0 .. 1.0.\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\n\nfunction parseCssInt(str) { // int or percentage.\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssByte(parseFloat(str) / 100 * 255);\n }\n return clampCssByte(parseInt(str, 10));\n}\n\nfunction parseCssFloat(str) { // float or percentage.\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssFloat(parseFloat(str) / 100);\n }\n return clampCssFloat(parseFloat(str));\n}\n\nfunction cssHueToRgb(m1, m2, h) {\n if (h < 0) {\n h += 1;\n }\n else if (h > 1) {\n h -= 1;\n }\n\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n if (h * 2 < 1) {\n return m2;\n }\n if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2/3 - h) * 6;\n }\n return m1;\n}\n\nfunction lerpNumber(a, b, p) {\n return a + (b - a) * p;\n}\n\nfunction setRgba(out, r, g, b, a) {\n out[0] = r; out[1] = g; out[2] = b; out[3] = a;\n return out;\n}\nfunction copyRgba(out, a) {\n out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3];\n return out;\n}\n\nvar colorCache = new LRU(20);\nvar lastRemovedArr = null;\n\nfunction putToCache(colorStr, rgbaArr) {\n // Reuse removed array\n if (lastRemovedArr) {\n copyRgba(lastRemovedArr, rgbaArr);\n }\n lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice()));\n}\n\n/**\n * @name clay.core.color.parse\n * @param {string} colorStr\n * @param {Array.} out\n * @return {Array.}\n */\ncolorUtil.parse = function (colorStr, rgbaArr) {\n if (!colorStr) {\n return;\n }\n rgbaArr = rgbaArr || [];\n\n var cached = colorCache.get(colorStr);\n if (cached) {\n return copyRgba(rgbaArr, cached);\n }\n\n // colorStr may be not string\n colorStr = colorStr + '';\n // Remove all whitespace, not compliant, but should just be more accepting.\n var str = colorStr.replace(/ /g, '').toLowerCase();\n\n // Color keywords (and transparent) lookup.\n if (str in kCSSColorTable) {\n copyRgba(rgbaArr, kCSSColorTable[str]);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n\n // #abc and #abc123 syntax.\n if (str.charAt(0) === '#') {\n if (str.length === 4) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xfff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return; // Covers NaN.\n }\n setRgba(rgbaArr,\n ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),\n (iv & 0xf0) | ((iv & 0xf0) >> 4),\n (iv & 0xf) | ((iv & 0xf) << 4),\n 1\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n else if (str.length === 7) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xffffff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return; // Covers NaN.\n }\n setRgba(rgbaArr,\n (iv & 0xff0000) >> 16,\n (iv & 0xff00) >> 8,\n iv & 0xff,\n 1\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n\n return;\n }\n var op = str.indexOf('('), ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === str.length) {\n var fname = str.substr(0, op);\n var params = str.substr(op + 1, ep - (op + 1)).split(',');\n var alpha = 1; // To allow case fallthrough.\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n alpha = parseCssFloat(params.pop()); // jshint ignore:line\n // Fall through.\n case 'rgb':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n setRgba(rgbaArr,\n parseCssInt(params[0]),\n parseCssInt(params[1]),\n parseCssInt(params[2]),\n alpha\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsla':\n if (params.length !== 4) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n params[3] = parseCssFloat(params[3]);\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsl':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n default:\n return;\n }\n }\n\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n};\n\ncolorUtil.parseToFloat = function (colorStr, rgbaArr) {\n rgbaArr = colorUtil.parse(colorStr, rgbaArr);\n if (!rgbaArr) {\n return;\n }\n rgbaArr[0] /= 255;\n rgbaArr[1] /= 255;\n rgbaArr[2] /= 255;\n return rgbaArr;\n}\n\n/**\n * @name clay.core.color.hsla2rgba\n * @param {Array.} hsla\n * @param {Array.} rgba\n * @return {Array.} rgba\n */\nfunction hsla2rgba(hsla, rgba) {\n var h = (((parseFloat(hsla[0]) % 360) + 360) % 360) / 360; // 0 .. 1\n // NOTE(deanm): According to the CSS spec s/l should only be\n // percentages, but we don't bother and let float or percentage.\n var s = parseCssFloat(hsla[1]);\n var l = parseCssFloat(hsla[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n\n rgba = rgba || [];\n setRgba(rgba,\n clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255),\n clampCssByte(cssHueToRgb(m1, m2, h) * 255),\n clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255),\n 1\n );\n\n if (hsla.length === 4) {\n rgba[3] = hsla[3];\n }\n\n return rgba;\n}\n\n/**\n * @name clay.core.color.rgba2hsla\n * @param {Array.} rgba\n * @return {Array.} hsla\n */\nfunction rgba2hsla(rgba) {\n if (!rgba) {\n return;\n }\n\n // RGB from 0 to 255\n var R = rgba[0] / 255;\n var G = rgba[1] / 255;\n var B = rgba[2] / 255;\n\n var vMin = Math.min(R, G, B); // Min. value of RGB\n var vMax = Math.max(R, G, B); // Max. value of RGB\n var delta = vMax - vMin; // Delta RGB value\n\n var L = (vMax + vMin) / 2;\n var H;\n var S;\n // HSL results from 0 to 1\n if (delta === 0) {\n H = 0;\n S = 0;\n }\n else {\n if (L < 0.5) {\n S = delta / (vMax + vMin);\n }\n else {\n S = delta / (2 - vMax - vMin);\n }\n\n var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;\n var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;\n var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;\n\n if (R === vMax) {\n H = deltaB - deltaG;\n }\n else if (G === vMax) {\n H = (1 / 3) + deltaR - deltaB;\n }\n else if (B === vMax) {\n H = (2 / 3) + deltaG - deltaR;\n }\n\n if (H < 0) {\n H += 1;\n }\n\n if (H > 1) {\n H -= 1;\n }\n }\n\n var hsla = [H * 360, S, L];\n\n if (rgba[3] != null) {\n hsla.push(rgba[3]);\n }\n\n return hsla;\n}\n\n/**\n * @name clay.core.color.lift\n * @param {string} color\n * @param {number} level\n * @return {string}\n */\ncolorUtil.lift = function (color, level) {\n var colorArr = colorUtil.parse(color);\n if (colorArr) {\n for (var i = 0; i < 3; i++) {\n if (level < 0) {\n colorArr[i] = colorArr[i] * (1 - level) | 0;\n }\n else {\n colorArr[i] = ((255 - colorArr[i]) * level + colorArr[i]) | 0;\n }\n }\n return colorUtil.stringify(colorArr, colorArr.length === 4 ? 'rgba' : 'rgb');\n }\n}\n\n/**\n * @name clay.core.color.toHex\n * @param {string} color\n * @return {string}\n */\ncolorUtil.toHex = function (color) {\n var colorArr = colorUtil.parse(color);\n if (colorArr) {\n return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + (+colorArr[2])).toString(16).slice(1);\n }\n};\n\n/**\n * Map value to color. Faster than lerp methods because color is represented by rgba array.\n * @name clay.core.color\n * @param {number} normalizedValue A float between 0 and 1.\n * @param {Array.>} colors List of rgba color array\n * @param {Array.} [out] Mapped gba color array\n * @return {Array.} will be null/undefined if input illegal.\n */\ncolorUtil.fastLerp = function (normalizedValue, colors, out) {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)\n ) {\n return;\n }\n\n out = out || [];\n\n var value = normalizedValue * (colors.length - 1);\n var leftIndex = Math.floor(value);\n var rightIndex = Math.ceil(value);\n var leftColor = colors[leftIndex];\n var rightColor = colors[rightIndex];\n var dv = value - leftIndex;\n out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));\n out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));\n out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));\n out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));\n\n return out;\n}\n\ncolorUtil.fastMapToColor = colorUtil.fastLerp;\n\n/**\n * @param {number} normalizedValue A float between 0 and 1.\n * @param {Array.} colors Color list.\n * @param {boolean=} fullOutput Default false.\n * @return {(string|Object)} Result color. If fullOutput,\n * return {color: ..., leftIndex: ..., rightIndex: ..., value: ...},\n */\ncolorUtil.lerp = function (normalizedValue, colors, fullOutput) {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)\n ) {\n return;\n }\n\n var value = normalizedValue * (colors.length - 1);\n var leftIndex = Math.floor(value);\n var rightIndex = Math.ceil(value);\n var leftColor = colorUtil.parse(colors[leftIndex]);\n var rightColor = colorUtil.parse(colors[rightIndex]);\n var dv = value - leftIndex;\n\n var color = colorUtil.stringify(\n [\n clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)),\n clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)),\n clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)),\n clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))\n ],\n 'rgba'\n );\n\n return fullOutput\n ? {\n color: color,\n leftIndex: leftIndex,\n rightIndex: rightIndex,\n value: value\n }\n : color;\n}\n\n/**\n * @deprecated\n */\ncolorUtil.mapToColor = colorUtil.lerp;\n\n/**\n * @name clay.core.color\n * @param {string} color\n * @param {number=} h 0 ~ 360, ignore when null.\n * @param {number=} s 0 ~ 1, ignore when null.\n * @param {number=} l 0 ~ 1, ignore when null.\n * @return {string} Color string in rgba format.\n */\ncolorUtil.modifyHSL = function (color, h, s, l) {\n color = colorUtil.parse(color);\n\n if (color) {\n color = rgba2hsla(color);\n h != null && (color[0] = clampCssAngle(h));\n s != null && (color[1] = parseCssFloat(s));\n l != null && (color[2] = parseCssFloat(l));\n\n return colorUtil.stringify(hsla2rgba(color), 'rgba');\n }\n}\n\n/**\n * @param {string} color\n * @param {number=} alpha 0 ~ 1\n * @return {string} Color string in rgba format.\n */\ncolorUtil.modifyAlpha = function (color, alpha) {\n color = colorUtil.parse(color);\n\n if (color && alpha != null) {\n color[3] = clampCssFloat(alpha);\n return colorUtil.stringify(color, 'rgba');\n }\n}\n\n/**\n * @param {Array.} arrColor like [12,33,44,0.4]\n * @param {string} type 'rgba', 'hsva', ...\n * @return {string} Result color. (If input illegal, return undefined).\n */\ncolorUtil.stringify = function (arrColor, type) {\n if (!arrColor || !arrColor.length) {\n return;\n }\n var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2];\n if (type === 'rgba' || type === 'hsva' || type === 'hsla') {\n colorStr += ',' + arrColor[3];\n }\n return type + '(' + colorStr + ')';\n};\n\n\n\nexport default colorUtil;","import Base from './core/Base';\nimport util from './core/util';\nimport colorUtil from './core/color';\nvar parseColor = colorUtil.parseToFloat;\n\nvar programKeyCache = {};\n\nfunction getDefineCode(defines) {\n var defineKeys = Object.keys(defines);\n defineKeys.sort();\n var defineStr = [];\n // Custom Defines\n for (var i = 0; i < defineKeys.length; i++) {\n var key = defineKeys[i];\n var value = defines[key];\n if (value === null) {\n defineStr.push(key);\n }\n else{\n defineStr.push(key + ' ' + value.toString());\n }\n }\n return defineStr.join('\\n');\n}\n\nfunction getProgramKey(vertexDefines, fragmentDefines, enabledTextures) {\n enabledTextures.sort();\n var defineStr = [];\n for (var i = 0; i < enabledTextures.length; i++) {\n var symbol = enabledTextures[i];\n defineStr.push(symbol);\n }\n var key = getDefineCode(vertexDefines) + '\\n'\n + getDefineCode(fragmentDefines) + '\\n'\n + defineStr.join('\\n');\n\n if (programKeyCache[key]) {\n return programKeyCache[key];\n }\n\n var id = util.genGUID();\n programKeyCache[key] = id;\n return id;\n}\n\n/**\n * Material defines the appearance of mesh surface, like `color`, `roughness`, `metalness`, etc.\n * It contains a {@link clay.Shader} and corresponding uniforms.\n *\n * Here is a basic example to create a standard material\n```js\nvar material = new clay.Material({\n shader: new clay.Shader(\n clay.Shader.source('clay.vertex'),\n clay.Shader.source('clay.fragment')\n )\n});\n```\n * @constructor clay.Material\n * @extends clay.core.Base\n */\nvar Material = Base.extend(function () {\n return /** @lends clay.Material# */ {\n /**\n * @type {string}\n */\n name: '',\n\n /**\n * @type {Object}\n */\n // uniforms: null,\n\n /**\n * @type {clay.Shader}\n */\n // shader: null,\n\n /**\n * @type {boolean}\n */\n depthTest: true,\n\n /**\n * @type {boolean}\n */\n depthMask: true,\n\n /**\n * @type {boolean}\n */\n transparent: false,\n /**\n * Blend func is a callback function when the material\n * have custom blending\n * The gl context will be the only argument passed in tho the\n * blend function\n * Detail of blend function in WebGL:\n * http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf\n *\n * Example :\n * function(_gl) {\n * _gl.blendEquation(_gl.FUNC_ADD);\n * _gl.blendFunc(_gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA);\n * }\n */\n blend: null,\n\n /**\n * If update texture status automatically.\n */\n autoUpdateTextureStatus: true,\n\n uniforms: {},\n vertexDefines: {},\n fragmentDefines: {},\n _textureStatus: {},\n\n // shadowTransparentMap : null\n\n // PENDING enable the uniform that only used in shader.\n _enabledUniforms: null,\n };\n}, function () {\n if (!this.name) {\n this.name = 'MATERIAL_' + this.__uid__;\n }\n\n if (this.shader) {\n // Keep status, mainly preset uniforms, vertexDefines and fragmentDefines\n this.attachShader(this.shader, true);\n }\n},\n/** @lends clay.Material.prototype */\n{\n precision: 'highp',\n\n /**\n * Set material uniform\n * @example\n * mat.setUniform('color', [1, 1, 1, 1]);\n * @param {string} symbol\n * @param {number|array|clay.Texture|ArrayBufferView} value\n */\n setUniform: function (symbol, value) {\n if (value === undefined) {\n console.warn('Uniform value \"' + symbol + '\" is undefined');\n }\n var uniform = this.uniforms[symbol];\n if (uniform) {\n\n if (typeof value === 'string') {\n // Try to parse as a color. Invalid color string will return null.\n value = parseColor(value) || value;\n }\n\n uniform.value = value;\n\n if (this.autoUpdateTextureStatus && uniform.type === 't') {\n if (value) {\n this.enableTexture(symbol);\n }\n else {\n this.disableTexture(symbol);\n }\n }\n }\n },\n\n /**\n * @param {Object} obj\n */\n setUniforms: function(obj) {\n for (var key in obj) {\n var val = obj[key];\n this.setUniform(key, val);\n }\n },\n\n /**\n * @param {string} symbol\n * @return {boolean}\n */\n isUniformEnabled: function (symbol) {\n return this._enabledUniforms.indexOf(symbol) >= 0;\n },\n\n getEnabledUniforms: function () {\n return this._enabledUniforms;\n },\n getTextureUniforms: function () {\n return this._textureUniforms;\n },\n\n /**\n * Alias of setUniform and setUniforms\n * @param {object|string} symbol\n * @param {number|array|clay.Texture|ArrayBufferView} [value]\n */\n set: function (symbol, value) {\n if (typeof(symbol) === 'object') {\n for (var key in symbol) {\n var val = symbol[key];\n this.setUniform(key, val);\n }\n }\n else {\n this.setUniform(symbol, value);\n }\n },\n /**\n * Get uniform value\n * @param {string} symbol\n * @return {number|array|clay.Texture|ArrayBufferView}\n */\n get: function (symbol) {\n var uniform = this.uniforms[symbol];\n if (uniform) {\n return uniform.value;\n }\n },\n /**\n * Attach a shader instance\n * @param {clay.Shader} shader\n * @param {boolean} keepStatus If try to keep uniform and texture\n */\n attachShader: function(shader, keepStatus) {\n var originalUniforms = this.uniforms;\n\n // Ignore if uniform can use in shader.\n this.uniforms = shader.createUniforms();\n this.shader = shader;\n\n var uniforms = this.uniforms;\n this._enabledUniforms = Object.keys(uniforms);\n // Make sure uniforms are set in same order to avoid texture slot wrong\n this._enabledUniforms.sort();\n this._textureUniforms = this._enabledUniforms.filter(function (uniformName) {\n var type = this.uniforms[uniformName].type;\n return type === 't' || type === 'tv';\n }, this);\n\n var originalVertexDefines = this.vertexDefines;\n var originalFragmentDefines = this.fragmentDefines;\n\n this.vertexDefines = util.clone(shader.vertexDefines);\n this.fragmentDefines = util.clone(shader.fragmentDefines);\n\n if (keepStatus) {\n for (var symbol in originalUniforms) {\n if (uniforms[symbol]) {\n uniforms[symbol].value = originalUniforms[symbol].value;\n }\n }\n\n util.defaults(this.vertexDefines, originalVertexDefines);\n util.defaults(this.fragmentDefines, originalFragmentDefines);\n }\n\n var textureStatus = {};\n for (var key in shader.textures) {\n textureStatus[key] = {\n shaderType: shader.textures[key].shaderType,\n type: shader.textures[key].type,\n enabled: (keepStatus && this._textureStatus[key]) ? this._textureStatus[key].enabled : false\n };\n }\n\n this._textureStatus = textureStatus;\n\n this._programKey = '';\n },\n\n /**\n * Clone a new material and keep uniforms, shader will not be cloned\n * @return {clay.Material}\n */\n clone: function () {\n var material = new this.constructor({\n name: this.name,\n shader: this.shader\n });\n for (var symbol in this.uniforms) {\n material.uniforms[symbol].value = this.uniforms[symbol].value;\n }\n material.depthTest = this.depthTest;\n material.depthMask = this.depthMask;\n material.transparent = this.transparent;\n material.blend = this.blend;\n\n material.vertexDefines = util.clone(this.vertexDefines);\n material.fragmentDefines = util.clone(this.fragmentDefines);\n material.enableTexture(this.getEnabledTextures());\n material.precision = this.precision;\n\n return material;\n },\n\n /**\n * Add a #define macro in shader code\n * @param {string} shaderType Can be vertex, fragment or both\n * @param {string} symbol\n * @param {number} [val]\n */\n define: function (shaderType, symbol, val) {\n var vertexDefines = this.vertexDefines;\n var fragmentDefines = this.fragmentDefines;\n if (shaderType !== 'vertex' && shaderType !== 'fragment' && shaderType !== 'both'\n && arguments.length < 3\n ) {\n // shaderType default to be 'both'\n val = symbol;\n symbol = shaderType;\n shaderType = 'both';\n }\n val = val != null ? val : null;\n if (shaderType === 'vertex' || shaderType === 'both') {\n if (vertexDefines[symbol] !== val) {\n vertexDefines[symbol] = val;\n // Mark as dirty\n this._programKey = '';\n }\n }\n if (shaderType === 'fragment' || shaderType === 'both') {\n if (fragmentDefines[symbol] !== val) {\n fragmentDefines[symbol] = val;\n if (shaderType !== 'both') {\n this._programKey = '';\n }\n }\n }\n },\n\n /**\n * Remove a #define macro in shader code\n * @param {string} shaderType Can be vertex, fragment or both\n * @param {string} symbol\n */\n undefine: function (shaderType, symbol) {\n if (shaderType !== 'vertex' && shaderType !== 'fragment' && shaderType !== 'both'\n && arguments.length < 2\n ) {\n // shaderType default to be 'both'\n symbol = shaderType;\n shaderType = 'both';\n }\n if (shaderType === 'vertex' || shaderType === 'both') {\n if (this.isDefined('vertex', symbol)) {\n delete this.vertexDefines[symbol];\n // Mark as dirty\n this._programKey = '';\n }\n }\n if (shaderType === 'fragment' || shaderType === 'both') {\n if (this.isDefined('fragment', symbol)) {\n delete this.fragmentDefines[symbol];\n if (shaderType !== 'both') {\n this._programKey = '';\n }\n }\n }\n },\n\n /**\n * If macro is defined in shader.\n * @param {string} shaderType Can be vertex, fragment or both\n * @param {string} symbol\n */\n isDefined: function (shaderType, symbol) {\n // PENDING hasOwnProperty ?\n switch (shaderType) {\n case 'vertex':\n return this.vertexDefines[symbol] !== undefined;\n case 'fragment':\n return this.fragmentDefines[symbol] !== undefined;\n }\n },\n /**\n * Get macro value defined in shader.\n * @param {string} shaderType Can be vertex, fragment or both\n * @param {string} symbol\n */\n getDefine: function (shaderType, symbol) {\n switch(shaderType) {\n case 'vertex':\n return this.vertexDefines[symbol];\n case 'fragment':\n return this.fragmentDefines[symbol];\n }\n },\n /**\n * Enable a texture, actually it will add a #define macro in the shader code\n * For example, if texture symbol is diffuseMap, it will add a line `#define DIFFUSEMAP_ENABLED` in the shader code\n * @param {string} symbol\n */\n enableTexture: function (symbol) {\n if (Array.isArray(symbol)) {\n for (var i = 0; i < symbol.length; i++) {\n this.enableTexture(symbol[i]);\n }\n return;\n }\n\n var status = this._textureStatus[symbol];\n if (status) {\n var isEnabled = status.enabled;\n if (!isEnabled) {\n status.enabled = true;\n this._programKey = '';\n }\n }\n },\n /**\n * Enable all textures used in the shader\n */\n enableTexturesAll: function () {\n var textureStatus = this._textureStatus;\n for (var symbol in textureStatus) {\n textureStatus[symbol].enabled = true;\n }\n\n this._programKey = '';\n },\n /**\n * Disable a texture, it remove a #define macro in the shader\n * @param {string} symbol\n */\n disableTexture: function (symbol) {\n if (Array.isArray(symbol)) {\n for (var i = 0; i < symbol.length; i++) {\n this.disableTexture(symbol[i]);\n }\n return;\n }\n\n var status = this._textureStatus[symbol];\n if (status) {\n var isDisabled = ! status.enabled;\n if (!isDisabled) {\n status.enabled = false;\n this._programKey = '';\n }\n }\n },\n /**\n * Disable all textures used in the shader\n */\n disableTexturesAll: function () {\n var textureStatus = this._textureStatus;\n for (var symbol in textureStatus) {\n textureStatus[symbol].enabled = false;\n }\n\n this._programKey = '';\n },\n /**\n * If texture of given type is enabled.\n * @param {string} symbol\n * @return {boolean}\n */\n isTextureEnabled: function (symbol) {\n var textureStatus = this._textureStatus;\n return !!textureStatus[symbol]\n && textureStatus[symbol].enabled;\n },\n\n /**\n * Get all enabled textures\n * @return {string[]}\n */\n getEnabledTextures: function () {\n var enabledTextures = [];\n var textureStatus = this._textureStatus;\n for (var symbol in textureStatus) {\n if (textureStatus[symbol].enabled) {\n enabledTextures.push(symbol);\n }\n }\n return enabledTextures;\n },\n\n /**\n * Mark defines are updated.\n */\n dirtyDefines: function () {\n this._programKey = '';\n },\n\n getProgramKey: function () {\n if (!this._programKey) {\n this._programKey = getProgramKey(\n this.vertexDefines, this.fragmentDefines, this.getEnabledTextures()\n );\n }\n return this._programKey;\n }\n});\n\nexport default Material;\n","\nexport var GLMAT_EPSILON = 0.000001;\n\n// Use Array instead of Float32Array. It seems to be much faster and higher precision.\nexport var GLMAT_ARRAY_TYPE = Array;\n// if(!GLMAT_ARRAY_TYPE) {\n// GLMAT_ARRAY_TYPE = (typeof Float32Array !== 'undefined') ? Float32Array : Array;\n// }\n\nexport var GLMAT_RANDOM = Math.random;\n","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 2 Dimensional Vector\n * @name vec2\n */\n\nvar vec2 = {};\n\n/**\n * Creates a new, empty vec2\n *\n * @returns {vec2} a new 2D vector\n */\nvec2.create = function() {\n var out = new GLMAT_ARRAY_TYPE(2);\n out[0] = 0;\n out[1] = 0;\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with values from an existing vector\n *\n * @param {vec2} a vector to clone\n * @returns {vec2} a new 2D vector\n */\nvec2.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} a new 2D vector\n */\nvec2.fromValues = function(x, y) {\n var out = new GLMAT_ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Copy the values from one vec2 to another\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the source vector\n * @returns {vec2} out\n */\nvec2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Set the components of a vec2 to the given values\n *\n * @param {vec2} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} out\n */\nvec2.set = function(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Adds two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.subtract}\n * @function\n */\nvec2.sub = vec2.subtract;\n\n/**\n * Multiplies two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.multiply}\n * @function\n */\nvec2.mul = vec2.multiply;\n\n/**\n * Divides two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.divide}\n * @function\n */\nvec2.div = vec2.divide;\n\n/**\n * Returns the minimum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n};\n\n/**\n * Scales a vec2 by a scalar number\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec2} out\n */\nvec2.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n};\n\n/**\n * Adds two vec2's after scaling the second operand by a scalar value\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec2} out\n */\nvec2.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} distance between a and b\n */\nvec2.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.distance}\n * @function\n */\nvec2.dist = vec2.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec2.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredDistance}\n * @function\n */\nvec2.sqrDist = vec2.squaredDistance;\n\n/**\n * Calculates the length of a vec2\n *\n * @param {vec2} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec2.length = function (a) {\n var x = a[0],\n y = a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.length}\n * @function\n */\nvec2.len = vec2.length;\n\n/**\n * Calculates the squared length of a vec2\n *\n * @param {vec2} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec2.squaredLength = function (a) {\n var x = a[0],\n y = a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredLength}\n * @function\n */\nvec2.sqrLen = vec2.squaredLength;\n\n/**\n * Negates the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to negate\n * @returns {vec2} out\n */\nvec2.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to invert\n * @returns {vec2} out\n */\nvec2.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n};\n\n/**\n * Normalize a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to normalize\n * @returns {vec2} out\n */\nvec2.normalize = function(out, a) {\n var x = a[0],\n y = a[1];\n var len = x*x + y*y;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec2.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1];\n};\n\n/**\n * Computes the cross product of two vec2's\n * Note that the cross product must by definition produce a 3D vector\n *\n * @param {vec3} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec3} out\n */\nvec2.cross = function(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec2} out\n */\nvec2.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec2} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec2} out\n */\nvec2.random = function (out, scale) {\n scale = scale || 1.0;\n var r = GLMAT_RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2d\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2d} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2d = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat3\n * 3rd vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat3} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat3 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat4\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat4 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n};\n\n/**\n * Perform some operation over an array of vec2s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec2.forEach = (function() {\n var vec = vec2.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 2;\n }\n\n if(!offset) {\n offset = 0;\n }\n\n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1];\n }\n\n return a;\n };\n})();\n\nexport default vec2;","import vec2 from '../glmatrix/vec2';\n\n/**\n * @constructor\n * @alias clay.Vector2\n * @param {number} x\n * @param {number} y\n */\nvar Vector2 = function(x, y) {\n\n x = x || 0;\n y = y || 0;\n\n /**\n * Storage of Vector2, read and write of x, y will change the values in array\n * All methods also operate on the array instead of x, y components\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Vector2#\n */\n this.array = vec2.fromValues(x, y);\n\n /**\n * Dirty flag is used by the Node to determine\n * if the matrix is updated to latest\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Vector2#\n */\n this._dirty = true;\n};\n\nVector2.prototype = {\n\n constructor: Vector2,\n\n /**\n * Add b to self\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n add: function(b) {\n vec2.add(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x and y components\n * @param {number} x\n * @param {number} y\n * @return {clay.Vector2}\n */\n set: function(x, y) {\n this.array[0] = x;\n this.array[1] = y;\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x and y components from array\n * @param {Float32Array|number[]} arr\n * @return {clay.Vector2}\n */\n setArray: function(arr) {\n this.array[0] = arr[0];\n this.array[1] = arr[1];\n\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Vector2\n * @return {clay.Vector2}\n */\n clone: function() {\n return new Vector2(this.x, this.y);\n },\n\n /**\n * Copy x, y from b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n copy: function(b) {\n vec2.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Cross product of self and b, written to a Vector3 out\n * @param {clay.Vector3} out\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n cross: function(out, b) {\n vec2.cross(out.array, this.array, b.array);\n out._dirty = true;\n return this;\n },\n\n /**\n * Alias for distance\n * @param {clay.Vector2} b\n * @return {number}\n */\n dist: function(b) {\n return vec2.dist(this.array, b.array);\n },\n\n /**\n * Distance between self and b\n * @param {clay.Vector2} b\n * @return {number}\n */\n distance: function(b) {\n return vec2.distance(this.array, b.array);\n },\n\n /**\n * Alias for divide\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n div: function(b) {\n vec2.div(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Divide self by b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n divide: function(b) {\n vec2.divide(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Dot product of self and b\n * @param {clay.Vector2} b\n * @return {number}\n */\n dot: function(b) {\n return vec2.dot(this.array, b.array);\n },\n\n /**\n * Alias of length\n * @return {number}\n */\n len: function() {\n return vec2.len(this.array);\n },\n\n /**\n * Calculate the length\n * @return {number}\n */\n length: function() {\n return vec2.length(this.array);\n },\n\n /**\n * Linear interpolation between a and b\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @param {number} t\n * @return {clay.Vector2}\n */\n lerp: function(a, b, t) {\n vec2.lerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Minimum of self and b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n min: function(b) {\n vec2.min(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Maximum of self and b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n max: function(b) {\n vec2.max(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiply\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n mul: function(b) {\n vec2.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply self and b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n multiply: function(b) {\n vec2.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Negate self\n * @return {clay.Vector2}\n */\n negate: function() {\n vec2.negate(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Normalize self\n * @return {clay.Vector2}\n */\n normalize: function() {\n vec2.normalize(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Generate random x, y components with a given scale\n * @param {number} scale\n * @return {clay.Vector2}\n */\n random: function(scale) {\n vec2.random(this.array, scale);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self\n * @param {number} scale\n * @return {clay.Vector2}\n */\n scale: function(s) {\n vec2.scale(this.array, this.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale b and add to self\n * @param {clay.Vector2} b\n * @param {number} scale\n * @return {clay.Vector2}\n */\n scaleAndAdd: function(b, s) {\n vec2.scaleAndAdd(this.array, this.array, b.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for squaredDistance\n * @param {clay.Vector2} b\n * @return {number}\n */\n sqrDist: function(b) {\n return vec2.sqrDist(this.array, b.array);\n },\n\n /**\n * Squared distance between self and b\n * @param {clay.Vector2} b\n * @return {number}\n */\n squaredDistance: function(b) {\n return vec2.squaredDistance(this.array, b.array);\n },\n\n /**\n * Alias for squaredLength\n * @return {number}\n */\n sqrLen: function() {\n return vec2.sqrLen(this.array);\n },\n\n /**\n * Squared length of self\n * @return {number}\n */\n squaredLength: function() {\n return vec2.squaredLength(this.array);\n },\n\n /**\n * Alias for subtract\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n sub: function(b) {\n vec2.sub(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Subtract b from self\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n subtract: function(b) {\n vec2.subtract(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix2 m\n * @param {clay.Matrix2} m\n * @return {clay.Vector2}\n */\n transformMat2: function(m) {\n vec2.transformMat2(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix2d m\n * @param {clay.Matrix2d} m\n * @return {clay.Vector2}\n */\n transformMat2d: function(m) {\n vec2.transformMat2d(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix3 m\n * @param {clay.Matrix3} m\n * @return {clay.Vector2}\n */\n transformMat3: function(m) {\n vec2.transformMat3(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix4 m\n * @param {clay.Matrix4} m\n * @return {clay.Vector2}\n */\n transformMat4: function(m) {\n vec2.transformMat4(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\n// Getter and Setter\nif (Object.defineProperty) {\n\n var proto = Vector2.prototype;\n /**\n * @name x\n * @type {number}\n * @memberOf clay.Vector2\n * @instance\n */\n Object.defineProperty(proto, 'x', {\n get: function () {\n return this.array[0];\n },\n set: function (value) {\n this.array[0] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name y\n * @type {number}\n * @memberOf clay.Vector2\n * @instance\n */\n Object.defineProperty(proto, 'y', {\n get: function () {\n return this.array[1];\n },\n set: function (value) {\n this.array[1] = value;\n this._dirty = true;\n }\n });\n}\n\n// Supply methods that are not in place\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.add = function(out, a, b) {\n vec2.add(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector2} out\n * @param {number} x\n * @param {number} y\n * @return {clay.Vector2}\n */\nVector2.set = function(out, x, y) {\n vec2.set(out.array, x, y);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.copy = function(out, b) {\n vec2.copy(out.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.cross = function(out, a, b) {\n vec2.cross(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.dist = function(a, b) {\n return vec2.distance(a.array, b.array);\n};\n/**\n * @function\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.distance = Vector2.dist;\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.div = function(out, a, b) {\n vec2.divide(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.divide = Vector2.div;\n/**\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.dot = function(a, b) {\n return vec2.dot(a.array, b.array);\n};\n\n/**\n * @param {clay.Vector2} a\n * @return {number}\n */\nVector2.len = function(b) {\n return vec2.length(b.array);\n};\n\n// Vector2.length = Vector2.len;\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @param {number} t\n * @return {clay.Vector2}\n */\nVector2.lerp = function(out, a, b, t) {\n vec2.lerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.min = function(out, a, b) {\n vec2.min(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.max = function(out, a, b) {\n vec2.max(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.mul = function(out, a, b) {\n vec2.multiply(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.multiply = Vector2.mul;\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @return {clay.Vector2}\n */\nVector2.negate = function(out, a) {\n vec2.negate(out.array, a.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @return {clay.Vector2}\n */\nVector2.normalize = function(out, a) {\n vec2.normalize(out.array, a.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {number} scale\n * @return {clay.Vector2}\n */\nVector2.random = function(out, scale) {\n vec2.random(out.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {number} scale\n * @return {clay.Vector2}\n */\nVector2.scale = function(out, a, scale) {\n vec2.scale(out.array, a.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @param {number} scale\n * @return {clay.Vector2}\n */\nVector2.scaleAndAdd = function(out, a, b, scale) {\n vec2.scaleAndAdd(out.array, a.array, b.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.sqrDist = function(a, b) {\n return vec2.sqrDist(a.array, b.array);\n};\n/**\n * @function\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.squaredDistance = Vector2.sqrDist;\n\n/**\n * @param {clay.Vector2} a\n * @return {number}\n */\nVector2.sqrLen = function(a) {\n return vec2.sqrLen(a.array);\n};\n/**\n * @function\n * @param {clay.Vector2} a\n * @return {number}\n */\nVector2.squaredLength = Vector2.sqrLen;\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.sub = function(out, a, b) {\n vec2.subtract(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.subtract = Vector2.sub;\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Matrix2} m\n * @return {clay.Vector2}\n */\nVector2.transformMat2 = function(out, a, m) {\n vec2.transformMat2(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Matrix2d} m\n * @return {clay.Vector2}\n */\nVector2.transformMat2d = function(out, a, m) {\n vec2.transformMat2d(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {Matrix3} m\n * @return {clay.Vector2}\n */\nVector2.transformMat3 = function(out, a, m) {\n vec2.transformMat3(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Matrix4} m\n * @return {clay.Vector2}\n */\nVector2.transformMat4 = function(out, a, m) {\n vec2.transformMat4(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n\nexport default Vector2;\n","import vendor from '../core/vendor';\nimport Base from '../core/Base';\n\nvar SHADER_STATE_TO_ENABLE = 1;\nvar SHADER_STATE_KEEP_ENABLE = 2;\nvar SHADER_STATE_PENDING = 3;\n\n// Enable attribute operation is global to all programs\n// Here saved the list of all enabled attribute index\n// http://www.mjbshaw.com/2013/03/webgl-fixing-invalidoperation.html\nvar enabledAttributeList = {};\n\n// some util functions\nfunction addLineNumbers(string) {\n var chunks = string.split('\\n');\n for (var i = 0, il = chunks.length; i < il; i ++) {\n // Chrome reports shader errors on lines\n // starting counting from 1\n chunks[i] = (i + 1) + ': ' + chunks[i];\n }\n return chunks.join('\\n');\n}\n\n// Return true or error msg if error happened\nfunction checkShaderErrorMsg(_gl, shader, shaderString) {\n if (!_gl.getShaderParameter(shader, _gl.COMPILE_STATUS)) {\n return [_gl.getShaderInfoLog(shader), addLineNumbers(shaderString)].join('\\n');\n }\n}\n\nvar tmpFloat32Array16 = new vendor.Float32Array(16);\n\nvar GLProgram = Base.extend({\n\n uniformSemantics: {},\n attributes: {}\n\n}, function () {\n this._locations = {};\n\n this._textureSlot = 0;\n\n this._program = null;\n}, {\n\n bind: function (renderer) {\n this._textureSlot = 0;\n renderer.gl.useProgram(this._program);\n },\n\n hasUniform: function (symbol) {\n var location = this._locations[symbol];\n return location !== null && location !== undefined;\n },\n\n useTextureSlot: function (renderer, texture, slot) {\n if (texture) {\n renderer.gl.activeTexture(renderer.gl.TEXTURE0 + slot);\n // Maybe texture is not loaded yet;\n if (texture.isRenderable()) {\n texture.bind(renderer);\n }\n else {\n // Bind texture to null\n texture.unbind(renderer);\n }\n }\n },\n\n currentTextureSlot: function () {\n return this._textureSlot;\n },\n\n resetTextureSlot: function (slot) {\n this._textureSlot = slot || 0;\n },\n\n takeCurrentTextureSlot: function (renderer, texture) {\n var textureSlot = this._textureSlot;\n\n this.useTextureSlot(renderer, texture, textureSlot);\n\n this._textureSlot++;\n\n return textureSlot;\n },\n\n setUniform: function (_gl, type, symbol, value) {\n var locationMap = this._locations;\n var location = locationMap[symbol];\n // Uniform is not existed in the shader\n if (location === null || location === undefined) {\n return false;\n }\n\n switch (type) {\n case 'm4':\n if (!(value instanceof Float32Array)) {\n // Use Float32Array is much faster than array when uniformMatrix4fv.\n for (var i = 0; i < value.length; i++) {\n tmpFloat32Array16[i] = value[i];\n }\n value = tmpFloat32Array16;\n }\n _gl.uniformMatrix4fv(location, false, value);\n break;\n case '2i':\n _gl.uniform2i(location, value[0], value[1]);\n break;\n case '2f':\n _gl.uniform2f(location, value[0], value[1]);\n break;\n case '3i':\n _gl.uniform3i(location, value[0], value[1], value[2]);\n break;\n case '3f':\n _gl.uniform3f(location, value[0], value[1], value[2]);\n break;\n case '4i':\n _gl.uniform4i(location, value[0], value[1], value[2], value[3]);\n break;\n case '4f':\n _gl.uniform4f(location, value[0], value[1], value[2], value[3]);\n break;\n case '1i':\n _gl.uniform1i(location, value);\n break;\n case '1f':\n _gl.uniform1f(location, value);\n break;\n case '1fv':\n _gl.uniform1fv(location, value);\n break;\n case '1iv':\n _gl.uniform1iv(location, value);\n break;\n case '2iv':\n _gl.uniform2iv(location, value);\n break;\n case '2fv':\n _gl.uniform2fv(location, value);\n break;\n case '3iv':\n _gl.uniform3iv(location, value);\n break;\n case '3fv':\n _gl.uniform3fv(location, value);\n break;\n case '4iv':\n _gl.uniform4iv(location, value);\n break;\n case '4fv':\n _gl.uniform4fv(location, value);\n break;\n case 'm2':\n case 'm2v':\n _gl.uniformMatrix2fv(location, false, value);\n break;\n case 'm3':\n case 'm3v':\n _gl.uniformMatrix3fv(location, false, value);\n break;\n case 'm4v':\n // Raw value\n if (Array.isArray(value) && Array.isArray(value[0])) {\n var array = new vendor.Float32Array(value.length * 16);\n var cursor = 0;\n for (var i = 0; i < value.length; i++) {\n var item = value[i];\n for (var j = 0; j < 16; j++) {\n array[cursor++] = item[j];\n }\n }\n _gl.uniformMatrix4fv(location, false, array);\n }\n else { // ArrayBufferView\n _gl.uniformMatrix4fv(location, false, value);\n }\n break;\n }\n return true;\n },\n\n setUniformOfSemantic: function (_gl, semantic, val) {\n var semanticInfo = this.uniformSemantics[semantic];\n if (semanticInfo) {\n return this.setUniform(_gl, semanticInfo.type, semanticInfo.symbol, val);\n }\n return false;\n },\n\n // Used for creating VAO\n // Enable the attributes passed in and disable the rest\n // Example Usage:\n // enableAttributes(renderer, [\"position\", \"texcoords\"])\n enableAttributes: function (renderer, attribList, vao) {\n var _gl = renderer.gl;\n var program = this._program;\n\n var locationMap = this._locations;\n\n var enabledAttributeListInContext;\n if (vao) {\n enabledAttributeListInContext = vao.__enabledAttributeList;\n }\n else {\n enabledAttributeListInContext = enabledAttributeList[renderer.__uid__];\n }\n if (!enabledAttributeListInContext) {\n // In vertex array object context\n // PENDING Each vao object needs to enable attributes again?\n if (vao) {\n enabledAttributeListInContext\n = vao.__enabledAttributeList\n = [];\n }\n else {\n enabledAttributeListInContext\n = enabledAttributeList[renderer.__uid__]\n = [];\n }\n }\n var locationList = [];\n for (var i = 0; i < attribList.length; i++) {\n var symbol = attribList[i];\n if (!this.attributes[symbol]) {\n locationList[i] = -1;\n continue;\n }\n var location = locationMap[symbol];\n if (location == null) {\n location = _gl.getAttribLocation(program, symbol);\n // Attrib location is a number from 0 to ...\n if (location === -1) {\n locationList[i] = -1;\n continue;\n }\n locationMap[symbol] = location;\n }\n locationList[i] = location;\n\n if (!enabledAttributeListInContext[location]) {\n enabledAttributeListInContext[location] = SHADER_STATE_TO_ENABLE;\n }\n else {\n enabledAttributeListInContext[location] = SHADER_STATE_KEEP_ENABLE;\n }\n }\n\n for (var i = 0; i < enabledAttributeListInContext.length; i++) {\n switch(enabledAttributeListInContext[i]){\n case SHADER_STATE_TO_ENABLE:\n _gl.enableVertexAttribArray(i);\n enabledAttributeListInContext[i] = SHADER_STATE_PENDING;\n break;\n case SHADER_STATE_KEEP_ENABLE:\n enabledAttributeListInContext[i] = SHADER_STATE_PENDING;\n break;\n // Expired\n case SHADER_STATE_PENDING:\n _gl.disableVertexAttribArray(i);\n enabledAttributeListInContext[i] = 0;\n break;\n }\n }\n\n return locationList;\n },\n\n getAttribLocation: function (_gl, symbol) {\n var locationMap = this._locations;\n\n var location = locationMap[symbol];\n if (location == null) {\n location = _gl.getAttribLocation(this._program, symbol);\n locationMap[symbol] = location;\n }\n\n return location;\n },\n\n buildProgram: function (_gl, shader, vertexShaderCode, fragmentShaderCode) {\n var vertexShader = _gl.createShader(_gl.VERTEX_SHADER);\n var program = _gl.createProgram();\n\n _gl.shaderSource(vertexShader, vertexShaderCode);\n _gl.compileShader(vertexShader);\n\n var fragmentShader = _gl.createShader(_gl.FRAGMENT_SHADER);\n _gl.shaderSource(fragmentShader, fragmentShaderCode);\n _gl.compileShader(fragmentShader);\n\n var msg = checkShaderErrorMsg(_gl, vertexShader, vertexShaderCode);\n if (msg) {\n return msg;\n }\n msg = checkShaderErrorMsg(_gl, fragmentShader, fragmentShaderCode);\n if (msg) {\n return msg;\n }\n\n _gl.attachShader(program, vertexShader);\n _gl.attachShader(program, fragmentShader);\n // Force the position bind to location 0;\n if (shader.attributeSemantics['POSITION']) {\n _gl.bindAttribLocation(program, 0, shader.attributeSemantics['POSITION'].symbol);\n }\n else {\n // Else choose an attribute and bind to location 0;\n var keys = Object.keys(this.attributes);\n _gl.bindAttribLocation(program, 0, keys[0]);\n }\n\n _gl.linkProgram(program);\n\n _gl.deleteShader(vertexShader);\n _gl.deleteShader(fragmentShader);\n\n this._program = program;\n\n // Save code.\n this.vertexCode = vertexShaderCode;\n this.fragmentCode = fragmentShaderCode;\n\n if (!_gl.getProgramParameter(program, _gl.LINK_STATUS)) {\n return 'Could not link program\\n' + _gl.getProgramInfoLog(program);\n }\n\n // Cache uniform locations\n for (var i = 0; i < shader.uniforms.length; i++) {\n var uniformSymbol = shader.uniforms[i];\n this._locations[uniformSymbol] = _gl.getUniformLocation(program, uniformSymbol);\n }\n\n }\n});\n\nexport default GLProgram;","import GLProgram from './GLProgram';\n\nvar loopRegex = /for\\s*?\\(int\\s*?_idx_\\s*\\=\\s*([\\w-]+)\\;\\s*_idx_\\s*<\\s*([\\w-]+);\\s*_idx_\\s*\\+\\+\\s*\\)\\s*\\{\\{([\\s\\S]+?)(?=\\}\\})\\}\\}/g;\n\nfunction unrollLoop(shaderStr, defines, lightsNumbers) {\n // Loop unroll from three.js, https://github.com/mrdoob/three.js/blob/master/src/renderers/webgl/WebGLProgram.js#L175\n // In some case like shadowMap in loop use 'i' to index value much slower.\n\n // Loop use _idx_ and increased with _idx_++ will be unrolled\n // Use {{ }} to match the pair so the if statement will not be affected\n // Write like following\n // for (int _idx_ = 0; _idx_ < 4; _idx_++) {{\n // vec3 color = texture2D(textures[_idx_], uv).rgb;\n // }}\n function replace(match, start, end, snippet) {\n var unroll = '';\n // Try to treat as define\n if (isNaN(start)) {\n if (start in defines) {\n start = defines[start];\n }\n else {\n start = lightNumberDefines[start];\n }\n }\n if (isNaN(end)) {\n if (end in defines) {\n end = defines[end];\n }\n else {\n end = lightNumberDefines[end];\n }\n }\n // TODO Error checking\n\n for (var idx = parseInt(start); idx < parseInt(end); idx++) {\n // PENDING Add scope?\n unroll += '{'\n + snippet\n .replace(/float\\s*\\(\\s*_idx_\\s*\\)/g, idx.toFixed(1))\n .replace(/_idx_/g, idx)\n + '}';\n }\n\n return unroll;\n }\n\n var lightNumberDefines = {};\n for (var lightType in lightsNumbers) {\n lightNumberDefines[lightType + '_COUNT'] = lightsNumbers[lightType];\n }\n return shaderStr.replace(loopRegex, replace);\n}\n\nfunction getDefineCode(defines, lightsNumbers, enabledTextures) {\n var defineStr = [];\n if (lightsNumbers) {\n for (var lightType in lightsNumbers) {\n var count = lightsNumbers[lightType];\n if (count > 0) {\n defineStr.push('#define ' + lightType.toUpperCase() + '_COUNT ' + count);\n }\n }\n }\n if (enabledTextures) {\n for (var i = 0; i < enabledTextures.length; i++) {\n var symbol = enabledTextures[i];\n defineStr.push('#define ' + symbol.toUpperCase() + '_ENABLED');\n }\n }\n // Custom Defines\n for (var symbol in defines) {\n var value = defines[symbol];\n if (value === null) {\n defineStr.push('#define ' + symbol);\n }\n else{\n defineStr.push('#define ' + symbol + ' ' + value.toString());\n }\n }\n return defineStr.join('\\n');\n}\n\nfunction getExtensionCode(exts) {\n // Extension declaration must before all non-preprocessor codes\n // TODO vertex ? extension enum ?\n var extensionStr = [];\n for (var i = 0; i < exts.length; i++) {\n extensionStr.push('#extension GL_' + exts[i] + ' : enable');\n }\n return extensionStr.join('\\n');\n}\n\nfunction getPrecisionCode(precision) {\n return ['precision', precision, 'float'].join(' ') + ';\\n'\n + ['precision', precision, 'int'].join(' ') + ';\\n'\n // depth texture may have precision problem on iOS device.\n + ['precision', precision, 'sampler2D'].join(' ') + ';\\n';\n}\n\nfunction ProgramManager(renderer) {\n this._renderer = renderer;\n this._cache = {};\n}\n\nProgramManager.prototype.getProgram = function (renderable, material, scene) {\n var cache = this._cache;\n\n var isSkinnedMesh = renderable.isSkinnedMesh && renderable.isSkinnedMesh();\n var isInstancedMesh = renderable.isInstancedMesh && renderable.isInstancedMesh();\n var key = 's' + material.shader.shaderID + 'm' + material.getProgramKey();\n if (scene) {\n key += 'se' + scene.getProgramKey(renderable.lightGroup);\n }\n if (isSkinnedMesh) {\n key += ',sk' + renderable.joints.length;\n }\n if (isInstancedMesh) {\n key += ',is';\n }\n var program = cache[key];\n\n if (program) {\n return program;\n }\n\n var lightsNumbers = scene ? scene.getLightsNumbers(renderable.lightGroup) : {};\n var renderer = this._renderer;\n var _gl = renderer.gl;\n var enabledTextures = material.getEnabledTextures();\n var extraDefineCode = '';\n if (isSkinnedMesh) {\n var skinDefines = {\n SKINNING: null,\n JOINT_COUNT: renderable.joints.length\n };\n if (renderable.joints.length > renderer.getMaxJointNumber()) {\n skinDefines.USE_SKIN_MATRICES_TEXTURE = null;\n }\n // TODO Add skinning code?\n extraDefineCode += '\\n' + getDefineCode(skinDefines) + '\\n';\n }\n if (isInstancedMesh) {\n extraDefineCode += '\\n#define INSTANCING\\n';\n }\n // TODO Optimize key generation\n // VERTEX\n var vertexDefineStr = extraDefineCode + getDefineCode(material.vertexDefines, lightsNumbers, enabledTextures);\n // FRAGMENT\n var fragmentDefineStr = extraDefineCode + getDefineCode(material.fragmentDefines, lightsNumbers, enabledTextures);\n\n var vertexCode = vertexDefineStr + '\\n' + material.shader.vertex;\n\n var extensions = [\n 'OES_standard_derivatives',\n 'EXT_shader_texture_lod'\n ].filter(function (ext) {\n return renderer.getGLExtension(ext) != null;\n });\n\n if (extensions.indexOf('EXT_shader_texture_lod') >= 0) {\n fragmentDefineStr += '\\n#define SUPPORT_TEXTURE_LOD';\n }\n if (extensions.indexOf('OES_standard_derivatives') >= 0) {\n fragmentDefineStr += '\\n#define SUPPORT_STANDARD_DERIVATIVES';\n }\n\n var fragmentCode = getExtensionCode(extensions) + '\\n'\n + getPrecisionCode(material.precision) + '\\n'\n + fragmentDefineStr + '\\n'\n + material.shader.fragment;\n\n var finalVertexCode = unrollLoop(vertexCode, material.vertexDefines, lightsNumbers);\n var finalFragmentCode = unrollLoop(fragmentCode, material.fragmentDefines, lightsNumbers);\n\n var program = new GLProgram();\n program.uniformSemantics = material.shader.uniformSemantics;\n program.attributes = material.shader.attributes;\n var errorMsg = program.buildProgram(_gl, material.shader, finalVertexCode, finalFragmentCode);\n program.__error = errorMsg;\n\n cache[key] = program;\n\n return program;\n};\n\nexport default ProgramManager;","/**\n * Mainly do the parse and compile of shader string\n * Support shader code chunk import and export\n * Support shader semantics\n * http://www.nvidia.com/object/using_sas.html\n * https://github.com/KhronosGroup/collada2json/issues/45\n */\nimport util from './core/util';\nimport vendor from './core/vendor';\n\nvar uniformRegex = /uniform\\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\\s+([\\s\\S]*?);/g;\nvar attributeRegex = /attribute\\s+(float|int|vec2|vec3|vec4)\\s+([\\s\\S]*?);/g;\n// Only parse number define.\nvar defineRegex = /#define\\s+(\\w+)?(\\s+[\\d-.]+)?\\s*;?\\s*\\n/g;\n\nvar uniformTypeMap = {\n 'bool': '1i',\n 'int': '1i',\n 'sampler2D': 't',\n 'samplerCube': 't',\n 'float': '1f',\n 'vec2': '2f',\n 'vec3': '3f',\n 'vec4': '4f',\n 'ivec2': '2i',\n 'ivec3': '3i',\n 'ivec4': '4i',\n 'mat2': 'm2',\n 'mat3': 'm3',\n 'mat4': 'm4'\n};\n\nfunction createZeroArray(len) {\n var arr = [];\n for (var i = 0; i < len; i++) {\n arr[i] = 0;\n }\n return arr;\n}\n\nvar uniformValueConstructor = {\n 'bool': function () { return true; },\n 'int': function () { return 0; },\n 'float': function () { return 0; },\n 'sampler2D': function () { return null; },\n 'samplerCube': function () { return null; },\n\n 'vec2': function () { return createZeroArray(2); },\n 'vec3': function () { return createZeroArray(3); },\n 'vec4': function () { return createZeroArray(4); },\n\n 'ivec2': function () { return createZeroArray(2); },\n 'ivec3': function () { return createZeroArray(3); },\n 'ivec4': function () { return createZeroArray(4); },\n\n 'mat2': function () { return createZeroArray(4); },\n 'mat3': function () { return createZeroArray(9); },\n 'mat4': function () { return createZeroArray(16); },\n\n 'array': function () { return []; }\n};\n\nvar attributeSemantics = [\n 'POSITION',\n 'NORMAL',\n 'BINORMAL',\n 'TANGENT',\n 'TEXCOORD',\n 'TEXCOORD_0',\n 'TEXCOORD_1',\n 'COLOR',\n // Skinning\n // https://github.com/KhronosGroup/glTF/blob/master/specification/README.md#semantics\n 'JOINT',\n 'WEIGHT'\n];\nvar uniformSemantics = [\n 'SKIN_MATRIX',\n // Information about viewport\n 'VIEWPORT_SIZE',\n 'VIEWPORT',\n 'DEVICEPIXELRATIO',\n // Window size for window relative coordinate\n // https://www.opengl.org/sdk/docs/man/html/gl_FragCoord.xhtml\n 'WINDOW_SIZE',\n // Infomation about camera\n 'NEAR',\n 'FAR',\n // Time\n 'TIME'\n];\nvar matrixSemantics = [\n 'WORLD',\n 'VIEW',\n 'PROJECTION',\n 'WORLDVIEW',\n 'VIEWPROJECTION',\n 'WORLDVIEWPROJECTION',\n 'WORLDINVERSE',\n 'VIEWINVERSE',\n 'PROJECTIONINVERSE',\n 'WORLDVIEWINVERSE',\n 'VIEWPROJECTIONINVERSE',\n 'WORLDVIEWPROJECTIONINVERSE',\n 'WORLDTRANSPOSE',\n 'VIEWTRANSPOSE',\n 'PROJECTIONTRANSPOSE',\n 'WORLDVIEWTRANSPOSE',\n 'VIEWPROJECTIONTRANSPOSE',\n 'WORLDVIEWPROJECTIONTRANSPOSE',\n 'WORLDINVERSETRANSPOSE',\n 'VIEWINVERSETRANSPOSE',\n 'PROJECTIONINVERSETRANSPOSE',\n 'WORLDVIEWINVERSETRANSPOSE',\n 'VIEWPROJECTIONINVERSETRANSPOSE',\n 'WORLDVIEWPROJECTIONINVERSETRANSPOSE'\n];\n\nvar attributeSizeMap = {\n // WebGL does not support integer attributes\n 'vec4': 4,\n 'vec3': 3,\n 'vec2': 2,\n 'float': 1\n};\n\n\nvar shaderIDCache = {};\nvar shaderCodeCache = {};\n\nfunction getShaderID(vertex, fragment) {\n var key = 'vertex:' + vertex + 'fragment:' + fragment;\n if (shaderIDCache[key]) {\n return shaderIDCache[key];\n }\n var id = util.genGUID();\n shaderIDCache[key] = id;\n\n shaderCodeCache[id] = {\n vertex: vertex,\n fragment: fragment\n };\n\n return id;\n}\n\nfunction removeComment(code) {\n return code.replace(/[ \\t]*\\/\\/.*\\n/g, '' ) // remove //\n .replace(/[ \\t]*\\/\\*[\\s\\S]*?\\*\\//g, '' ); // remove /* */\n}\n\nfunction logSyntaxError() {\n console.error('Wrong uniform/attributes syntax');\n}\n\nfunction parseDeclarations(type, line) {\n var speratorsRegexp = /[,=\\(\\):]/;\n var tokens = line\n // Convert `symbol: [1,2,3]` to `symbol: vec3(1,2,3)`\n .replace(/:\\s*\\[\\s*(.*)\\s*\\]/g, '=' + type + '($1)')\n .replace(/\\s+/g, '')\n .split(/(?=[,=\\(\\):])/g);\n\n var newTokens = [];\n for (var i = 0; i < tokens.length; i++) {\n if (tokens[i].match(speratorsRegexp)) {\n newTokens.push(\n tokens[i].charAt(0),\n tokens[i].slice(1)\n );\n }\n else {\n newTokens.push(tokens[i]);\n }\n }\n tokens = newTokens;\n\n var TYPE_SYMBOL = 0;\n var TYPE_ASSIGN = 1;\n var TYPE_VEC = 2;\n var TYPE_ARR = 3;\n var TYPE_SEMANTIC = 4;\n var TYPE_NORMAL = 5;\n\n var opType = TYPE_SYMBOL;\n var declarations = {};\n var declarationValue = null;\n var currentDeclaration;\n\n addSymbol(tokens[0]);\n\n function addSymbol(symbol) {\n if (!symbol) {\n logSyntaxError();\n }\n var arrResult = symbol.match(/\\[(.*?)\\]/);\n currentDeclaration = symbol.replace(/\\[(.*?)\\]/, '');\n declarations[currentDeclaration] = {};\n if (arrResult) {\n declarations[currentDeclaration].isArray = true;\n declarations[currentDeclaration].arraySize = arrResult[1];\n }\n }\n\n for (var i = 1; i < tokens.length; i++) {\n var token = tokens[i];\n if (!token) { // Empty token;\n continue;\n }\n if (token === '=') {\n if (opType !== TYPE_SYMBOL\n && opType !== TYPE_ARR) {\n logSyntaxError();\n break;\n }\n opType = TYPE_ASSIGN;\n\n continue;\n }\n else if (token === ':') {\n opType = TYPE_SEMANTIC;\n\n continue;\n }\n else if (token === ',') {\n if (opType === TYPE_VEC) {\n if (!(declarationValue instanceof Array)) {\n logSyntaxError();\n break;\n }\n declarationValue.push(+tokens[++i]);\n }\n else {\n opType = TYPE_NORMAL;\n }\n\n continue;\n }\n else if (token === ')') {\n declarations[currentDeclaration].value = new vendor.Float32Array(declarationValue);\n declarationValue = null;\n opType = TYPE_NORMAL;\n continue;\n }\n else if (token === '(') {\n if (opType !== TYPE_VEC) {\n logSyntaxError();\n break;\n }\n if (!(declarationValue instanceof Array)) {\n logSyntaxError();\n break;\n }\n declarationValue.push(+tokens[++i]);\n continue;\n }\n else if (token.indexOf('vec') >= 0) {\n if (opType !== TYPE_ASSIGN\n // Compatitable with old syntax `symbol: [1,2,3]`\n && opType !== TYPE_SEMANTIC) {\n logSyntaxError();\n break;\n }\n opType = TYPE_VEC;\n declarationValue = [];\n continue;\n }\n else if (opType === TYPE_ASSIGN) {\n if (type === 'bool') {\n declarations[currentDeclaration].value = token === 'true';\n }\n else {\n declarations[currentDeclaration].value = parseFloat(token);\n }\n declarationValue = null;\n continue;\n }\n else if (opType === TYPE_SEMANTIC) {\n var semantic = token;\n if (attributeSemantics.indexOf(semantic) >= 0\n || uniformSemantics.indexOf(semantic) >= 0\n || matrixSemantics.indexOf(semantic) >= 0\n ) {\n declarations[currentDeclaration].semantic = semantic;\n }\n else if (semantic === 'ignore' || semantic === 'unconfigurable') {\n declarations[currentDeclaration].ignore = true;\n }\n else {\n // Try to parse as a default tvalue.\n if (type === 'bool') {\n declarations[currentDeclaration].value = semantic === 'true';\n }\n else {\n declarations[currentDeclaration].value = parseFloat(semantic);\n }\n }\n continue;\n }\n\n // treat as symbol.\n addSymbol(token);\n opType = TYPE_SYMBOL;\n }\n\n return declarations;\n}\n\n\n/**\n * @constructor\n * @extends clay.core.Base\n * @alias clay.Shader\n * @param {string} vertex\n * @param {string} fragment\n * @example\n * // Create a phong shader\n * var shader = new clay.Shader(\n * clay.Shader.source('clay.standard.vertex'),\n * clay.Shader.source('clay.standard.fragment')\n * );\n */\nfunction Shader(vertex, fragment) {\n // First argument can be { vertex, fragment }\n if (typeof vertex === 'object') {\n fragment = vertex.fragment;\n vertex = vertex.vertex;\n }\n\n vertex = removeComment(vertex);\n fragment = removeComment(fragment);\n\n this._shaderID = getShaderID(vertex, fragment);\n\n this._vertexCode = Shader.parseImport(vertex);\n this._fragmentCode = Shader.parseImport(fragment);\n\n /**\n * @readOnly\n */\n this.attributeSemantics = {};\n /**\n * @readOnly\n */\n this.matrixSemantics = {};\n /**\n * @readOnly\n */\n this.uniformSemantics = {};\n /**\n * @readOnly\n */\n this.matrixSemanticKeys = [];\n /**\n * @readOnly\n */\n this.uniformTemplates = {};\n /**\n * @readOnly\n */\n this.attributes = {};\n /**\n * @readOnly\n */\n this.textures = {};\n /**\n * @readOnly\n */\n this.vertexDefines = {};\n /**\n * @readOnly\n */\n this.fragmentDefines = {};\n\n this._parseAttributes();\n this._parseUniforms();\n this._parseDefines();\n}\n\nShader.prototype = {\n\n constructor: Shader,\n\n // Create a new uniform instance for material\n createUniforms: function () {\n var uniforms = {};\n\n for (var symbol in this.uniformTemplates){\n var uniformTpl = this.uniformTemplates[symbol];\n uniforms[symbol] = {\n type: uniformTpl.type,\n value: uniformTpl.value()\n };\n }\n\n return uniforms;\n },\n\n _parseImport: function () {\n this._vertexCode = Shader.parseImport(this.vertex);\n this._fragmentCode = Shader.parseImport(this.fragment);\n },\n\n _addSemanticUniform: function (symbol, uniformType, semantic) {\n // This case is only for SKIN_MATRIX\n // TODO\n if (attributeSemantics.indexOf(semantic) >= 0) {\n this.attributeSemantics[semantic] = {\n symbol: symbol,\n type: uniformType\n };\n }\n else if (matrixSemantics.indexOf(semantic) >= 0) {\n var isTranspose = false;\n var semanticNoTranspose = semantic;\n if (semantic.match(/TRANSPOSE$/)) {\n isTranspose = true;\n semanticNoTranspose = semantic.slice(0, -9);\n }\n this.matrixSemantics[semantic] = {\n symbol: symbol,\n type: uniformType,\n isTranspose: isTranspose,\n semanticNoTranspose: semanticNoTranspose\n };\n }\n else if (uniformSemantics.indexOf(semantic) >= 0) {\n this.uniformSemantics[semantic] = {\n symbol: symbol,\n type: uniformType\n };\n }\n },\n\n _addMaterialUniform: function (symbol, type, uniformType, defaultValueFunc, isArray, materialUniforms) {\n materialUniforms[symbol] = {\n type: uniformType,\n value: isArray ? uniformValueConstructor['array'] : (defaultValueFunc || uniformValueConstructor[type]),\n semantic: null\n };\n },\n\n _parseUniforms: function () {\n var uniforms = {};\n var self = this;\n var shaderType = 'vertex';\n this._uniformList = [];\n\n this._vertexCode = this._vertexCode.replace(uniformRegex, _uniformParser);\n shaderType = 'fragment';\n this._fragmentCode = this._fragmentCode.replace(uniformRegex, _uniformParser);\n\n self.matrixSemanticKeys = Object.keys(this.matrixSemantics);\n\n function makeDefaultValueFunc(value) {\n return value != null ? function () { return value; } : null;\n }\n\n function _uniformParser(str, type, content) {\n var declaredUniforms = parseDeclarations(type, content);\n var uniformMainStr = [];\n for (var symbol in declaredUniforms) {\n\n var uniformInfo = declaredUniforms[symbol];\n var semantic = uniformInfo.semantic;\n var tmpStr = symbol;\n var uniformType = uniformTypeMap[type];\n var defaultValueFunc = makeDefaultValueFunc(declaredUniforms[symbol].value);\n if (declaredUniforms[symbol].isArray) {\n tmpStr += '[' + declaredUniforms[symbol].arraySize + ']';\n uniformType += 'v';\n }\n\n uniformMainStr.push(tmpStr);\n\n self._uniformList.push(symbol);\n\n if (!uniformInfo.ignore) {\n if (type === 'sampler2D' || type === 'samplerCube') {\n // Texture is default disabled\n self.textures[symbol] = {\n shaderType: shaderType,\n type: type\n };\n }\n\n if (semantic) {\n // TODO Should not declare multiple symbols if have semantic.\n self._addSemanticUniform(symbol, uniformType, semantic);\n }\n else {\n self._addMaterialUniform(\n symbol, type, uniformType, defaultValueFunc,\n declaredUniforms[symbol].isArray, uniforms\n );\n }\n }\n }\n return uniformMainStr.length > 0\n ? 'uniform ' + type + ' ' + uniformMainStr.join(',') + ';\\n' : '';\n }\n\n this.uniformTemplates = uniforms;\n },\n\n _parseAttributes: function () {\n var attributes = {};\n var self = this;\n this._vertexCode = this._vertexCode.replace(attributeRegex, _attributeParser);\n\n function _attributeParser(str, type, content) {\n var declaredAttributes = parseDeclarations(type, content);\n\n var size = attributeSizeMap[type] || 1;\n var attributeMainStr = [];\n for (var symbol in declaredAttributes) {\n var semantic = declaredAttributes[symbol].semantic;\n attributes[symbol] = {\n // TODO Can only be float\n type: 'float',\n size: size,\n semantic: semantic || null\n };\n // TODO Should not declare multiple symbols if have semantic.\n if (semantic) {\n if (attributeSemantics.indexOf(semantic) < 0) {\n throw new Error('Unkown semantic \"' + semantic + '\"');\n }\n else {\n self.attributeSemantics[semantic] = {\n symbol: symbol,\n type: type\n };\n }\n }\n attributeMainStr.push(symbol);\n }\n\n return 'attribute ' + type + ' ' + attributeMainStr.join(',') + ';\\n';\n }\n\n this.attributes = attributes;\n },\n\n _parseDefines: function () {\n var self = this;\n var shaderType = 'vertex';\n this._vertexCode = this._vertexCode.replace(defineRegex, _defineParser);\n shaderType = 'fragment';\n this._fragmentCode = this._fragmentCode.replace(defineRegex, _defineParser);\n\n function _defineParser(str, symbol, value) {\n var defines = shaderType === 'vertex' ? self.vertexDefines : self.fragmentDefines;\n if (!defines[symbol]) { // Haven't been defined by user\n if (value === 'false') {\n defines[symbol] = false;\n }\n else if (value === 'true') {\n defines[symbol] = true;\n }\n else {\n defines[symbol] = value\n // If can parse to float\n ? (isNaN(parseFloat(value)) ? value.trim() : parseFloat(value))\n : null;\n }\n }\n return '';\n }\n },\n\n /**\n * Clone a new shader\n * @return {clay.Shader}\n */\n clone: function () {\n var code = shaderCodeCache[this._shaderID];\n var shader = new Shader(code.vertex, code.fragment);\n return shader;\n }\n};\n\nif (Object.defineProperty) {\n Object.defineProperty(Shader.prototype, 'shaderID', {\n get: function () {\n return this._shaderID;\n }\n });\n Object.defineProperty(Shader.prototype, 'vertex', {\n get: function () {\n return this._vertexCode;\n }\n });\n Object.defineProperty(Shader.prototype, 'fragment', {\n get: function () {\n return this._fragmentCode;\n }\n });\n Object.defineProperty(Shader.prototype, 'uniforms', {\n get: function () {\n return this._uniformList;\n }\n });\n}\n\nvar importRegex = /(@import)\\s*([0-9a-zA-Z_\\-\\.]*)/g;\nShader.parseImport = function (shaderStr) {\n shaderStr = shaderStr.replace(importRegex, function (str, importSymbol, importName) {\n var str = Shader.source(importName);\n if (str) {\n // Recursively parse\n return Shader.parseImport(str);\n }\n else {\n console.error('Shader chunk \"' + importName + '\" not existed in library');\n return '';\n }\n });\n return shaderStr;\n};\n\nvar exportRegex = /(@export)\\s*([0-9a-zA-Z_\\-\\.]*)\\s*\\n([\\s\\S]*?)@end/g;\n\n/**\n * Import shader source\n * @param {string} shaderStr\n * @memberOf clay.Shader\n */\nShader['import'] = function (shaderStr) {\n shaderStr.replace(exportRegex, function (str, exportSymbol, exportName, code) {\n var code = code.replace(/(^[\\s\\t\\xa0\\u3000]+)|([\\u3000\\xa0\\s\\t]+\\x24)/g, '');\n if (code) {\n var parts = exportName.split('.');\n var obj = Shader.codes;\n var i = 0;\n var key;\n while (i < parts.length - 1) {\n key = parts[i++];\n if (!obj[key]) {\n obj[key] = {};\n }\n obj = obj[key];\n }\n key = parts[i];\n obj[key] = code;\n }\n return code;\n });\n};\n\n/**\n * Library to store all the loaded shader codes\n * @type {Object}\n * @readOnly\n * @memberOf clay.Shader\n */\nShader.codes = {};\n\n/**\n * Get shader source\n * @param {string} name\n * @return {string}\n */\nShader.source = function (name) {\n var parts = name.split('.');\n var obj = Shader.codes;\n var i = 0;\n while (obj && i < parts.length) {\n var key = parts[i++];\n obj = obj[key];\n }\n if (typeof obj !== 'string') {\n // FIXME Use default instead\n console.error('Shader \"' + name + '\" not existed in library');\n return '';\n }\n return obj;\n};\n\nexport default Shader;\n","export default \"@export clay.prez.vertex\\nuniform mat4 WVP : WORLDVIEWPROJECTION;\\nattribute vec3 pos : POSITION;\\nattribute vec2 uv : TEXCOORD_0;\\nuniform vec2 uvRepeat : [1.0, 1.0];\\nuniform vec2 uvOffset : [0.0, 0.0];\\n@import clay.chunk.skinning_header\\n@import clay.chunk.instancing_header\\nvarying vec2 v_Texcoord;\\nvoid main()\\n{\\n vec4 P = vec4(pos, 1.0);\\n#ifdef SKINNING\\n @import clay.chunk.skin_matrix\\n P = skinMatrixWS * P;\\n#endif\\n#ifdef INSTANCING\\n @import clay.chunk.instancing_matrix\\n P = instanceMat * P;\\n#endif\\n gl_Position = WVP * P;\\n v_Texcoord = uv * uvRepeat + uvOffset;\\n}\\n@end\\n@export clay.prez.fragment\\nuniform sampler2D alphaMap;\\nuniform float alphaCutoff: 0.0;\\nvarying vec2 v_Texcoord;\\nvoid main()\\n{\\n if (alphaCutoff > 0.0) {\\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\\n discard;\\n }\\n }\\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\\n}\\n@end\";\n","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport {GLMAT_EPSILON, GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 4x4 Matrix\n * @name mat4\n */\n\nvar mat4 = {};\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.create = function() {\n var out = new GLMAT_ARRAY_TYPE(16);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {mat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\nmat4.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a03 = a[3],\n a12 = a[6], a13 = a[7],\n a23 = a[11];\n\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n};\n\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));\n out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));\n return out;\n};\n\n/**\n * Calculates the determinant of a mat4\n *\n * @param {mat4} a the source matrix\n * @returns {Number} determinant of a\n */\nmat4.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32;\n\n // Calculate the determinant\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n};\n\n/**\n * Multiplies two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the first operand\n * @param {mat4} b the second operand\n * @returns {mat4} out\n */\nmat4.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n // Cache only the current line of the second matrix\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];\n out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];\n out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];\n out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n return out;\n};\n\n/**\n * Multiplies two affine mat4's\n * Add by https://github.com/pissang\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the first operand\n * @param {mat4} b the second operand\n * @returns {mat4} out\n */\nmat4.multiplyAffine = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[4], a11 = a[5], a12 = a[6],\n a20 = a[8], a21 = a[9], a22 = a[10],\n a30 = a[12], a31 = a[13], a32 = a[14];\n\n // Cache only the current line of the second matrix\n var b0 = b[0], b1 = b[1], b2 = b[2];\n out[0] = b0*a00 + b1*a10 + b2*a20;\n out[1] = b0*a01 + b1*a11 + b2*a21;\n out[2] = b0*a02 + b1*a12 + b2*a22;\n // out[3] = 0;\n\n b0 = b[4]; b1 = b[5]; b2 = b[6];\n out[4] = b0*a00 + b1*a10 + b2*a20;\n out[5] = b0*a01 + b1*a11 + b2*a21;\n out[6] = b0*a02 + b1*a12 + b2*a22;\n // out[7] = 0;\n\n b0 = b[8]; b1 = b[9]; b2 = b[10];\n out[8] = b0*a00 + b1*a10 + b2*a20;\n out[9] = b0*a01 + b1*a11 + b2*a21;\n out[10] = b0*a02 + b1*a12 + b2*a22;\n // out[11] = 0;\n\n b0 = b[12]; b1 = b[13]; b2 = b[14];\n out[12] = b0*a00 + b1*a10 + b2*a20 + a30;\n out[13] = b0*a01 + b1*a11 + b2*a21 + a31;\n out[14] = b0*a02 + b1*a12 + b2*a22 + a32;\n // out[15] = 1;\n return out;\n};\n\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\nmat4.mul = mat4.multiply;\n\n/**\n * Alias for {@link mat4.multiplyAffine}\n * @function\n */\nmat4.mulAffine = mat4.multiplyAffine;\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to translate\n * @param {vec3} v vector to translate by\n * @returns {mat4} out\n */\nmat4.translate = function (out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n};\n\n/**\n * Scales the mat4 by the dimensions in the given vec3\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to scale\n * @param {vec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\nmat4.scale = function(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Rotates a mat4 by the given angle\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {vec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nmat4.rotate = function (out, a, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2],\n len = Math.sqrt(x * x + y * y + z * z),\n s, c, t,\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23,\n b00, b01, b02,\n b10, b11, b12,\n b20, b21, b22;\n\n if (Math.abs(len) < GLMAT_EPSILON) { return null; }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n // Construct the elements of the rotation matrix\n b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;\n b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;\n b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;\n\n // Perform rotation-specific matrix multiplication\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateX = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateY = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateZ = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n};\n\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @returns {mat4} out\n */\nmat4.fromRotationTranslation = function (out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n};\n\nmat4.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.frustum = function (out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left),\n tb = 1 / (top - bottom),\n nf = 1 / (near - far);\n out[0] = (near * 2) * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = (near * 2) * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (far * near * 2) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a perspective projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.perspective = function (out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf = 1 / (near - far);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (2 * far * near) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a orthogonal projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.ortho = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {vec3} eye Position of the viewer\n * @param {vec3} center Point the viewer is looking at\n * @param {vec3} up vec3 pointing up\n * @returns {mat4} out\n */\nmat4.lookAt = function (out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,\n eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2],\n centerx = center[0],\n centery = center[1],\n centerz = center[2];\n\n if (Math.abs(eyex - centerx) < GLMAT_EPSILON &&\n Math.abs(eyey - centery) < GLMAT_EPSILON &&\n Math.abs(eyez - centerz) < GLMAT_EPSILON) {\n return mat4.identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {mat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat4.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))\n};\n\nexport default mat4;","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_RANDOM, GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 3 Dimensional Vector\n * @name vec3\n */\n\nvar vec3 = {};\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\nvec3.create = function() {\n var out = new GLMAT_ARRAY_TYPE(3);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {vec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\nvec3.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\nvec3.fromValues = function(x, y, z) {\n var out = new GLMAT_ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the source vector\n * @returns {vec3} out\n */\nvec3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\nvec3.set = function(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\nvec3.sub = vec3.subtract;\n\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\nvec3.mul = vec3.multiply;\n\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\nvec3.div = vec3.divide;\n\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n};\n\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\nvec3.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n};\n\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\nvec3.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} distance between a and b\n */\nvec3.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\nvec3.dist = vec3.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec3.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\nvec3.sqrDist = vec3.squaredDistance;\n\n/**\n * Calculates the length of a vec3\n *\n * @param {vec3} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec3.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.length}\n * @function\n */\nvec3.len = vec3.length;\n\n/**\n * Calculates the squared length of a vec3\n *\n * @param {vec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec3.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\nvec3.sqrLen = vec3.squaredLength;\n\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to negate\n * @returns {vec3} out\n */\nvec3.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to invert\n * @returns {vec3} out\n */\nvec3.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n};\n\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to normalize\n * @returns {vec3} out\n */\nvec3.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var len = x*x + y*y + z*z;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec3.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n};\n\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.cross = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2],\n bx = b[0], by = b[1], bz = b[2];\n\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec3} out\n */\nvec3.random = function (out, scale) {\n scale = scale || 1.0;\n\n var r = GLMAT_RANDOM() * 2.0 * Math.PI;\n var z = (GLMAT_RANDOM() * 2.0) - 1.0;\n var zScale = Math.sqrt(1.0-z*z) * scale;\n\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2],\n w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat3 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n};\n\n/**\n * Transforms the vec3 with a quat\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec3} out\n */\nvec3.transformQuat = function(out, a, q) {\n // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations\n\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return out;\n};\n\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateX = function(out, a, b, c){\n var p = [], r=[];\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);\n r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);\n\n //translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n\n return out;\n};\n\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateY = function(out, a, b, c){\n var p = [], r=[];\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);\n r[1] = p[1];\n r[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);\n\n //translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n\n return out;\n};\n\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateZ = function(out, a, b, c){\n var p = [], r=[];\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);\n r[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);\n r[2] = p[2];\n\n //translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n\n return out;\n};\n\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec3.forEach = (function() {\n var vec = vec3.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 3;\n }\n\n if(!offset) {\n offset = 0;\n }\n\n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];\n }\n\n return a;\n };\n})();\n\n/**\n * Get the angle between two 3D vectors\n * @param {vec3} a The first operand\n * @param {vec3} b The second operand\n * @returns {Number} The angle in radians\n */\nvec3.angle = function(a, b) {\n\n var tempA = vec3.fromValues(a[0], a[1], a[2]);\n var tempB = vec3.fromValues(b[0], b[1], b[2]);\n\n vec3.normalize(tempA, tempA);\n vec3.normalize(tempB, tempB);\n\n var cosine = vec3.dot(tempA, tempB);\n\n if(cosine > 1.0){\n return 0;\n } else {\n return Math.acos(cosine);\n }\n};\n\nexport default vec3;","// TODO Resources like shader, texture, geometry reference management\n// Trace and find out which shader, texture, geometry can be destroyed\nimport Base from './core/Base';\nimport GLInfo from './core/GLInfo';\nimport glenum from './core/glenum';\nimport vendor from './core/vendor';\n\nimport Material from './Material';\nimport Vector2 from './math/Vector2';\nimport ProgramManager from './gpu/ProgramManager';\n\n// Light header\nimport Shader from './Shader';\n\nimport prezEssl from './shader/source/prez.glsl.js';\nShader['import'](prezEssl);\n\nimport mat4 from './glmatrix/mat4';\nimport vec3 from './glmatrix/vec3';\n\nvar mat4Create = mat4.create;\n\nvar errorShader = {};\n\nfunction defaultGetMaterial(renderable) {\n return renderable.material;\n}\nfunction defaultGetUniform(renderable, material, symbol) {\n return material.uniforms[symbol].value;\n}\nfunction defaultIsMaterialChanged(renderabled, prevRenderable, material, prevMaterial) {\n return material !== prevMaterial;\n}\nfunction defaultIfRender(renderable) {\n return true;\n}\n\nfunction noop() {}\n\nvar attributeBufferTypeMap = {\n float: glenum.FLOAT,\n byte: glenum.BYTE,\n ubyte: glenum.UNSIGNED_BYTE,\n short: glenum.SHORT,\n ushort: glenum.UNSIGNED_SHORT\n};\n\nfunction VertexArrayObject(availableAttributes, availableAttributeSymbols, indicesBuffer) {\n this.availableAttributes = availableAttributes;\n this.availableAttributeSymbols = availableAttributeSymbols;\n this.indicesBuffer = indicesBuffer;\n\n this.vao = null;\n}\n\nfunction PlaceHolderTexture(renderer) {\n var blankCanvas;\n var webglTexture;\n this.bind = function (renderer) {\n if (!blankCanvas) {\n // TODO Environment not support createCanvas.\n blankCanvas = vendor.createCanvas();\n blankCanvas.width = blankCanvas.height = 1;\n blankCanvas.getContext('2d');\n }\n\n var gl = renderer.gl;\n var firstBind = !webglTexture;\n if (firstBind) {\n webglTexture = gl.createTexture();\n }\n gl.bindTexture(gl.TEXTURE_2D, webglTexture);\n if (firstBind) {\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, blankCanvas);\n }\n };\n this.unbind = function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, null);\n };\n this.isRenderable = function () {\n return true;\n };\n}\n/**\n * @constructor clay.Renderer\n * @extends clay.core.Base\n */\nvar Renderer = Base.extend(function () {\n return /** @lends clay.Renderer# */ {\n\n /**\n * @type {HTMLCanvasElement}\n * @readonly\n */\n canvas: null,\n\n /**\n * Canvas width, set by resize method\n * @type {number}\n * @private\n */\n _width: 100,\n\n /**\n * Canvas width, set by resize method\n * @type {number}\n * @private\n */\n _height: 100,\n\n /**\n * Device pixel ratio, set by setDevicePixelRatio method\n * Specially for high defination display\n * @see http://www.khronos.org/webgl/wiki/HandlingHighDPI\n * @type {number}\n * @private\n */\n devicePixelRatio: (typeof window !== 'undefined' && window.devicePixelRatio) || 1.0,\n\n /**\n * Clear color\n * @type {number[]}\n */\n clearColor: [0.0, 0.0, 0.0, 0.0],\n\n /**\n * Default:\n * _gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT | _gl.STENCIL_BUFFER_BIT\n * @type {number}\n */\n clearBit: 17664,\n\n // Settings when getting context\n // http://www.khronos.org/registry/webgl/specs/latest/#2.4\n\n /**\n * If enable alpha, default true\n * @type {boolean}\n */\n alpha: true,\n /**\n * If enable depth buffer, default true\n * @type {boolean}\n */\n depth: true,\n /**\n * If enable stencil buffer, default false\n * @type {boolean}\n */\n stencil: false,\n /**\n * If enable antialias, default true\n * @type {boolean}\n */\n antialias: true,\n /**\n * If enable premultiplied alpha, default true\n * @type {boolean}\n */\n premultipliedAlpha: true,\n /**\n * If preserve drawing buffer, default false\n * @type {boolean}\n */\n preserveDrawingBuffer: false,\n /**\n * If throw context error, usually turned on in debug mode\n * @type {boolean}\n */\n throwError: true,\n /**\n * WebGL Context created from given canvas\n * @type {WebGLRenderingContext}\n */\n gl: null,\n /**\n * Renderer viewport, read-only, can be set by setViewport method\n * @type {Object}\n */\n viewport: {},\n\n /**\n * Max joint number\n * @type {number}\n */\n maxJointNumber: 20,\n\n // Set by FrameBuffer#bind\n __currentFrameBuffer: null,\n\n _viewportStack: [],\n _clearStack: [],\n\n _sceneRendering: null\n };\n}, function () {\n\n if (!this.canvas) {\n this.canvas = vendor.createCanvas();\n }\n var canvas = this.canvas;\n try {\n var opts = {\n alpha: this.alpha,\n depth: this.depth,\n stencil: this.stencil,\n antialias: this.antialias,\n premultipliedAlpha: this.premultipliedAlpha,\n preserveDrawingBuffer: this.preserveDrawingBuffer\n };\n\n this.gl = canvas.getContext('webgl', opts)\n || canvas.getContext('experimental-webgl', opts);\n\n if (!this.gl) {\n throw new Error();\n }\n\n this._glinfo = new GLInfo(this.gl);\n\n if (this.gl.targetRenderer) {\n console.error('Already created a renderer');\n }\n this.gl.targetRenderer = this;\n\n this.resize();\n }\n catch (e) {\n throw 'Error creating WebGL Context ' + e;\n }\n\n // Init managers\n this._programMgr = new ProgramManager(this);\n\n this._placeholderTexture = new PlaceHolderTexture(this);\n},\n/** @lends clay.Renderer.prototype. **/\n{\n /**\n * Resize the canvas\n * @param {number} width\n * @param {number} height\n */\n resize: function(width, height) {\n var canvas = this.canvas;\n // http://www.khronos.org/webgl/wiki/HandlingHighDPI\n // set the display size of the canvas.\n var dpr = this.devicePixelRatio;\n if (width != null) {\n if (canvas.style) {\n canvas.style.width = width + 'px';\n canvas.style.height = height + 'px';\n }\n // set the size of the drawingBuffer\n canvas.width = width * dpr;\n canvas.height = height * dpr;\n\n this._width = width;\n this._height = height;\n }\n else {\n this._width = canvas.width / dpr;\n this._height = canvas.height / dpr;\n }\n\n this.setViewport(0, 0, this._width, this._height);\n },\n\n /**\n * Get renderer width\n * @return {number}\n */\n getWidth: function () {\n return this._width;\n },\n\n /**\n * Get renderer height\n * @return {number}\n */\n getHeight: function () {\n return this._height;\n },\n\n /**\n * Get viewport aspect,\n * @return {number}\n */\n getViewportAspect: function () {\n var viewport = this.viewport;\n return viewport.width / viewport.height;\n },\n\n /**\n * Set devicePixelRatio\n * @param {number} devicePixelRatio\n */\n setDevicePixelRatio: function(devicePixelRatio) {\n this.devicePixelRatio = devicePixelRatio;\n this.resize(this._width, this._height);\n },\n\n /**\n * Get devicePixelRatio\n * @param {number} devicePixelRatio\n */\n getDevicePixelRatio: function () {\n return this.devicePixelRatio;\n },\n\n /**\n * Get WebGL extension\n * @param {string} name\n * @return {object}\n */\n getGLExtension: function (name) {\n return this._glinfo.getExtension(name);\n },\n\n /**\n * Get WebGL parameter\n * @param {string} name\n * @return {*}\n */\n getGLParameter: function (name) {\n return this._glinfo.getParameter(name);\n },\n\n /**\n * Set rendering viewport\n * @param {number|Object} x\n * @param {number} [y]\n * @param {number} [width]\n * @param {number} [height]\n * @param {number} [devicePixelRatio]\n * Defaultly use the renderere devicePixelRatio\n * It needs to be 1 when setViewport is called by frameBuffer\n *\n * @example\n * setViewport(0,0,width,height,1)\n * setViewport({\n * x: 0,\n * y: 0,\n * width: width,\n * height: height,\n * devicePixelRatio: 1\n * })\n */\n setViewport: function (x, y, width, height, dpr) {\n\n if (typeof x === 'object') {\n var obj = x;\n\n x = obj.x;\n y = obj.y;\n width = obj.width;\n height = obj.height;\n dpr = obj.devicePixelRatio;\n }\n dpr = dpr || this.devicePixelRatio;\n\n this.gl.viewport(\n x * dpr, y * dpr, width * dpr, height * dpr\n );\n // Use a fresh new object, not write property.\n this.viewport = {\n x: x,\n y: y,\n width: width,\n height: height,\n devicePixelRatio: dpr\n };\n },\n\n /**\n * Push current viewport into a stack\n */\n saveViewport: function () {\n this._viewportStack.push(this.viewport);\n },\n\n /**\n * Pop viewport from stack, restore in the renderer\n */\n restoreViewport: function () {\n if (this._viewportStack.length > 0) {\n this.setViewport(this._viewportStack.pop());\n }\n },\n\n /**\n * Push current clear into a stack\n */\n saveClear: function () {\n this._clearStack.push({\n clearBit: this.clearBit,\n clearColor: this.clearColor\n });\n },\n\n /**\n * Pop clear from stack, restore in the renderer\n */\n restoreClear: function () {\n if (this._clearStack.length > 0) {\n var opt = this._clearStack.pop();\n this.clearColor = opt.clearColor;\n this.clearBit = opt.clearBit;\n }\n },\n\n bindSceneRendering: function (scene) {\n this._sceneRendering = scene;\n },\n\n /**\n * Render the scene in camera to the screen or binded offline framebuffer\n * @param {clay.Scene} scene\n * @param {clay.Camera} camera\n * @param {boolean} [notUpdateScene] If not call the scene.update methods in the rendering, default true\n * @param {boolean} [preZ] If use preZ optimization, default false\n * @return {IRenderInfo}\n */\n render: function(scene, camera, notUpdateScene, preZ) {\n var _gl = this.gl;\n\n var clearColor = this.clearColor;\n\n if (this.clearBit) {\n\n // Must set depth and color mask true before clear\n _gl.colorMask(true, true, true, true);\n _gl.depthMask(true);\n var viewport = this.viewport;\n var needsScissor = false;\n var viewportDpr = viewport.devicePixelRatio;\n if (viewport.width !== this._width || viewport.height !== this._height\n || (viewportDpr && viewportDpr !== this.devicePixelRatio)\n || viewport.x || viewport.y\n ) {\n needsScissor = true;\n // http://stackoverflow.com/questions/11544608/how-to-clear-a-rectangle-area-in-webgl\n // Only clear the viewport\n _gl.enable(_gl.SCISSOR_TEST);\n _gl.scissor(viewport.x * viewportDpr, viewport.y * viewportDpr, viewport.width * viewportDpr, viewport.height * viewportDpr);\n }\n _gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);\n _gl.clear(this.clearBit);\n if (needsScissor) {\n _gl.disable(_gl.SCISSOR_TEST);\n }\n }\n\n // If the scene have been updated in the prepass like shadow map\n // There is no need to update it again\n if (!notUpdateScene) {\n scene.update(false);\n }\n scene.updateLights();\n\n camera = camera || scene.getMainCamera();\n if (!camera) {\n console.error('Can\\'t find camera in the scene.');\n return;\n }\n camera.update();\n var renderList = scene.updateRenderList(camera, true);\n\n this._sceneRendering = scene;\n\n var opaqueList = renderList.opaque;\n var transparentList = renderList.transparent;\n var sceneMaterial = scene.material;\n\n scene.trigger('beforerender', this, scene, camera, renderList);\n\n // Render pre z\n if (preZ) {\n this.renderPreZ(opaqueList, scene, camera);\n _gl.depthFunc(_gl.LEQUAL);\n }\n else {\n _gl.depthFunc(_gl.LESS);\n }\n\n // Update the depth of transparent list.\n var worldViewMat = mat4Create();\n var posViewSpace = vec3.create();\n for (var i = 0; i < transparentList.length; i++) {\n var renderable = transparentList[i];\n mat4.multiplyAffine(worldViewMat, camera.viewMatrix.array, renderable.worldTransform.array);\n vec3.transformMat4(posViewSpace, renderable.position.array, worldViewMat);\n renderable.__depth = posViewSpace[2];\n }\n\n // Render opaque list\n this.renderPass(opaqueList, camera, {\n getMaterial: function (renderable) {\n return sceneMaterial || renderable.material;\n },\n sortCompare: this.opaqueSortCompare\n });\n\n this.renderPass(transparentList, camera, {\n getMaterial: function (renderable) {\n return sceneMaterial || renderable.material;\n },\n sortCompare: this.transparentSortCompare\n });\n\n scene.trigger('afterrender', this, scene, camera, renderList);\n\n // Cleanup\n this._sceneRendering = null;\n },\n\n getProgram: function (renderable, renderMaterial, scene) {\n renderMaterial = renderMaterial || renderable.material;\n return this._programMgr.getProgram(renderable, renderMaterial, scene);\n },\n\n validateProgram: function (program) {\n if (program.__error) {\n var errorMsg = program.__error;\n if (errorShader[program.__uid__]) {\n return;\n }\n errorShader[program.__uid__] = true;\n\n if (this.throwError) {\n throw new Error(errorMsg);\n }\n else {\n this.trigger('error', errorMsg);\n }\n\n }\n\n },\n\n updatePrograms: function (list, scene, passConfig) {\n var getMaterial = (passConfig && passConfig.getMaterial) || defaultGetMaterial;\n scene = scene || null;\n for (var i = 0; i < list.length; i++) {\n var renderable = list[i];\n var renderMaterial = getMaterial.call(this, renderable);\n if (i > 0) {\n var prevRenderable = list[i - 1];\n var prevJointsLen = prevRenderable.joints ? prevRenderable.joints.length : 0;\n var jointsLen = renderable.joints ? renderable.joints.length : 0;\n // Keep program not change if joints, material, lightGroup are same of two renderables.\n if (jointsLen === prevJointsLen\n && renderable.material === prevRenderable.material\n && renderable.lightGroup === prevRenderable.lightGroup\n ) {\n renderable.__program = prevRenderable.__program;\n continue;\n }\n }\n\n var program = this._programMgr.getProgram(renderable, renderMaterial, scene);\n\n this.validateProgram(program);\n\n renderable.__program = program;\n }\n },\n\n /**\n * Render a single renderable list in camera in sequence\n * @param {clay.Renderable[]} list List of all renderables.\n * @param {clay.Camera} [camera] Camera provide view matrix and porjection matrix. It can be null.\n * @param {Object} [passConfig]\n * @param {Function} [passConfig.getMaterial] Get renderable material.\n * @param {Function} [passConfig.getUniform] Get material uniform value.\n * @param {Function} [passConfig.isMaterialChanged] If material changed.\n * @param {Function} [passConfig.beforeRender] Before render each renderable.\n * @param {Function} [passConfig.afterRender] After render each renderable\n * @param {Function} [passConfig.ifRender] If render the renderable.\n * @param {Function} [passConfig.sortCompare] Sort compare function.\n * @return {IRenderInfo}\n */\n renderPass: function(list, camera, passConfig) {\n this.trigger('beforerenderpass', this, list, camera, passConfig);\n\n passConfig = passConfig || {};\n passConfig.getMaterial = passConfig.getMaterial || defaultGetMaterial;\n passConfig.getUniform = passConfig.getUniform || defaultGetUniform;\n // PENDING Better solution?\n passConfig.isMaterialChanged = passConfig.isMaterialChanged || defaultIsMaterialChanged;\n passConfig.beforeRender = passConfig.beforeRender || noop;\n passConfig.afterRender = passConfig.afterRender || noop;\n\n var ifRenderObject = passConfig.ifRender || defaultIfRender;\n\n this.updatePrograms(list, this._sceneRendering, passConfig);\n if (passConfig.sortCompare) {\n list.sort(passConfig.sortCompare);\n }\n\n // Some common builtin uniforms\n var viewport = this.viewport;\n var vDpr = viewport.devicePixelRatio;\n var viewportUniform = [\n viewport.x * vDpr, viewport.y * vDpr,\n viewport.width * vDpr, viewport.height * vDpr\n ];\n var windowDpr = this.devicePixelRatio;\n var windowSizeUniform = this.__currentFrameBuffer\n ? [this.__currentFrameBuffer.getTextureWidth(), this.__currentFrameBuffer.getTextureHeight()]\n : [this._width * windowDpr, this._height * windowDpr];\n // DEPRECATED\n var viewportSizeUniform = [\n viewportUniform[2], viewportUniform[3]\n ];\n var time = Date.now();\n\n // Calculate view and projection matrix\n if (camera) {\n mat4.copy(matrices.VIEW, camera.viewMatrix.array);\n mat4.copy(matrices.PROJECTION, camera.projectionMatrix.array);\n mat4.copy(matrices.VIEWINVERSE, camera.worldTransform.array);\n }\n else {\n mat4.identity(matrices.VIEW);\n mat4.identity(matrices.PROJECTION);\n mat4.identity(matrices.VIEWINVERSE);\n }\n mat4.multiply(matrices.VIEWPROJECTION, matrices.PROJECTION, matrices.VIEW);\n mat4.invert(matrices.PROJECTIONINVERSE, matrices.PROJECTION);\n mat4.invert(matrices.VIEWPROJECTIONINVERSE, matrices.VIEWPROJECTION);\n\n var _gl = this.gl;\n var scene = this._sceneRendering;\n\n var prevMaterial;\n var prevProgram;\n var prevRenderable;\n\n // Status\n var depthTest, depthMask;\n var culling, cullFace, frontFace;\n var transparent;\n var drawID;\n var currentVAO;\n var materialTakesTextureSlot;\n\n // var vaoExt = this.getGLExtension('OES_vertex_array_object');\n // not use vaoExt, some platforms may mess it up.\n var vaoExt = null;\n\n for (var i = 0; i < list.length; i++) {\n var renderable = list[i];\n var isSceneNode = renderable.worldTransform != null;\n var worldM;\n\n if (!ifRenderObject(renderable)) {\n continue;\n }\n\n // Skinned mesh will transformed to joint space. Ignore the mesh transform\n if (isSceneNode) {\n worldM = (renderable.isSkinnedMesh && renderable.isSkinnedMesh())\n // TODO\n ? (renderable.offsetMatrix ? renderable.offsetMatrix.array :matrices.IDENTITY)\n : renderable.worldTransform.array;\n }\n var geometry = renderable.geometry;\n var material = passConfig.getMaterial.call(this, renderable);\n\n var program = renderable.__program;\n var shader = material.shader;\n\n var currentDrawID = geometry.__uid__ + '-' + program.__uid__;\n var drawIDChanged = currentDrawID !== drawID;\n drawID = currentDrawID;\n if (drawIDChanged && vaoExt) {\n // TODO Seems need to be bound to null immediately (or before bind another program?) if vao is changed\n vaoExt.bindVertexArrayOES(null);\n }\n if (isSceneNode) {\n mat4.copy(matrices.WORLD, worldM);\n mat4.multiply(matrices.WORLDVIEWPROJECTION, matrices.VIEWPROJECTION, worldM);\n mat4.multiplyAffine(matrices.WORLDVIEW, matrices.VIEW, worldM);\n if (shader.matrixSemantics.WORLDINVERSE ||\n shader.matrixSemantics.WORLDINVERSETRANSPOSE) {\n mat4.invert(matrices.WORLDINVERSE, worldM);\n }\n if (shader.matrixSemantics.WORLDVIEWINVERSE ||\n shader.matrixSemantics.WORLDVIEWINVERSETRANSPOSE) {\n mat4.invert(matrices.WORLDVIEWINVERSE, matrices.WORLDVIEW);\n }\n if (shader.matrixSemantics.WORLDVIEWPROJECTIONINVERSE ||\n shader.matrixSemantics.WORLDVIEWPROJECTIONINVERSETRANSPOSE) {\n mat4.invert(matrices.WORLDVIEWPROJECTIONINVERSE, matrices.WORLDVIEWPROJECTION);\n }\n }\n\n // Before render hook\n renderable.beforeRender && renderable.beforeRender(this);\n passConfig.beforeRender.call(this, renderable, material, prevMaterial);\n\n var programChanged = program !== prevProgram;\n if (programChanged) {\n // Set lights number\n program.bind(this);\n // Set some common uniforms\n program.setUniformOfSemantic(_gl, 'VIEWPORT', viewportUniform);\n program.setUniformOfSemantic(_gl, 'WINDOW_SIZE', windowSizeUniform);\n if (camera) {\n program.setUniformOfSemantic(_gl, 'NEAR', camera.near);\n program.setUniformOfSemantic(_gl, 'FAR', camera.far);\n }\n program.setUniformOfSemantic(_gl, 'DEVICEPIXELRATIO', vDpr);\n program.setUniformOfSemantic(_gl, 'TIME', time);\n // DEPRECATED\n program.setUniformOfSemantic(_gl, 'VIEWPORT_SIZE', viewportSizeUniform);\n\n // Set lights uniforms\n // TODO needs optimized\n if (scene) {\n scene.setLightUniforms(program, renderable.lightGroup, this);\n }\n }\n else {\n program = prevProgram;\n }\n\n // Program changes also needs reset the materials.\n if (programChanged || passConfig.isMaterialChanged(\n renderable, prevRenderable, material, prevMaterial\n )) {\n if (material.depthTest !== depthTest) {\n material.depthTest ? _gl.enable(_gl.DEPTH_TEST) : _gl.disable(_gl.DEPTH_TEST);\n depthTest = material.depthTest;\n }\n if (material.depthMask !== depthMask) {\n _gl.depthMask(material.depthMask);\n depthMask = material.depthMask;\n }\n if (material.transparent !== transparent) {\n material.transparent ? _gl.enable(_gl.BLEND) : _gl.disable(_gl.BLEND);\n transparent = material.transparent;\n }\n // TODO cache blending\n if (material.transparent) {\n if (material.blend) {\n material.blend(_gl);\n }\n else {\n // Default blend function\n _gl.blendEquationSeparate(_gl.FUNC_ADD, _gl.FUNC_ADD);\n _gl.blendFuncSeparate(_gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA);\n }\n }\n\n materialTakesTextureSlot = this._bindMaterial(\n renderable, material, program,\n prevRenderable || null, prevMaterial || null, prevProgram || null,\n passConfig.getUniform\n );\n prevMaterial = material;\n }\n\n var matrixSemanticKeys = shader.matrixSemanticKeys;\n\n if (isSceneNode) {\n for (var k = 0; k < matrixSemanticKeys.length; k++) {\n var semantic = matrixSemanticKeys[k];\n var semanticInfo = shader.matrixSemantics[semantic];\n var matrix = matrices[semantic];\n if (semanticInfo.isTranspose) {\n var matrixNoTranspose = matrices[semanticInfo.semanticNoTranspose];\n mat4.transpose(matrix, matrixNoTranspose);\n }\n program.setUniform(_gl, semanticInfo.type, semanticInfo.symbol, matrix);\n }\n }\n\n if (renderable.cullFace !== cullFace) {\n cullFace = renderable.cullFace;\n _gl.cullFace(cullFace);\n }\n if (renderable.frontFace !== frontFace) {\n frontFace = renderable.frontFace;\n _gl.frontFace(frontFace);\n }\n if (renderable.culling !== culling) {\n culling = renderable.culling;\n culling ? _gl.enable(_gl.CULL_FACE) : _gl.disable(_gl.CULL_FACE);\n }\n // TODO Not update skeleton in each renderable.\n this._updateSkeleton(renderable, program, materialTakesTextureSlot);\n if (drawIDChanged) {\n currentVAO = this._bindVAO(vaoExt, shader, geometry, program);\n }\n this._renderObject(renderable, currentVAO, program);\n\n // After render hook\n passConfig.afterRender(this, renderable);\n renderable.afterRender && renderable.afterRender(this);\n\n prevProgram = program;\n prevRenderable = renderable;\n }\n\n // TODO Seems need to be bound to null immediately if vao is changed?\n if (vaoExt) {\n vaoExt.bindVertexArrayOES(null);\n }\n\n this.trigger('afterrenderpass', this, list, camera, passConfig);\n },\n\n getMaxJointNumber: function () {\n return this.maxJointNumber;\n },\n\n _updateSkeleton: function (object, program, slot) {\n var _gl = this.gl;\n var skeleton = object.skeleton;\n // Set pose matrices of skinned mesh\n if (skeleton) {\n // TODO Update before culling.\n skeleton.update();\n if (object.joints.length > this.getMaxJointNumber()) {\n var skinMatricesTexture = skeleton.getSubSkinMatricesTexture(object.__uid__, object.joints);\n program.useTextureSlot(this, skinMatricesTexture, slot);\n program.setUniform(_gl, '1i', 'skinMatricesTexture', slot);\n program.setUniform(_gl, '1f', 'skinMatricesTextureSize', skinMatricesTexture.width);\n }\n else {\n var skinMatricesArray = skeleton.getSubSkinMatrices(object.__uid__, object.joints);\n program.setUniformOfSemantic(_gl, 'SKIN_MATRIX', skinMatricesArray);\n }\n }\n },\n\n _renderObject: function (renderable, vao, program) {\n var _gl = this.gl;\n var geometry = renderable.geometry;\n\n var glDrawMode = renderable.mode;\n if (glDrawMode == null) {\n glDrawMode = 0x0004;\n }\n\n var ext = null;\n var isInstanced = renderable.isInstancedMesh && renderable.isInstancedMesh();\n if (isInstanced) {\n ext = this.getGLExtension('ANGLE_instanced_arrays');\n if (!ext) {\n console.warn('Device not support ANGLE_instanced_arrays extension');\n return;\n }\n }\n\n var instancedAttrLocations;\n if (isInstanced) {\n instancedAttrLocations = this._bindInstancedAttributes(renderable, program, ext);\n }\n\n if (vao.indicesBuffer) {\n var uintExt = this.getGLExtension('OES_element_index_uint');\n var useUintExt = uintExt && (geometry.indices instanceof Uint32Array);\n var indicesType = useUintExt ? _gl.UNSIGNED_INT : _gl.UNSIGNED_SHORT;\n\n if (isInstanced) {\n ext.drawElementsInstancedANGLE(\n glDrawMode, vao.indicesBuffer.count, indicesType, 0, renderable.getInstanceCount()\n );\n }\n else {\n _gl.drawElements(glDrawMode, vao.indicesBuffer.count, indicesType, 0);\n }\n }\n else {\n if (isInstanced) {\n ext.drawArraysInstancedANGLE(glDrawMode, 0, geometry.vertexCount, renderable.getInstanceCount());\n }\n else {\n // FIXME Use vertex number in buffer\n // vertexCount may get the wrong value when geometry forget to mark dirty after update\n _gl.drawArrays(glDrawMode, 0, geometry.vertexCount);\n }\n }\n\n if (isInstanced) {\n for (var i = 0; i < instancedAttrLocations.length; i++) {\n _gl.disableVertexAttribArray(instancedAttrLocations[i]);\n }\n }\n },\n\n _bindInstancedAttributes: function (renderable, program, ext) {\n var _gl = this.gl;\n var instancedBuffers = renderable.getInstancedAttributesBuffers(this);\n var locations = [];\n\n for (var i = 0; i < instancedBuffers.length; i++) {\n var bufferObj = instancedBuffers[i];\n var location = program.getAttribLocation(_gl, bufferObj.symbol);\n if (location < 0) {\n continue;\n }\n\n var glType = attributeBufferTypeMap[bufferObj.type] || _gl.FLOAT;;\n _gl.enableVertexAttribArray(location); // TODO\n _gl.bindBuffer(_gl.ARRAY_BUFFER, bufferObj.buffer);\n _gl.vertexAttribPointer(location, bufferObj.size, glType, false, 0, 0);\n ext.vertexAttribDivisorANGLE(location, bufferObj.divisor);\n\n locations.push(location);\n }\n\n return locations;\n },\n\n _bindMaterial: function (renderable, material, program, prevRenderable, prevMaterial, prevProgram, getUniformValue) {\n var _gl = this.gl;\n // PENDING Same texture in different material take different slot?\n\n // May use shader of other material if shader code are same\n var sameProgram = prevProgram === program;\n\n var currentTextureSlot = program.currentTextureSlot();\n var enabledUniforms = material.getEnabledUniforms();\n var textureUniforms = material.getTextureUniforms();\n var placeholderTexture = this._placeholderTexture;\n\n for (var u = 0; u < textureUniforms.length; u++) {\n var symbol = textureUniforms[u];\n var uniformValue = getUniformValue(renderable, material, symbol);\n var uniformType = material.uniforms[symbol].type;\n // Not use `instanceof` to determine if a value is texture in Material#bind.\n // Use type instead, in some case texture may be in different namespaces.\n // TODO Duck type validate.\n if (uniformType === 't' && uniformValue) {\n // Reset slot\n uniformValue.__slot = -1;\n }\n else if (uniformType === 'tv') {\n for (var i = 0; i < uniformValue.length; i++) {\n if (uniformValue[i]) {\n uniformValue[i].__slot = -1;\n }\n }\n }\n }\n\n placeholderTexture.__slot = -1;\n\n // Set uniforms\n for (var u = 0; u < enabledUniforms.length; u++) {\n var symbol = enabledUniforms[u];\n var uniform = material.uniforms[symbol];\n var uniformValue = getUniformValue(renderable, material, symbol);\n var uniformType = uniform.type;\n var isTexture = uniformType === 't';\n\n if (isTexture) {\n if (!uniformValue || !uniformValue.isRenderable()) {\n uniformValue = placeholderTexture;\n }\n }\n // PENDING\n // When binding two materials with the same shader\n // Many uniforms will be be set twice even if they have the same value\n // So add a evaluation to see if the uniform is really needed to be set\n if (prevMaterial && sameProgram) {\n var prevUniformValue = getUniformValue(prevRenderable, prevMaterial, symbol);\n if (isTexture) {\n if (!prevUniformValue || !prevUniformValue.isRenderable()) {\n prevUniformValue = placeholderTexture;\n }\n }\n\n if (prevUniformValue === uniformValue) {\n if (isTexture) {\n // Still take the slot to make sure same texture in different materials have same slot.\n program.takeCurrentTextureSlot(this, null);\n }\n else if (uniformType === 'tv' && uniformValue) {\n for (var i = 0; i < uniformValue.length; i++) {\n program.takeCurrentTextureSlot(this, null);\n }\n }\n continue;\n }\n }\n\n if (uniformValue == null) {\n continue;\n }\n else if (isTexture) {\n if (uniformValue.__slot < 0) {\n var slot = program.currentTextureSlot();\n var res = program.setUniform(_gl, '1i', symbol, slot);\n if (res) { // Texture uniform is enabled\n program.takeCurrentTextureSlot(this, uniformValue);\n uniformValue.__slot = slot;\n }\n }\n // Multiple uniform use same texture..\n else {\n program.setUniform(_gl, '1i', symbol, uniformValue.__slot);\n }\n }\n else if (Array.isArray(uniformValue)) {\n if (uniformValue.length === 0) {\n continue;\n }\n // Texture Array\n if (uniformType === 'tv') {\n if (!program.hasUniform(symbol)) {\n continue;\n }\n\n var arr = [];\n for (var i = 0; i < uniformValue.length; i++) {\n var texture = uniformValue[i];\n\n if (texture.__slot < 0) {\n var slot = program.currentTextureSlot();\n arr.push(slot);\n program.takeCurrentTextureSlot(this, texture);\n texture.__slot = slot;\n }\n else {\n arr.push(texture.__slot);\n }\n }\n\n program.setUniform(_gl, '1iv', symbol, arr);\n }\n else {\n program.setUniform(_gl, uniform.type, symbol, uniformValue);\n }\n }\n else{\n program.setUniform(_gl, uniform.type, symbol, uniformValue);\n }\n }\n var newSlot = program.currentTextureSlot();\n // Texture slot maybe used out of material.\n program.resetTextureSlot(currentTextureSlot);\n return newSlot;\n },\n\n _bindVAO: function (vaoExt, shader, geometry, program) {\n var isStatic = !geometry.dynamic;\n var _gl = this.gl;\n\n var vaoId = this.__uid__ + '-' + program.__uid__;\n var vao = geometry.__vaoCache[vaoId];\n if (!vao) {\n var chunks = geometry.getBufferChunks(this);\n if (!chunks || !chunks.length) { // Empty mesh\n return;\n }\n var chunk = chunks[0];\n var attributeBuffers = chunk.attributeBuffers;\n var indicesBuffer = chunk.indicesBuffer;\n\n var availableAttributes = [];\n var availableAttributeSymbols = [];\n for (var a = 0; a < attributeBuffers.length; a++) {\n var attributeBufferInfo = attributeBuffers[a];\n var name = attributeBufferInfo.name;\n var semantic = attributeBufferInfo.semantic;\n var symbol;\n if (semantic) {\n var semanticInfo = shader.attributeSemantics[semantic];\n symbol = semanticInfo && semanticInfo.symbol;\n }\n else {\n symbol = name;\n }\n if (symbol && program.attributes[symbol]) {\n availableAttributes.push(attributeBufferInfo);\n availableAttributeSymbols.push(symbol);\n }\n }\n\n vao = new VertexArrayObject(\n availableAttributes,\n availableAttributeSymbols,\n indicesBuffer\n );\n\n if (isStatic) {\n geometry.__vaoCache[vaoId] = vao;\n }\n }\n\n var needsBindAttributes = true;\n\n // Create vertex object array cost a lot\n // So we don't use it on the dynamic object\n if (vaoExt && isStatic) {\n // Use vertex array object\n // http://blog.tojicode.com/2012/10/oesvertexarrayobject-extension.html\n if (vao.vao == null) {\n vao.vao = vaoExt.createVertexArrayOES();\n }\n else {\n needsBindAttributes = false;\n }\n vaoExt.bindVertexArrayOES(vao.vao);\n }\n\n var availableAttributes = vao.availableAttributes;\n var indicesBuffer = vao.indicesBuffer;\n\n if (needsBindAttributes) {\n var locationList = program.enableAttributes(this, vao.availableAttributeSymbols, (vaoExt && isStatic && vao));\n // Setting attributes;\n for (var a = 0; a < availableAttributes.length; a++) {\n var location = locationList[a];\n if (location === -1) {\n continue;\n }\n var attributeBufferInfo = availableAttributes[a];\n var buffer = attributeBufferInfo.buffer;\n var size = attributeBufferInfo.size;\n var glType = attributeBufferTypeMap[attributeBufferInfo.type] || _gl.FLOAT;\n\n _gl.bindBuffer(_gl.ARRAY_BUFFER, buffer);\n _gl.vertexAttribPointer(location, size, glType, false, 0, 0);\n }\n\n if (geometry.isUseIndices()) {\n _gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER, indicesBuffer.buffer);\n }\n }\n\n return vao;\n },\n\n renderPreZ: function (list, scene, camera) {\n var _gl = this.gl;\n var preZPassMaterial = this._prezMaterial || new Material({\n shader: new Shader(Shader.source('clay.prez.vertex'), Shader.source('clay.prez.fragment'))\n });\n this._prezMaterial = preZPassMaterial;\n\n _gl.colorMask(false, false, false, false);\n _gl.depthMask(true);\n\n // Status\n this.renderPass(list, camera, {\n ifRender: function (renderable) {\n return !renderable.ignorePreZ;\n },\n isMaterialChanged: function (renderable, prevRenderable) {\n var matA = renderable.material;\n var matB = prevRenderable.material;\n return matA.get('diffuseMap') !== matB.get('diffuseMap')\n || (matA.get('alphaCutoff') || 0) !== (matB.get('alphaCutoff') || 0);\n },\n getUniform: function (renderable, depthMaterial, symbol) {\n if (symbol === 'alphaMap') {\n return renderable.material.get('diffuseMap');\n }\n else if (symbol === 'alphaCutoff') {\n if (renderable.material.isDefined('fragment', 'ALPHA_TEST')\n && renderable.material.get('diffuseMap')\n ) {\n var alphaCutoff = renderable.material.get('alphaCutoff');\n return alphaCutoff || 0;\n }\n return 0;\n }\n else if (symbol === 'uvRepeat') {\n return renderable.material.get('uvRepeat');\n }\n else if (symbol === 'uvOffset') {\n return renderable.material.get('uvOffset');\n }\n else {\n return depthMaterial.get(symbol);\n }\n },\n getMaterial: function () {\n return preZPassMaterial;\n },\n sort: this.opaqueSortCompare\n });\n\n _gl.colorMask(true, true, true, true);\n _gl.depthMask(true);\n },\n\n /**\n * Dispose given scene, including all geometris, textures and shaders in the scene\n * @param {clay.Scene} scene\n */\n disposeScene: function(scene) {\n this.disposeNode(scene, true, true);\n scene.dispose();\n },\n\n /**\n * Dispose given node, including all geometries, textures and shaders attached on it or its descendant\n * @param {clay.Node} node\n * @param {boolean} [disposeGeometry=false] If dispose the geometries used in the descendant mesh\n * @param {boolean} [disposeTexture=false] If dispose the textures used in the descendant mesh\n */\n disposeNode: function(root, disposeGeometry, disposeTexture) {\n // Dettached from parent\n if (root.getParent()) {\n root.getParent().remove(root);\n }\n var disposedMap = {};\n root.traverse(function(node) {\n var material = node.material;\n if (node.geometry && disposeGeometry) {\n node.geometry.dispose(this);\n }\n if (disposeTexture && material && !disposedMap[material.__uid__]) {\n var textureUniforms = material.getTextureUniforms();\n for (var u = 0; u < textureUniforms.length; u++) {\n var uniformName = textureUniforms[u];\n var val = material.uniforms[uniformName].value;\n var uniformType = material.uniforms[uniformName].type;\n if (!val) {\n continue;\n }\n if (uniformType === 't') {\n val.dispose && val.dispose(this);\n }\n else if (uniformType === 'tv') {\n for (var k = 0; k < val.length; k++) {\n if (val[k]) {\n val[k].dispose && val[k].dispose(this);\n }\n }\n }\n }\n disposedMap[material.__uid__] = true;\n }\n // Particle system and AmbientCubemap light need to dispose\n if (node.dispose) {\n node.dispose(this);\n }\n }, this);\n },\n\n /**\n * Dispose given geometry\n * @param {clay.Geometry} geometry\n */\n disposeGeometry: function(geometry) {\n geometry.dispose(this);\n },\n\n /**\n * Dispose given texture\n * @param {clay.Texture} texture\n */\n disposeTexture: function(texture) {\n texture.dispose(this);\n },\n\n /**\n * Dispose given frame buffer\n * @param {clay.FrameBuffer} frameBuffer\n */\n disposeFrameBuffer: function(frameBuffer) {\n frameBuffer.dispose(this);\n },\n\n /**\n * Dispose renderer\n */\n dispose: function () {},\n\n /**\n * Convert screen coords to normalized device coordinates(NDC)\n * Screen coords can get from mouse event, it is positioned relative to canvas element\n * NDC can be used in ray casting with Camera.prototype.castRay methods\n *\n * @param {number} x\n * @param {number} y\n * @param {clay.Vector2} [out]\n * @return {clay.Vector2}\n */\n screenToNDC: function(x, y, out) {\n if (!out) {\n out = new Vector2();\n }\n // Invert y;\n y = this._height - y;\n\n var viewport = this.viewport;\n var arr = out.array;\n arr[0] = (x - viewport.x) / viewport.width;\n arr[0] = arr[0] * 2 - 1;\n arr[1] = (y - viewport.y) / viewport.height;\n arr[1] = arr[1] * 2 - 1;\n\n return out;\n }\n});\n\n/**\n * Opaque renderables compare function\n * @param {clay.Renderable} x\n * @param {clay.Renderable} y\n * @return {boolean}\n * @static\n */\nRenderer.opaqueSortCompare = Renderer.prototype.opaqueSortCompare = function(x, y) {\n // Priority renderOrder -> program -> material -> geometry\n if (x.renderOrder === y.renderOrder) {\n if (x.__program === y.__program) {\n if (x.material === y.material) {\n return x.geometry.__uid__ - y.geometry.__uid__;\n }\n return x.material.__uid__ - y.material.__uid__;\n }\n if (x.__program && y.__program) {\n return x.__program.__uid__ - y.__program.__uid__;\n }\n return 0;\n }\n return x.renderOrder - y.renderOrder;\n};\n\n/**\n * Transparent renderables compare function\n * @param {clay.Renderable} a\n * @param {clay.Renderable} b\n * @return {boolean}\n * @static\n */\nRenderer.transparentSortCompare = Renderer.prototype.transparentSortCompare = function(x, y) {\n // Priority renderOrder -> depth -> program -> material -> geometry\n\n if (x.renderOrder === y.renderOrder) {\n if (x.__depth === y.__depth) {\n if (x.__program === y.__program) {\n if (x.material === y.material) {\n return x.geometry.__uid__ - y.geometry.__uid__;\n }\n return x.material.__uid__ - y.material.__uid__;\n }\n if (x.__program && y.__program) {\n return x.__program.__uid__ - y.__program.__uid__;\n }\n return 0;\n }\n // Depth is negative\n // So farther object has smaller depth value\n return x.__depth - y.__depth;\n }\n return x.renderOrder - y.renderOrder;\n};\n\n// Temporary variables\nvar matrices = {\n IDENTITY: mat4Create(),\n\n WORLD: mat4Create(),\n VIEW: mat4Create(),\n PROJECTION: mat4Create(),\n WORLDVIEW: mat4Create(),\n VIEWPROJECTION: mat4Create(),\n WORLDVIEWPROJECTION: mat4Create(),\n\n WORLDINVERSE: mat4Create(),\n VIEWINVERSE: mat4Create(),\n PROJECTIONINVERSE: mat4Create(),\n WORLDVIEWINVERSE: mat4Create(),\n VIEWPROJECTIONINVERSE: mat4Create(),\n WORLDVIEWPROJECTIONINVERSE: mat4Create(),\n\n WORLDTRANSPOSE: mat4Create(),\n VIEWTRANSPOSE: mat4Create(),\n PROJECTIONTRANSPOSE: mat4Create(),\n WORLDVIEWTRANSPOSE: mat4Create(),\n VIEWPROJECTIONTRANSPOSE: mat4Create(),\n WORLDVIEWPROJECTIONTRANSPOSE: mat4Create(),\n WORLDINVERSETRANSPOSE: mat4Create(),\n VIEWINVERSETRANSPOSE: mat4Create(),\n PROJECTIONINVERSETRANSPOSE: mat4Create(),\n WORLDVIEWINVERSETRANSPOSE: mat4Create(),\n VIEWPROJECTIONINVERSETRANSPOSE: mat4Create(),\n WORLDVIEWPROJECTIONINVERSETRANSPOSE: mat4Create()\n};\n\n/**\n * @name clay.Renderer.COLOR_BUFFER_BIT\n * @type {number}\n */\nRenderer.COLOR_BUFFER_BIT = glenum.COLOR_BUFFER_BIT;\n/**\n * @name clay.Renderer.DEPTH_BUFFER_BIT\n * @type {number}\n */\nRenderer.DEPTH_BUFFER_BIT = glenum.DEPTH_BUFFER_BIT;\n/**\n * @name clay.Renderer.STENCIL_BUFFER_BIT\n * @type {number}\n */\nRenderer.STENCIL_BUFFER_BIT = glenum.STENCIL_BUFFER_BIT;\n\nexport default Renderer;\n","import vec3 from '../glmatrix/vec3';\n\n/**\n * @constructor\n * @alias clay.Vector3\n * @param {number} x\n * @param {number} y\n * @param {number} z\n */\nvar Vector3 = function(x, y, z) {\n\n x = x || 0;\n y = y || 0;\n z = z || 0;\n\n /**\n * Storage of Vector3, read and write of x, y, z will change the values in array\n * All methods also operate on the array instead of x, y, z components\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Vector3#\n */\n this.array = vec3.fromValues(x, y, z);\n\n /**\n * Dirty flag is used by the Node to determine\n * if the matrix is updated to latest\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Vector3#\n */\n this._dirty = true;\n};\n\nVector3.prototype = {\n\n constructor: Vector3,\n\n /**\n * Add b to self\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n add: function (b) {\n vec3.add(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y and z components\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @return {clay.Vector3}\n */\n set: function (x, y, z) {\n this.array[0] = x;\n this.array[1] = y;\n this.array[2] = z;\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y and z components from array\n * @param {Float32Array|number[]} arr\n * @return {clay.Vector3}\n */\n setArray: function (arr) {\n this.array[0] = arr[0];\n this.array[1] = arr[1];\n this.array[2] = arr[2];\n\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Vector3\n * @return {clay.Vector3}\n */\n clone: function () {\n return new Vector3(this.x, this.y, this.z);\n },\n\n /**\n * Copy from b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n copy: function (b) {\n vec3.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Cross product of self and b, written to a Vector3 out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n cross: function (a, b) {\n vec3.cross(this.array, a.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for distance\n * @param {clay.Vector3} b\n * @return {number}\n */\n dist: function (b) {\n return vec3.dist(this.array, b.array);\n },\n\n /**\n * Distance between self and b\n * @param {clay.Vector3} b\n * @return {number}\n */\n distance: function (b) {\n return vec3.distance(this.array, b.array);\n },\n\n /**\n * Alias for divide\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n div: function (b) {\n vec3.div(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Divide self by b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n divide: function (b) {\n vec3.divide(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Dot product of self and b\n * @param {clay.Vector3} b\n * @return {number}\n */\n dot: function (b) {\n return vec3.dot(this.array, b.array);\n },\n\n /**\n * Alias of length\n * @return {number}\n */\n len: function () {\n return vec3.len(this.array);\n },\n\n /**\n * Calculate the length\n * @return {number}\n */\n length: function () {\n return vec3.length(this.array);\n },\n /**\n * Linear interpolation between a and b\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @param {number} t\n * @return {clay.Vector3}\n */\n lerp: function (a, b, t) {\n vec3.lerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Minimum of self and b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n min: function (b) {\n vec3.min(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Maximum of self and b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n max: function (b) {\n vec3.max(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiply\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n mul: function (b) {\n vec3.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply self and b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n multiply: function (b) {\n vec3.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Negate self\n * @return {clay.Vector3}\n */\n negate: function () {\n vec3.negate(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Normalize self\n * @return {clay.Vector3}\n */\n normalize: function () {\n vec3.normalize(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Generate random x, y, z components with a given scale\n * @param {number} scale\n * @return {clay.Vector3}\n */\n random: function (scale) {\n vec3.random(this.array, scale);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self\n * @param {number} scale\n * @return {clay.Vector3}\n */\n scale: function (s) {\n vec3.scale(this.array, this.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale b and add to self\n * @param {clay.Vector3} b\n * @param {number} scale\n * @return {clay.Vector3}\n */\n scaleAndAdd: function (b, s) {\n vec3.scaleAndAdd(this.array, this.array, b.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for squaredDistance\n * @param {clay.Vector3} b\n * @return {number}\n */\n sqrDist: function (b) {\n return vec3.sqrDist(this.array, b.array);\n },\n\n /**\n * Squared distance between self and b\n * @param {clay.Vector3} b\n * @return {number}\n */\n squaredDistance: function (b) {\n return vec3.squaredDistance(this.array, b.array);\n },\n\n /**\n * Alias for squaredLength\n * @return {number}\n */\n sqrLen: function () {\n return vec3.sqrLen(this.array);\n },\n\n /**\n * Squared length of self\n * @return {number}\n */\n squaredLength: function () {\n return vec3.squaredLength(this.array);\n },\n\n /**\n * Alias for subtract\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n sub: function (b) {\n vec3.sub(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Subtract b from self\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n subtract: function (b) {\n vec3.subtract(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix3 m\n * @param {clay.Matrix3} m\n * @return {clay.Vector3}\n */\n transformMat3: function (m) {\n vec3.transformMat3(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix4 m\n * @param {clay.Matrix4} m\n * @return {clay.Vector3}\n */\n transformMat4: function (m) {\n vec3.transformMat4(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n /**\n * Transform self with a Quaternion q\n * @param {clay.Quaternion} q\n * @return {clay.Vector3}\n */\n transformQuat: function (q) {\n vec3.transformQuat(this.array, this.array, q.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Trasnform self into projection space with m\n * @param {clay.Matrix4} m\n * @return {clay.Vector3}\n */\n applyProjection: function (m) {\n var v = this.array;\n m = m.array;\n\n // Perspective projection\n if (m[15] === 0) {\n var w = -1 / v[2];\n v[0] = m[0] * v[0] * w;\n v[1] = m[5] * v[1] * w;\n v[2] = (m[10] * v[2] + m[14]) * w;\n }\n else {\n v[0] = m[0] * v[0] + m[12];\n v[1] = m[5] * v[1] + m[13];\n v[2] = m[10] * v[2] + m[14];\n }\n this._dirty = true;\n\n return this;\n },\n\n eulerFromQuat: function(q, order) {\n Vector3.eulerFromQuat(this, q, order);\n },\n\n eulerFromMat3: function (m, order) {\n Vector3.eulerFromMat3(this, m, order);\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\nvar defineProperty = Object.defineProperty;\n// Getter and Setter\nif (defineProperty) {\n\n var proto = Vector3.prototype;\n /**\n * @name x\n * @type {number}\n * @memberOf clay.Vector3\n * @instance\n */\n defineProperty(proto, 'x', {\n get: function () {\n return this.array[0];\n },\n set: function (value) {\n this.array[0] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name y\n * @type {number}\n * @memberOf clay.Vector3\n * @instance\n */\n defineProperty(proto, 'y', {\n get: function () {\n return this.array[1];\n },\n set: function (value) {\n this.array[1] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name z\n * @type {number}\n * @memberOf clay.Vector3\n * @instance\n */\n defineProperty(proto, 'z', {\n get: function () {\n return this.array[2];\n },\n set: function (value) {\n this.array[2] = value;\n this._dirty = true;\n }\n });\n}\n\n\n// Supply methods that are not in place\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.add = function(out, a, b) {\n vec3.add(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @return {clay.Vector3}\n */\nVector3.set = function(out, x, y, z) {\n vec3.set(out.array, x, y, z);\n out._dirty = true;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.copy = function(out, b) {\n vec3.copy(out.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.cross = function(out, a, b) {\n vec3.cross(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.dist = function(a, b) {\n return vec3.distance(a.array, b.array);\n};\n\n/**\n * @function\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.distance = Vector3.dist;\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.div = function(out, a, b) {\n vec3.divide(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.divide = Vector3.div;\n\n/**\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.dot = function(a, b) {\n return vec3.dot(a.array, b.array);\n};\n\n/**\n * @param {clay.Vector3} a\n * @return {number}\n */\nVector3.len = function(b) {\n return vec3.length(b.array);\n};\n\n// Vector3.length = Vector3.len;\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @param {number} t\n * @return {clay.Vector3}\n */\nVector3.lerp = function(out, a, b, t) {\n vec3.lerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.min = function(out, a, b) {\n vec3.min(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.max = function(out, a, b) {\n vec3.max(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.mul = function(out, a, b) {\n vec3.multiply(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.multiply = Vector3.mul;\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @return {clay.Vector3}\n */\nVector3.negate = function(out, a) {\n vec3.negate(out.array, a.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @return {clay.Vector3}\n */\nVector3.normalize = function(out, a) {\n vec3.normalize(out.array, a.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {number} scale\n * @return {clay.Vector3}\n */\nVector3.random = function(out, scale) {\n vec3.random(out.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {number} scale\n * @return {clay.Vector3}\n */\nVector3.scale = function(out, a, scale) {\n vec3.scale(out.array, a.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @param {number} scale\n * @return {clay.Vector3}\n */\nVector3.scaleAndAdd = function(out, a, b, scale) {\n vec3.scaleAndAdd(out.array, a.array, b.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.sqrDist = function(a, b) {\n return vec3.sqrDist(a.array, b.array);\n};\n/**\n * @function\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.squaredDistance = Vector3.sqrDist;\n/**\n * @param {clay.Vector3} a\n * @return {number}\n */\nVector3.sqrLen = function(a) {\n return vec3.sqrLen(a.array);\n};\n/**\n * @function\n * @param {clay.Vector3} a\n * @return {number}\n */\nVector3.squaredLength = Vector3.sqrLen;\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.sub = function(out, a, b) {\n vec3.subtract(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.subtract = Vector3.sub;\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {Matrix3} m\n * @return {clay.Vector3}\n */\nVector3.transformMat3 = function(out, a, m) {\n vec3.transformMat3(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Matrix4} m\n * @return {clay.Vector3}\n */\nVector3.transformMat4 = function(out, a, m) {\n vec3.transformMat4(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Quaternion} q\n * @return {clay.Vector3}\n */\nVector3.transformQuat = function(out, a, q) {\n vec3.transformQuat(out.array, a.array, q.array);\n out._dirty = true;\n return out;\n};\n\nfunction clamp(val, min, max) {\n return val < min ? min : (val > max ? max : val);\n}\nvar atan2 = Math.atan2;\nvar asin = Math.asin;\nvar abs = Math.abs;\n/**\n * Convert quaternion to euler angle\n * Quaternion must be normalized\n * From three.js\n */\nVector3.eulerFromQuat = function (out, q, order) {\n out._dirty = true;\n q = q.array;\n\n var target = out.array;\n var x = q[0], y = q[1], z = q[2], w = q[3];\n var x2 = x * x;\n var y2 = y * y;\n var z2 = z * z;\n var w2 = w * w;\n\n var order = (order || 'XYZ').toUpperCase();\n\n switch (order) {\n case 'XYZ':\n target[0] = atan2(2 * (x * w - y * z), (w2 - x2 - y2 + z2));\n target[1] = asin(clamp(2 * (x * z + y * w), - 1, 1));\n target[2] = atan2(2 * (z * w - x * y), (w2 + x2 - y2 - z2));\n break;\n case 'YXZ':\n target[0] = asin(clamp(2 * (x * w - y * z), - 1, 1));\n target[1] = atan2(2 * (x * z + y * w), (w2 - x2 - y2 + z2));\n target[2] = atan2(2 * (x * y + z * w), (w2 - x2 + y2 - z2));\n break;\n case 'ZXY':\n target[0] = asin(clamp(2 * (x * w + y * z), - 1, 1));\n target[1] = atan2(2 * (y * w - z * x), (w2 - x2 - y2 + z2));\n target[2] = atan2(2 * (z * w - x * y), (w2 - x2 + y2 - z2));\n break;\n case 'ZYX':\n target[0] = atan2(2 * (x * w + z * y), (w2 - x2 - y2 + z2));\n target[1] = asin(clamp(2 * (y * w - x * z), - 1, 1));\n target[2] = atan2(2 * (x * y + z * w), (w2 + x2 - y2 - z2));\n break;\n case 'YZX':\n target[0] = atan2(2 * (x * w - z * y), (w2 - x2 + y2 - z2));\n target[1] = atan2(2 * (y * w - x * z), (w2 + x2 - y2 - z2));\n target[2] = asin(clamp(2 * (x * y + z * w), - 1, 1));\n break;\n case 'XZY':\n target[0] = atan2(2 * (x * w + y * z), (w2 - x2 + y2 - z2));\n target[1] = atan2(2 * (x * z + y * w), (w2 + x2 - y2 - z2));\n target[2] = asin(clamp(2 * (z * w - x * y), - 1, 1));\n break;\n default:\n console.warn('Unkown order: ' + order);\n }\n return out;\n};\n\n/**\n * Convert rotation matrix to euler angle\n * from three.js\n */\nVector3.eulerFromMat3 = function (out, m, order) {\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n var te = m.array;\n var m11 = te[0], m12 = te[3], m13 = te[6];\n var m21 = te[1], m22 = te[4], m23 = te[7];\n var m31 = te[2], m32 = te[5], m33 = te[8];\n var target = out.array;\n\n var order = (order || 'XYZ').toUpperCase();\n\n switch (order) {\n case 'XYZ':\n target[1] = asin(clamp(m13, -1, 1));\n if (abs(m13) < 0.99999) {\n target[0] = atan2(-m23, m33);\n target[2] = atan2(-m12, m11);\n }\n else {\n target[0] = atan2(m32, m22);\n target[2] = 0;\n }\n break;\n case 'YXZ':\n target[0] = asin(-clamp(m23, -1, 1));\n if (abs(m23) < 0.99999) {\n target[1] = atan2(m13, m33);\n target[2] = atan2(m21, m22);\n }\n else {\n target[1] = atan2(-m31, m11);\n target[2] = 0;\n }\n break;\n case 'ZXY':\n target[0] = asin(clamp(m32, -1, 1));\n if (abs(m32) < 0.99999) {\n target[1] = atan2(-m31, m33);\n target[2] = atan2(-m12, m22);\n }\n else {\n target[1] = 0;\n target[2] = atan2(m21, m11);\n }\n break;\n case 'ZYX':\n target[1] = asin(-clamp(m31, -1, 1));\n if (abs(m31) < 0.99999) {\n target[0] = atan2(m32, m33);\n target[2] = atan2(m21, m11);\n }\n else {\n target[0] = 0;\n target[2] = atan2(-m12, m22);\n }\n break;\n case 'YZX':\n target[2] = asin(clamp(m21, -1, 1));\n if (abs(m21) < 0.99999) {\n target[0] = atan2(-m23, m22);\n target[1] = atan2(-m31, m11);\n }\n else {\n target[0] = 0;\n target[1] = atan2(m13, m33);\n }\n break;\n case 'XZY':\n target[2] = asin(-clamp(m12, -1, 1));\n if (abs(m12) < 0.99999) {\n target[0] = atan2(m32, m22);\n target[1] = atan2(m13, m11);\n }\n else {\n target[0] = atan2(-m23, m33);\n target[1] = 0;\n }\n break;\n default:\n console.warn('Unkown order: ' + order);\n }\n out._dirty = true;\n\n return out;\n};\n\nObject.defineProperties(Vector3, {\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n POSITIVE_X: {\n get: function () {\n return new Vector3(1, 0, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n NEGATIVE_X: {\n get: function () {\n return new Vector3(-1, 0, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n POSITIVE_Y: {\n get: function () {\n return new Vector3(0, 1, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n NEGATIVE_Y: {\n get: function () {\n return new Vector3(0, -1, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n POSITIVE_Z: {\n get: function () {\n return new Vector3(0, 0, 1);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n */\n NEGATIVE_Z: {\n get: function () {\n return new Vector3(0, 0, -1);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n UP: {\n get: function () {\n return new Vector3(0, 1, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n ZERO: {\n get: function () {\n return new Vector3();\n }\n }\n});\n\nexport default Vector3;\n","import Vector3 from './Vector3';\nimport vec3 from '../glmatrix/vec3';\n\nvar EPSILON = 1e-5;\n\n/**\n * @constructor\n * @alias clay.Ray\n * @param {clay.Vector3} [origin]\n * @param {clay.Vector3} [direction]\n */\nvar Ray = function (origin, direction) {\n /**\n * @type {clay.Vector3}\n */\n this.origin = origin || new Vector3();\n /**\n * @type {clay.Vector3}\n */\n this.direction = direction || new Vector3();\n};\n\nRay.prototype = {\n\n constructor: Ray,\n\n // http://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm\n /**\n * Calculate intersection point between ray and a give plane\n * @param {clay.Plane} plane\n * @param {clay.Vector3} [out]\n * @return {clay.Vector3}\n */\n intersectPlane: function (plane, out) {\n var pn = plane.normal.array;\n var d = plane.distance;\n var ro = this.origin.array;\n var rd = this.direction.array;\n\n var divider = vec3.dot(pn, rd);\n // ray is parallel to the plane\n if (divider === 0) {\n return null;\n }\n if (!out) {\n out = new Vector3();\n }\n var t = (vec3.dot(pn, ro) - d) / divider;\n vec3.scaleAndAdd(out.array, ro, rd, -t);\n out._dirty = true;\n return out;\n },\n\n /**\n * Mirror the ray against plane\n * @param {clay.Plane} plane\n */\n mirrorAgainstPlane: function (plane) {\n // Distance to plane\n var d = vec3.dot(plane.normal.array, this.direction.array);\n vec3.scaleAndAdd(this.direction.array, this.direction.array, plane.normal.array, -d * 2);\n this.direction._dirty = true;\n },\n\n distanceToPoint: (function () {\n var v = vec3.create();\n return function (point) {\n vec3.sub(v, point, this.origin.array);\n // Distance from projection point to origin\n var b = vec3.dot(v, this.direction.array);\n if (b < 0) {\n return vec3.distance(this.origin.array, point);\n }\n // Squared distance from center to origin\n var c2 = vec3.lenSquared(v);\n // Squared distance from center to projection point\n return Math.sqrt(c2 - b * b);\n };\n })(),\n\n /**\n * Calculate intersection point between ray and sphere\n * @param {clay.Vector3} center\n * @param {number} radius\n * @param {clay.Vector3} out\n * @return {clay.Vector3}\n */\n intersectSphere: (function () {\n var v = vec3.create();\n return function (center, radius, out) {\n var origin = this.origin.array;\n var direction = this.direction.array;\n center = center.array;\n vec3.sub(v, center, origin);\n // Distance from projection point to origin\n var b = vec3.dot(v, direction);\n // Squared distance from center to origin\n var c2 = vec3.squaredLength(v);\n // Squared distance from center to projection point\n var d2 = c2 - b * b;\n\n var r2 = radius * radius;\n // No intersection\n if (d2 > r2) {\n return;\n }\n\n var a = Math.sqrt(r2 - d2);\n // First intersect point\n var t0 = b - a;\n // Second intersect point\n var t1 = b + a;\n\n if (!out) {\n out = new Vector3();\n }\n if (t0 < 0) {\n if (t1 < 0) {\n return null;\n }\n else {\n vec3.scaleAndAdd(out.array, origin, direction, t1);\n return out;\n }\n }\n else {\n vec3.scaleAndAdd(out.array, origin, direction, t0);\n return out;\n }\n };\n })(),\n\n // http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/\n /**\n * Calculate intersection point between ray and bounding box\n * @param {clay.BoundingBox} bbox\n * @param {clay.Vector3}\n * @return {clay.Vector3}\n */\n intersectBoundingBox: function (bbox, out) {\n var dir = this.direction.array;\n var origin = this.origin.array;\n var min = bbox.min.array;\n var max = bbox.max.array;\n\n var invdirx = 1 / dir[0];\n var invdiry = 1 / dir[1];\n var invdirz = 1 / dir[2];\n\n var tmin, tmax, tymin, tymax, tzmin, tzmax;\n if (invdirx >= 0) {\n tmin = (min[0] - origin[0]) * invdirx;\n tmax = (max[0] - origin[0]) * invdirx;\n }\n else {\n tmax = (min[0] - origin[0]) * invdirx;\n tmin = (max[0] - origin[0]) * invdirx;\n }\n if (invdiry >= 0) {\n tymin = (min[1] - origin[1]) * invdiry;\n tymax = (max[1] - origin[1]) * invdiry;\n }\n else {\n tymax = (min[1] - origin[1]) * invdiry;\n tymin = (max[1] - origin[1]) * invdiry;\n }\n\n if ((tmin > tymax) || (tymin > tmax)) {\n return null;\n }\n\n if (tymin > tmin || tmin !== tmin) {\n tmin = tymin;\n }\n if (tymax < tmax || tmax !== tmax) {\n tmax = tymax;\n }\n\n if (invdirz >= 0) {\n tzmin = (min[2] - origin[2]) * invdirz;\n tzmax = (max[2] - origin[2]) * invdirz;\n }\n else {\n tzmax = (min[2] - origin[2]) * invdirz;\n tzmin = (max[2] - origin[2]) * invdirz;\n }\n\n if ((tmin > tzmax) || (tzmin > tmax)) {\n return null;\n }\n\n if (tzmin > tmin || tmin !== tmin) {\n tmin = tzmin;\n }\n if (tzmax < tmax || tmax !== tmax) {\n tmax = tzmax;\n }\n if (tmax < 0) {\n return null;\n }\n\n var t = tmin >= 0 ? tmin : tmax;\n\n if (!out) {\n out = new Vector3();\n }\n vec3.scaleAndAdd(out.array, origin, dir, t);\n return out;\n },\n\n // http://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm\n /**\n * Calculate intersection point between ray and three triangle vertices\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @param {clay.Vector3} c\n * @param {boolean} singleSided, CW triangle will be ignored\n * @param {clay.Vector3} [out]\n * @param {clay.Vector3} [barycenteric] barycentric coords\n * @return {clay.Vector3}\n */\n intersectTriangle: (function () {\n\n var eBA = vec3.create();\n var eCA = vec3.create();\n var AO = vec3.create();\n var vCross = vec3.create();\n\n return function (a, b, c, singleSided, out, barycenteric) {\n var dir = this.direction.array;\n var origin = this.origin.array;\n a = a.array;\n b = b.array;\n c = c.array;\n\n vec3.sub(eBA, b, a);\n vec3.sub(eCA, c, a);\n\n vec3.cross(vCross, eCA, dir);\n\n var det = vec3.dot(eBA, vCross);\n\n if (singleSided) {\n if (det > -EPSILON) {\n return null;\n }\n }\n else {\n if (det > -EPSILON && det < EPSILON) {\n return null;\n }\n }\n\n vec3.sub(AO, origin, a);\n var u = vec3.dot(vCross, AO) / det;\n if (u < 0 || u > 1) {\n return null;\n }\n\n vec3.cross(vCross, eBA, AO);\n var v = vec3.dot(dir, vCross) / det;\n\n if (v < 0 || v > 1 || (u + v > 1)) {\n return null;\n }\n\n vec3.cross(vCross, eBA, eCA);\n var t = -vec3.dot(AO, vCross) / det;\n\n if (t < 0) {\n return null;\n }\n\n if (!out) {\n out = new Vector3();\n }\n if (barycenteric) {\n Vector3.set(barycenteric, (1 - u - v), u, v);\n }\n vec3.scaleAndAdd(out.array, origin, dir, t);\n\n return out;\n };\n })(),\n\n /**\n * Apply an affine transform matrix to the ray\n * @return {clay.Matrix4} matrix\n */\n applyTransform: function (matrix) {\n Vector3.add(this.direction, this.direction, this.origin);\n Vector3.transformMat4(this.origin, this.origin, matrix);\n Vector3.transformMat4(this.direction, this.direction, matrix);\n\n Vector3.sub(this.direction, this.direction, this.origin);\n Vector3.normalize(this.direction, this.direction);\n },\n\n /**\n * Copy values from another ray\n * @param {clay.Ray} ray\n */\n copy: function (ray) {\n Vector3.copy(this.origin, ray.origin);\n Vector3.copy(this.direction, ray.direction);\n },\n\n /**\n * Clone a new ray\n * @return {clay.Ray}\n */\n clone: function () {\n var ray = new Ray();\n ray.copy(this);\n return ray;\n }\n};\n\nexport default Ray;\n","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_RANDOM, GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 4 Dimensional Vector\n * @name vec4\n */\n\nexport var vec4 = {};\n\n/**\n * Creates a new, empty vec4\n *\n * @returns {vec4} a new 4D vector\n */\nvec4.create = function() {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param {vec4} a vector to clone\n * @returns {vec4} a new 4D vector\n */\nvec4.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} a new 4D vector\n */\nvec4.fromValues = function(x, y, z, w) {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Copy the values from one vec4 to another\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the source vector\n * @returns {vec4} out\n */\nvec4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set the components of a vec4 to the given values\n *\n * @param {vec4} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} out\n */\nvec4.set = function(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Adds two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.subtract}\n * @function\n */\nvec4.sub = vec4.subtract;\n\n/**\n * Multiplies two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.multiply}\n * @function\n */\nvec4.mul = vec4.multiply;\n\n/**\n * Divides two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.divide}\n * @function\n */\nvec4.div = vec4.divide;\n\n/**\n * Returns the minimum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n};\n\n/**\n * Scales a vec4 by a scalar number\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec4} out\n */\nvec4.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n};\n\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec4} out\n */\nvec4.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n out[3] = a[3] + (b[3] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} distance between a and b\n */\nvec4.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.distance}\n * @function\n */\nvec4.dist = vec4.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec4.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredDistance}\n * @function\n */\nvec4.sqrDist = vec4.squaredDistance;\n\n/**\n * Calculates the length of a vec4\n *\n * @param {vec4} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec4.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.length}\n * @function\n */\nvec4.len = vec4.length;\n\n/**\n * Calculates the squared length of a vec4\n *\n * @param {vec4} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec4.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredLength}\n * @function\n */\nvec4.sqrLen = vec4.squaredLength;\n\n/**\n * Negates the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to negate\n * @returns {vec4} out\n */\nvec4.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to invert\n * @returns {vec4} out\n */\nvec4.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n};\n\n/**\n * Normalize a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to normalize\n * @returns {vec4} out\n */\nvec4.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var len = x*x + y*y + z*z + w*w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n out[3] = a[3] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec4.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n};\n\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec4} out\n */\nvec4.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec4} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec4} out\n */\nvec4.random = function (out, scale) {\n scale = scale || 1.0;\n\n //TODO: This is a pretty awful way of doing this. Find something better.\n out[0] = GLMAT_RANDOM();\n out[1] = GLMAT_RANDOM();\n out[2] = GLMAT_RANDOM();\n out[3] = GLMAT_RANDOM();\n vec4.normalize(out, out);\n vec4.scale(out, out, scale);\n return out;\n};\n\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec4} out\n */\nvec4.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n};\n\n/**\n * Transforms the vec4 with a quat\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec4} out\n */\nvec4.transformQuat = function(out, a, q) {\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return out;\n};\n\n/**\n * Perform some operation over an array of vec4s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec4.forEach = (function() {\n var vec = vec4.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 4;\n }\n\n if(!offset) {\n offset = 0;\n }\n\n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];\n }\n\n return a;\n };\n})();\n\nexport default vec4;","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 3x3 Matrix\n * @name mat3\n */\n\nvar mat3 = {};\n\n/**\n * Creates a new identity mat3\n *\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.create = function() {\n var out = new GLMAT_ARRAY_TYPE(9);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Copies the upper-left 3x3 values into the given mat3.\n *\n * @param {mat3} out the receiving 3x3 matrix\n * @param {mat4} a the source 4x4 matrix\n * @returns {mat3} out\n */\nmat3.fromMat4 = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n};\n\n/**\n * Creates a new mat3 initialized with values from an existing matrix\n *\n * @param {mat3} a matrix to clone\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Copy the values from one mat3 to another\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Set a mat3 to the identity matrix\n *\n * @param {mat3} out the receiving matrix\n * @returns {mat3} out\n */\nmat3.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n\n return out;\n};\n\n/**\n * Inverts a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b01 = a22 * a11 - a12 * a21,\n b11 = -a22 * a10 + a12 * a20,\n b21 = a21 * a10 - a11 * a20,\n\n // Calculate the determinant\n det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n out[0] = (a11 * a22 - a12 * a21);\n out[1] = (a02 * a21 - a01 * a22);\n out[2] = (a01 * a12 - a02 * a11);\n out[3] = (a12 * a20 - a10 * a22);\n out[4] = (a00 * a22 - a02 * a20);\n out[5] = (a02 * a10 - a00 * a12);\n out[6] = (a10 * a21 - a11 * a20);\n out[7] = (a01 * a20 - a00 * a21);\n out[8] = (a00 * a11 - a01 * a10);\n return out;\n};\n\n/**\n * Calculates the determinant of a mat3\n *\n * @param {mat3} a the source matrix\n * @returns {Number} determinant of a\n */\nmat3.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n};\n\n/**\n * Multiplies two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the first operand\n * @param {mat3} b the second operand\n * @returns {mat3} out\n */\nmat3.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b00 = b[0], b01 = b[1], b02 = b[2],\n b10 = b[3], b11 = b[4], b12 = b[5],\n b20 = b[6], b21 = b[7], b22 = b[8];\n\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n};\n\n/**\n * Alias for {@link mat3.multiply}\n * @function\n */\nmat3.mul = mat3.multiply;\n\n/**\n * Translate a mat3 by the given vector\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to translate\n * @param {vec2} v vector to translate by\n * @returns {mat3} out\n */\nmat3.translate = function(out, a, v) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n x = v[0], y = v[1];\n\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n};\n\n/**\n * Rotates a mat3 by the given angle\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nmat3.rotate = function (out, a, rad) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n s = Math.sin(rad),\n c = Math.cos(rad);\n\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n};\n\n/**\n * Scales the mat3 by the dimensions in the given vec2\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat3} out\n **/\nmat3.scale = function(out, a, v) {\n var x = v[0], y = v[1];\n\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Copies the values from a mat2d into a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat2d} a the matrix to copy\n * @returns {mat3} out\n **/\nmat3.fromMat2d = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n};\n\n/**\n* Calculates a 3x3 matrix from the given quaternion\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {quat} q Quaternion to create matrix from\n*\n* @returns {mat3} out\n*/\nmat3.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n\n return out;\n};\n\n/**\n* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {mat4} a Mat4 to derive the normal matrix from\n*\n* @returns {mat3} out\n*/\nmat3.normalFromMat4 = function (out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n\n return out;\n};\n\n/**\n * Returns Frobenius norm of a mat3\n *\n * @param {mat3} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat3.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))\n};\n\n\nexport default mat3;","\n\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\nimport vec3 from './vec3';\nimport vec4 from './vec4';\nimport mat3 from './mat3';\n\n\n/**\n * @class Quaternion\n * @name quat\n */\n\nvar quat = {};\n\n/**\n * Creates a new identity quat\n *\n * @returns {quat} a new quaternion\n */\nquat.create = function() {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n *\n * @param {quat} out the receiving quaternion.\n * @param {vec3} a the initial vector\n * @param {vec3} b the destination vector\n * @returns {quat} out\n */\nquat.rotationTo = (function() {\n var tmpvec3 = vec3.create();\n var xUnitVec3 = vec3.fromValues(1,0,0);\n var yUnitVec3 = vec3.fromValues(0,1,0);\n\n return function(out, a, b) {\n var dot = vec3.dot(a, b);\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.length(tmpvec3) < 0.000001)\n vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n quat.setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return quat.normalize(out, out);\n }\n };\n})();\n\n/**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n *\n * @param {vec3} view the vector representing the viewing direction\n * @param {vec3} right the vector representing the local \"right\" direction\n * @param {vec3} up the vector representing the local \"up\" direction\n * @returns {quat} out\n */\nquat.setAxes = (function() {\n var matr = mat3.create();\n\n return function(out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n\n return quat.normalize(out, quat.fromMat3(out, matr));\n };\n})();\n\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {quat} a quaternion to clone\n * @returns {quat} a new quaternion\n * @function\n */\nquat.clone = vec4.clone;\n\n/**\n * Creates a new quat initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} a new quaternion\n * @function\n */\nquat.fromValues = vec4.fromValues;\n\n/**\n * Copy the values from one quat to another\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the source quaternion\n * @returns {quat} out\n * @function\n */\nquat.copy = vec4.copy;\n\n/**\n * Set the components of a quat to the given values\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} out\n * @function\n */\nquat.set = vec4.set;\n\n/**\n * Set a quat to the identity quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\nquat.identity = function(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n *\n * @param {quat} out the receiving quaternion\n * @param {vec3} axis the axis around which to rotate\n * @param {Number} rad the angle in radians\n * @returns {quat} out\n **/\nquat.setAxisAngle = function(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n};\n\n/**\n * Adds two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n * @function\n */\nquat.add = vec4.add;\n\n/**\n * Multiplies two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n */\nquat.multiply = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n};\n\n/**\n * Alias for {@link quat.multiply}\n * @function\n */\nquat.mul = quat.multiply;\n\n/**\n * Scales a quat by a scalar number\n *\n * @param {quat} out the receiving vector\n * @param {quat} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {quat} out\n * @function\n */\nquat.scale = vec4.scale;\n\n/**\n * Rotates a quaternion by the given angle about the X axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateX = function (out, a, rad) {\n rad *= 0.5;\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Y axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateY = function (out, a, rad) {\n rad *= 0.5;\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n by = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Z axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateZ = function (out, a, rad) {\n rad *= 0.5;\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bz = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n};\n\n/**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate W component of\n * @returns {quat} out\n */\nquat.calculateW = function (out, a) {\n var x = a[0], y = a[1], z = a[2];\n\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n};\n\n/**\n * Calculates the dot product of two quat's\n *\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\nquat.dot = vec4.dot;\n\n/**\n * Performs a linear interpolation between two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n * @function\n */\nquat.lerp = vec4.lerp;\n\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n */\nquat.slerp = function (out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n var omega, cosom, sinom, scale0, scale1;\n\n // calc cosine\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n // adjust signs (if necessary)\n if ( cosom < 0.0 ) {\n cosom = -cosom;\n bx = - bx;\n by = - by;\n bz = - bz;\n bw = - bw;\n }\n // calculate coefficients\n if ( (1.0 - cosom) > 0.000001 ) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n\n return out;\n};\n\n/**\n * Calculates the inverse of a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate inverse of\n * @returns {quat} out\n */\nquat.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,\n invDot = dot ? 1.0/dot : 0;\n\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0*invDot;\n out[1] = -a1*invDot;\n out[2] = -a2*invDot;\n out[3] = a3*invDot;\n return out;\n};\n\n/**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate conjugate of\n * @returns {quat} out\n */\nquat.conjugate = function (out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Calculates the length of a quat\n *\n * @param {quat} a vector to calculate length of\n * @returns {Number} length of a\n * @function\n */\nquat.length = vec4.length;\n\n/**\n * Alias for {@link quat.length}\n * @function\n */\nquat.len = quat.length;\n\n/**\n * Calculates the squared length of a quat\n *\n * @param {quat} a vector to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\nquat.squaredLength = vec4.squaredLength;\n\n/**\n * Alias for {@link quat.squaredLength}\n * @function\n */\nquat.sqrLen = quat.squaredLength;\n\n/**\n * Normalize a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quaternion to normalize\n * @returns {quat} out\n * @function\n */\nquat.normalize = vec4.normalize;\n\n/**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n *\n * @param {quat} out the receiving quaternion\n * @param {mat3} m rotation matrix\n * @returns {quat} out\n * @function\n */\nquat.fromMat3 = function(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if ( fTrace > 0.0 ) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n out[3] = 0.5 * fRoot;\n fRoot = 0.5/fRoot; // 1/(4w)\n out[0] = (m[5]-m[7])*fRoot;\n out[1] = (m[6]-m[2])*fRoot;\n out[2] = (m[1]-m[3])*fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if ( m[4] > m[0] )\n i = 1;\n if ( m[8] > m[i*3+i] )\n i = 2;\n var j = (i+1)%3;\n var k = (i+2)%3;\n\n fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;\n out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;\n out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;\n }\n\n return out;\n};\n\nexport default quat;","import mat4 from '../glmatrix/mat4';\nimport vec3 from '../glmatrix/vec3';\nimport quat from '../glmatrix/quat';\nimport mat3 from '../glmatrix/mat3';\nimport Vector3 from './Vector3';\n\n/**\n * @constructor\n * @alias clay.Matrix4\n */\nvar Matrix4 = function() {\n\n this._axisX = new Vector3();\n this._axisY = new Vector3();\n this._axisZ = new Vector3();\n\n /**\n * Storage of Matrix4\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Matrix4#\n */\n this.array = mat4.create();\n\n /**\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Matrix4#\n */\n this._dirty = true;\n};\n\nMatrix4.prototype = {\n\n constructor: Matrix4,\n\n /**\n * Set components from array\n * @param {Float32Array|number[]} arr\n */\n setArray: function (arr) {\n for (var i = 0; i < this.array.length; i++) {\n this.array[i] = arr[i];\n }\n this._dirty = true;\n return this;\n },\n /**\n * Calculate the adjugate of self, in-place\n * @return {clay.Matrix4}\n */\n adjoint: function() {\n mat4.adjoint(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Matrix4\n * @return {clay.Matrix4}\n */\n clone: function() {\n return (new Matrix4()).copy(this);\n },\n\n /**\n * Copy from b\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\n copy: function(a) {\n mat4.copy(this.array, a.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate matrix determinant\n * @return {number}\n */\n determinant: function() {\n return mat4.determinant(this.array);\n },\n\n /**\n * Set upper 3x3 part from quaternion\n * @param {clay.Quaternion} q\n * @return {clay.Matrix4}\n */\n fromQuat: function(q) {\n mat4.fromQuat(this.array, q.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set from a quaternion rotation and a vector translation\n * @param {clay.Quaternion} q\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\n fromRotationTranslation: function(q, v) {\n mat4.fromRotationTranslation(this.array, q.array, v.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set from Matrix2d, it is used when converting a 2d shape to 3d space.\n * In 3d space it is equivalent to ranslate on xy plane and rotate about z axis\n * @param {clay.Matrix2d} m2d\n * @return {clay.Matrix4}\n */\n fromMat2d: function(m2d) {\n Matrix4.fromMat2d(this, m2d);\n return this;\n },\n\n /**\n * Set from frustum bounds\n * @param {number} left\n * @param {number} right\n * @param {number} bottom\n * @param {number} top\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\n frustum: function (left, right, bottom, top, near, far) {\n mat4.frustum(this.array, left, right, bottom, top, near, far);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set to a identity matrix\n * @return {clay.Matrix4}\n */\n identity: function() {\n mat4.identity(this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Invert self\n * @return {clay.Matrix4}\n */\n invert: function() {\n mat4.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set as a matrix with the given eye position, focal point, and up axis\n * @param {clay.Vector3} eye\n * @param {clay.Vector3} center\n * @param {clay.Vector3} up\n * @return {clay.Matrix4}\n */\n lookAt: function(eye, center, up) {\n mat4.lookAt(this.array, eye.array, center.array, up.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for mutiply\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\n mul: function(b) {\n mat4.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\n mulLeft: function(a) {\n mat4.mul(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply self and b\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\n multiply: function(b) {\n mat4.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply a and self, a is on the left\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\n multiplyLeft: function(a) {\n mat4.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set as a orthographic projection matrix\n * @param {number} left\n * @param {number} right\n * @param {number} bottom\n * @param {number} top\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\n ortho: function(left, right, bottom, top, near, far) {\n mat4.ortho(this.array, left, right, bottom, top, near, far);\n this._dirty = true;\n return this;\n },\n /**\n * Set as a perspective projection matrix\n * @param {number} fovy\n * @param {number} aspect\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\n perspective: function(fovy, aspect, near, far) {\n mat4.perspective(this.array, fovy, aspect, near, far);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by rad about axis.\n * Equal to right-multiply a rotaion matrix\n * @param {number} rad\n * @param {clay.Vector3} axis\n * @return {clay.Matrix4}\n */\n rotate: function(rad, axis) {\n mat4.rotate(this.array, this.array, rad, axis.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about X axis.\n * Equal to right-multiply a rotaion matrix\n * @param {number} rad\n * @return {clay.Matrix4}\n */\n rotateX: function(rad) {\n mat4.rotateX(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about Y axis.\n * Equal to right-multiply a rotaion matrix\n * @param {number} rad\n * @return {clay.Matrix4}\n */\n rotateY: function(rad) {\n mat4.rotateY(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about Z axis.\n * Equal to right-multiply a rotaion matrix\n * @param {number} rad\n * @return {clay.Matrix4}\n */\n rotateZ: function(rad) {\n mat4.rotateZ(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self by s\n * Equal to right-multiply a scale matrix\n * @param {clay.Vector3} s\n * @return {clay.Matrix4}\n */\n scale: function(v) {\n mat4.scale(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Translate self by v.\n * Equal to right-multiply a translate matrix\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\n translate: function(v) {\n mat4.translate(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transpose self, in-place.\n * @return {clay.Matrix2}\n */\n transpose: function() {\n mat4.transpose(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Decompose a matrix to SRT\n * @param {clay.Vector3} [scale]\n * @param {clay.Quaternion} rotation\n * @param {clay.Vector} position\n * @see http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.matrix.decompose.aspx\n */\n decomposeMatrix: (function() {\n\n var x = vec3.create();\n var y = vec3.create();\n var z = vec3.create();\n\n var m3 = mat3.create();\n\n return function(scale, rotation, position) {\n\n var el = this.array;\n vec3.set(x, el[0], el[1], el[2]);\n vec3.set(y, el[4], el[5], el[6]);\n vec3.set(z, el[8], el[9], el[10]);\n\n var sx = vec3.length(x);\n var sy = vec3.length(y);\n var sz = vec3.length(z);\n\n // if determine is negative, we need to invert one scale\n var det = this.determinant();\n if (det < 0) {\n sx = -sx;\n }\n\n if (scale) {\n scale.set(sx, sy, sz);\n }\n\n position.set(el[12], el[13], el[14]);\n\n mat3.fromMat4(m3, el);\n // Not like mat4, mat3 in glmatrix seems to be row-based\n // Seems fixed in gl-matrix 2.2.2\n // https://github.com/toji/gl-matrix/issues/114\n // mat3.transpose(m3, m3);\n\n m3[0] /= sx;\n m3[1] /= sx;\n m3[2] /= sx;\n\n m3[3] /= sy;\n m3[4] /= sy;\n m3[5] /= sy;\n\n m3[6] /= sz;\n m3[7] /= sz;\n m3[8] /= sz;\n\n quat.fromMat3(rotation.array, m3);\n quat.normalize(rotation.array, rotation.array);\n\n rotation._dirty = true;\n position._dirty = true;\n };\n })(),\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\nvar defineProperty = Object.defineProperty;\n\nif (defineProperty) {\n var proto = Matrix4.prototype;\n /**\n * Z Axis of local transform\n * @name z\n * @type {clay.Vector3}\n * @memberOf clay.Matrix4\n * @instance\n */\n defineProperty(proto, 'z', {\n get: function () {\n var el = this.array;\n this._axisZ.set(el[8], el[9], el[10]);\n return this._axisZ;\n },\n set: function (v) {\n // TODO Here has a problem\n // If only set an item of vector will not work\n var el = this.array;\n v = v.array;\n el[8] = v[0];\n el[9] = v[1];\n el[10] = v[2];\n\n this._dirty = true;\n }\n });\n\n /**\n * Y Axis of local transform\n * @name y\n * @type {clay.Vector3}\n * @memberOf clay.Matrix4\n * @instance\n */\n defineProperty(proto, 'y', {\n get: function () {\n var el = this.array;\n this._axisY.set(el[4], el[5], el[6]);\n return this._axisY;\n },\n set: function (v) {\n var el = this.array;\n v = v.array;\n el[4] = v[0];\n el[5] = v[1];\n el[6] = v[2];\n\n this._dirty = true;\n }\n });\n\n /**\n * X Axis of local transform\n * @name x\n * @type {clay.Vector3}\n * @memberOf clay.Matrix4\n * @instance\n */\n defineProperty(proto, 'x', {\n get: function () {\n var el = this.array;\n this._axisX.set(el[0], el[1], el[2]);\n return this._axisX;\n },\n set: function (v) {\n var el = this.array;\n v = v.array;\n el[0] = v[0];\n el[1] = v[1];\n el[2] = v[2];\n\n this._dirty = true;\n }\n })\n}\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\nMatrix4.adjoint = function(out, a) {\n mat4.adjoint(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\nMatrix4.copy = function(out, a) {\n mat4.copy(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} a\n * @return {number}\n */\nMatrix4.determinant = function(a) {\n return mat4.determinant(a.array);\n};\n\n/**\n * @param {clay.Matrix4} out\n * @return {clay.Matrix4}\n */\nMatrix4.identity = function(out) {\n mat4.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {number} left\n * @param {number} right\n * @param {number} bottom\n * @param {number} top\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\nMatrix4.ortho = function(out, left, right, bottom, top, near, far) {\n mat4.ortho(out.array, left, right, bottom, top, near, far);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {number} fovy\n * @param {number} aspect\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\nMatrix4.perspective = function(out, fovy, aspect, near, far) {\n mat4.perspective(out.array, fovy, aspect, near, far);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Vector3} eye\n * @param {clay.Vector3} center\n * @param {clay.Vector3} up\n * @return {clay.Matrix4}\n */\nMatrix4.lookAt = function(out, eye, center, up) {\n mat4.lookAt(out.array, eye.array, center.array, up.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\nMatrix4.invert = function(out, a) {\n mat4.invert(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\nMatrix4.mul = function(out, a, b) {\n mat4.mul(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\nMatrix4.multiply = Matrix4.mul;\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Quaternion} q\n * @return {clay.Matrix4}\n */\nMatrix4.fromQuat = function(out, q) {\n mat4.fromQuat(out.array, q.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Quaternion} q\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\nMatrix4.fromRotationTranslation = function(out, q, v) {\n mat4.fromRotationTranslation(out.array, q.array, v.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} m4\n * @param {clay.Matrix2d} m2d\n * @return {clay.Matrix4}\n */\nMatrix4.fromMat2d = function(m4, m2d) {\n m4._dirty = true;\n var m2d = m2d.array;\n var m4 = m4.array;\n\n m4[0] = m2d[0];\n m4[4] = m2d[2];\n m4[12] = m2d[4];\n\n m4[1] = m2d[1];\n m4[5] = m2d[3];\n m4[13] = m2d[5];\n\n return m4;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {number} rad\n * @param {clay.Vector3} axis\n * @return {clay.Matrix4}\n */\nMatrix4.rotate = function(out, a, rad, axis) {\n mat4.rotate(out.array, a.array, rad, axis.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {number} rad\n * @return {clay.Matrix4}\n */\nMatrix4.rotateX = function(out, a, rad) {\n mat4.rotateX(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {number} rad\n * @return {clay.Matrix4}\n */\nMatrix4.rotateY = function(out, a, rad) {\n mat4.rotateY(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {number} rad\n * @return {clay.Matrix4}\n */\nMatrix4.rotateZ = function(out, a, rad) {\n mat4.rotateZ(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\nMatrix4.scale = function(out, a, v) {\n mat4.scale(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\nMatrix4.transpose = function(out, a) {\n mat4.transpose(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\nMatrix4.translate = function(out, a, v) {\n mat4.translate(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\nexport default Matrix4;\n","import quat from '../glmatrix/quat';\nimport mat3 from '../glmatrix/mat3';\n\n/**\n * @constructor\n * @alias clay.Quaternion\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n */\nvar Quaternion = function (x, y, z, w) {\n\n x = x || 0;\n y = y || 0;\n z = z || 0;\n w = w === undefined ? 1 : w;\n\n /**\n * Storage of Quaternion, read and write of x, y, z, w will change the values in array\n * All methods also operate on the array instead of x, y, z, w components\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Quaternion#\n */\n this.array = quat.fromValues(x, y, z, w);\n\n /**\n * Dirty flag is used by the Node to determine\n * if the matrix is updated to latest\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Quaternion#\n */\n this._dirty = true;\n};\n\nQuaternion.prototype = {\n\n constructor: Quaternion,\n\n /**\n * Add b to self\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\n add: function (b) {\n quat.add(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate the w component from x, y, z component\n * @return {clay.Quaternion}\n */\n calculateW: function () {\n quat.calculateW(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y and z components\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n * @return {clay.Quaternion}\n */\n set: function (x, y, z, w) {\n this.array[0] = x;\n this.array[1] = y;\n this.array[2] = z;\n this.array[3] = w;\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y, z and w components from array\n * @param {Float32Array|number[]} arr\n * @return {clay.Quaternion}\n */\n setArray: function (arr) {\n this.array[0] = arr[0];\n this.array[1] = arr[1];\n this.array[2] = arr[2];\n this.array[3] = arr[3];\n\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Quaternion\n * @return {clay.Quaternion}\n */\n clone: function () {\n return new Quaternion(this.x, this.y, this.z, this.w);\n },\n\n /**\n * Calculates the conjugate of self If the quaternion is normalized,\n * this function is faster than invert and produces the same result.\n *\n * @return {clay.Quaternion}\n */\n conjugate: function () {\n quat.conjugate(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Copy from b\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\n copy: function (b) {\n quat.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Dot product of self and b\n * @param {clay.Quaternion} b\n * @return {number}\n */\n dot: function (b) {\n return quat.dot(this.array, b.array);\n },\n\n /**\n * Set from the given 3x3 rotation matrix\n * @param {clay.Matrix3} m\n * @return {clay.Quaternion}\n */\n fromMat3: function (m) {\n quat.fromMat3(this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set from the given 4x4 rotation matrix\n * The 4th column and 4th row will be droped\n * @param {clay.Matrix4} m\n * @return {clay.Quaternion}\n */\n fromMat4: (function () {\n var m3 = mat3.create();\n return function (m) {\n mat3.fromMat4(m3, m.array);\n // TODO Not like mat4, mat3 in glmatrix seems to be row-based\n mat3.transpose(m3, m3);\n quat.fromMat3(this.array, m3);\n this._dirty = true;\n return this;\n };\n })(),\n\n /**\n * Set to identity quaternion\n * @return {clay.Quaternion}\n */\n identity: function () {\n quat.identity(this.array);\n this._dirty = true;\n return this;\n },\n /**\n * Invert self\n * @return {clay.Quaternion}\n */\n invert: function () {\n quat.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n /**\n * Alias of length\n * @return {number}\n */\n len: function () {\n return quat.len(this.array);\n },\n\n /**\n * Calculate the length\n * @return {number}\n */\n length: function () {\n return quat.length(this.array);\n },\n\n /**\n * Linear interpolation between a and b\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @param {number} t\n * @return {clay.Quaternion}\n */\n lerp: function (a, b, t) {\n quat.lerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiply\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\n mul: function (b) {\n quat.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\n mulLeft: function (a) {\n quat.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply self and b\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\n multiply: function (b) {\n quat.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply a and self\n * Quaternion mutiply is not commutative, so the result of mutiplyLeft is different with multiply.\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\n multiplyLeft: function (a) {\n quat.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Normalize self\n * @return {clay.Quaternion}\n */\n normalize: function () {\n quat.normalize(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about X axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\n rotateX: function (rad) {\n quat.rotateX(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about Y axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\n rotateY: function (rad) {\n quat.rotateY(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about Z axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\n rotateZ: function (rad) {\n quat.rotateZ(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Sets self to represent the shortest rotation from Vector3 a to Vector3 b.\n * a and b needs to be normalized\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Quaternion}\n */\n rotationTo: function (a, b) {\n quat.rotationTo(this.array, a.array, b.array);\n this._dirty = true;\n return this;\n },\n /**\n * Sets self with values corresponding to the given axes\n * @param {clay.Vector3} view\n * @param {clay.Vector3} right\n * @param {clay.Vector3} up\n * @return {clay.Quaternion}\n */\n setAxes: function (view, right, up) {\n quat.setAxes(this.array, view.array, right.array, up.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Sets self with a rotation axis and rotation angle\n * @param {clay.Vector3} axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\n setAxisAngle: function (axis, rad) {\n quat.setAxisAngle(this.array, axis.array, rad);\n this._dirty = true;\n return this;\n },\n /**\n * Perform spherical linear interpolation between a and b\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @param {number} t\n * @return {clay.Quaternion}\n */\n slerp: function (a, b, t) {\n quat.slerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for squaredLength\n * @return {number}\n */\n sqrLen: function () {\n return quat.sqrLen(this.array);\n },\n\n /**\n * Squared length of self\n * @return {number}\n */\n squaredLength: function () {\n return quat.squaredLength(this.array);\n },\n\n /**\n * Set from euler\n * @param {clay.Vector3} v\n * @param {String} order\n */\n fromEuler: function (v, order) {\n return Quaternion.fromEuler(this, v, order);\n },\n\n toString: function () {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\nvar defineProperty = Object.defineProperty;\n// Getter and Setter\nif (defineProperty) {\n\n var proto = Quaternion.prototype;\n /**\n * @name x\n * @type {number}\n * @memberOf clay.Quaternion\n * @instance\n */\n defineProperty(proto, 'x', {\n get: function () {\n return this.array[0];\n },\n set: function (value) {\n this.array[0] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name y\n * @type {number}\n * @memberOf clay.Quaternion\n * @instance\n */\n defineProperty(proto, 'y', {\n get: function () {\n return this.array[1];\n },\n set: function (value) {\n this.array[1] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name z\n * @type {number}\n * @memberOf clay.Quaternion\n * @instance\n */\n defineProperty(proto, 'z', {\n get: function () {\n return this.array[2];\n },\n set: function (value) {\n this.array[2] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name w\n * @type {number}\n * @memberOf clay.Quaternion\n * @instance\n */\n defineProperty(proto, 'w', {\n get: function () {\n return this.array[3];\n },\n set: function (value) {\n this.array[3] = value;\n this._dirty = true;\n }\n });\n}\n\n// Supply methods that are not in place\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\nQuaternion.add = function (out, a, b) {\n quat.add(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n * @return {clay.Quaternion}\n */\nQuaternion.set = function (out, x, y, z, w) {\n quat.set(out.array, x, y, z, w);\n out._dirty = true;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\nQuaternion.copy = function (out, b) {\n quat.copy(out.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\nQuaternion.calculateW = function (out, a) {\n quat.calculateW(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\nQuaternion.conjugate = function (out, a) {\n quat.conjugate(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @return {clay.Quaternion}\n */\nQuaternion.identity = function (out) {\n quat.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\nQuaternion.invert = function (out, a) {\n quat.invert(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @return {number}\n */\nQuaternion.dot = function (a, b) {\n return quat.dot(a.array, b.array);\n};\n\n/**\n * @param {clay.Quaternion} a\n * @return {number}\n */\nQuaternion.len = function (a) {\n return quat.length(a.array);\n};\n\n// Quaternion.length = Quaternion.len;\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @param {number} t\n * @return {clay.Quaternion}\n */\nQuaternion.lerp = function (out, a, b, t) {\n quat.lerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @param {number} t\n * @return {clay.Quaternion}\n */\nQuaternion.slerp = function (out, a, b, t) {\n quat.slerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\nQuaternion.mul = function (out, a, b) {\n quat.multiply(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\nQuaternion.multiply = Quaternion.mul;\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {number} rad\n * @return {clay.Quaternion}\n */\nQuaternion.rotateX = function (out, a, rad) {\n quat.rotateX(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {number} rad\n * @return {clay.Quaternion}\n */\nQuaternion.rotateY = function (out, a, rad) {\n quat.rotateY(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {number} rad\n * @return {clay.Quaternion}\n */\nQuaternion.rotateZ = function (out, a, rad) {\n quat.rotateZ(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Vector3} axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\nQuaternion.setAxisAngle = function (out, axis, rad) {\n quat.setAxisAngle(out.array, axis.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\nQuaternion.normalize = function (out, a) {\n quat.normalize(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} a\n * @return {number}\n */\nQuaternion.sqrLen = function (a) {\n return quat.sqrLen(a.array);\n};\n\n/**\n * @function\n * @param {clay.Quaternion} a\n * @return {number}\n */\nQuaternion.squaredLength = Quaternion.sqrLen;\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Matrix3} m\n * @return {clay.Quaternion}\n */\nQuaternion.fromMat3 = function (out, m) {\n quat.fromMat3(out.array, m.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Vector3} view\n * @param {clay.Vector3} right\n * @param {clay.Vector3} up\n * @return {clay.Quaternion}\n */\nQuaternion.setAxes = function (out, view, right, up) {\n quat.setAxes(out.array, view.array, right.array, up.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Quaternion}\n */\nQuaternion.rotationTo = function (out, a, b) {\n quat.rotationTo(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * Set quaternion from euler\n * @param {clay.Quaternion} out\n * @param {clay.Vector3} v\n * @param {String} order\n */\nQuaternion.fromEuler = function (out, v, order) {\n\n out._dirty = true;\n\n v = v.array;\n var target = out.array;\n var c1 = Math.cos(v[0] / 2);\n var c2 = Math.cos(v[1] / 2);\n var c3 = Math.cos(v[2] / 2);\n var s1 = Math.sin(v[0] / 2);\n var s2 = Math.sin(v[1] / 2);\n var s3 = Math.sin(v[2] / 2);\n\n var order = (order || 'XYZ').toUpperCase();\n\n // http://www.mathworks.com/matlabcentral/fileexchange/\n // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n // content/SpinCalc.m\n\n switch (order) {\n case 'XYZ':\n target[0] = s1 * c2 * c3 + c1 * s2 * s3;\n target[1] = c1 * s2 * c3 - s1 * c2 * s3;\n target[2] = c1 * c2 * s3 + s1 * s2 * c3;\n target[3] = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case 'YXZ':\n target[0] = s1 * c2 * c3 + c1 * s2 * s3;\n target[1] = c1 * s2 * c3 - s1 * c2 * s3;\n target[2] = c1 * c2 * s3 - s1 * s2 * c3;\n target[3] = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case 'ZXY':\n target[0] = s1 * c2 * c3 - c1 * s2 * s3;\n target[1] = c1 * s2 * c3 + s1 * c2 * s3;\n target[2] = c1 * c2 * s3 + s1 * s2 * c3;\n target[3] = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case 'ZYX':\n target[0] = s1 * c2 * c3 - c1 * s2 * s3;\n target[1] = c1 * s2 * c3 + s1 * c2 * s3;\n target[2] = c1 * c2 * s3 - s1 * s2 * c3;\n target[3] = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case 'YZX':\n target[0] = s1 * c2 * c3 + c1 * s2 * s3;\n target[1] = c1 * s2 * c3 + s1 * c2 * s3;\n target[2] = c1 * c2 * s3 - s1 * s2 * c3;\n target[3] = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case 'XZY':\n target[0] = s1 * c2 * c3 - c1 * s2 * s3;\n target[1] = c1 * s2 * c3 - s1 * c2 * s3;\n target[2] = c1 * c2 * s3 + s1 * s2 * c3;\n target[3] = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n }\n};\n\nexport default Quaternion;\n","import Vector3 from './Vector3';\nimport vec3 from '../glmatrix/vec3';\n\nvar vec3Set = vec3.set;\nvar vec3Copy = vec3.copy;\n\n/**\n * Axis aligned bounding box\n * @constructor\n * @alias clay.BoundingBox\n * @param {clay.Vector3} [min]\n * @param {clay.Vector3} [max]\n */\nvar BoundingBox = function (min, max) {\n\n /**\n * Minimum coords of bounding box\n * @type {clay.Vector3}\n */\n this.min = min || new Vector3(Infinity, Infinity, Infinity);\n\n /**\n * Maximum coords of bounding box\n * @type {clay.Vector3}\n */\n this.max = max || new Vector3(-Infinity, -Infinity, -Infinity);\n\n this.vertices = null;\n};\n\nBoundingBox.prototype = {\n\n constructor: BoundingBox,\n /**\n * Update min and max coords from a vertices array\n * @param {array} vertices\n */\n updateFromVertices: function (vertices) {\n if (vertices.length > 0) {\n var min = this.min;\n var max = this.max;\n var minArr = min.array;\n var maxArr = max.array;\n vec3Copy(minArr, vertices[0]);\n vec3Copy(maxArr, vertices[0]);\n for (var i = 1; i < vertices.length; i++) {\n var vertex = vertices[i];\n\n if (vertex[0] < minArr[0]) { minArr[0] = vertex[0]; }\n if (vertex[1] < minArr[1]) { minArr[1] = vertex[1]; }\n if (vertex[2] < minArr[2]) { minArr[2] = vertex[2]; }\n\n if (vertex[0] > maxArr[0]) { maxArr[0] = vertex[0]; }\n if (vertex[1] > maxArr[1]) { maxArr[1] = vertex[1]; }\n if (vertex[2] > maxArr[2]) { maxArr[2] = vertex[2]; }\n }\n min._dirty = true;\n max._dirty = true;\n }\n },\n\n /**\n * Union operation with another bounding box\n * @param {clay.BoundingBox} bbox\n */\n union: function (bbox) {\n var min = this.min;\n var max = this.max;\n vec3.min(min.array, min.array, bbox.min.array);\n vec3.max(max.array, max.array, bbox.max.array);\n min._dirty = true;\n max._dirty = true;\n return this;\n },\n\n /**\n * Intersection operation with another bounding box\n * @param {clay.BoundingBox} bbox\n */\n intersection: function (bbox) {\n var min = this.min;\n var max = this.max;\n vec3.max(min.array, min.array, bbox.min.array);\n vec3.min(max.array, max.array, bbox.max.array);\n min._dirty = true;\n max._dirty = true;\n return this;\n },\n\n /**\n * If intersect with another bounding box\n * @param {clay.BoundingBox} bbox\n * @return {boolean}\n */\n intersectBoundingBox: function (bbox) {\n var _min = this.min.array;\n var _max = this.max.array;\n\n var _min2 = bbox.min.array;\n var _max2 = bbox.max.array;\n\n return ! (_min[0] > _max2[0] || _min[1] > _max2[1] || _min[2] > _max2[2]\n || _max[0] < _min2[0] || _max[1] < _min2[1] || _max[2] < _min2[2]);\n },\n\n /**\n * If contain another bounding box entirely\n * @param {clay.BoundingBox} bbox\n * @return {boolean}\n */\n containBoundingBox: function (bbox) {\n\n var _min = this.min.array;\n var _max = this.max.array;\n\n var _min2 = bbox.min.array;\n var _max2 = bbox.max.array;\n\n return _min[0] <= _min2[0] && _min[1] <= _min2[1] && _min[2] <= _min2[2]\n && _max[0] >= _max2[0] && _max[1] >= _max2[1] && _max[2] >= _max2[2];\n },\n\n /**\n * If contain point entirely\n * @param {clay.Vector3} point\n * @return {boolean}\n */\n containPoint: function (p) {\n var _min = this.min.array;\n var _max = this.max.array;\n\n var _p = p.array;\n\n return _min[0] <= _p[0] && _min[1] <= _p[1] && _min[2] <= _p[2]\n && _max[0] >= _p[0] && _max[1] >= _p[1] && _max[2] >= _p[2];\n },\n\n /**\n * If bounding box is finite\n */\n isFinite: function () {\n var _min = this.min.array;\n var _max = this.max.array;\n return isFinite(_min[0]) && isFinite(_min[1]) && isFinite(_min[2])\n && isFinite(_max[0]) && isFinite(_max[1]) && isFinite(_max[2]);\n },\n\n /**\n * Apply an affine transform matrix to the bounding box\n * @param {clay.Matrix4} matrix\n */\n applyTransform: function (matrix) {\n this.transformFrom(this, matrix);\n },\n\n /**\n * Get from another bounding box and an affine transform matrix.\n * @param {clay.BoundingBox} source\n * @param {clay.Matrix4} matrix\n */\n transformFrom: (function () {\n // http://dev.theomader.com/transform-bounding-boxes/\n var xa = vec3.create();\n var xb = vec3.create();\n var ya = vec3.create();\n var yb = vec3.create();\n var za = vec3.create();\n var zb = vec3.create();\n\n return function (source, matrix) {\n var min = source.min.array;\n var max = source.max.array;\n\n var m = matrix.array;\n\n xa[0] = m[0] * min[0]; xa[1] = m[1] * min[0]; xa[2] = m[2] * min[0];\n xb[0] = m[0] * max[0]; xb[1] = m[1] * max[0]; xb[2] = m[2] * max[0];\n\n ya[0] = m[4] * min[1]; ya[1] = m[5] * min[1]; ya[2] = m[6] * min[1];\n yb[0] = m[4] * max[1]; yb[1] = m[5] * max[1]; yb[2] = m[6] * max[1];\n\n za[0] = m[8] * min[2]; za[1] = m[9] * min[2]; za[2] = m[10] * min[2];\n zb[0] = m[8] * max[2]; zb[1] = m[9] * max[2]; zb[2] = m[10] * max[2];\n\n min = this.min.array;\n max = this.max.array;\n min[0] = Math.min(xa[0], xb[0]) + Math.min(ya[0], yb[0]) + Math.min(za[0], zb[0]) + m[12];\n min[1] = Math.min(xa[1], xb[1]) + Math.min(ya[1], yb[1]) + Math.min(za[1], zb[1]) + m[13];\n min[2] = Math.min(xa[2], xb[2]) + Math.min(ya[2], yb[2]) + Math.min(za[2], zb[2]) + m[14];\n\n max[0] = Math.max(xa[0], xb[0]) + Math.max(ya[0], yb[0]) + Math.max(za[0], zb[0]) + m[12];\n max[1] = Math.max(xa[1], xb[1]) + Math.max(ya[1], yb[1]) + Math.max(za[1], zb[1]) + m[13];\n max[2] = Math.max(xa[2], xb[2]) + Math.max(ya[2], yb[2]) + Math.max(za[2], zb[2]) + m[14];\n\n this.min._dirty = true;\n this.max._dirty = true;\n\n return this;\n };\n })(),\n\n /**\n * Apply a projection matrix to the bounding box\n * @param {clay.Matrix4} matrix\n */\n applyProjection: function (matrix) {\n var min = this.min.array;\n var max = this.max.array;\n\n var m = matrix.array;\n // min in min z\n var v10 = min[0];\n var v11 = min[1];\n var v12 = min[2];\n // max in min z\n var v20 = max[0];\n var v21 = max[1];\n var v22 = min[2];\n // max in max z\n var v30 = max[0];\n var v31 = max[1];\n var v32 = max[2];\n\n if (m[15] === 1) { // Orthographic projection\n min[0] = m[0] * v10 + m[12];\n min[1] = m[5] * v11 + m[13];\n max[2] = m[10] * v12 + m[14];\n\n max[0] = m[0] * v30 + m[12];\n max[1] = m[5] * v31 + m[13];\n min[2] = m[10] * v32 + m[14];\n }\n else {\n var w = -1 / v12;\n min[0] = m[0] * v10 * w;\n min[1] = m[5] * v11 * w;\n max[2] = (m[10] * v12 + m[14]) * w;\n\n w = -1 / v22;\n max[0] = m[0] * v20 * w;\n max[1] = m[5] * v21 * w;\n\n w = -1 / v32;\n min[2] = (m[10] * v32 + m[14]) * w;\n }\n this.min._dirty = true;\n this.max._dirty = true;\n\n return this;\n },\n\n updateVertices: function () {\n var vertices = this.vertices;\n if (!vertices) {\n // Cube vertices\n vertices = [];\n for (var i = 0; i < 8; i++) {\n vertices[i] = vec3.fromValues(0, 0, 0);\n }\n\n /**\n * Eight coords of bounding box\n * @type {Float32Array[]}\n */\n this.vertices = vertices;\n }\n var min = this.min.array;\n var max = this.max.array;\n //--- min z\n // min x\n vec3Set(vertices[0], min[0], min[1], min[2]);\n vec3Set(vertices[1], min[0], max[1], min[2]);\n // max x\n vec3Set(vertices[2], max[0], min[1], min[2]);\n vec3Set(vertices[3], max[0], max[1], min[2]);\n\n //-- max z\n vec3Set(vertices[4], min[0], min[1], max[2]);\n vec3Set(vertices[5], min[0], max[1], max[2]);\n vec3Set(vertices[6], max[0], min[1], max[2]);\n vec3Set(vertices[7], max[0], max[1], max[2]);\n\n return this;\n },\n /**\n * Copy values from another bounding box\n * @param {clay.BoundingBox} bbox\n */\n copy: function (bbox) {\n var min = this.min;\n var max = this.max;\n vec3Copy(min.array, bbox.min.array);\n vec3Copy(max.array, bbox.max.array);\n min._dirty = true;\n max._dirty = true;\n return this;\n },\n\n /**\n * Clone a new bounding box\n * @return {clay.BoundingBox}\n */\n clone: function () {\n var boundingBox = new BoundingBox();\n boundingBox.copy(this);\n return boundingBox;\n }\n};\n\nexport default BoundingBox;\n","import Base from './core/Base';\nimport Vector3 from './math/Vector3';\nimport Quaternion from './math/Quaternion';\nimport Matrix4 from './math/Matrix4';\nimport mat4 from './glmatrix/mat4';\nimport BoundingBox from './math/BoundingBox';\n\nvar nameId = 0;\n\n/**\n * @constructor clay.Node\n * @extends clay.core.Base\n */\nvar Node = Base.extend(/** @lends clay.Node# */{\n /**\n * Scene node name\n * @type {string}\n */\n name: '',\n\n /**\n * Position relative to its parent node. aka translation.\n * @type {clay.Vector3}\n */\n position: null,\n\n /**\n * Rotation relative to its parent node. Represented by a quaternion\n * @type {clay.Quaternion}\n */\n rotation: null,\n\n /**\n * Scale relative to its parent node\n * @type {clay.Vector3}\n */\n scale: null,\n\n /**\n * Affine transform matrix relative to its root scene.\n * @type {clay.Matrix4}\n */\n worldTransform: null,\n\n /**\n * Affine transform matrix relative to its parent node.\n * Composited with position, rotation and scale.\n * @type {clay.Matrix4}\n */\n localTransform: null,\n\n /**\n * If the local transform is update from SRT(scale, rotation, translation, which is position here) each frame\n * @type {boolean}\n */\n autoUpdateLocalTransform: true,\n\n /**\n * Parent of current scene node\n * @type {?clay.Node}\n * @private\n */\n _parent: null,\n /**\n * The root scene mounted. Null if it is a isolated node\n * @type {?clay.Scene}\n * @private\n */\n _scene: null,\n /**\n * @type {boolean}\n * @private\n */\n _needsUpdateWorldTransform: true,\n /**\n * @type {boolean}\n * @private\n */\n _inIterating: false,\n\n // Depth for transparent list sorting\n __depth: 0\n\n}, function () {\n\n if (!this.name) {\n this.name = (this.type || 'NODE') + '_' + (nameId++);\n }\n\n if (!this.position) {\n this.position = new Vector3();\n }\n if (!this.rotation) {\n this.rotation = new Quaternion();\n }\n if (!this.scale) {\n this.scale = new Vector3(1, 1, 1);\n }\n\n this.worldTransform = new Matrix4();\n this.localTransform = new Matrix4();\n\n this._children = [];\n\n},\n/**@lends clay.Node.prototype. */\n{\n\n /**\n * @type {?clay.Vector3}\n * @instance\n */\n target: null,\n /**\n * If node and its chilren invisible\n * @type {boolean}\n * @instance\n */\n invisible: false,\n\n /**\n * If Node is a skinned mesh\n * @return {boolean}\n */\n isSkinnedMesh: function () {\n return false;\n },\n /**\n * Return true if it is a renderable scene node, like Mesh and ParticleSystem\n * @return {boolean}\n */\n isRenderable: function () {\n return false;\n },\n\n /**\n * Set the name of the scene node\n * @param {string} name\n */\n setName: function (name) {\n var scene = this._scene;\n if (scene) {\n var nodeRepository = scene._nodeRepository;\n delete nodeRepository[this.name];\n nodeRepository[name] = this;\n }\n this.name = name;\n },\n\n /**\n * Add a child node\n * @param {clay.Node} node\n */\n add: function (node) {\n var originalParent = node._parent;\n if (originalParent === this) {\n return;\n }\n if (originalParent) {\n originalParent.remove(node);\n }\n node._parent = this;\n this._children.push(node);\n\n var scene = this._scene;\n if (scene && scene !== node.scene) {\n node.traverse(this._addSelfToScene, this);\n }\n // Mark children needs update transform\n // In case child are remove and added again after parent moved\n node._needsUpdateWorldTransform = true;\n },\n\n /**\n * Remove the given child scene node\n * @param {clay.Node} node\n */\n remove: function (node) {\n var children = this._children;\n var idx = children.indexOf(node);\n if (idx < 0) {\n return;\n }\n\n children.splice(idx, 1);\n node._parent = null;\n\n if (this._scene) {\n node.traverse(this._removeSelfFromScene, this);\n }\n },\n\n /**\n * Remove all children\n */\n removeAll: function () {\n var children = this._children;\n\n for (var idx = 0; idx < children.length; idx++) {\n children[idx]._parent = null;\n\n if (this._scene) {\n children[idx].traverse(this._removeSelfFromScene, this);\n }\n }\n\n this._children = [];\n },\n\n /**\n * Get the scene mounted\n * @return {clay.Scene}\n */\n getScene: function () {\n return this._scene;\n },\n\n /**\n * Get parent node\n * @return {clay.Scene}\n */\n getParent: function () {\n return this._parent;\n },\n\n _removeSelfFromScene: function (descendant) {\n descendant._scene.removeFromScene(descendant);\n descendant._scene = null;\n },\n\n _addSelfToScene: function (descendant) {\n this._scene.addToScene(descendant);\n descendant._scene = this._scene;\n },\n\n /**\n * Return true if it is ancestor of the given scene node\n * @param {clay.Node} node\n */\n isAncestor: function (node) {\n var parent = node._parent;\n while(parent) {\n if (parent === this) {\n return true;\n }\n parent = parent._parent;\n }\n return false;\n },\n\n /**\n * Get a new created array of all children nodes\n * @return {clay.Node[]}\n */\n children: function () {\n return this._children.slice();\n },\n\n /**\n * Get child scene node at given index.\n * @param {number} idx\n * @return {clay.Node}\n */\n childAt: function (idx) {\n return this._children[idx];\n },\n\n /**\n * Get first child with the given name\n * @param {string} name\n * @return {clay.Node}\n */\n getChildByName: function (name) {\n var children = this._children;\n for (var i = 0; i < children.length; i++) {\n if (children[i].name === name) {\n return children[i];\n }\n }\n },\n\n /**\n * Get first descendant have the given name\n * @param {string} name\n * @return {clay.Node}\n */\n getDescendantByName: function (name) {\n var children = this._children;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (child.name === name) {\n return child;\n } else {\n var res = child.getDescendantByName(name);\n if (res) {\n return res;\n }\n }\n }\n },\n\n /**\n * Query descendant node by path\n * @param {string} path\n * @return {clay.Node}\n * @example\n * node.queryNode('root/parent/child');\n */\n queryNode: function (path) {\n if (!path) {\n return;\n }\n // TODO Name have slash ?\n var pathArr = path.split('/');\n var current = this;\n for (var i = 0; i < pathArr.length; i++) {\n var name = pathArr[i];\n // Skip empty\n if (!name) {\n continue;\n }\n var found = false;\n var children = current._children;\n for (var j = 0; j < children.length; j++) {\n var child = children[j];\n if (child.name === name) {\n current = child;\n found = true;\n break;\n }\n }\n // Early return if not found\n if (!found) {\n return;\n }\n }\n\n return current;\n },\n\n /**\n * Get query path, relative to rootNode(default is scene)\n * @param {clay.Node} [rootNode]\n * @return {string}\n */\n getPath: function (rootNode) {\n if (!this._parent) {\n return '/';\n }\n\n var current = this._parent;\n var path = this.name;\n while (current._parent) {\n path = current.name + '/' + path;\n if (current._parent == rootNode) {\n break;\n }\n current = current._parent;\n }\n if (!current._parent && rootNode) {\n return null;\n }\n return path;\n },\n\n /**\n * Depth first traverse all its descendant scene nodes.\n *\n * **WARN** Don't do `add`, `remove` operation in the callback during traverse.\n * @param {Function} callback\n * @param {Node} [context]\n */\n traverse: function (callback, context) {\n callback.call(context, this);\n var _children = this._children;\n for(var i = 0, len = _children.length; i < len; i++) {\n _children[i].traverse(callback, context);\n }\n },\n\n /**\n * Traverse all children nodes.\n *\n * **WARN** DON'T do `add`, `remove` operation in the callback during iteration.\n *\n * @param {Function} callback\n * @param {Node} [context]\n */\n eachChild: function (callback, context) {\n var _children = this._children;\n for(var i = 0, len = _children.length; i < len; i++) {\n var child = _children[i];\n callback.call(context, child, i);\n }\n },\n\n /**\n * Set the local transform and decompose to SRT\n * @param {clay.Matrix4} matrix\n */\n setLocalTransform: function (matrix) {\n mat4.copy(this.localTransform.array, matrix.array);\n this.decomposeLocalTransform();\n },\n\n /**\n * Decompose the local transform to SRT\n */\n decomposeLocalTransform: function (keepScale) {\n var scale = !keepScale ? this.scale: null;\n this.localTransform.decomposeMatrix(scale, this.rotation, this.position);\n },\n\n /**\n * Set the world transform and decompose to SRT\n * @param {clay.Matrix4} matrix\n */\n setWorldTransform: function (matrix) {\n mat4.copy(this.worldTransform.array, matrix.array);\n this.decomposeWorldTransform();\n },\n\n /**\n * Decompose the world transform to SRT\n * @function\n */\n decomposeWorldTransform: (function () {\n\n var tmp = mat4.create();\n\n return function (keepScale) {\n var localTransform = this.localTransform;\n var worldTransform = this.worldTransform;\n // Assume world transform is updated\n if (this._parent) {\n mat4.invert(tmp, this._parent.worldTransform.array);\n mat4.multiply(localTransform.array, tmp, worldTransform.array);\n } else {\n mat4.copy(localTransform.array, worldTransform.array);\n }\n var scale = !keepScale ? this.scale: null;\n localTransform.decomposeMatrix(scale, this.rotation, this.position);\n };\n })(),\n\n transformNeedsUpdate: function () {\n return this.position._dirty\n || this.rotation._dirty\n || this.scale._dirty;\n },\n\n /**\n * Update local transform from SRT\n * Notice that local transform will not be updated if _dirty mark of position, rotation, scale is all false\n */\n updateLocalTransform: function () {\n var position = this.position;\n var rotation = this.rotation;\n var scale = this.scale;\n\n if (this.transformNeedsUpdate()) {\n var m = this.localTransform.array;\n\n // Transform order, scale->rotation->position\n mat4.fromRotationTranslation(m, rotation.array, position.array);\n\n mat4.scale(m, m, scale.array);\n\n rotation._dirty = false;\n scale._dirty = false;\n position._dirty = false;\n\n this._needsUpdateWorldTransform = true;\n }\n },\n\n /**\n * Update world transform, assume its parent world transform have been updated\n * @private\n */\n _updateWorldTransformTopDown: function () {\n var localTransform = this.localTransform.array;\n var worldTransform = this.worldTransform.array;\n if (this._parent) {\n mat4.multiplyAffine(\n worldTransform,\n this._parent.worldTransform.array,\n localTransform\n );\n }\n else {\n mat4.copy(worldTransform, localTransform);\n }\n },\n\n /**\n * Update world transform before whole scene is updated.\n */\n updateWorldTransform: function () {\n // Find the root node which transform needs update;\n var rootNodeIsDirty = this;\n while (rootNodeIsDirty && rootNodeIsDirty.getParent()\n && rootNodeIsDirty.getParent().transformNeedsUpdate()\n ) {\n rootNodeIsDirty = rootNodeIsDirty.getParent();\n }\n rootNodeIsDirty.update();\n },\n\n /**\n * Update local transform and world transform recursively\n * @param {boolean} forceUpdateWorld\n */\n update: function (forceUpdateWorld) {\n if (this.autoUpdateLocalTransform) {\n this.updateLocalTransform();\n }\n else {\n // Transform is manually setted\n forceUpdateWorld = true;\n }\n\n if (forceUpdateWorld || this._needsUpdateWorldTransform) {\n this._updateWorldTransformTopDown();\n forceUpdateWorld = true;\n this._needsUpdateWorldTransform = false;\n }\n\n var children = this._children;\n for(var i = 0, len = children.length; i < len; i++) {\n children[i].update(forceUpdateWorld);\n }\n },\n\n /**\n * Get bounding box of node\n * @param {Function} [filter]\n * @param {clay.BoundingBox} [out]\n * @return {clay.BoundingBox}\n */\n // TODO Skinning\n getBoundingBox: (function () {\n function defaultFilter (el) {\n return !el.invisible && el.geometry;\n }\n var tmpBBox = new BoundingBox();\n var tmpMat4 = new Matrix4();\n var invWorldTransform = new Matrix4();\n return function (filter, out) {\n out = out || new BoundingBox();\n filter = filter || defaultFilter;\n\n if (this._parent) {\n Matrix4.invert(invWorldTransform, this._parent.worldTransform);\n }\n else {\n Matrix4.identity(invWorldTransform);\n }\n\n this.traverse(function (mesh) {\n if (mesh.geometry && mesh.geometry.boundingBox) {\n tmpBBox.copy(mesh.geometry.boundingBox);\n Matrix4.multiply(tmpMat4, invWorldTransform, mesh.worldTransform);\n tmpBBox.applyTransform(tmpMat4);\n out.union(tmpBBox);\n }\n }, this, defaultFilter);\n\n return out;\n };\n })(),\n\n /**\n * Get world position, extracted from world transform\n * @param {clay.Vector3} [out]\n * @return {clay.Vector3}\n */\n getWorldPosition: function (out) {\n // PENDING\n if (this.transformNeedsUpdate()) {\n this.updateWorldTransform();\n }\n var m = this.worldTransform.array;\n if (out) {\n var arr = out.array;\n arr[0] = m[12];\n arr[1] = m[13];\n arr[2] = m[14];\n return out;\n }\n else {\n return new Vector3(m[12], m[13], m[14]);\n }\n },\n\n /**\n * Clone a new node\n * @return {Node}\n */\n clone: function () {\n var node = new this.constructor();\n\n var children = this._children;\n\n node.setName(this.name);\n node.position.copy(this.position);\n node.rotation.copy(this.rotation);\n node.scale.copy(this.scale);\n\n for (var i = 0; i < children.length; i++) {\n node.add(children[i].clone());\n }\n\n return node;\n },\n\n /**\n * Rotate the node around a axis by angle degrees, axis passes through point\n * @param {clay.Vector3} point Center point\n * @param {clay.Vector3} axis Center axis\n * @param {number} angle Rotation angle\n * @see http://docs.unity3d.com/Documentation/ScriptReference/Transform.RotateAround.html\n * @function\n */\n rotateAround: (function () {\n var v = new Vector3();\n var RTMatrix = new Matrix4();\n\n // TODO improve performance\n return function (point, axis, angle) {\n\n v.copy(this.position).subtract(point);\n\n var localTransform = this.localTransform;\n localTransform.identity();\n // parent node\n localTransform.translate(point);\n localTransform.rotate(angle, axis);\n\n RTMatrix.fromRotationTranslation(this.rotation, v);\n localTransform.multiply(RTMatrix);\n localTransform.scale(this.scale);\n\n this.decomposeLocalTransform();\n this._needsUpdateWorldTransform = true;\n };\n })(),\n\n /**\n * @param {clay.Vector3} target\n * @param {clay.Vector3} [up]\n * @see http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml\n * @function\n */\n lookAt: (function () {\n var m = new Matrix4();\n return function (target, up) {\n m.lookAt(this.position, target, up || this.localTransform.y).invert();\n this.setLocalTransform(m);\n\n this.target = target;\n };\n })()\n});\n\nexport default Node;\n","import Node from './Node';\nimport glenum from './core/glenum';\n\n/**\n * @constructor\n * @alias clay.Renderable\n * @extends clay.Node\n */\nvar Renderable = Node.extend(/** @lends clay.Renderable# */ {\n /**\n * @type {clay.Material}\n */\n material: null,\n\n /**\n * @type {clay.Geometry}\n */\n geometry: null,\n\n /**\n * @type {number}\n */\n mode: glenum.TRIANGLES,\n\n _renderInfo: null\n},\n/** @lends clay.Renderable.prototype */\n{\n\n __program: null,\n\n /**\n * Group of received light.\n */\n lightGroup: 0,\n /**\n * Render order, Nodes with smaller value renders before nodes with larger values.\n * @type {Number}\n */\n renderOrder: 0,\n\n /**\n * Used when mode is LINES, LINE_STRIP or LINE_LOOP\n * @type {number}\n */\n // lineWidth: 1,\n\n /**\n * If enable culling\n * @type {boolean}\n */\n culling: true,\n /**\n * Specify which side of polygon will be culled.\n * Possible values:\n * + {@link clay.Renderable.BACK}\n * + {@link clay.Renderable.FRONT}\n * + {@link clay.Renderable.FRONT_AND_BACK}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/cullFace\n * @type {number}\n */\n cullFace: glenum.BACK,\n /**\n * Specify which side is front face.\n * Possible values:\n * + {@link clay.Renderable.CW}\n * + {@link clay.Renderable.CCW}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/frontFace\n * @type {number}\n */\n frontFace: glenum.CCW,\n\n /**\n * If enable software frustum culling\n * @type {boolean}\n */\n frustumCulling: true,\n /**\n * @type {boolean}\n */\n receiveShadow: true,\n /**\n * @type {boolean}\n */\n castShadow: true,\n /**\n * @type {boolean}\n */\n ignorePicking: false,\n /**\n * @type {boolean}\n */\n ignorePreZ: false,\n\n /**\n * @type {boolean}\n */\n ignoreGBuffer: false,\n\n /**\n * @return {boolean}\n */\n isRenderable: function() {\n // TODO Shader ?\n return this.geometry && this.material && this.material.shader && !this.invisible\n && this.geometry.vertexCount > 0;\n },\n\n /**\n * Before render hook\n * @type {Function}\n */\n beforeRender: function (_gl) {},\n\n /**\n * Before render hook\n * @type {Function}\n */\n afterRender: function (_gl, renderStat) {},\n\n getBoundingBox: function (filter, out) {\n out = Node.prototype.getBoundingBox.call(this, filter, out);\n if (this.geometry && this.geometry.boundingBox) {\n out.union(this.geometry.boundingBox);\n }\n\n return out;\n },\n\n /**\n * Clone a new renderable\n * @function\n * @return {clay.Renderable}\n */\n clone: (function() {\n var properties = [\n 'castShadow', 'receiveShadow',\n 'mode', 'culling', 'cullFace', 'frontFace',\n 'frustumCulling',\n 'renderOrder', 'lineWidth',\n 'ignorePicking', 'ignorePreZ', 'ignoreGBuffer'\n ];\n return function() {\n var renderable = Node.prototype.clone.call(this);\n\n renderable.geometry = this.geometry;\n renderable.material = this.material;\n\n for (var i = 0; i < properties.length; i++) {\n var name = properties[i];\n // Try not to overwrite the prototype property\n if (renderable[name] !== this[name]) {\n renderable[name] = this[name];\n }\n }\n\n return renderable;\n };\n })()\n});\n\n/**\n * @type {number}\n */\nRenderable.POINTS = glenum.POINTS;\n/**\n * @type {number}\n */\nRenderable.LINES = glenum.LINES;\n/**\n * @type {number}\n */\nRenderable.LINE_LOOP = glenum.LINE_LOOP;\n/**\n * @type {number}\n */\nRenderable.LINE_STRIP = glenum.LINE_STRIP;\n/**\n * @type {number}\n */\nRenderable.TRIANGLES = glenum.TRIANGLES;\n/**\n * @type {number}\n */\nRenderable.TRIANGLE_STRIP = glenum.TRIANGLE_STRIP;\n/**\n * @type {number}\n */\nRenderable.TRIANGLE_FAN = glenum.TRIANGLE_FAN;\n/**\n * @type {number}\n */\nRenderable.BACK = glenum.BACK;\n/**\n * @type {number}\n */\nRenderable.FRONT = glenum.FRONT;\n/**\n * @type {number}\n */\nRenderable.FRONT_AND_BACK = glenum.FRONT_AND_BACK;\n/**\n * @type {number}\n */\nRenderable.CW = glenum.CW;\n/**\n * @type {number}\n */\nRenderable.CCW = glenum.CCW;\n\nexport default Renderable;\n","import Base from '../core/Base';\nimport Ray from '../math/Ray';\nimport Vector2 from '../math/Vector2';\nimport Vector3 from '../math/Vector3';\nimport Matrix4 from '../math/Matrix4';\nimport Renderable from '../Renderable';\nimport glenum from '../core/glenum';\nimport vec3 from '../glmatrix/vec3';\n\n/**\n * @constructor clay.picking.RayPicking\n * @extends clay.core.Base\n */\nvar RayPicking = Base.extend(/** @lends clay.picking.RayPicking# */{\n /**\n * Target scene\n * @type {clay.Scene}\n */\n scene: null,\n /**\n * Target camera\n * @type {clay.Camera}\n */\n camera: null,\n /**\n * Target renderer\n * @type {clay.Renderer}\n */\n renderer: null\n}, function () {\n this._ray = new Ray();\n this._ndc = new Vector2();\n},\n/** @lends clay.picking.RayPicking.prototype */\n{\n\n /**\n * Pick the nearest intersection object in the scene\n * @param {number} x Mouse position x\n * @param {number} y Mouse position y\n * @param {boolean} [forcePickAll=false] ignore ignorePicking\n * @return {clay.picking.RayPicking~Intersection}\n */\n pick: function (x, y, forcePickAll) {\n var out = this.pickAll(x, y, [], forcePickAll);\n return out[0] || null;\n },\n\n /**\n * Pick all intersection objects, wich will be sorted from near to far\n * @param {number} x Mouse position x\n * @param {number} y Mouse position y\n * @param {Array} [output]\n * @param {boolean} [forcePickAll=false] ignore ignorePicking\n * @return {Array.}\n */\n pickAll: function (x, y, output, forcePickAll) {\n this.renderer.screenToNDC(x, y, this._ndc);\n this.camera.castRay(this._ndc, this._ray);\n\n output = output || [];\n\n this._intersectNode(this.scene, output, forcePickAll || false);\n\n output.sort(this._intersectionCompareFunc);\n\n return output;\n },\n\n _intersectNode: function (node, out, forcePickAll) {\n if ((node instanceof Renderable) && node.isRenderable()) {\n if ((!node.ignorePicking || forcePickAll)\n && (\n // Only triangle mesh support ray picking\n (node.mode === glenum.TRIANGLES && node.geometry.isUseIndices())\n // Or if geometry has it's own pickByRay, pick, implementation\n || node.geometry.pickByRay\n || node.geometry.pick\n )\n ) {\n this._intersectRenderable(node, out);\n }\n }\n for (var i = 0; i < node._children.length; i++) {\n this._intersectNode(node._children[i], out, forcePickAll);\n }\n },\n\n _intersectRenderable: (function () {\n\n var v1 = new Vector3();\n var v2 = new Vector3();\n var v3 = new Vector3();\n var ray = new Ray();\n var worldInverse = new Matrix4();\n\n return function (renderable, out) {\n\n var isSkinnedMesh = renderable.isSkinnedMesh();\n ray.copy(this._ray);\n Matrix4.invert(worldInverse, renderable.worldTransform);\n\n // Skinned mesh will ignore the world transform.\n if (!isSkinnedMesh) {\n ray.applyTransform(worldInverse);\n }\n\n var geometry = renderable.geometry;\n\n var bbox = isSkinnedMesh ? renderable.skeleton.boundingBox : geometry.boundingBox;\n\n if (bbox && !ray.intersectBoundingBox(bbox)) {\n return;\n }\n // Use user defined picking algorithm\n if (geometry.pick) {\n geometry.pick(\n this._ndc.x, this._ndc.y,\n this.renderer,\n this.camera,\n renderable, out\n );\n return;\n }\n // Use user defined ray picking algorithm\n else if (geometry.pickByRay) {\n geometry.pickByRay(ray, renderable, out);\n return;\n }\n\n var cullBack = (renderable.cullFace === glenum.BACK && renderable.frontFace === glenum.CCW)\n || (renderable.cullFace === glenum.FRONT && renderable.frontFace === glenum.CW);\n\n var point;\n var indices = geometry.indices;\n var positionAttr = geometry.attributes.position;\n var weightAttr = geometry.attributes.weight;\n var jointAttr = geometry.attributes.joint;\n var skinMatricesArray;\n var skinMatrices = [];\n // Check if valid.\n if (!positionAttr || !positionAttr.value || !indices) {\n return;\n }\n if (isSkinnedMesh) {\n skinMatricesArray = renderable.skeleton.getSubSkinMatrices(renderable.__uid__, renderable.joints);\n for (var i = 0; i < renderable.joints.length; i++) {\n skinMatrices[i] = skinMatrices[i] || [];\n for (var k = 0; k < 16; k++) {\n skinMatrices[i][k] = skinMatricesArray[i * 16 + k];\n }\n }\n var pos = [];\n var weight = [];\n var joint = [];\n var skinnedPos = [];\n var tmp = [];\n var skinnedPositionAttr = geometry.attributes.skinnedPosition;\n if (!skinnedPositionAttr || !skinnedPositionAttr.value) {\n geometry.createAttribute('skinnedPosition', 'f', 3);\n skinnedPositionAttr = geometry.attributes.skinnedPosition;\n skinnedPositionAttr.init(geometry.vertexCount);\n }\n for (var i = 0; i < geometry.vertexCount; i++) {\n positionAttr.get(i, pos);\n weightAttr.get(i, weight);\n jointAttr.get(i, joint);\n weight[3] = 1 - weight[0] - weight[1] - weight[2];\n vec3.set(skinnedPos, 0, 0, 0);\n for (var k = 0; k < 4; k++) {\n if (joint[k] >= 0 && weight[k] > 1e-4) {\n vec3.transformMat4(tmp, pos, skinMatrices[joint[k]]);\n vec3.scaleAndAdd(skinnedPos, skinnedPos, tmp, weight[k]);\n }\n }\n skinnedPositionAttr.set(i, skinnedPos);\n }\n }\n\n for (var i = 0; i < indices.length; i += 3) {\n var i1 = indices[i];\n var i2 = indices[i + 1];\n var i3 = indices[i + 2];\n var finalPosAttr = isSkinnedMesh\n ? geometry.attributes.skinnedPosition\n : positionAttr;\n finalPosAttr.get(i1, v1.array);\n finalPosAttr.get(i2, v2.array);\n finalPosAttr.get(i3, v3.array);\n\n if (cullBack) {\n point = ray.intersectTriangle(v1, v2, v3, renderable.culling);\n }\n else {\n point = ray.intersectTriangle(v1, v3, v2, renderable.culling);\n }\n if (point) {\n var pointW = new Vector3();\n if (!isSkinnedMesh) {\n Vector3.transformMat4(pointW, point, renderable.worldTransform);\n }\n else {\n // TODO point maybe not right.\n Vector3.copy(pointW, point);\n }\n out.push(new RayPicking.Intersection(\n point, pointW, renderable, [i1, i2, i3], i / 3,\n Vector3.dist(pointW, this._ray.origin)\n ));\n }\n }\n };\n })(),\n\n _intersectionCompareFunc: function (a, b) {\n return a.distance - b.distance;\n }\n});\n\n/**\n * @constructor clay.picking.RayPicking~Intersection\n * @param {clay.Vector3} point\n * @param {clay.Vector3} pointWorld\n * @param {clay.Node} target\n * @param {Array.} triangle\n * @param {number} triangleIndex\n * @param {number} distance\n */\nRayPicking.Intersection = function (point, pointWorld, target, triangle, triangleIndex, distance) {\n /**\n * Intersection point in local transform coordinates\n * @type {clay.Vector3}\n */\n this.point = point;\n /**\n * Intersection point in world transform coordinates\n * @type {clay.Vector3}\n */\n this.pointWorld = pointWorld;\n /**\n * Intersection scene node\n * @type {clay.Node}\n */\n this.target = target;\n /**\n * Intersection triangle, which is an array of vertex index\n * @type {Array.}\n */\n this.triangle = triangle;\n /**\n * Index of intersection triangle.\n */\n this.triangleIndex = triangleIndex;\n /**\n * Distance from intersection point to ray origin\n * @type {number}\n */\n this.distance = distance;\n};\n\nexport default RayPicking;\n","var DIRTY_PREFIX = '__dt__';\n\nvar Cache = function () {\n\n this._contextId = 0;\n\n this._caches = [];\n\n this._context = {};\n};\n\nCache.prototype = {\n\n use: function (contextId, documentSchema) {\n var caches = this._caches;\n if (!caches[contextId]) {\n caches[contextId] = {};\n\n if (documentSchema) {\n caches[contextId] = documentSchema();\n }\n }\n this._contextId = contextId;\n\n this._context = caches[contextId];\n },\n\n put: function (key, value) {\n this._context[key] = value;\n },\n\n get: function (key) {\n return this._context[key];\n },\n\n dirty: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n this.put(key, true);\n },\n\n dirtyAll: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n var caches = this._caches;\n for (var i = 0; i < caches.length; i++) {\n if (caches[i]) {\n caches[i][key] = true;\n }\n }\n },\n\n fresh: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n this.put(key, false);\n },\n\n freshAll: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n var caches = this._caches;\n for (var i = 0; i < caches.length; i++) {\n if (caches[i]) {\n caches[i][key] = false;\n }\n }\n },\n\n isDirty: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n var context = this._context;\n return !context.hasOwnProperty(key)\n || context[key] === true;\n },\n\n deleteContext: function (contextId) {\n delete this._caches[contextId];\n this._context = {};\n },\n\n delete: function (key) {\n delete this._context[key];\n },\n\n clearAll: function () {\n this._caches = {};\n },\n\n getContext: function () {\n return this._context;\n },\n\n eachContext : function (cb, context) {\n var keys = Object.keys(this._caches);\n keys.forEach(function (key) {\n cb && cb.call(context, key);\n });\n },\n\n miss: function (key) {\n return ! this._context.hasOwnProperty(key);\n }\n};\n\nCache.prototype.constructor = Cache;\n\nexport default Cache;\n","/**\n * Base class for all textures like compressed texture, texture2d, texturecube\n * TODO mapping\n */\nimport Base from './core/Base';\nimport glenum from './core/glenum';\nimport Cache from './core/Cache';\n\n/**\n * @constructor\n * @alias clay.Texture\n * @extends clay.core.Base\n */\nvar Texture = Base.extend( /** @lends clay.Texture# */ {\n /**\n * Texture width, readonly when the texture source is image\n * @type {number}\n */\n width: 512,\n /**\n * Texture height, readonly when the texture source is image\n * @type {number}\n */\n height: 512,\n /**\n * Texel data type.\n * Possible values:\n * + {@link clay.Texture.UNSIGNED_BYTE}\n * + {@link clay.Texture.HALF_FLOAT}\n * + {@link clay.Texture.FLOAT}\n * + {@link clay.Texture.UNSIGNED_INT_24_8_WEBGL}\n * + {@link clay.Texture.UNSIGNED_INT}\n * @type {number}\n */\n type: glenum.UNSIGNED_BYTE,\n /**\n * Format of texel data\n * Possible values:\n * + {@link clay.Texture.RGBA}\n * + {@link clay.Texture.DEPTH_COMPONENT}\n * + {@link clay.Texture.DEPTH_STENCIL}\n * @type {number}\n */\n format: glenum.RGBA,\n /**\n * Texture wrap. Default to be REPEAT.\n * Possible values:\n * + {@link clay.Texture.CLAMP_TO_EDGE}\n * + {@link clay.Texture.REPEAT}\n * + {@link clay.Texture.MIRRORED_REPEAT}\n * @type {number}\n */\n wrapS: glenum.REPEAT,\n /**\n * Texture wrap. Default to be REPEAT.\n * Possible values:\n * + {@link clay.Texture.CLAMP_TO_EDGE}\n * + {@link clay.Texture.REPEAT}\n * + {@link clay.Texture.MIRRORED_REPEAT}\n * @type {number}\n */\n wrapT: glenum.REPEAT,\n /**\n * Possible values:\n * + {@link clay.Texture.NEAREST}\n * + {@link clay.Texture.LINEAR}\n * + {@link clay.Texture.NEAREST_MIPMAP_NEAREST}\n * + {@link clay.Texture.LINEAR_MIPMAP_NEAREST}\n * + {@link clay.Texture.NEAREST_MIPMAP_LINEAR}\n * + {@link clay.Texture.LINEAR_MIPMAP_LINEAR}\n * @type {number}\n */\n minFilter: glenum.LINEAR_MIPMAP_LINEAR,\n /**\n * Possible values:\n * + {@link clay.Texture.NEAREST}\n * + {@link clay.Texture.LINEAR}\n * @type {number}\n */\n magFilter: glenum.LINEAR,\n /**\n * If enable mimap.\n * @type {boolean}\n */\n useMipmap: true,\n\n /**\n * Anisotropic filtering, enabled if value is larger than 1\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_texture_filter_anisotropic\n * @type {number}\n */\n anisotropic: 1,\n // pixelStorei parameters, not available when texture is used as render target\n // http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml\n /**\n * If flip in y axis for given image source\n * @type {boolean}\n * @default true\n */\n flipY: true,\n\n /**\n * A flag to indicate if texture source is sRGB\n */\n sRGB: true,\n /**\n * @type {number}\n * @default 4\n */\n unpackAlignment: 4,\n /**\n * @type {boolean}\n * @default false\n */\n premultiplyAlpha: false,\n\n /**\n * Dynamic option for texture like video\n * @type {boolean}\n */\n dynamic: false,\n\n NPOT: false,\n\n // PENDING\n // Init it here to avoid deoptimization when it's assigned in application dynamically\n __used: 0\n\n}, function () {\n this._cache = new Cache();\n},\n/** @lends clay.Texture.prototype */\n{\n\n getWebGLTexture: function (renderer) {\n var _gl = renderer.gl;\n var cache = this._cache;\n cache.use(renderer.__uid__);\n\n if (cache.miss('webgl_texture')) {\n // In a new gl context, create new texture and set dirty true\n cache.put('webgl_texture', _gl.createTexture());\n }\n if (this.dynamic) {\n this.update(renderer);\n }\n else if (cache.isDirty()) {\n this.update(renderer);\n cache.fresh();\n }\n\n return cache.get('webgl_texture');\n },\n\n bind: function () {},\n unbind: function () {},\n\n /**\n * Mark texture is dirty and update in the next frame\n */\n dirty: function () {\n if (this._cache) {\n this._cache.dirtyAll();\n }\n },\n\n update: function (renderer) {},\n\n // Update the common parameters of texture\n updateCommon: function (renderer) {\n var _gl = renderer.gl;\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, this.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, this.unpackAlignment);\n\n // Use of none-power of two texture\n // http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences\n if (this.format === glenum.DEPTH_COMPONENT) {\n this.useMipmap = false;\n }\n\n var sRGBExt = renderer.getGLExtension('EXT_sRGB');\n // Fallback\n if (this.format === Texture.SRGB && !sRGBExt) {\n this.format = Texture.RGB;\n }\n if (this.format === Texture.SRGB_ALPHA && !sRGBExt) {\n this.format = Texture.RGBA;\n }\n\n this.NPOT = !this.isPowerOfTwo();\n },\n\n getAvailableWrapS: function () {\n if (this.NPOT) {\n return glenum.CLAMP_TO_EDGE;\n }\n return this.wrapS;\n },\n getAvailableWrapT: function () {\n if (this.NPOT) {\n return glenum.CLAMP_TO_EDGE;\n }\n return this.wrapT;\n },\n getAvailableMinFilter: function () {\n var minFilter = this.minFilter;\n if (this.NPOT || !this.useMipmap) {\n if (minFilter === glenum.NEAREST_MIPMAP_NEAREST ||\n minFilter === glenum.NEAREST_MIPMAP_LINEAR\n ) {\n return glenum.NEAREST;\n }\n else if (minFilter === glenum.LINEAR_MIPMAP_LINEAR ||\n minFilter === glenum.LINEAR_MIPMAP_NEAREST\n ) {\n return glenum.LINEAR;\n }\n else {\n return minFilter;\n }\n }\n else {\n return minFilter;\n }\n },\n getAvailableMagFilter: function () {\n return this.magFilter;\n },\n\n nextHighestPowerOfTwo: function (x) {\n --x;\n for (var i = 1; i < 32; i <<= 1) {\n x = x | x >> i;\n }\n return x + 1;\n },\n /**\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n\n var cache = this._cache;\n\n cache.use(renderer.__uid__);\n\n var webglTexture = cache.get('webgl_texture');\n if (webglTexture){\n renderer.gl.deleteTexture(webglTexture);\n }\n cache.deleteContext(renderer.__uid__);\n\n },\n /**\n * Test if image of texture is valid and loaded.\n * @return {boolean}\n */\n isRenderable: function () {},\n\n /**\n * Test if texture size is power of two\n * @return {boolean}\n */\n isPowerOfTwo: function () {}\n});\n\nObject.defineProperty(Texture.prototype, 'width', {\n get: function () {\n return this._width;\n },\n set: function (value) {\n this._width = value;\n }\n});\nObject.defineProperty(Texture.prototype, 'height', {\n get: function () {\n return this._height;\n },\n set: function (value) {\n this._height = value;\n }\n});\n\n/* DataType */\n\n/**\n * @type {number}\n */\nTexture.BYTE = glenum.BYTE;\n/**\n * @type {number}\n */\nTexture.UNSIGNED_BYTE = glenum.UNSIGNED_BYTE;\n/**\n * @type {number}\n */\nTexture.SHORT = glenum.SHORT;\n/**\n * @type {number}\n */\nTexture.UNSIGNED_SHORT = glenum.UNSIGNED_SHORT;\n/**\n * @type {number}\n */\nTexture.INT = glenum.INT;\n/**\n * @type {number}\n */\nTexture.UNSIGNED_INT = glenum.UNSIGNED_INT;\n/**\n * @type {number}\n */\nTexture.FLOAT = glenum.FLOAT;\n/**\n * @type {number}\n */\nTexture.HALF_FLOAT = 0x8D61;\n\n/**\n * UNSIGNED_INT_24_8_WEBGL for WEBGL_depth_texture extension\n * @type {number}\n */\nTexture.UNSIGNED_INT_24_8_WEBGL = 34042;\n\n/* PixelFormat */\n/**\n * @type {number}\n */\nTexture.DEPTH_COMPONENT = glenum.DEPTH_COMPONENT;\n/**\n * @type {number}\n */\nTexture.DEPTH_STENCIL = glenum.DEPTH_STENCIL;\n/**\n * @type {number}\n */\nTexture.ALPHA = glenum.ALPHA;\n/**\n * @type {number}\n */\nTexture.RGB = glenum.RGB;\n/**\n * @type {number}\n */\nTexture.RGBA = glenum.RGBA;\n/**\n * @type {number}\n */\nTexture.LUMINANCE = glenum.LUMINANCE;\n/**\n * @type {number}\n */\nTexture.LUMINANCE_ALPHA = glenum.LUMINANCE_ALPHA;\n\n/**\n * @see https://www.khronos.org/registry/webgl/extensions/EXT_sRGB/\n * @type {number}\n */\nTexture.SRGB = 0x8C40;\n/**\n * @see https://www.khronos.org/registry/webgl/extensions/EXT_sRGB/\n * @type {number}\n */\nTexture.SRGB_ALPHA = 0x8C42;\n\n/* Compressed Texture */\nTexture.COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;\nTexture.COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;\nTexture.COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;\nTexture.COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;\n\n/* TextureMagFilter */\n/**\n * @type {number}\n */\nTexture.NEAREST = glenum.NEAREST;\n/**\n * @type {number}\n */\nTexture.LINEAR = glenum.LINEAR;\n\n/* TextureMinFilter */\n/**\n * @type {number}\n */\nTexture.NEAREST_MIPMAP_NEAREST = glenum.NEAREST_MIPMAP_NEAREST;\n/**\n * @type {number}\n */\nTexture.LINEAR_MIPMAP_NEAREST = glenum.LINEAR_MIPMAP_NEAREST;\n/**\n * @type {number}\n */\nTexture.NEAREST_MIPMAP_LINEAR = glenum.NEAREST_MIPMAP_LINEAR;\n/**\n * @type {number}\n */\nTexture.LINEAR_MIPMAP_LINEAR = glenum.LINEAR_MIPMAP_LINEAR;\n\n/* TextureWrapMode */\n/**\n * @type {number}\n */\nTexture.REPEAT = glenum.REPEAT;\n/**\n * @type {number}\n */\nTexture.CLAMP_TO_EDGE = glenum.CLAMP_TO_EDGE;\n/**\n * @type {number}\n */\nTexture.MIRRORED_REPEAT = glenum.MIRRORED_REPEAT;\n\n\nexport default Texture;\n","import Renderable from './Renderable';\nimport glenum from './core/glenum';\n\n/**\n * @constructor clay.Mesh\n * @extends clay.Renderable\n */\nvar Mesh = Renderable.extend(/** @lends clay.Mesh# */ {\n /**\n * Used when it is a skinned mesh\n * @type {clay.Skeleton}\n */\n skeleton: null,\n /**\n * Joints indices Meshes can share the one skeleton instance and each mesh can use one part of joints. Joints indices indicate the index of joint in the skeleton instance\n * @type {number[]}\n */\n joints: null\n\n}, function () {\n if (!this.joints) {\n this.joints = [];\n }\n}, {\n\n /**\n * Offset matrix used for multiple skinned mesh clone sharing one skeleton\n * @type {clay.Matrix4}\n */\n offsetMatrix: null,\n\n isInstancedMesh: function () { return false; },\n\n isSkinnedMesh: function () {\n return !!(this.skeleton && this.joints && this.joints.length > 0);\n },\n\n clone: function () {\n var mesh = Renderable.prototype.clone.call(this);\n mesh.skeleton = this.skeleton;\n if (this.joints) {\n mesh.joints = this.joints.slice();\n }\n return mesh;\n }\n});\n\n// Enums\nMesh.POINTS = glenum.POINTS;\nMesh.LINES = glenum.LINES;\nMesh.LINE_LOOP = glenum.LINE_LOOP;\nMesh.LINE_STRIP = glenum.LINE_STRIP;\nMesh.TRIANGLES = glenum.TRIANGLES;\nMesh.TRIANGLE_STRIP = glenum.TRIANGLE_STRIP;\nMesh.TRIANGLE_FAN = glenum.TRIANGLE_FAN;\n\nMesh.BACK = glenum.BACK;\nMesh.FRONT = glenum.FRONT;\nMesh.FRONT_AND_BACK = glenum.FRONT_AND_BACK;\nMesh.CW = glenum.CW;\nMesh.CCW = glenum.CCW;\n\nexport default Mesh;\n","var mathUtil = {};\n\nmathUtil.isPowerOfTwo = function (value) {\n return (value & (value - 1)) === 0;\n};\n\nmathUtil.nextPowerOfTwo = function (value) {\n value --;\n value |= value >> 1;\n value |= value >> 2;\n value |= value >> 4;\n value |= value >> 8;\n value |= value >> 16;\n value ++;\n\n return value;\n};\n\nmathUtil.nearestPowerOfTwo = function (value) {\n return Math.pow( 2, Math.round( Math.log( value ) / Math.LN2 ) );\n};\n\nexport default mathUtil;\n","import Texture from './Texture';\nimport glenum from './core/glenum';\nimport vendor from './core/vendor';\nimport mathUtil from './math/util';\nvar isPowerOfTwo = mathUtil.isPowerOfTwo;\n\nfunction nearestPowerOfTwo(val) {\n return Math.pow(2, Math.round(Math.log(val) / Math.LN2));\n}\nfunction convertTextureToPowerOfTwo(texture, canvas) {\n // var canvas = document.createElement('canvas');\n var width = nearestPowerOfTwo(texture.width);\n var height = nearestPowerOfTwo(texture.height);\n canvas = canvas || document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n var ctx = canvas.getContext('2d');\n ctx.drawImage(texture.image, 0, 0, width, height);\n\n return canvas;\n}\n\n/**\n * @constructor clay.Texture2D\n * @extends clay.Texture\n *\n * @example\n * ...\n * var mat = new clay.Material({\n * shader: clay.shader.library.get('clay.phong', 'diffuseMap')\n * });\n * var diffuseMap = new clay.Texture2D();\n * diffuseMap.load('assets/textures/diffuse.jpg');\n * mat.set('diffuseMap', diffuseMap);\n * ...\n * diffuseMap.success(function () {\n * // Wait for the diffuse texture loaded\n * animation.on('frame', function (frameTime) {\n * renderer.render(scene, camera);\n * });\n * });\n */\nvar Texture2D = Texture.extend(function () {\n return /** @lends clay.Texture2D# */ {\n /**\n * @type {?HTMLImageElement|HTMLCanvasElemnet}\n */\n // TODO mark dirty when assigned.\n image: null,\n /**\n * Pixels data. Will be ignored if image is set.\n * @type {?Uint8Array|Float32Array}\n */\n pixels: null,\n /**\n * @type {Array.}\n * @example\n * [{\n * image: mipmap0,\n * pixels: null\n * }, {\n * image: mipmap1,\n * pixels: null\n * }, ....]\n */\n mipmaps: [],\n\n /**\n * If convert texture to power-of-two\n * @type {boolean}\n */\n convertToPOT: false\n };\n}, {\n\n textureType: 'texture2D',\n\n update: function (renderer) {\n\n var _gl = renderer.gl;\n _gl.bindTexture(_gl.TEXTURE_2D, this._cache.get('webgl_texture'));\n\n this.updateCommon(renderer);\n\n var glFormat = this.format;\n var glType = this.type;\n\n // Convert to pot is only available when using image/canvas/video element.\n var convertToPOT = !!(this.convertToPOT\n && !this.mipmaps.length && this.image\n && (this.wrapS === Texture.REPEAT || this.wrapT === Texture.REPEAT)\n && this.NPOT\n );\n\n _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, convertToPOT ? this.wrapS : this.getAvailableWrapS());\n _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, convertToPOT ? this.wrapT : this.getAvailableWrapT());\n\n _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, convertToPOT ? this.magFilter : this.getAvailableMagFilter());\n _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, convertToPOT ? this.minFilter : this.getAvailableMinFilter());\n\n var anisotropicExt = renderer.getGLExtension('EXT_texture_filter_anisotropic');\n if (anisotropicExt && this.anisotropic > 1) {\n _gl.texParameterf(_gl.TEXTURE_2D, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropic);\n }\n\n // Fallback to float type if browser don't have half float extension\n if (glType === 36193) {\n var halfFloatExt = renderer.getGLExtension('OES_texture_half_float');\n if (!halfFloatExt) {\n glType = glenum.FLOAT;\n }\n }\n\n if (this.mipmaps.length) {\n var width = this.width;\n var height = this.height;\n for (var i = 0; i < this.mipmaps.length; i++) {\n var mipmap = this.mipmaps[i];\n this._updateTextureData(_gl, mipmap, i, width, height, glFormat, glType, false);\n width /= 2;\n height /= 2;\n }\n }\n else {\n this._updateTextureData(_gl, this, 0, this.width, this.height, glFormat, glType, convertToPOT);\n\n if (this.useMipmap && (!this.NPOT || convertToPOT)) {\n _gl.generateMipmap(_gl.TEXTURE_2D);\n }\n }\n\n _gl.bindTexture(_gl.TEXTURE_2D, null);\n },\n\n _updateTextureData: function (_gl, data, level, width, height, glFormat, glType, convertToPOT) {\n if (data.image) {\n var imgData = data.image;\n if (convertToPOT) {\n this._potCanvas = convertTextureToPowerOfTwo(this, this._potCanvas);\n imgData = this._potCanvas;\n }\n _gl.texImage2D(_gl.TEXTURE_2D, level, glFormat, glFormat, glType, imgData);\n }\n else {\n // Can be used as a blank texture when writing render to texture(RTT)\n if (\n glFormat <= Texture.COMPRESSED_RGBA_S3TC_DXT5_EXT\n && glFormat >= Texture.COMPRESSED_RGB_S3TC_DXT1_EXT\n ) {\n _gl.compressedTexImage2D(_gl.TEXTURE_2D, level, glFormat, width, height, 0, data.pixels);\n }\n else {\n // Is a render target if pixels is null\n _gl.texImage2D(_gl.TEXTURE_2D, level, glFormat, width, height, 0, glFormat, glType, data.pixels);\n }\n }\n },\n\n /**\n * @param {clay.Renderer} renderer\n * @memberOf clay.Texture2D.prototype\n */\n generateMipmap: function (renderer) {\n var _gl = renderer.gl;\n if (this.useMipmap && !this.NPOT) {\n _gl.bindTexture(_gl.TEXTURE_2D, this._cache.get('webgl_texture'));\n _gl.generateMipmap(_gl.TEXTURE_2D);\n }\n },\n\n isPowerOfTwo: function () {\n return isPowerOfTwo(this.width) && isPowerOfTwo(this.height);\n },\n\n isRenderable: function () {\n if (this.image) {\n return this.image.width > 0 && this.image.height > 0;\n }\n else {\n return !!(this.width && this.height);\n }\n },\n\n bind: function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, this.getWebGLTexture(renderer));\n },\n\n unbind: function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, null);\n },\n\n load: function (src, crossOrigin) {\n var image = vendor.createImage();\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n var self = this;\n image.onload = function () {\n self.dirty();\n self.trigger('success', self);\n };\n image.onerror = function () {\n self.trigger('error', self);\n };\n\n image.src = src;\n this.image = image;\n\n return this;\n }\n});\n\nObject.defineProperty(Texture2D.prototype, 'width', {\n get: function () {\n if (this.image) {\n return this.image.width;\n }\n return this._width;\n },\n set: function (value) {\n if (this.image) {\n console.warn('Texture from image can\\'t set width');\n }\n else {\n if (this._width !== value) {\n this.dirty();\n }\n this._width = value;\n }\n }\n});\nObject.defineProperty(Texture2D.prototype, 'height', {\n get: function () {\n if (this.image) {\n return this.image.height;\n }\n return this._height;\n },\n set: function (value) {\n if (this.image) {\n console.warn('Texture from image can\\'t set height');\n }\n else {\n if (this._height !== value) {\n this.dirty();\n }\n this._height = value;\n }\n }\n});\n\nexport default Texture2D;\n","import Base from './core/Base';\nimport glenum from './core/glenum';\nimport Cache from './core/Cache';\nimport vendor from './core/vendor';\n\nfunction getArrayCtorByType (type) {\n return ({\n 'byte': vendor.Int8Array,\n 'ubyte': vendor.Uint8Array,\n 'short': vendor.Int16Array,\n 'ushort': vendor.Uint16Array\n })[type] || vendor.Float32Array;\n}\n\nfunction makeAttrKey(attrName) {\n return 'attr_' + attrName;\n}\n/**\n * GeometryBase attribute\n * @alias clay.GeometryBase.Attribute\n * @constructor\n */\nfunction Attribute(name, type, size, semantic) {\n /**\n * Attribute name\n * @type {string}\n */\n this.name = name;\n /**\n * Attribute type\n * Possible values:\n * + `'byte'`\n * + `'ubyte'`\n * + `'short'`\n * + `'ushort'`\n * + `'float'` Most commonly used.\n * @type {string}\n */\n this.type = type;\n /**\n * Size of attribute component. 1 - 4.\n * @type {number}\n */\n this.size = size;\n /**\n * Semantic of this attribute.\n * Possible values:\n * + `'POSITION'`\n * + `'NORMAL'`\n * + `'BINORMAL'`\n * + `'TANGENT'`\n * + `'TEXCOORD'`\n * + `'TEXCOORD_0'`\n * + `'TEXCOORD_1'`\n * + `'COLOR'`\n * + `'JOINT'`\n * + `'WEIGHT'`\n *\n * In shader, attribute with same semantic will be automatically mapped. For example:\n * ```glsl\n * attribute vec3 pos: POSITION\n * ```\n * will use the attribute value with semantic POSITION in geometry, no matter what name it used.\n * @type {string}\n */\n this.semantic = semantic || '';\n\n /**\n * Value of the attribute.\n * @type {TypedArray}\n */\n this.value = null;\n\n // Init getter setter\n switch (size) {\n case 1:\n this.get = function (idx) {\n return this.value[idx];\n };\n this.set = function (idx, value) {\n this.value[idx] = value;\n };\n // Copy from source to target\n this.copy = function (target, source) {\n this.value[target] = this.value[target];\n };\n break;\n case 2:\n this.get = function (idx, out) {\n var arr = this.value;\n out[0] = arr[idx * 2];\n out[1] = arr[idx * 2 + 1];\n return out;\n };\n this.set = function (idx, val) {\n var arr = this.value;\n arr[idx * 2] = val[0];\n arr[idx * 2 + 1] = val[1];\n };\n this.copy = function (target, source) {\n var arr = this.value;\n source *= 2;\n target *= 2;\n arr[target] = arr[source];\n arr[target + 1] = arr[source + 1];\n };\n break;\n case 3:\n this.get = function (idx, out) {\n var idx3 = idx * 3;\n var arr = this.value;\n out[0] = arr[idx3];\n out[1] = arr[idx3 + 1];\n out[2] = arr[idx3 + 2];\n return out;\n };\n this.set = function (idx, val) {\n var idx3 = idx * 3;\n var arr = this.value;\n arr[idx3] = val[0];\n arr[idx3 + 1] = val[1];\n arr[idx3 + 2] = val[2];\n };\n this.copy = function (target, source) {\n var arr = this.value;\n source *= 3;\n target *= 3;\n arr[target] = arr[source];\n arr[target + 1] = arr[source + 1];\n arr[target + 2] = arr[source + 2];\n };\n break;\n case 4:\n this.get = function (idx, out) {\n var arr = this.value;\n var idx4 = idx * 4;\n out[0] = arr[idx4];\n out[1] = arr[idx4 + 1];\n out[2] = arr[idx4 + 2];\n out[3] = arr[idx4 + 3];\n return out;\n };\n this.set = function (idx, val) {\n var arr = this.value;\n var idx4 = idx * 4;\n arr[idx4] = val[0];\n arr[idx4 + 1] = val[1];\n arr[idx4 + 2] = val[2];\n arr[idx4 + 3] = val[3];\n };\n this.copy = function (target, source) {\n var arr = this.value;\n source *= 4;\n target *= 4;\n // copyWithin is extremely slow\n arr[target] = arr[source];\n arr[target + 1] = arr[source + 1];\n arr[target + 2] = arr[source + 2];\n arr[target + 3] = arr[source + 3];\n };\n }\n}\n\n/**\n * Set item value at give index. Second parameter val is number if size is 1\n * @function\n * @name clay.GeometryBase.Attribute#set\n * @param {number} idx\n * @param {number[]|number} val\n * @example\n * geometry.getAttribute('position').set(0, [1, 1, 1]);\n */\n\n/**\n * Get item value at give index. Second parameter out is no need if size is 1\n * @function\n * @name clay.GeometryBase.Attribute#set\n * @param {number} idx\n * @param {number[]} [out]\n * @example\n * geometry.getAttribute('position').get(0, out);\n */\n\n/**\n * Initialize attribute with given vertex count\n * @param {number} nVertex\n */\nAttribute.prototype.init = function (nVertex) {\n if (!this.value || this.value.length !== nVertex * this.size) {\n var ArrayConstructor = getArrayCtorByType(this.type);\n this.value = new ArrayConstructor(nVertex * this.size);\n }\n};\n\n/**\n * Initialize attribute with given array. Which can be 1 dimensional or 2 dimensional\n * @param {Array} array\n * @example\n * geometry.getAttribute('position').fromArray(\n * [-1, 0, 0, 1, 0, 0, 0, 1, 0]\n * );\n * geometry.getAttribute('position').fromArray(\n * [ [-1, 0, 0], [1, 0, 0], [0, 1, 0] ]\n * );\n */\nAttribute.prototype.fromArray = function (array) {\n var ArrayConstructor = getArrayCtorByType(this.type);\n var value;\n // Convert 2d array to flat\n if (array[0] && (array[0].length)) {\n var n = 0;\n var size = this.size;\n value = new ArrayConstructor(array.length * size);\n for (var i = 0; i < array.length; i++) {\n for (var j = 0; j < size; j++) {\n value[n++] = array[i][j];\n }\n }\n }\n else {\n value = new ArrayConstructor(array);\n }\n this.value = value;\n};\n\nAttribute.prototype.clone = function(copyValue) {\n var ret = new Attribute(this.name, this.type, this.size, this.semantic);\n // FIXME\n if (copyValue) {\n console.warn('todo');\n }\n return ret;\n};\n\nfunction AttributeBuffer(name, type, buffer, size, semantic) {\n this.name = name;\n this.type = type;\n this.buffer = buffer;\n this.size = size;\n this.semantic = semantic;\n\n // To be set in mesh\n // symbol in the shader\n this.symbol = '';\n\n // Needs remove flag\n this.needsRemove = false;\n}\n\nfunction IndicesBuffer(buffer) {\n this.buffer = buffer;\n this.count = 0;\n}\n\n/**\n * Base of all geometry. Use {@link clay.Geometry} for common 3D usage.\n * @constructor clay.GeometryBase\n * @extends clay.core.Base\n */\nvar GeometryBase = Base.extend(function () {\n return /** @lends clay.GeometryBase# */ {\n /**\n * Attributes of geometry.\n * @type {Object.}\n */\n attributes: {},\n\n /**\n * Indices of geometry.\n * @type {Uint16Array|Uint32Array}\n */\n indices: null,\n\n /**\n * Is vertices data dynamically updated.\n * Attributes value can't be changed after first render if dyanmic is false.\n * @type {boolean}\n */\n dynamic: true,\n\n _enabledAttributes: null,\n\n // PENDING\n // Init it here to avoid deoptimization when it's assigned in application dynamically\n __used: 0\n };\n}, function () {\n // Use cache\n this._cache = new Cache();\n\n this._attributeList = Object.keys(this.attributes);\n\n this.__vaoCache = {};\n},\n/** @lends clay.GeometryBase.prototype */\n{\n /**\n * Main attribute will be used to count vertex number\n * @type {string}\n */\n mainAttribute: '',\n /**\n * User defined picking algorithm instead of default\n * triangle ray intersection\n * x, y are NDC.\n * ```typescript\n * (x, y, renderer, camera, renderable, out) => boolean\n * ```\n * @type {?Function}\n */\n pick: null,\n\n /**\n * User defined ray picking algorithm instead of default\n * triangle ray intersection\n * ```typescript\n * (ray: clay.Ray, renderable: clay.Renderable, out: Array) => boolean\n * ```\n * @type {?Function}\n */\n pickByRay: null,\n\n /**\n * Mark attributes and indices in geometry needs to update.\n * Usually called after you change the data in attributes.\n */\n dirty: function () {\n var enabledAttributes = this.getEnabledAttributes();\n for (var i = 0; i < enabledAttributes.length; i++) {\n this.dirtyAttribute(enabledAttributes[i]);\n }\n this.dirtyIndices();\n this._enabledAttributes = null;\n\n this._cache.dirty('any');\n },\n /**\n * Mark the indices needs to update.\n */\n dirtyIndices: function () {\n this._cache.dirtyAll('indices');\n },\n /**\n * Mark the attributes needs to update.\n * @param {string} [attrName]\n */\n dirtyAttribute: function (attrName) {\n this._cache.dirtyAll(makeAttrKey(attrName));\n this._cache.dirtyAll('attributes');\n },\n /**\n * Get indices of triangle at given index.\n * @param {number} idx\n * @param {Array.} out\n * @return {Array.}\n */\n getTriangleIndices: function (idx, out) {\n if (idx < this.triangleCount && idx >= 0) {\n if (!out) {\n out = [];\n }\n var indices = this.indices;\n out[0] = indices[idx * 3];\n out[1] = indices[idx * 3 + 1];\n out[2] = indices[idx * 3 + 2];\n return out;\n }\n },\n\n /**\n * Set indices of triangle at given index.\n * @param {number} idx\n * @param {Array.} arr\n */\n setTriangleIndices: function (idx, arr) {\n var indices = this.indices;\n indices[idx * 3] = arr[0];\n indices[idx * 3 + 1] = arr[1];\n indices[idx * 3 + 2] = arr[2];\n },\n\n isUseIndices: function () {\n return !!this.indices;\n },\n\n /**\n * Initialize indices from an array.\n * @param {Array} array\n */\n initIndicesFromArray: function (array) {\n var value;\n var ArrayConstructor = this.vertexCount > 0xffff\n ? vendor.Uint32Array : vendor.Uint16Array;\n // Convert 2d array to flat\n if (array[0] && (array[0].length)) {\n var n = 0;\n var size = 3;\n\n value = new ArrayConstructor(array.length * size);\n for (var i = 0; i < array.length; i++) {\n for (var j = 0; j < size; j++) {\n value[n++] = array[i][j];\n }\n }\n }\n else {\n value = new ArrayConstructor(array);\n }\n\n this.indices = value;\n },\n /**\n * Create a new attribute\n * @param {string} name\n * @param {string} type\n * @param {number} size\n * @param {string} [semantic]\n */\n createAttribute: function (name, type, size, semantic) {\n var attrib = new Attribute(name, type, size, semantic);\n if (this.attributes[name]) {\n this.removeAttribute(name);\n }\n this.attributes[name] = attrib;\n this._attributeList.push(name);\n return attrib;\n },\n /**\n * Remove attribute\n * @param {string} name\n */\n removeAttribute: function (name) {\n var attributeList = this._attributeList;\n var idx = attributeList.indexOf(name);\n if (idx >= 0) {\n attributeList.splice(idx, 1);\n delete this.attributes[name];\n return true;\n }\n return false;\n },\n\n /**\n * Get attribute\n * @param {string} name\n * @return {clay.GeometryBase.Attribute}\n */\n getAttribute: function (name) {\n return this.attributes[name];\n },\n\n /**\n * Get enabled attributes name list\n * Attribute which has the same vertex number with position is treated as a enabled attribute\n * @return {string[]}\n */\n getEnabledAttributes: function () {\n var enabledAttributes = this._enabledAttributes;\n var attributeList = this._attributeList;\n // Cache\n if (enabledAttributes) {\n return enabledAttributes;\n }\n\n var result = [];\n var nVertex = this.vertexCount;\n\n for (var i = 0; i < attributeList.length; i++) {\n var name = attributeList[i];\n var attrib = this.attributes[name];\n if (attrib.value) {\n if (attrib.value.length === nVertex * attrib.size) {\n result.push(name);\n }\n }\n }\n\n this._enabledAttributes = result;\n\n return result;\n },\n\n getBufferChunks: function (renderer) {\n var cache = this._cache;\n cache.use(renderer.__uid__);\n var isAttributesDirty = cache.isDirty('attributes');\n var isIndicesDirty = cache.isDirty('indices');\n if (isAttributesDirty || isIndicesDirty) {\n this._updateBuffer(renderer.gl, isAttributesDirty, isIndicesDirty);\n var enabledAttributes = this.getEnabledAttributes();\n for (var i = 0; i < enabledAttributes.length; i++) {\n cache.fresh(makeAttrKey(enabledAttributes[i]));\n }\n cache.fresh('attributes');\n cache.fresh('indices');\n }\n cache.fresh('any');\n return cache.get('chunks');\n },\n\n _updateBuffer: function (_gl, isAttributesDirty, isIndicesDirty) {\n var cache = this._cache;\n var chunks = cache.get('chunks');\n var firstUpdate = false;\n if (!chunks) {\n chunks = [];\n // Intialize\n chunks[0] = {\n attributeBuffers: [],\n indicesBuffer: null\n };\n cache.put('chunks', chunks);\n firstUpdate = true;\n }\n\n var chunk = chunks[0];\n var attributeBuffers = chunk.attributeBuffers;\n var indicesBuffer = chunk.indicesBuffer;\n\n if (isAttributesDirty || firstUpdate) {\n var attributeList = this.getEnabledAttributes();\n\n var attributeBufferMap = {};\n if (!firstUpdate) {\n for (var i = 0; i < attributeBuffers.length; i++) {\n attributeBufferMap[attributeBuffers[i].name] = attributeBuffers[i];\n }\n }\n // FIXME If some attributes removed\n for (var k = 0; k < attributeList.length; k++) {\n var name = attributeList[k];\n var attribute = this.attributes[name];\n\n var bufferInfo;\n\n if (!firstUpdate) {\n bufferInfo = attributeBufferMap[name];\n }\n var buffer;\n if (bufferInfo) {\n buffer = bufferInfo.buffer;\n }\n else {\n buffer = _gl.createBuffer();\n }\n if (cache.isDirty(makeAttrKey(name))) {\n // Only update when they are dirty.\n // TODO: Use BufferSubData?\n _gl.bindBuffer(_gl.ARRAY_BUFFER, buffer);\n _gl.bufferData(_gl.ARRAY_BUFFER, attribute.value, this.dynamic ? _gl.DYNAMIC_DRAW : _gl.STATIC_DRAW);\n }\n\n attributeBuffers[k] = new AttributeBuffer(name, attribute.type, buffer, attribute.size, attribute.semantic);\n }\n // Remove unused attributes buffers.\n // PENDING\n for (var i = k; i < attributeBuffers.length; i++) {\n _gl.deleteBuffer(attributeBuffers[i].buffer);\n }\n attributeBuffers.length = k;\n\n }\n\n if (this.isUseIndices() && (isIndicesDirty || firstUpdate)) {\n if (!indicesBuffer) {\n indicesBuffer = new IndicesBuffer(_gl.createBuffer());\n chunk.indicesBuffer = indicesBuffer;\n }\n indicesBuffer.count = this.indices.length;\n _gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER, indicesBuffer.buffer);\n _gl.bufferData(_gl.ELEMENT_ARRAY_BUFFER, this.indices, this.dynamic ? _gl.DYNAMIC_DRAW : _gl.STATIC_DRAW);\n }\n },\n\n /**\n * Dispose geometry data in GL context.\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n\n var cache = this._cache;\n\n cache.use(renderer.__uid__);\n var chunks = cache.get('chunks');\n if (chunks) {\n for (var c = 0; c < chunks.length; c++) {\n var chunk = chunks[c];\n\n for (var k = 0; k < chunk.attributeBuffers.length; k++) {\n var attribs = chunk.attributeBuffers[k];\n renderer.gl.deleteBuffer(attribs.buffer);\n }\n\n if (chunk.indicesBuffer) {\n renderer.gl.deleteBuffer(chunk.indicesBuffer.buffer);\n }\n }\n }\n if (this.__vaoCache) {\n var vaoExt = renderer.getGLExtension('OES_vertex_array_object');\n for (var id in this.__vaoCache) {\n var vao = this.__vaoCache[id].vao;\n if (vao) {\n vaoExt.deleteVertexArrayOES(vao);\n }\n }\n }\n this.__vaoCache = {};\n cache.deleteContext(renderer.__uid__);\n }\n\n});\n\nif (Object.defineProperty) {\n /**\n * @name clay.GeometryBase#vertexCount\n * @type {number}\n * @readOnly\n */\n Object.defineProperty(GeometryBase.prototype, 'vertexCount', {\n\n enumerable: false,\n\n get: function () {\n\n var mainAttribute = this.attributes[this.mainAttribute];\n\n if (!mainAttribute) {\n mainAttribute = this.attributes[this._attributeList[0]];\n }\n\n if (!mainAttribute || !mainAttribute.value) {\n return 0;\n }\n return mainAttribute.value.length / mainAttribute.size;\n }\n });\n /**\n * @name clay.GeometryBase#triangleCount\n * @type {number}\n * @readOnly\n */\n Object.defineProperty(GeometryBase.prototype, 'triangleCount', {\n\n enumerable: false,\n\n get: function () {\n var indices = this.indices;\n if (!indices) {\n return 0;\n }\n else {\n return indices.length / 3;\n }\n }\n });\n}\n\nGeometryBase.STATIC_DRAW = glenum.STATIC_DRAW;\nGeometryBase.DYNAMIC_DRAW = glenum.DYNAMIC_DRAW;\nGeometryBase.STREAM_DRAW = glenum.STREAM_DRAW;\n\nGeometryBase.AttributeBuffer = AttributeBuffer;\nGeometryBase.IndicesBuffer = IndicesBuffer;\n\nGeometryBase.Attribute = Attribute;\n\nexport default GeometryBase;\n","import vendor from './core/vendor';\nimport vec3 from './glmatrix/vec3';\nimport mat4 from './glmatrix/mat4';\nimport BoundingBox from './math/BoundingBox';\nimport GeometryBase from './GeometryBase';\n\nvar vec3Create = vec3.create;\nvar vec3Add = vec3.add;\nvar vec3Set = vec3.set;\n\nvar Attribute = GeometryBase.Attribute;\n\n/**\n * Geometry in ClayGL contains vertex attributes of mesh. These vertex attributes will be finally provided to the {@link clay.Shader}.\n * Different {@link clay.Shader} needs different attributes. Here is a list of attributes used in the builtin shaders.\n *\n * + position: `clay.basic`, `clay.lambert`, `clay.standard`\n * + texcoord0: `clay.basic`, `clay.lambert`, `clay.standard`\n * + color: `clay.basic`, `clay.lambert`, `clay.standard`\n * + weight: `clay.basic`, `clay.lambert`, `clay.standard`\n * + joint: `clay.basic`, `clay.lambert`, `clay.standard`\n * + normal: `clay.lambert`, `clay.standard`\n * + tangent: `clay.standard`\n *\n * #### Create a procedural geometry\n *\n * ClayGL provides a couple of builtin procedural geometries. Inlcuding:\n *\n * + {@link clay.geometry.Cube}\n * + {@link clay.geometry.Sphere}\n * + {@link clay.geometry.Plane}\n * + {@link clay.geometry.Cylinder}\n * + {@link clay.geometry.Cone}\n * + {@link clay.geometry.ParametricSurface}\n *\n * It's simple to create a basic geometry with these classes.\n *\n```js\nvar sphere = new clay.geometry.Sphere({\n radius: 2\n});\n```\n *\n * #### Create the geometry data by yourself\n *\n * Usually the vertex attributes data are created by the {@link clay.loader.GLTF} or procedural geometries like {@link clay.geometry.Sphere}.\n * Besides these, you can create the data manually. Here is a simple example to create a triangle.\n```js\nvar TRIANGLE_POSITIONS = [\n [-0.5, -0.5, 0],\n [0.5, -0.5, 0],\n [0, 0.5, 0]\n];\nvar geometry = new clay.StaticGeometryBase();\n// Add triangle vertices to position attribute.\ngeometry.attributes.position.fromArray(TRIANGLE_POSITIONS);\n```\n * Then you can use the utility methods like `generateVertexNormals`, `generateTangents` to create the remaining necessary attributes.\n *\n *\n * #### Use with custom shaders\n *\n * If you wan't to write custom shaders. Don't forget to add SEMANTICS to these attributes. For example\n *\n ```glsl\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n```\n * These `POSITION`, `TEXCOORD_0`, `NORMAL` are SEMANTICS which will map the attributes in shader to the attributes in the GeometryBase\n *\n * Available attributes SEMANTICS includes `POSITION`, `TEXCOORD_0`, `TEXCOORD_1` `NORMAL`, `TANGENT`, `COLOR`, `WEIGHT`, `JOINT`.\n *\n *\n * @constructor clay.Geometry\n * @extends clay.GeometryBase\n */\nvar Geometry = GeometryBase.extend(function () {\n return /** @lends clay.Geometry# */ {\n /**\n * Attributes of geometry. Including:\n * + `position`\n * + `texcoord0`\n * + `texcoord1`\n * + `normal`\n * + `tangent`\n * + `color`\n * + `weight`\n * + `joint`\n * + `barycentric`\n *\n * @type {Object.}\n */\n attributes: {\n position: new Attribute('position', 'float', 3, 'POSITION'),\n texcoord0: new Attribute('texcoord0', 'float', 2, 'TEXCOORD_0'),\n texcoord1: new Attribute('texcoord1', 'float', 2, 'TEXCOORD_1'),\n normal: new Attribute('normal', 'float', 3, 'NORMAL'),\n tangent: new Attribute('tangent', 'float', 4, 'TANGENT'),\n color: new Attribute('color', 'float', 4, 'COLOR'),\n // Skinning attributes\n // Each vertex can be bind to 4 bones, because the\n // sum of weights is 1, so the weights is stored in vec3 and the last\n // can be calculated by 1-w.x-w.y-w.z\n weight: new Attribute('weight', 'float', 3, 'WEIGHT'),\n joint: new Attribute('joint', 'float', 4, 'JOINT'),\n // For wireframe display\n // http://codeflow.org/entries/2012/aug/02/easy-wireframe-display-with-barycentric-coordinates/\n barycentric: new Attribute('barycentric', 'float', 3, null),\n },\n /**\n * Calculated bounding box of geometry.\n * @type {clay.BoundingBox}\n */\n boundingBox: null\n };\n},\n/** @lends clay.Geometry.prototype */\n{\n\n mainAttribute: 'position',\n\n /**\n * Update boundingBox of Geometry\n */\n updateBoundingBox: function () {\n var bbox = this.boundingBox;\n if (!bbox) {\n bbox = this.boundingBox = new BoundingBox();\n }\n var posArr = this.attributes.position.value;\n if (posArr && posArr.length) {\n var min = bbox.min;\n var max = bbox.max;\n var minArr = min.array;\n var maxArr = max.array;\n vec3.set(minArr, posArr[0], posArr[1], posArr[2]);\n vec3.set(maxArr, posArr[0], posArr[1], posArr[2]);\n for (var i = 3; i < posArr.length;) {\n var x = posArr[i++];\n var y = posArr[i++];\n var z = posArr[i++];\n if (x < minArr[0]) { minArr[0] = x; }\n if (y < minArr[1]) { minArr[1] = y; }\n if (z < minArr[2]) { minArr[2] = z; }\n\n if (x > maxArr[0]) { maxArr[0] = x; }\n if (y > maxArr[1]) { maxArr[1] = y; }\n if (z > maxArr[2]) { maxArr[2] = z; }\n }\n min._dirty = true;\n max._dirty = true;\n }\n },\n\n /**\n * Generate normals per vertex.\n */\n generateVertexNormals: function () {\n if (!this.vertexCount) {\n return;\n }\n\n var indices = this.indices;\n var attributes = this.attributes;\n var positions = attributes.position.value;\n var normals = attributes.normal.value;\n\n if (!normals || normals.length !== positions.length) {\n normals = attributes.normal.value = new vendor.Float32Array(positions.length);\n }\n else {\n // Reset\n for (var i = 0; i < normals.length; i++) {\n normals[i] = 0;\n }\n }\n\n var p1 = vec3Create();\n var p2 = vec3Create();\n var p3 = vec3Create();\n\n var v21 = vec3Create();\n var v32 = vec3Create();\n\n var n = vec3Create();\n\n var len = indices ? indices.length : this.vertexCount;\n var i1, i2, i3;\n for (var f = 0; f < len;) {\n if (indices) {\n i1 = indices[f++];\n i2 = indices[f++];\n i3 = indices[f++];\n }\n else {\n i1 = f++;\n i2 = f++;\n i3 = f++;\n }\n\n vec3Set(p1, positions[i1*3], positions[i1*3+1], positions[i1*3+2]);\n vec3Set(p2, positions[i2*3], positions[i2*3+1], positions[i2*3+2]);\n vec3Set(p3, positions[i3*3], positions[i3*3+1], positions[i3*3+2]);\n\n vec3.sub(v21, p1, p2);\n vec3.sub(v32, p2, p3);\n vec3.cross(n, v21, v32);\n // Already be weighted by the triangle area\n for (var i = 0; i < 3; i++) {\n normals[i1*3+i] = normals[i1*3+i] + n[i];\n normals[i2*3+i] = normals[i2*3+i] + n[i];\n normals[i3*3+i] = normals[i3*3+i] + n[i];\n }\n }\n\n for (var i = 0; i < normals.length;) {\n vec3Set(n, normals[i], normals[i+1], normals[i+2]);\n vec3.normalize(n, n);\n normals[i++] = n[0];\n normals[i++] = n[1];\n normals[i++] = n[2];\n }\n this.dirty();\n },\n\n /**\n * Generate normals per face.\n */\n generateFaceNormals: function () {\n if (!this.vertexCount) {\n return;\n }\n\n if (!this.isUniqueVertex()) {\n this.generateUniqueVertex();\n }\n\n var indices = this.indices;\n var attributes = this.attributes;\n var positions = attributes.position.value;\n var normals = attributes.normal.value;\n\n var p1 = vec3Create();\n var p2 = vec3Create();\n var p3 = vec3Create();\n\n var v21 = vec3Create();\n var v32 = vec3Create();\n var n = vec3Create();\n\n if (!normals) {\n normals = attributes.normal.value = new Float32Array(positions.length);\n }\n var len = indices ? indices.length : this.vertexCount;\n var i1, i2, i3;\n for (var f = 0; f < len;) {\n if (indices) {\n i1 = indices[f++];\n i2 = indices[f++];\n i3 = indices[f++];\n }\n else {\n i1 = f++;\n i2 = f++;\n i3 = f++;\n }\n\n vec3Set(p1, positions[i1*3], positions[i1*3+1], positions[i1*3+2]);\n vec3Set(p2, positions[i2*3], positions[i2*3+1], positions[i2*3+2]);\n vec3Set(p3, positions[i3*3], positions[i3*3+1], positions[i3*3+2]);\n\n vec3.sub(v21, p1, p2);\n vec3.sub(v32, p2, p3);\n vec3.cross(n, v21, v32);\n\n vec3.normalize(n, n);\n\n for (var i = 0; i < 3; i++) {\n normals[i1*3 + i] = n[i];\n normals[i2*3 + i] = n[i];\n normals[i3*3 + i] = n[i];\n }\n }\n this.dirty();\n },\n\n /**\n * Generate tangents attributes.\n */\n generateTangents: function () {\n if (!this.vertexCount) {\n return;\n }\n\n var nVertex = this.vertexCount;\n var attributes = this.attributes;\n if (!attributes.tangent.value) {\n attributes.tangent.value = new Float32Array(nVertex * 4);\n }\n var texcoords = attributes.texcoord0.value;\n var positions = attributes.position.value;\n var tangents = attributes.tangent.value;\n var normals = attributes.normal.value;\n\n if (!texcoords) {\n console.warn('Geometry without texcoords can\\'t generate tangents.');\n return;\n }\n\n var tan1 = [];\n var tan2 = [];\n for (var i = 0; i < nVertex; i++) {\n tan1[i] = [0.0, 0.0, 0.0];\n tan2[i] = [0.0, 0.0, 0.0];\n }\n\n var sdir = [0.0, 0.0, 0.0];\n var tdir = [0.0, 0.0, 0.0];\n var indices = this.indices;\n\n var len = indices ? indices.length : this.vertexCount;\n var i1, i2, i3;\n for (var i = 0; i < len;) {\n if (indices) {\n i1 = indices[i++];\n i2 = indices[i++];\n i3 = indices[i++];\n }\n else {\n i1 = i++;\n i2 = i++;\n i3 = i++;\n }\n\n var st1s = texcoords[i1 * 2],\n st2s = texcoords[i2 * 2],\n st3s = texcoords[i3 * 2],\n st1t = texcoords[i1 * 2 + 1],\n st2t = texcoords[i2 * 2 + 1],\n st3t = texcoords[i3 * 2 + 1],\n\n p1x = positions[i1 * 3],\n p2x = positions[i2 * 3],\n p3x = positions[i3 * 3],\n p1y = positions[i1 * 3 + 1],\n p2y = positions[i2 * 3 + 1],\n p3y = positions[i3 * 3 + 1],\n p1z = positions[i1 * 3 + 2],\n p2z = positions[i2 * 3 + 2],\n p3z = positions[i3 * 3 + 2];\n\n var x1 = p2x - p1x,\n x2 = p3x - p1x,\n y1 = p2y - p1y,\n y2 = p3y - p1y,\n z1 = p2z - p1z,\n z2 = p3z - p1z;\n\n var s1 = st2s - st1s,\n s2 = st3s - st1s,\n t1 = st2t - st1t,\n t2 = st3t - st1t;\n\n var r = 1.0 / (s1 * t2 - t1 * s2);\n sdir[0] = (t2 * x1 - t1 * x2) * r;\n sdir[1] = (t2 * y1 - t1 * y2) * r;\n sdir[2] = (t2 * z1 - t1 * z2) * r;\n\n tdir[0] = (s1 * x2 - s2 * x1) * r;\n tdir[1] = (s1 * y2 - s2 * y1) * r;\n tdir[2] = (s1 * z2 - s2 * z1) * r;\n\n vec3Add(tan1[i1], tan1[i1], sdir);\n vec3Add(tan1[i2], tan1[i2], sdir);\n vec3Add(tan1[i3], tan1[i3], sdir);\n vec3Add(tan2[i1], tan2[i1], tdir);\n vec3Add(tan2[i2], tan2[i2], tdir);\n vec3Add(tan2[i3], tan2[i3], tdir);\n }\n var tmp = vec3Create();\n var nCrossT = vec3Create();\n var n = vec3Create();\n for (var i = 0; i < nVertex; i++) {\n n[0] = normals[i * 3];\n n[1] = normals[i * 3 + 1];\n n[2] = normals[i * 3 + 2];\n var t = tan1[i];\n\n // Gram-Schmidt orthogonalize\n vec3.scale(tmp, n, vec3.dot(n, t));\n vec3.sub(tmp, t, tmp);\n vec3.normalize(tmp, tmp);\n // Calculate handedness.\n vec3.cross(nCrossT, n, t);\n tangents[i * 4] = tmp[0];\n tangents[i * 4 + 1] = tmp[1];\n tangents[i * 4 + 2] = tmp[2];\n // PENDING can config ?\n tangents[i * 4 + 3] = vec3.dot(nCrossT, tan2[i]) < 0.0 ? -1.0 : 1.0;\n }\n this.dirty();\n },\n\n /**\n * If vertices are not shared by different indices.\n */\n isUniqueVertex: function () {\n if (this.isUseIndices()) {\n return this.vertexCount === this.indices.length;\n }\n else {\n return true;\n }\n },\n /**\n * Create a unique vertex for each index.\n */\n generateUniqueVertex: function () {\n if (!this.vertexCount || !this.indices) {\n return;\n }\n\n if (this.indices.length > 0xffff) {\n this.indices = new vendor.Uint32Array(this.indices);\n }\n\n var attributes = this.attributes;\n var indices = this.indices;\n\n var attributeNameList = this.getEnabledAttributes();\n\n var oldAttrValues = {};\n for (var a = 0; a < attributeNameList.length; a++) {\n var name = attributeNameList[a];\n oldAttrValues[name] = attributes[name].value;\n attributes[name].init(this.indices.length);\n }\n\n var cursor = 0;\n for (var i = 0; i < indices.length; i++) {\n var ii = indices[i];\n for (var a = 0; a < attributeNameList.length; a++) {\n var name = attributeNameList[a];\n var array = attributes[name].value;\n var size = attributes[name].size;\n\n for (var k = 0; k < size; k++) {\n array[cursor * size + k] = oldAttrValues[name][ii * size + k];\n }\n }\n indices[i] = cursor;\n cursor++;\n }\n\n this.dirty();\n },\n\n /**\n * Generate barycentric coordinates for wireframe draw.\n */\n generateBarycentric: function () {\n if (!this.vertexCount) {\n return;\n }\n\n if (!this.isUniqueVertex()) {\n this.generateUniqueVertex();\n }\n\n var attributes = this.attributes;\n var array = attributes.barycentric.value;\n var indices = this.indices;\n // Already existed;\n if (array && array.length === indices.length * 3) {\n return;\n }\n array = attributes.barycentric.value = new Float32Array(indices.length * 3);\n\n for (var i = 0; i < (indices ? indices.length : this.vertexCount / 3);) {\n for (var j = 0; j < 3; j++) {\n var ii = indices ? indices[i++] : (i * 3 + j);\n array[ii * 3 + j] = 1;\n }\n }\n this.dirty();\n },\n\n /**\n * Apply transform to geometry attributes.\n * @param {clay.Matrix4} matrix\n */\n applyTransform: function (matrix) {\n\n var attributes = this.attributes;\n var positions = attributes.position.value;\n var normals = attributes.normal.value;\n var tangents = attributes.tangent.value;\n\n matrix = matrix.array;\n // Normal Matrix\n var inverseTransposeMatrix = mat4.create();\n mat4.invert(inverseTransposeMatrix, matrix);\n mat4.transpose(inverseTransposeMatrix, inverseTransposeMatrix);\n\n var vec3TransformMat4 = vec3.transformMat4;\n var vec3ForEach = vec3.forEach;\n vec3ForEach(positions, 3, 0, null, vec3TransformMat4, matrix);\n if (normals) {\n vec3ForEach(normals, 3, 0, null, vec3TransformMat4, inverseTransposeMatrix);\n }\n if (tangents) {\n vec3ForEach(tangents, 4, 0, null, vec3TransformMat4, inverseTransposeMatrix);\n }\n\n if (this.boundingBox) {\n this.updateBoundingBox();\n }\n },\n /**\n * Dispose geometry data in GL context.\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n\n var cache = this._cache;\n\n cache.use(renderer.__uid__);\n var chunks = cache.get('chunks');\n if (chunks) {\n for (var c = 0; c < chunks.length; c++) {\n var chunk = chunks[c];\n\n for (var k = 0; k < chunk.attributeBuffers.length; k++) {\n var attribs = chunk.attributeBuffers[k];\n renderer.gl.deleteBuffer(attribs.buffer);\n }\n\n if (chunk.indicesBuffer) {\n renderer.gl.deleteBuffer(chunk.indicesBuffer.buffer);\n }\n }\n }\n if (this.__vaoCache) {\n var vaoExt = renderer.getGLExtension('OES_vertex_array_object');\n for (var id in this.__vaoCache) {\n var vao = this.__vaoCache[id].vao;\n if (vao) {\n vaoExt.deleteVertexArrayOES(vao);\n }\n }\n }\n this.__vaoCache = {};\n cache.deleteContext(renderer.__uid__);\n }\n\n});\n\nGeometry.STATIC_DRAW = GeometryBase.STATIC_DRAW;\nGeometry.DYNAMIC_DRAW = GeometryBase.DYNAMIC_DRAW;\nGeometry.STREAM_DRAW = GeometryBase.STREAM_DRAW;\n\nGeometry.AttributeBuffer = GeometryBase.AttributeBuffer;\nGeometry.IndicesBuffer = GeometryBase.IndicesBuffer;\n\nGeometry.Attribute = Attribute;\n\nexport default Geometry;\n","export default \"vec3 calcAmbientSHLight(int idx, vec3 N) {\\n int offset = 9 * idx;\\n return ambientSHLightCoefficients[0]\\n + ambientSHLightCoefficients[1] * N.x\\n + ambientSHLightCoefficients[2] * N.y\\n + ambientSHLightCoefficients[3] * N.z\\n + ambientSHLightCoefficients[4] * N.x * N.z\\n + ambientSHLightCoefficients[5] * N.z * N.y\\n + ambientSHLightCoefficients[6] * N.y * N.x\\n + ambientSHLightCoefficients[7] * (3.0 * N.z * N.z - 1.0)\\n + ambientSHLightCoefficients[8] * (N.x * N.x - N.y * N.y);\\n}\";\n","import calcAmbientSHLightEssl from './calcAmbientSHLight.glsl.js';\n\nvar uniformVec3Prefix = 'uniform vec3 ';\nvar uniformFloatPrefix = 'uniform float ';\nvar exportHeaderPrefix = '@export clay.header.';\nvar exportEnd = '@end';\nvar unconfigurable = ':unconfigurable;';\nexport default [\n exportHeaderPrefix + 'directional_light',\n uniformVec3Prefix + 'directionalLightDirection[DIRECTIONAL_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'directionalLightColor[DIRECTIONAL_LIGHT_COUNT]' + unconfigurable,\n exportEnd,\n\n exportHeaderPrefix + 'ambient_light',\n uniformVec3Prefix + 'ambientLightColor[AMBIENT_LIGHT_COUNT]' + unconfigurable,\n exportEnd,\n\n exportHeaderPrefix + 'ambient_sh_light',\n uniformVec3Prefix + 'ambientSHLightColor[AMBIENT_SH_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'ambientSHLightCoefficients[AMBIENT_SH_LIGHT_COUNT * 9]' + unconfigurable,\n calcAmbientSHLightEssl,\n exportEnd,\n\n exportHeaderPrefix + 'ambient_cubemap_light',\n uniformVec3Prefix + 'ambientCubemapLightColor[AMBIENT_CUBEMAP_LIGHT_COUNT]' + unconfigurable,\n 'uniform samplerCube ambientCubemapLightCubemap[AMBIENT_CUBEMAP_LIGHT_COUNT]' + unconfigurable,\n 'uniform sampler2D ambientCubemapLightBRDFLookup[AMBIENT_CUBEMAP_LIGHT_COUNT]' + unconfigurable,\n exportEnd,\n\n exportHeaderPrefix + 'point_light',\n uniformVec3Prefix + 'pointLightPosition[POINT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'pointLightRange[POINT_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'pointLightColor[POINT_LIGHT_COUNT]' + unconfigurable,\n exportEnd,\n\n exportHeaderPrefix + 'spot_light',\n uniformVec3Prefix + 'spotLightPosition[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'spotLightDirection[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'spotLightRange[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'spotLightUmbraAngleCosine[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'spotLightPenumbraAngleCosine[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'spotLightFalloffFactor[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'spotLightColor[SPOT_LIGHT_COUNT]' + unconfigurable,\n exportEnd\n].join('\\n');\n","import Node from './Node';\nimport Shader from './Shader';\n\nimport lightShader from './shader/source/header/light';\nShader['import'](lightShader);\n\n/**\n * @constructor clay.Light\n * @extends clay.Node\n */\nvar Light = Node.extend(function(){\n return /** @lends clay.Light# */ {\n /**\n * Light RGB color\n * @type {number[]}\n */\n color: [1, 1, 1],\n\n /**\n * Light intensity\n * @type {number}\n */\n intensity: 1.0,\n\n // Config for shadow map\n /**\n * If light cast shadow\n * @type {boolean}\n */\n castShadow: true,\n\n /**\n * Shadow map size\n * @type {number}\n */\n shadowResolution: 512,\n\n /**\n * Light group, shader with same `lightGroup` will be affected\n *\n * Only useful in forward rendering\n * @type {number}\n */\n group: 0\n };\n},\n/** @lends clay.Light.prototype. */\n{\n /**\n * Light type\n * @type {string}\n * @memberOf clay.Light#\n */\n type: '',\n\n /**\n * @return {clay.Light}\n * @memberOf clay.Light.prototype\n */\n clone: function() {\n var light = Node.prototype.clone.call(this);\n light.color = Array.prototype.slice.call(this.color);\n light.intensity = this.intensity;\n light.castShadow = this.castShadow;\n light.shadowResolution = this.shadowResolution;\n\n return light;\n }\n});\n\nexport default Light;\n","import Vector3 from './Vector3';\nimport mat4 from '../glmatrix/mat4';\nimport vec3 from '../glmatrix/vec3';\nimport vec4 from '../glmatrix/vec4';\n\n/**\n * @constructor\n * @alias clay.Plane\n * @param {clay.Vector3} [normal]\n * @param {number} [distance]\n */\nvar Plane = function(normal, distance) {\n /**\n * Normal of the plane\n * @type {clay.Vector3}\n */\n this.normal = normal || new Vector3(0, 1, 0);\n\n /**\n * Constant of the plane equation, used as distance to the origin\n * @type {number}\n */\n this.distance = distance || 0;\n};\n\nPlane.prototype = {\n\n constructor: Plane,\n\n /**\n * Distance from a given point to the plane\n * @param {clay.Vector3} point\n * @return {number}\n */\n distanceToPoint: function(point) {\n return vec3.dot(point.array, this.normal.array) - this.distance;\n },\n\n /**\n * Calculate the projection point on the plane\n * @param {clay.Vector3} point\n * @param {clay.Vector3} out\n * @return {clay.Vector3}\n */\n projectPoint: function(point, out) {\n if (!out) {\n out = new Vector3();\n }\n var d = this.distanceToPoint(point);\n vec3.scaleAndAdd(out.array, point.array, this.normal.array, -d);\n out._dirty = true;\n return out;\n },\n\n /**\n * Normalize the plane's normal and calculate the distance\n */\n normalize: function() {\n var invLen = 1 / vec3.len(this.normal.array);\n vec3.scale(this.normal.array, invLen);\n this.distance *= invLen;\n },\n\n /**\n * If the plane intersect a frustum\n * @param {clay.Frustum} Frustum\n * @return {boolean}\n */\n intersectFrustum: function(frustum) {\n // Check if all coords of frustum is on plane all under plane\n var coords = frustum.vertices;\n var normal = this.normal.array;\n var onPlane = vec3.dot(coords[0].array, normal) > this.distance;\n for (var i = 1; i < 8; i++) {\n if ((vec3.dot(coords[i].array, normal) > this.distance) != onPlane) {\n return true;\n }\n }\n },\n\n /**\n * Calculate the intersection point between plane and a given line\n * @function\n * @param {clay.Vector3} start start point of line\n * @param {clay.Vector3} end end point of line\n * @param {clay.Vector3} [out]\n * @return {clay.Vector3}\n */\n intersectLine: (function() {\n var rd = vec3.create();\n return function(start, end, out) {\n var d0 = this.distanceToPoint(start);\n var d1 = this.distanceToPoint(end);\n if ((d0 > 0 && d1 > 0) || (d0 < 0 && d1 < 0)) {\n return null;\n }\n // Ray intersection\n var pn = this.normal.array;\n var d = this.distance;\n var ro = start.array;\n // direction\n vec3.sub(rd, end.array, start.array);\n vec3.normalize(rd, rd);\n\n var divider = vec3.dot(pn, rd);\n // ray is parallel to the plane\n if (divider === 0) {\n return null;\n }\n if (!out) {\n out = new Vector3();\n }\n var t = (vec3.dot(pn, ro) - d) / divider;\n vec3.scaleAndAdd(out.array, ro, rd, -t);\n out._dirty = true;\n return out;\n };\n })(),\n\n /**\n * Apply an affine transform matrix to plane\n * @function\n * @return {clay.Matrix4}\n */\n applyTransform: (function() {\n var inverseTranspose = mat4.create();\n var normalv4 = vec4.create();\n var pointv4 = vec4.create();\n pointv4[3] = 1;\n return function(m4) {\n m4 = m4.array;\n // Transform point on plane\n vec3.scale(pointv4, this.normal.array, this.distance);\n vec4.transformMat4(pointv4, pointv4, m4);\n this.distance = vec3.dot(pointv4, this.normal.array);\n // Transform plane normal\n mat4.invert(inverseTranspose, m4);\n mat4.transpose(inverseTranspose, inverseTranspose);\n normalv4[3] = 0;\n vec3.copy(normalv4, this.normal.array);\n vec4.transformMat4(normalv4, normalv4, inverseTranspose);\n vec3.copy(this.normal.array, normalv4);\n };\n })(),\n\n /**\n * Copy from another plane\n * @param {clay.Vector3} plane\n */\n copy: function(plane) {\n vec3.copy(this.normal.array, plane.normal.array);\n this.normal._dirty = true;\n this.distance = plane.distance;\n },\n\n /**\n * Clone a new plane\n * @return {clay.Plane}\n */\n clone: function() {\n var plane = new Plane();\n plane.copy(this);\n return plane;\n }\n};\n\nexport default Plane;\n","import BoundingBox from './BoundingBox';\nimport Plane from './Plane';\n\nimport vec3 from '../glmatrix/vec3';\n\nvar vec3Set = vec3.set;\nvar vec3Copy = vec3.copy;\nvar vec3TranformMat4 = vec3.transformMat4;\nvar mathMin = Math.min;\nvar mathMax = Math.max;\n/**\n * @constructor\n * @alias clay.Frustum\n */\nvar Frustum = function() {\n\n /**\n * Eight planes to enclose the frustum\n * @type {clay.Plane[]}\n */\n this.planes = [];\n\n for (var i = 0; i < 6; i++) {\n this.planes.push(new Plane());\n }\n\n /**\n * Bounding box of frustum\n * @type {clay.BoundingBox}\n */\n this.boundingBox = new BoundingBox();\n\n /**\n * Eight vertices of frustum\n * @type {Float32Array[]}\n */\n this.vertices = [];\n for (var i = 0; i < 8; i++) {\n this.vertices[i] = vec3.fromValues(0, 0, 0);\n }\n};\n\nFrustum.prototype = {\n\n // http://web.archive.org/web/20120531231005/http://crazyjoke.free.fr/doc/3D/plane%20extraction.pdf\n /**\n * Set frustum from a projection matrix\n * @param {clay.Matrix4} projectionMatrix\n */\n setFromProjection: function(projectionMatrix) {\n\n var planes = this.planes;\n var m = projectionMatrix.array;\n var m0 = m[0], m1 = m[1], m2 = m[2], m3 = m[3];\n var m4 = m[4], m5 = m[5], m6 = m[6], m7 = m[7];\n var m8 = m[8], m9 = m[9], m10 = m[10], m11 = m[11];\n var m12 = m[12], m13 = m[13], m14 = m[14], m15 = m[15];\n\n // Update planes\n vec3Set(planes[0].normal.array, m3 - m0, m7 - m4, m11 - m8);\n planes[0].distance = -(m15 - m12);\n planes[0].normalize();\n\n vec3Set(planes[1].normal.array, m3 + m0, m7 + m4, m11 + m8);\n planes[1].distance = -(m15 + m12);\n planes[1].normalize();\n\n vec3Set(planes[2].normal.array, m3 + m1, m7 + m5, m11 + m9);\n planes[2].distance = -(m15 + m13);\n planes[2].normalize();\n\n vec3Set(planes[3].normal.array, m3 - m1, m7 - m5, m11 - m9);\n planes[3].distance = -(m15 - m13);\n planes[3].normalize();\n\n vec3Set(planes[4].normal.array, m3 - m2, m7 - m6, m11 - m10);\n planes[4].distance = -(m15 - m14);\n planes[4].normalize();\n\n vec3Set(planes[5].normal.array, m3 + m2, m7 + m6, m11 + m10);\n planes[5].distance = -(m15 + m14);\n planes[5].normalize();\n\n // Perspective projection\n var boundingBox = this.boundingBox;\n var vertices = this.vertices;\n if (m15 === 0) {\n var aspect = m5 / m0;\n var zNear = -m14 / (m10 - 1);\n var zFar = -m14 / (m10 + 1);\n var farY = -zFar / m5;\n var nearY = -zNear / m5;\n // Update bounding box\n boundingBox.min.set(-farY * aspect, -farY, zFar);\n boundingBox.max.set(farY * aspect, farY, zNear);\n // update vertices\n //--- min z\n // min x\n vec3Set(vertices[0], -farY * aspect, -farY, zFar);\n vec3Set(vertices[1], -farY * aspect, farY, zFar);\n // max x\n vec3Set(vertices[2], farY * aspect, -farY, zFar);\n vec3Set(vertices[3], farY * aspect, farY, zFar);\n //-- max z\n vec3Set(vertices[4], -nearY * aspect, -nearY, zNear);\n vec3Set(vertices[5], -nearY * aspect, nearY, zNear);\n vec3Set(vertices[6], nearY * aspect, -nearY, zNear);\n vec3Set(vertices[7], nearY * aspect, nearY, zNear);\n }\n else { // Orthographic projection\n var left = (-1 - m12) / m0;\n var right = (1 - m12) / m0;\n var top = (1 - m13) / m5;\n var bottom = (-1 - m13) / m5;\n var near = (-1 - m14) / m10;\n var far = (1 - m14) / m10;\n\n\n boundingBox.min.set(Math.min(left, right), Math.min(bottom, top), Math.min(far, near));\n boundingBox.max.set(Math.max(right, left), Math.max(top, bottom), Math.max(near, far));\n\n var min = boundingBox.min.array;\n var max = boundingBox.max.array;\n //--- min z\n // min x\n vec3Set(vertices[0], min[0], min[1], min[2]);\n vec3Set(vertices[1], min[0], max[1], min[2]);\n // max x\n vec3Set(vertices[2], max[0], min[1], min[2]);\n vec3Set(vertices[3], max[0], max[1], min[2]);\n //-- max z\n vec3Set(vertices[4], min[0], min[1], max[2]);\n vec3Set(vertices[5], min[0], max[1], max[2]);\n vec3Set(vertices[6], max[0], min[1], max[2]);\n vec3Set(vertices[7], max[0], max[1], max[2]);\n }\n },\n\n /**\n * Apply a affine transform matrix and set to the given bounding box\n * @function\n * @param {clay.BoundingBox}\n * @param {clay.Matrix4}\n * @return {clay.BoundingBox}\n */\n getTransformedBoundingBox: (function() {\n\n var tmpVec3 = vec3.create();\n\n return function(bbox, matrix) {\n var vertices = this.vertices;\n\n var m4 = matrix.array;\n var min = bbox.min;\n var max = bbox.max;\n var minArr = min.array;\n var maxArr = max.array;\n var v = vertices[0];\n vec3TranformMat4(tmpVec3, v, m4);\n vec3Copy(minArr, tmpVec3);\n vec3Copy(maxArr, tmpVec3);\n\n for (var i = 1; i < 8; i++) {\n v = vertices[i];\n vec3TranformMat4(tmpVec3, v, m4);\n\n minArr[0] = mathMin(tmpVec3[0], minArr[0]);\n minArr[1] = mathMin(tmpVec3[1], minArr[1]);\n minArr[2] = mathMin(tmpVec3[2], minArr[2]);\n\n maxArr[0] = mathMax(tmpVec3[0], maxArr[0]);\n maxArr[1] = mathMax(tmpVec3[1], maxArr[1]);\n maxArr[2] = mathMax(tmpVec3[2], maxArr[2]);\n }\n\n min._dirty = true;\n max._dirty = true;\n\n return bbox;\n };\n }) ()\n};\nexport default Frustum;\n","import Node from './Node';\nimport Matrix4 from './math/Matrix4';\nimport Frustum from './math/Frustum';\nimport Ray from './math/Ray';\n\nimport vec4 from './glmatrix/vec4';\nimport vec3 from './glmatrix/vec3';\n\n\n/**\n * @constructor clay.Camera\n * @extends clay.Node\n */\nvar Camera = Node.extend(function () {\n return /** @lends clay.Camera# */ {\n /**\n * Camera projection matrix\n * @type {clay.Matrix4}\n */\n projectionMatrix: new Matrix4(),\n\n /**\n * Inverse of camera projection matrix\n * @type {clay.Matrix4}\n */\n invProjectionMatrix: new Matrix4(),\n\n /**\n * View matrix, equal to inverse of camera's world matrix\n * @type {clay.Matrix4}\n */\n viewMatrix: new Matrix4(),\n\n /**\n * Camera frustum in view space\n * @type {clay.Frustum}\n */\n frustum: new Frustum()\n };\n}, function () {\n this.update(true);\n},\n/** @lends clay.Camera.prototype */\n{\n\n update: function (force) {\n Node.prototype.update.call(this, force);\n Matrix4.invert(this.viewMatrix, this.worldTransform);\n\n this.updateProjectionMatrix();\n Matrix4.invert(this.invProjectionMatrix, this.projectionMatrix);\n\n this.frustum.setFromProjection(this.projectionMatrix);\n },\n\n /**\n * Set camera view matrix\n */\n setViewMatrix: function (viewMatrix) {\n Matrix4.copy(this.viewMatrix, viewMatrix);\n Matrix4.invert(this.worldTransform, viewMatrix);\n this.decomposeWorldTransform();\n },\n\n /**\n * Decompose camera projection matrix\n */\n decomposeProjectionMatrix: function () {},\n\n /**\n * Set camera projection matrix\n * @param {clay.Matrix4} projectionMatrix\n */\n setProjectionMatrix: function (projectionMatrix) {\n Matrix4.copy(this.projectionMatrix, projectionMatrix);\n Matrix4.invert(this.invProjectionMatrix, projectionMatrix);\n this.decomposeProjectionMatrix();\n },\n /**\n * Update projection matrix, called after update\n */\n updateProjectionMatrix: function () {},\n\n /**\n * Cast a picking ray from camera near plane to far plane\n * @function\n * @param {clay.Vector2} ndc\n * @param {clay.Ray} [out]\n * @return {clay.Ray}\n */\n castRay: (function () {\n var v4 = vec4.create();\n return function (ndc, out) {\n var ray = out !== undefined ? out : new Ray();\n var x = ndc.array[0];\n var y = ndc.array[1];\n vec4.set(v4, x, y, -1, 1);\n vec4.transformMat4(v4, v4, this.invProjectionMatrix.array);\n vec4.transformMat4(v4, v4, this.worldTransform.array);\n vec3.scale(ray.origin.array, v4, 1 / v4[3]);\n\n vec4.set(v4, x, y, 1, 1);\n vec4.transformMat4(v4, v4, this.invProjectionMatrix.array);\n vec4.transformMat4(v4, v4, this.worldTransform.array);\n vec3.scale(v4, v4, 1 / v4[3]);\n vec3.sub(ray.direction.array, v4, ray.origin.array);\n\n vec3.normalize(ray.direction.array, ray.direction.array);\n ray.direction._dirty = true;\n ray.origin._dirty = true;\n\n return ray;\n };\n })(),\n\n /**\n * @function\n * @name clone\n * @return {clay.Camera}\n * @memberOf clay.Camera.prototype\n */\n});\n\nexport default Camera;\n","import Node from './Node';\nimport Light from './Light';\nimport Camera from './Camera';\nimport BoundingBox from './math/BoundingBox';\nimport util from './core/util';\nimport mat4 from './glmatrix/mat4';\nimport LRUCache from './core/LRU';\nimport Matrix4 from './math/Matrix4';\n\nvar IDENTITY = mat4.create();\nvar WORLDVIEW = mat4.create();\n\nvar programKeyCache = {};\n\nfunction getProgramKey(lightNumbers) {\n var defineStr = [];\n var lightTypes = Object.keys(lightNumbers);\n lightTypes.sort();\n for (var i = 0; i < lightTypes.length; i++) {\n var lightType = lightTypes[i];\n defineStr.push(lightType + ' ' + lightNumbers[lightType]);\n }\n var key = defineStr.join('\\n');\n\n if (programKeyCache[key]) {\n return programKeyCache[key];\n }\n\n var id = util.genGUID();\n programKeyCache[key] = id;\n return id;\n}\n\nfunction RenderList() {\n\n this.opaque = [];\n this.transparent = [];\n\n this._opaqueCount = 0;\n this._transparentCount = 0;\n}\n\nRenderList.prototype.startCount = function () {\n this._opaqueCount = 0;\n this._transparentCount = 0;\n};\n\nRenderList.prototype.add = function (object, isTransparent) {\n if (isTransparent) {\n this.transparent[this._transparentCount++] = object;\n }\n else {\n this.opaque[this._opaqueCount++] = object;\n }\n};\n\nRenderList.prototype.endCount = function () {\n this.transparent.length = this._transparentCount;\n this.opaque.length = this._opaqueCount;\n};\n\n/**\n * @typedef {Object} clay.Scene.RenderList\n * @property {Array.} opaque\n * @property {Array.} transparent\n */\n\n/**\n * @constructor clay.Scene\n * @extends clay.Node\n */\nvar Scene = Node.extend(function () {\n return /** @lends clay.Scene# */ {\n /**\n * Global material of scene\n * @type {clay.Material}\n */\n material: null,\n\n lights: [],\n\n /**\n * Scene bounding box in view space.\n * Used when camera needs to adujst the near and far plane automatically\n * so that the view frustum contains the visible objects as tightly as possible.\n * Notice:\n * It is updated after rendering (in the step of frustum culling passingly). So may be not so accurate, but saves a lot of calculation\n *\n * @type {clay.BoundingBox}\n */\n viewBoundingBoxLastFrame: new BoundingBox(),\n\n // Uniforms for shadow map.\n shadowUniforms: {},\n\n _cameraList: [],\n\n // Properties to save the light information in the scene\n // Will be set in the render function\n _lightUniforms: {},\n\n _previousLightNumber: {},\n\n _lightNumber: {\n // groupId: {\n // POINT_LIGHT: 0,\n // DIRECTIONAL_LIGHT: 0,\n // SPOT_LIGHT: 0,\n // AMBIENT_LIGHT: 0,\n // AMBIENT_SH_LIGHT: 0\n // }\n },\n\n _lightProgramKeys: {},\n\n _nodeRepository: {},\n\n _renderLists: new LRUCache(20)\n\n };\n}, function () {\n this._scene = this;\n},\n/** @lends clay.Scene.prototype. */\n{\n\n // Add node to scene\n addToScene: function (node) {\n if (node instanceof Camera) {\n if (this._cameraList.length > 0) {\n console.warn('Found multiple camera in one scene. Use the fist one.');\n }\n this._cameraList.push(node);\n }\n else if (node instanceof Light) {\n this.lights.push(node);\n }\n if (node.name) {\n this._nodeRepository[node.name] = node;\n }\n },\n\n // Remove node from scene\n removeFromScene: function (node) {\n var idx;\n if (node instanceof Camera) {\n idx = this._cameraList.indexOf(node);\n if (idx >= 0) {\n this._cameraList.splice(idx, 1);\n }\n }\n else if (node instanceof Light) {\n idx = this.lights.indexOf(node);\n if (idx >= 0) {\n this.lights.splice(idx, 1);\n }\n }\n if (node.name) {\n delete this._nodeRepository[node.name];\n }\n },\n\n /**\n * Get node by name\n * @param {string} name\n * @return {Node}\n * @DEPRECATED\n */\n getNode: function (name) {\n return this._nodeRepository[name];\n },\n\n /**\n * Set main camera of the scene.\n * @param {claygl.Camera} camera\n */\n setMainCamera: function (camera) {\n var idx = this._cameraList.indexOf(camera);\n if (idx >= 0) {\n this._cameraList.splice(idx, 1);\n }\n this._cameraList.unshift(camera);\n },\n /**\n * Get main camera of the scene.\n */\n getMainCamera: function () {\n return this._cameraList[0];\n },\n\n getLights: function () {\n return this.lights;\n },\n\n updateLights: function () {\n var lights = this.lights;\n this._previousLightNumber = this._lightNumber;\n\n var lightNumber = {};\n for (var i = 0; i < lights.length; i++) {\n var light = lights[i];\n if (light.invisible) {\n continue;\n }\n var group = light.group;\n if (!lightNumber[group]) {\n lightNumber[group] = {};\n }\n // User can use any type of light\n lightNumber[group][light.type] = lightNumber[group][light.type] || 0;\n lightNumber[group][light.type]++;\n }\n this._lightNumber = lightNumber;\n\n for (var groupId in lightNumber) {\n this._lightProgramKeys[groupId] = getProgramKey(lightNumber[groupId]);\n }\n\n this._updateLightUniforms();\n },\n\n /**\n * Clone a node and it's children, including mesh, camera, light, etc.\n * Unlike using `Node#clone`. It will clone skeleton and remap the joints. Material will also be cloned.\n *\n * @param {clay.Node} node\n * @return {clay.Node}\n */\n cloneNode: function (node) {\n var newNode = node.clone();\n var clonedNodesMap = {};\n function buildNodesMap(sNode, tNode) {\n clonedNodesMap[sNode.__uid__] = tNode;\n\n for (var i = 0; i < sNode._children.length; i++) {\n var sChild = sNode._children[i];\n var tChild = tNode._children[i];\n buildNodesMap(sChild, tChild);\n }\n }\n buildNodesMap(node, newNode);\n\n newNode.traverse(function (newChild) {\n if (newChild.skeleton) {\n newChild.skeleton = newChild.skeleton.clone(clonedNodesMap);\n }\n if (newChild.material) {\n newChild.material = newChild.material.clone();\n }\n });\n\n return newNode;\n },\n\n /**\n * Traverse the scene and add the renderable object to the render list.\n * It needs camera for the frustum culling.\n *\n * @param {clay.Camera} camera\n * @param {boolean} updateSceneBoundingBox\n * @return {clay.Scene.RenderList}\n */\n updateRenderList: function (camera, updateSceneBoundingBox) {\n var id = camera.__uid__;\n var renderList = this._renderLists.get(id);\n if (!renderList) {\n renderList = new RenderList();\n this._renderLists.put(id, renderList);\n }\n renderList.startCount();\n\n if (updateSceneBoundingBox) {\n this.viewBoundingBoxLastFrame.min.set(Infinity, Infinity, Infinity);\n this.viewBoundingBoxLastFrame.max.set(-Infinity, -Infinity, -Infinity);\n }\n\n var sceneMaterialTransparent = this.material && this.material.transparent || false;\n this._doUpdateRenderList(this, camera, sceneMaterialTransparent, renderList, updateSceneBoundingBox);\n\n renderList.endCount();\n\n return renderList;\n },\n\n /**\n * Get render list. Used after {@link clay.Scene#updateRenderList}\n * @param {clay.Camera} camera\n * @return {clay.Scene.RenderList}\n */\n getRenderList: function (camera) {\n return this._renderLists.get(camera.__uid__);\n },\n\n _doUpdateRenderList: function (parent, camera, sceneMaterialTransparent, renderList, updateSceneBoundingBox) {\n if (parent.invisible) {\n return;\n }\n // TODO Optimize\n for (var i = 0; i < parent._children.length; i++) {\n var child = parent._children[i];\n\n if (child.isRenderable()) {\n // Frustum culling\n var worldM = child.isSkinnedMesh() ? IDENTITY : child.worldTransform.array;\n var geometry = child.geometry;\n\n mat4.multiplyAffine(WORLDVIEW, camera.viewMatrix.array, worldM);\n if (updateSceneBoundingBox && !geometry.boundingBox || !this.isFrustumCulled(child, camera, WORLDVIEW)) {\n renderList.add(child, child.material.transparent || sceneMaterialTransparent);\n }\n }\n if (child._children.length > 0) {\n this._doUpdateRenderList(child, camera, sceneMaterialTransparent, renderList, updateSceneBoundingBox);\n }\n }\n },\n\n /**\n * If an scene object is culled by camera frustum\n *\n * Object can be a renderable or a light\n *\n * @param {clay.Node} object\n * @param {clay.Camera} camera\n * @param {Array.} worldViewMat represented with array\n * @param {Array.} projectionMat represented with array\n */\n isFrustumCulled: (function () {\n // Frustum culling\n // http://www.cse.chalmers.se/~uffe/vfc_bbox.pdf\n var cullingBoundingBox = new BoundingBox();\n var cullingMatrix = new Matrix4();\n return function(object, camera, worldViewMat) {\n // Bounding box can be a property of object(like light) or renderable.geometry\n // PENDING\n var geoBBox = object.boundingBox;\n if (!geoBBox) {\n if (object.skeleton && object.skeleton.boundingBox) {\n geoBBox = object.skeleton.boundingBox;\n }\n else {\n geoBBox = object.geometry.boundingBox;\n }\n }\n\n if (!geoBBox) {\n return false;\n }\n\n cullingMatrix.array = worldViewMat;\n cullingBoundingBox.transformFrom(geoBBox, cullingMatrix);\n\n // Passingly update the scene bounding box\n // FIXME exclude very large mesh like ground plane or terrain ?\n // FIXME Only rendererable which cast shadow ?\n\n // FIXME boundingBox becomes much larger after transformd.\n if (object.castShadow) {\n this.viewBoundingBoxLastFrame.union(cullingBoundingBox);\n }\n // Ignore frustum culling if object is skinned mesh.\n if (object.frustumCulling) {\n if (!cullingBoundingBox.intersectBoundingBox(camera.frustum.boundingBox)) {\n return true;\n }\n\n cullingMatrix.array = camera.projectionMatrix.array;\n if (\n cullingBoundingBox.max.array[2] > 0 &&\n cullingBoundingBox.min.array[2] < 0\n ) {\n // Clip in the near plane\n cullingBoundingBox.max.array[2] = -1e-20;\n }\n\n cullingBoundingBox.applyProjection(cullingMatrix);\n\n var min = cullingBoundingBox.min.array;\n var max = cullingBoundingBox.max.array;\n\n if (\n max[0] < -1 || min[0] > 1\n || max[1] < -1 || min[1] > 1\n || max[2] < -1 || min[2] > 1\n ) {\n return true;\n }\n }\n\n return false;\n };\n })(),\n\n _updateLightUniforms: function () {\n var lights = this.lights;\n // Put the light cast shadow before the light not cast shadow\n lights.sort(lightSortFunc);\n\n var lightUniforms = this._lightUniforms;\n for (var group in lightUniforms) {\n for (var symbol in lightUniforms[group]) {\n lightUniforms[group][symbol].value.length = 0;\n }\n }\n for (var i = 0; i < lights.length; i++) {\n\n var light = lights[i];\n\n if (light.invisible) {\n continue;\n }\n\n var group = light.group;\n\n for (var symbol in light.uniformTemplates) {\n var uniformTpl = light.uniformTemplates[symbol];\n var value = uniformTpl.value(light);\n if (value == null) {\n continue;\n }\n if (!lightUniforms[group]) {\n lightUniforms[group] = {};\n }\n if (!lightUniforms[group][symbol]) {\n lightUniforms[group][symbol] = {\n type: '',\n value: []\n };\n }\n var lu = lightUniforms[group][symbol];\n lu.type = uniformTpl.type + 'v';\n switch (uniformTpl.type) {\n case '1i':\n case '1f':\n case 't':\n lu.value.push(value);\n break;\n case '2f':\n case '3f':\n case '4f':\n for (var j = 0; j < value.length; j++) {\n lu.value.push(value[j]);\n }\n break;\n default:\n console.error('Unkown light uniform type ' + uniformTpl.type);\n }\n }\n }\n },\n\n getLightGroups: function () {\n var lightGroups = [];\n for (var groupId in this._lightNumber) {\n lightGroups.push(groupId);\n }\n return lightGroups;\n },\n\n getNumberChangedLightGroups: function () {\n var lightGroups = [];\n for (var groupId in this._lightNumber) {\n if (this.isLightNumberChanged(groupId)) {\n lightGroups.push(groupId);\n }\n }\n return lightGroups;\n },\n\n // Determine if light group is different with since last frame\n // Used to determine whether to update shader and scene's uniforms in Renderer.render\n isLightNumberChanged: function (lightGroup) {\n var prevLightNumber = this._previousLightNumber;\n var currentLightNumber = this._lightNumber;\n // PENDING Performance\n for (var type in currentLightNumber[lightGroup]) {\n if (!prevLightNumber[lightGroup]) {\n return true;\n }\n if (currentLightNumber[lightGroup][type] !== prevLightNumber[lightGroup][type]) {\n return true;\n }\n }\n for (var type in prevLightNumber[lightGroup]) {\n if (!currentLightNumber[lightGroup]) {\n return true;\n }\n if (currentLightNumber[lightGroup][type] !== prevLightNumber[lightGroup][type]) {\n return true;\n }\n }\n return false;\n },\n\n getLightsNumbers: function (lightGroup) {\n return this._lightNumber[lightGroup];\n },\n\n getProgramKey: function (lightGroup) {\n return this._lightProgramKeys[lightGroup];\n },\n\n setLightUniforms: (function () {\n function setUniforms(uniforms, program, renderer) {\n for (var symbol in uniforms) {\n var lu = uniforms[symbol];\n if (lu.type === 'tv') {\n if (!program.hasUniform(symbol)) {\n continue;\n }\n var texSlots = [];\n for (var i = 0; i < lu.value.length; i++) {\n var texture = lu.value[i];\n var slot = program.takeCurrentTextureSlot(renderer, texture);\n texSlots.push(slot);\n }\n program.setUniform(renderer.gl, '1iv', symbol, texSlots);\n }\n else {\n program.setUniform(renderer.gl, lu.type, symbol, lu.value);\n }\n }\n }\n\n return function (program, lightGroup, renderer) {\n setUniforms(this._lightUniforms[lightGroup], program, renderer);\n // Set shadows\n setUniforms(this.shadowUniforms, program, renderer);\n };\n })(),\n\n /**\n * Dispose self, clear all the scene objects\n * But resources of gl like texuture, shader will not be disposed.\n * Mostly you should use disposeScene method in Renderer to do dispose.\n */\n dispose: function () {\n this.material = null;\n this._opaqueList = [];\n this._transparentList = [];\n\n this.lights = [];\n\n this._lightUniforms = {};\n\n this._lightNumber = {};\n this._nodeRepository = {};\n }\n});\n\nfunction lightSortFunc(a, b) {\n if (b.castShadow && !a.castShadow) {\n return true;\n }\n}\n\nexport default Scene;\n","var Entry = (function () {\n function Entry(val) {\n this.value = val;\n }\n return Entry;\n}());\nexport { Entry };\nvar LinkedList = (function () {\n function LinkedList() {\n this._len = 0;\n }\n LinkedList.prototype.insert = function (val) {\n var entry = new Entry(val);\n this.insertEntry(entry);\n return entry;\n };\n LinkedList.prototype.insertEntry = function (entry) {\n if (!this.head) {\n this.head = this.tail = entry;\n }\n else {\n this.tail.next = entry;\n entry.prev = this.tail;\n entry.next = null;\n this.tail = entry;\n }\n this._len++;\n };\n LinkedList.prototype.remove = function (entry) {\n var prev = entry.prev;\n var next = entry.next;\n if (prev) {\n prev.next = next;\n }\n else {\n this.head = next;\n }\n if (next) {\n next.prev = prev;\n }\n else {\n this.tail = prev;\n }\n entry.next = entry.prev = null;\n this._len--;\n };\n LinkedList.prototype.len = function () {\n return this._len;\n };\n LinkedList.prototype.clear = function () {\n this.head = this.tail = null;\n this._len = 0;\n };\n return LinkedList;\n}());\nexport { LinkedList };\nvar LRU = (function () {\n function LRU(maxSize) {\n this._list = new LinkedList();\n this._maxSize = 10;\n this._map = {};\n this._maxSize = maxSize;\n }\n LRU.prototype.put = function (key, value) {\n var list = this._list;\n var map = this._map;\n var removed = null;\n if (map[key] == null) {\n var len = list.len();\n var entry = this._lastRemovedEntry;\n if (len >= this._maxSize && len > 0) {\n var leastUsedEntry = list.head;\n list.remove(leastUsedEntry);\n delete map[leastUsedEntry.key];\n removed = leastUsedEntry.value;\n this._lastRemovedEntry = leastUsedEntry;\n }\n if (entry) {\n entry.value = value;\n }\n else {\n entry = new Entry(value);\n }\n entry.key = key;\n list.insertEntry(entry);\n map[key] = entry;\n }\n return removed;\n };\n LRU.prototype.get = function (key) {\n var entry = this._map[key];\n var list = this._list;\n if (entry != null) {\n if (entry !== list.tail) {\n list.remove(entry);\n list.insertEntry(entry);\n }\n return entry.value;\n }\n };\n LRU.prototype.clear = function () {\n this._list.clear();\n this._map = {};\n };\n LRU.prototype.len = function () {\n return this._list.len();\n };\n return LRU;\n}());\nexport default LRU;\n","import Texture from './Texture';\nimport glenum from './core/glenum';\nimport util from './core/util';\nimport mathUtil from './math/util';\nimport vendor from './core/vendor';\nvar isPowerOfTwo = mathUtil.isPowerOfTwo;\n\nvar targetList = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\n/**\n * @constructor clay.TextureCube\n * @extends clay.Texture\n *\n * @example\n * ...\n * var mat = new clay.Material({\n * shader: clay.shader.library.get('clay.phong', 'environmentMap')\n * });\n * var envMap = new clay.TextureCube();\n * envMap.load({\n * 'px': 'assets/textures/sky/px.jpg',\n * 'nx': 'assets/textures/sky/nx.jpg'\n * 'py': 'assets/textures/sky/py.jpg'\n * 'ny': 'assets/textures/sky/ny.jpg'\n * 'pz': 'assets/textures/sky/pz.jpg'\n * 'nz': 'assets/textures/sky/nz.jpg'\n * });\n * mat.set('environmentMap', envMap);\n * ...\n * envMap.success(function () {\n * // Wait for the sky texture loaded\n * animation.on('frame', function (frameTime) {\n * renderer.render(scene, camera);\n * });\n * });\n */\nvar TextureCube = Texture.extend(function () {\n return /** @lends clay.TextureCube# */{\n\n /**\n * @type {boolean}\n * @default false\n */\n // PENDING cubemap should not flipY in default.\n // flipY: false,\n\n /**\n * @type {Object}\n * @property {?HTMLImageElement|HTMLCanvasElemnet} px\n * @property {?HTMLImageElement|HTMLCanvasElemnet} nx\n * @property {?HTMLImageElement|HTMLCanvasElemnet} py\n * @property {?HTMLImageElement|HTMLCanvasElemnet} ny\n * @property {?HTMLImageElement|HTMLCanvasElemnet} pz\n * @property {?HTMLImageElement|HTMLCanvasElemnet} nz\n */\n image: {\n px: null,\n nx: null,\n py: null,\n ny: null,\n pz: null,\n nz: null\n },\n /**\n * Pixels data of each side. Will be ignored if images are set.\n * @type {Object}\n * @property {?Uint8Array} px\n * @property {?Uint8Array} nx\n * @property {?Uint8Array} py\n * @property {?Uint8Array} ny\n * @property {?Uint8Array} pz\n * @property {?Uint8Array} nz\n */\n pixels: {\n px: null,\n nx: null,\n py: null,\n ny: null,\n pz: null,\n nz: null\n },\n\n /**\n * @type {Array.}\n */\n mipmaps: []\n };\n}, {\n\n textureType: 'textureCube',\n\n update: function (renderer) {\n var _gl = renderer.gl;\n _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, this._cache.get('webgl_texture'));\n\n this.updateCommon(renderer);\n\n var glFormat = this.format;\n var glType = this.type;\n\n _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_S, this.getAvailableWrapS());\n _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_T, this.getAvailableWrapT());\n\n _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MAG_FILTER, this.getAvailableMagFilter());\n _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MIN_FILTER, this.getAvailableMinFilter());\n\n var anisotropicExt = renderer.getGLExtension('EXT_texture_filter_anisotropic');\n if (anisotropicExt && this.anisotropic > 1) {\n _gl.texParameterf(_gl.TEXTURE_CUBE_MAP, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropic);\n }\n\n // Fallback to float type if browser don't have half float extension\n if (glType === 36193) {\n var halfFloatExt = renderer.getGLExtension('OES_texture_half_float');\n if (!halfFloatExt) {\n glType = glenum.FLOAT;\n }\n }\n\n if (this.mipmaps.length) {\n var width = this.width;\n var height = this.height;\n for (var i = 0; i < this.mipmaps.length; i++) {\n var mipmap = this.mipmaps[i];\n this._updateTextureData(_gl, mipmap, i, width, height, glFormat, glType);\n width /= 2;\n height /= 2;\n }\n }\n else {\n this._updateTextureData(_gl, this, 0, this.width, this.height, glFormat, glType);\n\n if (!this.NPOT && this.useMipmap) {\n _gl.generateMipmap(_gl.TEXTURE_CUBE_MAP);\n }\n }\n\n _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, null);\n },\n\n _updateTextureData: function (_gl, data, level, width, height, glFormat, glType) {\n for (var i = 0; i < 6; i++) {\n var target = targetList[i];\n var img = data.image && data.image[target];\n if (img) {\n _gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level, glFormat, glFormat, glType, img);\n }\n else {\n _gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level, glFormat, width, height, 0, glFormat, glType, data.pixels && data.pixels[target]);\n }\n }\n },\n\n /**\n * @param {clay.Renderer} renderer\n * @memberOf clay.TextureCube.prototype\n */\n generateMipmap: function (renderer) {\n var _gl = renderer.gl;\n if (this.useMipmap && !this.NPOT) {\n _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, this._cache.get('webgl_texture'));\n _gl.generateMipmap(_gl.TEXTURE_CUBE_MAP);\n }\n },\n\n bind: function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_CUBE_MAP, this.getWebGLTexture(renderer));\n },\n\n unbind: function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_CUBE_MAP, null);\n },\n\n // Overwrite the isPowerOfTwo method\n isPowerOfTwo: function () {\n if (this.image.px) {\n return isPowerOfTwo(this.image.px.width)\n && isPowerOfTwo(this.image.px.height);\n }\n else {\n return isPowerOfTwo(this.width)\n && isPowerOfTwo(this.height);\n }\n },\n\n isRenderable: function () {\n if (this.image.px) {\n return isImageRenderable(this.image.px)\n && isImageRenderable(this.image.nx)\n && isImageRenderable(this.image.py)\n && isImageRenderable(this.image.ny)\n && isImageRenderable(this.image.pz)\n && isImageRenderable(this.image.nz);\n }\n else {\n return !!(this.width && this.height);\n }\n },\n\n load: function (imageList, crossOrigin) {\n var loading = 0;\n var self = this;\n util.each(imageList, function (src, target){\n var image = vendor.createImage();\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n image.onload = function () {\n loading --;\n if (loading === 0){\n self.dirty();\n self.trigger('success', self);\n }\n };\n image.onerror = function () {\n loading --;\n };\n\n loading++;\n image.src = src;\n self.image[target] = image;\n });\n\n return this;\n }\n});\n\nObject.defineProperty(TextureCube.prototype, 'width', {\n get: function () {\n if (this.image && this.image.px) {\n return this.image.px.width;\n }\n return this._width;\n },\n set: function (value) {\n if (this.image && this.image.px) {\n console.warn('Texture from image can\\'t set width');\n }\n else {\n if (this._width !== value) {\n this.dirty();\n }\n this._width = value;\n }\n }\n});\nObject.defineProperty(TextureCube.prototype, 'height', {\n get: function () {\n if (this.image && this.image.px) {\n return this.image.px.height;\n }\n return this._height;\n },\n set: function (value) {\n if (this.image && this.image.px) {\n console.warn('Texture from image can\\'t set height');\n }\n else {\n if (this._height !== value) {\n this.dirty();\n }\n this._height = value;\n }\n }\n});\nfunction isImageRenderable(image) {\n return image.width > 0 && image.height > 0;\n}\n\nexport default TextureCube;\n","import Camera from '../Camera';\n\n/**\n * @constructor clay.camera.Perspective\n * @extends clay.Camera\n */\nvar Perspective = Camera.extend(/** @lends clay.camera.Perspective# */{\n /**\n * Vertical field of view in degrees\n * @type {number}\n */\n fov: 50,\n /**\n * Aspect ratio, typically viewport width / height\n * @type {number}\n */\n aspect: 1,\n /**\n * Near bound of the frustum\n * @type {number}\n */\n near: 0.1,\n /**\n * Far bound of the frustum\n * @type {number}\n */\n far: 2000\n},\n/** @lends clay.camera.Perspective.prototype */\n{\n\n updateProjectionMatrix: function() {\n var rad = this.fov / 180 * Math.PI;\n this.projectionMatrix.perspective(rad, this.aspect, this.near, this.far);\n },\n decomposeProjectionMatrix: function () {\n var m = this.projectionMatrix.array;\n var rad = Math.atan(1 / m[5]) * 2;\n this.fov = rad / Math.PI * 180;\n this.aspect = m[5] / m[0];\n this.near = m[14] / (m[10] - 1);\n this.far = m[14] / (m[10] + 1);\n },\n /**\n * @return {clay.camera.Perspective}\n */\n clone: function() {\n var camera = Camera.prototype.clone.call(this);\n camera.fov = this.fov;\n camera.aspect = this.aspect;\n camera.near = this.near;\n camera.far = this.far;\n\n return camera;\n }\n});\n\nexport default Perspective;\n","import Base from './core/Base';\nimport Texture from './Texture';\nimport TextureCube from './TextureCube';\nimport glenum from './core/glenum';\nimport Cache from './core/Cache';\n\nvar KEY_FRAMEBUFFER = 'framebuffer';\nvar KEY_RENDERBUFFER = 'renderbuffer';\nvar KEY_RENDERBUFFER_WIDTH = KEY_RENDERBUFFER + '_width';\nvar KEY_RENDERBUFFER_HEIGHT = KEY_RENDERBUFFER + '_height';\nvar KEY_RENDERBUFFER_ATTACHED = KEY_RENDERBUFFER + '_attached';\nvar KEY_DEPTHTEXTURE_ATTACHED = 'depthtexture_attached';\n\nvar GL_FRAMEBUFFER = glenum.FRAMEBUFFER;\nvar GL_RENDERBUFFER = glenum.RENDERBUFFER;\nvar GL_DEPTH_ATTACHMENT = glenum.DEPTH_ATTACHMENT;\nvar GL_COLOR_ATTACHMENT0 = glenum.COLOR_ATTACHMENT0;\n/**\n * @constructor clay.FrameBuffer\n * @extends clay.core.Base\n */\nvar FrameBuffer = Base.extend(\n/** @lends clay.FrameBuffer# */\n{\n /**\n * If use depth buffer\n * @type {boolean}\n */\n depthBuffer: true,\n\n /**\n * @type {Object}\n */\n viewport: null,\n\n _width: 0,\n _height: 0,\n\n _textures: null,\n\n _boundRenderer: null,\n}, function () {\n // Use cache\n this._cache = new Cache();\n\n this._textures = {};\n},\n\n/**@lends clay.FrameBuffer.prototype. */\n{\n /**\n * Get attached texture width\n * {number}\n */\n // FIXME Can't use before #bind\n getTextureWidth: function () {\n return this._width;\n },\n\n /**\n * Get attached texture height\n * {number}\n */\n getTextureHeight: function () {\n return this._height;\n },\n\n /**\n * Bind the framebuffer to given renderer before rendering\n * @param {clay.Renderer} renderer\n */\n bind: function (renderer) {\n\n if (renderer.__currentFrameBuffer) {\n // Already bound\n if (renderer.__currentFrameBuffer === this) {\n return;\n }\n\n console.warn('Renderer already bound with another framebuffer. Unbind it first');\n }\n renderer.__currentFrameBuffer = this;\n\n var _gl = renderer.gl;\n\n _gl.bindFramebuffer(GL_FRAMEBUFFER, this._getFrameBufferGL(renderer));\n this._boundRenderer = renderer;\n var cache = this._cache;\n\n cache.put('viewport', renderer.viewport);\n\n var hasTextureAttached = false;\n var width;\n var height;\n for (var attachment in this._textures) {\n hasTextureAttached = true;\n var obj = this._textures[attachment];\n if (obj) {\n // TODO Do width, height checking, make sure size are same\n width = obj.texture.width;\n height = obj.texture.height;\n // Attach textures\n this._doAttach(renderer, obj.texture, attachment, obj.target);\n }\n }\n\n this._width = width;\n this._height = height;\n\n if (!hasTextureAttached && this.depthBuffer) {\n console.error('Must attach texture before bind, or renderbuffer may have incorrect width and height.')\n }\n\n if (this.viewport) {\n renderer.setViewport(this.viewport);\n }\n else {\n renderer.setViewport(0, 0, width, height, 1);\n }\n\n var attachedTextures = cache.get('attached_textures');\n if (attachedTextures) {\n for (var attachment in attachedTextures) {\n if (!this._textures[attachment]) {\n var target = attachedTextures[attachment];\n this._doDetach(_gl, attachment, target);\n }\n }\n }\n if (!cache.get(KEY_DEPTHTEXTURE_ATTACHED) && this.depthBuffer) {\n // Create a new render buffer\n if (cache.miss(KEY_RENDERBUFFER)) {\n cache.put(KEY_RENDERBUFFER, _gl.createRenderbuffer());\n }\n var renderbuffer = cache.get(KEY_RENDERBUFFER);\n\n if (width !== cache.get(KEY_RENDERBUFFER_WIDTH)\n || height !== cache.get(KEY_RENDERBUFFER_HEIGHT)) {\n _gl.bindRenderbuffer(GL_RENDERBUFFER, renderbuffer);\n _gl.renderbufferStorage(GL_RENDERBUFFER, _gl.DEPTH_COMPONENT16, width, height);\n cache.put(KEY_RENDERBUFFER_WIDTH, width);\n cache.put(KEY_RENDERBUFFER_HEIGHT, height);\n _gl.bindRenderbuffer(GL_RENDERBUFFER, null);\n }\n if (!cache.get(KEY_RENDERBUFFER_ATTACHED)) {\n _gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderbuffer);\n cache.put(KEY_RENDERBUFFER_ATTACHED, true);\n }\n }\n },\n\n /**\n * Unbind the frame buffer after rendering\n * @param {clay.Renderer} renderer\n */\n unbind: function (renderer) {\n // Remove status record on renderer\n renderer.__currentFrameBuffer = null;\n\n var _gl = renderer.gl;\n\n _gl.bindFramebuffer(GL_FRAMEBUFFER, null);\n this._boundRenderer = null;\n\n this._cache.use(renderer.__uid__);\n var viewport = this._cache.get('viewport');\n // Reset viewport;\n if (viewport) {\n renderer.setViewport(viewport);\n }\n\n this.updateMipmap(renderer);\n },\n\n // Because the data of texture is changed over time,\n // Here update the mipmaps of texture each time after rendered;\n updateMipmap: function (renderer) {\n var _gl = renderer.gl;\n for (var attachment in this._textures) {\n var obj = this._textures[attachment];\n if (obj) {\n var texture = obj.texture;\n // FIXME some texture format can't generate mipmap\n if (!texture.NPOT && texture.useMipmap\n && texture.minFilter === Texture.LINEAR_MIPMAP_LINEAR) {\n var target = texture.textureType === 'textureCube' ? glenum.TEXTURE_CUBE_MAP : glenum.TEXTURE_2D;\n _gl.bindTexture(target, texture.getWebGLTexture(renderer));\n _gl.generateMipmap(target);\n _gl.bindTexture(target, null);\n }\n }\n }\n },\n\n\n // 0x8CD5, 36053, FRAMEBUFFER_COMPLETE\n // 0x8CD6, 36054, FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n // 0x8CD7, 36055, FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n // 0x8CD9, 36057, FRAMEBUFFER_INCOMPLETE_DIMENSIONS\n // 0x8CDD, 36061, FRAMEBUFFER_UNSUPPORTED\n checkStatus: function (_gl) {\n return _gl.checkFramebufferStatus(GL_FRAMEBUFFER);\n },\n\n _getFrameBufferGL: function (renderer) {\n var cache = this._cache;\n cache.use(renderer.__uid__);\n\n if (cache.miss(KEY_FRAMEBUFFER)) {\n cache.put(KEY_FRAMEBUFFER, renderer.gl.createFramebuffer());\n }\n\n return cache.get(KEY_FRAMEBUFFER);\n },\n\n /**\n * Attach a texture(RTT) to the framebuffer\n * @param {clay.Texture} texture\n * @param {number} [attachment=gl.COLOR_ATTACHMENT0]\n * @param {number} [target=gl.TEXTURE_2D]\n */\n attach: function (texture, attachment, target) {\n\n if (!texture.width) {\n throw new Error('The texture attached to color buffer is not a valid.');\n }\n // TODO width and height check\n\n // If the depth_texture extension is enabled, developers\n // Can attach a depth texture to the depth buffer\n // http://blog.tojicode.com/2012/07/using-webgldepthtexture.html\n attachment = attachment || GL_COLOR_ATTACHMENT0;\n target = target || glenum.TEXTURE_2D;\n\n var boundRenderer = this._boundRenderer;\n var _gl = boundRenderer && boundRenderer.gl;\n var attachedTextures;\n\n if (_gl) {\n var cache = this._cache;\n cache.use(boundRenderer.__uid__);\n attachedTextures = cache.get('attached_textures');\n }\n\n // Check if texture attached\n var previous = this._textures[attachment];\n if (previous && previous.target === target\n && previous.texture === texture\n && (attachedTextures && attachedTextures[attachment] != null)\n ) {\n return;\n }\n\n var canAttach = true;\n if (boundRenderer) {\n canAttach = this._doAttach(boundRenderer, texture, attachment, target);\n // Set viewport again incase attached to different size textures.\n if (!this.viewport) {\n boundRenderer.setViewport(0, 0, texture.width, texture.height, 1);\n }\n }\n\n if (canAttach) {\n this._textures[attachment] = this._textures[attachment] || {};\n this._textures[attachment].texture = texture;\n this._textures[attachment].target = target;\n }\n },\n\n _doAttach: function (renderer, texture, attachment, target) {\n var _gl = renderer.gl;\n // Make sure texture is always updated\n // Because texture width or height may be changed and in this we can't be notified\n // FIXME awkward;\n var webglTexture = texture.getWebGLTexture(renderer);\n // Assume cache has been used.\n var attachedTextures = this._cache.get('attached_textures');\n if (attachedTextures && attachedTextures[attachment]) {\n var obj = attachedTextures[attachment];\n // Check if texture and target not changed\n if (obj.texture === texture && obj.target === target) {\n return;\n }\n }\n attachment = +attachment;\n\n var canAttach = true;\n if (attachment === GL_DEPTH_ATTACHMENT || attachment === glenum.DEPTH_STENCIL_ATTACHMENT) {\n var extension = renderer.getGLExtension('WEBGL_depth_texture');\n\n if (!extension) {\n console.error('Depth texture is not supported by the browser');\n canAttach = false;\n }\n if (texture.format !== glenum.DEPTH_COMPONENT\n && texture.format !== glenum.DEPTH_STENCIL\n ) {\n console.error('The texture attached to depth buffer is not a valid.');\n canAttach = false;\n }\n\n // Dispose render buffer created previous\n if (canAttach) {\n var renderbuffer = this._cache.get(KEY_RENDERBUFFER);\n if (renderbuffer) {\n _gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, null);\n _gl.deleteRenderbuffer(renderbuffer);\n this._cache.put(KEY_RENDERBUFFER, false);\n }\n\n this._cache.put(KEY_RENDERBUFFER_ATTACHED, false);\n this._cache.put(KEY_DEPTHTEXTURE_ATTACHED, true);\n }\n }\n\n // Mipmap level can only be 0\n _gl.framebufferTexture2D(GL_FRAMEBUFFER, attachment, target, webglTexture, 0);\n\n if (!attachedTextures) {\n attachedTextures = {};\n this._cache.put('attached_textures', attachedTextures);\n }\n attachedTextures[attachment] = attachedTextures[attachment] || {};\n attachedTextures[attachment].texture = texture;\n attachedTextures[attachment].target = target;\n\n return canAttach;\n },\n\n _doDetach: function (_gl, attachment, target) {\n // Detach a texture from framebuffer\n // https://github.com/KhronosGroup/WebGL/blob/master/conformance-suites/1.0.0/conformance/framebuffer-test.html#L145\n _gl.framebufferTexture2D(GL_FRAMEBUFFER, attachment, target, null, 0);\n\n // Assume cache has been used.\n var attachedTextures = this._cache.get('attached_textures');\n if (attachedTextures && attachedTextures[attachment]) {\n attachedTextures[attachment] = null;\n }\n\n if (attachment === GL_DEPTH_ATTACHMENT || attachment === glenum.DEPTH_STENCIL_ATTACHMENT) {\n this._cache.put(KEY_DEPTHTEXTURE_ATTACHED, false);\n }\n },\n\n /**\n * Detach a texture\n * @param {number} [attachment=gl.COLOR_ATTACHMENT0]\n * @param {number} [target=gl.TEXTURE_2D]\n */\n detach: function (attachment, target) {\n // TODO depth extension check ?\n this._textures[attachment] = null;\n if (this._boundRenderer) {\n var cache = this._cache;\n cache.use(this._boundRenderer.__uid__);\n this._doDetach(this._boundRenderer.gl, attachment, target);\n }\n },\n /**\n * Dispose\n * @param {WebGLRenderingContext} _gl\n */\n dispose: function (renderer) {\n\n var _gl = renderer.gl;\n var cache = this._cache;\n\n cache.use(renderer.__uid__);\n\n var renderBuffer = cache.get(KEY_RENDERBUFFER);\n if (renderBuffer) {\n _gl.deleteRenderbuffer(renderBuffer);\n }\n var frameBuffer = cache.get(KEY_FRAMEBUFFER);\n if (frameBuffer) {\n _gl.deleteFramebuffer(frameBuffer);\n }\n cache.deleteContext(renderer.__uid__);\n\n // Clear cache for reusing\n this._textures = {};\n\n }\n});\n\nFrameBuffer.DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT;\nFrameBuffer.COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0;\nFrameBuffer.STENCIL_ATTACHMENT = glenum.STENCIL_ATTACHMENT;\nFrameBuffer.DEPTH_STENCIL_ATTACHMENT = glenum.DEPTH_STENCIL_ATTACHMENT;\n\nexport default FrameBuffer;\n","import Base from '../core/Base';\nimport Vector3 from '../math/Vector3';\nimport PerspectiveCamera from '../camera/Perspective';\nimport FrameBuffer from '../FrameBuffer';\n\nvar targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\n/**\n * Pass rendering scene to a environment cube map\n *\n * @constructor clay.prePass.EnvironmentMap\n * @extends clay.core.Base\n * @example\n * // Example of car reflection\n * var envMap = new clay.TextureCube({\n * width: 256,\n * height: 256\n * });\n * var envPass = new clay.prePass.EnvironmentMap({\n * position: car.position,\n * texture: envMap\n * });\n * var carBody = car.getChildByName('body');\n * carBody.material.enableTexture('environmentMap');\n * carBody.material.set('environmentMap', envMap);\n * ...\n * animation.on('frame', function(frameTime) {\n * envPass.render(renderer, scene);\n * renderer.render(scene, camera);\n * });\n */\nvar EnvironmentMapPass = Base.extend(function() {\n var ret = /** @lends clay.prePass.EnvironmentMap# */ {\n /**\n * Camera position\n * @type {clay.Vector3}\n * @memberOf clay.prePass.EnvironmentMap#\n */\n position: new Vector3(),\n /**\n * Camera far plane\n * @type {number}\n * @memberOf clay.prePass.EnvironmentMap#\n */\n far: 1000,\n /**\n * Camera near plane\n * @type {number}\n * @memberOf clay.prePass.EnvironmentMap#\n */\n near: 0.1,\n /**\n * Environment cube map\n * @type {clay.TextureCube}\n * @memberOf clay.prePass.EnvironmentMap#\n */\n texture: null,\n\n /**\n * Used if you wan't have shadow in environment map\n * @type {clay.prePass.ShadowMap}\n */\n shadowMapPass: null,\n };\n var cameras = ret._cameras = {\n px: new PerspectiveCamera({ fov: 90 }),\n nx: new PerspectiveCamera({ fov: 90 }),\n py: new PerspectiveCamera({ fov: 90 }),\n ny: new PerspectiveCamera({ fov: 90 }),\n pz: new PerspectiveCamera({ fov: 90 }),\n nz: new PerspectiveCamera({ fov: 90 })\n };\n cameras.px.lookAt(Vector3.POSITIVE_X, Vector3.NEGATIVE_Y);\n cameras.nx.lookAt(Vector3.NEGATIVE_X, Vector3.NEGATIVE_Y);\n cameras.py.lookAt(Vector3.POSITIVE_Y, Vector3.POSITIVE_Z);\n cameras.ny.lookAt(Vector3.NEGATIVE_Y, Vector3.NEGATIVE_Z);\n cameras.pz.lookAt(Vector3.POSITIVE_Z, Vector3.NEGATIVE_Y);\n cameras.nz.lookAt(Vector3.NEGATIVE_Z, Vector3.NEGATIVE_Y);\n\n // FIXME In windows, use one framebuffer only renders one side of cubemap\n ret._frameBuffer = new FrameBuffer();\n\n return ret;\n}, /** @lends clay.prePass.EnvironmentMap# */ {\n /**\n * @param {string} target\n * @return {clay.Camera}\n */\n getCamera: function (target) {\n return this._cameras[target];\n },\n /**\n * @param {clay.Renderer} renderer\n * @param {clay.Scene} scene\n * @param {boolean} [notUpdateScene=false]\n */\n render: function(renderer, scene, notUpdateScene) {\n var _gl = renderer.gl;\n if (!notUpdateScene) {\n scene.update();\n }\n // Tweak fov\n // http://the-witness.net/news/2012/02/seamless-cube-map-filtering/\n var n = this.texture.width;\n var fov = 2 * Math.atan(n / (n - 0.5)) / Math.PI * 180;\n\n for (var i = 0; i < 6; i++) {\n var target = targets[i];\n var camera = this._cameras[target];\n Vector3.copy(camera.position, this.position);\n\n camera.far = this.far;\n camera.near = this.near;\n camera.fov = fov;\n\n if (this.shadowMapPass) {\n camera.update();\n\n // update boundingBoxLastFrame\n var bbox = scene.getBoundingBox();\n bbox.applyTransform(camera.viewMatrix);\n scene.viewBoundingBoxLastFrame.copy(bbox);\n\n this.shadowMapPass.render(renderer, scene, camera, true);\n }\n this._frameBuffer.attach(\n this.texture, _gl.COLOR_ATTACHMENT0,\n _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i\n );\n this._frameBuffer.bind(renderer);\n renderer.render(scene, camera, true);\n this._frameBuffer.unbind(renderer);\n }\n },\n /**\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n this._frameBuffer.dispose(renderer);\n }\n});\n\nexport default EnvironmentMapPass;\n","import Geometry from '../Geometry';\nimport BoundingBox from '../math/BoundingBox';\n\n/**\n * @constructor clay.geometry.Plane\n * @extends clay.Geometry\n * @param {Object} [opt]\n * @param {number} [opt.widthSegments]\n * @param {number} [opt.heightSegments]\n */\nvar Plane = Geometry.extend(\n/** @lends clay.geometry.Plane# */\n{\n dynamic: false,\n /**\n * @type {number}\n */\n widthSegments: 1,\n /**\n * @type {number}\n */\n heightSegments: 1\n}, function() {\n this.build();\n},\n/** @lends clay.geometry.Plane.prototype */\n{\n /**\n * Build plane geometry\n */\n build: function() {\n var heightSegments = this.heightSegments;\n var widthSegments = this.widthSegments;\n var attributes = this.attributes;\n var positions = [];\n var texcoords = [];\n var normals = [];\n var faces = [];\n\n for (var y = 0; y <= heightSegments; y++) {\n var t = y / heightSegments;\n for (var x = 0; x <= widthSegments; x++) {\n var s = x / widthSegments;\n\n positions.push([2 * s - 1, 2 * t - 1, 0]);\n if (texcoords) {\n texcoords.push([s, t]);\n }\n if (normals) {\n normals.push([0, 0, 1]);\n }\n if (x < widthSegments && y < heightSegments) {\n var i = x + y * (widthSegments + 1);\n faces.push([i, i + 1, i + widthSegments + 1]);\n faces.push([i + widthSegments + 1, i + 1, i + widthSegments + 2]);\n }\n }\n }\n\n attributes.position.fromArray(positions);\n attributes.texcoord0.fromArray(texcoords);\n attributes.normal.fromArray(normals);\n\n this.initIndicesFromArray(faces);\n\n this.boundingBox = new BoundingBox();\n this.boundingBox.min.set(-1, -1, 0);\n this.boundingBox.max.set(1, 1, 0);\n }\n});\n\nexport default Plane;\n","import Geometry from '../Geometry';\nimport Plane from './Plane';\nimport Matrix4 from '../math/Matrix4';\nimport Vector3 from '../math/Vector3';\nimport BoundingBox from '../math/BoundingBox';\nimport vendor from '../core/vendor';\n\nvar planeMatrix = new Matrix4();\n\n/**\n * @constructor clay.geometry.Cube\n * @extends clay.Geometry\n * @param {Object} [opt]\n * @param {number} [opt.widthSegments]\n * @param {number} [opt.heightSegments]\n * @param {number} [opt.depthSegments]\n * @param {boolean} [opt.inside]\n */\nvar Cube = Geometry.extend(\n/**@lends clay.geometry.Cube# */\n{\n dynamic: false,\n /**\n * @type {number}\n */\n widthSegments: 1,\n /**\n * @type {number}\n */\n heightSegments: 1,\n /**\n * @type {number}\n */\n depthSegments: 1,\n /**\n * @type {boolean}\n */\n inside: false\n}, function() {\n this.build();\n},\n/** @lends clay.geometry.Cube.prototype */\n{\n /**\n * Build cube geometry\n */\n build: function() {\n\n var planes = {\n 'px': createPlane('px', this.depthSegments, this.heightSegments),\n 'nx': createPlane('nx', this.depthSegments, this.heightSegments),\n 'py': createPlane('py', this.widthSegments, this.depthSegments),\n 'ny': createPlane('ny', this.widthSegments, this.depthSegments),\n 'pz': createPlane('pz', this.widthSegments, this.heightSegments),\n 'nz': createPlane('nz', this.widthSegments, this.heightSegments),\n };\n\n var attrList = ['position', 'texcoord0', 'normal'];\n var vertexNumber = 0;\n var faceNumber = 0;\n for (var pos in planes) {\n vertexNumber += planes[pos].vertexCount;\n faceNumber += planes[pos].indices.length;\n }\n for (var k = 0; k < attrList.length; k++) {\n this.attributes[attrList[k]].init(vertexNumber);\n }\n this.indices = new vendor.Uint16Array(faceNumber);\n var faceOffset = 0;\n var vertexOffset = 0;\n for (var pos in planes) {\n var plane = planes[pos];\n for (var k = 0; k < attrList.length; k++) {\n var attrName = attrList[k];\n var attrArray = plane.attributes[attrName].value;\n var attrSize = plane.attributes[attrName].size;\n var isNormal = attrName === 'normal';\n for (var i = 0; i < attrArray.length; i++) {\n var value = attrArray[i];\n if (this.inside && isNormal) {\n value = -value;\n }\n this.attributes[attrName].value[i + attrSize * vertexOffset] = value;\n }\n }\n var len = plane.indices.length;\n for (var i = 0; i < plane.indices.length; i++) {\n this.indices[i + faceOffset] = vertexOffset + plane.indices[this.inside ? (len - i - 1) : i];\n }\n faceOffset += plane.indices.length;\n vertexOffset += plane.vertexCount;\n }\n\n this.boundingBox = new BoundingBox();\n this.boundingBox.max.set(1, 1, 1);\n this.boundingBox.min.set(-1, -1, -1);\n }\n});\n\nfunction createPlane(pos, widthSegments, heightSegments) {\n\n planeMatrix.identity();\n\n var plane = new Plane({\n widthSegments: widthSegments,\n heightSegments: heightSegments\n });\n\n switch(pos) {\n case 'px':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.POSITIVE_X);\n Matrix4.rotateY(planeMatrix, planeMatrix, Math.PI / 2);\n break;\n case 'nx':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.NEGATIVE_X);\n Matrix4.rotateY(planeMatrix, planeMatrix, -Math.PI / 2);\n break;\n case 'py':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.POSITIVE_Y);\n Matrix4.rotateX(planeMatrix, planeMatrix, -Math.PI / 2);\n break;\n case 'ny':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.NEGATIVE_Y);\n Matrix4.rotateX(planeMatrix, planeMatrix, Math.PI / 2);\n break;\n case 'pz':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.POSITIVE_Z);\n break;\n case 'nz':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.NEGATIVE_Z);\n Matrix4.rotateY(planeMatrix, planeMatrix, Math.PI);\n break;\n }\n plane.applyTransform(planeMatrix);\n return plane;\n}\n\nexport default Cube;\n","export default \"@export clay.skybox.vertex\\n#define SHADER_NAME skybox\\nuniform mat4 world : WORLD;\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nattribute vec3 position : POSITION;\\nvarying vec3 v_WorldPosition;\\nvoid main()\\n{\\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n}\\n@end\\n@export clay.skybox.fragment\\n#define PI 3.1415926\\nuniform mat4 viewInverse : VIEWINVERSE;\\n#ifdef EQUIRECTANGULAR\\nuniform sampler2D environmentMap;\\n#else\\nuniform samplerCube environmentMap;\\n#endif\\nuniform float lod: 0.0;\\nvarying vec3 v_WorldPosition;\\n@import clay.util.rgbm\\n@import clay.util.srgb\\n@import clay.util.ACES\\nvoid main()\\n{\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(v_WorldPosition - eyePos);\\n#ifdef EQUIRECTANGULAR\\n float phi = acos(V.y);\\n float theta = atan(-V.x, V.z) + PI * 0.5;\\n vec2 uv = vec2(theta / 2.0 / PI, phi / PI);\\n vec4 texel = decodeHDR(texture2D(environmentMap, fract(uv)));\\n#else\\n #if defined(LOD) || defined(SUPPORT_TEXTURE_LOD)\\n vec4 texel = decodeHDR(textureCubeLodEXT(environmentMap, V, lod));\\n #else\\n vec4 texel = decodeHDR(textureCube(environmentMap, V));\\n #endif\\n#endif\\n#ifdef SRGB_DECODE\\n texel = sRGBToLinear(texel);\\n#endif\\n#ifdef TONEMAPPING\\n texel.rgb = ACESToneMapping(texel.rgb);\\n#endif\\n#ifdef SRGB_ENCODE\\n texel = linearTosRGB(texel);\\n#endif\\n gl_FragColor = encodeHDR(vec4(texel.rgb, 1.0));\\n}\\n@end\";\n","// TODO Should not derived from mesh?\nimport Mesh from '../Mesh';\nimport CubeGeometry from '../geometry/Cube';\nimport Shader from '../Shader';\nimport Material from '../Material';\nimport Texture from '../Texture';\nimport PerspectiveCamera from '../camera/Perspective';\nimport Matrix4 from '../math/Matrix4';\n\nimport skyboxEssl from '../shader/source/skybox.glsl.js';\nShader.import(skyboxEssl);\n/**\n * @constructor clay.plugin.Skybox\n *\n * @example\n * var skyTex = new clay.TextureCube();\n * skyTex.load({\n * 'px': 'assets/textures/sky/px.jpg',\n * 'nx': 'assets/textures/sky/nx.jpg'\n * 'py': 'assets/textures/sky/py.jpg'\n * 'ny': 'assets/textures/sky/ny.jpg'\n * 'pz': 'assets/textures/sky/pz.jpg'\n * 'nz': 'assets/textures/sky/nz.jpg'\n * });\n * var skybox = new clay.plugin.Skybox({\n * scene: scene\n * });\n * skybox.material.set('environmentMap', skyTex);\n */\nvar Skybox = Mesh.extend(function () {\n\n var skyboxShader = new Shader({\n vertex: Shader.source('clay.skybox.vertex'),\n fragment: Shader.source('clay.skybox.fragment')\n });\n var material = new Material({\n shader: skyboxShader,\n depthMask: false\n });\n\n return {\n /**\n * @type {clay.Scene}\n * @memberOf clay.plugin.Skybox.prototype\n */\n scene: null,\n\n geometry: new CubeGeometry(),\n\n material: material,\n\n environmentMap: null,\n\n culling: false,\n\n _dummyCamera: new PerspectiveCamera()\n };\n}, function () {\n var scene = this.scene;\n if (scene) {\n this.attachScene(scene);\n }\n if (this.environmentMap) {\n this.setEnvironmentMap(this.environmentMap);\n }\n}, /** @lends clay.plugin.Skybox# */ {\n /**\n * Attach the skybox to the scene\n * @param {clay.Scene} scene\n */\n attachScene: function (scene) {\n if (this.scene) {\n this.detachScene();\n }\n scene.skybox = this;\n\n this.scene = scene;\n scene.on('beforerender', this._beforeRenderScene, this);\n },\n /**\n * Detach from scene\n */\n detachScene: function () {\n if (this.scene) {\n this.scene.off('beforerender', this._beforeRenderScene);\n this.scene.skybox = null;\n }\n this.scene = null;\n },\n\n /**\n * Dispose skybox\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n this.detachScene();\n this.geometry.dispose(renderer);\n },\n /**\n * Set environment map\n * @param {clay.TextureCube} envMap\n */\n setEnvironmentMap: function (envMap) {\n if (envMap.textureType === 'texture2D') {\n this.material.define('EQUIRECTANGULAR');\n // LINEAR filter can remove the artifacts in pole\n envMap.minFilter = Texture.LINEAR;\n }\n else {\n this.material.undefine('EQUIRECTANGULAR');\n }\n this.material.set('environmentMap', envMap);\n },\n /**\n * Get environment map\n * @return {clay.TextureCube}\n */\n getEnvironmentMap: function () {\n return this.material.get('environmentMap');\n },\n\n _beforeRenderScene: function(renderer, scene, camera) {\n this.renderSkybox(renderer, camera);\n },\n\n renderSkybox: function (renderer, camera) {\n var dummyCamera = this._dummyCamera;\n dummyCamera.aspect = renderer.getViewportAspect();\n dummyCamera.fov = camera.fov || 50;\n dummyCamera.updateProjectionMatrix();\n Matrix4.invert(dummyCamera.invProjectionMatrix, dummyCamera.projectionMatrix);\n dummyCamera.worldTransform.copy(camera.worldTransform);\n dummyCamera.viewMatrix.copy(camera.viewMatrix);\n\n this.position.copy(camera.getWorldPosition());\n this.update();\n\n // Don't remember to disable blend\n renderer.gl.disable(renderer.gl.BLEND);\n if (this.material.get('lod') > 0) {\n this.material.define('fragment', 'LOD');\n }\n else {\n this.material.undefine('fragment', 'LOD');\n }\n renderer.renderPass([this], dummyCamera);\n }\n});\n\nexport default Skybox;\n","import Skybox from './Skybox';\n\nexport default Skybox;","import Texture from '../Texture';\nimport Texture2D from '../Texture2D';\nimport TextureCube from '../TextureCube';\n\n// http://msdn.microsoft.com/en-us/library/windows/desktop/bb943991(v=vs.85).aspx\n// https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js\nvar DDS_MAGIC = 0x20534444;\n\nvar DDSD_CAPS = 0x1;\nvar DDSD_HEIGHT = 0x2;\nvar DDSD_WIDTH = 0x4;\nvar DDSD_PITCH = 0x8;\nvar DDSD_PIXELFORMAT = 0x1000;\nvar DDSD_MIPMAPCOUNT = 0x20000;\nvar DDSD_LINEARSIZE = 0x80000;\nvar DDSD_DEPTH = 0x800000;\n\nvar DDSCAPS_COMPLEX = 0x8;\nvar DDSCAPS_MIPMAP = 0x400000;\nvar DDSCAPS_TEXTURE = 0x1000;\n\nvar DDSCAPS2_CUBEMAP = 0x200;\nvar DDSCAPS2_CUBEMAP_POSITIVEX = 0x400;\nvar DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800;\nvar DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000;\nvar DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000;\nvar DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000;\nvar DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000;\nvar DDSCAPS2_VOLUME = 0x200000;\n\nvar DDPF_ALPHAPIXELS = 0x1;\nvar DDPF_ALPHA = 0x2;\nvar DDPF_FOURCC = 0x4;\nvar DDPF_RGB = 0x40;\nvar DDPF_YUV = 0x200;\nvar DDPF_LUMINANCE = 0x20000;\n\nfunction fourCCToInt32(value) {\n return value.charCodeAt(0) +\n (value.charCodeAt(1) << 8) +\n (value.charCodeAt(2) << 16) +\n (value.charCodeAt(3) << 24);\n}\n\nfunction int32ToFourCC(value) {\n return String.fromCharCode(\n value & 0xff,\n (value >> 8) & 0xff,\n (value >> 16) & 0xff,\n (value >> 24) & 0xff\n );\n}\n\nvar headerLengthInt = 31; // The header length in 32 bit ints\n\nvar FOURCC_DXT1 = fourCCToInt32('DXT1');\nvar FOURCC_DXT3 = fourCCToInt32('DXT3');\nvar FOURCC_DXT5 = fourCCToInt32('DXT5');\n// Offsets into the header array\nvar off_magic = 0;\n\nvar off_size = 1;\nvar off_flags = 2;\nvar off_height = 3;\nvar off_width = 4;\n\nvar off_mipmapCount = 7;\n\nvar off_pfFlags = 20;\nvar off_pfFourCC = 21;\n\nvar off_caps = 27;\nvar off_caps2 = 28;\nvar off_caps3 = 29;\nvar off_caps4 = 30;\n\nvar ret = {\n parse: function(arrayBuffer, out) {\n var header = new Int32Array(arrayBuffer, 0, headerLengthInt);\n if (header[off_magic] !== DDS_MAGIC) {\n return null;\n }\n if (!header(off_pfFlags) & DDPF_FOURCC) {\n return null;\n }\n\n var fourCC = header(off_pfFourCC);\n var width = header[off_width];\n var height = header[off_height];\n var isCubeMap = header[off_caps2] & DDSCAPS2_CUBEMAP;\n var hasMipmap = header[off_flags] & DDSD_MIPMAPCOUNT;\n var blockBytes, internalFormat;\n switch(fourCC) {\n case FOURCC_DXT1:\n blockBytes = 8;\n internalFormat = Texture.COMPRESSED_RGB_S3TC_DXT1_EXT;\n break;\n case FOURCC_DXT3:\n blockBytes = 16;\n internalFormat = Texture.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n break;\n case FOURCC_DXT5:\n blockBytes = 16;\n internalFormat = Texture.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n break;\n default:\n return null;\n }\n var dataOffset = header[off_size] + 4;\n // TODO: Suppose all face are existed\n var faceNumber = isCubeMap ? 6 : 1;\n var mipmapCount = 1;\n if (hasMipmap) {\n mipmapCount = Math.max(1, header[off_mipmapCount]);\n }\n\n var textures = [];\n for (var f = 0; f < faceNumber; f++) {\n var _width = width;\n var _height = height;\n textures[f] = new Texture2D({\n width: _width,\n height: _height,\n format: internalFormat\n });\n var mipmaps = [];\n for (var i = 0; i < mipmapCount; i++) {\n var dataLength = Math.max(4, _width) / 4 * Math.max(4, _height) / 4 * blockBytes;\n var byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength);\n\n dataOffset += dataLength;\n _width *= 0.5;\n _height *= 0.5;\n mipmaps[i] = byteArray;\n }\n textures[f].pixels = mipmaps[0];\n if (hasMipmap) {\n textures[f].mipmaps = mipmaps;\n }\n }\n // TODO\n // return isCubeMap ? textures : textures[0];\n if (out) {\n out.width = textures[0].width;\n out.height = textures[0].height;\n out.format = textures[0].format;\n out.pixels = textures[0].pixels;\n out.mipmaps = textures[0].mipmaps;\n }\n else {\n return textures[0];\n }\n }\n};\n\nexport default ret;\n","import Texture from '../Texture';\nimport Texture2D from '../Texture2D';\nvar toChar = String.fromCharCode;\n\nvar MINELEN = 8;\nvar MAXELEN = 0x7fff;\nfunction rgbe2float(rgbe, buffer, offset, exposure) {\n if (rgbe[3] > 0) {\n var f = Math.pow(2.0, rgbe[3] - 128 - 8 + exposure);\n buffer[offset + 0] = rgbe[0] * f;\n buffer[offset + 1] = rgbe[1] * f;\n buffer[offset + 2] = rgbe[2] * f;\n }\n else {\n buffer[offset + 0] = 0;\n buffer[offset + 1] = 0;\n buffer[offset + 2] = 0;\n }\n buffer[offset + 3] = 1.0;\n return buffer;\n}\n\nfunction uint82string(array, offset, size) {\n var str = '';\n for (var i = offset; i < size; i++) {\n str += toChar(array[i]);\n }\n return str;\n}\n\nfunction copyrgbe(s, t) {\n t[0] = s[0];\n t[1] = s[1];\n t[2] = s[2];\n t[3] = s[3];\n}\n\n// TODO : check\nfunction oldReadColors(scan, buffer, offset, xmax) {\n var rshift = 0, x = 0, len = xmax;\n while (len > 0) {\n scan[x][0] = buffer[offset++];\n scan[x][1] = buffer[offset++];\n scan[x][2] = buffer[offset++];\n scan[x][3] = buffer[offset++];\n if (scan[x][0] === 1 && scan[x][1] === 1 && scan[x][2] === 1) {\n // exp is count of repeated pixels\n for (var i = (scan[x][3] << rshift) >>> 0; i > 0; i--) {\n copyrgbe(scan[x-1], scan[x]);\n x++;\n len--;\n }\n rshift += 8;\n } else {\n x++;\n len--;\n rshift = 0;\n }\n }\n return offset;\n}\n\nfunction readColors(scan, buffer, offset, xmax) {\n if ((xmax < MINELEN) | (xmax > MAXELEN)) {\n return oldReadColors(scan, buffer, offset, xmax);\n }\n var i = buffer[offset++];\n if (i != 2) {\n return oldReadColors(scan, buffer, offset - 1, xmax);\n }\n scan[0][1] = buffer[offset++];\n scan[0][2] = buffer[offset++];\n\n i = buffer[offset++];\n if ((((scan[0][2] << 8) >>> 0) | i) >>> 0 !== xmax) {\n return null;\n }\n for (var i = 0; i < 4; i++) {\n for (var x = 0; x < xmax;) {\n var code = buffer[offset++];\n if (code > 128) {\n code = (code & 127) >>> 0;\n var val = buffer[offset++];\n while (code--) {\n scan[x++][i] = val;\n }\n } else {\n while (code--) {\n scan[x++][i] = buffer[offset++];\n }\n }\n }\n }\n return offset;\n}\n\n\nvar ret = {\n // http://www.graphics.cornell.edu/~bjw/rgbe.html\n // Blender source\n // http://radsite.lbl.gov/radiance/refer/Notes/picture_format.html\n parseRGBE: function(arrayBuffer, texture, exposure) {\n if (exposure == null) {\n exposure = 0;\n }\n var data = new Uint8Array(arrayBuffer);\n var size = data.length;\n if (uint82string(data, 0, 2) !== '#?') {\n return;\n }\n // find empty line, next line is resolution info\n for (var i = 2; i < size; i++) {\n if (toChar(data[i]) === '\\n' && toChar(data[i+1]) === '\\n') {\n break;\n }\n }\n if (i >= size) { // not found\n return;\n }\n // find resolution info line\n i += 2;\n var str = '';\n for (; i < size; i++) {\n var _char = toChar(data[i]);\n if (_char === '\\n') {\n break;\n }\n str += _char;\n }\n // -Y M +X N\n var tmp = str.split(' ');\n var height = parseInt(tmp[1]);\n var width = parseInt(tmp[3]);\n if (!width || !height) {\n return;\n }\n\n // read and decode actual data\n var offset = i+1;\n var scanline = [];\n // memzero\n for (var x = 0; x < width; x++) {\n scanline[x] = [];\n for (var j = 0; j < 4; j++) {\n scanline[x][j] = 0;\n }\n }\n var pixels = new Float32Array(width * height * 4);\n var offset2 = 0;\n for (var y = 0; y < height; y++) {\n var offset = readColors(scanline, data, offset, width);\n if (!offset) {\n return null;\n }\n for (var x = 0; x < width; x++) {\n rgbe2float(scanline[x], pixels, offset2, exposure);\n offset2 += 4;\n }\n }\n\n if (!texture) {\n texture = new Texture2D();\n }\n texture.width = width;\n texture.height = height;\n texture.pixels = pixels;\n // HALF_FLOAT can't use Float32Array\n texture.type = Texture.FLOAT;\n return texture;\n },\n\n parseRGBEFromPNG: function(png) {\n\n }\n};\n\nexport default ret;\n","import Texture2D from '../Texture2D';\nimport TextureCube from '../TextureCube';\nimport vendor from '../core/vendor';\nimport EnvironmentMapPass from '../prePass/EnvironmentMap';\nimport Skydome from '../plugin/Skydome';\nimport Scene from '../Scene';\n\nimport dds from './dds';\nimport hdr from './hdr';\n\n/**\n * @alias clay.util.texture\n */\nvar textureUtil = {\n /**\n * @param {string|object} path\n * @param {object} [option]\n * @param {Function} [onsuccess]\n * @param {Function} [onerror]\n * @return {clay.Texture}\n */\n loadTexture: function (path, option, onsuccess, onerror) {\n var texture;\n if (typeof(option) === 'function') {\n onsuccess = option;\n onerror = onsuccess;\n option = {};\n }\n else {\n option = option || {};\n }\n if (typeof(path) === 'string') {\n if (path.match(/.hdr$/) || option.fileType === 'hdr') {\n texture = new Texture2D({\n width: 0,\n height: 0,\n sRGB: false\n });\n textureUtil._fetchTexture(\n path,\n function (data) {\n hdr.parseRGBE(data, texture, option.exposure);\n texture.dirty();\n onsuccess && onsuccess(texture);\n },\n onerror\n );\n return texture;\n }\n else if (path.match(/.dds$/) || option.fileType === 'dds') {\n texture = new Texture2D({\n width: 0,\n height: 0\n });\n textureUtil._fetchTexture(\n path,\n function (data) {\n dds.parse(data, texture);\n texture.dirty();\n onsuccess && onsuccess(texture);\n },\n onerror\n );\n }\n else {\n texture = new Texture2D();\n texture.load(path);\n texture.success(onsuccess);\n texture.error(onerror);\n }\n }\n else if (typeof path === 'object' && typeof(path.px) !== 'undefined') {\n texture = new TextureCube();\n texture.load(path);\n texture.success(onsuccess);\n texture.error(onerror);\n }\n return texture;\n },\n\n /**\n * Load a panorama texture and render it to a cube map\n * @param {clay.Renderer} renderer\n * @param {string} path\n * @param {clay.TextureCube} cubeMap\n * @param {object} [option]\n * @param {boolean} [option.encodeRGBM]\n * @param {number} [option.exposure]\n * @param {Function} [onsuccess]\n * @param {Function} [onerror]\n */\n loadPanorama: function (renderer, path, cubeMap, option, onsuccess, onerror) {\n var self = this;\n\n if (typeof(option) === 'function') {\n onsuccess = option;\n onerror = onsuccess;\n option = {};\n }\n else {\n option = option || {};\n }\n\n textureUtil.loadTexture(path, option, function (texture) {\n // PENDING\n texture.flipY = option.flipY || false;\n self.panoramaToCubeMap(renderer, texture, cubeMap, option);\n texture.dispose(renderer);\n onsuccess && onsuccess(cubeMap);\n }, onerror);\n },\n\n /**\n * Render a panorama texture to a cube map\n * @param {clay.Renderer} renderer\n * @param {clay.Texture2D} panoramaMap\n * @param {clay.TextureCube} cubeMap\n * @param {Object} option\n * @param {boolean} [option.encodeRGBM]\n */\n panoramaToCubeMap: function (renderer, panoramaMap, cubeMap, option) {\n var environmentMapPass = new EnvironmentMapPass();\n var skydome = new Skydome({\n scene: new Scene()\n });\n skydome.setEnvironmentMap(panoramaMap);\n\n option = option || {};\n if (option.encodeRGBM) {\n skydome.material.define('fragment', 'RGBM_ENCODE');\n }\n\n // Share sRGB\n cubeMap.sRGB = panoramaMap.sRGB;\n\n environmentMapPass.texture = cubeMap;\n environmentMapPass.render(renderer, skydome.scene);\n environmentMapPass.texture = null;\n environmentMapPass.dispose(renderer);\n return cubeMap;\n },\n\n /**\n * Convert height map to normal map\n * @param {HTMLImageElement|HTMLCanvasElement} image\n * @param {boolean} [checkBump=false]\n * @return {HTMLCanvasElement}\n */\n heightToNormal: function (image, checkBump) {\n var canvas = document.createElement('canvas');\n var width = canvas.width = image.width;\n var height = canvas.height = image.height;\n var ctx = canvas.getContext('2d');\n ctx.drawImage(image, 0, 0, width, height);\n checkBump = checkBump || false;\n var srcData = ctx.getImageData(0, 0, width, height);\n var dstData = ctx.createImageData(width, height);\n for (var i = 0; i < srcData.data.length; i += 4) {\n if (checkBump) {\n var r = srcData.data[i];\n var g = srcData.data[i + 1];\n var b = srcData.data[i + 2];\n var diff = Math.abs(r - g) + Math.abs(g - b);\n if (diff > 20) {\n console.warn('Given image is not a height map');\n return image;\n }\n }\n // Modified from http://mrdoob.com/lab/javascript/height2normal/\n var x1, y1, x2, y2;\n if (i % (width * 4) === 0) {\n // left edge\n x1 = srcData.data[i];\n x2 = srcData.data[i + 4];\n }\n else if (i % (width * 4) === (width - 1) * 4) {\n // right edge\n x1 = srcData.data[i - 4];\n x2 = srcData.data[i];\n }\n else {\n x1 = srcData.data[i - 4];\n x2 = srcData.data[i + 4];\n }\n\n if (i < width * 4) {\n // top edge\n y1 = srcData.data[i];\n y2 = srcData.data[i + width * 4];\n }\n else if (i > width * (height - 1) * 4) {\n // bottom edge\n y1 = srcData.data[i - width * 4];\n y2 = srcData.data[i];\n }\n else {\n y1 = srcData.data[i - width * 4];\n y2 = srcData.data[i + width * 4];\n }\n\n dstData.data[i] = (x1 - x2) + 127;\n dstData.data[i + 1] = (y1 - y2) + 127;\n dstData.data[i + 2] = 255;\n dstData.data[i + 3] = 255;\n }\n ctx.putImageData(dstData, 0, 0);\n return canvas;\n },\n\n /**\n * Convert height map to normal map\n * @param {HTMLImageElement|HTMLCanvasElement} image\n * @param {boolean} [checkBump=false]\n * @param {number} [threshold=20]\n * @return {HTMLCanvasElement}\n */\n isHeightImage: function (img, downScaleSize, threshold) {\n if (!img || !img.width || !img.height) {\n return false;\n }\n\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n var size = downScaleSize || 32;\n threshold = threshold || 20;\n canvas.width = canvas.height = size;\n ctx.drawImage(img, 0, 0, size, size);\n var srcData = ctx.getImageData(0, 0, size, size);\n for (var i = 0; i < srcData.data.length; i += 4) {\n var r = srcData.data[i];\n var g = srcData.data[i + 1];\n var b = srcData.data[i + 2];\n var diff = Math.abs(r - g) + Math.abs(g - b);\n if (diff > threshold) {\n return false;\n }\n }\n return true;\n },\n\n _fetchTexture: function (path, onsuccess, onerror) {\n vendor.request.get({\n url: path,\n responseType: 'arraybuffer',\n onload: onsuccess,\n onerror: onerror\n });\n },\n\n /**\n * Create a chessboard texture\n * @param {number} [size]\n * @param {number} [unitSize]\n * @param {string} [color1]\n * @param {string} [color2]\n * @return {clay.Texture2D}\n */\n createChessboard: function (size, unitSize, color1, color2) {\n size = size || 512;\n unitSize = unitSize || 64;\n color1 = color1 || 'black';\n color2 = color2 || 'white';\n\n var repeat = Math.ceil(size / unitSize);\n\n var canvas = document.createElement('canvas');\n canvas.width = size;\n canvas.height = size;\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = color2;\n ctx.fillRect(0, 0, size, size);\n\n ctx.fillStyle = color1;\n for (var i = 0; i < repeat; i++) {\n for (var j = 0; j < repeat; j++) {\n var isFill = j % 2 ? (i % 2) : (i % 2 - 1);\n if (isFill) {\n ctx.fillRect(i * unitSize, j * unitSize, unitSize, unitSize);\n }\n }\n }\n\n var texture = new Texture2D({\n image: canvas,\n anisotropic: 8\n });\n\n return texture;\n },\n\n /**\n * Create a blank pure color 1x1 texture\n * @param {string} color\n * @return {clay.Texture2D}\n */\n createBlank: function (color) {\n var canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = color;\n ctx.fillRect(0, 0, 1, 1);\n\n var texture = new Texture2D({\n image: canvas\n });\n\n return texture;\n }\n};\n\nexport default textureUtil;\n","/**\n * Surface texture in the 3D scene.\n * Provide management and rendering of zrender shapes and groups\n *\n * @module echarts-gl/util/EChartsSurface\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Texture2D from 'claygl/src/Texture2D';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Vector2 from 'claygl/src/math/Vector2';\n\nvar events = ['mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'click', 'dblclick', 'contextmenu'];\n\nfunction makeHandlerName(eventName) {\n return '_on' + eventName;\n}\n/**\n * @constructor\n * @alias echarts-gl/util/EChartsSurface\n * @param {module:echarts~ECharts} chart\n */\nvar EChartsSurface = function (chart) {\n var self = this;\n this._texture = new Texture2D({\n anisotropic: 32,\n flipY: false,\n\n surface: this,\n\n dispose: function (renderer) {\n self.dispose();\n Texture2D.prototype.dispose.call(this, renderer);\n }\n });\n\n events.forEach(function (eventName) {\n this[makeHandlerName(eventName)] = function (eveObj) {\n if (!eveObj.triangle) {\n return;\n }\n this._meshes.forEach(function (mesh) {\n this.dispatchEvent(eventName, mesh, eveObj.triangle, eveObj.point);\n }, this);\n };\n }, this);\n\n this._meshes = [];\n\n if (chart) {\n this.setECharts(chart);\n }\n\n // Texture updated callback;\n this.onupdate = null;\n};\n\nEChartsSurface.prototype = {\n\n constructor: EChartsSurface,\n\n getTexture: function () {\n return this._texture;\n },\n\n setECharts: function (chart) {\n this._chart = chart;\n\n var canvas = chart.getDom();\n if (!(canvas instanceof HTMLCanvasElement)) {\n console.error('ECharts must init on canvas if it is used as texture.');\n // Use an empty canvas\n canvas = document.createElement('canvas');\n }\n else {\n var self = this;\n // Wrap refreshImmediately\n var zr = chart.getZr();\n var oldRefreshImmediately = zr.__oldRefreshImmediately || zr.refreshImmediately;\n zr.refreshImmediately = function () {\n oldRefreshImmediately.call(this);\n self._texture.dirty();\n\n self.onupdate && self.onupdate();\n };\n zr.__oldRefreshImmediately = oldRefreshImmediately;\n }\n\n this._texture.image = canvas;\n this._texture.dirty();\n this.onupdate && this.onupdate();\n },\n\n /**\n * @method\n * @param {clay.Mesh} attachedMesh\n * @param {Array.} triangle Triangle indices\n * @param {clay.math.Vector3} point\n */\n dispatchEvent: (function () {\n\n var p0 = new Vector3();\n var p1 = new Vector3();\n var p2 = new Vector3();\n var uv0 = new Vector2();\n var uv1 = new Vector2();\n var uv2 = new Vector2();\n var uv = new Vector2();\n\n var vCross = new Vector3();\n\n return function (eventName, attachedMesh, triangle, point) {\n var geo = attachedMesh.geometry;\n var position = geo.attributes.position;\n var texcoord = geo.attributes.texcoord0;\n var dot = Vector3.dot;\n var cross = Vector3.cross;\n\n position.get(triangle[0], p0.array);\n position.get(triangle[1], p1.array);\n position.get(triangle[2], p2.array);\n texcoord.get(triangle[0], uv0.array);\n texcoord.get(triangle[1], uv1.array);\n texcoord.get(triangle[2], uv2.array);\n\n cross(vCross, p1, p2);\n var det = dot(p0, vCross);\n var t = dot(point, vCross) / det;\n cross(vCross, p2, p0);\n var u = dot(point, vCross) / det;\n cross(vCross, p0, p1);\n var v = dot(point, vCross) / det;\n\n Vector2.scale(uv, uv0, t);\n Vector2.scaleAndAdd(uv, uv, uv1, u);\n Vector2.scaleAndAdd(uv, uv, uv2, v);\n\n var x = uv.x * this._chart.getWidth();\n var y = uv.y * this._chart.getHeight();\n this._chart.getZr().handler.dispatch(eventName, {\n zrX: x,\n zrY: y\n });\n };\n })(),\n\n attachToMesh: function (mesh) {\n if (this._meshes.indexOf(mesh) >= 0) {\n return;\n }\n\n events.forEach(function (eventName) {\n mesh.on(eventName, this[makeHandlerName(eventName)], this);\n }, this);\n\n this._meshes.push(mesh);\n },\n\n detachFromMesh: function (mesh) {\n var idx = this._meshes.indexOf(mesh);\n if (idx >= 0) {\n this._meshes.splice(idx, 1);\n }\n\n events.forEach(function (eventName) {\n mesh.off(eventName, this[makeHandlerName(eventName)]);\n }, this);\n },\n\n dispose: function () {\n this._meshes.forEach(function (mesh) {\n this.detachFromMesh(mesh);\n }, this);\n }\n};\n\nexport default EChartsSurface;","import Camera from '../Camera';\n/**\n * @constructor clay.camera.Orthographic\n * @extends clay.Camera\n */\nvar Orthographic = Camera.extend(\n/** @lends clay.camera.Orthographic# */\n{\n /**\n * @type {number}\n */\n left: -1,\n /**\n * @type {number}\n */\n right: 1,\n /**\n * @type {number}\n */\n near: -1,\n /**\n * @type {number}\n */\n far: 1,\n /**\n * @type {number}\n */\n top: 1,\n /**\n * @type {number}\n */\n bottom: -1\n},\n/** @lends clay.camera.Orthographic.prototype */\n{\n\n updateProjectionMatrix: function() {\n this.projectionMatrix.ortho(this.left, this.right, this.bottom, this.top, this.near, this.far);\n },\n\n decomposeProjectionMatrix: function () {\n var m = this.projectionMatrix.array;\n this.left = (-1 - m[12]) / m[0];\n this.right = (1 - m[12]) / m[0];\n this.top = (1 - m[13]) / m[5];\n this.bottom = (-1 - m[13]) / m[5];\n this.near = -(-1 - m[14]) / m[10];\n this.far = -(1 - m[14]) / m[10];\n },\n /**\n * @return {clay.camera.Orthographic}\n */\n clone: function() {\n var camera = Camera.prototype.clone.call(this);\n camera.left = this.left;\n camera.right = this.right;\n camera.near = this.near;\n camera.far = this.far;\n camera.top = this.top;\n camera.bottom = this.bottom;\n\n return camera;\n }\n});\n\nexport default Orthographic;\n","export default \"\\n@export clay.compositor.vertex\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nattribute vec3 position : POSITION;\\nattribute vec2 texcoord : TEXCOORD_0;\\nvarying vec2 v_Texcoord;\\nvoid main()\\n{\\n v_Texcoord = texcoord;\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n}\\n@end\";\n","import Base from '../core/Base';\nimport OrthoCamera from '../camera/Orthographic';\nimport Plane from '../geometry/Plane';\nimport Shader from '../Shader';\nimport Material from '../Material';\nimport Mesh from '../Mesh';\nimport glenum from '../core/glenum';\nimport vertexGlsl from '../shader/source/compositor/vertex.glsl.js';\n\nShader['import'](vertexGlsl);\n\nvar planeGeo = new Plane();\nvar mesh = new Mesh({\n geometry: planeGeo,\n frustumCulling: false\n});\nvar camera = new OrthoCamera();\n\n/**\n * @constructor clay.compositor.Pass\n * @extends clay.core.Base\n */\nvar Pass = Base.extend(function () {\n return /** @lends clay.compositor.Pass# */ {\n /**\n * Fragment shader string\n * @type {string}\n */\n // PENDING shader or fragment ?\n fragment: '',\n\n /**\n * @type {Object}\n */\n outputs: null,\n\n /**\n * @type {clay.Material}\n */\n material: null,\n\n /**\n * @type {Boolean}\n */\n blendWithPrevious: false,\n\n /**\n * @type {Boolean}\n */\n clearColor: false,\n\n /**\n * @type {Boolean}\n */\n clearDepth: true\n };\n}, function() {\n\n var shader = new Shader(Shader.source('clay.compositor.vertex'), this.fragment);\n var material = new Material({\n shader: shader\n });\n material.enableTexturesAll();\n\n this.material = material;\n\n},\n/** @lends clay.compositor.Pass.prototype */\n{\n /**\n * @param {string} name\n * @param {} value\n */\n setUniform: function(name, value) {\n this.material.setUniform(name, value);\n },\n /**\n * @param {string} name\n * @return {}\n */\n getUniform: function(name) {\n var uniform = this.material.uniforms[name];\n if (uniform) {\n return uniform.value;\n }\n },\n /**\n * @param {clay.Texture} texture\n * @param {number} attachment\n */\n attachOutput: function(texture, attachment) {\n if (!this.outputs) {\n this.outputs = {};\n }\n attachment = attachment || glenum.COLOR_ATTACHMENT0;\n this.outputs[attachment] = texture;\n },\n /**\n * @param {clay.Texture} texture\n */\n detachOutput: function(texture) {\n for (var attachment in this.outputs) {\n if (this.outputs[attachment] === texture) {\n this.outputs[attachment] = null;\n }\n }\n },\n\n bind: function(renderer, frameBuffer) {\n\n if (this.outputs) {\n for (var attachment in this.outputs) {\n var texture = this.outputs[attachment];\n if (texture) {\n frameBuffer.attach(texture, attachment);\n }\n }\n }\n\n if (frameBuffer) {\n frameBuffer.bind(renderer);\n }\n },\n\n unbind: function(renderer, frameBuffer) {\n frameBuffer.unbind(renderer);\n },\n /**\n * @param {clay.Renderer} renderer\n * @param {clay.FrameBuffer} [frameBuffer]\n */\n render: function(renderer, frameBuffer) {\n\n var _gl = renderer.gl;\n\n if (frameBuffer) {\n this.bind(renderer, frameBuffer);\n // MRT Support in chrome\n // https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/ext-draw-buffers.html\n var ext = renderer.getGLExtension('EXT_draw_buffers');\n if (ext && this.outputs) {\n var bufs = [];\n for (var attachment in this.outputs) {\n attachment = +attachment;\n if (attachment >= _gl.COLOR_ATTACHMENT0 && attachment <= _gl.COLOR_ATTACHMENT0 + 8) {\n bufs.push(attachment);\n }\n }\n ext.drawBuffersEXT(bufs);\n }\n }\n\n this.trigger('beforerender', this, renderer);\n\n // FIXME Don't clear in each pass in default, let the color overwrite the buffer\n // FIXME pixels may be discard\n var clearBit = this.clearDepth ? _gl.DEPTH_BUFFER_BIT : 0;\n _gl.depthMask(true);\n if (this.clearColor) {\n clearBit = clearBit | _gl.COLOR_BUFFER_BIT;\n _gl.colorMask(true, true, true, true);\n var cc = this.clearColor;\n if (Array.isArray(cc)) {\n _gl.clearColor(cc[0], cc[1], cc[2], cc[3]);\n }\n }\n _gl.clear(clearBit);\n\n if (this.blendWithPrevious) {\n // Blend with previous rendered scene in the final output\n // FIXME Configure blend.\n // FIXME It will cause screen blink?\n _gl.enable(_gl.BLEND);\n this.material.transparent = true;\n }\n else {\n _gl.disable(_gl.BLEND);\n this.material.transparent = false;\n }\n\n this.renderQuad(renderer);\n\n this.trigger('afterrender', this, renderer);\n\n if (frameBuffer) {\n this.unbind(renderer, frameBuffer);\n }\n },\n\n /**\n * Simply do quad rendering\n */\n renderQuad: function (renderer) {\n mesh.material = this.material;\n renderer.renderPass([mesh], camera);\n },\n\n /**\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {}\n});\n\nexport default Pass;\n","export default \"#define SAMPLE_NUMBER 1024\\n#define PI 3.14159265358979\\nuniform sampler2D normalDistribution;\\nuniform vec2 viewportSize : [512, 256];\\nconst vec3 N = vec3(0.0, 0.0, 1.0);\\nconst float fSampleNumber = float(SAMPLE_NUMBER);\\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\\n vec3 tangentX = normalize(cross(N, upVector));\\n vec3 tangentZ = cross(N, tangentX);\\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\\n}\\nfloat G_Smith(float roughness, float NoV, float NoL) {\\n float k = roughness * roughness / 2.0;\\n float G1V = NoV / (NoV * (1.0 - k) + k);\\n float G1L = NoL / (NoL * (1.0 - k) + k);\\n return G1L * G1V;\\n}\\nvoid main() {\\n vec2 uv = gl_FragCoord.xy / viewportSize;\\n float NoV = uv.x;\\n float roughness = uv.y;\\n vec3 V;\\n V.x = sqrt(1.0 - NoV * NoV);\\n V.y = 0.0;\\n V.z = NoV;\\n float A = 0.0;\\n float B = 0.0;\\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\\n vec3 L = reflect(-V, H);\\n float NoL = clamp(L.z, 0.0, 1.0);\\n float NoH = clamp(H.z, 0.0, 1.0);\\n float VoH = clamp(dot(V, H), 0.0, 1.0);\\n if (NoL > 0.0) {\\n float G = G_Smith(roughness, NoV, NoL);\\n float G_Vis = G * VoH / (NoH * NoV);\\n float Fc = pow(1.0 - VoH, 5.0);\\n A += (1.0 - Fc) * G_Vis;\\n B += Fc * G_Vis;\\n }\\n }\\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\\n}\\n\";\n","export default \"#define SHADER_NAME prefilter\\n#define SAMPLE_NUMBER 1024\\n#define PI 3.14159265358979\\nuniform mat4 viewInverse : VIEWINVERSE;\\nuniform samplerCube environmentMap;\\nuniform sampler2D normalDistribution;\\nuniform float roughness : 0.5;\\nvarying vec2 v_Texcoord;\\nvarying vec3 v_WorldPosition;\\n@import clay.util.rgbm\\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\\n vec3 tangentX = normalize(cross(N, upVector));\\n vec3 tangentZ = cross(N, tangentX);\\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\\n}\\nvoid main() {\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(v_WorldPosition - eyePos);\\n vec3 N = V;\\n vec3 prefilteredColor = vec3(0.0);\\n float totalWeight = 0.0;\\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\\n vec3 L = reflect(-V, H);\\n float NoL = clamp(dot(N, L), 0.0, 1.0);\\n if (NoL > 0.0) {\\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\\n totalWeight += NoL;\\n }\\n }\\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\\n}\\n\";\n","// Cubemap prefilter utility\n// http://www.unrealengine.com/files/downloads/2013SiggraphPresentationsNotes.pdf\n// http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html\nimport Texture2D from '../Texture2D';\nimport TextureCube from '../TextureCube';\nimport Texture from '../Texture';\nimport FrameBuffer from '../FrameBuffer';\nimport Pass from '../compositor/Pass';\nimport Material from '../Material';\nimport Shader from '../Shader';\nimport Skybox from '../plugin/Skybox';\nimport Scene from '../Scene';\nimport EnvironmentMapPass from '../prePass/EnvironmentMap';\nimport vendor from '../core/vendor';\nimport textureUtil from './texture';\n\nimport integrateBRDFShaderCode from './shader/integrateBRDF.glsl.js';\nimport prefilterFragCode from './shader/prefilter.glsl.js';\n\nvar cubemapUtil = {};\n\nvar targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\n// TODO Downsample\n/**\n * @name clay.util.cubemap.prefilterEnvironmentMap\n * @param {clay.Renderer} renderer\n * @param {clay.Texture} envMap\n * @param {Object} [textureOpts]\n * @param {number} [textureOpts.width=64]\n * @param {number} [textureOpts.height=64]\n * @param {number} [textureOpts.type]\n * @param {boolean} [textureOpts.encodeRGBM=false]\n * @param {boolean} [textureOpts.decodeRGBM=false]\n * @param {clay.Texture2D} [normalDistribution]\n * @param {clay.Texture2D} [brdfLookup]\n */\ncubemapUtil.prefilterEnvironmentMap = function (\n renderer, envMap, textureOpts, normalDistribution, brdfLookup\n) {\n // Not create other renderer, it is easy having issue of cross reference of resources like framebuffer\n // PENDING preserveDrawingBuffer?\n if (!brdfLookup || !normalDistribution) {\n normalDistribution = cubemapUtil.generateNormalDistribution();\n brdfLookup = cubemapUtil.integrateBRDF(renderer, normalDistribution);\n }\n textureOpts = textureOpts || {};\n\n var width = textureOpts.width || 64;\n var height = textureOpts.height || 64;\n\n var textureType = textureOpts.type || envMap.type;\n\n // Use same type with given envMap\n var prefilteredCubeMap = new TextureCube({\n width: width,\n height: height,\n type: textureType,\n flipY: false,\n mipmaps: []\n });\n\n if (!prefilteredCubeMap.isPowerOfTwo()) {\n console.warn('Width and height must be power of two to enable mipmap.');\n }\n\n var size = Math.min(width, height);\n var mipmapNum = Math.log(size) / Math.log(2) + 1;\n\n var prefilterMaterial = new Material({\n shader: new Shader({\n vertex: Shader.source('clay.skybox.vertex'),\n fragment: prefilterFragCode\n })\n });\n prefilterMaterial.set('normalDistribution', normalDistribution);\n\n textureOpts.encodeRGBM && prefilterMaterial.define('fragment', 'RGBM_ENCODE');\n textureOpts.decodeRGBM && prefilterMaterial.define('fragment', 'RGBM_DECODE');\n\n var dummyScene = new Scene();\n var skyEnv;\n\n if (envMap.textureType === 'texture2D') {\n // Convert panorama to cubemap\n var envCubemap = new TextureCube({\n width: width,\n height: height,\n // FIXME FLOAT type will cause GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error on iOS\n type: textureType === Texture.FLOAT ?\n Texture.HALF_FLOAT : textureType\n });\n textureUtil.panoramaToCubeMap(renderer, envMap, envCubemap, {\n // PENDING encodeRGBM so it can be decoded as RGBM\n encodeRGBM: textureOpts.decodeRGBM\n });\n envMap = envCubemap;\n }\n skyEnv = new Skybox({\n scene: dummyScene,\n material: prefilterMaterial\n });\n skyEnv.material.set('environmentMap', envMap);\n\n var envMapPass = new EnvironmentMapPass({\n texture: prefilteredCubeMap\n });\n\n // Force to be UNSIGNED_BYTE\n if (textureOpts.encodeRGBM) {\n textureType = prefilteredCubeMap.type = Texture.UNSIGNED_BYTE;\n }\n\n var renderTargetTmp = new Texture2D({\n width: width,\n height: height,\n type: textureType\n });\n var frameBuffer = new FrameBuffer({\n depthBuffer: false\n });\n var ArrayCtor = vendor[textureType === Texture.UNSIGNED_BYTE ? 'Uint8Array' : 'Float32Array'];\n for (var i = 0; i < mipmapNum; i++) {\n // console.time('prefilter');\n prefilteredCubeMap.mipmaps[i] = {\n pixels: {}\n };\n skyEnv.material.set('roughness', i / (mipmapNum - 1));\n\n // Tweak fov\n // http://the-witness.net/news/2012/02/seamless-cube-map-filtering/\n var n = renderTargetTmp.width;\n var fov = 2 * Math.atan(n / (n - 0.5)) / Math.PI * 180;\n\n for (var j = 0; j < targets.length; j++) {\n var pixels = new ArrayCtor(renderTargetTmp.width * renderTargetTmp.height * 4);\n frameBuffer.attach(renderTargetTmp);\n frameBuffer.bind(renderer);\n\n var camera = envMapPass.getCamera(targets[j]);\n camera.fov = fov;\n renderer.render(dummyScene, camera);\n renderer.gl.readPixels(\n 0, 0, renderTargetTmp.width, renderTargetTmp.height,\n Texture.RGBA, textureType, pixels\n );\n\n // var canvas = document.createElement('canvas');\n // var ctx = canvas.getContext('2d');\n // canvas.width = renderTargetTmp.width;\n // canvas.height = renderTargetTmp.height;\n // var imageData = ctx.createImageData(renderTargetTmp.width, renderTargetTmp.height);\n // for (var k = 0; k < pixels.length; k++) {\n // imageData.data[k] = pixels[k];\n // }\n // ctx.putImageData(imageData, 0, 0);\n // document.body.appendChild(canvas);\n\n frameBuffer.unbind(renderer);\n prefilteredCubeMap.mipmaps[i].pixels[targets[j]] = pixels;\n }\n\n renderTargetTmp.width /= 2;\n renderTargetTmp.height /= 2;\n renderTargetTmp.dirty();\n // console.timeEnd('prefilter');\n }\n\n frameBuffer.dispose(renderer);\n renderTargetTmp.dispose(renderer);\n skyEnv.dispose(renderer);\n // Remove gpu resource allucated in renderer\n normalDistribution.dispose(renderer);\n\n // renderer.dispose();\n\n return {\n environmentMap: prefilteredCubeMap,\n brdfLookup: brdfLookup,\n normalDistribution: normalDistribution,\n maxMipmapLevel: mipmapNum\n };\n};\n\ncubemapUtil.integrateBRDF = function (renderer, normalDistribution) {\n normalDistribution = normalDistribution || cubemapUtil.generateNormalDistribution();\n var framebuffer = new FrameBuffer({\n depthBuffer: false\n });\n var pass = new Pass({\n fragment: integrateBRDFShaderCode\n });\n\n var texture = new Texture2D({\n width: 512,\n height: 256,\n type: Texture.HALF_FLOAT,\n wrapS: Texture.CLAMP_TO_EDGE,\n wrapT: Texture.CLAMP_TO_EDGE,\n minFilter: Texture.NEAREST,\n magFilter: Texture.NEAREST,\n useMipmap: false\n });\n pass.setUniform('normalDistribution', normalDistribution);\n pass.setUniform('viewportSize', [512, 256]);\n pass.attachOutput(texture);\n pass.render(renderer, framebuffer);\n\n // FIXME Only chrome and firefox can readPixels with float type.\n // framebuffer.bind(renderer);\n // var pixels = new Float32Array(512 * 256 * 4);\n // renderer.gl.readPixels(\n // 0, 0, texture.width, texture.height,\n // Texture.RGBA, Texture.FLOAT, pixels\n // );\n // texture.pixels = pixels;\n // texture.flipY = false;\n // texture.dirty();\n // framebuffer.unbind(renderer);\n\n framebuffer.dispose(renderer);\n\n return texture;\n};\n\ncubemapUtil.generateNormalDistribution = function (roughnessLevels, sampleSize) {\n\n // http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html\n // GLSL not support bit operation, use lookup instead\n // V -> i / N, U -> roughness\n var roughnessLevels = roughnessLevels || 256;\n var sampleSize = sampleSize || 1024;\n\n var normalDistribution = new Texture2D({\n width: roughnessLevels,\n height: sampleSize,\n type: Texture.FLOAT,\n minFilter: Texture.NEAREST,\n magFilter: Texture.NEAREST,\n wrapS: Texture.CLAMP_TO_EDGE,\n wrapT: Texture.CLAMP_TO_EDGE,\n useMipmap: false\n });\n var pixels = new Float32Array(sampleSize * roughnessLevels * 4);\n var tmp = [];\n\n // function sortFunc(a, b) {\n // return Math.abs(b) - Math.abs(a);\n // }\n for (var j = 0; j < roughnessLevels; j++) {\n var roughness = j / roughnessLevels;\n var a = roughness * roughness;\n\n for (var i = 0; i < sampleSize; i++) {\n // http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators\n // http://stackoverflow.com/questions/1908492/unsigned-integer-in-javascript\n // http://stackoverflow.com/questions/1822350/what-is-the-javascript-operator-and-how-do-you-use-it\n var y = (i << 16 | i >>> 16) >>> 0;\n y = ((y & 1431655765) << 1 | (y & 2863311530) >>> 1) >>> 0;\n y = ((y & 858993459) << 2 | (y & 3435973836) >>> 2) >>> 0;\n y = ((y & 252645135) << 4 | (y & 4042322160) >>> 4) >>> 0;\n y = (((y & 16711935) << 8 | (y & 4278255360) >>> 8) >>> 0) / 4294967296;\n\n // CDF\n var cosTheta = Math.sqrt((1 - y) / (1 + (a * a - 1.0) * y));\n tmp[i] = cosTheta;\n }\n\n for (var i = 0; i < sampleSize; i++) {\n var offset = (i * roughnessLevels + j) * 4;\n var cosTheta = tmp[i];\n var sinTheta = Math.sqrt(1.0 - cosTheta * cosTheta);\n var x = i / sampleSize;\n var phi = 2.0 * Math.PI * x;\n pixels[offset] = sinTheta * Math.cos(phi);\n pixels[offset + 1] = cosTheta;\n pixels[offset + 2] = sinTheta * Math.sin(phi);\n pixels[offset + 3] = 1.0;\n }\n }\n normalDistribution.pixels = pixels;\n\n return normalDistribution;\n};\n\nexport default cubemapUtil;\n","// https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/AmbientCubemap/\nimport Light from '../Light';\nimport cubemapUtil from '../util/cubemap';\n\n/**\n * Ambient cubemap light provides specular parts of Image Based Lighting.\n * Which is a basic requirement for Physically Based Rendering\n * @constructor clay.light.AmbientCubemap\n * @extends clay.Light\n */\nvar AmbientCubemapLight = Light.extend({\n\n /**\n * @type {clay.TextureCube}\n * @memberOf clay.light.AmbientCubemap#\n */\n cubemap: null,\n\n // TODO\n // range: 100,\n\n castShadow: false,\n\n _normalDistribution: null,\n _brdfLookup: null\n\n}, /** @lends clay.light.AmbientCubemap# */ {\n\n type: 'AMBIENT_CUBEMAP_LIGHT',\n\n /**\n * Do prefitering the cubemap\n * @param {clay.Renderer} renderer\n * @param {number} [size=32]\n */\n prefilter: function (renderer, size) {\n if (!renderer.getGLExtension('EXT_shader_texture_lod')) {\n console.warn('Device not support textureCubeLodEXT');\n return;\n }\n if (!this._brdfLookup) {\n this._normalDistribution = cubemapUtil.generateNormalDistribution();\n this._brdfLookup = cubemapUtil.integrateBRDF(renderer, this._normalDistribution);\n }\n var cubemap = this.cubemap;\n if (cubemap.__prefiltered) {\n return;\n }\n\n var result = cubemapUtil.prefilterEnvironmentMap(\n renderer, cubemap, {\n encodeRGBM: true,\n width: size,\n height: size\n }, this._normalDistribution, this._brdfLookup\n );\n this.cubemap = result.environmentMap;\n this.cubemap.__prefiltered = true;\n\n cubemap.dispose(renderer);\n },\n\n getBRDFLookup: function () {\n return this._brdfLookup;\n },\n\n uniformTemplates: {\n ambientCubemapLightColor: {\n type: '3f',\n value: function (instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0]*intensity, color[1]*intensity, color[2]*intensity];\n }\n },\n\n ambientCubemapLightCubemap: {\n type: 't',\n value: function (instance) {\n return instance.cubemap;\n }\n },\n\n ambientCubemapLightBRDFLookup: {\n type: 't',\n value: function (instance) {\n return instance._brdfLookup;\n }\n }\n }\n /**\n * @function\n * @name clone\n * @return {clay.light.AmbientCubemap}\n * @memberOf clay.light.AmbientCubemap.prototype\n */\n});\n\nexport default AmbientCubemapLight;\n","import Light from '../Light';\nimport vendor from '../core/vendor';\n\n/**\n * Spherical Harmonic Ambient Light\n * @constructor clay.light.AmbientSH\n * @extends clay.Light\n */\nvar AmbientSHLight = Light.extend({\n\n castShadow: false,\n\n /**\n * Spherical Harmonic Coefficients\n * @type {Array.}\n * @memberOf clay.light.AmbientSH#\n */\n coefficients: [],\n\n}, function () {\n this._coefficientsTmpArr = new vendor.Float32Array(9 * 3);\n}, {\n\n type: 'AMBIENT_SH_LIGHT',\n\n uniformTemplates: {\n ambientSHLightColor: {\n type: '3f',\n value: function (instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0] * intensity, color[1] * intensity, color[2] * intensity];\n }\n },\n\n ambientSHLightCoefficients: {\n type: '3f',\n value: function (instance) {\n var coefficientsTmpArr = instance._coefficientsTmpArr;\n for (var i = 0; i < instance.coefficients.length; i++) {\n coefficientsTmpArr[i] = instance.coefficients[i];\n }\n return coefficientsTmpArr;\n }\n }\n }\n /**\n * @function\n * @name clone\n * @return {clay.light.Ambient}\n * @memberOf clay.light.Ambient.prototype\n */\n});\n\nexport default AmbientSHLight;\n","export default \"uniform samplerCube environmentMap;\\nvarying vec2 v_Texcoord;\\n#define TEXTURE_SIZE 16\\nmat3 front = mat3(\\n 1.0, 0.0, 0.0,\\n 0.0, 1.0, 0.0,\\n 0.0, 0.0, 1.0\\n);\\nmat3 back = mat3(\\n -1.0, 0.0, 0.0,\\n 0.0, 1.0, 0.0,\\n 0.0, 0.0, -1.0\\n);\\nmat3 left = mat3(\\n 0.0, 0.0, -1.0,\\n 0.0, 1.0, 0.0,\\n 1.0, 0.0, 0.0\\n);\\nmat3 right = mat3(\\n 0.0, 0.0, 1.0,\\n 0.0, 1.0, 0.0,\\n -1.0, 0.0, 0.0\\n);\\nmat3 up = mat3(\\n 1.0, 0.0, 0.0,\\n 0.0, 0.0, 1.0,\\n 0.0, -1.0, 0.0\\n);\\nmat3 down = mat3(\\n 1.0, 0.0, 0.0,\\n 0.0, 0.0, -1.0,\\n 0.0, 1.0, 0.0\\n);\\nfloat harmonics(vec3 normal){\\n int index = int(gl_FragCoord.x);\\n float x = normal.x;\\n float y = normal.y;\\n float z = normal.z;\\n if(index==0){\\n return 1.0;\\n }\\n else if(index==1){\\n return x;\\n }\\n else if(index==2){\\n return y;\\n }\\n else if(index==3){\\n return z;\\n }\\n else if(index==4){\\n return x*z;\\n }\\n else if(index==5){\\n return y*z;\\n }\\n else if(index==6){\\n return x*y;\\n }\\n else if(index==7){\\n return 3.0*z*z - 1.0;\\n }\\n else{\\n return x*x - y*y;\\n }\\n}\\nvec3 sampleSide(mat3 rot)\\n{\\n vec3 result = vec3(0.0);\\n float divider = 0.0;\\n for (int i = 0; i < TEXTURE_SIZE * TEXTURE_SIZE; i++) {\\n float x = mod(float(i), float(TEXTURE_SIZE));\\n float y = float(i / TEXTURE_SIZE);\\n vec2 sidecoord = ((vec2(x, y) + vec2(0.5, 0.5)) / vec2(TEXTURE_SIZE)) * 2.0 - 1.0;\\n vec3 normal = normalize(vec3(sidecoord, -1.0));\\n vec3 fetchNormal = rot * normal;\\n vec3 texel = textureCube(environmentMap, fetchNormal).rgb;\\n result += harmonics(fetchNormal) * texel * -normal.z;\\n divider += -normal.z;\\n }\\n return result / divider;\\n}\\nvoid main()\\n{\\n vec3 result = (\\n sampleSide(front) +\\n sampleSide(back) +\\n sampleSide(left) +\\n sampleSide(right) +\\n sampleSide(up) +\\n sampleSide(down)\\n ) / 6.0;\\n gl_FragColor = vec4(result, 1.0);\\n}\";\n","// Spherical Harmonic Helpers\nimport Texture from '../Texture';\nimport FrameBuffer from '../FrameBuffer';\nimport Texture2D from '../Texture2D';\nimport Pass from '../compositor/Pass';\nimport vendor from '../core/vendor';\nimport Skybox from '../plugin/Skybox';\nimport Skydome from '../plugin/Skydome';\nimport EnvironmentMapPass from '../prePass/EnvironmentMap';\nimport Scene from '../Scene';\nimport vec3 from '../glmatrix/vec3';\nvar sh = {};\n\nimport projectEnvMapShaderCode from './shader/projectEnvMap.glsl.js';\n\nvar targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\n// Project on gpu, but needs browser to support readPixels as Float32Array.\nfunction projectEnvironmentMapGPU(renderer, envMap) {\n var shTexture = new Texture2D({\n width: 9,\n height: 1,\n type: Texture.FLOAT\n });\n var pass = new Pass({\n fragment: projectEnvMapShaderCode\n });\n pass.material.define('fragment', 'TEXTURE_SIZE', envMap.width);\n pass.setUniform('environmentMap', envMap);\n\n var framebuffer = new FrameBuffer();\n framebuffer.attach(shTexture);\n pass.render(renderer, framebuffer);\n\n framebuffer.bind(renderer);\n // TODO Only chrome and firefox support Float32Array\n var pixels = new vendor.Float32Array(9 * 4);\n renderer.gl.readPixels(0, 0, 9, 1, Texture.RGBA, Texture.FLOAT, pixels);\n\n var coeff = new vendor.Float32Array(9 * 3);\n for (var i = 0; i < 9; i++) {\n coeff[i * 3] = pixels[i * 4];\n coeff[i * 3 + 1] = pixels[i * 4 + 1];\n coeff[i * 3 + 2] = pixels[i * 4 + 2];\n }\n framebuffer.unbind(renderer);\n\n framebuffer.dispose(renderer);\n pass.dispose(renderer);\n return coeff;\n}\n\nfunction harmonics(normal, index){\n var x = normal[0];\n var y = normal[1];\n var z = normal[2];\n\n if (index === 0) {\n return 1.0;\n }\n else if (index === 1) {\n return x;\n }\n else if (index === 2) {\n return y;\n }\n else if (index === 3) {\n return z;\n }\n else if (index === 4) {\n return x * z;\n }\n else if (index === 5) {\n return y * z;\n }\n else if (index === 6) {\n return x * y;\n }\n else if (index === 7) {\n return 3.0 * z * z - 1.0;\n }\n else {\n return x * x - y * y;\n }\n}\n\nvar normalTransform = {\n px: [2, 1, 0, -1, -1, 1],\n nx: [2, 1, 0, 1, -1, -1],\n py: [0, 2, 1, 1, -1, -1],\n ny: [0, 2, 1, 1, 1, 1],\n pz: [0, 1, 2, -1, -1, -1],\n nz: [0, 1, 2, 1, -1, 1]\n};\n\n// Project on cpu.\nfunction projectEnvironmentMapCPU(renderer, cubePixels, width, height) {\n var coeff = new vendor.Float32Array(9 * 3);\n var normal = vec3.create();\n var texel = vec3.create();\n var fetchNormal = vec3.create();\n for (var m = 0; m < 9; m++) {\n var result = vec3.create();\n for (var k = 0; k < targets.length; k++) {\n var pixels = cubePixels[targets[k]];\n\n var sideResult = vec3.create();\n var divider = 0;\n var i = 0;\n var transform = normalTransform[targets[k]];\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width; x++) {\n\n normal[0] = x / (width - 1.0) * 2.0 - 1.0;\n // TODO Flip y?\n normal[1] = y / (height - 1.0) * 2.0 - 1.0;\n normal[2] = -1.0;\n vec3.normalize(normal, normal);\n\n fetchNormal[0] = normal[transform[0]] * transform[3];\n fetchNormal[1] = normal[transform[1]] * transform[4];\n fetchNormal[2] = normal[transform[2]] * transform[5];\n\n texel[0] = pixels[i++] / 255;\n texel[1] = pixels[i++] / 255;\n texel[2] = pixels[i++] / 255;\n // RGBM Decode\n var scale = pixels[i++] / 255 * 8.12;\n texel[0] *= scale;\n texel[1] *= scale;\n texel[2] *= scale;\n\n vec3.scaleAndAdd(sideResult, sideResult, texel, harmonics(fetchNormal, m) * -normal[2]);\n // -normal.z equals cos(theta) of Lambertian\n divider += -normal[2];\n }\n }\n vec3.scaleAndAdd(result, result, sideResult, 1 / divider);\n }\n\n coeff[m * 3] = result[0] / 6.0;\n coeff[m * 3 + 1] = result[1] / 6.0;\n coeff[m * 3 + 2] = result[2] / 6.0;\n }\n return coeff;\n}\n\n/**\n * @param {clay.Renderer} renderer\n * @param {clay.Texture} envMap\n * @param {Object} [textureOpts]\n * @param {Object} [textureOpts.lod]\n * @param {boolean} [textureOpts.decodeRGBM]\n */\nsh.projectEnvironmentMap = function (renderer, envMap, opts) {\n\n // TODO sRGB\n\n opts = opts || {};\n opts.lod = opts.lod || 0;\n\n var skybox;\n var dummyScene = new Scene();\n var size = 64;\n if (envMap.textureType === 'texture2D') {\n skybox = new Skydome({\n scene: dummyScene,\n environmentMap: envMap\n });\n }\n else {\n size = (envMap.image && envMap.image.px) ? envMap.image.px.width : envMap.width;\n skybox = new Skybox({\n scene: dummyScene,\n environmentMap: envMap\n });\n }\n // Convert to rgbm\n var width = Math.ceil(size / Math.pow(2, opts.lod));\n var height = Math.ceil(size / Math.pow(2, opts.lod));\n var rgbmTexture = new Texture2D({\n width: width,\n height: height\n });\n var framebuffer = new FrameBuffer();\n skybox.material.define('fragment', 'RGBM_ENCODE');\n if (opts.decodeRGBM) {\n skybox.material.define('fragment', 'RGBM_DECODE');\n }\n skybox.material.set('lod', opts.lod);\n var envMapPass = new EnvironmentMapPass({\n texture: rgbmTexture\n });\n var cubePixels = {};\n for (var i = 0; i < targets.length; i++) {\n cubePixels[targets[i]] = new Uint8Array(width * height * 4);\n var camera = envMapPass.getCamera(targets[i]);\n camera.fov = 90;\n framebuffer.attach(rgbmTexture);\n framebuffer.bind(renderer);\n renderer.render(dummyScene, camera);\n renderer.gl.readPixels(\n 0, 0, width, height,\n Texture.RGBA, Texture.UNSIGNED_BYTE, cubePixels[targets[i]]\n );\n framebuffer.unbind(renderer);\n }\n\n skybox.dispose(renderer);\n framebuffer.dispose(renderer);\n rgbmTexture.dispose(renderer);\n\n return projectEnvironmentMapCPU(renderer, cubePixels, width, height);\n};\n\nexport default sh;\n","import * as echarts from 'echarts/lib/echarts';\n\nvar retrieve = {\n\n firstNotNull: function () {\n for (var i = 0, len = arguments.length; i < len; i++) {\n if (arguments[i] != null) {\n return arguments[i];\n }\n }\n },\n\n /**\n * @param {module:echarts/data/List} data\n * @param {Object} payload Contains dataIndex (means rawIndex) / dataIndexInside / name\n * each of which can be Array or primary type.\n * @return {number|Array.} dataIndex If not found, return undefined/null.\n */\n queryDataIndex: function (data, payload) {\n if (payload.dataIndexInside != null) {\n return payload.dataIndexInside;\n }\n else if (payload.dataIndex != null) {\n return echarts.util.isArray(payload.dataIndex)\n ? echarts.util.map(payload.dataIndex, function (value) {\n return data.indexOfRawIndex(value);\n })\n : data.indexOfRawIndex(payload.dataIndex);\n }\n else if (payload.name != null) {\n return echarts.util.isArray(payload.name)\n ? echarts.util.map(payload.name, function (value) {\n return data.indexOfName(value);\n })\n : data.indexOfName(payload.name);\n }\n }\n};\n\nexport default retrieve;","import Geometry from '../Geometry';\nimport BoundingBox from '../math/BoundingBox';\n\n/**\n * @constructor clay.geometry.Sphere\n * @extends clay.Geometry\n * @param {Object} [opt]\n * @param {number} [widthSegments]\n * @param {number} [heightSegments]\n * @param {number} [phiStart]\n * @param {number} [phiLength]\n * @param {number} [thetaStart]\n * @param {number} [thetaLength]\n * @param {number} [radius]\n */\nvar Sphere = Geometry.extend(/** @lends clay.geometry.Sphere# */ {\n dynamic: false,\n /**\n * @type {number}\n */\n widthSegments: 40,\n /**\n * @type {number}\n */\n heightSegments: 20,\n\n /**\n * @type {number}\n */\n phiStart: 0,\n /**\n * @type {number}\n */\n phiLength: Math.PI * 2,\n\n /**\n * @type {number}\n */\n thetaStart: 0,\n /**\n * @type {number}\n */\n thetaLength: Math.PI,\n\n /**\n * @type {number}\n */\n radius: 1\n\n}, function() {\n this.build();\n},\n/** @lends clay.geometry.Sphere.prototype */\n{\n /**\n * Build sphere geometry\n */\n build: function() {\n var heightSegments = this.heightSegments;\n var widthSegments = this.widthSegments;\n\n var positionAttr = this.attributes.position;\n var texcoordAttr = this.attributes.texcoord0;\n var normalAttr = this.attributes.normal;\n\n var vertexCount = (widthSegments + 1) * (heightSegments + 1);\n positionAttr.init(vertexCount);\n texcoordAttr.init(vertexCount);\n normalAttr.init(vertexCount);\n\n var IndicesCtor = vertexCount > 0xffff ? Uint32Array : Uint16Array;\n var indices = this.indices = new IndicesCtor(widthSegments * heightSegments * 6);\n\n var x, y, z,\n u, v,\n i, j;\n\n var radius = this.radius;\n var phiStart = this.phiStart;\n var phiLength = this.phiLength;\n var thetaStart = this.thetaStart;\n var thetaLength = this.thetaLength;\n var radius = this.radius;\n\n var pos = [];\n var uv = [];\n var offset = 0;\n var divider = 1 / radius;\n for (j = 0; j <= heightSegments; j ++) {\n for (i = 0; i <= widthSegments; i ++) {\n u = i / widthSegments;\n v = j / heightSegments;\n\n // X axis is inverted so texture can be mapped from left to right\n x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n y = radius * Math.cos(thetaStart + v * thetaLength);\n z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n\n pos[0] = x; pos[1] = y; pos[2] = z;\n uv[0] = u; uv[1] = v;\n positionAttr.set(offset, pos);\n texcoordAttr.set(offset, uv);\n pos[0] *= divider;\n pos[1] *= divider;\n pos[2] *= divider;\n normalAttr.set(offset, pos);\n offset++;\n }\n }\n\n var i1, i2, i3, i4;\n\n var len = widthSegments + 1;\n\n var n = 0;\n for (j = 0; j < heightSegments; j ++) {\n for (i = 0; i < widthSegments; i ++) {\n i2 = j * len + i;\n i1 = (j * len + i + 1);\n i4 = (j + 1) * len + i + 1;\n i3 = (j + 1) * len + i;\n\n indices[n++] = i1;\n indices[n++] = i2;\n indices[n++] = i4;\n\n indices[n++] = i2;\n indices[n++] = i3;\n indices[n++] = i4;\n }\n }\n\n this.boundingBox = new BoundingBox();\n this.boundingBox.max.set(radius, radius, radius);\n this.boundingBox.min.set(-radius, -radius, -radius);\n }\n});\n\nexport default Sphere;\n","import Light from '../Light';\n\n/**\n * @constructor clay.light.Ambient\n * @extends clay.Light\n */\nvar AmbientLight = Light.extend({\n\n castShadow: false\n\n}, {\n\n type: 'AMBIENT_LIGHT',\n\n uniformTemplates: {\n ambientLightColor: {\n type: '3f',\n value: function(instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0]*intensity, color[1]*intensity, color[2]*intensity];\n }\n }\n }\n /**\n * @function\n * @name clone\n * @return {clay.light.Ambient}\n * @memberOf clay.light.Ambient.prototype\n */\n});\n\nexport default AmbientLight;\n","import Light from '../Light';\nimport Vector3 from '../math/Vector3';\n\n/**\n * @constructor clay.light.Directional\n * @extends clay.Light\n *\n * @example\n * var light = new clay.light.Directional({\n * intensity: 0.5,\n * color: [1.0, 0.0, 0.0]\n * });\n * light.position.set(10, 10, 10);\n * light.lookAt(clay.Vector3.ZERO);\n * scene.add(light);\n */\nvar DirectionalLight = Light.extend(/** @lends clay.light.Directional# */ {\n /**\n * @type {number}\n */\n shadowBias: 0.001,\n /**\n * @type {number}\n */\n shadowSlopeScale: 2.0,\n /**\n * Shadow cascade.\n * Use PSSM technique when it is larger than 1 and have a unique directional light in scene.\n * @type {number}\n */\n shadowCascade: 1,\n\n /**\n * Available when shadowCascade is larger than 1 and have a unique directional light in scene.\n * @type {number}\n */\n cascadeSplitLogFactor: 0.2\n}, {\n\n type: 'DIRECTIONAL_LIGHT',\n\n uniformTemplates: {\n directionalLightDirection: {\n type: '3f',\n value: function (instance) {\n instance.__dir = instance.__dir || new Vector3();\n // Direction is target to eye\n return instance.__dir.copy(instance.worldTransform.z).normalize().negate().array;\n }\n },\n directionalLightColor: {\n type: '3f',\n value: function (instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0] * intensity, color[1] * intensity, color[2] * intensity];\n }\n }\n },\n /**\n * @return {clay.light.Directional}\n * @memberOf clay.light.Directional.prototype\n */\n clone: function () {\n var light = Light.prototype.clone.call(this);\n light.shadowBias = this.shadowBias;\n light.shadowSlopeScale = this.shadowSlopeScale;\n return light;\n }\n});\n\nexport default DirectionalLight;\n","import Light from '../Light';\n\n/**\n * @constructor clay.light.Point\n * @extends clay.Light\n */\nvar PointLight = Light.extend(/** @lends clay.light.Point# */ {\n /**\n * @type {number}\n */\n range: 100,\n\n /**\n * @type {number}\n */\n castShadow: false\n}, {\n\n type: 'POINT_LIGHT',\n\n uniformTemplates: {\n pointLightPosition: {\n type: '3f',\n value: function(instance) {\n return instance.getWorldPosition().array;\n }\n },\n pointLightRange: {\n type: '1f',\n value: function(instance) {\n return instance.range;\n }\n },\n pointLightColor: {\n type: '3f',\n value: function(instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0] * intensity, color[1] * intensity, color[2] * intensity];\n }\n }\n },\n /**\n * @return {clay.light.Point}\n * @memberOf clay.light.Point.prototype\n */\n clone: function() {\n var light = Light.prototype.clone.call(this);\n light.range = this.range;\n return light;\n }\n});\n\nexport default PointLight;\n","import Light from '../Light';\nimport Vector3 from '../math/Vector3';\n\n/**\n * @constructor clay.light.Spot\n * @extends clay.Light\n */\nvar SpotLight = Light.extend(/**@lends clay.light.Spot */ {\n /**\n * @type {number}\n */\n range: 20,\n /**\n * @type {number}\n */\n umbraAngle: 30,\n /**\n * @type {number}\n */\n penumbraAngle: 45,\n /**\n * @type {number}\n */\n falloffFactor: 2.0,\n /**\n * @type {number}\n */\n shadowBias: 0.001,\n /**\n * @type {number}\n */\n shadowSlopeScale: 2.0\n}, {\n\n type: 'SPOT_LIGHT',\n\n uniformTemplates: {\n spotLightPosition: {\n type: '3f',\n value: function (instance) {\n return instance.getWorldPosition().array;\n }\n },\n spotLightRange: {\n type: '1f',\n value: function (instance) {\n return instance.range;\n }\n },\n spotLightUmbraAngleCosine: {\n type: '1f',\n value: function (instance) {\n return Math.cos(instance.umbraAngle * Math.PI / 180);\n }\n },\n spotLightPenumbraAngleCosine: {\n type: '1f',\n value: function (instance) {\n return Math.cos(instance.penumbraAngle * Math.PI / 180);\n }\n },\n spotLightFalloffFactor: {\n type: '1f',\n value: function (instance) {\n return instance.falloffFactor;\n }\n },\n spotLightDirection: {\n type: '3f',\n value: function (instance) {\n instance.__dir = instance.__dir || new Vector3();\n // Direction is target to eye\n return instance.__dir.copy(instance.worldTransform.z).negate().array;\n }\n },\n spotLightColor: {\n type: '3f',\n value: function (instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0] * intensity, color[1] * intensity, color[2] * intensity];\n }\n }\n },\n /**\n * @return {clay.light.Spot}\n * @memberOf clay.light.Spot.prototype\n */\n clone: function () {\n var light = Light.prototype.clone.call(this);\n light.range = this.range;\n light.umbraAngle = this.umbraAngle;\n light.penumbraAngle = this.penumbraAngle;\n light.falloffFactor = this.falloffFactor;\n light.shadowBias = this.shadowBias;\n light.shadowSlopeScale = this.shadowSlopeScale;\n return light;\n }\n});\n\nexport default SpotLight;\n","import vec4 from '../glmatrix/vec4';\n\n/**\n * @constructor\n * @alias clay.Vector4\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n */\nvar Vector4 = function(x, y, z, w) {\n\n x = x || 0;\n y = y || 0;\n z = z || 0;\n w = w || 0;\n\n /**\n * Storage of Vector4, read and write of x, y, z, w will change the values in array\n * All methods also operate on the array instead of x, y, z, w components\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Vector4#\n */\n this.array = vec4.fromValues(x, y, z, w);\n\n /**\n * Dirty flag is used by the Node to determine\n * if the matrix is updated to latest\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Vector4#\n */\n this._dirty = true;\n};\n\nVector4.prototype = {\n\n constructor: Vector4,\n\n /**\n * Add b to self\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n add: function(b) {\n vec4.add(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y and z components\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n * @return {clay.Vector4}\n */\n set: function(x, y, z, w) {\n this.array[0] = x;\n this.array[1] = y;\n this.array[2] = z;\n this.array[3] = w;\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y, z and w components from array\n * @param {Float32Array|number[]} arr\n * @return {clay.Vector4}\n */\n setArray: function(arr) {\n this.array[0] = arr[0];\n this.array[1] = arr[1];\n this.array[2] = arr[2];\n this.array[3] = arr[3];\n\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Vector4\n * @return {clay.Vector4}\n */\n clone: function() {\n return new Vector4(this.x, this.y, this.z, this.w);\n },\n\n /**\n * Copy from b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n copy: function(b) {\n vec4.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for distance\n * @param {clay.Vector4} b\n * @return {number}\n */\n dist: function(b) {\n return vec4.dist(this.array, b.array);\n },\n\n /**\n * Distance between self and b\n * @param {clay.Vector4} b\n * @return {number}\n */\n distance: function(b) {\n return vec4.distance(this.array, b.array);\n },\n\n /**\n * Alias for divide\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n div: function(b) {\n vec4.div(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Divide self by b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n divide: function(b) {\n vec4.divide(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Dot product of self and b\n * @param {clay.Vector4} b\n * @return {number}\n */\n dot: function(b) {\n return vec4.dot(this.array, b.array);\n },\n\n /**\n * Alias of length\n * @return {number}\n */\n len: function() {\n return vec4.len(this.array);\n },\n\n /**\n * Calculate the length\n * @return {number}\n */\n length: function() {\n return vec4.length(this.array);\n },\n /**\n * Linear interpolation between a and b\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @param {number} t\n * @return {clay.Vector4}\n */\n lerp: function(a, b, t) {\n vec4.lerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Minimum of self and b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n min: function(b) {\n vec4.min(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Maximum of self and b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n max: function(b) {\n vec4.max(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiply\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n mul: function(b) {\n vec4.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply self and b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n multiply: function(b) {\n vec4.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Negate self\n * @return {clay.Vector4}\n */\n negate: function() {\n vec4.negate(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Normalize self\n * @return {clay.Vector4}\n */\n normalize: function() {\n vec4.normalize(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Generate random x, y, z, w components with a given scale\n * @param {number} scale\n * @return {clay.Vector4}\n */\n random: function(scale) {\n vec4.random(this.array, scale);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self\n * @param {number} scale\n * @return {clay.Vector4}\n */\n scale: function(s) {\n vec4.scale(this.array, this.array, s);\n this._dirty = true;\n return this;\n },\n /**\n * Scale b and add to self\n * @param {clay.Vector4} b\n * @param {number} scale\n * @return {clay.Vector4}\n */\n scaleAndAdd: function(b, s) {\n vec4.scaleAndAdd(this.array, this.array, b.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for squaredDistance\n * @param {clay.Vector4} b\n * @return {number}\n */\n sqrDist: function(b) {\n return vec4.sqrDist(this.array, b.array);\n },\n\n /**\n * Squared distance between self and b\n * @param {clay.Vector4} b\n * @return {number}\n */\n squaredDistance: function(b) {\n return vec4.squaredDistance(this.array, b.array);\n },\n\n /**\n * Alias for squaredLength\n * @return {number}\n */\n sqrLen: function() {\n return vec4.sqrLen(this.array);\n },\n\n /**\n * Squared length of self\n * @return {number}\n */\n squaredLength: function() {\n return vec4.squaredLength(this.array);\n },\n\n /**\n * Alias for subtract\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n sub: function(b) {\n vec4.sub(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Subtract b from self\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n subtract: function(b) {\n vec4.subtract(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix4 m\n * @param {clay.Matrix4} m\n * @return {clay.Vector4}\n */\n transformMat4: function(m) {\n vec4.transformMat4(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Quaternion q\n * @param {clay.Quaternion} q\n * @return {clay.Vector4}\n */\n transformQuat: function(q) {\n vec4.transformQuat(this.array, this.array, q.array);\n this._dirty = true;\n return this;\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\nvar defineProperty = Object.defineProperty;\n// Getter and Setter\nif (defineProperty) {\n\n var proto = Vector4.prototype;\n /**\n * @name x\n * @type {number}\n * @memberOf clay.Vector4\n * @instance\n */\n defineProperty(proto, 'x', {\n get: function () {\n return this.array[0];\n },\n set: function (value) {\n this.array[0] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name y\n * @type {number}\n * @memberOf clay.Vector4\n * @instance\n */\n defineProperty(proto, 'y', {\n get: function () {\n return this.array[1];\n },\n set: function (value) {\n this.array[1] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name z\n * @type {number}\n * @memberOf clay.Vector4\n * @instance\n */\n defineProperty(proto, 'z', {\n get: function () {\n return this.array[2];\n },\n set: function (value) {\n this.array[2] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name w\n * @type {number}\n * @memberOf clay.Vector4\n * @instance\n */\n defineProperty(proto, 'w', {\n get: function () {\n return this.array[3];\n },\n set: function (value) {\n this.array[3] = value;\n this._dirty = true;\n }\n });\n}\n\n// Supply methods that are not in place\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.add = function(out, a, b) {\n vec4.add(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @return {clay.Vector4}\n */\nVector4.set = function(out, x, y, z, w) {\n vec4.set(out.array, x, y, z, w);\n out._dirty = true;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.copy = function(out, b) {\n vec4.copy(out.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.dist = function(a, b) {\n return vec4.distance(a.array, b.array);\n};\n\n/**\n * @function\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.distance = Vector4.dist;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.div = function(out, a, b) {\n vec4.divide(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.divide = Vector4.div;\n\n/**\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.dot = function(a, b) {\n return vec4.dot(a.array, b.array);\n};\n\n/**\n * @param {clay.Vector4} a\n * @return {number}\n */\nVector4.len = function(b) {\n return vec4.length(b.array);\n};\n\n// Vector4.length = Vector4.len;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @param {number} t\n * @return {clay.Vector4}\n */\nVector4.lerp = function(out, a, b, t) {\n vec4.lerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.min = function(out, a, b) {\n vec4.min(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.max = function(out, a, b) {\n vec4.max(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.mul = function(out, a, b) {\n vec4.multiply(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.multiply = Vector4.mul;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @return {clay.Vector4}\n */\nVector4.negate = function(out, a) {\n vec4.negate(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @return {clay.Vector4}\n */\nVector4.normalize = function(out, a) {\n vec4.normalize(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {number} scale\n * @return {clay.Vector4}\n */\nVector4.random = function(out, scale) {\n vec4.random(out.array, scale);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {number} scale\n * @return {clay.Vector4}\n */\nVector4.scale = function(out, a, scale) {\n vec4.scale(out.array, a.array, scale);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @param {number} scale\n * @return {clay.Vector4}\n */\nVector4.scaleAndAdd = function(out, a, b, scale) {\n vec4.scaleAndAdd(out.array, a.array, b.array, scale);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.sqrDist = function(a, b) {\n return vec4.sqrDist(a.array, b.array);\n};\n\n/**\n * @function\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.squaredDistance = Vector4.sqrDist;\n\n/**\n * @param {clay.Vector4} a\n * @return {number}\n */\nVector4.sqrLen = function(a) {\n return vec4.sqrLen(a.array);\n};\n/**\n * @function\n * @param {clay.Vector4} a\n * @return {number}\n */\nVector4.squaredLength = Vector4.sqrLen;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.sub = function(out, a, b) {\n vec4.subtract(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.subtract = Vector4.sub;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Matrix4} m\n * @return {clay.Vector4}\n */\nVector4.transformMat4 = function(out, a, m) {\n vec4.transformMat4(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Quaternion} q\n * @return {clay.Vector4}\n */\nVector4.transformQuat = function(out, a, q) {\n vec4.transformQuat(out.array, a.array, q.array);\n out._dirty = true;\n return out;\n};\n\nexport default Vector4;\n","\n\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 2x2 Matrix\n * @name mat2\n */\n\nvar mat2 = {};\n\n/**\n * Creates a new identity mat2\n *\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.create = function() {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Creates a new mat2 initialized with values from an existing matrix\n *\n * @param {mat2} a matrix to clone\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Copy the values from one mat2 to another\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set a mat2 to the identity matrix\n *\n * @param {mat2} out the receiving matrix\n * @returns {mat2} out\n */\nmat2.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n\n return out;\n};\n\n/**\n * Inverts a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n\n // Calculate the determinant\n det = a0 * a3 - a2 * a1;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.adjoint = function(out, a) {\n // Caching this value is nessecary if out == a\n var a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2\n *\n * @param {mat2} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2.determinant = function (a) {\n return a[0] * a[3] - a[2] * a[1];\n};\n\n/**\n * Multiplies two mat2's\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the first operand\n * @param {mat2} b the second operand\n * @returns {mat2} out\n */\nmat2.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n};\n\n/**\n * Alias for {@link mat2.multiply}\n * @function\n */\nmat2.mul = mat2.multiply;\n\n/**\n * Rotates a mat2 by the given angle\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\nmat2.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n};\n\n/**\n * Scales the mat2 by the dimensions in the given vec2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2} out\n **/\nmat2.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n};\n\n/**\n * Returns Frobenius norm of a mat2\n *\n * @param {mat2} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2)))\n};\n\n/**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @param {mat2} L the lower triangular matrix\n * @param {mat2} D the diagonal matrix\n * @param {mat2} U the upper triangular matrix\n * @param {mat2} a the input matrix to factorize\n */\n\nmat2.LDU = function (L, D, U, a) {\n L[2] = a[2]/a[0];\n U[0] = a[0];\n U[1] = a[1];\n U[3] = a[3] - L[2] * U[1];\n return [L, D, U];\n};\n\n\nexport default mat2;","import mat2 from '../glmatrix/mat2';\n\n/**\n * @constructor\n * @alias clay.Matrix2\n */\nvar Matrix2 = function() {\n\n /**\n * Storage of Matrix2\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Matrix2#\n */\n this.array = mat2.create();\n\n /**\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Matrix2#\n */\n this._dirty = true;\n};\n\nMatrix2.prototype = {\n\n constructor: Matrix2,\n\n /**\n * Set components from array\n * @param {Float32Array|number[]} arr\n */\n setArray: function (arr) {\n for (var i = 0; i < this.array.length; i++) {\n this.array[i] = arr[i];\n }\n this._dirty = true;\n return this;\n },\n /**\n * Clone a new Matrix2\n * @return {clay.Matrix2}\n */\n clone: function() {\n return (new Matrix2()).copy(this);\n },\n\n /**\n * Copy from b\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\n copy: function(b) {\n mat2.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate the adjugate of self, in-place\n * @return {clay.Matrix2}\n */\n adjoint: function() {\n mat2.adjoint(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate matrix determinant\n * @return {number}\n */\n determinant: function() {\n return mat2.determinant(this.array);\n },\n\n /**\n * Set to a identity matrix\n * @return {clay.Matrix2}\n */\n identity: function() {\n mat2.identity(this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Invert self\n * @return {clay.Matrix2}\n */\n invert: function() {\n mat2.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for mutiply\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\n mul: function(b) {\n mat2.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Matrix2} a\n * @return {clay.Matrix2}\n */\n mulLeft: function(a) {\n mat2.mul(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply self and b\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\n multiply: function(b) {\n mat2.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply a and self, a is on the left\n * @param {clay.Matrix2} a\n * @return {clay.Matrix2}\n */\n multiplyLeft: function(a) {\n mat2.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian\n * @param {number} rad\n * @return {clay.Matrix2}\n */\n rotate: function(rad) {\n mat2.rotate(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self by s\n * @param {clay.Vector2} s\n * @return {clay.Matrix2}\n */\n scale: function(v) {\n mat2.scale(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n /**\n * Transpose self, in-place.\n * @return {clay.Matrix2}\n */\n transpose: function() {\n mat2.transpose(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\n/**\n * @param {Matrix2} out\n * @param {Matrix2} a\n * @return {Matrix2}\n */\nMatrix2.adjoint = function(out, a) {\n mat2.adjoint(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @return {clay.Matrix2}\n */\nMatrix2.copy = function(out, a) {\n mat2.copy(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} a\n * @return {number}\n */\nMatrix2.determinant = function(a) {\n return mat2.determinant(a.array);\n};\n\n/**\n * @param {clay.Matrix2} out\n * @return {clay.Matrix2}\n */\nMatrix2.identity = function(out) {\n mat2.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @return {clay.Matrix2}\n */\nMatrix2.invert = function(out, a) {\n mat2.invert(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\nMatrix2.mul = function(out, a, b) {\n mat2.mul(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\nMatrix2.multiply = Matrix2.mul;\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @param {number} rad\n * @return {clay.Matrix2}\n */\nMatrix2.rotate = function(out, a, rad) {\n mat2.rotate(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix2}\n */\nMatrix2.scale = function(out, a, v) {\n mat2.scale(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {Matrix2} out\n * @param {Matrix2} a\n * @return {Matrix2}\n */\nMatrix2.transpose = function(out, a) {\n mat2.transpose(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\nexport default Matrix2;\n","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 2x3 Matrix\n * @name mat2d\n *\n * @description\n * A mat2d contains six elements defined as:\n *
\n * [a, c, tx,\n *  b, d, ty]\n * 
\n * This is a short form for the 3x3 matrix:\n *
\n * [a, c, tx,\n *  b, d, ty,\n *  0, 0, 1]\n * 
\n * The last row is ignored so the array is shorter and operations are faster.\n */\n\nvar mat2d = {};\n\n/**\n * Creates a new identity mat2d\n *\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.create = function() {\n var out = new GLMAT_ARRAY_TYPE(6);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Creates a new mat2d initialized with values from an existing matrix\n *\n * @param {mat2d} a matrix to clone\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(6);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Copy the values from one mat2d to another\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Set a mat2d to the identity matrix\n *\n * @param {mat2d} out the receiving matrix\n * @returns {mat2d} out\n */\nmat2d.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Inverts a mat2d\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.invert = function(out, a) {\n var aa = a[0], ab = a[1], ac = a[2], ad = a[3],\n atx = a[4], aty = a[5];\n\n var det = aa * ad - ab * ac;\n if(!det){\n return null;\n }\n det = 1.0 / det;\n\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2d\n *\n * @param {mat2d} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2d.determinant = function (a) {\n return a[0] * a[3] - a[1] * a[2];\n};\n\n/**\n * Multiplies two mat2d's\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the first operand\n * @param {mat2d} b the second operand\n * @returns {mat2d} out\n */\nmat2d.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n};\n\n/**\n * Alias for {@link mat2d.multiply}\n * @function\n */\nmat2d.mul = mat2d.multiply;\n\n\n/**\n * Rotates a mat2d by the given angle\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\nmat2d.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Scales the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2d} out\n **/\nmat2d.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Translates the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to translate the matrix by\n * @returns {mat2d} out\n **/\nmat2d.translate = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n};\n\n/**\n * Returns Frobenius norm of a mat2d\n *\n * @param {mat2d} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2d.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))\n};\n\n\nexport default mat2d;","import mat2d from '../glmatrix/mat2d';\n\n/**\n * @constructor\n * @alias clay.Matrix2d\n */\nvar Matrix2d = function() {\n /**\n * Storage of Matrix2d\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Matrix2d#\n */\n this.array = mat2d.create();\n\n /**\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Matrix2d#\n */\n this._dirty = true;\n};\n\nMatrix2d.prototype = {\n\n constructor: Matrix2d,\n\n /**\n * Set components from array\n * @param {Float32Array|number[]} arr\n */\n setArray: function (arr) {\n for (var i = 0; i < this.array.length; i++) {\n this.array[i] = arr[i];\n }\n this._dirty = true;\n return this;\n },\n /**\n * Clone a new Matrix2d\n * @return {clay.Matrix2d}\n */\n clone: function() {\n return (new Matrix2d()).copy(this);\n },\n\n /**\n * Copy from b\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\n copy: function(b) {\n mat2d.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate matrix determinant\n * @return {number}\n */\n determinant: function() {\n return mat2d.determinant(this.array);\n },\n\n /**\n * Set to a identity matrix\n * @return {clay.Matrix2d}\n */\n identity: function() {\n mat2d.identity(this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Invert self\n * @return {clay.Matrix2d}\n */\n invert: function() {\n mat2d.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for mutiply\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\n mul: function(b) {\n mat2d.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix2d}\n */\n mulLeft: function(b) {\n mat2d.mul(this.array, b.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply self and b\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\n multiply: function(b) {\n mat2d.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply a and self, a is on the left\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix2d}\n */\n multiplyLeft: function(b) {\n mat2d.multiply(this.array, b.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian\n * @param {number} rad\n * @return {clay.Matrix2d}\n */\n rotate: function(rad) {\n mat2d.rotate(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self by s\n * @param {clay.Vector2} s\n * @return {clay.Matrix2d}\n */\n scale: function(s) {\n mat2d.scale(this.array, this.array, s.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Translate self by v\n * @param {clay.Vector2} v\n * @return {clay.Matrix2d}\n */\n translate: function(v) {\n mat2d.translate(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix2d}\n */\nMatrix2d.copy = function(out, a) {\n mat2d.copy(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} a\n * @return {number}\n */\nMatrix2d.determinant = function(a) {\n return mat2d.determinant(a.array);\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @return {clay.Matrix2d}\n */\nMatrix2d.identity = function(out) {\n mat2d.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix2d}\n */\nMatrix2d.invert = function(out, a) {\n mat2d.invert(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\nMatrix2d.mul = function(out, a, b) {\n mat2d.mul(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\nMatrix2d.multiply = Matrix2d.mul;\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {number} rad\n * @return {clay.Matrix2d}\n */\nMatrix2d.rotate = function(out, a, rad) {\n mat2d.rotate(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix2d}\n */\nMatrix2d.scale = function(out, a, v) {\n mat2d.scale(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix2d}\n */\nMatrix2d.translate = function(out, a, v) {\n mat2d.translate(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\nexport default Matrix2d;\n","import mat3 from '../glmatrix/mat3';\n\n/**\n * @constructor\n * @alias clay.Matrix3\n */\nvar Matrix3 = function () {\n\n /**\n * Storage of Matrix3\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Matrix3#\n */\n this.array = mat3.create();\n\n /**\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Matrix3#\n */\n this._dirty = true;\n};\n\nMatrix3.prototype = {\n\n constructor: Matrix3,\n\n /**\n * Set components from array\n * @param {Float32Array|number[]} arr\n */\n setArray: function (arr) {\n for (var i = 0; i < this.array.length; i++) {\n this.array[i] = arr[i];\n }\n this._dirty = true;\n return this;\n },\n /**\n * Calculate the adjugate of self, in-place\n * @return {clay.Matrix3}\n */\n adjoint: function () {\n mat3.adjoint(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Matrix3\n * @return {clay.Matrix3}\n */\n clone: function () {\n return (new Matrix3()).copy(this);\n },\n\n /**\n * Copy from b\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\n copy: function (b) {\n mat3.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate matrix determinant\n * @return {number}\n */\n determinant: function () {\n return mat3.determinant(this.array);\n },\n\n /**\n * Copy the values from Matrix2d a\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix3}\n */\n fromMat2d: function (a) {\n mat3.fromMat2d(this.array, a.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Copies the upper-left 3x3 values of Matrix4\n * @param {clay.Matrix4} a\n * @return {clay.Matrix3}\n */\n fromMat4: function (a) {\n mat3.fromMat4(this.array, a.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculates a rotation matrix from the given quaternion\n * @param {clay.Quaternion} q\n * @return {clay.Matrix3}\n */\n fromQuat: function (q) {\n mat3.fromQuat(this.array, q.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set to a identity matrix\n * @return {clay.Matrix3}\n */\n identity: function () {\n mat3.identity(this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Invert self\n * @return {clay.Matrix3}\n */\n invert: function () {\n mat3.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for mutiply\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\n mul: function (b) {\n mat3.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\n mulLeft: function (a) {\n mat3.mul(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply self and b\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\n multiply: function (b) {\n mat3.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply a and self, a is on the left\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\n multiplyLeft: function (a) {\n mat3.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian\n * @param {number} rad\n * @return {clay.Matrix3}\n */\n rotate: function (rad) {\n mat3.rotate(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self by s\n * @param {clay.Vector2} s\n * @return {clay.Matrix3}\n */\n scale: function (v) {\n mat3.scale(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Translate self by v\n * @param {clay.Vector2} v\n * @return {clay.Matrix3}\n */\n translate: function (v) {\n mat3.translate(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n /**\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n * @param {clay.Matrix4} a\n */\n normalFromMat4: function (a) {\n mat3.normalFromMat4(this.array, a.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transpose self, in-place.\n * @return {clay.Matrix2}\n */\n transpose: function () {\n mat3.transpose(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n toString: function () {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\nMatrix3.adjoint = function (out, a) {\n mat3.adjoint(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\nMatrix3.copy = function (out, a) {\n mat3.copy(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} a\n * @return {number}\n */\nMatrix3.determinant = function (a) {\n return mat3.determinant(a.array);\n};\n\n/**\n * @param {clay.Matrix3} out\n * @return {clay.Matrix3}\n */\nMatrix3.identity = function (out) {\n mat3.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\nMatrix3.invert = function (out, a) {\n mat3.invert(out.array, a.array);\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\nMatrix3.mul = function (out, a, b) {\n mat3.mul(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\nMatrix3.multiply = Matrix3.mul;\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix3}\n */\nMatrix3.fromMat2d = function (out, a) {\n mat3.fromMat2d(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix3}\n */\nMatrix3.fromMat4 = function (out, a) {\n mat3.fromMat4(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Quaternion} a\n * @return {clay.Matrix3}\n */\nMatrix3.fromQuat = function (out, q) {\n mat3.fromQuat(out.array, q.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix3}\n */\nMatrix3.normalFromMat4 = function (out, a) {\n mat3.normalFromMat4(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {number} rad\n * @return {clay.Matrix3}\n */\nMatrix3.rotate = function (out, a, rad) {\n mat3.rotate(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix3}\n */\nMatrix3.scale = function (out, a, v) {\n mat3.scale(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\nMatrix3.transpose = function (out, a) {\n mat3.transpose(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix3}\n */\nMatrix3.translate = function (out, a, v) {\n mat3.translate(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\nexport default Matrix3;\n","var easing = {\n linear: function (k) {\n return k;\n },\n quadraticIn: function (k) {\n return k * k;\n },\n quadraticOut: function (k) {\n return k * (2 - k);\n },\n quadraticInOut: function (k) {\n if ((k *= 2) < 1) {\n return 0.5 * k * k;\n }\n return -0.5 * (--k * (k - 2) - 1);\n },\n cubicIn: function (k) {\n return k * k * k;\n },\n cubicOut: function (k) {\n return --k * k * k + 1;\n },\n cubicInOut: function (k) {\n if ((k *= 2) < 1) {\n return 0.5 * k * k * k;\n }\n return 0.5 * ((k -= 2) * k * k + 2);\n },\n quarticIn: function (k) {\n return k * k * k * k;\n },\n quarticOut: function (k) {\n return 1 - (--k * k * k * k);\n },\n quarticInOut: function (k) {\n if ((k *= 2) < 1) {\n return 0.5 * k * k * k * k;\n }\n return -0.5 * ((k -= 2) * k * k * k - 2);\n },\n quinticIn: function (k) {\n return k * k * k * k * k;\n },\n quinticOut: function (k) {\n return --k * k * k * k * k + 1;\n },\n quinticInOut: function (k) {\n if ((k *= 2) < 1) {\n return 0.5 * k * k * k * k * k;\n }\n return 0.5 * ((k -= 2) * k * k * k * k + 2);\n },\n sinusoidalIn: function (k) {\n return 1 - Math.cos(k * Math.PI / 2);\n },\n sinusoidalOut: function (k) {\n return Math.sin(k * Math.PI / 2);\n },\n sinusoidalInOut: function (k) {\n return 0.5 * (1 - Math.cos(Math.PI * k));\n },\n exponentialIn: function (k) {\n return k === 0 ? 0 : Math.pow(1024, k - 1);\n },\n exponentialOut: function (k) {\n return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);\n },\n exponentialInOut: function (k) {\n if (k === 0) {\n return 0;\n }\n if (k === 1) {\n return 1;\n }\n if ((k *= 2) < 1) {\n return 0.5 * Math.pow(1024, k - 1);\n }\n return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);\n },\n circularIn: function (k) {\n return 1 - Math.sqrt(1 - k * k);\n },\n circularOut: function (k) {\n return Math.sqrt(1 - (--k * k));\n },\n circularInOut: function (k) {\n if ((k *= 2) < 1) {\n return -0.5 * (Math.sqrt(1 - k * k) - 1);\n }\n return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);\n },\n elasticIn: function (k) {\n var s;\n var a = 0.1;\n var p = 0.4;\n if (k === 0) {\n return 0;\n }\n if (k === 1) {\n return 1;\n }\n if (!a || a < 1) {\n a = 1;\n s = p / 4;\n }\n else {\n s = p * Math.asin(1 / a) / (2 * Math.PI);\n }\n return -(a * Math.pow(2, 10 * (k -= 1))\n * Math.sin((k - s) * (2 * Math.PI) / p));\n },\n elasticOut: function (k) {\n var s;\n var a = 0.1;\n var p = 0.4;\n if (k === 0) {\n return 0;\n }\n if (k === 1) {\n return 1;\n }\n if (!a || a < 1) {\n a = 1;\n s = p / 4;\n }\n else {\n s = p * Math.asin(1 / a) / (2 * Math.PI);\n }\n return (a * Math.pow(2, -10 * k)\n * Math.sin((k - s) * (2 * Math.PI) / p) + 1);\n },\n elasticInOut: function (k) {\n var s;\n var a = 0.1;\n var p = 0.4;\n if (k === 0) {\n return 0;\n }\n if (k === 1) {\n return 1;\n }\n if (!a || a < 1) {\n a = 1;\n s = p / 4;\n }\n else {\n s = p * Math.asin(1 / a) / (2 * Math.PI);\n }\n if ((k *= 2) < 1) {\n return -0.5 * (a * Math.pow(2, 10 * (k -= 1))\n * Math.sin((k - s) * (2 * Math.PI) / p));\n }\n return a * Math.pow(2, -10 * (k -= 1))\n * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;\n },\n backIn: function (k) {\n var s = 1.70158;\n return k * k * ((s + 1) * k - s);\n },\n backOut: function (k) {\n var s = 1.70158;\n return --k * k * ((s + 1) * k + s) + 1;\n },\n backInOut: function (k) {\n var s = 1.70158 * 1.525;\n if ((k *= 2) < 1) {\n return 0.5 * (k * k * ((s + 1) * k - s));\n }\n return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);\n },\n bounceIn: function (k) {\n return 1 - easing.bounceOut(1 - k);\n },\n bounceOut: function (k) {\n if (k < (1 / 2.75)) {\n return 7.5625 * k * k;\n }\n else if (k < (2 / 2.75)) {\n return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;\n }\n else if (k < (2.5 / 2.75)) {\n return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;\n }\n else {\n return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;\n }\n },\n bounceInOut: function (k) {\n if (k < 0.5) {\n return easing.bounceIn(k * 2) * 0.5;\n }\n return easing.bounceOut(k * 2 - 1) * 0.5 + 0.5;\n }\n};\nexport default easing;\n","import easingFuncs from './easing';\nvar Clip = (function () {\n function Clip(opts) {\n this._initialized = false;\n this._startTime = 0;\n this._pausedTime = 0;\n this._paused = false;\n this._life = opts.life || 1000;\n this._delay = opts.delay || 0;\n this.loop = opts.loop == null ? false : opts.loop;\n this.gap = opts.gap || 0;\n this.easing = opts.easing || 'linear';\n this.onframe = opts.onframe;\n this.ondestroy = opts.ondestroy;\n this.onrestart = opts.onrestart;\n }\n Clip.prototype.step = function (globalTime, deltaTime) {\n if (!this._initialized) {\n this._startTime = globalTime + this._delay;\n this._initialized = true;\n }\n if (this._paused) {\n this._pausedTime += deltaTime;\n return;\n }\n var percent = (globalTime - this._startTime - this._pausedTime) / this._life;\n if (percent < 0) {\n percent = 0;\n }\n percent = Math.min(percent, 1);\n var easing = this.easing;\n var easingFunc = typeof easing === 'string'\n ? easingFuncs[easing] : easing;\n var schedule = typeof easingFunc === 'function'\n ? easingFunc(percent)\n : percent;\n this.onframe && this.onframe(schedule);\n if (percent === 1) {\n if (this.loop) {\n this._restart(globalTime);\n this.onrestart && this.onrestart();\n }\n else {\n return true;\n }\n }\n return false;\n };\n Clip.prototype._restart = function (globalTime) {\n var remainder = (globalTime - this._startTime - this._pausedTime) % this._life;\n this._startTime = globalTime - remainder + this.gap;\n this._pausedTime = 0;\n };\n Clip.prototype.pause = function () {\n this._paused = true;\n };\n Clip.prototype.resume = function () {\n this._paused = false;\n };\n return Clip;\n}());\nexport default Clip;\n","import LRU from '../core/LRU';\nvar kCSSColorTable = {\n 'transparent': [0, 0, 0, 0], 'aliceblue': [240, 248, 255, 1],\n 'antiquewhite': [250, 235, 215, 1], 'aqua': [0, 255, 255, 1],\n 'aquamarine': [127, 255, 212, 1], 'azure': [240, 255, 255, 1],\n 'beige': [245, 245, 220, 1], 'bisque': [255, 228, 196, 1],\n 'black': [0, 0, 0, 1], 'blanchedalmond': [255, 235, 205, 1],\n 'blue': [0, 0, 255, 1], 'blueviolet': [138, 43, 226, 1],\n 'brown': [165, 42, 42, 1], 'burlywood': [222, 184, 135, 1],\n 'cadetblue': [95, 158, 160, 1], 'chartreuse': [127, 255, 0, 1],\n 'chocolate': [210, 105, 30, 1], 'coral': [255, 127, 80, 1],\n 'cornflowerblue': [100, 149, 237, 1], 'cornsilk': [255, 248, 220, 1],\n 'crimson': [220, 20, 60, 1], 'cyan': [0, 255, 255, 1],\n 'darkblue': [0, 0, 139, 1], 'darkcyan': [0, 139, 139, 1],\n 'darkgoldenrod': [184, 134, 11, 1], 'darkgray': [169, 169, 169, 1],\n 'darkgreen': [0, 100, 0, 1], 'darkgrey': [169, 169, 169, 1],\n 'darkkhaki': [189, 183, 107, 1], 'darkmagenta': [139, 0, 139, 1],\n 'darkolivegreen': [85, 107, 47, 1], 'darkorange': [255, 140, 0, 1],\n 'darkorchid': [153, 50, 204, 1], 'darkred': [139, 0, 0, 1],\n 'darksalmon': [233, 150, 122, 1], 'darkseagreen': [143, 188, 143, 1],\n 'darkslateblue': [72, 61, 139, 1], 'darkslategray': [47, 79, 79, 1],\n 'darkslategrey': [47, 79, 79, 1], 'darkturquoise': [0, 206, 209, 1],\n 'darkviolet': [148, 0, 211, 1], 'deeppink': [255, 20, 147, 1],\n 'deepskyblue': [0, 191, 255, 1], 'dimgray': [105, 105, 105, 1],\n 'dimgrey': [105, 105, 105, 1], 'dodgerblue': [30, 144, 255, 1],\n 'firebrick': [178, 34, 34, 1], 'floralwhite': [255, 250, 240, 1],\n 'forestgreen': [34, 139, 34, 1], 'fuchsia': [255, 0, 255, 1],\n 'gainsboro': [220, 220, 220, 1], 'ghostwhite': [248, 248, 255, 1],\n 'gold': [255, 215, 0, 1], 'goldenrod': [218, 165, 32, 1],\n 'gray': [128, 128, 128, 1], 'green': [0, 128, 0, 1],\n 'greenyellow': [173, 255, 47, 1], 'grey': [128, 128, 128, 1],\n 'honeydew': [240, 255, 240, 1], 'hotpink': [255, 105, 180, 1],\n 'indianred': [205, 92, 92, 1], 'indigo': [75, 0, 130, 1],\n 'ivory': [255, 255, 240, 1], 'khaki': [240, 230, 140, 1],\n 'lavender': [230, 230, 250, 1], 'lavenderblush': [255, 240, 245, 1],\n 'lawngreen': [124, 252, 0, 1], 'lemonchiffon': [255, 250, 205, 1],\n 'lightblue': [173, 216, 230, 1], 'lightcoral': [240, 128, 128, 1],\n 'lightcyan': [224, 255, 255, 1], 'lightgoldenrodyellow': [250, 250, 210, 1],\n 'lightgray': [211, 211, 211, 1], 'lightgreen': [144, 238, 144, 1],\n 'lightgrey': [211, 211, 211, 1], 'lightpink': [255, 182, 193, 1],\n 'lightsalmon': [255, 160, 122, 1], 'lightseagreen': [32, 178, 170, 1],\n 'lightskyblue': [135, 206, 250, 1], 'lightslategray': [119, 136, 153, 1],\n 'lightslategrey': [119, 136, 153, 1], 'lightsteelblue': [176, 196, 222, 1],\n 'lightyellow': [255, 255, 224, 1], 'lime': [0, 255, 0, 1],\n 'limegreen': [50, 205, 50, 1], 'linen': [250, 240, 230, 1],\n 'magenta': [255, 0, 255, 1], 'maroon': [128, 0, 0, 1],\n 'mediumaquamarine': [102, 205, 170, 1], 'mediumblue': [0, 0, 205, 1],\n 'mediumorchid': [186, 85, 211, 1], 'mediumpurple': [147, 112, 219, 1],\n 'mediumseagreen': [60, 179, 113, 1], 'mediumslateblue': [123, 104, 238, 1],\n 'mediumspringgreen': [0, 250, 154, 1], 'mediumturquoise': [72, 209, 204, 1],\n 'mediumvioletred': [199, 21, 133, 1], 'midnightblue': [25, 25, 112, 1],\n 'mintcream': [245, 255, 250, 1], 'mistyrose': [255, 228, 225, 1],\n 'moccasin': [255, 228, 181, 1], 'navajowhite': [255, 222, 173, 1],\n 'navy': [0, 0, 128, 1], 'oldlace': [253, 245, 230, 1],\n 'olive': [128, 128, 0, 1], 'olivedrab': [107, 142, 35, 1],\n 'orange': [255, 165, 0, 1], 'orangered': [255, 69, 0, 1],\n 'orchid': [218, 112, 214, 1], 'palegoldenrod': [238, 232, 170, 1],\n 'palegreen': [152, 251, 152, 1], 'paleturquoise': [175, 238, 238, 1],\n 'palevioletred': [219, 112, 147, 1], 'papayawhip': [255, 239, 213, 1],\n 'peachpuff': [255, 218, 185, 1], 'peru': [205, 133, 63, 1],\n 'pink': [255, 192, 203, 1], 'plum': [221, 160, 221, 1],\n 'powderblue': [176, 224, 230, 1], 'purple': [128, 0, 128, 1],\n 'red': [255, 0, 0, 1], 'rosybrown': [188, 143, 143, 1],\n 'royalblue': [65, 105, 225, 1], 'saddlebrown': [139, 69, 19, 1],\n 'salmon': [250, 128, 114, 1], 'sandybrown': [244, 164, 96, 1],\n 'seagreen': [46, 139, 87, 1], 'seashell': [255, 245, 238, 1],\n 'sienna': [160, 82, 45, 1], 'silver': [192, 192, 192, 1],\n 'skyblue': [135, 206, 235, 1], 'slateblue': [106, 90, 205, 1],\n 'slategray': [112, 128, 144, 1], 'slategrey': [112, 128, 144, 1],\n 'snow': [255, 250, 250, 1], 'springgreen': [0, 255, 127, 1],\n 'steelblue': [70, 130, 180, 1], 'tan': [210, 180, 140, 1],\n 'teal': [0, 128, 128, 1], 'thistle': [216, 191, 216, 1],\n 'tomato': [255, 99, 71, 1], 'turquoise': [64, 224, 208, 1],\n 'violet': [238, 130, 238, 1], 'wheat': [245, 222, 179, 1],\n 'white': [255, 255, 255, 1], 'whitesmoke': [245, 245, 245, 1],\n 'yellow': [255, 255, 0, 1], 'yellowgreen': [154, 205, 50, 1]\n};\nfunction clampCssByte(i) {\n i = Math.round(i);\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\nfunction clampCssAngle(i) {\n i = Math.round(i);\n return i < 0 ? 0 : i > 360 ? 360 : i;\n}\nfunction clampCssFloat(f) {\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\nfunction parseCssInt(val) {\n var str = val;\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssByte(parseFloat(str) / 100 * 255);\n }\n return clampCssByte(parseInt(str, 10));\n}\nfunction parseCssFloat(val) {\n var str = val;\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssFloat(parseFloat(str) / 100);\n }\n return clampCssFloat(parseFloat(str));\n}\nfunction cssHueToRgb(m1, m2, h) {\n if (h < 0) {\n h += 1;\n }\n else if (h > 1) {\n h -= 1;\n }\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n if (h * 2 < 1) {\n return m2;\n }\n if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2 / 3 - h) * 6;\n }\n return m1;\n}\nfunction lerpNumber(a, b, p) {\n return a + (b - a) * p;\n}\nfunction setRgba(out, r, g, b, a) {\n out[0] = r;\n out[1] = g;\n out[2] = b;\n out[3] = a;\n return out;\n}\nfunction copyRgba(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\nvar colorCache = new LRU(20);\nvar lastRemovedArr = null;\nfunction putToCache(colorStr, rgbaArr) {\n if (lastRemovedArr) {\n copyRgba(lastRemovedArr, rgbaArr);\n }\n lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice()));\n}\nexport function parse(colorStr, rgbaArr) {\n if (!colorStr) {\n return;\n }\n rgbaArr = rgbaArr || [];\n var cached = colorCache.get(colorStr);\n if (cached) {\n return copyRgba(rgbaArr, cached);\n }\n colorStr = colorStr + '';\n var str = colorStr.replace(/ /g, '').toLowerCase();\n if (str in kCSSColorTable) {\n copyRgba(rgbaArr, kCSSColorTable[str]);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n var strLen = str.length;\n if (str.charAt(0) === '#') {\n if (strLen === 4 || strLen === 5) {\n var iv = parseInt(str.slice(1, 4), 16);\n if (!(iv >= 0 && iv <= 0xfff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n setRgba(rgbaArr, ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8), (iv & 0xf0) | ((iv & 0xf0) >> 4), (iv & 0xf) | ((iv & 0xf) << 4), strLen === 5 ? parseInt(str.slice(4), 16) / 0xf : 1);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n else if (strLen === 7 || strLen === 9) {\n var iv = parseInt(str.slice(1, 7), 16);\n if (!(iv >= 0 && iv <= 0xffffff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n setRgba(rgbaArr, (iv & 0xff0000) >> 16, (iv & 0xff00) >> 8, iv & 0xff, strLen === 9 ? parseInt(str.slice(7), 16) / 0xff : 1);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n return;\n }\n var op = str.indexOf('(');\n var ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === strLen) {\n var fname = str.substr(0, op);\n var params = str.substr(op + 1, ep - (op + 1)).split(',');\n var alpha = 1;\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) {\n return params.length === 3\n ? setRgba(rgbaArr, +params[0], +params[1], +params[2], 1)\n : setRgba(rgbaArr, 0, 0, 0, 1);\n }\n alpha = parseCssFloat(params.pop());\n case 'rgb':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n setRgba(rgbaArr, parseCssInt(params[0]), parseCssInt(params[1]), parseCssInt(params[2]), alpha);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsla':\n if (params.length !== 4) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n params[3] = parseCssFloat(params[3]);\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsl':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n default:\n return;\n }\n }\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n}\nfunction hsla2rgba(hsla, rgba) {\n var h = (((parseFloat(hsla[0]) % 360) + 360) % 360) / 360;\n var s = parseCssFloat(hsla[1]);\n var l = parseCssFloat(hsla[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n rgba = rgba || [];\n setRgba(rgba, clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), clampCssByte(cssHueToRgb(m1, m2, h) * 255), clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), 1);\n if (hsla.length === 4) {\n rgba[3] = hsla[3];\n }\n return rgba;\n}\nfunction rgba2hsla(rgba) {\n if (!rgba) {\n return;\n }\n var R = rgba[0] / 255;\n var G = rgba[1] / 255;\n var B = rgba[2] / 255;\n var vMin = Math.min(R, G, B);\n var vMax = Math.max(R, G, B);\n var delta = vMax - vMin;\n var L = (vMax + vMin) / 2;\n var H;\n var S;\n if (delta === 0) {\n H = 0;\n S = 0;\n }\n else {\n if (L < 0.5) {\n S = delta / (vMax + vMin);\n }\n else {\n S = delta / (2 - vMax - vMin);\n }\n var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;\n var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;\n var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;\n if (R === vMax) {\n H = deltaB - deltaG;\n }\n else if (G === vMax) {\n H = (1 / 3) + deltaR - deltaB;\n }\n else if (B === vMax) {\n H = (2 / 3) + deltaG - deltaR;\n }\n if (H < 0) {\n H += 1;\n }\n if (H > 1) {\n H -= 1;\n }\n }\n var hsla = [H * 360, S, L];\n if (rgba[3] != null) {\n hsla.push(rgba[3]);\n }\n return hsla;\n}\nexport function lift(color, level) {\n var colorArr = parse(color);\n if (colorArr) {\n for (var i = 0; i < 3; i++) {\n if (level < 0) {\n colorArr[i] = colorArr[i] * (1 - level) | 0;\n }\n else {\n colorArr[i] = ((255 - colorArr[i]) * level + colorArr[i]) | 0;\n }\n if (colorArr[i] > 255) {\n colorArr[i] = 255;\n }\n else if (colorArr[i] < 0) {\n colorArr[i] = 0;\n }\n }\n return stringify(colorArr, colorArr.length === 4 ? 'rgba' : 'rgb');\n }\n}\nexport function toHex(color) {\n var colorArr = parse(color);\n if (colorArr) {\n return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + (+colorArr[2])).toString(16).slice(1);\n }\n}\nexport function fastLerp(normalizedValue, colors, out) {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)) {\n return;\n }\n out = out || [];\n var value = normalizedValue * (colors.length - 1);\n var leftIndex = Math.floor(value);\n var rightIndex = Math.ceil(value);\n var leftColor = colors[leftIndex];\n var rightColor = colors[rightIndex];\n var dv = value - leftIndex;\n out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));\n out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));\n out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));\n out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));\n return out;\n}\nexport var fastMapToColor = fastLerp;\nexport function lerp(normalizedValue, colors, fullOutput) {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)) {\n return;\n }\n var value = normalizedValue * (colors.length - 1);\n var leftIndex = Math.floor(value);\n var rightIndex = Math.ceil(value);\n var leftColor = parse(colors[leftIndex]);\n var rightColor = parse(colors[rightIndex]);\n var dv = value - leftIndex;\n var color = stringify([\n clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)),\n clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)),\n clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)),\n clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))\n ], 'rgba');\n return fullOutput\n ? {\n color: color,\n leftIndex: leftIndex,\n rightIndex: rightIndex,\n value: value\n }\n : color;\n}\nexport var mapToColor = lerp;\nexport function modifyHSL(color, h, s, l) {\n var colorArr = parse(color);\n if (color) {\n colorArr = rgba2hsla(colorArr);\n h != null && (colorArr[0] = clampCssAngle(h));\n s != null && (colorArr[1] = parseCssFloat(s));\n l != null && (colorArr[2] = parseCssFloat(l));\n return stringify(hsla2rgba(colorArr), 'rgba');\n }\n}\nexport function modifyAlpha(color, alpha) {\n var colorArr = parse(color);\n if (colorArr && alpha != null) {\n colorArr[3] = clampCssFloat(alpha);\n return stringify(colorArr, 'rgba');\n }\n}\nexport function stringify(arrColor, type) {\n if (!arrColor || !arrColor.length) {\n return;\n }\n var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2];\n if (type === 'rgba' || type === 'hsva' || type === 'hsla') {\n colorStr += ',' + arrColor[3];\n }\n return type + '(' + colorStr + ')';\n}\nexport function lum(color, backgroundLum) {\n var arr = parse(color);\n return arr\n ? (0.299 * arr[0] + 0.587 * arr[1] + 0.114 * arr[2]) * arr[3] / 255\n + (1 - arr[3]) * backgroundLum\n : 0;\n}\nexport function random() {\n var r = Math.round(Math.random() * 255);\n var g = Math.round(Math.random() * 255);\n var b = Math.round(Math.random() * 255);\n return 'rgb(' + r + ',' + g + ',' + b + ')';\n}\n","var BUILTIN_OBJECT = {\n '[object Function]': true,\n '[object RegExp]': true,\n '[object Date]': true,\n '[object Error]': true,\n '[object CanvasGradient]': true,\n '[object CanvasPattern]': true,\n '[object Image]': true,\n '[object Canvas]': true\n};\nvar TYPED_ARRAY = {\n '[object Int8Array]': true,\n '[object Uint8Array]': true,\n '[object Uint8ClampedArray]': true,\n '[object Int16Array]': true,\n '[object Uint16Array]': true,\n '[object Int32Array]': true,\n '[object Uint32Array]': true,\n '[object Float32Array]': true,\n '[object Float64Array]': true\n};\nvar objToString = Object.prototype.toString;\nvar arrayProto = Array.prototype;\nvar nativeForEach = arrayProto.forEach;\nvar nativeFilter = arrayProto.filter;\nvar nativeSlice = arrayProto.slice;\nvar nativeMap = arrayProto.map;\nvar ctorFunction = function () { }.constructor;\nvar protoFunction = ctorFunction ? ctorFunction.prototype : null;\nvar methods = {};\nexport function $override(name, fn) {\n methods[name] = fn;\n}\nvar idStart = 0x0907;\nexport function guid() {\n return idStart++;\n}\nexport function logError() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (typeof console !== 'undefined') {\n console.error.apply(console, args);\n }\n}\nexport function clone(source) {\n if (source == null || typeof source !== 'object') {\n return source;\n }\n var result = source;\n var typeStr = objToString.call(source);\n if (typeStr === '[object Array]') {\n if (!isPrimitive(source)) {\n result = [];\n for (var i = 0, len = source.length; i < len; i++) {\n result[i] = clone(source[i]);\n }\n }\n }\n else if (TYPED_ARRAY[typeStr]) {\n if (!isPrimitive(source)) {\n var Ctor = source.constructor;\n if (Ctor.from) {\n result = Ctor.from(source);\n }\n else {\n result = new Ctor(source.length);\n for (var i = 0, len = source.length; i < len; i++) {\n result[i] = clone(source[i]);\n }\n }\n }\n }\n else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {\n result = {};\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n result[key] = clone(source[key]);\n }\n }\n }\n return result;\n}\nexport function merge(target, source, overwrite) {\n if (!isObject(source) || !isObject(target)) {\n return overwrite ? clone(source) : target;\n }\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n var targetProp = target[key];\n var sourceProp = source[key];\n if (isObject(sourceProp)\n && isObject(targetProp)\n && !isArray(sourceProp)\n && !isArray(targetProp)\n && !isDom(sourceProp)\n && !isDom(targetProp)\n && !isBuiltInObject(sourceProp)\n && !isBuiltInObject(targetProp)\n && !isPrimitive(sourceProp)\n && !isPrimitive(targetProp)) {\n merge(targetProp, sourceProp, overwrite);\n }\n else if (overwrite || !(key in target)) {\n target[key] = clone(source[key]);\n }\n }\n }\n return target;\n}\nexport function mergeAll(targetAndSources, overwrite) {\n var result = targetAndSources[0];\n for (var i = 1, len = targetAndSources.length; i < len; i++) {\n result = merge(result, targetAndSources[i], overwrite);\n }\n return result;\n}\nexport function extend(target, source) {\n if (Object.assign) {\n Object.assign(target, source);\n }\n else {\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n}\nexport function defaults(target, source, overlay) {\n var keysArr = keys(source);\n for (var i = 0; i < keysArr.length; i++) {\n var key = keysArr[i];\n if ((overlay ? source[key] != null : target[key] == null)) {\n target[key] = source[key];\n }\n }\n return target;\n}\nexport var createCanvas = function () {\n return methods.createCanvas();\n};\nmethods.createCanvas = function () {\n return document.createElement('canvas');\n};\nexport function indexOf(array, value) {\n if (array) {\n if (array.indexOf) {\n return array.indexOf(value);\n }\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n }\n return -1;\n}\nexport function inherits(clazz, baseClazz) {\n var clazzPrototype = clazz.prototype;\n function F() { }\n F.prototype = baseClazz.prototype;\n clazz.prototype = new F();\n for (var prop in clazzPrototype) {\n if (clazzPrototype.hasOwnProperty(prop)) {\n clazz.prototype[prop] = clazzPrototype[prop];\n }\n }\n clazz.prototype.constructor = clazz;\n clazz.superClass = baseClazz;\n}\nexport function mixin(target, source, override) {\n target = 'prototype' in target ? target.prototype : target;\n source = 'prototype' in source ? source.prototype : source;\n if (Object.getOwnPropertyNames) {\n var keyList = Object.getOwnPropertyNames(source);\n for (var i = 0; i < keyList.length; i++) {\n var key = keyList[i];\n if (key !== 'constructor') {\n if ((override ? source[key] != null : target[key] == null)) {\n target[key] = source[key];\n }\n }\n }\n }\n else {\n defaults(target, source, override);\n }\n}\nexport function isArrayLike(data) {\n if (!data) {\n return false;\n }\n if (typeof data === 'string') {\n return false;\n }\n return typeof data.length === 'number';\n}\nexport function each(arr, cb, context) {\n if (!(arr && cb)) {\n return;\n }\n if (arr.forEach && arr.forEach === nativeForEach) {\n arr.forEach(cb, context);\n }\n else if (arr.length === +arr.length) {\n for (var i = 0, len = arr.length; i < len; i++) {\n cb.call(context, arr[i], i, arr);\n }\n }\n else {\n for (var key in arr) {\n if (arr.hasOwnProperty(key)) {\n cb.call(context, arr[key], key, arr);\n }\n }\n }\n}\nexport function map(arr, cb, context) {\n if (!arr) {\n return [];\n }\n if (!cb) {\n return slice(arr);\n }\n if (arr.map && arr.map === nativeMap) {\n return arr.map(cb, context);\n }\n else {\n var result = [];\n for (var i = 0, len = arr.length; i < len; i++) {\n result.push(cb.call(context, arr[i], i, arr));\n }\n return result;\n }\n}\nexport function reduce(arr, cb, memo, context) {\n if (!(arr && cb)) {\n return;\n }\n for (var i = 0, len = arr.length; i < len; i++) {\n memo = cb.call(context, memo, arr[i], i, arr);\n }\n return memo;\n}\nexport function filter(arr, cb, context) {\n if (!arr) {\n return [];\n }\n if (!cb) {\n return slice(arr);\n }\n if (arr.filter && arr.filter === nativeFilter) {\n return arr.filter(cb, context);\n }\n else {\n var result = [];\n for (var i = 0, len = arr.length; i < len; i++) {\n if (cb.call(context, arr[i], i, arr)) {\n result.push(arr[i]);\n }\n }\n return result;\n }\n}\nexport function find(arr, cb, context) {\n if (!(arr && cb)) {\n return;\n }\n for (var i = 0, len = arr.length; i < len; i++) {\n if (cb.call(context, arr[i], i, arr)) {\n return arr[i];\n }\n }\n}\nexport function keys(obj) {\n if (!obj) {\n return [];\n }\n if (Object.keys) {\n return Object.keys(obj);\n }\n var keyList = [];\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n keyList.push(key);\n }\n }\n return keyList;\n}\nfunction bindPolyfill(func, context) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n return function () {\n return func.apply(context, args.concat(nativeSlice.call(arguments)));\n };\n}\nexport var bind = (protoFunction && isFunction(protoFunction.bind))\n ? protoFunction.call.bind(protoFunction.bind)\n : bindPolyfill;\nfunction curry(func) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n return function () {\n return func.apply(this, args.concat(nativeSlice.call(arguments)));\n };\n}\nexport { curry };\nexport function isArray(value) {\n if (Array.isArray) {\n return Array.isArray(value);\n }\n return objToString.call(value) === '[object Array]';\n}\nexport function isFunction(value) {\n return typeof value === 'function';\n}\nexport function isString(value) {\n return typeof value === 'string';\n}\nexport function isStringSafe(value) {\n return objToString.call(value) === '[object String]';\n}\nexport function isNumber(value) {\n return typeof value === 'number';\n}\nexport function isObject(value) {\n var type = typeof value;\n return type === 'function' || (!!value && type === 'object');\n}\nexport function isBuiltInObject(value) {\n return !!BUILTIN_OBJECT[objToString.call(value)];\n}\nexport function isTypedArray(value) {\n return !!TYPED_ARRAY[objToString.call(value)];\n}\nexport function isDom(value) {\n return typeof value === 'object'\n && typeof value.nodeType === 'number'\n && typeof value.ownerDocument === 'object';\n}\nexport function isGradientObject(value) {\n return value.colorStops != null;\n}\nexport function isImagePatternObject(value) {\n return value.image != null;\n}\nexport function isRegExp(value) {\n return objToString.call(value) === '[object RegExp]';\n}\nexport function eqNaN(value) {\n return value !== value;\n}\nexport function retrieve() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n for (var i = 0, len = args.length; i < len; i++) {\n if (args[i] != null) {\n return args[i];\n }\n }\n}\nexport function retrieve2(value0, value1) {\n return value0 != null\n ? value0\n : value1;\n}\nexport function retrieve3(value0, value1, value2) {\n return value0 != null\n ? value0\n : value1 != null\n ? value1\n : value2;\n}\nexport function slice(arr) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n return nativeSlice.apply(arr, args);\n}\nexport function normalizeCssArray(val) {\n if (typeof (val) === 'number') {\n return [val, val, val, val];\n }\n var len = val.length;\n if (len === 2) {\n return [val[0], val[1], val[0], val[1]];\n }\n else if (len === 3) {\n return [val[0], val[1], val[2], val[1]];\n }\n return val;\n}\nexport function assert(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}\nexport function trim(str) {\n if (str == null) {\n return null;\n }\n else if (typeof str.trim === 'function') {\n return str.trim();\n }\n else {\n return str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n }\n}\nvar primitiveKey = '__ec_primitive__';\nexport function setAsPrimitive(obj) {\n obj[primitiveKey] = true;\n}\nexport function isPrimitive(obj) {\n return obj[primitiveKey];\n}\nvar HashMap = (function () {\n function HashMap(obj) {\n this.data = {};\n var isArr = isArray(obj);\n this.data = {};\n var thisMap = this;\n (obj instanceof HashMap)\n ? obj.each(visit)\n : (obj && each(obj, visit));\n function visit(value, key) {\n isArr ? thisMap.set(value, key) : thisMap.set(key, value);\n }\n }\n HashMap.prototype.get = function (key) {\n return this.data.hasOwnProperty(key) ? this.data[key] : null;\n };\n HashMap.prototype.set = function (key, value) {\n return (this.data[key] = value);\n };\n HashMap.prototype.each = function (cb, context) {\n for (var key in this.data) {\n if (this.data.hasOwnProperty(key)) {\n cb.call(context, this.data[key], key);\n }\n }\n };\n HashMap.prototype.keys = function () {\n return keys(this.data);\n };\n HashMap.prototype.removeKey = function (key) {\n delete this.data[key];\n };\n return HashMap;\n}());\nexport { HashMap };\nexport function createHashMap(obj) {\n return new HashMap(obj);\n}\nexport function concatArray(a, b) {\n var newArray = new a.constructor(a.length + b.length);\n for (var i = 0; i < a.length; i++) {\n newArray[i] = a[i];\n }\n var offset = a.length;\n for (var i = 0; i < b.length; i++) {\n newArray[i + offset] = b[i];\n }\n return newArray;\n}\nexport function createObject(proto, properties) {\n var obj;\n if (Object.create) {\n obj = Object.create(proto);\n }\n else {\n var StyleCtor = function () { };\n StyleCtor.prototype = proto;\n obj = new StyleCtor();\n }\n if (properties) {\n extend(obj, properties);\n }\n return obj;\n}\nexport function hasOwn(own, prop) {\n return own.hasOwnProperty(prop);\n}\nexport function noop() { }\n","import Clip from './Clip';\nimport * as color from '../tool/color';\nimport { isArrayLike, keys, logError } from '../core/util';\nvar arraySlice = Array.prototype.slice;\nexport function interpolateNumber(p0, p1, percent) {\n return (p1 - p0) * percent + p0;\n}\nexport function step(p0, p1, percent) {\n return percent > 0.5 ? p1 : p0;\n}\nexport function interpolate1DArray(out, p0, p1, percent) {\n var len = p0.length;\n for (var i = 0; i < len; i++) {\n out[i] = interpolateNumber(p0[i], p1[i], percent);\n }\n}\nexport function interpolate2DArray(out, p0, p1, percent) {\n var len = p0.length;\n var len2 = len && p0[0].length;\n for (var i = 0; i < len; i++) {\n if (!out[i]) {\n out[i] = [];\n }\n for (var j = 0; j < len2; j++) {\n out[i][j] = interpolateNumber(p0[i][j], p1[i][j], percent);\n }\n }\n}\nfunction add1DArray(out, p0, p1, sign) {\n var len = p0.length;\n for (var i = 0; i < len; i++) {\n out[i] = p0[i] + p1[i] * sign;\n }\n return out;\n}\nfunction add2DArray(out, p0, p1, sign) {\n var len = p0.length;\n var len2 = len && p0[0].length;\n for (var i = 0; i < len; i++) {\n if (!out[i]) {\n out[i] = [];\n }\n for (var j = 0; j < len2; j++) {\n out[i][j] = p0[i][j] + p1[i][j] * sign;\n }\n }\n return out;\n}\nfunction fillArray(val0, val1, arrDim) {\n var arr0 = val0;\n var arr1 = val1;\n if (!arr0.push || !arr1.push) {\n return;\n }\n var arr0Len = arr0.length;\n var arr1Len = arr1.length;\n if (arr0Len !== arr1Len) {\n var isPreviousLarger = arr0Len > arr1Len;\n if (isPreviousLarger) {\n arr0.length = arr1Len;\n }\n else {\n for (var i = arr0Len; i < arr1Len; i++) {\n arr0.push(arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i]));\n }\n }\n }\n var len2 = arr0[0] && arr0[0].length;\n for (var i = 0; i < arr0.length; i++) {\n if (arrDim === 1) {\n if (isNaN(arr0[i])) {\n arr0[i] = arr1[i];\n }\n }\n else {\n for (var j = 0; j < len2; j++) {\n if (isNaN(arr0[i][j])) {\n arr0[i][j] = arr1[i][j];\n }\n }\n }\n }\n}\nfunction is1DArraySame(arr0, arr1) {\n var len = arr0.length;\n if (len !== arr1.length) {\n return false;\n }\n for (var i = 0; i < len; i++) {\n if (arr0[i] !== arr1[i]) {\n return false;\n }\n }\n return true;\n}\nfunction is2DArraySame(arr0, arr1) {\n var len = arr0.length;\n if (len !== arr1.length) {\n return false;\n }\n var len2 = arr0[0].length;\n for (var i = 0; i < len; i++) {\n for (var j = 0; j < len2; j++) {\n if (arr0[i][j] !== arr1[i][j]) {\n return false;\n }\n }\n }\n return true;\n}\nfunction catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {\n var v0 = (p2 - p0) * 0.5;\n var v1 = (p3 - p1) * 0.5;\n return (2 * (p1 - p2) + v0 + v1) * t3\n + (-3 * (p1 - p2) - 2 * v0 - v1) * t2\n + v0 * t + p1;\n}\nfunction catmullRomInterpolate1DArray(out, p0, p1, p2, p3, t, t2, t3) {\n var len = p0.length;\n for (var i = 0; i < len; i++) {\n out[i] = catmullRomInterpolate(p0[i], p1[i], p2[i], p3[i], t, t2, t3);\n }\n}\nfunction catmullRomInterpolate2DArray(out, p0, p1, p2, p3, t, t2, t3) {\n var len = p0.length;\n var len2 = p0[0].length;\n for (var i = 0; i < len; i++) {\n if (!out[i]) {\n out[1] = [];\n }\n for (var j = 0; j < len2; j++) {\n out[i][j] = catmullRomInterpolate(p0[i][j], p1[i][j], p2[i][j], p3[i][j], t, t2, t3);\n }\n }\n}\nexport function cloneValue(value) {\n if (isArrayLike(value)) {\n var len = value.length;\n if (isArrayLike(value[0])) {\n var ret = [];\n for (var i = 0; i < len; i++) {\n ret.push(arraySlice.call(value[i]));\n }\n return ret;\n }\n return arraySlice.call(value);\n }\n return value;\n}\nfunction rgba2String(rgba) {\n rgba[0] = Math.floor(rgba[0]);\n rgba[1] = Math.floor(rgba[1]);\n rgba[2] = Math.floor(rgba[2]);\n return 'rgba(' + rgba.join(',') + ')';\n}\nfunction guessArrayDim(value) {\n return isArrayLike(value && value[0]) ? 2 : 1;\n}\nvar tmpRgba = [0, 0, 0, 0];\nvar Track = (function () {\n function Track(propName) {\n this.keyframes = [];\n this.maxTime = 0;\n this.arrDim = 0;\n this.interpolable = true;\n this._needsSort = false;\n this._isAllValueEqual = true;\n this._lastFrame = 0;\n this._lastFramePercent = 0;\n this.propName = propName;\n }\n Track.prototype.isFinished = function () {\n return this._finished;\n };\n Track.prototype.setFinished = function () {\n this._finished = true;\n if (this._additiveTrack) {\n this._additiveTrack.setFinished();\n }\n };\n Track.prototype.needsAnimate = function () {\n return !this._isAllValueEqual && this.keyframes.length >= 2 && this.interpolable;\n };\n Track.prototype.getAdditiveTrack = function () {\n return this._additiveTrack;\n };\n Track.prototype.addKeyframe = function (time, value) {\n if (time >= this.maxTime) {\n this.maxTime = time;\n }\n else {\n this._needsSort = true;\n }\n var keyframes = this.keyframes;\n var len = keyframes.length;\n if (this.interpolable) {\n if (isArrayLike(value)) {\n var arrayDim = guessArrayDim(value);\n if (len > 0 && this.arrDim !== arrayDim) {\n this.interpolable = false;\n return;\n }\n if (arrayDim === 1 && typeof value[0] !== 'number'\n || arrayDim === 2 && typeof value[0][0] !== 'number') {\n this.interpolable = false;\n return;\n }\n if (len > 0) {\n var lastFrame = keyframes[len - 1];\n if (this._isAllValueEqual) {\n if (arrayDim === 1) {\n if (!is1DArraySame(value, lastFrame.value)) {\n this._isAllValueEqual = false;\n }\n }\n else {\n this._isAllValueEqual = false;\n }\n }\n }\n this.arrDim = arrayDim;\n }\n else {\n if (this.arrDim > 0) {\n this.interpolable = false;\n return;\n }\n if (typeof value === 'string') {\n var colorArray = color.parse(value);\n if (colorArray) {\n value = colorArray;\n this.isValueColor = true;\n }\n else {\n this.interpolable = false;\n }\n }\n else if (typeof value !== 'number' || isNaN(value)) {\n this.interpolable = false;\n return;\n }\n if (this._isAllValueEqual && len > 0) {\n var lastFrame = keyframes[len - 1];\n if (this.isValueColor && !is1DArraySame(lastFrame.value, value)) {\n this._isAllValueEqual = false;\n }\n else if (lastFrame.value !== value) {\n this._isAllValueEqual = false;\n }\n }\n }\n }\n var kf = {\n time: time,\n value: value,\n percent: 0\n };\n this.keyframes.push(kf);\n return kf;\n };\n Track.prototype.prepare = function (additiveTrack) {\n var kfs = this.keyframes;\n if (this._needsSort) {\n kfs.sort(function (a, b) {\n return a.time - b.time;\n });\n }\n var arrDim = this.arrDim;\n var kfsLen = kfs.length;\n var lastKf = kfs[kfsLen - 1];\n for (var i = 0; i < kfsLen; i++) {\n kfs[i].percent = kfs[i].time / this.maxTime;\n if (arrDim > 0 && i !== kfsLen - 1) {\n fillArray(kfs[i].value, lastKf.value, arrDim);\n }\n }\n if (additiveTrack\n && this.needsAnimate()\n && additiveTrack.needsAnimate()\n && arrDim === additiveTrack.arrDim\n && this.isValueColor === additiveTrack.isValueColor\n && !additiveTrack._finished) {\n this._additiveTrack = additiveTrack;\n var startValue = kfs[0].value;\n for (var i = 0; i < kfsLen; i++) {\n if (arrDim === 0) {\n if (this.isValueColor) {\n kfs[i].additiveValue\n = add1DArray([], kfs[i].value, startValue, -1);\n }\n else {\n kfs[i].additiveValue = kfs[i].value - startValue;\n }\n }\n else if (arrDim === 1) {\n kfs[i].additiveValue = add1DArray([], kfs[i].value, startValue, -1);\n }\n else if (arrDim === 2) {\n kfs[i].additiveValue = add2DArray([], kfs[i].value, startValue, -1);\n }\n }\n }\n };\n Track.prototype.step = function (target, percent) {\n if (this._finished) {\n return;\n }\n if (this._additiveTrack && this._additiveTrack._finished) {\n this._additiveTrack = null;\n }\n var isAdditive = this._additiveTrack != null;\n var valueKey = isAdditive ? 'additiveValue' : 'value';\n var keyframes = this.keyframes;\n var kfsNum = this.keyframes.length;\n var propName = this.propName;\n var arrDim = this.arrDim;\n var isValueColor = this.isValueColor;\n var frameIdx;\n if (percent < 0) {\n frameIdx = 0;\n }\n else if (percent < this._lastFramePercent) {\n var start = Math.min(this._lastFrame + 1, kfsNum - 1);\n for (frameIdx = start; frameIdx >= 0; frameIdx--) {\n if (keyframes[frameIdx].percent <= percent) {\n break;\n }\n }\n frameIdx = Math.min(frameIdx, kfsNum - 2);\n }\n else {\n for (frameIdx = this._lastFrame; frameIdx < kfsNum; frameIdx++) {\n if (keyframes[frameIdx].percent > percent) {\n break;\n }\n }\n frameIdx = Math.min(frameIdx - 1, kfsNum - 2);\n }\n var nextFrame = keyframes[frameIdx + 1];\n var frame = keyframes[frameIdx];\n if (!(frame && nextFrame)) {\n return;\n }\n this._lastFrame = frameIdx;\n this._lastFramePercent = percent;\n var range = (nextFrame.percent - frame.percent);\n if (range === 0) {\n return;\n }\n var w = (percent - frame.percent) / range;\n var targetArr = isAdditive ? this._additiveValue\n : (isValueColor ? tmpRgba : target[propName]);\n if ((arrDim > 0 || isValueColor) && !targetArr) {\n targetArr = this._additiveValue = [];\n }\n if (this.useSpline) {\n var p1 = keyframes[frameIdx][valueKey];\n var p0 = keyframes[frameIdx === 0 ? frameIdx : frameIdx - 1][valueKey];\n var p2 = keyframes[frameIdx > kfsNum - 2 ? kfsNum - 1 : frameIdx + 1][valueKey];\n var p3 = keyframes[frameIdx > kfsNum - 3 ? kfsNum - 1 : frameIdx + 2][valueKey];\n if (arrDim > 0) {\n arrDim === 1\n ? catmullRomInterpolate1DArray(targetArr, p0, p1, p2, p3, w, w * w, w * w * w)\n : catmullRomInterpolate2DArray(targetArr, p0, p1, p2, p3, w, w * w, w * w * w);\n }\n else if (isValueColor) {\n catmullRomInterpolate1DArray(targetArr, p0, p1, p2, p3, w, w * w, w * w * w);\n if (!isAdditive) {\n target[propName] = rgba2String(targetArr);\n }\n }\n else {\n var value = void 0;\n if (!this.interpolable) {\n value = p2;\n }\n else {\n value = catmullRomInterpolate(p0, p1, p2, p3, w, w * w, w * w * w);\n }\n if (isAdditive) {\n this._additiveValue = value;\n }\n else {\n target[propName] = value;\n }\n }\n }\n else {\n if (arrDim > 0) {\n arrDim === 1\n ? interpolate1DArray(targetArr, frame[valueKey], nextFrame[valueKey], w)\n : interpolate2DArray(targetArr, frame[valueKey], nextFrame[valueKey], w);\n }\n else if (isValueColor) {\n interpolate1DArray(targetArr, frame[valueKey], nextFrame[valueKey], w);\n if (!isAdditive) {\n target[propName] = rgba2String(targetArr);\n }\n }\n else {\n var value = void 0;\n if (!this.interpolable) {\n value = step(frame[valueKey], nextFrame[valueKey], w);\n }\n else {\n value = interpolateNumber(frame[valueKey], nextFrame[valueKey], w);\n }\n if (isAdditive) {\n this._additiveValue = value;\n }\n else {\n target[propName] = value;\n }\n }\n }\n if (isAdditive) {\n this._addToTarget(target);\n }\n };\n Track.prototype._addToTarget = function (target) {\n var arrDim = this.arrDim;\n var propName = this.propName;\n var additiveValue = this._additiveValue;\n if (arrDim === 0) {\n if (this.isValueColor) {\n color.parse(target[propName], tmpRgba);\n add1DArray(tmpRgba, tmpRgba, additiveValue, 1);\n target[propName] = rgba2String(tmpRgba);\n }\n else {\n target[propName] = target[propName] + additiveValue;\n }\n }\n else if (arrDim === 1) {\n add1DArray(target[propName], target[propName], additiveValue, 1);\n }\n else if (arrDim === 2) {\n add2DArray(target[propName], target[propName], additiveValue, 1);\n }\n };\n return Track;\n}());\nvar Animator = (function () {\n function Animator(target, loop, additiveTo) {\n this._tracks = {};\n this._trackKeys = [];\n this._delay = 0;\n this._maxTime = 0;\n this._paused = false;\n this._started = 0;\n this._clip = null;\n this._target = target;\n this._loop = loop;\n if (loop && additiveTo) {\n logError('Can\\' use additive animation on looped animation.');\n return;\n }\n this._additiveAnimators = additiveTo;\n }\n Animator.prototype.getTarget = function () {\n return this._target;\n };\n Animator.prototype.changeTarget = function (target) {\n this._target = target;\n };\n Animator.prototype.when = function (time, props) {\n return this.whenWithKeys(time, props, keys(props));\n };\n Animator.prototype.whenWithKeys = function (time, props, propNames) {\n var tracks = this._tracks;\n for (var i = 0; i < propNames.length; i++) {\n var propName = propNames[i];\n var track = tracks[propName];\n if (!track) {\n track = tracks[propName] = new Track(propName);\n var initialValue = void 0;\n var additiveTrack = this._getAdditiveTrack(propName);\n if (additiveTrack) {\n var lastFinalKf = additiveTrack.keyframes[additiveTrack.keyframes.length - 1];\n initialValue = lastFinalKf && lastFinalKf.value;\n if (additiveTrack.isValueColor && initialValue) {\n initialValue = rgba2String(initialValue);\n }\n }\n else {\n initialValue = this._target[propName];\n }\n if (initialValue == null) {\n continue;\n }\n if (time !== 0) {\n track.addKeyframe(0, cloneValue(initialValue));\n }\n this._trackKeys.push(propName);\n }\n track.addKeyframe(time, cloneValue(props[propName]));\n }\n this._maxTime = Math.max(this._maxTime, time);\n return this;\n };\n Animator.prototype.pause = function () {\n this._clip.pause();\n this._paused = true;\n };\n Animator.prototype.resume = function () {\n this._clip.resume();\n this._paused = false;\n };\n Animator.prototype.isPaused = function () {\n return !!this._paused;\n };\n Animator.prototype._doneCallback = function () {\n this._setTracksFinished();\n this._clip = null;\n var doneList = this._doneList;\n if (doneList) {\n var len = doneList.length;\n for (var i = 0; i < len; i++) {\n doneList[i].call(this);\n }\n }\n };\n Animator.prototype._abortedCallback = function () {\n this._setTracksFinished();\n var animation = this.animation;\n var abortedList = this._abortedList;\n if (animation) {\n animation.removeClip(this._clip);\n }\n this._clip = null;\n if (abortedList) {\n for (var i = 0; i < abortedList.length; i++) {\n abortedList[i].call(this);\n }\n }\n };\n Animator.prototype._setTracksFinished = function () {\n var tracks = this._tracks;\n var tracksKeys = this._trackKeys;\n for (var i = 0; i < tracksKeys.length; i++) {\n tracks[tracksKeys[i]].setFinished();\n }\n };\n Animator.prototype._getAdditiveTrack = function (trackName) {\n var additiveTrack;\n var additiveAnimators = this._additiveAnimators;\n if (additiveAnimators) {\n for (var i = 0; i < additiveAnimators.length; i++) {\n var track = additiveAnimators[i].getTrack(trackName);\n if (track) {\n additiveTrack = track;\n }\n }\n }\n return additiveTrack;\n };\n Animator.prototype.start = function (easing, forceAnimate) {\n if (this._started > 0) {\n return;\n }\n this._started = 1;\n var self = this;\n var tracks = [];\n for (var i = 0; i < this._trackKeys.length; i++) {\n var propName = this._trackKeys[i];\n var track = this._tracks[propName];\n var additiveTrack = this._getAdditiveTrack(propName);\n var kfs = track.keyframes;\n track.prepare(additiveTrack);\n if (track.needsAnimate()) {\n tracks.push(track);\n }\n else if (!track.interpolable) {\n var lastKf = kfs[kfs.length - 1];\n if (lastKf) {\n self._target[track.propName] = lastKf.value;\n }\n }\n }\n if (tracks.length || forceAnimate) {\n var clip = new Clip({\n life: this._maxTime,\n loop: this._loop,\n delay: this._delay,\n onframe: function (percent) {\n self._started = 2;\n var additiveAnimators = self._additiveAnimators;\n if (additiveAnimators) {\n var stillHasAdditiveAnimator = false;\n for (var i = 0; i < additiveAnimators.length; i++) {\n if (additiveAnimators[i]._clip) {\n stillHasAdditiveAnimator = true;\n break;\n }\n }\n if (!stillHasAdditiveAnimator) {\n self._additiveAnimators = null;\n }\n }\n for (var i = 0; i < tracks.length; i++) {\n tracks[i].step(self._target, percent);\n }\n var onframeList = self._onframeList;\n if (onframeList) {\n for (var i = 0; i < onframeList.length; i++) {\n onframeList[i](self._target, percent);\n }\n }\n },\n ondestroy: function () {\n self._doneCallback();\n }\n });\n this._clip = clip;\n if (this.animation) {\n this.animation.addClip(clip);\n }\n if (easing && easing !== 'spline') {\n clip.easing = easing;\n }\n }\n else {\n this._doneCallback();\n }\n return this;\n };\n Animator.prototype.stop = function (forwardToLast) {\n if (!this._clip) {\n return;\n }\n var clip = this._clip;\n if (forwardToLast) {\n clip.onframe(1);\n }\n this._abortedCallback();\n };\n Animator.prototype.delay = function (time) {\n this._delay = time;\n return this;\n };\n Animator.prototype.during = function (cb) {\n if (cb) {\n if (!this._onframeList) {\n this._onframeList = [];\n }\n this._onframeList.push(cb);\n }\n return this;\n };\n Animator.prototype.done = function (cb) {\n if (cb) {\n if (!this._doneList) {\n this._doneList = [];\n }\n this._doneList.push(cb);\n }\n return this;\n };\n Animator.prototype.aborted = function (cb) {\n if (cb) {\n if (!this._abortedList) {\n this._abortedList = [];\n }\n this._abortedList.push(cb);\n }\n return this;\n };\n Animator.prototype.getClip = function () {\n return this._clip;\n };\n Animator.prototype.getTrack = function (propName) {\n return this._tracks[propName];\n };\n Animator.prototype.stopTracks = function (propNames, forwardToLast) {\n if (!propNames.length || !this._clip) {\n return true;\n }\n var tracks = this._tracks;\n var tracksKeys = this._trackKeys;\n for (var i = 0; i < propNames.length; i++) {\n var track = tracks[propNames[i]];\n if (track) {\n if (forwardToLast) {\n track.step(this._target, 1);\n }\n else if (this._started === 1) {\n track.step(this._target, 0);\n }\n track.setFinished();\n }\n }\n var allAborted = true;\n for (var i = 0; i < tracksKeys.length; i++) {\n if (!tracks[tracksKeys[i]].isFinished()) {\n allAborted = false;\n break;\n }\n }\n if (allAborted) {\n this._abortedCallback();\n }\n return allAborted;\n };\n Animator.prototype.saveFinalToTarget = function (target, trackKeys) {\n if (!target) {\n return;\n }\n trackKeys = trackKeys || this._trackKeys;\n for (var i = 0; i < trackKeys.length; i++) {\n var propName = trackKeys[i];\n var track = this._tracks[propName];\n if (!track || track.isFinished()) {\n continue;\n }\n var kfs = track.keyframes;\n var lastKf = kfs[kfs.length - 1];\n if (lastKf) {\n var val = cloneValue(lastKf.value);\n if (track.isValueColor) {\n val = rgba2String(val);\n }\n target[propName] = val;\n }\n }\n };\n Animator.prototype.__changeFinalValue = function (finalProps, trackKeys) {\n trackKeys = trackKeys || keys(finalProps);\n for (var i = 0; i < trackKeys.length; i++) {\n var propName = trackKeys[i];\n var track = this._tracks[propName];\n if (!track) {\n continue;\n }\n var kfs = track.keyframes;\n if (kfs.length > 1) {\n var lastKf = kfs.pop();\n track.addKeyframe(lastKf.time, finalProps[propName]);\n track.prepare(track.getAdditiveTrack());\n }\n }\n };\n return Animator;\n}());\nexport default Animator;\n","import Animator from 'zrender/lib/animation/Animator';\n\nvar animatableMixin = {\n\n _animators: null,\n\n getAnimators: function () {\n this._animators = this._animators || [];\n\n return this._animators;\n },\n\n animate: function (path, opts) {\n this._animators = this._animators || [];\n\n var el = this;\n\n var target;\n\n if (path) {\n var pathSplitted = path.split('.');\n var prop = el;\n for (var i = 0, l = pathSplitted.length; i < l; i++) {\n if (!prop) {\n continue;\n }\n prop = prop[pathSplitted[i]];\n }\n if (prop) {\n target = prop;\n }\n }\n else {\n target = el;\n }\n if (target == null) {\n throw new Error('Target ' + path + ' not exists');\n }\n\n var animators = this._animators;\n\n var animator = new Animator(target, opts);\n var self = this;\n animator.during(function () {\n if (self.__zr) {\n self.__zr.refresh();\n }\n }).done(function () {\n var idx = animators.indexOf(animator);\n if (idx >= 0) {\n animators.splice(idx, 1);\n }\n });\n animators.push(animator);\n\n if (this.__zr) {\n this.__zr.animation.addAnimator(animator);\n }\n\n return animator;\n },\n\n stopAnimation: function (forwardToLast) {\n this._animators = this._animators || [];\n\n var animators = this._animators;\n var len = animators.length;\n for (var i = 0; i < len; i++) {\n animators[i].stop(forwardToLast);\n }\n animators.length = 0;\n\n return this;\n },\n\n addAnimatorsToZr: function (zr) {\n if (this._animators) {\n for (var i = 0; i < this._animators.length; i++) {\n zr.animation.addAnimator(this._animators[i]);\n }\n }\n },\n\n removeAnimatorsFromZr: function (zr) {\n if (this._animators) {\n for (var i = 0; i < this._animators.length; i++) {\n zr.animation.removeAnimator(this._animators[i]);\n }\n }\n }\n};\n\nexport default animatableMixin;","export default \"\\n@export clay.util.rand\\nhighp float rand(vec2 uv) {\\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n highp float dt = dot(uv.xy, vec2(a,b)), sn = mod(dt, 3.141592653589793);\\n return fract(sin(sn) * c);\\n}\\n@end\\n@export clay.util.calculate_attenuation\\nuniform float attenuationFactor : 5.0;\\nfloat lightAttenuation(float dist, float range)\\n{\\n float attenuation = 1.0;\\n attenuation = dist*dist/(range*range+1.0);\\n float att_s = attenuationFactor;\\n attenuation = 1.0/(attenuation*att_s+1.0);\\n att_s = 1.0/(att_s+1.0);\\n attenuation = attenuation - att_s;\\n attenuation /= 1.0 - att_s;\\n return clamp(attenuation, 0.0, 1.0);\\n}\\n@end\\n@export clay.util.edge_factor\\n#ifdef SUPPORT_STANDARD_DERIVATIVES\\nfloat edgeFactor(float width)\\n{\\n vec3 d = fwidth(v_Barycentric);\\n vec3 a3 = smoothstep(vec3(0.0), d * width, v_Barycentric);\\n return min(min(a3.x, a3.y), a3.z);\\n}\\n#else\\nfloat edgeFactor(float width)\\n{\\n return 1.0;\\n}\\n#endif\\n@end\\n@export clay.util.encode_float\\nvec4 encodeFloat(const in float depth)\\n{\\n const vec4 bitShifts = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\\n const vec4 bit_mask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\\n vec4 res = fract(depth * bitShifts);\\n res -= res.xxyz * bit_mask;\\n return res;\\n}\\n@end\\n@export clay.util.decode_float\\nfloat decodeFloat(const in vec4 color)\\n{\\n const vec4 bitShifts = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);\\n return dot(color, bitShifts);\\n}\\n@end\\n@export clay.util.float\\n@import clay.util.encode_float\\n@import clay.util.decode_float\\n@end\\n@export clay.util.rgbm_decode\\nvec3 RGBMDecode(vec4 rgbm, float range) {\\n return range * rgbm.rgb * rgbm.a;\\n}\\n@end\\n@export clay.util.rgbm_encode\\nvec4 RGBMEncode(vec3 color, float range) {\\n if (dot(color, color) == 0.0) {\\n return vec4(0.0);\\n }\\n vec4 rgbm;\\n color /= range;\\n rgbm.a = clamp(max(max(color.r, color.g), max(color.b, 1e-6)), 0.0, 1.0);\\n rgbm.a = ceil(rgbm.a * 255.0) / 255.0;\\n rgbm.rgb = color / rgbm.a;\\n return rgbm;\\n}\\n@end\\n@export clay.util.rgbm\\n@import clay.util.rgbm_decode\\n@import clay.util.rgbm_encode\\nvec4 decodeHDR(vec4 color)\\n{\\n#if defined(RGBM_DECODE) || defined(RGBM)\\n return vec4(RGBMDecode(color, 8.12), 1.0);\\n#else\\n return color;\\n#endif\\n}\\nvec4 encodeHDR(vec4 color)\\n{\\n#if defined(RGBM_ENCODE) || defined(RGBM)\\n return RGBMEncode(color.xyz, 8.12);\\n#else\\n return color;\\n#endif\\n}\\n@end\\n@export clay.util.srgb\\nvec4 sRGBToLinear(in vec4 value) {\\n return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.w);\\n}\\nvec4 linearTosRGB(in vec4 value) {\\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\\n}\\n@end\\n@export clay.chunk.skinning_header\\n#ifdef SKINNING\\nattribute vec3 weight : WEIGHT;\\nattribute vec4 joint : JOINT;\\n#ifdef USE_SKIN_MATRICES_TEXTURE\\nuniform sampler2D skinMatricesTexture : ignore;\\nuniform float skinMatricesTextureSize: ignore;\\nmat4 getSkinMatrix(sampler2D tex, float idx) {\\n float j = idx * 4.0;\\n float x = mod(j, skinMatricesTextureSize);\\n float y = floor(j / skinMatricesTextureSize) + 0.5;\\n vec2 scale = vec2(skinMatricesTextureSize);\\n return mat4(\\n texture2D(tex, vec2(x + 0.5, y) / scale),\\n texture2D(tex, vec2(x + 1.5, y) / scale),\\n texture2D(tex, vec2(x + 2.5, y) / scale),\\n texture2D(tex, vec2(x + 3.5, y) / scale)\\n );\\n}\\nmat4 getSkinMatrix(float idx) {\\n return getSkinMatrix(skinMatricesTexture, idx);\\n}\\n#else\\nuniform mat4 skinMatrix[JOINT_COUNT] : SKIN_MATRIX;\\nmat4 getSkinMatrix(float idx) {\\n return skinMatrix[int(idx)];\\n}\\n#endif\\n#endif\\n@end\\n@export clay.chunk.skin_matrix\\nmat4 skinMatrixWS = getSkinMatrix(joint.x) * weight.x;\\nif (weight.y > 1e-4)\\n{\\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\\n}\\nif (weight.z > 1e-4)\\n{\\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\\n}\\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\\nif (weightW > 1e-4)\\n{\\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\\n}\\n@end\\n@export clay.chunk.instancing_header\\n#ifdef INSTANCING\\nattribute vec4 instanceMat1;\\nattribute vec4 instanceMat2;\\nattribute vec4 instanceMat3;\\n#endif\\n@end\\n@export clay.chunk.instancing_matrix\\nmat4 instanceMat = mat4(\\n vec4(instanceMat1.xyz, 0.0),\\n vec4(instanceMat2.xyz, 0.0),\\n vec4(instanceMat3.xyz, 0.0),\\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\\n);\\n@end\\n@export clay.util.parallax_correct\\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\\n vec3 first = (boxMax - pos) / dir;\\n vec3 second = (boxMin - pos) / dir;\\n vec3 further = max(first, second);\\n float dist = min(further.x, min(further.y, further.z));\\n vec3 fixedPos = pos + dir * dist;\\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\\n return normalize(fixedPos - boxCenter);\\n}\\n@end\\n@export clay.util.clamp_sample\\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\\n{\\n#ifdef STEREO\\n float eye = step(0.5, coord.x) * 0.5;\\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\\n#else\\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\\n#endif\\n return texture2D(texture, coordClamped);\\n}\\n@end\\n@export clay.util.ACES\\nvec3 ACESToneMapping(vec3 color)\\n{\\n const float A = 2.51;\\n const float B = 0.03;\\n const float C = 2.43;\\n const float D = 0.59;\\n const float E = 0.14;\\n return (color * (A * color + B)) / (color * (C * color + D) + E);\\n}\\n@end\";\n","export default \"\\n@export ecgl.common.transformUniforms\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\\nuniform mat4 world : WORLD;\\n@end\\n\\n@export ecgl.common.attributes\\nattribute vec3 position : POSITION;\\nattribute vec2 texcoord : TEXCOORD_0;\\nattribute vec3 normal : NORMAL;\\n@end\\n\\n@export ecgl.common.uv.header\\nuniform vec2 uvRepeat : [1.0, 1.0];\\nuniform vec2 uvOffset : [0.0, 0.0];\\nuniform vec2 detailUvRepeat : [1.0, 1.0];\\nuniform vec2 detailUvOffset : [0.0, 0.0];\\n\\nvarying vec2 v_Texcoord;\\nvarying vec2 v_DetailTexcoord;\\n@end\\n\\n@export ecgl.common.uv.main\\nv_Texcoord = texcoord * uvRepeat + uvOffset;\\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\\n@end\\n\\n@export ecgl.common.uv.fragmentHeader\\nvarying vec2 v_Texcoord;\\nvarying vec2 v_DetailTexcoord;\\n@end\\n\\n\\n@export ecgl.common.albedo.main\\n\\n vec4 albedoTexel = vec4(1.0);\\n#ifdef DIFFUSEMAP_ENABLED\\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\\n #ifdef SRGB_DECODE\\n albedoTexel = sRGBToLinear(albedoTexel);\\n #endif\\n#endif\\n\\n#ifdef DETAILMAP_ENABLED\\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\\n #ifdef SRGB_DECODE\\n detailTexel = sRGBToLinear(detailTexel);\\n #endif\\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.wireframe.vertexHeader\\n\\n#ifdef WIREFRAME_QUAD\\nattribute vec4 barycentric;\\nvarying vec4 v_Barycentric;\\n#elif defined(WIREFRAME_TRIANGLE)\\nattribute vec3 barycentric;\\nvarying vec3 v_Barycentric;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.wireframe.vertexMain\\n\\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\\n v_Barycentric = barycentric;\\n#endif\\n\\n@end\\n\\n\\n@export ecgl.common.wireframe.fragmentHeader\\n\\nuniform float wireframeLineWidth : 1;\\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\\n\\n#ifdef WIREFRAME_QUAD\\nvarying vec4 v_Barycentric;\\nfloat edgeFactor () {\\n vec4 d = fwidth(v_Barycentric);\\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\\n}\\n#elif defined(WIREFRAME_TRIANGLE)\\nvarying vec3 v_Barycentric;\\nfloat edgeFactor () {\\n vec3 d = fwidth(v_Barycentric);\\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\\n return min(min(a3.x, a3.y), a3.z);\\n}\\n#endif\\n\\n@end\\n\\n\\n@export ecgl.common.wireframe.fragmentMain\\n\\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\\n if (wireframeLineWidth > 0.) {\\n vec4 lineColor = wireframeLineColor;\\n#ifdef SRGB_DECODE\\n lineColor = sRGBToLinear(lineColor);\\n#endif\\n\\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\\n }\\n#endif\\n@end\\n\\n\\n\\n\\n@export ecgl.common.bumpMap.header\\n\\n#ifdef BUMPMAP_ENABLED\\nuniform sampler2D bumpMap;\\nuniform float bumpScale : 1.0;\\n\\n\\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\\n{\\n vec2 dSTdx = dFdx(v_Texcoord);\\n vec2 dSTdy = dFdy(v_Texcoord);\\n\\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\\n\\n vec3 vSigmaX = dFdx(surfPos);\\n vec3 vSigmaY = dFdy(surfPos);\\n vec3 vN = surfNormal;\\n\\n vec3 R1 = cross(vSigmaY, vN);\\n vec3 R2 = cross(vN, vSigmaX);\\n\\n float fDet = dot(vSigmaX, R1);\\n\\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\\n return normalize(abs(fDet) * baseNormal - vGrad);\\n\\n}\\n#endif\\n\\n@end\\n\\n@export ecgl.common.normalMap.vertexHeader\\n\\n#ifdef NORMALMAP_ENABLED\\nattribute vec4 tangent : TANGENT;\\nvarying vec3 v_Tangent;\\nvarying vec3 v_Bitangent;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.normalMap.vertexMain\\n\\n#ifdef NORMALMAP_ENABLED\\n if (dot(tangent, tangent) > 0.0) {\\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\\n }\\n#endif\\n\\n@end\\n\\n\\n@export ecgl.common.normalMap.fragmentHeader\\n\\n#ifdef NORMALMAP_ENABLED\\nuniform sampler2D normalMap;\\nvarying vec3 v_Tangent;\\nvarying vec3 v_Bitangent;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.normalMap.fragmentMain\\n#ifdef NORMALMAP_ENABLED\\n if (dot(v_Tangent, v_Tangent) > 0.0) {\\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\\n N = normalize(tbn * N);\\n }\\n }\\n#endif\\n@end\\n\\n\\n\\n@export ecgl.common.vertexAnimation.header\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nattribute vec3 prevNormal;\\nuniform float percent;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.vertexAnimation.main\\n\\n#ifdef VERTEX_ANIMATION\\n vec3 pos = mix(prevPosition, position, percent);\\n vec3 norm = mix(prevNormal, normal, percent);\\n#else\\n vec3 pos = position;\\n vec3 norm = normal;\\n#endif\\n\\n@end\\n\\n\\n@export ecgl.common.ssaoMap.header\\n#ifdef SSAOMAP_ENABLED\\nuniform sampler2D ssaoMap;\\nuniform vec4 viewport : VIEWPORT;\\n#endif\\n@end\\n\\n@export ecgl.common.ssaoMap.main\\n float ao = 1.0;\\n#ifdef SSAOMAP_ENABLED\\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\\n#endif\\n@end\\n\\n\\n\\n\\n@export ecgl.common.diffuseLayer.header\\n\\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\\n#endif\\n\\n@end\\n\\n@export ecgl.common.emissiveLayer.header\\n\\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\\n#endif\\n\\n@end\\n\\n@export ecgl.common.layers.header\\n@import ecgl.common.diffuseLayer.header\\n@import ecgl.common.emissiveLayer.header\\n@end\\n\\n@export ecgl.common.diffuseLayer.main\\n\\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\\n float intensity = layerDiffuseIntensity[_idx_];\\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\\n #ifdef SRGB_DECODE\\n texel2 = sRGBToLinear(texel2);\\n #endif\\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\\n }}\\n#endif\\n\\n@end\\n\\n@export ecgl.common.emissiveLayer.main\\n\\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\\n {{\\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\\n #ifdef SRGB_DECODE\\n texel2 = sRGBToLinear(texel2);\\n #endif\\n float intensity = layerEmissionIntensity[_idx_];\\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\\n }}\\n#endif\\n\\n@end\\n\";\n","export default \"@export ecgl.color.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\n@import ecgl.common.uv.header\\n\\nattribute vec2 texcoord : TEXCOORD_0;\\nattribute vec3 position: POSITION;\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nuniform float percent : 1.0;\\n#endif\\n\\n#ifdef ATMOSPHERE_ENABLED\\nattribute vec3 normal: NORMAL;\\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\\nvarying vec3 v_Normal;\\n#endif\\n\\nvoid main()\\n{\\n#ifdef VERTEX_ANIMATION\\n vec3 pos = mix(prevPosition, position, percent);\\n#else\\n vec3 pos = position;\\n#endif\\n\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n\\n @import ecgl.common.uv.main\\n\\n#ifdef VERTEX_COLOR\\n v_Color = a_Color;\\n#endif\\n\\n#ifdef ATMOSPHERE_ENABLED\\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\\n#endif\\n\\n @import ecgl.common.wireframe.vertexMain\\n\\n}\\n\\n@end\\n\\n@export ecgl.color.fragment\\n\\n#define LAYER_DIFFUSEMAP_COUNT 0\\n#define LAYER_EMISSIVEMAP_COUNT 0\\n\\nuniform sampler2D diffuseMap;\\nuniform sampler2D detailMap;\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\n#ifdef ATMOSPHERE_ENABLED\\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\\nuniform vec3 glowColor;\\nuniform float glowPower;\\nvarying vec3 v_Normal;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\n@import ecgl.common.layers.header\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color);\\n#else\\n gl_FragColor = color;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\n gl_FragColor *= v_Color;\\n#endif\\n\\n @import ecgl.common.albedo.main\\n\\n @import ecgl.common.diffuseLayer.main\\n\\n gl_FragColor *= albedoTexel;\\n\\n#ifdef ATMOSPHERE_ENABLED\\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\\n gl_FragColor.rgb += glowColor * atmoIntensity;\\n#endif\\n\\n @import ecgl.common.emissiveLayer.main\\n\\n @import ecgl.common.wireframe.fragmentMain\\n\\n}\\n@end\";\n","export default \"/**\\n * http: */\\n\\n@export ecgl.lambert.vertex\\n\\n@import ecgl.common.transformUniforms\\n\\n@import ecgl.common.uv.header\\n\\n\\n@import ecgl.common.attributes\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\n\\n@import ecgl.common.vertexAnimation.header\\n\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nvoid main()\\n{\\n @import ecgl.common.uv.main\\n\\n @import ecgl.common.vertexAnimation.main\\n\\n\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n\\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\\n\\n#ifdef VERTEX_COLOR\\n v_Color = a_Color;\\n#endif\\n\\n @import ecgl.common.wireframe.vertexMain\\n}\\n\\n@end\\n\\n\\n@export ecgl.lambert.fragment\\n\\n#define LAYER_DIFFUSEMAP_COUNT 0\\n#define LAYER_EMISSIVEMAP_COUNT 0\\n\\n#define NORMAL_UP_AXIS 1\\n#define NORMAL_FRONT_AXIS 2\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform sampler2D diffuseMap;\\nuniform sampler2D detailMap;\\n\\n@import ecgl.common.layers.header\\n\\nuniform float emissionIntensity: 1.0;\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nuniform mat4 viewInverse : VIEWINVERSE;\\n\\n#ifdef ATMOSPHERE_ENABLED\\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\\nuniform vec3 glowColor;\\nuniform float glowPower;\\n#endif\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n@import clay.header.ambient_light\\n#endif\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n@import clay.header.ambient_sh_light\\n#endif\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n@import clay.header.directional_light\\n#endif\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\n\\n@import ecgl.common.ssaoMap.header\\n\\n@import ecgl.common.bumpMap.header\\n\\n@import clay.util.srgb\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.plugin.compute_shadow_map\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color);\\n#else\\n gl_FragColor = color;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\n #ifdef SRGB_DECODE\\n gl_FragColor *= sRGBToLinear(v_Color);\\n #else\\n gl_FragColor *= v_Color;\\n #endif\\n#endif\\n\\n @import ecgl.common.albedo.main\\n\\n @import ecgl.common.diffuseLayer.main\\n\\n gl_FragColor *= albedoTexel;\\n\\n vec3 N = v_Normal;\\n#ifdef DOUBLE_SIDED\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(eyePos - v_WorldPosition);\\n\\n if (dot(N, V) < 0.0) {\\n N = -N;\\n }\\n#endif\\n\\n float ambientFactor = 1.0;\\n\\n#ifdef BUMPMAP_ENABLED\\n N = bumpNormal(v_WorldPosition, v_Normal, N);\\n ambientFactor = dot(v_Normal, N);\\n#endif\\n\\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\\n\\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\\n\\n @import ecgl.common.ssaoMap.main\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\\n {\\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\\n }\\n#endif\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\\n {{\\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\\n }}\\n#endif\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\\n if(shadowEnabled)\\n {\\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\\n }\\n#endif\\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\\n {\\n vec3 lightDirection = -directionalLightDirection[i];\\n vec3 lightColor = directionalLightColor[i];\\n\\n float shadowContrib = 1.0;\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n if (shadowEnabled)\\n {\\n shadowContrib = shadowContribsDir[i];\\n }\\n#endif\\n\\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\\n\\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\\n }\\n#endif\\n\\n gl_FragColor.rgb *= diffuseColor;\\n\\n#ifdef ATMOSPHERE_ENABLED\\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\\n gl_FragColor.rgb += glowColor * atmoIntensity;\\n#endif\\n\\n @import ecgl.common.emissiveLayer.main\\n\\n @import ecgl.common.wireframe.fragmentMain\\n}\\n\\n@end\";\n","export default \"@export ecgl.realistic.vertex\\n\\n@import ecgl.common.transformUniforms\\n\\n@import ecgl.common.uv.header\\n\\n@import ecgl.common.attributes\\n\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\n#ifdef NORMALMAP_ENABLED\\nattribute vec4 tangent : TANGENT;\\nvarying vec3 v_Tangent;\\nvarying vec3 v_Bitangent;\\n#endif\\n\\n@import ecgl.common.vertexAnimation.header\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nvoid main()\\n{\\n\\n @import ecgl.common.uv.main\\n\\n @import ecgl.common.vertexAnimation.main\\n\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n\\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\\n\\n#ifdef VERTEX_COLOR\\n v_Color = a_Color;\\n#endif\\n\\n#ifdef NORMALMAP_ENABLED\\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\\n#endif\\n\\n @import ecgl.common.wireframe.vertexMain\\n\\n}\\n\\n@end\\n\\n\\n\\n@export ecgl.realistic.fragment\\n\\n#define LAYER_DIFFUSEMAP_COUNT 0\\n#define LAYER_EMISSIVEMAP_COUNT 0\\n#define PI 3.14159265358979\\n#define ROUGHNESS_CHANEL 0\\n#define METALNESS_CHANEL 1\\n\\n#define NORMAL_UP_AXIS 1\\n#define NORMAL_FRONT_AXIS 2\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform sampler2D diffuseMap;\\n\\nuniform sampler2D detailMap;\\nuniform sampler2D metalnessMap;\\nuniform sampler2D roughnessMap;\\n\\n@import ecgl.common.layers.header\\n\\nuniform float emissionIntensity: 1.0;\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nuniform float metalness : 0.0;\\nuniform float roughness : 0.5;\\n\\nuniform mat4 viewInverse : VIEWINVERSE;\\n\\n#ifdef ATMOSPHERE_ENABLED\\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\\nuniform vec3 glowColor;\\nuniform float glowPower;\\n#endif\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n@import clay.header.ambient_light\\n#endif\\n\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n@import clay.header.ambient_sh_light\\n#endif\\n\\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\\n@import clay.header.ambient_cubemap_light\\n#endif\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n@import clay.header.directional_light\\n#endif\\n\\n@import ecgl.common.normalMap.fragmentHeader\\n\\n@import ecgl.common.ssaoMap.header\\n\\n@import ecgl.common.bumpMap.header\\n\\n@import clay.util.srgb\\n\\n@import clay.util.rgbm\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.plugin.compute_shadow_map\\n\\nvec3 F_Schlick(float ndv, vec3 spec) {\\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\\n}\\n\\nfloat D_Phong(float g, float ndh) {\\n float a = pow(8192.0, g);\\n return (a + 2.0) / 8.0 * pow(ndh, a);\\n}\\n\\nvoid main()\\n{\\n vec4 albedoColor = color;\\n\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(eyePos - v_WorldPosition);\\n#ifdef VERTEX_COLOR\\n #ifdef SRGB_DECODE\\n albedoColor *= sRGBToLinear(v_Color);\\n #else\\n albedoColor *= v_Color;\\n #endif\\n#endif\\n\\n @import ecgl.common.albedo.main\\n\\n @import ecgl.common.diffuseLayer.main\\n\\n albedoColor *= albedoTexel;\\n\\n float m = metalness;\\n\\n#ifdef METALNESSMAP_ENABLED\\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\\n#endif\\n\\n vec3 baseColor = albedoColor.rgb;\\n albedoColor.rgb = baseColor * (1.0 - m);\\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\\n\\n float g = 1.0 - roughness;\\n\\n#ifdef ROUGHNESSMAP_ENABLED\\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\\n#endif\\n\\n vec3 N = v_Normal;\\n\\n#ifdef DOUBLE_SIDED\\n if (dot(N, V) < 0.0) {\\n N = -N;\\n }\\n#endif\\n\\n float ambientFactor = 1.0;\\n\\n#ifdef BUMPMAP_ENABLED\\n N = bumpNormal(v_WorldPosition, v_Normal, N);\\n ambientFactor = dot(v_Normal, N);\\n#endif\\n\\n@import ecgl.common.normalMap.fragmentMain\\n\\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\\n\\n vec3 diffuseTerm = vec3(0.0);\\n vec3 specularTerm = vec3(0.0);\\n\\n float ndv = clamp(dot(N, V), 0.0, 1.0);\\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\\n\\n @import ecgl.common.ssaoMap.main\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\\n {{\\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\\n }}\\n#endif\\n\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\\n {{\\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\\n }}\\n#endif\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\\n if(shadowEnabled)\\n {\\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\\n }\\n#endif\\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\\n {{\\n vec3 L = -directionalLightDirection[_idx_];\\n vec3 lc = directionalLightColor[_idx_];\\n\\n vec3 H = normalize(L + V);\\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\\n float ndh = clamp(dot(N, H), 0.0, 1.0);\\n\\n float shadowContrib = 1.0;\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n if (shadowEnabled)\\n {\\n shadowContrib = shadowContribsDir[_idx_];\\n }\\n#endif\\n\\n vec3 li = lc * ndl * shadowContrib;\\n\\n diffuseTerm += li;\\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\\n }}\\n#endif\\n\\n\\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\\n vec3 L = reflect(-V, N);\\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\\n float bias2 = rough2 * 5.0;\\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\\n vec3 envTexel2;\\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\\n {{\\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\\n }}\\n#endif\\n\\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\\n gl_FragColor.a = albedoColor.a;\\n\\n#ifdef ATMOSPHERE_ENABLED\\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\\n gl_FragColor.rgb += glowColor * atmoIntensity;\\n#endif\\n\\n#ifdef SRGB_ENCODE\\n gl_FragColor = linearTosRGB(gl_FragColor);\\n#endif\\n\\n @import ecgl.common.emissiveLayer.main\\n\\n @import ecgl.common.wireframe.fragmentMain\\n}\\n\\n@end\";\n","export default \"@export ecgl.hatching.vertex\\n\\n@import ecgl.realistic.vertex\\n\\n@end\\n\\n\\n@export ecgl.hatching.fragment\\n\\n#define NORMAL_UP_AXIS 1\\n#define NORMAL_FRONT_AXIS 2\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\\n\\nuniform mat4 viewInverse : VIEWINVERSE;\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n@import clay.header.ambient_light\\n#endif\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n@import clay.header.ambient_sh_light\\n#endif\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n@import clay.header.directional_light\\n#endif\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\n\\n@import ecgl.common.ssaoMap.header\\n\\n@import ecgl.common.bumpMap.header\\n\\n@import clay.util.srgb\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.plugin.compute_shadow_map\\n\\nuniform sampler2D hatch1;\\nuniform sampler2D hatch2;\\nuniform sampler2D hatch3;\\nuniform sampler2D hatch4;\\nuniform sampler2D hatch5;\\nuniform sampler2D hatch6;\\n\\nfloat shade(in float tone) {\\n vec4 c = vec4(1. ,1., 1., 1.);\\n float step = 1. / 6.;\\n vec2 uv = v_DetailTexcoord;\\n if (tone <= step / 2.0) {\\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\\n }\\n else if (tone <= step) {\\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\\n }\\n if(tone > step && tone <= 2. * step){\\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\\n }\\n if(tone > 2. * step && tone <= 3. * step){\\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\\n }\\n if(tone > 3. * step && tone <= 4. * step){\\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\\n }\\n if(tone > 4. * step && tone <= 5. * step){\\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\\n }\\n if(tone > 5. * step){\\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\\n }\\n\\n return c.r;\\n}\\n\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n vec4 inkColor = sRGBToLinear(color);\\n#else\\n vec4 inkColor = color;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\n #ifdef SRGB_DECODE\\n inkColor *= sRGBToLinear(v_Color);\\n #else\\n inkColor *= v_Color;\\n #endif\\n#endif\\n\\n vec3 N = v_Normal;\\n#ifdef DOUBLE_SIDED\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(eyePos - v_WorldPosition);\\n\\n if (dot(N, V) < 0.0) {\\n N = -N;\\n }\\n#endif\\n\\n float tone = 0.0;\\n\\n float ambientFactor = 1.0;\\n\\n#ifdef BUMPMAP_ENABLED\\n N = bumpNormal(v_WorldPosition, v_Normal, N);\\n ambientFactor = dot(v_Normal, N);\\n#endif\\n\\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\\n\\n @import ecgl.common.ssaoMap.main\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\\n {\\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\\n }\\n#endif\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\\n {{\\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\\n }}\\n#endif\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\\n if(shadowEnabled)\\n {\\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\\n }\\n#endif\\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\\n {\\n vec3 lightDirection = -directionalLightDirection[i];\\n float lightTone = dot(directionalLightColor[i], w);\\n\\n float shadowContrib = 1.0;\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n if (shadowEnabled)\\n {\\n shadowContrib = shadowContribsDir[i];\\n }\\n#endif\\n\\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\\n\\n tone += lightTone * clamp(ndl, 0.0, 1.0);\\n }\\n#endif\\n\\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\\n }\\n@end\\n\";\n","export default \"@export ecgl.sm.depth.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nattribute vec3 position : POSITION;\\nattribute vec2 texcoord : TEXCOORD_0;\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nuniform float percent : 1.0;\\n#endif\\n\\nvarying vec4 v_ViewPosition;\\nvarying vec2 v_Texcoord;\\n\\nvoid main(){\\n\\n#ifdef VERTEX_ANIMATION\\n vec3 pos = mix(prevPosition, position, percent);\\n#else\\n vec3 pos = position;\\n#endif\\n\\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\\n gl_Position = v_ViewPosition;\\n\\n v_Texcoord = texcoord;\\n\\n}\\n@end\\n\\n\\n\\n@export ecgl.sm.depth.fragment\\n\\n@import clay.sm.depth.fragment\\n\\n@end\";\n","import Mesh from 'claygl/src/Mesh';\nimport Renderer from 'claygl/src/Renderer';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Shader from 'claygl/src/Shader';\nimport Material from 'claygl/src/Material';\nimport Node3D from 'claygl/src/Node';\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\nimport Scene from 'claygl/src/Scene';\nimport LRUCache from 'zrender/lib/core/LRU';\nimport textureUtil from 'claygl/src/util/texture';\nimport EChartsSurface from './EChartsSurface';\nimport AmbientCubemapLight from 'claygl/src/light/AmbientCubemap';\nimport AmbientSHLight from 'claygl/src/light/AmbientSH';\nimport shUtil from 'claygl/src/util/sh';\nimport retrieve from './retrieve';\n\nimport SphereGeometry from 'claygl/src/geometry/Sphere';\nimport PlaneGeometry from 'claygl/src/geometry/Plane';\nimport CubeGeometry from 'claygl/src/geometry/Cube';\n\nimport AmbientLight from 'claygl/src/light/Ambient';\nimport DirectionalLight from 'claygl/src/light/Directional';\nimport PointLight from 'claygl/src/light/Point';\nimport SpotLight from 'claygl/src/light/Spot';\n\nimport PerspectiveCamera from 'claygl/src/camera/Perspective';\nimport OrthographicCamera from 'claygl/src/camera/Orthographic';\n\n// Math\nimport Vector2 from 'claygl/src/math/Vector2';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Vector4 from 'claygl/src/math/Vector4';\n\nimport Quaternion from 'claygl/src/math/Quaternion';\n\nimport Matrix2 from 'claygl/src/math/Matrix2';\nimport Matrix2d from 'claygl/src/math/Matrix2d';\nimport Matrix3 from 'claygl/src/math/Matrix3';\nimport Matrix4 from 'claygl/src/math/Matrix4';\n\nimport Plane from 'claygl/src/math/Plane';\nimport Ray from 'claygl/src/math/Ray';\nimport BoundingBox from 'claygl/src/math/BoundingBox';\nimport Frustum from 'claygl/src/math/Frustum';\n\nimport animatableMixin from './animatableMixin';\n// Some common shaders\n\nimport utilGLSL from 'claygl/src/shader/source/util.glsl.js';\nimport prezGLSL from 'claygl/src/shader/source/prez.glsl.js';\nimport commonGLSL from './shader/common.glsl.js';\nimport colorGLSL from './shader/color.glsl.js';\nimport lambertGLSL from './shader/lambert.glsl.js';\nimport realisticGLSL from './shader/realistic.glsl.js';\nimport hatchingGLSL from './shader/hatching.glsl.js';\nimport shadowGLSL from './shader/shadow.glsl.js';\n\nObject.assign(Node3D.prototype, animatableMixin);\n\nShader.import(utilGLSL);\nShader.import(prezGLSL);\nShader.import(commonGLSL);\nShader.import(colorGLSL);\nShader.import(lambertGLSL);\nShader.import(realisticGLSL);\nShader.import(hatchingGLSL);\nShader.import(shadowGLSL);\n\nfunction isValueNone(value) {\n return !value || value === 'none';\n}\n\nfunction isValueImage(value) {\n return value instanceof HTMLCanvasElement\n || value instanceof HTMLImageElement\n || value instanceof Image;\n}\n\nfunction isECharts(value) {\n return value.getZr && value.setOption;\n}\n\n// Overwrite addToScene and removeFromScene\nvar oldAddToScene = Scene.prototype.addToScene;\nvar oldRemoveFromScene = Scene.prototype.removeFromScene;\n\nScene.prototype.addToScene = function (node) {\n oldAddToScene.call(this, node);\n\n if (this.__zr) {\n var zr = this.__zr;\n node.traverse(function (child) {\n child.__zr = zr;\n if (child.addAnimatorsToZr) {\n child.addAnimatorsToZr(zr);\n }\n });\n }\n};\n\nScene.prototype.removeFromScene = function (node) {\n oldRemoveFromScene.call(this, node);\n\n node.traverse(function (child) {\n var zr = child.__zr;\n child.__zr = null;\n if (zr && child.removeAnimatorsFromZr) {\n child.removeAnimatorsFromZr(zr);\n }\n });\n};\n\n/**\n * @param {string} textureName\n * @param {string|HTMLImageElement|HTMLCanvasElement} imgValue\n * @param {module:echarts/ExtensionAPI} api\n * @param {Object} [textureOpts]\n */\nMaterial.prototype.setTextureImage = function (textureName, imgValue, api, textureOpts) {\n if (!this.shader) {\n return;\n }\n\n var zr = api.getZr();\n var material = this;\n var texture;\n material.autoUpdateTextureStatus = false;\n // disableTexture first\n material.disableTexture(textureName);\n if (!isValueNone(imgValue)) {\n texture = graphicGL.loadTexture(imgValue, api, textureOpts, function (texture) {\n material.enableTexture(textureName);\n zr && zr.refresh();\n });\n // Set texture immediately for other code to verify if have this texture.\n material.set(textureName, texture);\n }\n\n return texture;\n};\n\nvar graphicGL = {};\n\ngraphicGL.Renderer = Renderer;\n\ngraphicGL.Node = Node3D;\n\ngraphicGL.Mesh = Mesh;\n\ngraphicGL.Shader = Shader;\n\ngraphicGL.Material = Material;\n\ngraphicGL.Texture = Texture;\n\ngraphicGL.Texture2D = Texture2D;\n\n// Geometries\ngraphicGL.Geometry = Geometry;\ngraphicGL.SphereGeometry = SphereGeometry;\ngraphicGL.PlaneGeometry = PlaneGeometry;\ngraphicGL.CubeGeometry = CubeGeometry;\n\n// Lights\ngraphicGL.AmbientLight = AmbientLight;\ngraphicGL.DirectionalLight = DirectionalLight;\ngraphicGL.PointLight = PointLight;\ngraphicGL.SpotLight = SpotLight;\n\n// Cameras\ngraphicGL.PerspectiveCamera = PerspectiveCamera;\ngraphicGL.OrthographicCamera = OrthographicCamera;\n\n// Math\ngraphicGL.Vector2 = Vector2;\ngraphicGL.Vector3 = Vector3;\ngraphicGL.Vector4 = Vector4;\n\ngraphicGL.Quaternion = Quaternion;\n\ngraphicGL.Matrix2 = Matrix2;\ngraphicGL.Matrix2d = Matrix2d;\ngraphicGL.Matrix3 = Matrix3;\ngraphicGL.Matrix4 = Matrix4;\n\ngraphicGL.Plane = Plane;\ngraphicGL.Ray = Ray;\ngraphicGL.BoundingBox = BoundingBox;\ngraphicGL.Frustum = Frustum;\n\n// Texture utilities\n\nvar blankImage = textureUtil.createBlank('rgba(255,255,255,0)').image;\n\n\nfunction nearestPowerOfTwo(val) {\n return Math.pow(2, Math.round(Math.log(val) / Math.LN2));\n}\nfunction convertTextureToPowerOfTwo(texture) {\n if ((texture.wrapS === Texture.REPEAT || texture.wrapT === Texture.REPEAT) && texture.image) {\n // var canvas = document.createElement('canvas');\n var width = nearestPowerOfTwo(texture.width);\n var height = nearestPowerOfTwo(texture.height);\n if (width !== texture.width || height !== texture.height) {\n var canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n var ctx = canvas.getContext('2d');\n ctx.drawImage(texture.image, 0, 0, width, height);\n texture.image = canvas;\n }\n }\n}\n/**\n * @param {string|HTMLImageElement|HTMLCanvasElement} imgValue\n * @param {module:echarts/ExtensionAPI} api\n * @param {Object} [textureOpts]\n * @param {Function} cb\n */\n// TODO Promise, test\ngraphicGL.loadTexture = function (imgValue, api, textureOpts, cb) {\n if (typeof textureOpts === 'function') {\n cb = textureOpts;\n textureOpts = {};\n }\n textureOpts = textureOpts || {};\n\n var keys = Object.keys(textureOpts).sort();\n var prefix = '';\n for (var i = 0; i < keys.length; i++) {\n prefix += keys[i] + '_' + textureOpts[keys[i]] + '_';\n }\n\n var textureCache = api.__textureCache = api.__textureCache || new LRUCache(20);\n\n if (isECharts(imgValue)) {\n var id = imgValue.__textureid__;\n var textureObj = textureCache.get(prefix + id);\n if (!textureObj) {\n var surface = new EChartsSurface(imgValue);\n surface.onupdate = function () {\n api.getZr().refresh();\n };\n textureObj = {\n texture: surface.getTexture()\n };\n for (var i = 0; i < keys.length; i++) {\n textureObj.texture[keys[i]] = textureOpts[keys[i]];\n }\n id = imgValue.__textureid__ || '__ecgl_ec__' + textureObj.texture.__uid__;\n imgValue.__textureid__ = id;\n textureCache.put(prefix + id, textureObj);\n cb && cb(textureObj.texture);\n }\n else {\n textureObj.texture.surface.setECharts(imgValue);\n\n cb && cb(textureObj.texture);\n }\n return textureObj.texture;\n }\n else if (isValueImage(imgValue)) {\n var id = imgValue.__textureid__;\n var textureObj = textureCache.get(prefix + id);\n if (!textureObj) {\n textureObj = {\n texture: new graphicGL.Texture2D({\n image: imgValue\n })\n };\n for (var i = 0; i < keys.length; i++) {\n textureObj.texture[keys[i]] = textureOpts[keys[i]];\n }\n id = imgValue.__textureid__ || '__ecgl_image__' + textureObj.texture.__uid__;\n imgValue.__textureid__ = id;\n textureCache.put(prefix + id, textureObj);\n\n convertTextureToPowerOfTwo(textureObj.texture);\n // TODO Next tick?\n cb && cb(textureObj.texture);\n }\n return textureObj.texture;\n }\n else {\n var textureObj = textureCache.get(prefix + imgValue);\n if (textureObj) {\n if (textureObj.callbacks) {\n // Add to pending callbacks\n textureObj.callbacks.push(cb);\n }\n else {\n // TODO Next tick?\n cb && cb(textureObj.texture);\n }\n }\n else {\n // Maybe base64\n if (imgValue.match(/.hdr$|^data:application\\/octet-stream/)) {\n textureObj = {\n callbacks: [cb]\n };\n var texture = textureUtil.loadTexture(imgValue, {\n exposure: textureOpts.exposure,\n fileType: 'hdr'\n }, function () {\n texture.dirty();\n textureObj.callbacks.forEach(function (cb) {\n cb && cb(texture);\n });\n textureObj.callbacks = null;\n });\n textureObj.texture = texture;\n textureCache.put(prefix + imgValue, textureObj);\n }\n else {\n var texture = new graphicGL.Texture2D({\n image: new Image()\n });\n for (var i = 0; i < keys.length; i++) {\n texture[keys[i]] = textureOpts[keys[i]];\n }\n\n textureObj = {\n texture: texture,\n callbacks: [cb]\n };\n var originalImage = texture.image;\n originalImage.onload = function () {\n texture.image = originalImage;\n convertTextureToPowerOfTwo(texture);\n\n texture.dirty();\n textureObj.callbacks.forEach(function (cb) {\n cb && cb(texture);\n });\n textureObj.callbacks = null;\n };\n originalImage.crossOrigin = 'Anonymous';\n originalImage.src = imgValue;\n // Use blank image as place holder.\n texture.image = blankImage;\n\n textureCache.put(prefix + imgValue, textureObj);\n }\n }\n\n return textureObj.texture;\n }\n};\n\n/**\n * Create ambientCubemap and ambientSH light. respectively to have specular and diffuse light\n * @return {Object} { specular, diffuse }\n */\ngraphicGL.createAmbientCubemap = function (opt, renderer, api, cb) {\n opt = opt || {};\n var textureUrl = opt.texture;\n var exposure = retrieve.firstNotNull(opt.exposure, 1.0);\n\n var ambientCubemap = new AmbientCubemapLight({\n intensity: retrieve.firstNotNull(opt.specularIntensity, 1.0)\n });\n var ambientSH = new AmbientSHLight({\n intensity: retrieve.firstNotNull(opt.diffuseIntensity, 1.0),\n coefficients: [0.844, 0.712, 0.691, -0.037, 0.083, 0.167, 0.343, 0.288, 0.299, -0.041, -0.021, -0.009, -0.003, -0.041, -0.064, -0.011, -0.007, -0.004, -0.031, 0.034, 0.081, -0.060, -0.049, -0.060, 0.046, 0.056, 0.050]\n });\n\n\n ambientCubemap.cubemap = graphicGL.loadTexture(textureUrl, api, {\n exposure: exposure\n }, function () {\n // TODO Performance when multiple view\n ambientCubemap.cubemap.flipY = false;\n if (process.env.NODE_ENV !== 'production') {\n var time = Date.now();\n }\n ambientCubemap.prefilter(renderer, 32);\n if (process.env.NODE_ENV !== 'production') {\n var dTime = Date.now() - time;\n console.log('Prefilter environment map: ' + dTime + 'ms');\n }\n ambientSH.coefficients = shUtil.projectEnvironmentMap(renderer, ambientCubemap.cubemap, {\n lod: 1\n });\n\n cb && cb();\n\n // TODO Refresh ?\n });\n\n return {\n specular: ambientCubemap,\n diffuse: ambientSH\n };\n};\n\n/**\n * Create a blank texture for placeholder\n */\ngraphicGL.createBlankTexture = textureUtil.createBlank;\n\n/**\n * If value is image\n * @param {*}\n * @return {boolean}\n */\ngraphicGL.isImage = isValueImage;\n\ngraphicGL.additiveBlend = function (gl) {\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE);\n};\n\n/**\n * @param {string|Array.} colorStr\n * @param {Array.} [rgba]\n * @return {Array.} rgba\n */\ngraphicGL.parseColor = function (colorStr, rgba) {\n if (colorStr instanceof Array) {\n if (!rgba) {\n rgba = [];\n }\n // Color has been parsed.\n rgba[0] = colorStr[0];\n rgba[1] = colorStr[1];\n rgba[2] = colorStr[2];\n if (colorStr.length > 3) {\n rgba[3] = colorStr[3];\n }\n else {\n rgba[3] = 1;\n }\n return rgba;\n }\n\n rgba = echarts.color.parse(colorStr || '#000', rgba) || [0, 0, 0, 0];\n rgba[0] /= 255;\n rgba[1] /= 255;\n rgba[2] /= 255;\n return rgba;\n};\n\n/**\n * Convert alpha beta rotation to direction.\n * @param {number} alpha\n * @param {number} beta\n * @return {Array.}\n */\ngraphicGL.directionFromAlphaBeta = function (alpha, beta) {\n var theta = alpha / 180 * Math.PI + Math.PI / 2;\n var phi = -beta / 180 * Math.PI + Math.PI / 2;\n\n var dir = [];\n var r = Math.sin(theta);\n dir[0] = r * Math.cos(phi);\n dir[1] = -Math.cos(theta);\n dir[2] = r * Math.sin(phi);\n\n return dir;\n};\n/**\n * Get shadow resolution from shadowQuality configuration\n */\ngraphicGL.getShadowResolution = function (shadowQuality) {\n var shadowResolution = 1024;\n switch (shadowQuality) {\n case 'low':\n shadowResolution = 512;\n break;\n case 'medium':\n break;\n case 'high':\n shadowResolution = 2048;\n break;\n case 'ultra':\n shadowResolution = 4096;\n break;\n }\n return shadowResolution;\n};\n\n/**\n * Shading utilities\n */\ngraphicGL.COMMON_SHADERS = ['lambert', 'color', 'realistic', 'hatching', 'shadow'];\n\n/**\n * Create shader including vertex and fragment\n * @param {string} prefix.\n */\ngraphicGL.createShader = function (prefix) {\n if (prefix === 'ecgl.shadow') {\n prefix = 'ecgl.displayShadow';\n }\n var vertexShaderStr = Shader.source(prefix + '.vertex');\n var fragmentShaderStr = Shader.source(prefix + '.fragment');\n if (!vertexShaderStr) {\n console.error('Vertex shader of \\'%s\\' not exits', prefix);\n }\n if (!fragmentShaderStr) {\n console.error('Fragment shader of \\'%s\\' not exits', prefix);\n }\n var shader = new Shader(vertexShaderStr, fragmentShaderStr);\n shader.name = prefix;\n return shader;\n};\n\ngraphicGL.createMaterial = function (prefix, defines) {\n if (!(defines instanceof Array)) {\n defines = [defines];\n }\n var shader = graphicGL.createShader(prefix);\n var material = new Material({\n shader: shader\n });\n defines.forEach(function (defineName) {\n if (typeof defineName === 'string') {\n material.define(defineName);\n }\n });\n return material;\n};\n/**\n * Set material from model.\n * @param {clay.Material} material\n * @param {module:echarts/model/Model} model\n * @param {module:echarts/ExtensionAPI} api\n */\ngraphicGL.setMaterialFromModel = function (shading, material, model, api) {\n material.autoUpdateTextureStatus = false;\n\n var materialModel = model.getModel(shading + 'Material');\n var detailTexture = materialModel.get('detailTexture');\n var uvRepeat = retrieve.firstNotNull(materialModel.get('textureTiling'), 1.0);\n var uvOffset = retrieve.firstNotNull(materialModel.get('textureOffset'), 0.0);\n if (typeof uvRepeat === 'number') {\n uvRepeat = [uvRepeat, uvRepeat];\n }\n if (typeof uvOffset === 'number') {\n uvOffset = [uvOffset, uvOffset];\n }\n var repeatParam = (uvRepeat[0] > 1 || uvRepeat[1] > 1) ? graphicGL.Texture.REPEAT : graphicGL.Texture.CLAMP_TO_EDGE;\n var textureOpt = {\n anisotropic: 8,\n wrapS: repeatParam,\n wrapT: repeatParam\n };\n if (shading === 'realistic') {\n var roughness = materialModel.get('roughness');\n var metalness = materialModel.get('metalness');\n if (metalness != null) {\n // Try to treat as a texture, TODO More check\n if (isNaN(metalness)) {\n material.setTextureImage('metalnessMap', metalness, api, textureOpt);\n metalness = retrieve.firstNotNull(materialModel.get('metalnessAdjust'), 0.5);\n }\n }\n else {\n // Default metalness.\n metalness = 0;\n }\n if (roughness != null) {\n // Try to treat as a texture, TODO More check\n if (isNaN(roughness)) {\n material.setTextureImage('roughnessMap', roughness, api, textureOpt);\n roughness = retrieve.firstNotNull(materialModel.get('roughnessAdjust'), 0.5);\n }\n }\n else {\n // Default roughness.\n roughness = 0.5;\n }\n var normalTextureVal = materialModel.get('normalTexture');\n material.setTextureImage('detailMap', detailTexture, api, textureOpt);\n material.setTextureImage('normalMap', normalTextureVal, api, textureOpt);\n material.set({\n roughness: roughness,\n metalness: metalness,\n detailUvRepeat: uvRepeat,\n detailUvOffset: uvOffset\n });\n // var normalTexture = material.get('normalMap');\n // if (normalTexture) {\n // PENDING\n // normalTexture.format = Texture.SRGB;\n // }\n }\n else if (shading === 'lambert') {\n material.setTextureImage('detailMap', detailTexture, api, textureOpt);\n material.set({\n detailUvRepeat: uvRepeat,\n detailUvOffset: uvOffset\n });\n }\n else if (shading === 'color') {\n material.setTextureImage('detailMap', detailTexture, api, textureOpt);\n material.set({\n detailUvRepeat: uvRepeat,\n detailUvOffset: uvOffset\n });\n }\n else if (shading === 'hatching') {\n var tams = materialModel.get('hatchingTextures') || [];\n if (tams.length < 6) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Invalid hatchingTextures.');\n }\n }\n for (var i = 0; i < 6; i++) {\n material.setTextureImage('hatch' + (i + 1), tams[i], api, {\n anisotropic: 8,\n wrapS: graphicGL.Texture.REPEAT,\n wrapT: graphicGL.Texture.REPEAT\n });\n }\n material.set({\n detailUvRepeat: uvRepeat,\n detailUvOffset: uvOffset\n });\n }\n};\n\ngraphicGL.updateVertexAnimation = function (\n mappingAttributes, previousMesh, currentMesh, seriesModel\n) {\n var enableAnimation = seriesModel.get('animation');\n var duration = seriesModel.get('animationDurationUpdate');\n var easing = seriesModel.get('animationEasingUpdate');\n var shadowDepthMaterial = currentMesh.shadowDepthMaterial;\n\n if (enableAnimation && previousMesh && duration > 0\n // Only animate when bar count are not changed\n && previousMesh.geometry.vertexCount === currentMesh.geometry.vertexCount\n ) {\n currentMesh.material.define('vertex', 'VERTEX_ANIMATION');\n currentMesh.ignorePreZ = true;\n if (shadowDepthMaterial) {\n shadowDepthMaterial.define('vertex', 'VERTEX_ANIMATION');\n }\n for (var i = 0; i < mappingAttributes.length; i++) {\n currentMesh.geometry.attributes[mappingAttributes[i][0]].value =\n previousMesh.geometry.attributes[mappingAttributes[i][1]].value;\n }\n currentMesh.geometry.dirty();\n currentMesh.__percent = 0;\n currentMesh.material.set('percent', 0);\n currentMesh.stopAnimation();\n currentMesh.animate()\n .when(duration, {\n __percent: 1\n })\n .during(function () {\n currentMesh.material.set('percent', currentMesh.__percent);\n if (shadowDepthMaterial) {\n shadowDepthMaterial.set('percent', currentMesh.__percent);\n }\n })\n .done(function () {\n currentMesh.ignorePreZ = false;\n currentMesh.material.undefine('vertex', 'VERTEX_ANIMATION');\n if (shadowDepthMaterial) {\n shadowDepthMaterial.undefine('vertex', 'VERTEX_ANIMATION');\n }\n })\n .start(easing);\n }\n else {\n currentMesh.material.undefine('vertex', 'VERTEX_ANIMATION');\n if (shadowDepthMaterial) {\n shadowDepthMaterial.undefine('vertex', 'VERTEX_ANIMATION');\n }\n }\n};\n\nexport default graphicGL;","var requestAnimationFrame;\nrequestAnimationFrame = (typeof window !== 'undefined'\n && ((window.requestAnimationFrame && window.requestAnimationFrame.bind(window))\n || (window.msRequestAnimationFrame && window.msRequestAnimationFrame.bind(window))\n || window.mozRequestAnimationFrame\n || window.webkitRequestAnimationFrame)) || function (func) {\n return setTimeout(func, 16);\n};\nexport default requestAnimationFrame;\n","/**\n * Provide WebGL layer to zrender. Which is rendered on top of clay.\n *\n *\n * Relationship between zrender, LayerGL(renderer) and ViewGL(Scene, Camera, Viewport)\n * zrender\n * / \\\n * LayerGL LayerGL\n * (renderer) (renderer)\n * / \\\n * ViewGL ViewGL\n */\n\nimport * as echarts from 'echarts/lib/echarts';\nimport Renderer from 'claygl/src/Renderer';\nimport RayPicking from 'claygl/src/picking/RayPicking';\nimport Texture from 'claygl/src/Texture';\nimport graphicGL from '../util/graphicGL';\n\n// PENDING, clay. notifier is same with zrender Eventful\nimport notifier from 'claygl/src/core/mixin/notifier';\nimport requestAnimationFrame from 'zrender/lib/animation/requestAnimationFrame';\n\n/**\n * @constructor\n * @alias module:echarts-gl/core/LayerGL\n * @param {string} id Layer ID\n * @param {module:zrender/ZRender} zr\n */\nvar LayerGL = function (id, zr) {\n\n /**\n * Layer ID\n * @type {string}\n */\n this.id = id;\n\n /**\n * @type {module:zrender/ZRender}\n */\n this.zr = zr;\n\n /**\n * @type {clay.Renderer}\n */\n try {\n this.renderer = new Renderer({\n clearBit: 0,\n devicePixelRatio: zr.painter.dpr,\n preserveDrawingBuffer: true,\n // PENDING\n premultipliedAlpha: true\n });\n this.renderer.resize(zr.painter.getWidth(), zr.painter.getHeight());\n }\n catch (e) {\n this.renderer = null;\n this.dom = document.createElement('div');\n this.dom.style.cssText = 'position:absolute; left: 0; top: 0; right: 0; bottom: 0;';\n this.dom.className = 'ecgl-nowebgl';\n this.dom.innerHTML = 'Sorry, your browser does not support WebGL';\n\n console.error(e);\n return;\n }\n\n this.onglobalout = this.onglobalout.bind(this);\n zr.on('globalout', this.onglobalout);\n\n /**\n * Canvas dom for webgl rendering\n * @type {HTMLCanvasElement}\n */\n this.dom = this.renderer.canvas;\n var style = this.dom.style;\n style.position = 'absolute';\n style.left = '0';\n style.top = '0';\n\n /**\n * @type {Array.}\n */\n this.views = [];\n\n this._picking = new RayPicking({\n renderer: this.renderer\n });\n\n this._viewsToDispose = [];\n\n /**\n * Current accumulating id.\n */\n this._accumulatingId = 0;\n\n this._zrEventProxy = new echarts.graphic.Rect({\n shape: {x: -1, y: -1, width: 2, height: 2},\n // FIXME Better solution.\n __isGLToZRProxy: true\n });\n\n this._backgroundColor = null;\n\n this._disposed = false;\n};\n\nLayerGL.prototype.setUnpainted = function () {};\n\n/**\n * @param {module:echarts-gl/core/ViewGL} view\n */\nLayerGL.prototype.addView = function (view) {\n if (view.layer === this) {\n return;\n }\n // If needs to dispose in this layer. unmark it.\n var idx = this._viewsToDispose.indexOf(view);\n if (idx >= 0) {\n this._viewsToDispose.splice(idx, 1);\n }\n\n this.views.push(view);\n\n view.layer = this;\n\n var zr = this.zr;\n view.scene.traverse(function (node) {\n node.__zr = zr;\n if (node.addAnimatorsToZr) {\n node.addAnimatorsToZr(zr);\n }\n });\n};\n\nfunction removeFromZr(node) {\n var zr = node.__zr;\n node.__zr = null;\n if (zr && node.removeAnimatorsFromZr) {\n node.removeAnimatorsFromZr(zr);\n }\n}\n/**\n * @param {module:echarts-gl/core/ViewGL} view\n */\nLayerGL.prototype.removeView = function (view) {\n if (view.layer !== this) {\n return;\n }\n\n var idx = this.views.indexOf(view);\n if (idx >= 0) {\n this.views.splice(idx, 1);\n view.scene.traverse(removeFromZr, this);\n view.layer = null;\n\n // Mark to dispose in this layer.\n this._viewsToDispose.push(view);\n }\n};\n\n/**\n * Remove all views\n */\nLayerGL.prototype.removeViewsAll = function () {\n this.views.forEach(function (view) {\n view.scene.traverse(removeFromZr, this);\n view.layer = null;\n\n // Mark to dispose in this layer.\n this._viewsToDispose.push(view);\n }, this);\n\n this.views.length = 0;\n\n};\n\n/**\n * Resize the canvas and viewport, will be invoked by zrender\n * @param {number} width\n * @param {number} height\n */\nLayerGL.prototype.resize = function (width, height) {\n var renderer = this.renderer;\n renderer.resize(width, height);\n};\n\n/**\n * Clear color and depth\n * @return {[type]} [description]\n */\nLayerGL.prototype.clear = function () {\n var gl = this.renderer.gl;\n var clearColor = this._backgroundColor || [0, 0, 0, 0];\n gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);\n gl.depthMask(true);\n gl.colorMask(true, true, true, true);\n gl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT);\n};\n\n/**\n * Clear depth\n */\nLayerGL.prototype.clearDepth = function () {\n var gl = this.renderer.gl;\n gl.clear(gl.DEPTH_BUFFER_BIT);\n};\n\n/**\n * Clear color\n */\nLayerGL.prototype.clearColor = function () {\n var gl = this.renderer.gl;\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n};\n\n/**\n * Mark layer to refresh next tick\n */\nLayerGL.prototype.needsRefresh = function () {\n this.zr.refresh();\n};\n\n/**\n * Refresh the layer, will be invoked by zrender\n */\nLayerGL.prototype.refresh = function (bgColor) {\n\n this._backgroundColor = bgColor ? graphicGL.parseColor(bgColor) : [0, 0, 0, 0];\n this.renderer.clearColor = this._backgroundColor;\n\n for (var i = 0; i < this.views.length; i++) {\n this.views[i].prepareRender(this.renderer);\n }\n\n this._doRender(false);\n\n // Auto dispose unused resources on GPU, like program(shader), texture, geometry(buffers)\n this._trackAndClean();\n\n // Dispose trashed views\n for (var i = 0; i < this._viewsToDispose.length; i++) {\n this._viewsToDispose[i].dispose(this.renderer);\n }\n this._viewsToDispose.length = 0;\n\n this._startAccumulating();\n};\n\n\nLayerGL.prototype.renderToCanvas = function (ctx) {\n // PENDING will block the page\n this._startAccumulating(true);\n ctx.drawImage(this.dom, 0, 0, ctx.canvas.width, ctx.canvas.height);\n};\n\nLayerGL.prototype._doRender = function (accumulating) {\n this.clear();\n this.renderer.saveViewport();\n for (var i = 0; i < this.views.length; i++) {\n this.views[i].render(this.renderer, accumulating);\n }\n this.renderer.restoreViewport();\n};\n\n/**\n * Stop accumulating\n */\nLayerGL.prototype._stopAccumulating = function () {\n this._accumulatingId = 0;\n clearTimeout(this._accumulatingTimeout);\n};\n\nvar accumulatingId = 1;\n/**\n * Start accumulating all the views.\n * Accumulating is for antialising and have more sampling in SSAO\n * @private\n */\nLayerGL.prototype._startAccumulating = function (immediate) {\n var self = this;\n this._stopAccumulating();\n\n var needsAccumulate = false;\n for (var i = 0; i < this.views.length; i++) {\n needsAccumulate = this.views[i].needsAccumulate() || needsAccumulate;\n }\n if (!needsAccumulate) {\n return;\n }\n\n function accumulate(id) {\n if (!self._accumulatingId || id !== self._accumulatingId) {\n return;\n }\n\n var isFinished = true;\n for (var i = 0; i < self.views.length; i++) {\n isFinished = self.views[i].isAccumulateFinished() && needsAccumulate;\n }\n\n if (!isFinished) {\n self._doRender(true);\n\n if (immediate) {\n accumulate(id);\n }\n else {\n requestAnimationFrame(function () {\n accumulate(id);\n });\n }\n }\n }\n\n this._accumulatingId = accumulatingId++;\n\n if (immediate) {\n accumulate(self._accumulatingId);\n }\n else {\n this._accumulatingTimeout = setTimeout(function () {\n accumulate(self._accumulatingId);\n }, 50);\n }\n};\n\nLayerGL.prototype._trackAndClean = function () {\n var textureList = [];\n var geometriesList = [];\n\n // Mark all resources unused;\n if (this._textureList) {\n markUnused(this._textureList);\n markUnused(this._geometriesList);\n }\n\n for (var i = 0; i < this.views.length; i++) {\n collectResources(this.views[i].scene, textureList, geometriesList);\n }\n\n // Dispose those unsed resources.\n if (this._textureList) {\n checkAndDispose(this.renderer, this._textureList);\n checkAndDispose(this.renderer, this._geometriesList);\n }\n\n this._textureList = textureList;\n this._geometriesList = geometriesList;\n};\n\nfunction markUnused(resourceList) {\n for (var i = 0; i < resourceList.length; i++) {\n resourceList[i].__used__ = 0;\n }\n}\nfunction checkAndDispose(renderer, resourceList) {\n for (var i = 0; i < resourceList.length; i++) {\n if (!resourceList[i].__used__) {\n resourceList[i].dispose(renderer);\n }\n }\n}\nfunction updateUsed(resource, list) {\n resource.__used__ = resource.__used__ || 0;\n resource.__used__++;\n if (resource.__used__ === 1) {\n // Don't push to the list twice.\n list.push(resource);\n }\n}\nfunction collectResources(scene, textureResourceList, geometryResourceList) {\n var prevMaterial;\n var prevGeometry;\n scene.traverse(function (renderable) {\n if (renderable.isRenderable()) {\n var geometry = renderable.geometry;\n var material = renderable.material;\n\n // TODO optimize!!\n if (material !== prevMaterial) {\n var textureUniforms = material.getTextureUniforms();\n for (var u = 0; u < textureUniforms.length; u++) {\n var uniformName = textureUniforms[u];\n var val = material.uniforms[uniformName].value;\n if (!val) {\n continue;\n }\n if (val instanceof Texture) {\n updateUsed(val, textureResourceList);\n }\n else if (val instanceof Array) {\n for (var k = 0; k < val.length; k++) {\n if (val[k] instanceof Texture) {\n updateUsed(val[k], textureResourceList);\n }\n }\n }\n }\n }\n if (geometry !== prevGeometry) {\n updateUsed(geometry, geometryResourceList);\n }\n\n prevMaterial = material;\n prevGeometry = geometry;\n }\n });\n\n for (var k = 0; k < scene.lights.length; k++) {\n // Track AmbientCubemap\n if (scene.lights[k].cubemap) {\n updateUsed(scene.lights[k].cubemap, textureResourceList);\n }\n }\n}\n/**\n * Dispose the layer\n */\nLayerGL.prototype.dispose = function () {\n if (this._disposed) {\n return;\n }\n this._stopAccumulating();\n if (this._textureList) {\n markUnused(this._textureList);\n markUnused(this._geometriesList);\n checkAndDispose(this.renderer, this._textureList);\n checkAndDispose(this.renderer, this._geometriesList);\n }\n this.zr.off('globalout', this.onglobalout);\n this._disposed = true;\n};\n\n// Event handlers\nLayerGL.prototype.onmousedown = function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n e = e.event;\n var obj = this.pickObject(e.offsetX, e.offsetY);\n if (obj) {\n this._dispatchEvent('mousedown', e, obj);\n this._dispatchDataEvent('mousedown', e, obj);\n }\n\n this._downX = e.offsetX;\n this._downY = e.offsetY;\n};\n\nLayerGL.prototype.onmousemove = function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n e = e.event;\n var obj = this.pickObject(e.offsetX, e.offsetY);\n\n var target = obj && obj.target;\n var lastHovered = this._hovered;\n this._hovered = obj;\n\n if (lastHovered && target !== lastHovered.target) {\n lastHovered.relatedTarget = target;\n this._dispatchEvent('mouseout', e, lastHovered);\n // this._dispatchDataEvent('mouseout', e, lastHovered);\n\n this.zr.setCursorStyle('default');\n }\n\n this._dispatchEvent('mousemove', e, obj);\n\n if (obj) {\n this.zr.setCursorStyle('pointer');\n\n if (!lastHovered || (target !== lastHovered.target)) {\n this._dispatchEvent('mouseover', e, obj);\n // this._dispatchDataEvent('mouseover', e, obj);\n }\n }\n\n this._dispatchDataEvent('mousemove', e, obj);\n};\n\nLayerGL.prototype.onmouseup = function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n e = e.event;\n var obj = this.pickObject(e.offsetX, e.offsetY);\n\n if (obj) {\n this._dispatchEvent('mouseup', e, obj);\n this._dispatchDataEvent('mouseup', e, obj);\n }\n\n this._upX = e.offsetX;\n this._upY = e.offsetY;\n};\n\nLayerGL.prototype.onclick = LayerGL.prototype.dblclick = function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n // Ignore click event if mouse moved\n var dx = this._upX - this._downX;\n var dy = this._upY - this._downY;\n if (Math.sqrt(dx * dx + dy * dy) > 20) {\n return;\n }\n\n e = e.event;\n var obj = this.pickObject(e.offsetX, e.offsetY);\n\n if (obj) {\n this._dispatchEvent(e.type, e, obj);\n this._dispatchDataEvent(e.type, e, obj);\n }\n\n // Try set depth of field onclick\n var result = this._clickToSetFocusPoint(e);\n if (result) {\n var success = result.view.setDOFFocusOnPoint(result.distance);\n if (success) {\n this.zr.refresh();\n }\n }\n};\n\nLayerGL.prototype._clickToSetFocusPoint = function (e) {\n var renderer = this.renderer;\n var oldViewport = renderer.viewport;\n for (var i = this.views.length - 1; i >= 0; i--) {\n var viewGL = this.views[i];\n if (viewGL.hasDOF() && viewGL.containPoint(e.offsetX, e.offsetY)) {\n this._picking.scene = viewGL.scene;\n this._picking.camera = viewGL.camera;\n // Only used for picking, renderer.setViewport will also invoke gl.viewport.\n // Set directly, PENDING.\n renderer.viewport = viewGL.viewport;\n var result = this._picking.pick(e.offsetX, e.offsetY, true);\n if (result) {\n result.view = viewGL;\n return result;\n }\n }\n }\n renderer.viewport = oldViewport;\n};\n\nLayerGL.prototype.onglobalout = function (e) {\n var lastHovered = this._hovered;\n if (lastHovered) {\n this._dispatchEvent('mouseout', e, {\n target: lastHovered.target\n });\n }\n};\n\nLayerGL.prototype.pickObject = function (x, y) {\n\n var output = [];\n var renderer = this.renderer;\n var oldViewport = renderer.viewport;\n for (var i = 0; i < this.views.length; i++) {\n var viewGL = this.views[i];\n if (viewGL.containPoint(x, y)) {\n this._picking.scene = viewGL.scene;\n this._picking.camera = viewGL.camera;\n // Only used for picking, renderer.setViewport will also invoke gl.viewport.\n // Set directly, PENDING.\n renderer.viewport = viewGL.viewport;\n this._picking.pickAll(x, y, output);\n }\n }\n renderer.viewport = oldViewport;\n output.sort(function (a, b) {\n return a.distance - b.distance;\n });\n return output[0];\n};\n\nLayerGL.prototype._dispatchEvent = function (eveName, originalEvent, newEvent) {\n if (!newEvent) {\n newEvent = {};\n }\n var current = newEvent.target;\n\n newEvent.cancelBubble = false;\n newEvent.event = originalEvent;\n newEvent.type = eveName;\n newEvent.offsetX = originalEvent.offsetX;\n newEvent.offsetY = originalEvent.offsetY;\n\n while (current) {\n current.trigger(eveName, newEvent);\n current = current.getParent();\n\n if (newEvent.cancelBubble) {\n break;\n }\n }\n\n this._dispatchToView(eveName, newEvent);\n};\n\nLayerGL.prototype._dispatchDataEvent = function (eveName, originalEvent, newEvent) {\n var mesh = newEvent && newEvent.target;\n\n var dataIndex = mesh && mesh.dataIndex;\n var seriesIndex = mesh && mesh.seriesIndex;\n // Custom event data\n var eventData = mesh && mesh.eventData;\n var elChangedInMouseMove = false;\n\n var eventProxy = this._zrEventProxy;\n eventProxy.x = originalEvent.offsetX;\n eventProxy.y = originalEvent.offsetY;\n eventProxy.update();\n\n var targetInfo = {\n target: eventProxy\n };\n const ecData = echarts.helper.getECData(eventProxy);\n if (eveName === 'mousemove') {\n if (dataIndex != null) {\n if (dataIndex !== this._lastDataIndex) {\n if (parseInt(this._lastDataIndex, 10) >= 0) {\n ecData.dataIndex = this._lastDataIndex;\n ecData.seriesIndex = this._lastSeriesIndex;\n // FIXME May cause double events.\n this.zr.handler.dispatchToElement(targetInfo, 'mouseout', originalEvent);\n }\n elChangedInMouseMove = true;\n }\n }\n else if (eventData != null) {\n if (eventData !== this._lastEventData) {\n if (this._lastEventData != null) {\n ecData.eventData = this._lastEventData;\n // FIXME May cause double events.\n this.zr.handler.dispatchToElement(targetInfo, 'mouseout', originalEvent);\n }\n elChangedInMouseMove = true;\n }\n }\n this._lastEventData = eventData;\n this._lastDataIndex = dataIndex;\n this._lastSeriesIndex = seriesIndex;\n }\n\n ecData.eventData = eventData;\n ecData.dataIndex = dataIndex;\n ecData.seriesIndex = seriesIndex;\n\n if (eventData != null || (parseInt(dataIndex, 10) >= 0 && parseInt(seriesIndex, 10) >= 0)) {\n this.zr.handler.dispatchToElement(targetInfo, eveName, originalEvent);\n\n if (elChangedInMouseMove) {\n this.zr.handler.dispatchToElement(targetInfo, 'mouseover', originalEvent);\n }\n }\n};\n\nLayerGL.prototype._dispatchToView = function (eventName, e) {\n for (var i = 0; i < this.views.length; i++) {\n if (this.views[i].containPoint(e.offsetX, e.offsetY)) {\n this.views[i].trigger(eventName, e);\n }\n }\n};\n\nObject.assign(LayerGL.prototype, notifier);\n\nexport default LayerGL;","import * as echarts from 'echarts/lib/echarts';\n\nvar GL_SERIES = ['bar3D', 'line3D', 'map3D', 'scatter3D', 'surface', 'lines3D', 'scatterGL', 'scatter3D'];\n\nfunction convertNormalEmphasis(option, optType) {\n if (option && option[optType] && (option[optType].normal || option[optType].emphasis)) {\n var normalOpt = option[optType].normal;\n var emphasisOpt = option[optType].emphasis;\n\n if (normalOpt) {\n option[optType] = normalOpt;\n }\n if (emphasisOpt) {\n option.emphasis = option.emphasis || {};\n option.emphasis[optType] = emphasisOpt;\n }\n }\n}\n\nfunction convertNormalEmphasisForEach(option) {\n convertNormalEmphasis(option, 'itemStyle');\n convertNormalEmphasis(option, 'lineStyle');\n convertNormalEmphasis(option, 'areaStyle');\n convertNormalEmphasis(option, 'label');\n}\n\nfunction removeTextStyleInAxis(axesOpt) {\n if (!axesOpt) {\n return;\n }\n if (!(axesOpt instanceof Array)) {\n axesOpt = [axesOpt];\n }\n echarts.util.each(axesOpt, function (axisOpt) {\n if (axisOpt.axisLabel) {\n var labelOpt = axisOpt.axisLabel;\n Object.assign(labelOpt, labelOpt.textStyle);\n labelOpt.textStyle = null;\n }\n });\n}\n\nexport default function (option) {\n echarts.util.each(option.series, function (series) {\n if (echarts.util.indexOf(GL_SERIES, series.type) >= 0) {\n convertNormalEmphasisForEach(series);\n\n // Compatitable with original mapbox\n if (series.coordinateSystem === 'mapbox') {\n series.coordinateSystem = 'mapbox3D';\n option.mapbox3D = option.mapbox;\n }\n }\n });\n\n removeTextStyleInAxis(option.xAxis3D);\n removeTextStyleInAxis(option.yAxis3D);\n removeTextStyleInAxis(option.zAxis3D);\n removeTextStyleInAxis(option.grid3D);\n\n convertNormalEmphasis(option.geo3D);\n};","/**\n * echarts-gl\n * Extension pack of ECharts providing 3d plots and globe visualization\n *\n * Copyright (c) 2014, echarts-gl\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport * as echarts from 'echarts/lib/echarts';\nimport LayerGL from './core/LayerGL';\nimport backwardCompat from './preprocessor/backwardCompat';\n\nfunction EChartsGL (zr) {\n this._layers = {};\n\n this._zr = zr;\n}\n\nEChartsGL.prototype.update = function (ecModel, api) {\n var self = this;\n var zr = api.getZr();\n\n if (!zr.getWidth() || !zr.getHeight()) {\n console.warn('Dom has no width or height');\n return;\n }\n\n function getLayerGL(model) {\n // Disable auto sleep in gl layer.\n zr.setSleepAfterStill(0);\n\n var zlevel;\n // Host on coordinate system.\n if (model.coordinateSystem && model.coordinateSystem.model) {\n zlevel = model.get('zlevel');\n }\n else {\n zlevel = model.get('zlevel');\n }\n\n var layers = self._layers;\n var layerGL = layers[zlevel];\n if (!layerGL) {\n layerGL = layers[zlevel] = new LayerGL('gl-' + zlevel, zr);\n\n if (zr.painter.isSingleCanvas()) {\n layerGL.virtual = true;\n // If container is canvas, use image to represent LayerGL\n // FIXME Performance\n var img = new echarts.graphic.Image({\n z: 1e4,\n style: {\n image: layerGL.renderer.canvas\n },\n silent: true\n });\n layerGL.__hostImage = img;\n\n zr.add(img);\n }\n\n zr.painter.insertLayer(zlevel, layerGL);\n }\n if (layerGL.__hostImage) {\n layerGL.__hostImage.setStyle({\n width: layerGL.renderer.getWidth(),\n height: layerGL.renderer.getHeight()\n });\n }\n\n return layerGL;\n }\n\n function setSilent(groupGL, silent) {\n if (groupGL) {\n groupGL.traverse(function (mesh) {\n if (mesh.isRenderable && mesh.isRenderable()) {\n mesh.ignorePicking = mesh.$ignorePicking != null\n ? mesh.$ignorePicking : silent;\n }\n });\n }\n }\n\n for (var zlevel in this._layers) {\n this._layers[zlevel].removeViewsAll();\n }\n\n ecModel.eachComponent(function (componentType, componentModel) {\n if (componentType !== 'series') {\n var view = api.getViewOfComponentModel(componentModel);\n var coordSys = componentModel.coordinateSystem;\n // View with __ecgl__ flag is a echarts-gl component.\n if (view.__ecgl__) {\n var viewGL;\n if (coordSys) {\n if (!coordSys.viewGL) {\n console.error('Can\\'t find viewGL in coordinateSystem of component ' + componentModel.id);\n return;\n }\n viewGL = coordSys.viewGL;\n }\n else {\n if (!componentModel.viewGL) {\n console.error('Can\\'t find viewGL of component ' + componentModel.id);\n return;\n }\n viewGL = coordSys.viewGL;\n }\n\n var viewGL = coordSys.viewGL;\n var layerGL = getLayerGL(componentModel);\n\n layerGL.addView(viewGL);\n\n view.afterRender && view.afterRender(\n componentModel, ecModel, api, layerGL\n );\n\n setSilent(view.groupGL, componentModel.get('silent'));\n }\n }\n });\n\n ecModel.eachSeries(function (seriesModel) {\n var chartView = api.getViewOfSeriesModel(seriesModel);\n var coordSys = seriesModel.coordinateSystem;\n if (chartView.__ecgl__) {\n if ((coordSys && !coordSys.viewGL) && !chartView.viewGL) {\n console.error('Can\\'t find viewGL of series ' + chartView.id);\n return;\n }\n var viewGL = (coordSys && coordSys.viewGL) || chartView.viewGL;\n // TODO Check zlevel not same with component of coordinate system ?\n var layerGL = getLayerGL(seriesModel);\n layerGL.addView(viewGL);\n\n chartView.afterRender && chartView.afterRender(\n seriesModel, ecModel, api, layerGL\n );\n\n setSilent(chartView.groupGL, seriesModel.get('silent'));\n }\n });\n};\n\n// Hack original getRenderedCanvas. Will removed after new echarts released\n// TODO\n\necharts.registerPostInit(function (chart) {\n var zr = chart.getZr();\n var oldDispose = zr.painter.dispose;\n\n zr.painter.dispose = function () {\n this.eachOtherLayer(function (layer) {\n if (layer instanceof LayerGL) {\n layer.dispose();\n }\n });\n oldDispose.call(this);\n }\n zr.painter.getRenderedCanvas = function (opts) {\n opts = opts || {};\n if (this._singleCanvas) {\n return this._layers[0].dom;\n }\n\n var canvas = document.createElement('canvas');\n var dpr = opts.pixelRatio || this.dpr;\n canvas.width = this.getWidth() * dpr;\n canvas.height = this.getHeight() * dpr;\n var ctx = canvas.getContext('2d');\n ctx.dpr = dpr;\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n if (opts.backgroundColor) {\n ctx.fillStyle = opts.backgroundColor;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n }\n\n var displayList = this.storage.getDisplayList(true);\n\n var scope = {};\n var zlevel;\n\n var self = this;\n function findAndDrawOtherLayer(smaller, larger) {\n var zlevelList = self._zlevelList;\n if (smaller == null) {\n smaller = -Infinity;\n }\n var intermediateLayer;\n for (var i = 0; i < zlevelList.length; i++) {\n var z = zlevelList[i];\n var layer = self._layers[z];\n if (!layer.__builtin__ && z > smaller && z < larger) {\n intermediateLayer = layer;\n break;\n }\n }\n if (intermediateLayer && intermediateLayer.renderToCanvas) {\n ctx.save();\n intermediateLayer.renderToCanvas(ctx);\n ctx.restore();\n }\n }\n var layer = {\n ctx: ctx\n };\n for (var i = 0; i < displayList.length; i++) {\n var el = displayList[i];\n\n if (el.zlevel !== zlevel) {\n findAndDrawOtherLayer(zlevel, el.zlevel);\n zlevel = el.zlevel;\n }\n this._doPaintEl(el, layer, true, null, scope);\n }\n\n findAndDrawOtherLayer(zlevel, Infinity);\n\n return canvas;\n };\n});\n\necharts.registerPostUpdate(function (ecModel, api) {\n var zr = api.getZr();\n\n var egl = zr.__egl = zr.__egl || new EChartsGL(zr);\n\n egl.update(ecModel, api);\n});\n\necharts.registerPreprocessor(backwardCompat);\n\n\nexport default EChartsGL;","export default {\n defaultOption: {\n\n viewControl: {\n // perspective, orthographic.\n // TODO Isometric\n projection: 'perspective',\n // If rotate on on init\n autoRotate: false,\n // cw or ccw\n autoRotateDirection: 'cw',\n // Degree per second\n autoRotateSpeed: 10,\n\n // Start rotating after still for a given time\n // default is 3 seconds\n autoRotateAfterStill: 3,\n\n // Rotate, zoom damping.\n damping: 0.8,\n // Sensitivities for operations.\n // Can be array to set x,y respectively\n rotateSensitivity: 1,\n zoomSensitivity: 1,\n // Can be array to set x,y respectively\n panSensitivity: 1,\n // Which mouse button do rotate or pan\n panMouseButton: 'middle',\n rotateMouseButton: 'left',\n\n // Distance to the target\n // Only available when camera is perspective.\n distance: 150,\n // Min distance mouse can zoom in\n minDistance: 40,\n // Max distance mouse can zoom out\n maxDistance: 400,\n\n // Size of viewing volume.\n // Only available when camera is orthographic\n orthographicSize: 150,\n maxOrthographicSize: 400,\n minOrthographicSize: 20,\n\n // Center view point\n center: [0, 0, 0],\n // Alpha angle for top-down rotation\n // Positive to rotate to top.\n alpha: 0,\n // beta angle for left-right rotation\n // Positive to rotate to right.\n beta: 0,\n\n minAlpha: -90,\n maxAlpha: 90\n\n // minBeta: -Infinity\n // maxBeta: -Infinity\n }\n },\n\n setView: function (opts) {\n opts = opts || {};\n this.option.viewControl = this.option.viewControl || {};\n if (opts.alpha != null) {\n this.option.viewControl.alpha = opts.alpha;\n }\n if (opts.beta != null) {\n this.option.viewControl.beta = opts.beta;\n }\n if (opts.distance != null) {\n this.option.viewControl.distance = opts.distance;\n }\n if (opts.center != null) {\n this.option.viewControl.center = opts.center;\n }\n }\n};","export default {\n defaultOption: {\n // Post effect\n postEffect: {\n enable: false,\n\n bloom: {\n enable: true,\n intensity: 0.1\n },\n depthOfField: {\n enable: false,\n focalRange: 20,\n focalDistance: 50,\n blurRadius: 10,\n fstop: 2.8,\n quality: 'medium'\n },\n\n screenSpaceAmbientOcclusion: {\n enable: false,\n radius: 2,\n // low, medium, high, ultra\n quality: 'medium',\n intensity: 1\n },\n\n screenSpaceReflection: {\n enable: false,\n quality: 'medium',\n maxRoughness: 0.8\n },\n\n colorCorrection: {\n enable: true,\n\n exposure: 0,\n\n brightness: 0,\n\n contrast: 1,\n\n saturation: 1,\n\n lookupTexture: ''\n },\n\n edge: {\n enable: false\n },\n\n FXAA: {\n enable: false\n }\n },\n\n // Temporal super sampling when the picture is still.\n temporalSuperSampling: {\n // Only enabled when postEffect is enabled\n enable: 'auto'\n }\n }\n};","export default {\n defaultOption: {\n // Light is available when material.shading is not color\n light: {\n // Main light\n main: {\n shadow: false,\n // low, medium, high, ultra\n shadowQuality: 'high',\n\n color: '#fff',\n intensity: 1,\n\n alpha: 0,\n beta: 0\n },\n ambient: {\n color: '#fff',\n intensity: 0.2\n },\n ambientCubemap: {\n // Panorama environment texture,\n // Support .hdr and commmon web formats.\n texture: null,\n // Available when texture is hdr.\n exposure: 1,\n // Intensity for diffuse term\n diffuseIntensity: 0.5,\n // Intensity for specular term, only available when shading is realastic\n specularIntensity: 0.5\n }\n }\n }\n};","import * as echarts from 'echarts/lib/echarts';\nimport componentViewControlMixin from '../common/componentViewControlMixin';\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\n\nvar Grid3DModel = echarts.ComponentModel.extend({\n\n type: 'grid3D',\n\n dependencies: ['xAxis3D', 'yAxis3D', 'zAxis3D'],\n\n defaultOption: {\n\n show: true,\n\n zlevel: -10,\n\n // Layout used for viewport\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n\n environment: 'auto',\n\n // Dimension of grid3D\n boxWidth: 100,\n boxHeight: 100,\n boxDepth: 100,\n\n // Common axis options.\n axisPointer: {\n show: true,\n lineStyle: {\n color: 'rgba(0, 0, 0, 0.8)',\n width: 1\n },\n\n label: {\n show: true,\n // (dimValue: number, value: Array) => string\n formatter: null,\n\n // TODO, Consider boxWidth\n margin: 8,\n // backgroundColor: '#ffbd67',\n // borderColor: '#000',\n // borderWidth: 0,\n\n textStyle: {\n fontSize: 14,\n color: '#fff',\n backgroundColor: 'rgba(0,0,0,0.5)',\n padding: 3,\n borderRadius: 3\n }\n }\n },\n\n axisLine: {\n show: true,\n lineStyle: {\n color: '#333',\n width: 2,\n type: 'solid'\n }\n },\n\n axisTick: {\n show: true,\n inside: false,\n length: 3,\n lineStyle: {\n width: 1\n }\n },\n axisLabel: {\n show: true,\n inside: false,\n rotate: 0,\n margin: 8,\n textStyle: {\n fontSize: 12\n }\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: ['#ccc'],\n width: 1,\n type: 'solid'\n }\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)']\n }\n },\n\n // Light options\n light: {\n main: {\n // Alpha angle for top-down rotation\n // Positive to rotate to top.\n alpha: 30,\n // beta angle for left-right rotation\n // Positive to rotate to right.\n beta: 40\n },\n ambient: {\n intensity: 0.4\n }\n },\n\n viewControl: {\n // Small damping for precise control.\n // damping: 0.1,\n\n // Alpha angle for top-down rotation\n // Positive to rotate to top.\n alpha: 20,\n // beta angle for left-right rotation\n // Positive to rotate to right.\n beta: 40,\n\n autoRotate: false,\n\n // Distance to the surface of grid3D.\n distance: 200,\n\n // Min distance to the surface of grid3D\n minDistance: 40,\n // Max distance to the surface of grid3D\n maxDistance: 400\n }\n }\n});\n\necharts.util.merge(Grid3DModel.prototype, componentViewControlMixin);\necharts.util.merge(Grid3DModel.prototype, componentPostEffectMixin);\necharts.util.merge(Grid3DModel.prototype, componentLightMixin);\n\nexport default Grid3DModel;\n\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import LRU from '../../core/LRU';\nvar globalImageCache = new LRU(50);\nexport function findExistImage(newImageOrSrc) {\n if (typeof newImageOrSrc === 'string') {\n var cachedImgObj = globalImageCache.get(newImageOrSrc);\n return cachedImgObj && cachedImgObj.image;\n }\n else {\n return newImageOrSrc;\n }\n}\nexport function createOrUpdateImage(newImageOrSrc, image, hostEl, onload, cbPayload) {\n if (!newImageOrSrc) {\n return image;\n }\n else if (typeof newImageOrSrc === 'string') {\n if ((image && image.__zrImageSrc === newImageOrSrc) || !hostEl) {\n return image;\n }\n var cachedImgObj = globalImageCache.get(newImageOrSrc);\n var pendingWrap = { hostEl: hostEl, cb: onload, cbPayload: cbPayload };\n if (cachedImgObj) {\n image = cachedImgObj.image;\n !isImageReady(image) && cachedImgObj.pending.push(pendingWrap);\n }\n else {\n image = new Image();\n image.onload = image.onerror = imageOnLoad;\n globalImageCache.put(newImageOrSrc, image.__cachedImgObj = {\n image: image,\n pending: [pendingWrap]\n });\n image.src = image.__zrImageSrc = newImageOrSrc;\n }\n return image;\n }\n else {\n return newImageOrSrc;\n }\n}\nfunction imageOnLoad() {\n var cachedImgObj = this.__cachedImgObj;\n this.onload = this.onerror = this.__cachedImgObj = null;\n for (var i = 0; i < cachedImgObj.pending.length; i++) {\n var pendingWrap = cachedImgObj.pending[i];\n var cb = pendingWrap.cb;\n cb && cb(this, pendingWrap.cbPayload);\n pendingWrap.hostEl.dirty();\n }\n cachedImgObj.pending.length = 0;\n}\nexport function isImageReady(image) {\n return image && image.width && image.height;\n}\n","export function create() {\n return [1, 0, 0, 1, 0, 0];\n}\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\nexport function copy(out, m) {\n out[0] = m[0];\n out[1] = m[1];\n out[2] = m[2];\n out[3] = m[3];\n out[4] = m[4];\n out[5] = m[5];\n return out;\n}\nexport function mul(out, m1, m2) {\n var out0 = m1[0] * m2[0] + m1[2] * m2[1];\n var out1 = m1[1] * m2[0] + m1[3] * m2[1];\n var out2 = m1[0] * m2[2] + m1[2] * m2[3];\n var out3 = m1[1] * m2[2] + m1[3] * m2[3];\n var out4 = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];\n var out5 = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = out3;\n out[4] = out4;\n out[5] = out5;\n return out;\n}\nexport function translate(out, a, v) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4] + v[0];\n out[5] = a[5] + v[1];\n return out;\n}\nexport function rotate(out, a, rad) {\n var aa = a[0];\n var ac = a[2];\n var atx = a[4];\n var ab = a[1];\n var ad = a[3];\n var aty = a[5];\n var st = Math.sin(rad);\n var ct = Math.cos(rad);\n out[0] = aa * ct + ab * st;\n out[1] = -aa * st + ab * ct;\n out[2] = ac * ct + ad * st;\n out[3] = -ac * st + ct * ad;\n out[4] = ct * atx + st * aty;\n out[5] = ct * aty - st * atx;\n return out;\n}\nexport function scale(out, a, v) {\n var vx = v[0];\n var vy = v[1];\n out[0] = a[0] * vx;\n out[1] = a[1] * vy;\n out[2] = a[2] * vx;\n out[3] = a[3] * vy;\n out[4] = a[4] * vx;\n out[5] = a[5] * vy;\n return out;\n}\nexport function invert(out, a) {\n var aa = a[0];\n var ac = a[2];\n var atx = a[4];\n var ab = a[1];\n var ad = a[3];\n var aty = a[5];\n var det = aa * ad - ab * ac;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n}\nexport function clone(a) {\n var b = create();\n copy(b, a);\n return b;\n}\n","var Point = (function () {\n function Point(x, y) {\n this.x = x || 0;\n this.y = y || 0;\n }\n Point.prototype.copy = function (other) {\n this.x = other.x;\n this.y = other.y;\n return this;\n };\n Point.prototype.clone = function () {\n return new Point(this.x, this.y);\n };\n Point.prototype.set = function (x, y) {\n this.x = x;\n this.y = y;\n return this;\n };\n Point.prototype.equal = function (other) {\n return other.x === this.x && other.y === this.y;\n };\n Point.prototype.add = function (other) {\n this.x += other.x;\n this.y += other.y;\n return this;\n };\n Point.prototype.scale = function (scalar) {\n this.x *= scalar;\n this.y *= scalar;\n };\n Point.prototype.scaleAndAdd = function (other, scalar) {\n this.x += other.x * scalar;\n this.y += other.y * scalar;\n };\n Point.prototype.sub = function (other) {\n this.x -= other.x;\n this.y -= other.y;\n return this;\n };\n Point.prototype.dot = function (other) {\n return this.x * other.x + this.y * other.y;\n };\n Point.prototype.len = function () {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n };\n Point.prototype.lenSquare = function () {\n return this.x * this.x + this.y * this.y;\n };\n Point.prototype.normalize = function () {\n var len = this.len();\n this.x /= len;\n this.y /= len;\n return this;\n };\n Point.prototype.distance = function (other) {\n var dx = this.x - other.x;\n var dy = this.y - other.y;\n return Math.sqrt(dx * dx + dy * dy);\n };\n Point.prototype.distanceSquare = function (other) {\n var dx = this.x - other.x;\n var dy = this.y - other.y;\n return dx * dx + dy * dy;\n };\n Point.prototype.negate = function () {\n this.x = -this.x;\n this.y = -this.y;\n return this;\n };\n Point.prototype.transform = function (m) {\n if (!m) {\n return;\n }\n var x = this.x;\n var y = this.y;\n this.x = m[0] * x + m[2] * y + m[4];\n this.y = m[1] * x + m[3] * y + m[5];\n return this;\n };\n Point.prototype.toArray = function (out) {\n out[0] = this.x;\n out[1] = this.y;\n return out;\n };\n Point.prototype.fromArray = function (input) {\n this.x = input[0];\n this.y = input[1];\n };\n Point.set = function (p, x, y) {\n p.x = x;\n p.y = y;\n };\n Point.copy = function (p, p2) {\n p.x = p2.x;\n p.y = p2.y;\n };\n Point.len = function (p) {\n return Math.sqrt(p.x * p.x + p.y * p.y);\n };\n Point.lenSquare = function (p) {\n return p.x * p.x + p.y * p.y;\n };\n Point.dot = function (p0, p1) {\n return p0.x * p1.x + p0.y * p1.y;\n };\n Point.add = function (out, p0, p1) {\n out.x = p0.x + p1.x;\n out.y = p0.y + p1.y;\n };\n Point.sub = function (out, p0, p1) {\n out.x = p0.x - p1.x;\n out.y = p0.y - p1.y;\n };\n Point.scale = function (out, p0, scalar) {\n out.x = p0.x * scalar;\n out.y = p0.y * scalar;\n };\n Point.scaleAndAdd = function (out, p0, p1, scalar) {\n out.x = p0.x + p1.x * scalar;\n out.y = p0.y + p1.y * scalar;\n };\n Point.lerp = function (out, p0, p1, t) {\n var onet = 1 - t;\n out.x = onet * p0.x + t * p1.x;\n out.y = onet * p0.y + t * p1.y;\n };\n return Point;\n}());\nexport default Point;\n","import * as matrix from './matrix';\nimport Point from './Point';\nvar mathMin = Math.min;\nvar mathMax = Math.max;\nvar lt = new Point();\nvar rb = new Point();\nvar lb = new Point();\nvar rt = new Point();\nvar minTv = new Point();\nvar maxTv = new Point();\nvar BoundingRect = (function () {\n function BoundingRect(x, y, width, height) {\n if (width < 0) {\n x = x + width;\n width = -width;\n }\n if (height < 0) {\n y = y + height;\n height = -height;\n }\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n BoundingRect.prototype.union = function (other) {\n var x = mathMin(other.x, this.x);\n var y = mathMin(other.y, this.y);\n if (isFinite(this.x) && isFinite(this.width)) {\n this.width = mathMax(other.x + other.width, this.x + this.width) - x;\n }\n else {\n this.width = other.width;\n }\n if (isFinite(this.y) && isFinite(this.height)) {\n this.height = mathMax(other.y + other.height, this.y + this.height) - y;\n }\n else {\n this.height = other.height;\n }\n this.x = x;\n this.y = y;\n };\n BoundingRect.prototype.applyTransform = function (m) {\n BoundingRect.applyTransform(this, this, m);\n };\n BoundingRect.prototype.calculateTransform = function (b) {\n var a = this;\n var sx = b.width / a.width;\n var sy = b.height / a.height;\n var m = matrix.create();\n matrix.translate(m, m, [-a.x, -a.y]);\n matrix.scale(m, m, [sx, sy]);\n matrix.translate(m, m, [b.x, b.y]);\n return m;\n };\n BoundingRect.prototype.intersect = function (b, mtv) {\n if (!b) {\n return false;\n }\n if (!(b instanceof BoundingRect)) {\n b = BoundingRect.create(b);\n }\n var a = this;\n var ax0 = a.x;\n var ax1 = a.x + a.width;\n var ay0 = a.y;\n var ay1 = a.y + a.height;\n var bx0 = b.x;\n var bx1 = b.x + b.width;\n var by0 = b.y;\n var by1 = b.y + b.height;\n var overlap = !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);\n if (mtv) {\n var dMin = Infinity;\n var dMax = 0;\n var d0 = Math.abs(ax1 - bx0);\n var d1 = Math.abs(bx1 - ax0);\n var d2 = Math.abs(ay1 - by0);\n var d3 = Math.abs(by1 - ay0);\n var dx = Math.min(d0, d1);\n var dy = Math.min(d2, d3);\n if (ax1 < bx0 || bx1 < ax0) {\n if (dx > dMax) {\n dMax = dx;\n if (d0 < d1) {\n Point.set(maxTv, -d0, 0);\n }\n else {\n Point.set(maxTv, d1, 0);\n }\n }\n }\n else {\n if (dx < dMin) {\n dMin = dx;\n if (d0 < d1) {\n Point.set(minTv, d0, 0);\n }\n else {\n Point.set(minTv, -d1, 0);\n }\n }\n }\n if (ay1 < by0 || by1 < ay0) {\n if (dy > dMax) {\n dMax = dy;\n if (d2 < d3) {\n Point.set(maxTv, 0, -d2);\n }\n else {\n Point.set(maxTv, 0, d3);\n }\n }\n }\n else {\n if (dx < dMin) {\n dMin = dx;\n if (d2 < d3) {\n Point.set(minTv, 0, d2);\n }\n else {\n Point.set(minTv, 0, -d3);\n }\n }\n }\n }\n if (mtv) {\n Point.copy(mtv, overlap ? minTv : maxTv);\n }\n return overlap;\n };\n BoundingRect.prototype.contain = function (x, y) {\n var rect = this;\n return x >= rect.x\n && x <= (rect.x + rect.width)\n && y >= rect.y\n && y <= (rect.y + rect.height);\n };\n BoundingRect.prototype.clone = function () {\n return new BoundingRect(this.x, this.y, this.width, this.height);\n };\n BoundingRect.prototype.copy = function (other) {\n BoundingRect.copy(this, other);\n };\n BoundingRect.prototype.plain = function () {\n return {\n x: this.x,\n y: this.y,\n width: this.width,\n height: this.height\n };\n };\n BoundingRect.prototype.isFinite = function () {\n return isFinite(this.x)\n && isFinite(this.y)\n && isFinite(this.width)\n && isFinite(this.height);\n };\n BoundingRect.prototype.isZero = function () {\n return this.width === 0 || this.height === 0;\n };\n BoundingRect.create = function (rect) {\n return new BoundingRect(rect.x, rect.y, rect.width, rect.height);\n };\n BoundingRect.copy = function (target, source) {\n target.x = source.x;\n target.y = source.y;\n target.width = source.width;\n target.height = source.height;\n };\n BoundingRect.applyTransform = function (target, source, m) {\n if (!m) {\n if (target !== source) {\n BoundingRect.copy(target, source);\n }\n return;\n }\n if (m[1] < 1e-5 && m[1] > -1e-5 && m[2] < 1e-5 && m[2] > -1e-5) {\n var sx = m[0];\n var sy = m[3];\n var tx = m[4];\n var ty = m[5];\n target.x = source.x * sx + tx;\n target.y = source.y * sy + ty;\n target.width = source.width * sx;\n target.height = source.height * sy;\n if (target.width < 0) {\n target.x += target.width;\n target.width = -target.width;\n }\n if (target.height < 0) {\n target.y += target.height;\n target.height = -target.height;\n }\n return;\n }\n lt.x = lb.x = source.x;\n lt.y = rt.y = source.y;\n rb.x = rt.x = source.x + source.width;\n rb.y = lb.y = source.y + source.height;\n lt.transform(m);\n rt.transform(m);\n rb.transform(m);\n lb.transform(m);\n target.x = mathMin(lt.x, rb.x, lb.x, rt.x);\n target.y = mathMin(lt.y, rb.y, lb.y, rt.y);\n var maxX = mathMax(lt.x, rb.x, lb.x, rt.x);\n var maxY = mathMax(lt.y, rb.y, lb.y, rt.y);\n target.width = maxX - target.x;\n target.height = maxY - target.y;\n };\n return BoundingRect;\n}());\nexport default BoundingRect;\n","import BoundingRect from '../core/BoundingRect';\nimport { createCanvas } from '../core/util';\nimport LRU from '../core/LRU';\nvar textWidthCache = {};\nexport var DEFAULT_FONT = '12px sans-serif';\nvar _ctx;\nvar _cachedFont;\nfunction defaultMeasureText(text, font) {\n if (!_ctx) {\n _ctx = createCanvas().getContext('2d');\n }\n if (_cachedFont !== font) {\n _cachedFont = _ctx.font = font || DEFAULT_FONT;\n }\n return _ctx.measureText(text);\n}\nvar methods = {\n measureText: defaultMeasureText\n};\nexport function $override(name, fn) {\n methods[name] = fn;\n}\nexport function getWidth(text, font) {\n font = font || DEFAULT_FONT;\n var cacheOfFont = textWidthCache[font];\n if (!cacheOfFont) {\n cacheOfFont = textWidthCache[font] = new LRU(500);\n }\n var width = cacheOfFont.get(text);\n if (width == null) {\n width = methods.measureText(text, font).width;\n cacheOfFont.put(text, width);\n }\n return width;\n}\nexport function innerGetBoundingRect(text, font, textAlign, textBaseline) {\n var width = getWidth(text, font);\n var height = getLineHeight(font);\n var x = adjustTextX(0, width, textAlign);\n var y = adjustTextY(0, height, textBaseline);\n var rect = new BoundingRect(x, y, width, height);\n return rect;\n}\nexport function getBoundingRect(text, font, textAlign, textBaseline) {\n var textLines = ((text || '') + '').split('\\n');\n var len = textLines.length;\n if (len === 1) {\n return innerGetBoundingRect(textLines[0], font, textAlign, textBaseline);\n }\n else {\n var uniondRect = new BoundingRect(0, 0, 0, 0);\n for (var i = 0; i < textLines.length; i++) {\n var rect = innerGetBoundingRect(textLines[i], font, textAlign, textBaseline);\n i === 0 ? uniondRect.copy(rect) : uniondRect.union(rect);\n }\n return uniondRect;\n }\n}\nexport function adjustTextX(x, width, textAlign) {\n if (textAlign === 'right') {\n x -= width;\n }\n else if (textAlign === 'center') {\n x -= width / 2;\n }\n return x;\n}\nexport function adjustTextY(y, height, verticalAlign) {\n if (verticalAlign === 'middle') {\n y -= height / 2;\n }\n else if (verticalAlign === 'bottom') {\n y -= height;\n }\n return y;\n}\nexport function getLineHeight(font) {\n return getWidth('国', font);\n}\nexport function measureText(text, font) {\n return methods.measureText(text, font);\n}\nexport function parsePercent(value, maxValue) {\n if (typeof value === 'string') {\n if (value.lastIndexOf('%') >= 0) {\n return parseFloat(value) / 100 * maxValue;\n }\n return parseFloat(value);\n }\n return value;\n}\nexport function calculateTextPosition(out, opts, rect) {\n var textPosition = opts.position || 'inside';\n var distance = opts.distance != null ? opts.distance : 5;\n var height = rect.height;\n var width = rect.width;\n var halfHeight = height / 2;\n var x = rect.x;\n var y = rect.y;\n var textAlign = 'left';\n var textVerticalAlign = 'top';\n if (textPosition instanceof Array) {\n x += parsePercent(textPosition[0], rect.width);\n y += parsePercent(textPosition[1], rect.height);\n textAlign = null;\n textVerticalAlign = null;\n }\n else {\n switch (textPosition) {\n case 'left':\n x -= distance;\n y += halfHeight;\n textAlign = 'right';\n textVerticalAlign = 'middle';\n break;\n case 'right':\n x += distance + width;\n y += halfHeight;\n textVerticalAlign = 'middle';\n break;\n case 'top':\n x += width / 2;\n y -= distance;\n textAlign = 'center';\n textVerticalAlign = 'bottom';\n break;\n case 'bottom':\n x += width / 2;\n y += height + distance;\n textAlign = 'center';\n break;\n case 'inside':\n x += width / 2;\n y += halfHeight;\n textAlign = 'center';\n textVerticalAlign = 'middle';\n break;\n case 'insideLeft':\n x += distance;\n y += halfHeight;\n textVerticalAlign = 'middle';\n break;\n case 'insideRight':\n x += width - distance;\n y += halfHeight;\n textAlign = 'right';\n textVerticalAlign = 'middle';\n break;\n case 'insideTop':\n x += width / 2;\n y += distance;\n textAlign = 'center';\n break;\n case 'insideBottom':\n x += width / 2;\n y += height - distance;\n textAlign = 'center';\n textVerticalAlign = 'bottom';\n break;\n case 'insideTopLeft':\n x += distance;\n y += distance;\n break;\n case 'insideTopRight':\n x += width - distance;\n y += distance;\n textAlign = 'right';\n break;\n case 'insideBottomLeft':\n x += distance;\n y += height - distance;\n textVerticalAlign = 'bottom';\n break;\n case 'insideBottomRight':\n x += width - distance;\n y += height - distance;\n textAlign = 'right';\n textVerticalAlign = 'bottom';\n break;\n }\n }\n out = out || {};\n out.x = x;\n out.y = y;\n out.align = textAlign;\n out.verticalAlign = textVerticalAlign;\n return out;\n}\n","import * as imageHelper from '../helper/image';\nimport { extend, retrieve2, retrieve3, reduce } from '../../core/util';\nimport { getLineHeight, getWidth, parsePercent } from '../../contain/text';\nvar STYLE_REG = /\\{([a-zA-Z0-9_]+)\\|([^}]*)\\}/g;\nexport function truncateText(text, containerWidth, font, ellipsis, options) {\n if (!containerWidth) {\n return '';\n }\n var textLines = (text + '').split('\\n');\n options = prepareTruncateOptions(containerWidth, font, ellipsis, options);\n for (var i = 0, len = textLines.length; i < len; i++) {\n textLines[i] = truncateSingleLine(textLines[i], options);\n }\n return textLines.join('\\n');\n}\nfunction prepareTruncateOptions(containerWidth, font, ellipsis, options) {\n options = options || {};\n var preparedOpts = extend({}, options);\n preparedOpts.font = font;\n ellipsis = retrieve2(ellipsis, '...');\n preparedOpts.maxIterations = retrieve2(options.maxIterations, 2);\n var minChar = preparedOpts.minChar = retrieve2(options.minChar, 0);\n preparedOpts.cnCharWidth = getWidth('国', font);\n var ascCharWidth = preparedOpts.ascCharWidth = getWidth('a', font);\n preparedOpts.placeholder = retrieve2(options.placeholder, '');\n var contentWidth = containerWidth = Math.max(0, containerWidth - 1);\n for (var i = 0; i < minChar && contentWidth >= ascCharWidth; i++) {\n contentWidth -= ascCharWidth;\n }\n var ellipsisWidth = getWidth(ellipsis, font);\n if (ellipsisWidth > contentWidth) {\n ellipsis = '';\n ellipsisWidth = 0;\n }\n contentWidth = containerWidth - ellipsisWidth;\n preparedOpts.ellipsis = ellipsis;\n preparedOpts.ellipsisWidth = ellipsisWidth;\n preparedOpts.contentWidth = contentWidth;\n preparedOpts.containerWidth = containerWidth;\n return preparedOpts;\n}\nfunction truncateSingleLine(textLine, options) {\n var containerWidth = options.containerWidth;\n var font = options.font;\n var contentWidth = options.contentWidth;\n if (!containerWidth) {\n return '';\n }\n var lineWidth = getWidth(textLine, font);\n if (lineWidth <= containerWidth) {\n return textLine;\n }\n for (var j = 0;; j++) {\n if (lineWidth <= contentWidth || j >= options.maxIterations) {\n textLine += options.ellipsis;\n break;\n }\n var subLength = j === 0\n ? estimateLength(textLine, contentWidth, options.ascCharWidth, options.cnCharWidth)\n : lineWidth > 0\n ? Math.floor(textLine.length * contentWidth / lineWidth)\n : 0;\n textLine = textLine.substr(0, subLength);\n lineWidth = getWidth(textLine, font);\n }\n if (textLine === '') {\n textLine = options.placeholder;\n }\n return textLine;\n}\nfunction estimateLength(text, contentWidth, ascCharWidth, cnCharWidth) {\n var width = 0;\n var i = 0;\n for (var len = text.length; i < len && width < contentWidth; i++) {\n var charCode = text.charCodeAt(i);\n width += (0 <= charCode && charCode <= 127) ? ascCharWidth : cnCharWidth;\n }\n return i;\n}\nexport function parsePlainText(text, style) {\n text != null && (text += '');\n var overflow = style.overflow;\n var padding = style.padding;\n var font = style.font;\n var truncate = overflow === 'truncate';\n var calculatedLineHeight = getLineHeight(font);\n var lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);\n var truncateLineOverflow = style.lineOverflow === 'truncate';\n var width = style.width;\n var lines;\n if (width != null && overflow === 'break' || overflow === 'breakAll') {\n lines = text ? wrapText(text, style.font, width, overflow === 'breakAll', 0).lines : [];\n }\n else {\n lines = text ? text.split('\\n') : [];\n }\n var contentHeight = lines.length * lineHeight;\n var height = retrieve2(style.height, contentHeight);\n if (contentHeight > height && truncateLineOverflow) {\n var lineCount = Math.floor(height / lineHeight);\n lines = lines.slice(0, lineCount);\n }\n var outerHeight = height;\n var outerWidth = width;\n if (padding) {\n outerHeight += padding[0] + padding[2];\n if (outerWidth != null) {\n outerWidth += padding[1] + padding[3];\n }\n }\n if (text && truncate && outerWidth != null) {\n var options = prepareTruncateOptions(width, font, style.ellipsis, {\n minChar: style.truncateMinChar,\n placeholder: style.placeholder\n });\n for (var i = 0; i < lines.length; i++) {\n lines[i] = truncateSingleLine(lines[i], options);\n }\n }\n if (width == null) {\n var maxWidth = 0;\n for (var i = 0; i < lines.length; i++) {\n maxWidth = Math.max(getWidth(lines[i], font), maxWidth);\n }\n width = maxWidth;\n }\n return {\n lines: lines,\n height: height,\n outerHeight: outerHeight,\n lineHeight: lineHeight,\n calculatedLineHeight: calculatedLineHeight,\n contentHeight: contentHeight,\n width: width\n };\n}\nvar RichTextToken = (function () {\n function RichTextToken() {\n }\n return RichTextToken;\n}());\nvar RichTextLine = (function () {\n function RichTextLine(tokens) {\n this.tokens = [];\n if (tokens) {\n this.tokens = tokens;\n }\n }\n return RichTextLine;\n}());\nvar RichTextContentBlock = (function () {\n function RichTextContentBlock() {\n this.width = 0;\n this.height = 0;\n this.contentWidth = 0;\n this.contentHeight = 0;\n this.outerWidth = 0;\n this.outerHeight = 0;\n this.lines = [];\n }\n return RichTextContentBlock;\n}());\nexport { RichTextContentBlock };\nexport function parseRichText(text, style) {\n var contentBlock = new RichTextContentBlock();\n text != null && (text += '');\n if (!text) {\n return contentBlock;\n }\n var topWidth = style.width;\n var topHeight = style.height;\n var overflow = style.overflow;\n var wrapInfo = (overflow === 'break' || overflow === 'breakAll') && topWidth != null\n ? { width: topWidth, accumWidth: 0, breakAll: overflow === 'breakAll' }\n : null;\n var lastIndex = STYLE_REG.lastIndex = 0;\n var result;\n while ((result = STYLE_REG.exec(text)) != null) {\n var matchedIndex = result.index;\n if (matchedIndex > lastIndex) {\n pushTokens(contentBlock, text.substring(lastIndex, matchedIndex), style, wrapInfo);\n }\n pushTokens(contentBlock, result[2], style, wrapInfo, result[1]);\n lastIndex = STYLE_REG.lastIndex;\n }\n if (lastIndex < text.length) {\n pushTokens(contentBlock, text.substring(lastIndex, text.length), style, wrapInfo);\n }\n var pendingList = [];\n var calculatedHeight = 0;\n var calculatedWidth = 0;\n var stlPadding = style.padding;\n var truncate = overflow === 'truncate';\n var truncateLine = style.lineOverflow === 'truncate';\n function finishLine(line, lineWidth, lineHeight) {\n line.width = lineWidth;\n line.lineHeight = lineHeight;\n calculatedHeight += lineHeight;\n calculatedWidth = Math.max(calculatedWidth, lineWidth);\n }\n outer: for (var i = 0; i < contentBlock.lines.length; i++) {\n var line = contentBlock.lines[i];\n var lineHeight = 0;\n var lineWidth = 0;\n for (var j = 0; j < line.tokens.length; j++) {\n var token = line.tokens[j];\n var tokenStyle = token.styleName && style.rich[token.styleName] || {};\n var textPadding = token.textPadding = tokenStyle.padding;\n var paddingH = textPadding ? textPadding[1] + textPadding[3] : 0;\n var font = token.font = tokenStyle.font || style.font;\n token.contentHeight = getLineHeight(font);\n var tokenHeight = retrieve2(tokenStyle.height, token.contentHeight);\n token.innerHeight = tokenHeight;\n textPadding && (tokenHeight += textPadding[0] + textPadding[2]);\n token.height = tokenHeight;\n token.lineHeight = retrieve3(tokenStyle.lineHeight, style.lineHeight, tokenHeight);\n token.align = tokenStyle && tokenStyle.align || style.align;\n token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || 'middle';\n if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {\n if (j > 0) {\n line.tokens = line.tokens.slice(0, j);\n finishLine(line, lineWidth, lineHeight);\n contentBlock.lines = contentBlock.lines.slice(0, i + 1);\n }\n else {\n contentBlock.lines = contentBlock.lines.slice(0, i);\n }\n break outer;\n }\n var styleTokenWidth = tokenStyle.width;\n var tokenWidthNotSpecified = styleTokenWidth == null || styleTokenWidth === 'auto';\n if (typeof styleTokenWidth === 'string' && styleTokenWidth.charAt(styleTokenWidth.length - 1) === '%') {\n token.percentWidth = styleTokenWidth;\n pendingList.push(token);\n token.contentWidth = getWidth(token.text, font);\n }\n else {\n if (tokenWidthNotSpecified) {\n var textBackgroundColor = tokenStyle.backgroundColor;\n var bgImg = textBackgroundColor && textBackgroundColor.image;\n if (bgImg) {\n bgImg = imageHelper.findExistImage(bgImg);\n if (imageHelper.isImageReady(bgImg)) {\n token.width = Math.max(token.width, bgImg.width * tokenHeight / bgImg.height);\n }\n }\n }\n var remainTruncWidth = truncate && topWidth != null\n ? topWidth - lineWidth : null;\n if (remainTruncWidth != null && remainTruncWidth < token.width) {\n if (!tokenWidthNotSpecified || remainTruncWidth < paddingH) {\n token.text = '';\n token.width = token.contentWidth = 0;\n }\n else {\n token.text = truncateText(token.text, remainTruncWidth - paddingH, font, style.ellipsis, { minChar: style.truncateMinChar });\n token.width = token.contentWidth = getWidth(token.text, font);\n }\n }\n else {\n token.contentWidth = getWidth(token.text, font);\n }\n }\n token.width += paddingH;\n lineWidth += token.width;\n tokenStyle && (lineHeight = Math.max(lineHeight, token.lineHeight));\n }\n finishLine(line, lineWidth, lineHeight);\n }\n contentBlock.outerWidth = contentBlock.width = retrieve2(topWidth, calculatedWidth);\n contentBlock.outerHeight = contentBlock.height = retrieve2(topHeight, calculatedHeight);\n contentBlock.contentHeight = calculatedHeight;\n contentBlock.contentWidth = calculatedWidth;\n if (stlPadding) {\n contentBlock.outerWidth += stlPadding[1] + stlPadding[3];\n contentBlock.outerHeight += stlPadding[0] + stlPadding[2];\n }\n for (var i = 0; i < pendingList.length; i++) {\n var token = pendingList[i];\n var percentWidth = token.percentWidth;\n token.width = parseInt(percentWidth, 10) / 100 * contentBlock.width;\n }\n return contentBlock;\n}\nfunction pushTokens(block, str, style, wrapInfo, styleName) {\n var isEmptyStr = str === '';\n var tokenStyle = styleName && style.rich[styleName] || {};\n var lines = block.lines;\n var font = tokenStyle.font || style.font;\n var newLine = false;\n var strLines;\n var linesWidths;\n if (wrapInfo) {\n var tokenPadding = tokenStyle.padding;\n var tokenPaddingH = tokenPadding ? tokenPadding[1] + tokenPadding[3] : 0;\n if (tokenStyle.width != null && tokenStyle.width !== 'auto') {\n var outerWidth_1 = parsePercent(tokenStyle.width, wrapInfo.width) + tokenPaddingH;\n if (lines.length > 0) {\n if (outerWidth_1 + wrapInfo.accumWidth > wrapInfo.width) {\n strLines = str.split('\\n');\n newLine = true;\n }\n }\n wrapInfo.accumWidth = outerWidth_1;\n }\n else {\n var res = wrapText(str, font, wrapInfo.width, wrapInfo.breakAll, wrapInfo.accumWidth);\n wrapInfo.accumWidth = res.accumWidth + tokenPaddingH;\n linesWidths = res.linesWidths;\n strLines = res.lines;\n }\n }\n else {\n strLines = str.split('\\n');\n }\n for (var i = 0; i < strLines.length; i++) {\n var text = strLines[i];\n var token = new RichTextToken();\n token.styleName = styleName;\n token.text = text;\n token.isLineHolder = !text && !isEmptyStr;\n if (typeof tokenStyle.width === 'number') {\n token.width = tokenStyle.width;\n }\n else {\n token.width = linesWidths\n ? linesWidths[i]\n : getWidth(text, font);\n }\n if (!i && !newLine) {\n var tokens = (lines[lines.length - 1] || (lines[0] = new RichTextLine())).tokens;\n var tokensLen = tokens.length;\n (tokensLen === 1 && tokens[0].isLineHolder)\n ? (tokens[0] = token)\n : ((text || !tokensLen || isEmptyStr) && tokens.push(token));\n }\n else {\n lines.push(new RichTextLine([token]));\n }\n }\n}\nfunction isLatin(ch) {\n var code = ch.charCodeAt(0);\n return code >= 0x21 && code <= 0xFF;\n}\nvar breakCharMap = reduce(',&?/;] '.split(''), function (obj, ch) {\n obj[ch] = true;\n return obj;\n}, {});\nfunction isWordBreakChar(ch) {\n if (isLatin(ch)) {\n if (breakCharMap[ch]) {\n return true;\n }\n return false;\n }\n return true;\n}\nfunction wrapText(text, font, lineWidth, isBreakAll, lastAccumWidth) {\n var lines = [];\n var linesWidths = [];\n var line = '';\n var currentWord = '';\n var currentWordWidth = 0;\n var accumWidth = 0;\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch === '\\n') {\n if (currentWord) {\n line += currentWord;\n accumWidth += currentWordWidth;\n }\n lines.push(line);\n linesWidths.push(accumWidth);\n line = '';\n currentWord = '';\n currentWordWidth = 0;\n accumWidth = 0;\n continue;\n }\n var chWidth = getWidth(ch, font);\n var inWord = isBreakAll ? false : !isWordBreakChar(ch);\n if (!lines.length\n ? lastAccumWidth + accumWidth + chWidth > lineWidth\n : accumWidth + chWidth > lineWidth) {\n if (!accumWidth) {\n if (inWord) {\n lines.push(currentWord);\n linesWidths.push(currentWordWidth);\n currentWord = ch;\n currentWordWidth = chWidth;\n }\n else {\n lines.push(ch);\n linesWidths.push(chWidth);\n }\n }\n else if (line || currentWord) {\n if (inWord) {\n if (!line) {\n line = currentWord;\n currentWord = '';\n currentWordWidth = 0;\n accumWidth = currentWordWidth;\n }\n lines.push(line);\n linesWidths.push(accumWidth - currentWordWidth);\n currentWord += ch;\n currentWordWidth += chWidth;\n line = '';\n accumWidth = currentWordWidth;\n }\n else {\n if (currentWord) {\n line += currentWord;\n accumWidth += currentWordWidth;\n currentWord = '';\n currentWordWidth = 0;\n }\n lines.push(line);\n linesWidths.push(accumWidth);\n line = ch;\n accumWidth = chWidth;\n }\n }\n continue;\n }\n accumWidth += chWidth;\n if (inWord) {\n currentWord += ch;\n currentWordWidth += chWidth;\n }\n else {\n if (currentWord) {\n line += currentWord;\n currentWord = '';\n currentWordWidth = 0;\n }\n line += ch;\n }\n }\n if (!lines.length && !line) {\n line = text;\n currentWord = '';\n currentWordWidth = 0;\n }\n if (currentWord) {\n line += currentWord;\n }\n if (line) {\n lines.push(line);\n linesWidths.push(accumWidth);\n }\n if (lines.length === 1) {\n accumWidth += lastAccumWidth;\n }\n return {\n accumWidth: accumWidth,\n lines: lines,\n linesWidths: linesWidths\n };\n}\n","export function create(x, y) {\n if (x == null) {\n x = 0;\n }\n if (y == null) {\n y = 0;\n }\n return [x, y];\n}\nexport function copy(out, v) {\n out[0] = v[0];\n out[1] = v[1];\n return out;\n}\nexport function clone(v) {\n return [v[0], v[1]];\n}\nexport function set(out, a, b) {\n out[0] = a;\n out[1] = b;\n return out;\n}\nexport function add(out, v1, v2) {\n out[0] = v1[0] + v2[0];\n out[1] = v1[1] + v2[1];\n return out;\n}\nexport function scaleAndAdd(out, v1, v2, a) {\n out[0] = v1[0] + v2[0] * a;\n out[1] = v1[1] + v2[1] * a;\n return out;\n}\nexport function sub(out, v1, v2) {\n out[0] = v1[0] - v2[0];\n out[1] = v1[1] - v2[1];\n return out;\n}\nexport function len(v) {\n return Math.sqrt(lenSquare(v));\n}\nexport var length = len;\nexport function lenSquare(v) {\n return v[0] * v[0] + v[1] * v[1];\n}\nexport var lengthSquare = lenSquare;\nexport function mul(out, v1, v2) {\n out[0] = v1[0] * v2[0];\n out[1] = v1[1] * v2[1];\n return out;\n}\nexport function div(out, v1, v2) {\n out[0] = v1[0] / v2[0];\n out[1] = v1[1] / v2[1];\n return out;\n}\nexport function dot(v1, v2) {\n return v1[0] * v2[0] + v1[1] * v2[1];\n}\nexport function scale(out, v, s) {\n out[0] = v[0] * s;\n out[1] = v[1] * s;\n return out;\n}\nexport function normalize(out, v) {\n var d = len(v);\n if (d === 0) {\n out[0] = 0;\n out[1] = 0;\n }\n else {\n out[0] = v[0] / d;\n out[1] = v[1] / d;\n }\n return out;\n}\nexport function distance(v1, v2) {\n return Math.sqrt((v1[0] - v2[0]) * (v1[0] - v2[0])\n + (v1[1] - v2[1]) * (v1[1] - v2[1]));\n}\nexport var dist = distance;\nexport function distanceSquare(v1, v2) {\n return (v1[0] - v2[0]) * (v1[0] - v2[0])\n + (v1[1] - v2[1]) * (v1[1] - v2[1]);\n}\nexport var distSquare = distanceSquare;\nexport function negate(out, v) {\n out[0] = -v[0];\n out[1] = -v[1];\n return out;\n}\nexport function lerp(out, v1, v2, t) {\n out[0] = v1[0] + t * (v2[0] - v1[0]);\n out[1] = v1[1] + t * (v2[1] - v1[1]);\n return out;\n}\nexport function applyTransform(out, v, m) {\n var x = v[0];\n var y = v[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\nexport function min(out, v1, v2) {\n out[0] = Math.min(v1[0], v2[0]);\n out[1] = Math.min(v1[1], v2[1]);\n return out;\n}\nexport function max(out, v1, v2) {\n out[0] = Math.max(v1[0], v2[0]);\n out[1] = Math.max(v1[1], v2[1]);\n return out;\n}\n","import * as matrix from './matrix';\nimport * as vector from './vector';\nvar mIdentity = matrix.identity;\nvar EPSILON = 5e-5;\nfunction isNotAroundZero(val) {\n return val > EPSILON || val < -EPSILON;\n}\nvar scaleTmp = [];\nvar tmpTransform = [];\nvar originTransform = matrix.create();\nvar abs = Math.abs;\nvar Transformable = (function () {\n function Transformable() {\n }\n Transformable.prototype.setPosition = function (arr) {\n this.x = arr[0];\n this.y = arr[1];\n };\n Transformable.prototype.setScale = function (arr) {\n this.scaleX = arr[0];\n this.scaleY = arr[1];\n };\n Transformable.prototype.setSkew = function (arr) {\n this.skewX = arr[0];\n this.skewY = arr[1];\n };\n Transformable.prototype.setOrigin = function (arr) {\n this.originX = arr[0];\n this.originY = arr[1];\n };\n Transformable.prototype.needLocalTransform = function () {\n return isNotAroundZero(this.rotation)\n || isNotAroundZero(this.x)\n || isNotAroundZero(this.y)\n || isNotAroundZero(this.scaleX - 1)\n || isNotAroundZero(this.scaleY - 1);\n };\n Transformable.prototype.updateTransform = function () {\n var parent = this.parent;\n var parentHasTransform = parent && parent.transform;\n var needLocalTransform = this.needLocalTransform();\n var m = this.transform;\n if (!(needLocalTransform || parentHasTransform)) {\n m && mIdentity(m);\n return;\n }\n m = m || matrix.create();\n if (needLocalTransform) {\n this.getLocalTransform(m);\n }\n else {\n mIdentity(m);\n }\n if (parentHasTransform) {\n if (needLocalTransform) {\n matrix.mul(m, parent.transform, m);\n }\n else {\n matrix.copy(m, parent.transform);\n }\n }\n this.transform = m;\n this._resolveGlobalScaleRatio(m);\n };\n Transformable.prototype._resolveGlobalScaleRatio = function (m) {\n var globalScaleRatio = this.globalScaleRatio;\n if (globalScaleRatio != null && globalScaleRatio !== 1) {\n this.getGlobalScale(scaleTmp);\n var relX = scaleTmp[0] < 0 ? -1 : 1;\n var relY = scaleTmp[1] < 0 ? -1 : 1;\n var sx = ((scaleTmp[0] - relX) * globalScaleRatio + relX) / scaleTmp[0] || 0;\n var sy = ((scaleTmp[1] - relY) * globalScaleRatio + relY) / scaleTmp[1] || 0;\n m[0] *= sx;\n m[1] *= sx;\n m[2] *= sy;\n m[3] *= sy;\n }\n this.invTransform = this.invTransform || matrix.create();\n matrix.invert(this.invTransform, m);\n };\n Transformable.prototype.getLocalTransform = function (m) {\n return Transformable.getLocalTransform(this, m);\n };\n Transformable.prototype.getComputedTransform = function () {\n var transformNode = this;\n var ancestors = [];\n while (transformNode) {\n ancestors.push(transformNode);\n transformNode = transformNode.parent;\n }\n while (transformNode = ancestors.pop()) {\n transformNode.updateTransform();\n }\n return this.transform;\n };\n Transformable.prototype.setLocalTransform = function (m) {\n if (!m) {\n return;\n }\n var sx = m[0] * m[0] + m[1] * m[1];\n var sy = m[2] * m[2] + m[3] * m[3];\n var rotation = Math.atan2(m[1], m[0]);\n var shearX = Math.PI / 2 + rotation - Math.atan2(m[3], m[2]);\n sy = Math.sqrt(sy) * Math.cos(shearX);\n sx = Math.sqrt(sx);\n this.skewX = shearX;\n this.skewY = 0;\n this.rotation = -rotation;\n this.x = +m[4];\n this.y = +m[5];\n this.scaleX = sx;\n this.scaleY = sy;\n this.originX = 0;\n this.originY = 0;\n };\n Transformable.prototype.decomposeTransform = function () {\n if (!this.transform) {\n return;\n }\n var parent = this.parent;\n var m = this.transform;\n if (parent && parent.transform) {\n matrix.mul(tmpTransform, parent.invTransform, m);\n m = tmpTransform;\n }\n var ox = this.originX;\n var oy = this.originY;\n if (ox || oy) {\n originTransform[4] = ox;\n originTransform[5] = oy;\n matrix.mul(tmpTransform, m, originTransform);\n tmpTransform[4] -= ox;\n tmpTransform[5] -= oy;\n m = tmpTransform;\n }\n this.setLocalTransform(m);\n };\n Transformable.prototype.getGlobalScale = function (out) {\n var m = this.transform;\n out = out || [];\n if (!m) {\n out[0] = 1;\n out[1] = 1;\n return out;\n }\n out[0] = Math.sqrt(m[0] * m[0] + m[1] * m[1]);\n out[1] = Math.sqrt(m[2] * m[2] + m[3] * m[3]);\n if (m[0] < 0) {\n out[0] = -out[0];\n }\n if (m[3] < 0) {\n out[1] = -out[1];\n }\n return out;\n };\n Transformable.prototype.transformCoordToLocal = function (x, y) {\n var v2 = [x, y];\n var invTransform = this.invTransform;\n if (invTransform) {\n vector.applyTransform(v2, v2, invTransform);\n }\n return v2;\n };\n Transformable.prototype.transformCoordToGlobal = function (x, y) {\n var v2 = [x, y];\n var transform = this.transform;\n if (transform) {\n vector.applyTransform(v2, v2, transform);\n }\n return v2;\n };\n Transformable.prototype.getLineScale = function () {\n var m = this.transform;\n return m && abs(m[0] - 1) > 1e-10 && abs(m[3] - 1) > 1e-10\n ? Math.sqrt(abs(m[0] * m[3] - m[2] * m[1]))\n : 1;\n };\n Transformable.getLocalTransform = function (target, m) {\n m = m || [];\n var ox = target.originX || 0;\n var oy = target.originY || 0;\n var sx = target.scaleX;\n var sy = target.scaleY;\n var rotation = target.rotation || 0;\n var x = target.x;\n var y = target.y;\n var skewX = target.skewX ? Math.tan(target.skewX) : 0;\n var skewY = target.skewY ? Math.tan(-target.skewY) : 0;\n if (ox || oy) {\n m[4] = -ox * sx - skewX * oy * sy;\n m[5] = -oy * sy - skewY * ox * sx;\n }\n else {\n m[4] = m[5] = 0;\n }\n m[0] = sx;\n m[3] = sy;\n m[1] = skewY * sx;\n m[2] = skewX * sy;\n rotation && matrix.rotate(m, m, rotation);\n m[4] += ox + x;\n m[5] += oy + y;\n return m;\n };\n Transformable.initDefaultProps = (function () {\n var proto = Transformable.prototype;\n proto.x = 0;\n proto.y = 0;\n proto.scaleX = 1;\n proto.scaleY = 1;\n proto.originX = 0;\n proto.originY = 0;\n proto.skewX = 0;\n proto.skewY = 0;\n proto.rotation = 0;\n proto.globalScaleRatio = 1;\n })();\n return Transformable;\n}());\n;\nexport default Transformable;\n","var Eventful = (function () {\n function Eventful(eventProcessors) {\n if (eventProcessors) {\n this._$eventProcessor = eventProcessors;\n }\n }\n Eventful.prototype.on = function (event, query, handler, context) {\n if (!this._$handlers) {\n this._$handlers = {};\n }\n var _h = this._$handlers;\n if (typeof query === 'function') {\n context = handler;\n handler = query;\n query = null;\n }\n if (!handler || !event) {\n return this;\n }\n var eventProcessor = this._$eventProcessor;\n if (query != null && eventProcessor && eventProcessor.normalizeQuery) {\n query = eventProcessor.normalizeQuery(query);\n }\n if (!_h[event]) {\n _h[event] = [];\n }\n for (var i = 0; i < _h[event].length; i++) {\n if (_h[event][i].h === handler) {\n return this;\n }\n }\n var wrap = {\n h: handler,\n query: query,\n ctx: (context || this),\n callAtLast: handler.zrEventfulCallAtLast\n };\n var lastIndex = _h[event].length - 1;\n var lastWrap = _h[event][lastIndex];\n (lastWrap && lastWrap.callAtLast)\n ? _h[event].splice(lastIndex, 0, wrap)\n : _h[event].push(wrap);\n return this;\n };\n Eventful.prototype.isSilent = function (eventName) {\n var _h = this._$handlers;\n return !_h || !_h[eventName] || !_h[eventName].length;\n };\n Eventful.prototype.off = function (eventType, handler) {\n var _h = this._$handlers;\n if (!_h) {\n return this;\n }\n if (!eventType) {\n this._$handlers = {};\n return this;\n }\n if (handler) {\n if (_h[eventType]) {\n var newList = [];\n for (var i = 0, l = _h[eventType].length; i < l; i++) {\n if (_h[eventType][i].h !== handler) {\n newList.push(_h[eventType][i]);\n }\n }\n _h[eventType] = newList;\n }\n if (_h[eventType] && _h[eventType].length === 0) {\n delete _h[eventType];\n }\n }\n else {\n delete _h[eventType];\n }\n return this;\n };\n Eventful.prototype.trigger = function (eventType) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (!this._$handlers) {\n return this;\n }\n var _h = this._$handlers[eventType];\n var eventProcessor = this._$eventProcessor;\n if (_h) {\n var argLen = args.length;\n var len = _h.length;\n for (var i = 0; i < len; i++) {\n var hItem = _h[i];\n if (eventProcessor\n && eventProcessor.filter\n && hItem.query != null\n && !eventProcessor.filter(eventType, hItem.query)) {\n continue;\n }\n switch (argLen) {\n case 0:\n hItem.h.call(hItem.ctx);\n break;\n case 1:\n hItem.h.call(hItem.ctx, args[0]);\n break;\n case 2:\n hItem.h.call(hItem.ctx, args[0], args[1]);\n break;\n default:\n hItem.h.apply(hItem.ctx, args);\n break;\n }\n }\n }\n eventProcessor && eventProcessor.afterTrigger\n && eventProcessor.afterTrigger(eventType);\n return this;\n };\n Eventful.prototype.triggerWithContext = function (type) {\n if (!this._$handlers) {\n return this;\n }\n var _h = this._$handlers[type];\n var eventProcessor = this._$eventProcessor;\n if (_h) {\n var args = arguments;\n var argLen = args.length;\n var ctx = args[argLen - 1];\n var len = _h.length;\n for (var i = 0; i < len; i++) {\n var hItem = _h[i];\n if (eventProcessor\n && eventProcessor.filter\n && hItem.query != null\n && !eventProcessor.filter(type, hItem.query)) {\n continue;\n }\n switch (argLen) {\n case 0:\n hItem.h.call(ctx);\n break;\n case 1:\n hItem.h.call(ctx, args[0]);\n break;\n case 2:\n hItem.h.call(ctx, args[0], args[1]);\n break;\n default:\n hItem.h.apply(ctx, args.slice(1, argLen - 1));\n break;\n }\n }\n }\n eventProcessor && eventProcessor.afterTrigger\n && eventProcessor.afterTrigger(type);\n return this;\n };\n return Eventful;\n}());\nexport default Eventful;\n","var dpr = 1;\nif (typeof window !== 'undefined') {\n dpr = Math.max(window.devicePixelRatio\n || (window.screen && window.screen.deviceXDPI / window.screen.logicalXDPI)\n || 1, 1);\n}\nexport var debugMode = 0;\nexport var devicePixelRatio = dpr;\nexport var DARK_MODE_THRESHOLD = 0.4;\nexport var DARK_LABEL_COLOR = '#333';\nexport var LIGHT_LABEL_COLOR = '#ccc';\nexport var LIGHTER_LABEL_COLOR = '#eee';\n","var Browser = (function () {\n function Browser() {\n this.firefox = false;\n this.ie = false;\n this.edge = false;\n this.newEdge = false;\n this.weChat = false;\n }\n return Browser;\n}());\nvar Env = (function () {\n function Env() {\n this.browser = new Browser();\n this.node = false;\n this.wxa = false;\n this.worker = false;\n this.canvasSupported = false;\n this.svgSupported = false;\n this.touchEventsSupported = false;\n this.pointerEventsSupported = false;\n this.domSupported = false;\n this.transformSupported = false;\n this.transform3dSupported = false;\n }\n return Env;\n}());\nvar env = new Env();\nif (typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function') {\n env.wxa = true;\n env.canvasSupported = true;\n env.touchEventsSupported = true;\n}\nelse if (typeof document === 'undefined' && typeof self !== 'undefined') {\n env.worker = true;\n env.canvasSupported = true;\n}\nelse if (typeof navigator === 'undefined') {\n env.node = true;\n env.canvasSupported = true;\n env.svgSupported = true;\n}\nelse {\n detect(navigator.userAgent, env);\n}\nfunction detect(ua, env) {\n var browser = env.browser;\n var firefox = ua.match(/Firefox\\/([\\d.]+)/);\n var ie = ua.match(/MSIE\\s([\\d.]+)/)\n || ua.match(/Trident\\/.+?rv:(([\\d.]+))/);\n var edge = ua.match(/Edge?\\/([\\d.]+)/);\n var weChat = (/micromessenger/i).test(ua);\n if (firefox) {\n browser.firefox = true;\n browser.version = firefox[1];\n }\n if (ie) {\n browser.ie = true;\n browser.version = ie[1];\n }\n if (edge) {\n browser.edge = true;\n browser.version = edge[1];\n browser.newEdge = +edge[1].split('.')[0] > 18;\n }\n if (weChat) {\n browser.weChat = true;\n }\n env.canvasSupported = !!document.createElement('canvas').getContext;\n env.svgSupported = typeof SVGRect !== 'undefined';\n env.touchEventsSupported = 'ontouchstart' in window && !browser.ie && !browser.edge;\n env.pointerEventsSupported = 'onpointerdown' in window\n && (browser.edge || (browser.ie && +browser.version >= 11));\n env.domSupported = typeof document !== 'undefined';\n var style = document.documentElement.style;\n env.transform3dSupported = ((browser.ie && 'transition' in style)\n || browser.edge\n || (('WebKitCSSMatrix' in window) && ('m11' in new WebKitCSSMatrix()))\n || 'MozPerspective' in style)\n && !('OTransition' in style);\n env.transformSupported = env.transform3dSupported\n || (browser.ie && +browser.version >= 9);\n}\nexport default env;\n","export var REDARAW_BIT = 1;\nexport var STYLE_CHANGED_BIT = 2;\nexport var SHAPE_CHANGED_BIT = 4;\n","import Transformable from './core/Transformable';\nimport Animator, { cloneValue } from './animation/Animator';\nimport BoundingRect from './core/BoundingRect';\nimport Eventful from './core/Eventful';\nimport { calculateTextPosition, parsePercent } from './contain/text';\nimport { guid, isObject, keys, extend, indexOf, logError, mixin, isArrayLike, isTypedArray } from './core/util';\nimport { LIGHT_LABEL_COLOR, DARK_LABEL_COLOR } from './config';\nimport { parse, stringify } from './tool/color';\nimport env from './core/env';\nimport { REDARAW_BIT } from './graphic/constants';\nexport var PRESERVED_NORMAL_STATE = '__zr_normal__';\nvar PRIMARY_STATES_KEYS = ['x', 'y', 'scaleX', 'scaleY', 'originX', 'originY', 'rotation', 'ignore'];\nvar DEFAULT_ANIMATABLE_MAP = {\n x: true,\n y: true,\n scaleX: true,\n scaleY: true,\n originX: true,\n originY: true,\n rotation: true,\n ignore: false\n};\nvar tmpTextPosCalcRes = {};\nvar tmpBoundingRect = new BoundingRect(0, 0, 0, 0);\nvar Element = (function () {\n function Element(props) {\n this.id = guid();\n this.animators = [];\n this.currentStates = [];\n this.states = {};\n this._init(props);\n }\n Element.prototype._init = function (props) {\n this.attr(props);\n };\n Element.prototype.drift = function (dx, dy, e) {\n switch (this.draggable) {\n case 'horizontal':\n dy = 0;\n break;\n case 'vertical':\n dx = 0;\n break;\n }\n var m = this.transform;\n if (!m) {\n m = this.transform = [1, 0, 0, 1, 0, 0];\n }\n m[4] += dx;\n m[5] += dy;\n this.decomposeTransform();\n this.markRedraw();\n };\n Element.prototype.beforeUpdate = function () { };\n Element.prototype.afterUpdate = function () { };\n Element.prototype.update = function () {\n this.updateTransform();\n if (this.__dirty) {\n this.updateInnerText();\n }\n };\n Element.prototype.updateInnerText = function (forceUpdate) {\n var textEl = this._textContent;\n if (textEl && (!textEl.ignore || forceUpdate)) {\n if (!this.textConfig) {\n this.textConfig = {};\n }\n var textConfig = this.textConfig;\n var isLocal = textConfig.local;\n var attachedTransform = textEl.attachedTransform;\n var textAlign = void 0;\n var textVerticalAlign = void 0;\n var textStyleChanged = false;\n if (isLocal) {\n attachedTransform.parent = this;\n }\n else {\n attachedTransform.parent = null;\n }\n var innerOrigin = false;\n attachedTransform.x = textEl.x;\n attachedTransform.y = textEl.y;\n attachedTransform.originX = textEl.originX;\n attachedTransform.originY = textEl.originY;\n attachedTransform.rotation = textEl.rotation;\n attachedTransform.scaleX = textEl.scaleX;\n attachedTransform.scaleY = textEl.scaleY;\n if (textConfig.position != null) {\n var layoutRect = tmpBoundingRect;\n if (textConfig.layoutRect) {\n layoutRect.copy(textConfig.layoutRect);\n }\n else {\n layoutRect.copy(this.getBoundingRect());\n }\n if (!isLocal) {\n layoutRect.applyTransform(this.transform);\n }\n if (this.calculateTextPosition) {\n this.calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n }\n else {\n calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n }\n attachedTransform.x = tmpTextPosCalcRes.x;\n attachedTransform.y = tmpTextPosCalcRes.y;\n textAlign = tmpTextPosCalcRes.align;\n textVerticalAlign = tmpTextPosCalcRes.verticalAlign;\n var textOrigin = textConfig.origin;\n if (textOrigin && textConfig.rotation != null) {\n var relOriginX = void 0;\n var relOriginY = void 0;\n if (textOrigin === 'center') {\n relOriginX = layoutRect.width * 0.5;\n relOriginY = layoutRect.height * 0.5;\n }\n else {\n relOriginX = parsePercent(textOrigin[0], layoutRect.width);\n relOriginY = parsePercent(textOrigin[1], layoutRect.height);\n }\n innerOrigin = true;\n attachedTransform.originX = -attachedTransform.x + relOriginX + (isLocal ? 0 : layoutRect.x);\n attachedTransform.originY = -attachedTransform.y + relOriginY + (isLocal ? 0 : layoutRect.y);\n }\n }\n if (textConfig.rotation != null) {\n attachedTransform.rotation = textConfig.rotation;\n }\n var textOffset = textConfig.offset;\n if (textOffset) {\n attachedTransform.x += textOffset[0];\n attachedTransform.y += textOffset[1];\n if (!innerOrigin) {\n attachedTransform.originX = -textOffset[0];\n attachedTransform.originY = -textOffset[1];\n }\n }\n var isInside = textConfig.inside == null\n ? (typeof textConfig.position === 'string' && textConfig.position.indexOf('inside') >= 0)\n : textConfig.inside;\n var innerTextDefaultStyle = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {});\n var textFill = void 0;\n var textStroke = void 0;\n var autoStroke = void 0;\n if (isInside && this.canBeInsideText()) {\n textFill = textConfig.insideFill;\n textStroke = textConfig.insideStroke;\n if (textFill == null || textFill === 'auto') {\n textFill = this.getInsideTextFill();\n }\n if (textStroke == null || textStroke === 'auto') {\n textStroke = this.getInsideTextStroke(textFill);\n autoStroke = true;\n }\n }\n else {\n textFill = textConfig.outsideFill;\n textStroke = textConfig.outsideStroke;\n if (textFill == null || textFill === 'auto') {\n textFill = this.getOutsideFill();\n }\n if (textStroke == null || textStroke === 'auto') {\n textStroke = this.getOutsideStroke(textFill);\n autoStroke = true;\n }\n }\n textFill = textFill || '#000';\n if (textFill !== innerTextDefaultStyle.fill\n || textStroke !== innerTextDefaultStyle.stroke\n || autoStroke !== innerTextDefaultStyle.autoStroke\n || textAlign !== innerTextDefaultStyle.align\n || textVerticalAlign !== innerTextDefaultStyle.verticalAlign) {\n textStyleChanged = true;\n innerTextDefaultStyle.fill = textFill;\n innerTextDefaultStyle.stroke = textStroke;\n innerTextDefaultStyle.autoStroke = autoStroke;\n innerTextDefaultStyle.align = textAlign;\n innerTextDefaultStyle.verticalAlign = textVerticalAlign;\n textEl.setDefaultTextStyle(innerTextDefaultStyle);\n }\n textEl.__dirty |= REDARAW_BIT;\n if (textStyleChanged) {\n textEl.dirtyStyle(true);\n }\n }\n };\n Element.prototype.canBeInsideText = function () {\n return true;\n };\n Element.prototype.getInsideTextFill = function () {\n return '#fff';\n };\n Element.prototype.getInsideTextStroke = function (textFill) {\n return '#000';\n };\n Element.prototype.getOutsideFill = function () {\n return this.__zr && this.__zr.isDarkMode() ? LIGHT_LABEL_COLOR : DARK_LABEL_COLOR;\n };\n Element.prototype.getOutsideStroke = function (textFill) {\n var backgroundColor = this.__zr && this.__zr.getBackgroundColor();\n var colorArr = typeof backgroundColor === 'string' && parse(backgroundColor);\n if (!colorArr) {\n colorArr = [255, 255, 255, 1];\n }\n var alpha = colorArr[3];\n var isDark = this.__zr.isDarkMode();\n for (var i = 0; i < 3; i++) {\n colorArr[i] = colorArr[i] * alpha + (isDark ? 0 : 255) * (1 - alpha);\n }\n colorArr[3] = 1;\n return stringify(colorArr, 'rgba');\n };\n Element.prototype.traverse = function (cb, context) { };\n Element.prototype.attrKV = function (key, value) {\n if (key === 'textConfig') {\n this.setTextConfig(value);\n }\n else if (key === 'textContent') {\n this.setTextContent(value);\n }\n else if (key === 'clipPath') {\n this.setClipPath(value);\n }\n else if (key === 'extra') {\n this.extra = this.extra || {};\n extend(this.extra, value);\n }\n else {\n this[key] = value;\n }\n };\n Element.prototype.hide = function () {\n this.ignore = true;\n this.markRedraw();\n };\n Element.prototype.show = function () {\n this.ignore = false;\n this.markRedraw();\n };\n Element.prototype.attr = function (keyOrObj, value) {\n if (typeof keyOrObj === 'string') {\n this.attrKV(keyOrObj, value);\n }\n else if (isObject(keyOrObj)) {\n var obj = keyOrObj;\n var keysArr = keys(obj);\n for (var i = 0; i < keysArr.length; i++) {\n var key = keysArr[i];\n this.attrKV(key, keyOrObj[key]);\n }\n }\n this.markRedraw();\n return this;\n };\n Element.prototype.saveCurrentToNormalState = function (toState) {\n this._innerSaveToNormal(toState);\n var normalState = this._normalState;\n for (var i = 0; i < this.animators.length; i++) {\n var animator = this.animators[i];\n var fromStateTransition = animator.__fromStateTransition;\n if (fromStateTransition && fromStateTransition !== PRESERVED_NORMAL_STATE) {\n continue;\n }\n var targetName = animator.targetName;\n var target = targetName\n ? normalState[targetName] : normalState;\n animator.saveFinalToTarget(target);\n }\n };\n Element.prototype._innerSaveToNormal = function (toState) {\n var normalState = this._normalState;\n if (!normalState) {\n normalState = this._normalState = {};\n }\n if (toState.textConfig && !normalState.textConfig) {\n normalState.textConfig = this.textConfig;\n }\n this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);\n };\n Element.prototype._savePrimaryToNormal = function (toState, normalState, primaryKeys) {\n for (var i = 0; i < primaryKeys.length; i++) {\n var key = primaryKeys[i];\n if (toState[key] != null && !(key in normalState)) {\n normalState[key] = this[key];\n }\n }\n };\n Element.prototype.hasState = function () {\n return this.currentStates.length > 0;\n };\n Element.prototype.getState = function (name) {\n return this.states[name];\n };\n Element.prototype.ensureState = function (name) {\n var states = this.states;\n if (!states[name]) {\n states[name] = {};\n }\n return states[name];\n };\n Element.prototype.clearStates = function (noAnimation) {\n this.useState(PRESERVED_NORMAL_STATE, false, noAnimation);\n };\n Element.prototype.useState = function (stateName, keepCurrentStates, noAnimation, forceUseHoverLayer) {\n var toNormalState = stateName === PRESERVED_NORMAL_STATE;\n var hasStates = this.hasState();\n if (!hasStates && toNormalState) {\n return;\n }\n var currentStates = this.currentStates;\n var animationCfg = this.stateTransition;\n if (indexOf(currentStates, stateName) >= 0 && (keepCurrentStates || currentStates.length === 1)) {\n return;\n }\n var state;\n if (this.stateProxy && !toNormalState) {\n state = this.stateProxy(stateName);\n }\n if (!state) {\n state = (this.states && this.states[stateName]);\n }\n if (!state && !toNormalState) {\n logError(\"State \" + stateName + \" not exists.\");\n return;\n }\n if (!toNormalState) {\n this.saveCurrentToNormalState(state);\n }\n var useHoverLayer = !!((state && state.hoverLayer) || forceUseHoverLayer);\n if (useHoverLayer) {\n this._toggleHoverLayerFlag(true);\n }\n this._applyStateObj(stateName, state, this._normalState, keepCurrentStates, !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0, animationCfg);\n var textContent = this._textContent;\n var textGuide = this._textGuide;\n if (textContent) {\n textContent.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);\n }\n if (textGuide) {\n textGuide.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);\n }\n if (toNormalState) {\n this.currentStates = [];\n this._normalState = {};\n }\n else {\n if (!keepCurrentStates) {\n this.currentStates = [stateName];\n }\n else {\n this.currentStates.push(stateName);\n }\n }\n this._updateAnimationTargets();\n this.markRedraw();\n if (!useHoverLayer && this.__inHover) {\n this._toggleHoverLayerFlag(false);\n this.__dirty &= ~REDARAW_BIT;\n }\n return state;\n };\n Element.prototype.useStates = function (states, noAnimation, forceUseHoverLayer) {\n if (!states.length) {\n this.clearStates();\n }\n else {\n var stateObjects = [];\n var currentStates = this.currentStates;\n var len = states.length;\n var notChange = len === currentStates.length;\n if (notChange) {\n for (var i = 0; i < len; i++) {\n if (states[i] !== currentStates[i]) {\n notChange = false;\n break;\n }\n }\n }\n if (notChange) {\n return;\n }\n for (var i = 0; i < len; i++) {\n var stateName = states[i];\n var stateObj = void 0;\n if (this.stateProxy) {\n stateObj = this.stateProxy(stateName, states);\n }\n if (!stateObj) {\n stateObj = this.states[stateName];\n }\n if (stateObj) {\n stateObjects.push(stateObj);\n }\n }\n var lastStateObj = stateObjects[len - 1];\n var useHoverLayer = !!((lastStateObj && lastStateObj.hoverLayer) || forceUseHoverLayer);\n if (useHoverLayer) {\n this._toggleHoverLayerFlag(true);\n }\n var mergedState = this._mergeStates(stateObjects);\n var animationCfg = this.stateTransition;\n this.saveCurrentToNormalState(mergedState);\n this._applyStateObj(states.join(','), mergedState, this._normalState, false, !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0, animationCfg);\n var textContent = this._textContent;\n var textGuide = this._textGuide;\n if (textContent) {\n textContent.useStates(states, noAnimation, useHoverLayer);\n }\n if (textGuide) {\n textGuide.useStates(states, noAnimation, useHoverLayer);\n }\n this._updateAnimationTargets();\n this.currentStates = states.slice();\n this.markRedraw();\n if (!useHoverLayer && this.__inHover) {\n this._toggleHoverLayerFlag(false);\n this.__dirty &= ~REDARAW_BIT;\n }\n }\n };\n Element.prototype._updateAnimationTargets = function () {\n for (var i = 0; i < this.animators.length; i++) {\n var animator = this.animators[i];\n if (animator.targetName) {\n animator.changeTarget(this[animator.targetName]);\n }\n }\n };\n Element.prototype.removeState = function (state) {\n var idx = indexOf(this.currentStates, state);\n if (idx >= 0) {\n var currentStates = this.currentStates.slice();\n currentStates.splice(idx, 1);\n this.useStates(currentStates);\n }\n };\n Element.prototype.replaceState = function (oldState, newState, forceAdd) {\n var currentStates = this.currentStates.slice();\n var idx = indexOf(currentStates, oldState);\n var newStateExists = indexOf(currentStates, newState) >= 0;\n if (idx >= 0) {\n if (!newStateExists) {\n currentStates[idx] = newState;\n }\n else {\n currentStates.splice(idx, 1);\n }\n }\n else if (forceAdd && !newStateExists) {\n currentStates.push(newState);\n }\n this.useStates(currentStates);\n };\n Element.prototype.toggleState = function (state, enable) {\n if (enable) {\n this.useState(state, true);\n }\n else {\n this.removeState(state);\n }\n };\n Element.prototype._mergeStates = function (states) {\n var mergedState = {};\n var mergedTextConfig;\n for (var i = 0; i < states.length; i++) {\n var state = states[i];\n extend(mergedState, state);\n if (state.textConfig) {\n mergedTextConfig = mergedTextConfig || {};\n extend(mergedTextConfig, state.textConfig);\n }\n }\n if (mergedTextConfig) {\n mergedState.textConfig = mergedTextConfig;\n }\n return mergedState;\n };\n Element.prototype._applyStateObj = function (stateName, state, normalState, keepCurrentStates, transition, animationCfg) {\n var needsRestoreToNormal = !(state && keepCurrentStates);\n if (state && state.textConfig) {\n this.textConfig = extend({}, keepCurrentStates ? this.textConfig : normalState.textConfig);\n extend(this.textConfig, state.textConfig);\n }\n else if (needsRestoreToNormal) {\n if (normalState.textConfig) {\n this.textConfig = normalState.textConfig;\n }\n }\n var transitionTarget = {};\n var hasTransition = false;\n for (var i = 0; i < PRIMARY_STATES_KEYS.length; i++) {\n var key = PRIMARY_STATES_KEYS[i];\n var propNeedsTransition = transition && DEFAULT_ANIMATABLE_MAP[key];\n if (state && state[key] != null) {\n if (propNeedsTransition) {\n hasTransition = true;\n transitionTarget[key] = state[key];\n }\n else {\n this[key] = state[key];\n }\n }\n else if (needsRestoreToNormal) {\n if (normalState[key] != null) {\n if (propNeedsTransition) {\n hasTransition = true;\n transitionTarget[key] = normalState[key];\n }\n else {\n this[key] = normalState[key];\n }\n }\n }\n }\n if (!transition) {\n for (var i = 0; i < this.animators.length; i++) {\n var animator = this.animators[i];\n var targetName = animator.targetName;\n animator.__changeFinalValue(targetName\n ? (state || normalState)[targetName]\n : (state || normalState));\n }\n }\n if (hasTransition) {\n this._transitionState(stateName, transitionTarget, animationCfg);\n }\n };\n Element.prototype._attachComponent = function (componentEl) {\n if (componentEl.__zr && !componentEl.__hostTarget) {\n throw new Error('Text element has been added to zrender.');\n }\n if (componentEl === this) {\n throw new Error('Recursive component attachment.');\n }\n var zr = this.__zr;\n if (zr) {\n componentEl.addSelfToZr(zr);\n }\n componentEl.__zr = zr;\n componentEl.__hostTarget = this;\n };\n Element.prototype._detachComponent = function (componentEl) {\n if (componentEl.__zr) {\n componentEl.removeSelfFromZr(componentEl.__zr);\n }\n componentEl.__zr = null;\n componentEl.__hostTarget = null;\n };\n Element.prototype.getClipPath = function () {\n return this._clipPath;\n };\n Element.prototype.setClipPath = function (clipPath) {\n if (this._clipPath && this._clipPath !== clipPath) {\n this.removeClipPath();\n }\n this._attachComponent(clipPath);\n this._clipPath = clipPath;\n this.markRedraw();\n };\n Element.prototype.removeClipPath = function () {\n var clipPath = this._clipPath;\n if (clipPath) {\n this._detachComponent(clipPath);\n this._clipPath = null;\n this.markRedraw();\n }\n };\n Element.prototype.getTextContent = function () {\n return this._textContent;\n };\n Element.prototype.setTextContent = function (textEl) {\n var previousTextContent = this._textContent;\n if (previousTextContent === textEl) {\n return;\n }\n if (previousTextContent && previousTextContent !== textEl) {\n this.removeTextContent();\n }\n if (textEl.__zr && !textEl.__hostTarget) {\n throw new Error('Text element has been added to zrender.');\n }\n textEl.attachedTransform = new Transformable();\n this._attachComponent(textEl);\n this._textContent = textEl;\n this.markRedraw();\n };\n Element.prototype.setTextConfig = function (cfg) {\n if (!this.textConfig) {\n this.textConfig = {};\n }\n extend(this.textConfig, cfg);\n this.markRedraw();\n };\n Element.prototype.removeTextConfig = function () {\n this.textConfig = null;\n this.markRedraw();\n };\n Element.prototype.removeTextContent = function () {\n var textEl = this._textContent;\n if (textEl) {\n textEl.attachedTransform = null;\n this._detachComponent(textEl);\n this._textContent = null;\n this._innerTextDefaultStyle = null;\n this.markRedraw();\n }\n };\n Element.prototype.getTextGuideLine = function () {\n return this._textGuide;\n };\n Element.prototype.setTextGuideLine = function (guideLine) {\n if (this._textGuide && this._textGuide !== guideLine) {\n this.removeTextGuideLine();\n }\n this._attachComponent(guideLine);\n this._textGuide = guideLine;\n this.markRedraw();\n };\n Element.prototype.removeTextGuideLine = function () {\n var textGuide = this._textGuide;\n if (textGuide) {\n this._detachComponent(textGuide);\n this._textGuide = null;\n this.markRedraw();\n }\n };\n Element.prototype.markRedraw = function () {\n this.__dirty |= REDARAW_BIT;\n var zr = this.__zr;\n if (zr) {\n if (this.__inHover) {\n zr.refreshHover();\n }\n else {\n zr.refresh();\n }\n }\n if (this.__hostTarget) {\n this.__hostTarget.markRedraw();\n }\n };\n Element.prototype.dirty = function () {\n this.markRedraw();\n };\n Element.prototype._toggleHoverLayerFlag = function (inHover) {\n this.__inHover = inHover;\n var textContent = this._textContent;\n var textGuide = this._textGuide;\n if (textContent) {\n textContent.__inHover = inHover;\n }\n if (textGuide) {\n textGuide.__inHover = inHover;\n }\n };\n Element.prototype.addSelfToZr = function (zr) {\n this.__zr = zr;\n var animators = this.animators;\n if (animators) {\n for (var i = 0; i < animators.length; i++) {\n zr.animation.addAnimator(animators[i]);\n }\n }\n if (this._clipPath) {\n this._clipPath.addSelfToZr(zr);\n }\n if (this._textContent) {\n this._textContent.addSelfToZr(zr);\n }\n if (this._textGuide) {\n this._textGuide.addSelfToZr(zr);\n }\n };\n Element.prototype.removeSelfFromZr = function (zr) {\n this.__zr = null;\n var animators = this.animators;\n if (animators) {\n for (var i = 0; i < animators.length; i++) {\n zr.animation.removeAnimator(animators[i]);\n }\n }\n if (this._clipPath) {\n this._clipPath.removeSelfFromZr(zr);\n }\n if (this._textContent) {\n this._textContent.removeSelfFromZr(zr);\n }\n if (this._textGuide) {\n this._textGuide.removeSelfFromZr(zr);\n }\n };\n Element.prototype.animate = function (key, loop) {\n var target = key ? this[key] : this;\n if (!target) {\n logError('Property \"'\n + key\n + '\" is not existed in element '\n + this.id);\n return;\n }\n var animator = new Animator(target, loop);\n this.addAnimator(animator, key);\n return animator;\n };\n Element.prototype.addAnimator = function (animator, key) {\n var zr = this.__zr;\n var el = this;\n animator.during(function () {\n el.updateDuringAnimation(key);\n }).done(function () {\n var animators = el.animators;\n var idx = indexOf(animators, animator);\n if (idx >= 0) {\n animators.splice(idx, 1);\n }\n });\n this.animators.push(animator);\n if (zr) {\n zr.animation.addAnimator(animator);\n }\n zr && zr.wakeUp();\n };\n Element.prototype.updateDuringAnimation = function (key) {\n this.markRedraw();\n };\n Element.prototype.stopAnimation = function (scope, forwardToLast) {\n var animators = this.animators;\n var len = animators.length;\n var leftAnimators = [];\n for (var i = 0; i < len; i++) {\n var animator = animators[i];\n if (!scope || scope === animator.scope) {\n animator.stop(forwardToLast);\n }\n else {\n leftAnimators.push(animator);\n }\n }\n this.animators = leftAnimators;\n return this;\n };\n Element.prototype.animateTo = function (target, cfg, animationProps) {\n animateTo(this, target, cfg, animationProps);\n };\n Element.prototype.animateFrom = function (target, cfg, animationProps) {\n animateTo(this, target, cfg, animationProps, true);\n };\n Element.prototype._transitionState = function (stateName, target, cfg, animationProps) {\n var animators = animateTo(this, target, cfg, animationProps);\n for (var i = 0; i < animators.length; i++) {\n animators[i].__fromStateTransition = stateName;\n }\n };\n Element.prototype.getBoundingRect = function () {\n return null;\n };\n Element.prototype.getPaintRect = function () {\n return null;\n };\n Element.initDefaultProps = (function () {\n var elProto = Element.prototype;\n elProto.type = 'element';\n elProto.name = '';\n elProto.ignore = false;\n elProto.silent = false;\n elProto.isGroup = false;\n elProto.draggable = false;\n elProto.dragging = false;\n elProto.ignoreClip = false;\n elProto.__inHover = false;\n elProto.__dirty = REDARAW_BIT;\n var logs = {};\n function logDeprecatedError(key, xKey, yKey) {\n if (!logs[key + xKey + yKey]) {\n console.warn(\"DEPRECATED: '\" + key + \"' has been deprecated. use '\" + xKey + \"', '\" + yKey + \"' instead\");\n logs[key + xKey + yKey] = true;\n }\n }\n function createLegacyProperty(key, privateKey, xKey, yKey) {\n Object.defineProperty(elProto, key, {\n get: function () {\n logDeprecatedError(key, xKey, yKey);\n if (!this[privateKey]) {\n var pos = this[privateKey] = [];\n enhanceArray(this, pos);\n }\n return this[privateKey];\n },\n set: function (pos) {\n logDeprecatedError(key, xKey, yKey);\n this[xKey] = pos[0];\n this[yKey] = pos[1];\n this[privateKey] = pos;\n enhanceArray(this, pos);\n }\n });\n function enhanceArray(self, pos) {\n Object.defineProperty(pos, 0, {\n get: function () {\n return self[xKey];\n },\n set: function (val) {\n self[xKey] = val;\n }\n });\n Object.defineProperty(pos, 1, {\n get: function () {\n return self[yKey];\n },\n set: function (val) {\n self[yKey] = val;\n }\n });\n }\n }\n if (Object.defineProperty && (!env.browser.ie || env.browser.version > 8)) {\n createLegacyProperty('position', '_legacyPos', 'x', 'y');\n createLegacyProperty('scale', '_legacyScale', 'scaleX', 'scaleY');\n createLegacyProperty('origin', '_legacyOrigin', 'originX', 'originY');\n }\n })();\n return Element;\n}());\nmixin(Element, Eventful);\nmixin(Element, Transformable);\nfunction animateTo(animatable, target, cfg, animationProps, reverse) {\n cfg = cfg || {};\n var animators = [];\n animateToShallow(animatable, '', animatable, target, cfg, animationProps, animators, reverse);\n var finishCount = animators.length;\n var doneHappened = false;\n var cfgDone = cfg.done;\n var cfgAborted = cfg.aborted;\n var doneCb = function () {\n doneHappened = true;\n finishCount--;\n if (finishCount <= 0) {\n doneHappened\n ? (cfgDone && cfgDone())\n : (cfgAborted && cfgAborted());\n }\n };\n var abortedCb = function () {\n finishCount--;\n if (finishCount <= 0) {\n doneHappened\n ? (cfgDone && cfgDone())\n : (cfgAborted && cfgAborted());\n }\n };\n if (!finishCount) {\n cfgDone && cfgDone();\n }\n if (animators.length > 0 && cfg.during) {\n animators[0].during(function (target, percent) {\n cfg.during(percent);\n });\n }\n for (var i = 0; i < animators.length; i++) {\n var animator = animators[i];\n if (doneCb) {\n animator.done(doneCb);\n }\n if (abortedCb) {\n animator.aborted(abortedCb);\n }\n animator.start(cfg.easing, cfg.force);\n }\n return animators;\n}\nfunction copyArrShallow(source, target, len) {\n for (var i = 0; i < len; i++) {\n source[i] = target[i];\n }\n}\nfunction is2DArray(value) {\n return isArrayLike(value[0]);\n}\nfunction copyValue(target, source, key) {\n if (isArrayLike(source[key])) {\n if (!isArrayLike(target[key])) {\n target[key] = [];\n }\n if (isTypedArray(source[key])) {\n var len = source[key].length;\n if (target[key].length !== len) {\n target[key] = new (source[key].constructor)(len);\n copyArrShallow(target[key], source[key], len);\n }\n }\n else {\n var sourceArr = source[key];\n var targetArr = target[key];\n var len0 = sourceArr.length;\n if (is2DArray(sourceArr)) {\n var len1 = sourceArr[0].length;\n for (var i = 0; i < len0; i++) {\n if (!targetArr[i]) {\n targetArr[i] = Array.prototype.slice.call(sourceArr[i]);\n }\n else {\n copyArrShallow(targetArr[i], sourceArr[i], len1);\n }\n }\n }\n else {\n copyArrShallow(targetArr, sourceArr, len0);\n }\n targetArr.length = sourceArr.length;\n }\n }\n else {\n target[key] = source[key];\n }\n}\nfunction animateToShallow(animatable, topKey, source, target, cfg, animationProps, animators, reverse) {\n var animatableKeys = [];\n var changedKeys = [];\n var targetKeys = keys(target);\n var duration = cfg.duration;\n var delay = cfg.delay;\n var additive = cfg.additive;\n var setToFinal = cfg.setToFinal;\n var animateAll = !isObject(animationProps);\n for (var k = 0; k < targetKeys.length; k++) {\n var innerKey = targetKeys[k];\n if (source[innerKey] != null\n && target[innerKey] != null\n && (animateAll || animationProps[innerKey])) {\n if (isObject(target[innerKey]) && !isArrayLike(target[innerKey])) {\n if (topKey) {\n if (!reverse) {\n source[innerKey] = target[innerKey];\n animatable.updateDuringAnimation(topKey);\n }\n continue;\n }\n animateToShallow(animatable, innerKey, source[innerKey], target[innerKey], cfg, animationProps && animationProps[innerKey], animators, reverse);\n }\n else {\n animatableKeys.push(innerKey);\n changedKeys.push(innerKey);\n }\n }\n else if (!reverse) {\n source[innerKey] = target[innerKey];\n animatable.updateDuringAnimation(topKey);\n changedKeys.push(innerKey);\n }\n }\n var keyLen = animatableKeys.length;\n if (keyLen > 0\n || (cfg.force && !animators.length)) {\n var existsAnimators = animatable.animators;\n var existsAnimatorsOnSameTarget = [];\n for (var i = 0; i < existsAnimators.length; i++) {\n if (existsAnimators[i].targetName === topKey) {\n existsAnimatorsOnSameTarget.push(existsAnimators[i]);\n }\n }\n if (!additive && existsAnimatorsOnSameTarget.length) {\n for (var i = 0; i < existsAnimatorsOnSameTarget.length; i++) {\n var allAborted = existsAnimatorsOnSameTarget[i].stopTracks(changedKeys);\n if (allAborted) {\n var idx = indexOf(existsAnimators, existsAnimatorsOnSameTarget[i]);\n existsAnimators.splice(idx, 1);\n }\n }\n }\n var revertedSource = void 0;\n var reversedTarget = void 0;\n var sourceClone = void 0;\n if (reverse) {\n reversedTarget = {};\n if (setToFinal) {\n revertedSource = {};\n }\n for (var i = 0; i < keyLen; i++) {\n var innerKey = animatableKeys[i];\n reversedTarget[innerKey] = source[innerKey];\n if (setToFinal) {\n revertedSource[innerKey] = target[innerKey];\n }\n else {\n source[innerKey] = target[innerKey];\n }\n }\n }\n else if (setToFinal) {\n sourceClone = {};\n for (var i = 0; i < keyLen; i++) {\n var innerKey = animatableKeys[i];\n sourceClone[innerKey] = cloneValue(source[innerKey]);\n copyValue(source, target, innerKey);\n }\n }\n var animator = new Animator(source, false, additive ? existsAnimatorsOnSameTarget : null);\n animator.targetName = topKey;\n if (cfg.scope) {\n animator.scope = cfg.scope;\n }\n if (setToFinal && revertedSource) {\n animator.whenWithKeys(0, revertedSource, animatableKeys);\n }\n if (sourceClone) {\n animator.whenWithKeys(0, sourceClone, animatableKeys);\n }\n animator.whenWithKeys(duration == null ? 500 : duration, reverse ? reversedTarget : target, animatableKeys).delay(delay || 0);\n animatable.addAnimator(animator, topKey);\n animators.push(animator);\n }\n}\nexport default Element;\n","import { __extends } from \"tslib\";\nimport Element from '../Element';\nimport BoundingRect from '../core/BoundingRect';\nimport { keys, extend, createObject } from '../core/util';\nimport { REDARAW_BIT, STYLE_CHANGED_BIT } from './constants';\nvar STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));\nexport var DEFAULT_COMMON_STYLE = {\n shadowBlur: 0,\n shadowOffsetX: 0,\n shadowOffsetY: 0,\n shadowColor: '#000',\n opacity: 1,\n blend: 'source-over'\n};\nexport var DEFAULT_COMMON_ANIMATION_PROPS = {\n style: {\n shadowBlur: true,\n shadowOffsetX: true,\n shadowOffsetY: true,\n shadowColor: true,\n opacity: true\n }\n};\nDEFAULT_COMMON_STYLE[STYLE_MAGIC_KEY] = true;\nvar PRIMARY_STATES_KEYS = ['z', 'z2', 'invisible'];\nvar PRIMARY_STATES_KEYS_IN_HOVER_LAYER = ['invisible'];\nvar Displayable = (function (_super) {\n __extends(Displayable, _super);\n function Displayable(props) {\n return _super.call(this, props) || this;\n }\n Displayable.prototype._init = function (props) {\n var keysArr = keys(props);\n for (var i = 0; i < keysArr.length; i++) {\n var key = keysArr[i];\n if (key === 'style') {\n this.useStyle(props[key]);\n }\n else {\n _super.prototype.attrKV.call(this, key, props[key]);\n }\n }\n if (!this.style) {\n this.useStyle({});\n }\n };\n Displayable.prototype.beforeBrush = function () { };\n Displayable.prototype.afterBrush = function () { };\n Displayable.prototype.innerBeforeBrush = function () { };\n Displayable.prototype.innerAfterBrush = function () { };\n Displayable.prototype.shouldBePainted = function (viewWidth, viewHeight, considerClipPath, considerAncestors) {\n var m = this.transform;\n if (this.ignore\n || this.invisible\n || this.style.opacity === 0\n || (this.culling\n && isDisplayableCulled(this, viewWidth, viewHeight))\n || (m && !m[0] && !m[3])) {\n return false;\n }\n if (considerClipPath && this.__clipPaths) {\n for (var i = 0; i < this.__clipPaths.length; ++i) {\n if (this.__clipPaths[i].isZeroArea()) {\n return false;\n }\n }\n }\n if (considerAncestors && this.parent) {\n var parent_1 = this.parent;\n while (parent_1) {\n if (parent_1.ignore) {\n return false;\n }\n parent_1 = parent_1.parent;\n }\n }\n return true;\n };\n Displayable.prototype.contain = function (x, y) {\n return this.rectContain(x, y);\n };\n Displayable.prototype.traverse = function (cb, context) {\n cb.call(context, this);\n };\n Displayable.prototype.rectContain = function (x, y) {\n var coord = this.transformCoordToLocal(x, y);\n var rect = this.getBoundingRect();\n return rect.contain(coord[0], coord[1]);\n };\n Displayable.prototype.getPaintRect = function () {\n var rect = this._paintRect;\n if (!this._paintRect || this.__dirty) {\n var transform = this.transform;\n var elRect = this.getBoundingRect();\n var style = this.style;\n var shadowSize = style.shadowBlur || 0;\n var shadowOffsetX = style.shadowOffsetX || 0;\n var shadowOffsetY = style.shadowOffsetY || 0;\n rect = this._paintRect || (this._paintRect = new BoundingRect(0, 0, 0, 0));\n if (transform) {\n BoundingRect.applyTransform(rect, elRect, transform);\n }\n else {\n rect.copy(elRect);\n }\n if (shadowSize || shadowOffsetX || shadowOffsetY) {\n rect.width += shadowSize * 2 + Math.abs(shadowOffsetX);\n rect.height += shadowSize * 2 + Math.abs(shadowOffsetY);\n rect.x = Math.min(rect.x, rect.x + shadowOffsetX - shadowSize);\n rect.y = Math.min(rect.y, rect.y + shadowOffsetY - shadowSize);\n }\n var tolerance = this.dirtyRectTolerance;\n if (!rect.isZero()) {\n rect.x = Math.floor(rect.x - tolerance);\n rect.y = Math.floor(rect.y - tolerance);\n rect.width = Math.ceil(rect.width + 1 + tolerance * 2);\n rect.height = Math.ceil(rect.height + 1 + tolerance * 2);\n }\n }\n return rect;\n };\n Displayable.prototype.setPrevPaintRect = function (paintRect) {\n if (paintRect) {\n this._prevPaintRect = this._prevPaintRect || new BoundingRect(0, 0, 0, 0);\n this._prevPaintRect.copy(paintRect);\n }\n else {\n this._prevPaintRect = null;\n }\n };\n Displayable.prototype.getPrevPaintRect = function () {\n return this._prevPaintRect;\n };\n Displayable.prototype.animateStyle = function (loop) {\n return this.animate('style', loop);\n };\n Displayable.prototype.updateDuringAnimation = function (targetKey) {\n if (targetKey === 'style') {\n this.dirtyStyle();\n }\n else {\n this.markRedraw();\n }\n };\n Displayable.prototype.attrKV = function (key, value) {\n if (key !== 'style') {\n _super.prototype.attrKV.call(this, key, value);\n }\n else {\n if (!this.style) {\n this.useStyle(value);\n }\n else {\n this.setStyle(value);\n }\n }\n };\n Displayable.prototype.setStyle = function (keyOrObj, value) {\n if (typeof keyOrObj === 'string') {\n this.style[keyOrObj] = value;\n }\n else {\n extend(this.style, keyOrObj);\n }\n this.dirtyStyle();\n return this;\n };\n Displayable.prototype.dirtyStyle = function (notRedraw) {\n if (!notRedraw) {\n this.markRedraw();\n }\n this.__dirty |= STYLE_CHANGED_BIT;\n if (this._rect) {\n this._rect = null;\n }\n };\n Displayable.prototype.dirty = function () {\n this.dirtyStyle();\n };\n Displayable.prototype.styleChanged = function () {\n return !!(this.__dirty & STYLE_CHANGED_BIT);\n };\n Displayable.prototype.styleUpdated = function () {\n this.__dirty &= ~STYLE_CHANGED_BIT;\n };\n Displayable.prototype.createStyle = function (obj) {\n return createObject(DEFAULT_COMMON_STYLE, obj);\n };\n Displayable.prototype.useStyle = function (obj) {\n if (!obj[STYLE_MAGIC_KEY]) {\n obj = this.createStyle(obj);\n }\n if (this.__inHover) {\n this.__hoverStyle = obj;\n }\n else {\n this.style = obj;\n }\n this.dirtyStyle();\n };\n Displayable.prototype.isStyleObject = function (obj) {\n return obj[STYLE_MAGIC_KEY];\n };\n Displayable.prototype._innerSaveToNormal = function (toState) {\n _super.prototype._innerSaveToNormal.call(this, toState);\n var normalState = this._normalState;\n if (toState.style && !normalState.style) {\n normalState.style = this._mergeStyle(this.createStyle(), this.style);\n }\n this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);\n };\n Displayable.prototype._applyStateObj = function (stateName, state, normalState, keepCurrentStates, transition, animationCfg) {\n _super.prototype._applyStateObj.call(this, stateName, state, normalState, keepCurrentStates, transition, animationCfg);\n var needsRestoreToNormal = !(state && keepCurrentStates);\n var targetStyle;\n if (state && state.style) {\n if (transition) {\n if (keepCurrentStates) {\n targetStyle = state.style;\n }\n else {\n targetStyle = this._mergeStyle(this.createStyle(), normalState.style);\n this._mergeStyle(targetStyle, state.style);\n }\n }\n else {\n targetStyle = this._mergeStyle(this.createStyle(), keepCurrentStates ? this.style : normalState.style);\n this._mergeStyle(targetStyle, state.style);\n }\n }\n else if (needsRestoreToNormal) {\n targetStyle = normalState.style;\n }\n if (targetStyle) {\n if (transition) {\n var sourceStyle = this.style;\n this.style = this.createStyle(needsRestoreToNormal ? {} : sourceStyle);\n if (needsRestoreToNormal) {\n var changedKeys = keys(sourceStyle);\n for (var i = 0; i < changedKeys.length; i++) {\n var key = changedKeys[i];\n if (key in targetStyle) {\n targetStyle[key] = targetStyle[key];\n this.style[key] = sourceStyle[key];\n }\n }\n }\n var targetKeys = keys(targetStyle);\n for (var i = 0; i < targetKeys.length; i++) {\n var key = targetKeys[i];\n this.style[key] = this.style[key];\n }\n this._transitionState(stateName, {\n style: targetStyle\n }, animationCfg, this.getAnimationStyleProps());\n }\n else {\n this.useStyle(targetStyle);\n }\n }\n var statesKeys = this.__inHover ? PRIMARY_STATES_KEYS_IN_HOVER_LAYER : PRIMARY_STATES_KEYS;\n for (var i = 0; i < statesKeys.length; i++) {\n var key = statesKeys[i];\n if (state && state[key] != null) {\n this[key] = state[key];\n }\n else if (needsRestoreToNormal) {\n if (normalState[key] != null) {\n this[key] = normalState[key];\n }\n }\n }\n };\n Displayable.prototype._mergeStates = function (states) {\n var mergedState = _super.prototype._mergeStates.call(this, states);\n var mergedStyle;\n for (var i = 0; i < states.length; i++) {\n var state = states[i];\n if (state.style) {\n mergedStyle = mergedStyle || {};\n this._mergeStyle(mergedStyle, state.style);\n }\n }\n if (mergedStyle) {\n mergedState.style = mergedStyle;\n }\n return mergedState;\n };\n Displayable.prototype._mergeStyle = function (targetStyle, sourceStyle) {\n extend(targetStyle, sourceStyle);\n return targetStyle;\n };\n Displayable.prototype.getAnimationStyleProps = function () {\n return DEFAULT_COMMON_ANIMATION_PROPS;\n };\n Displayable.initDefaultProps = (function () {\n var dispProto = Displayable.prototype;\n dispProto.type = 'displayable';\n dispProto.invisible = false;\n dispProto.z = 0;\n dispProto.z2 = 0;\n dispProto.zlevel = 0;\n dispProto.culling = false;\n dispProto.cursor = 'pointer';\n dispProto.rectHover = false;\n dispProto.incremental = false;\n dispProto._rect = null;\n dispProto.dirtyRectTolerance = 0;\n dispProto.__dirty = REDARAW_BIT | STYLE_CHANGED_BIT;\n })();\n return Displayable;\n}(Element));\nvar tmpRect = new BoundingRect(0, 0, 0, 0);\nvar viewRect = new BoundingRect(0, 0, 0, 0);\nfunction isDisplayableCulled(el, width, height) {\n tmpRect.copy(el.getBoundingRect());\n if (el.transform) {\n tmpRect.applyTransform(el.transform);\n }\n viewRect.width = width;\n viewRect.height = height;\n return !tmpRect.intersect(viewRect);\n}\nexport default Displayable;\n","import { create as v2Create, distSquare as v2DistSquare } from './vector';\nvar mathPow = Math.pow;\nvar mathSqrt = Math.sqrt;\nvar EPSILON = 1e-8;\nvar EPSILON_NUMERIC = 1e-4;\nvar THREE_SQRT = mathSqrt(3);\nvar ONE_THIRD = 1 / 3;\nvar _v0 = v2Create();\nvar _v1 = v2Create();\nvar _v2 = v2Create();\nfunction isAroundZero(val) {\n return val > -EPSILON && val < EPSILON;\n}\nfunction isNotAroundZero(val) {\n return val > EPSILON || val < -EPSILON;\n}\nexport function cubicAt(p0, p1, p2, p3, t) {\n var onet = 1 - t;\n return onet * onet * (onet * p0 + 3 * t * p1)\n + t * t * (t * p3 + 3 * onet * p2);\n}\nexport function cubicDerivativeAt(p0, p1, p2, p3, t) {\n var onet = 1 - t;\n return 3 * (((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet\n + (p3 - p2) * t * t);\n}\nexport function cubicRootAt(p0, p1, p2, p3, val, roots) {\n var a = p3 + 3 * (p1 - p2) - p0;\n var b = 3 * (p2 - p1 * 2 + p0);\n var c = 3 * (p1 - p0);\n var d = p0 - val;\n var A = b * b - 3 * a * c;\n var B = b * c - 9 * a * d;\n var C = c * c - 3 * b * d;\n var n = 0;\n if (isAroundZero(A) && isAroundZero(B)) {\n if (isAroundZero(b)) {\n roots[0] = 0;\n }\n else {\n var t1 = -c / b;\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n }\n }\n else {\n var disc = B * B - 4 * A * C;\n if (isAroundZero(disc)) {\n var K = B / A;\n var t1 = -b / a + K;\n var t2 = -K / 2;\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n if (t2 >= 0 && t2 <= 1) {\n roots[n++] = t2;\n }\n }\n else if (disc > 0) {\n var discSqrt = mathSqrt(disc);\n var Y1 = A * b + 1.5 * a * (-B + discSqrt);\n var Y2 = A * b + 1.5 * a * (-B - discSqrt);\n if (Y1 < 0) {\n Y1 = -mathPow(-Y1, ONE_THIRD);\n }\n else {\n Y1 = mathPow(Y1, ONE_THIRD);\n }\n if (Y2 < 0) {\n Y2 = -mathPow(-Y2, ONE_THIRD);\n }\n else {\n Y2 = mathPow(Y2, ONE_THIRD);\n }\n var t1 = (-b - (Y1 + Y2)) / (3 * a);\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n }\n else {\n var T = (2 * A * b - 3 * a * B) / (2 * mathSqrt(A * A * A));\n var theta = Math.acos(T) / 3;\n var ASqrt = mathSqrt(A);\n var tmp = Math.cos(theta);\n var t1 = (-b - 2 * ASqrt * tmp) / (3 * a);\n var t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a);\n var t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n if (t2 >= 0 && t2 <= 1) {\n roots[n++] = t2;\n }\n if (t3 >= 0 && t3 <= 1) {\n roots[n++] = t3;\n }\n }\n }\n return n;\n}\nexport function cubicExtrema(p0, p1, p2, p3, extrema) {\n var b = 6 * p2 - 12 * p1 + 6 * p0;\n var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;\n var c = 3 * p1 - 3 * p0;\n var n = 0;\n if (isAroundZero(a)) {\n if (isNotAroundZero(b)) {\n var t1 = -c / b;\n if (t1 >= 0 && t1 <= 1) {\n extrema[n++] = t1;\n }\n }\n }\n else {\n var disc = b * b - 4 * a * c;\n if (isAroundZero(disc)) {\n extrema[0] = -b / (2 * a);\n }\n else if (disc > 0) {\n var discSqrt = mathSqrt(disc);\n var t1 = (-b + discSqrt) / (2 * a);\n var t2 = (-b - discSqrt) / (2 * a);\n if (t1 >= 0 && t1 <= 1) {\n extrema[n++] = t1;\n }\n if (t2 >= 0 && t2 <= 1) {\n extrema[n++] = t2;\n }\n }\n }\n return n;\n}\nexport function cubicSubdivide(p0, p1, p2, p3, t, out) {\n var p01 = (p1 - p0) * t + p0;\n var p12 = (p2 - p1) * t + p1;\n var p23 = (p3 - p2) * t + p2;\n var p012 = (p12 - p01) * t + p01;\n var p123 = (p23 - p12) * t + p12;\n var p0123 = (p123 - p012) * t + p012;\n out[0] = p0;\n out[1] = p01;\n out[2] = p012;\n out[3] = p0123;\n out[4] = p0123;\n out[5] = p123;\n out[6] = p23;\n out[7] = p3;\n}\nexport function cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {\n var t;\n var interval = 0.005;\n var d = Infinity;\n var prev;\n var next;\n var d1;\n var d2;\n _v0[0] = x;\n _v0[1] = y;\n for (var _t = 0; _t < 1; _t += 0.05) {\n _v1[0] = cubicAt(x0, x1, x2, x3, _t);\n _v1[1] = cubicAt(y0, y1, y2, y3, _t);\n d1 = v2DistSquare(_v0, _v1);\n if (d1 < d) {\n t = _t;\n d = d1;\n }\n }\n d = Infinity;\n for (var i = 0; i < 32; i++) {\n if (interval < EPSILON_NUMERIC) {\n break;\n }\n prev = t - interval;\n next = t + interval;\n _v1[0] = cubicAt(x0, x1, x2, x3, prev);\n _v1[1] = cubicAt(y0, y1, y2, y3, prev);\n d1 = v2DistSquare(_v1, _v0);\n if (prev >= 0 && d1 < d) {\n t = prev;\n d = d1;\n }\n else {\n _v2[0] = cubicAt(x0, x1, x2, x3, next);\n _v2[1] = cubicAt(y0, y1, y2, y3, next);\n d2 = v2DistSquare(_v2, _v0);\n if (next <= 1 && d2 < d) {\n t = next;\n d = d2;\n }\n else {\n interval *= 0.5;\n }\n }\n }\n if (out) {\n out[0] = cubicAt(x0, x1, x2, x3, t);\n out[1] = cubicAt(y0, y1, y2, y3, t);\n }\n return mathSqrt(d);\n}\nexport function cubicLength(x0, y0, x1, y1, x2, y2, x3, y3, iteration) {\n var px = x0;\n var py = y0;\n var d = 0;\n var step = 1 / iteration;\n for (var i = 1; i <= iteration; i++) {\n var t = i * step;\n var x = cubicAt(x0, x1, x2, x3, t);\n var y = cubicAt(y0, y1, y2, y3, t);\n var dx = x - px;\n var dy = y - py;\n d += Math.sqrt(dx * dx + dy * dy);\n px = x;\n py = y;\n }\n return d;\n}\nexport function quadraticAt(p0, p1, p2, t) {\n var onet = 1 - t;\n return onet * (onet * p0 + 2 * t * p1) + t * t * p2;\n}\nexport function quadraticDerivativeAt(p0, p1, p2, t) {\n return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));\n}\nexport function quadraticRootAt(p0, p1, p2, val, roots) {\n var a = p0 - 2 * p1 + p2;\n var b = 2 * (p1 - p0);\n var c = p0 - val;\n var n = 0;\n if (isAroundZero(a)) {\n if (isNotAroundZero(b)) {\n var t1 = -c / b;\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n }\n }\n else {\n var disc = b * b - 4 * a * c;\n if (isAroundZero(disc)) {\n var t1 = -b / (2 * a);\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n }\n else if (disc > 0) {\n var discSqrt = mathSqrt(disc);\n var t1 = (-b + discSqrt) / (2 * a);\n var t2 = (-b - discSqrt) / (2 * a);\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n if (t2 >= 0 && t2 <= 1) {\n roots[n++] = t2;\n }\n }\n }\n return n;\n}\nexport function quadraticExtremum(p0, p1, p2) {\n var divider = p0 + p2 - 2 * p1;\n if (divider === 0) {\n return 0.5;\n }\n else {\n return (p0 - p1) / divider;\n }\n}\nexport function quadraticSubdivide(p0, p1, p2, t, out) {\n var p01 = (p1 - p0) * t + p0;\n var p12 = (p2 - p1) * t + p1;\n var p012 = (p12 - p01) * t + p01;\n out[0] = p0;\n out[1] = p01;\n out[2] = p012;\n out[3] = p012;\n out[4] = p12;\n out[5] = p2;\n}\nexport function quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {\n var t;\n var interval = 0.005;\n var d = Infinity;\n _v0[0] = x;\n _v0[1] = y;\n for (var _t = 0; _t < 1; _t += 0.05) {\n _v1[0] = quadraticAt(x0, x1, x2, _t);\n _v1[1] = quadraticAt(y0, y1, y2, _t);\n var d1 = v2DistSquare(_v0, _v1);\n if (d1 < d) {\n t = _t;\n d = d1;\n }\n }\n d = Infinity;\n for (var i = 0; i < 32; i++) {\n if (interval < EPSILON_NUMERIC) {\n break;\n }\n var prev = t - interval;\n var next = t + interval;\n _v1[0] = quadraticAt(x0, x1, x2, prev);\n _v1[1] = quadraticAt(y0, y1, y2, prev);\n var d1 = v2DistSquare(_v1, _v0);\n if (prev >= 0 && d1 < d) {\n t = prev;\n d = d1;\n }\n else {\n _v2[0] = quadraticAt(x0, x1, x2, next);\n _v2[1] = quadraticAt(y0, y1, y2, next);\n var d2 = v2DistSquare(_v2, _v0);\n if (next <= 1 && d2 < d) {\n t = next;\n d = d2;\n }\n else {\n interval *= 0.5;\n }\n }\n }\n if (out) {\n out[0] = quadraticAt(x0, x1, x2, t);\n out[1] = quadraticAt(y0, y1, y2, t);\n }\n return mathSqrt(d);\n}\nexport function quadraticLength(x0, y0, x1, y1, x2, y2, iteration) {\n var px = x0;\n var py = y0;\n var d = 0;\n var step = 1 / iteration;\n for (var i = 1; i <= iteration; i++) {\n var t = i * step;\n var x = quadraticAt(x0, x1, x2, t);\n var y = quadraticAt(y0, y1, y2, t);\n var dx = x - px;\n var dy = y - py;\n d += Math.sqrt(dx * dx + dy * dy);\n px = x;\n py = y;\n }\n return d;\n}\n","import * as vec2 from './vector';\nimport * as curve from './curve';\nvar mathMin = Math.min;\nvar mathMax = Math.max;\nvar mathSin = Math.sin;\nvar mathCos = Math.cos;\nvar PI2 = Math.PI * 2;\nvar start = vec2.create();\nvar end = vec2.create();\nvar extremity = vec2.create();\nexport function fromPoints(points, min, max) {\n if (points.length === 0) {\n return;\n }\n var p = points[0];\n var left = p[0];\n var right = p[0];\n var top = p[1];\n var bottom = p[1];\n for (var i = 1; i < points.length; i++) {\n p = points[i];\n left = mathMin(left, p[0]);\n right = mathMax(right, p[0]);\n top = mathMin(top, p[1]);\n bottom = mathMax(bottom, p[1]);\n }\n min[0] = left;\n min[1] = top;\n max[0] = right;\n max[1] = bottom;\n}\nexport function fromLine(x0, y0, x1, y1, min, max) {\n min[0] = mathMin(x0, x1);\n min[1] = mathMin(y0, y1);\n max[0] = mathMax(x0, x1);\n max[1] = mathMax(y0, y1);\n}\nvar xDim = [];\nvar yDim = [];\nexport function fromCubic(x0, y0, x1, y1, x2, y2, x3, y3, min, max) {\n var cubicExtrema = curve.cubicExtrema;\n var cubicAt = curve.cubicAt;\n var n = cubicExtrema(x0, x1, x2, x3, xDim);\n min[0] = Infinity;\n min[1] = Infinity;\n max[0] = -Infinity;\n max[1] = -Infinity;\n for (var i = 0; i < n; i++) {\n var x = cubicAt(x0, x1, x2, x3, xDim[i]);\n min[0] = mathMin(x, min[0]);\n max[0] = mathMax(x, max[0]);\n }\n n = cubicExtrema(y0, y1, y2, y3, yDim);\n for (var i = 0; i < n; i++) {\n var y = cubicAt(y0, y1, y2, y3, yDim[i]);\n min[1] = mathMin(y, min[1]);\n max[1] = mathMax(y, max[1]);\n }\n min[0] = mathMin(x0, min[0]);\n max[0] = mathMax(x0, max[0]);\n min[0] = mathMin(x3, min[0]);\n max[0] = mathMax(x3, max[0]);\n min[1] = mathMin(y0, min[1]);\n max[1] = mathMax(y0, max[1]);\n min[1] = mathMin(y3, min[1]);\n max[1] = mathMax(y3, max[1]);\n}\nexport function fromQuadratic(x0, y0, x1, y1, x2, y2, min, max) {\n var quadraticExtremum = curve.quadraticExtremum;\n var quadraticAt = curve.quadraticAt;\n var tx = mathMax(mathMin(quadraticExtremum(x0, x1, x2), 1), 0);\n var ty = mathMax(mathMin(quadraticExtremum(y0, y1, y2), 1), 0);\n var x = quadraticAt(x0, x1, x2, tx);\n var y = quadraticAt(y0, y1, y2, ty);\n min[0] = mathMin(x0, x2, x);\n min[1] = mathMin(y0, y2, y);\n max[0] = mathMax(x0, x2, x);\n max[1] = mathMax(y0, y2, y);\n}\nexport function fromArc(x, y, rx, ry, startAngle, endAngle, anticlockwise, min, max) {\n var vec2Min = vec2.min;\n var vec2Max = vec2.max;\n var diff = Math.abs(startAngle - endAngle);\n if (diff % PI2 < 1e-4 && diff > 1e-4) {\n min[0] = x - rx;\n min[1] = y - ry;\n max[0] = x + rx;\n max[1] = y + ry;\n return;\n }\n start[0] = mathCos(startAngle) * rx + x;\n start[1] = mathSin(startAngle) * ry + y;\n end[0] = mathCos(endAngle) * rx + x;\n end[1] = mathSin(endAngle) * ry + y;\n vec2Min(min, start, end);\n vec2Max(max, start, end);\n startAngle = startAngle % (PI2);\n if (startAngle < 0) {\n startAngle = startAngle + PI2;\n }\n endAngle = endAngle % (PI2);\n if (endAngle < 0) {\n endAngle = endAngle + PI2;\n }\n if (startAngle > endAngle && !anticlockwise) {\n endAngle += PI2;\n }\n else if (startAngle < endAngle && anticlockwise) {\n startAngle += PI2;\n }\n if (anticlockwise) {\n var tmp = endAngle;\n endAngle = startAngle;\n startAngle = tmp;\n }\n for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {\n if (angle > startAngle) {\n extremity[0] = mathCos(angle) * rx + x;\n extremity[1] = mathSin(angle) * ry + y;\n vec2Min(min, extremity, min);\n vec2Max(max, extremity, max);\n }\n }\n}\n","import * as vec2 from './vector';\nimport BoundingRect from './BoundingRect';\nimport { devicePixelRatio as dpr } from '../config';\nimport { fromLine, fromCubic, fromQuadratic, fromArc } from './bbox';\nimport { cubicAt, cubicLength, cubicSubdivide, quadraticLength, quadraticSubdivide } from './curve';\nvar CMD = {\n M: 1,\n L: 2,\n C: 3,\n Q: 4,\n A: 5,\n Z: 6,\n R: 7\n};\nvar tmpOutX = [];\nvar tmpOutY = [];\nvar min = [];\nvar max = [];\nvar min2 = [];\nvar max2 = [];\nvar mathMin = Math.min;\nvar mathMax = Math.max;\nvar mathCos = Math.cos;\nvar mathSin = Math.sin;\nvar mathSqrt = Math.sqrt;\nvar mathAbs = Math.abs;\nvar PI = Math.PI;\nvar PI2 = PI * 2;\nvar hasTypedArray = typeof Float32Array !== 'undefined';\nvar tmpAngles = [];\nfunction modPI2(radian) {\n var n = Math.round(radian / PI * 1e8) / 1e8;\n return (n % 2) * PI;\n}\nexport function normalizeArcAngles(angles, anticlockwise) {\n var newStartAngle = modPI2(angles[0]);\n if (newStartAngle < 0) {\n newStartAngle += PI2;\n }\n var delta = newStartAngle - angles[0];\n var newEndAngle = angles[1];\n newEndAngle += delta;\n if (!anticlockwise && newEndAngle - newStartAngle >= PI2) {\n newEndAngle = newStartAngle + PI2;\n }\n else if (anticlockwise && newStartAngle - newEndAngle >= PI2) {\n newEndAngle = newStartAngle - PI2;\n }\n else if (!anticlockwise && newStartAngle > newEndAngle) {\n newEndAngle = newStartAngle + (PI2 - modPI2(newStartAngle - newEndAngle));\n }\n else if (anticlockwise && newStartAngle < newEndAngle) {\n newEndAngle = newStartAngle - (PI2 - modPI2(newEndAngle - newStartAngle));\n }\n angles[0] = newStartAngle;\n angles[1] = newEndAngle;\n}\nvar PathProxy = (function () {\n function PathProxy(notSaveData) {\n this.dpr = 1;\n this._xi = 0;\n this._yi = 0;\n this._x0 = 0;\n this._y0 = 0;\n this._len = 0;\n if (notSaveData) {\n this._saveData = false;\n }\n if (this._saveData) {\n this.data = [];\n }\n }\n PathProxy.prototype.increaseVersion = function () {\n this._version++;\n };\n PathProxy.prototype.getVersion = function () {\n return this._version;\n };\n PathProxy.prototype.setScale = function (sx, sy, segmentIgnoreThreshold) {\n segmentIgnoreThreshold = segmentIgnoreThreshold || 0;\n if (segmentIgnoreThreshold > 0) {\n this._ux = mathAbs(segmentIgnoreThreshold / dpr / sx) || 0;\n this._uy = mathAbs(segmentIgnoreThreshold / dpr / sy) || 0;\n }\n };\n PathProxy.prototype.setDPR = function (dpr) {\n this.dpr = dpr;\n };\n PathProxy.prototype.setContext = function (ctx) {\n this._ctx = ctx;\n };\n PathProxy.prototype.getContext = function () {\n return this._ctx;\n };\n PathProxy.prototype.beginPath = function () {\n this._ctx && this._ctx.beginPath();\n this.reset();\n return this;\n };\n PathProxy.prototype.reset = function () {\n if (this._saveData) {\n this._len = 0;\n }\n if (this._lineDash) {\n this._lineDash = null;\n this._dashOffset = 0;\n }\n if (this._pathSegLen) {\n this._pathSegLen = null;\n this._pathLen = 0;\n }\n this._version++;\n };\n PathProxy.prototype.moveTo = function (x, y) {\n this._drawPendingPt();\n this.addData(CMD.M, x, y);\n this._ctx && this._ctx.moveTo(x, y);\n this._x0 = x;\n this._y0 = y;\n this._xi = x;\n this._yi = y;\n return this;\n };\n PathProxy.prototype.lineTo = function (x, y) {\n var dx = mathAbs(x - this._xi);\n var dy = mathAbs(y - this._yi);\n var exceedUnit = dx > this._ux || dy > this._uy;\n this.addData(CMD.L, x, y);\n if (this._ctx && exceedUnit) {\n this._needsDash ? this._dashedLineTo(x, y)\n : this._ctx.lineTo(x, y);\n }\n if (exceedUnit) {\n this._xi = x;\n this._yi = y;\n this._pendingPtDist = 0;\n }\n else {\n var d2 = dx * dx + dy * dy;\n if (d2 > this._pendingPtDist) {\n this._pendingPtX = x;\n this._pendingPtY = y;\n this._pendingPtDist = d2;\n }\n }\n return this;\n };\n PathProxy.prototype.bezierCurveTo = function (x1, y1, x2, y2, x3, y3) {\n this.addData(CMD.C, x1, y1, x2, y2, x3, y3);\n if (this._ctx) {\n this._needsDash ? this._dashedBezierTo(x1, y1, x2, y2, x3, y3)\n : this._ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n }\n this._xi = x3;\n this._yi = y3;\n return this;\n };\n PathProxy.prototype.quadraticCurveTo = function (x1, y1, x2, y2) {\n this.addData(CMD.Q, x1, y1, x2, y2);\n if (this._ctx) {\n this._needsDash ? this._dashedQuadraticTo(x1, y1, x2, y2)\n : this._ctx.quadraticCurveTo(x1, y1, x2, y2);\n }\n this._xi = x2;\n this._yi = y2;\n return this;\n };\n PathProxy.prototype.arc = function (cx, cy, r, startAngle, endAngle, anticlockwise) {\n tmpAngles[0] = startAngle;\n tmpAngles[1] = endAngle;\n normalizeArcAngles(tmpAngles, anticlockwise);\n startAngle = tmpAngles[0];\n endAngle = tmpAngles[1];\n var delta = endAngle - startAngle;\n this.addData(CMD.A, cx, cy, r, r, startAngle, delta, 0, anticlockwise ? 0 : 1);\n this._ctx && this._ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);\n this._xi = mathCos(endAngle) * r + cx;\n this._yi = mathSin(endAngle) * r + cy;\n return this;\n };\n PathProxy.prototype.arcTo = function (x1, y1, x2, y2, radius) {\n if (this._ctx) {\n this._ctx.arcTo(x1, y1, x2, y2, radius);\n }\n return this;\n };\n PathProxy.prototype.rect = function (x, y, w, h) {\n this._ctx && this._ctx.rect(x, y, w, h);\n this.addData(CMD.R, x, y, w, h);\n return this;\n };\n PathProxy.prototype.closePath = function () {\n this._drawPendingPt();\n this.addData(CMD.Z);\n var ctx = this._ctx;\n var x0 = this._x0;\n var y0 = this._y0;\n if (ctx) {\n this._needsDash && this._dashedLineTo(x0, y0);\n ctx.closePath();\n }\n this._xi = x0;\n this._yi = y0;\n return this;\n };\n PathProxy.prototype.fill = function (ctx) {\n ctx && ctx.fill();\n this.toStatic();\n };\n PathProxy.prototype.stroke = function (ctx) {\n ctx && ctx.stroke();\n this.toStatic();\n };\n PathProxy.prototype.setLineDash = function (lineDash) {\n if (lineDash instanceof Array) {\n this._lineDash = lineDash;\n this._dashIdx = 0;\n var lineDashSum = 0;\n for (var i = 0; i < lineDash.length; i++) {\n lineDashSum += lineDash[i];\n }\n this._dashSum = lineDashSum;\n this._needsDash = true;\n }\n else {\n this._lineDash = null;\n this._needsDash = false;\n }\n return this;\n };\n PathProxy.prototype.setLineDashOffset = function (offset) {\n this._dashOffset = offset;\n return this;\n };\n PathProxy.prototype.len = function () {\n return this._len;\n };\n PathProxy.prototype.setData = function (data) {\n var len = data.length;\n if (!(this.data && this.data.length === len) && hasTypedArray) {\n this.data = new Float32Array(len);\n }\n for (var i = 0; i < len; i++) {\n this.data[i] = data[i];\n }\n this._len = len;\n };\n PathProxy.prototype.appendPath = function (path) {\n if (!(path instanceof Array)) {\n path = [path];\n }\n var len = path.length;\n var appendSize = 0;\n var offset = this._len;\n for (var i = 0; i < len; i++) {\n appendSize += path[i].len();\n }\n if (hasTypedArray && (this.data instanceof Float32Array)) {\n this.data = new Float32Array(offset + appendSize);\n }\n for (var i = 0; i < len; i++) {\n var appendPathData = path[i].data;\n for (var k = 0; k < appendPathData.length; k++) {\n this.data[offset++] = appendPathData[k];\n }\n }\n this._len = offset;\n };\n PathProxy.prototype.addData = function (cmd, a, b, c, d, e, f, g, h) {\n if (!this._saveData) {\n return;\n }\n var data = this.data;\n if (this._len + arguments.length > data.length) {\n this._expandData();\n data = this.data;\n }\n for (var i = 0; i < arguments.length; i++) {\n data[this._len++] = arguments[i];\n }\n };\n PathProxy.prototype._drawPendingPt = function () {\n if (this._pendingPtDist > 0) {\n this._ctx && this._ctx.lineTo(this._pendingPtX, this._pendingPtY);\n this._pendingPtDist = 0;\n }\n };\n PathProxy.prototype._expandData = function () {\n if (!(this.data instanceof Array)) {\n var newData = [];\n for (var i = 0; i < this._len; i++) {\n newData[i] = this.data[i];\n }\n this.data = newData;\n }\n };\n PathProxy.prototype._dashedLineTo = function (x1, y1) {\n var dashSum = this._dashSum;\n var lineDash = this._lineDash;\n var ctx = this._ctx;\n var offset = this._dashOffset;\n var x0 = this._xi;\n var y0 = this._yi;\n var dx = x1 - x0;\n var dy = y1 - y0;\n var dist = mathSqrt(dx * dx + dy * dy);\n var x = x0;\n var y = y0;\n var nDash = lineDash.length;\n var dash;\n var idx;\n dx /= dist;\n dy /= dist;\n if (offset < 0) {\n offset = dashSum + offset;\n }\n offset %= dashSum;\n x -= offset * dx;\n y -= offset * dy;\n while ((dx > 0 && x <= x1) || (dx < 0 && x >= x1)\n || (dx === 0 && ((dy > 0 && y <= y1) || (dy < 0 && y >= y1)))) {\n idx = this._dashIdx;\n dash = lineDash[idx];\n x += dx * dash;\n y += dy * dash;\n this._dashIdx = (idx + 1) % nDash;\n if ((dx > 0 && x < x0) || (dx < 0 && x > x0) || (dy > 0 && y < y0) || (dy < 0 && y > y0)) {\n continue;\n }\n ctx[idx % 2 ? 'moveTo' : 'lineTo'](dx >= 0 ? mathMin(x, x1) : mathMax(x, x1), dy >= 0 ? mathMin(y, y1) : mathMax(y, y1));\n }\n dx = x - x1;\n dy = y - y1;\n this._dashOffset = -mathSqrt(dx * dx + dy * dy);\n };\n PathProxy.prototype._dashedBezierTo = function (x1, y1, x2, y2, x3, y3) {\n var ctx = this._ctx;\n var dashSum = this._dashSum;\n var offset = this._dashOffset;\n var lineDash = this._lineDash;\n var x0 = this._xi;\n var y0 = this._yi;\n var bezierLen = 0;\n var idx = this._dashIdx;\n var nDash = lineDash.length;\n var t;\n var dx;\n var dy;\n var x;\n var y;\n var tmpLen = 0;\n if (offset < 0) {\n offset = dashSum + offset;\n }\n offset %= dashSum;\n for (t = 0; t < 1; t += 0.1) {\n dx = cubicAt(x0, x1, x2, x3, t + 0.1)\n - cubicAt(x0, x1, x2, x3, t);\n dy = cubicAt(y0, y1, y2, y3, t + 0.1)\n - cubicAt(y0, y1, y2, y3, t);\n bezierLen += mathSqrt(dx * dx + dy * dy);\n }\n for (; idx < nDash; idx++) {\n tmpLen += lineDash[idx];\n if (tmpLen > offset) {\n break;\n }\n }\n t = (tmpLen - offset) / bezierLen;\n while (t <= 1) {\n x = cubicAt(x0, x1, x2, x3, t);\n y = cubicAt(y0, y1, y2, y3, t);\n idx % 2 ? ctx.moveTo(x, y)\n : ctx.lineTo(x, y);\n t += lineDash[idx] / bezierLen;\n idx = (idx + 1) % nDash;\n }\n (idx % 2 !== 0) && ctx.lineTo(x3, y3);\n dx = x3 - x;\n dy = y3 - y;\n this._dashOffset = -mathSqrt(dx * dx + dy * dy);\n };\n PathProxy.prototype._dashedQuadraticTo = function (x1, y1, x2, y2) {\n var x3 = x2;\n var y3 = y2;\n x2 = (x2 + 2 * x1) / 3;\n y2 = (y2 + 2 * y1) / 3;\n x1 = (this._xi + 2 * x1) / 3;\n y1 = (this._yi + 2 * y1) / 3;\n this._dashedBezierTo(x1, y1, x2, y2, x3, y3);\n };\n PathProxy.prototype.toStatic = function () {\n if (!this._saveData) {\n return;\n }\n this._drawPendingPt();\n var data = this.data;\n if (data instanceof Array) {\n data.length = this._len;\n if (hasTypedArray && this._len > 11) {\n this.data = new Float32Array(data);\n }\n }\n };\n PathProxy.prototype.getBoundingRect = function () {\n min[0] = min[1] = min2[0] = min2[1] = Number.MAX_VALUE;\n max[0] = max[1] = max2[0] = max2[1] = -Number.MAX_VALUE;\n var data = this.data;\n var xi = 0;\n var yi = 0;\n var x0 = 0;\n var y0 = 0;\n var i;\n for (i = 0; i < this._len;) {\n var cmd = data[i++];\n var isFirst = i === 1;\n if (isFirst) {\n xi = data[i];\n yi = data[i + 1];\n x0 = xi;\n y0 = yi;\n }\n switch (cmd) {\n case CMD.M:\n xi = x0 = data[i++];\n yi = y0 = data[i++];\n min2[0] = x0;\n min2[1] = y0;\n max2[0] = x0;\n max2[1] = y0;\n break;\n case CMD.L:\n fromLine(xi, yi, data[i], data[i + 1], min2, max2);\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.C:\n fromCubic(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], min2, max2);\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.Q:\n fromQuadratic(xi, yi, data[i++], data[i++], data[i], data[i + 1], min2, max2);\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.A:\n var cx = data[i++];\n var cy = data[i++];\n var rx = data[i++];\n var ry = data[i++];\n var startAngle = data[i++];\n var endAngle = data[i++] + startAngle;\n i += 1;\n var anticlockwise = !data[i++];\n if (isFirst) {\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n fromArc(cx, cy, rx, ry, startAngle, endAngle, anticlockwise, min2, max2);\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n var width = data[i++];\n var height = data[i++];\n fromLine(x0, y0, x0 + width, y0 + height, min2, max2);\n break;\n case CMD.Z:\n xi = x0;\n yi = y0;\n break;\n }\n vec2.min(min, min, min2);\n vec2.max(max, max, max2);\n }\n if (i === 0) {\n min[0] = min[1] = max[0] = max[1] = 0;\n }\n return new BoundingRect(min[0], min[1], max[0] - min[0], max[1] - min[1]);\n };\n PathProxy.prototype._calculateLength = function () {\n var data = this.data;\n var len = this._len;\n var ux = this._ux;\n var uy = this._uy;\n var xi = 0;\n var yi = 0;\n var x0 = 0;\n var y0 = 0;\n if (!this._pathSegLen) {\n this._pathSegLen = [];\n }\n var pathSegLen = this._pathSegLen;\n var pathTotalLen = 0;\n var segCount = 0;\n for (var i = 0; i < len;) {\n var cmd = data[i++];\n var isFirst = i === 1;\n if (isFirst) {\n xi = data[i];\n yi = data[i + 1];\n x0 = xi;\n y0 = yi;\n }\n var l = -1;\n switch (cmd) {\n case CMD.M:\n xi = x0 = data[i++];\n yi = y0 = data[i++];\n break;\n case CMD.L: {\n var x2 = data[i++];\n var y2 = data[i++];\n var dx = x2 - xi;\n var dy = y2 - yi;\n if (mathAbs(dx) > ux || mathAbs(dy) > uy || i === len - 1) {\n l = Math.sqrt(dx * dx + dy * dy);\n xi = x2;\n yi = y2;\n }\n break;\n }\n case CMD.C: {\n var x1 = data[i++];\n var y1 = data[i++];\n var x2 = data[i++];\n var y2 = data[i++];\n var x3 = data[i++];\n var y3 = data[i++];\n l = cubicLength(xi, yi, x1, y1, x2, y2, x3, y3, 10);\n xi = x3;\n yi = y3;\n break;\n }\n case CMD.Q: {\n var x1 = data[i++];\n var y1 = data[i++];\n var x2 = data[i++];\n var y2 = data[i++];\n l = quadraticLength(xi, yi, x1, y1, x2, y2, 10);\n xi = x2;\n yi = y2;\n break;\n }\n case CMD.A:\n var cx = data[i++];\n var cy = data[i++];\n var rx = data[i++];\n var ry = data[i++];\n var startAngle = data[i++];\n var delta = data[i++];\n var endAngle = delta + startAngle;\n i += 1;\n var anticlockwise = !data[i++];\n if (isFirst) {\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n l = mathMax(rx, ry) * mathMin(PI2, Math.abs(delta));\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R: {\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n var width = data[i++];\n var height = data[i++];\n l = width * 2 + height * 2;\n break;\n }\n case CMD.Z: {\n var dx = x0 - xi;\n var dy = y0 - yi;\n l = Math.sqrt(dx * dx + dy * dy);\n xi = x0;\n yi = y0;\n break;\n }\n }\n if (l >= 0) {\n pathSegLen[segCount++] = l;\n pathTotalLen += l;\n }\n }\n this._pathLen = pathTotalLen;\n return pathTotalLen;\n };\n PathProxy.prototype.rebuildPath = function (ctx, percent) {\n var d = this.data;\n var ux = this._ux;\n var uy = this._uy;\n var len = this._len;\n var x0;\n var y0;\n var xi;\n var yi;\n var x;\n var y;\n var drawPart = percent < 1;\n var pathSegLen;\n var pathTotalLen;\n var accumLength = 0;\n var segCount = 0;\n var displayedLength;\n var pendingPtDist = 0;\n var pendingPtX;\n var pendingPtY;\n if (drawPart) {\n if (!this._pathSegLen) {\n this._calculateLength();\n }\n pathSegLen = this._pathSegLen;\n pathTotalLen = this._pathLen;\n displayedLength = percent * pathTotalLen;\n if (!displayedLength) {\n return;\n }\n }\n lo: for (var i = 0; i < len;) {\n var cmd = d[i++];\n var isFirst = i === 1;\n if (isFirst) {\n xi = d[i];\n yi = d[i + 1];\n x0 = xi;\n y0 = yi;\n }\n switch (cmd) {\n case CMD.M:\n if (pendingPtDist > 0) {\n ctx.lineTo(pendingPtX, pendingPtY);\n pendingPtDist = 0;\n }\n x0 = xi = d[i++];\n y0 = yi = d[i++];\n ctx.moveTo(xi, yi);\n break;\n case CMD.L: {\n x = d[i++];\n y = d[i++];\n var dx = mathAbs(x - xi);\n var dy = mathAbs(y - yi);\n if (dx > ux || dy > uy) {\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var t = (displayedLength - accumLength) / l;\n ctx.lineTo(xi * (1 - t) + x * t, yi * (1 - t) + y * t);\n break lo;\n }\n accumLength += l;\n }\n ctx.lineTo(x, y);\n xi = x;\n yi = y;\n pendingPtDist = 0;\n }\n else {\n var d2 = dx * dx + dy * dy;\n if (d2 > pendingPtDist) {\n pendingPtX = x;\n pendingPtY = y;\n pendingPtDist = d2;\n }\n }\n break;\n }\n case CMD.C: {\n var x1 = d[i++];\n var y1 = d[i++];\n var x2 = d[i++];\n var y2 = d[i++];\n var x3 = d[i++];\n var y3 = d[i++];\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var t = (displayedLength - accumLength) / l;\n cubicSubdivide(xi, x1, x2, x3, t, tmpOutX);\n cubicSubdivide(yi, y1, y2, y3, t, tmpOutY);\n ctx.bezierCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2], tmpOutX[3], tmpOutY[3]);\n break lo;\n }\n accumLength += l;\n }\n ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n xi = x3;\n yi = y3;\n break;\n }\n case CMD.Q: {\n var x1 = d[i++];\n var y1 = d[i++];\n var x2 = d[i++];\n var y2 = d[i++];\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var t = (displayedLength - accumLength) / l;\n quadraticSubdivide(xi, x1, x2, t, tmpOutX);\n quadraticSubdivide(yi, y1, y2, t, tmpOutY);\n ctx.quadraticCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2]);\n break lo;\n }\n accumLength += l;\n }\n ctx.quadraticCurveTo(x1, y1, x2, y2);\n xi = x2;\n yi = y2;\n break;\n }\n case CMD.A:\n var cx = d[i++];\n var cy = d[i++];\n var rx = d[i++];\n var ry = d[i++];\n var startAngle = d[i++];\n var delta = d[i++];\n var psi = d[i++];\n var anticlockwise = !d[i++];\n var r = (rx > ry) ? rx : ry;\n var scaleX = (rx > ry) ? 1 : rx / ry;\n var scaleY = (rx > ry) ? ry / rx : 1;\n var isEllipse = mathAbs(rx - ry) > 1e-3;\n var endAngle = startAngle + delta;\n var breakBuild = false;\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n endAngle = startAngle + delta * (displayedLength - accumLength) / l;\n breakBuild = true;\n }\n accumLength += l;\n }\n if (isEllipse && ctx.ellipse) {\n ctx.ellipse(cx, cy, rx, ry, psi, startAngle, endAngle, anticlockwise);\n }\n else {\n ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);\n }\n if (breakBuild) {\n break lo;\n }\n if (isFirst) {\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = d[i];\n y0 = yi = d[i + 1];\n x = d[i++];\n y = d[i++];\n var width = d[i++];\n var height = d[i++];\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var d_1 = displayedLength - accumLength;\n ctx.moveTo(x, y);\n ctx.lineTo(x + mathMin(d_1, width), y);\n d_1 -= width;\n if (d_1 > 0) {\n ctx.lineTo(x + width, y + mathMin(d_1, height));\n }\n d_1 -= height;\n if (d_1 > 0) {\n ctx.lineTo(x + mathMax(width - d_1, 0), y + height);\n }\n d_1 -= width;\n if (d_1 > 0) {\n ctx.lineTo(x, y + mathMax(height - d_1, 0));\n }\n break lo;\n }\n accumLength += l;\n }\n ctx.rect(x, y, width, height);\n break;\n case CMD.Z:\n if (pendingPtDist > 0) {\n ctx.lineTo(pendingPtX, pendingPtY);\n pendingPtDist = 0;\n }\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var t = (displayedLength - accumLength) / l;\n ctx.lineTo(xi * (1 - t) + x0 * t, yi * (1 - t) + y0 * t);\n break lo;\n }\n accumLength += l;\n }\n ctx.closePath();\n xi = x0;\n yi = y0;\n }\n }\n };\n PathProxy.CMD = CMD;\n PathProxy.initDefaultProps = (function () {\n var proto = PathProxy.prototype;\n proto._saveData = true;\n proto._needsDash = false;\n proto._dashOffset = 0;\n proto._dashIdx = 0;\n proto._dashSum = 0;\n proto._ux = 0;\n proto._uy = 0;\n proto._pendingPtDist = 0;\n proto._version = 0;\n })();\n return PathProxy;\n}());\nexport default PathProxy;\n","export function containStroke(x0, y0, x1, y1, lineWidth, x, y) {\n if (lineWidth === 0) {\n return false;\n }\n var _l = lineWidth;\n var _a = 0;\n var _b = x0;\n if ((y > y0 + _l && y > y1 + _l)\n || (y < y0 - _l && y < y1 - _l)\n || (x > x0 + _l && x > x1 + _l)\n || (x < x0 - _l && x < x1 - _l)) {\n return false;\n }\n if (x0 !== x1) {\n _a = (y0 - y1) / (x0 - x1);\n _b = (x0 * y1 - x1 * y0) / (x0 - x1);\n }\n else {\n return Math.abs(x - x0) <= _l / 2;\n }\n var tmp = _a * x - y + _b;\n var _s = tmp * tmp / (_a * _a + 1);\n return _s <= _l / 2 * _l / 2;\n}\n","import * as curve from '../core/curve';\nexport function containStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {\n if (lineWidth === 0) {\n return false;\n }\n var _l = lineWidth;\n if ((y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)\n || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)\n || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)\n || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)) {\n return false;\n }\n var d = curve.cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, null);\n return d <= _l / 2;\n}\n","import { quadraticProjectPoint } from '../core/curve';\nexport function containStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {\n if (lineWidth === 0) {\n return false;\n }\n var _l = lineWidth;\n if ((y > y0 + _l && y > y1 + _l && y > y2 + _l)\n || (y < y0 - _l && y < y1 - _l && y < y2 - _l)\n || (x > x0 + _l && x > x1 + _l && x > x2 + _l)\n || (x < x0 - _l && x < x1 - _l && x < x2 - _l)) {\n return false;\n }\n var d = quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, null);\n return d <= _l / 2;\n}\n","var PI2 = Math.PI * 2;\nexport function normalizeRadian(angle) {\n angle %= PI2;\n if (angle < 0) {\n angle += PI2;\n }\n return angle;\n}\n","import { normalizeRadian } from './util';\nvar PI2 = Math.PI * 2;\nexport function containStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {\n if (lineWidth === 0) {\n return false;\n }\n var _l = lineWidth;\n x -= cx;\n y -= cy;\n var d = Math.sqrt(x * x + y * y);\n if ((d - _l > r) || (d + _l < r)) {\n return false;\n }\n if (Math.abs(startAngle - endAngle) % PI2 < 1e-4) {\n return true;\n }\n if (anticlockwise) {\n var tmp = startAngle;\n startAngle = normalizeRadian(endAngle);\n endAngle = normalizeRadian(tmp);\n }\n else {\n startAngle = normalizeRadian(startAngle);\n endAngle = normalizeRadian(endAngle);\n }\n if (startAngle > endAngle) {\n endAngle += PI2;\n }\n var angle = Math.atan2(y, x);\n if (angle < 0) {\n angle += PI2;\n }\n return (angle >= startAngle && angle <= endAngle)\n || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);\n}\n","export default function windingLine(x0, y0, x1, y1, x, y) {\n if ((y > y0 && y > y1) || (y < y0 && y < y1)) {\n return 0;\n }\n if (y1 === y0) {\n return 0;\n }\n var t = (y - y0) / (y1 - y0);\n var dir = y1 < y0 ? 1 : -1;\n if (t === 1 || t === 0) {\n dir = y1 < y0 ? 0.5 : -0.5;\n }\n var x_ = t * (x1 - x0) + x0;\n return x_ === x ? Infinity : x_ > x ? dir : 0;\n}\n","import PathProxy from '../core/PathProxy';\nimport * as line from './line';\nimport * as cubic from './cubic';\nimport * as quadratic from './quadratic';\nimport * as arc from './arc';\nimport * as curve from '../core/curve';\nimport windingLine from './windingLine';\nvar CMD = PathProxy.CMD;\nvar PI2 = Math.PI * 2;\nvar EPSILON = 1e-4;\nfunction isAroundEqual(a, b) {\n return Math.abs(a - b) < EPSILON;\n}\nvar roots = [-1, -1, -1];\nvar extrema = [-1, -1];\nfunction swapExtrema() {\n var tmp = extrema[0];\n extrema[0] = extrema[1];\n extrema[1] = tmp;\n}\nfunction windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {\n if ((y > y0 && y > y1 && y > y2 && y > y3)\n || (y < y0 && y < y1 && y < y2 && y < y3)) {\n return 0;\n }\n var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);\n if (nRoots === 0) {\n return 0;\n }\n else {\n var w = 0;\n var nExtrema = -1;\n var y0_ = void 0;\n var y1_ = void 0;\n for (var i = 0; i < nRoots; i++) {\n var t = roots[i];\n var unit = (t === 0 || t === 1) ? 0.5 : 1;\n var x_ = curve.cubicAt(x0, x1, x2, x3, t);\n if (x_ < x) {\n continue;\n }\n if (nExtrema < 0) {\n nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);\n if (extrema[1] < extrema[0] && nExtrema > 1) {\n swapExtrema();\n }\n y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);\n if (nExtrema > 1) {\n y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);\n }\n }\n if (nExtrema === 2) {\n if (t < extrema[0]) {\n w += y0_ < y0 ? unit : -unit;\n }\n else if (t < extrema[1]) {\n w += y1_ < y0_ ? unit : -unit;\n }\n else {\n w += y3 < y1_ ? unit : -unit;\n }\n }\n else {\n if (t < extrema[0]) {\n w += y0_ < y0 ? unit : -unit;\n }\n else {\n w += y3 < y0_ ? unit : -unit;\n }\n }\n }\n return w;\n }\n}\nfunction windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {\n if ((y > y0 && y > y1 && y > y2)\n || (y < y0 && y < y1 && y < y2)) {\n return 0;\n }\n var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);\n if (nRoots === 0) {\n return 0;\n }\n else {\n var t = curve.quadraticExtremum(y0, y1, y2);\n if (t >= 0 && t <= 1) {\n var w = 0;\n var y_ = curve.quadraticAt(y0, y1, y2, t);\n for (var i = 0; i < nRoots; i++) {\n var unit = (roots[i] === 0 || roots[i] === 1) ? 0.5 : 1;\n var x_ = curve.quadraticAt(x0, x1, x2, roots[i]);\n if (x_ < x) {\n continue;\n }\n if (roots[i] < t) {\n w += y_ < y0 ? unit : -unit;\n }\n else {\n w += y2 < y_ ? unit : -unit;\n }\n }\n return w;\n }\n else {\n var unit = (roots[0] === 0 || roots[0] === 1) ? 0.5 : 1;\n var x_ = curve.quadraticAt(x0, x1, x2, roots[0]);\n if (x_ < x) {\n return 0;\n }\n return y2 < y0 ? unit : -unit;\n }\n }\n}\nfunction windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {\n y -= cy;\n if (y > r || y < -r) {\n return 0;\n }\n var tmp = Math.sqrt(r * r - y * y);\n roots[0] = -tmp;\n roots[1] = tmp;\n var dTheta = Math.abs(startAngle - endAngle);\n if (dTheta < 1e-4) {\n return 0;\n }\n if (dTheta >= PI2 - 1e-4) {\n startAngle = 0;\n endAngle = PI2;\n var dir = anticlockwise ? 1 : -1;\n if (x >= roots[0] + cx && x <= roots[1] + cx) {\n return dir;\n }\n else {\n return 0;\n }\n }\n if (startAngle > endAngle) {\n var tmp_1 = startAngle;\n startAngle = endAngle;\n endAngle = tmp_1;\n }\n if (startAngle < 0) {\n startAngle += PI2;\n endAngle += PI2;\n }\n var w = 0;\n for (var i = 0; i < 2; i++) {\n var x_ = roots[i];\n if (x_ + cx > x) {\n var angle = Math.atan2(y, x_);\n var dir = anticlockwise ? 1 : -1;\n if (angle < 0) {\n angle = PI2 + angle;\n }\n if ((angle >= startAngle && angle <= endAngle)\n || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)) {\n if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {\n dir = -dir;\n }\n w += dir;\n }\n }\n }\n return w;\n}\nfunction containPath(path, lineWidth, isStroke, x, y) {\n var data = path.data;\n var len = path.len();\n var w = 0;\n var xi = 0;\n var yi = 0;\n var x0 = 0;\n var y0 = 0;\n var x1;\n var y1;\n for (var i = 0; i < len;) {\n var cmd = data[i++];\n var isFirst = i === 1;\n if (cmd === CMD.M && i > 1) {\n if (!isStroke) {\n w += windingLine(xi, yi, x0, y0, x, y);\n }\n }\n if (isFirst) {\n xi = data[i];\n yi = data[i + 1];\n x0 = xi;\n y0 = yi;\n }\n switch (cmd) {\n case CMD.M:\n x0 = data[i++];\n y0 = data[i++];\n xi = x0;\n yi = y0;\n break;\n case CMD.L:\n if (isStroke) {\n if (line.containStroke(xi, yi, data[i], data[i + 1], lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingLine(xi, yi, data[i], data[i + 1], x, y) || 0;\n }\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.C:\n if (isStroke) {\n if (cubic.containStroke(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingCubic(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], x, y) || 0;\n }\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.Q:\n if (isStroke) {\n if (quadratic.containStroke(xi, yi, data[i++], data[i++], data[i], data[i + 1], lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingQuadratic(xi, yi, data[i++], data[i++], data[i], data[i + 1], x, y) || 0;\n }\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.A:\n var cx = data[i++];\n var cy = data[i++];\n var rx = data[i++];\n var ry = data[i++];\n var theta = data[i++];\n var dTheta = data[i++];\n i += 1;\n var anticlockwise = !!(1 - data[i++]);\n x1 = Math.cos(theta) * rx + cx;\n y1 = Math.sin(theta) * ry + cy;\n if (!isFirst) {\n w += windingLine(xi, yi, x1, y1, x, y);\n }\n else {\n x0 = x1;\n y0 = y1;\n }\n var _x = (x - cx) * ry / rx + cx;\n if (isStroke) {\n if (arc.containStroke(cx, cy, ry, theta, theta + dTheta, anticlockwise, lineWidth, _x, y)) {\n return true;\n }\n }\n else {\n w += windingArc(cx, cy, ry, theta, theta + dTheta, anticlockwise, _x, y);\n }\n xi = Math.cos(theta + dTheta) * rx + cx;\n yi = Math.sin(theta + dTheta) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n var width = data[i++];\n var height = data[i++];\n x1 = x0 + width;\n y1 = y0 + height;\n if (isStroke) {\n if (line.containStroke(x0, y0, x1, y0, lineWidth, x, y)\n || line.containStroke(x1, y0, x1, y1, lineWidth, x, y)\n || line.containStroke(x1, y1, x0, y1, lineWidth, x, y)\n || line.containStroke(x0, y1, x0, y0, lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingLine(x1, y0, x1, y1, x, y);\n w += windingLine(x0, y1, x0, y0, x, y);\n }\n break;\n case CMD.Z:\n if (isStroke) {\n if (line.containStroke(xi, yi, x0, y0, lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingLine(xi, yi, x0, y0, x, y);\n }\n xi = x0;\n yi = y0;\n break;\n }\n }\n if (!isStroke && !isAroundEqual(yi, y0)) {\n w += windingLine(xi, yi, x0, y0, x, y) || 0;\n }\n return w !== 0;\n}\nexport function contain(pathProxy, x, y) {\n return containPath(pathProxy, 0, false, x, y);\n}\nexport function containStroke(pathProxy, lineWidth, x, y) {\n return containPath(pathProxy, lineWidth, true, x, y);\n}\n","import { __extends } from \"tslib\";\nimport Displayable, { DEFAULT_COMMON_STYLE, DEFAULT_COMMON_ANIMATION_PROPS } from './Displayable';\nimport PathProxy from '../core/PathProxy';\nimport * as pathContain from '../contain/path';\nimport { defaults, keys, extend, clone, isString, createObject } from '../core/util';\nimport { lum } from '../tool/color';\nimport { DARK_LABEL_COLOR, LIGHT_LABEL_COLOR, DARK_MODE_THRESHOLD, LIGHTER_LABEL_COLOR } from '../config';\nimport { REDARAW_BIT, SHAPE_CHANGED_BIT, STYLE_CHANGED_BIT } from './constants';\nexport var DEFAULT_PATH_STYLE = defaults({\n fill: '#000',\n stroke: null,\n strokePercent: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n lineDashOffset: 0,\n lineWidth: 1,\n lineCap: 'butt',\n miterLimit: 10,\n strokeNoScale: false,\n strokeFirst: false\n}, DEFAULT_COMMON_STYLE);\nexport var DEFAULT_PATH_ANIMATION_PROPS = {\n style: defaults({\n fill: true,\n stroke: true,\n strokePercent: true,\n fillOpacity: true,\n strokeOpacity: true,\n lineDashOffset: true,\n lineWidth: true,\n miterLimit: true\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n};\nvar pathCopyParams = [\n 'x', 'y', 'rotation', 'scaleX', 'scaleY', 'originX', 'originY', 'invisible',\n 'culling', 'z', 'z2', 'zlevel', 'parent'\n];\nvar Path = (function (_super) {\n __extends(Path, _super);\n function Path(opts) {\n return _super.call(this, opts) || this;\n }\n Path.prototype.update = function () {\n var _this = this;\n _super.prototype.update.call(this);\n var style = this.style;\n if (style.decal) {\n var decalEl = this._decalEl = this._decalEl || new Path();\n if (decalEl.buildPath === Path.prototype.buildPath) {\n decalEl.buildPath = function (ctx) {\n _this.buildPath(ctx, _this.shape);\n };\n }\n decalEl.silent = true;\n var decalElStyle = decalEl.style;\n for (var key in style) {\n if (decalElStyle[key] !== style[key]) {\n decalElStyle[key] = style[key];\n }\n }\n decalElStyle.fill = style.fill ? style.decal : null;\n decalElStyle.decal = null;\n decalElStyle.shadowColor = null;\n style.strokeFirst && (decalElStyle.stroke = null);\n for (var i = 0; i < pathCopyParams.length; ++i) {\n decalEl[pathCopyParams[i]] = this[pathCopyParams[i]];\n }\n decalEl.__dirty |= REDARAW_BIT;\n }\n else if (this._decalEl) {\n this._decalEl = null;\n }\n };\n Path.prototype.getDecalElement = function () {\n return this._decalEl;\n };\n Path.prototype._init = function (props) {\n var keysArr = keys(props);\n this.shape = this.getDefaultShape();\n var defaultStyle = this.getDefaultStyle();\n if (defaultStyle) {\n this.useStyle(defaultStyle);\n }\n for (var i = 0; i < keysArr.length; i++) {\n var key = keysArr[i];\n var value = props[key];\n if (key === 'style') {\n if (!this.style) {\n this.useStyle(value);\n }\n else {\n extend(this.style, value);\n }\n }\n else if (key === 'shape') {\n extend(this.shape, value);\n }\n else {\n _super.prototype.attrKV.call(this, key, value);\n }\n }\n if (!this.style) {\n this.useStyle({});\n }\n };\n Path.prototype.getDefaultStyle = function () {\n return null;\n };\n Path.prototype.getDefaultShape = function () {\n return {};\n };\n Path.prototype.canBeInsideText = function () {\n return this.hasFill();\n };\n Path.prototype.getInsideTextFill = function () {\n var pathFill = this.style.fill;\n if (pathFill !== 'none') {\n if (isString(pathFill)) {\n var fillLum = lum(pathFill, 0);\n if (fillLum > 0.5) {\n return DARK_LABEL_COLOR;\n }\n else if (fillLum > 0.2) {\n return LIGHTER_LABEL_COLOR;\n }\n return LIGHT_LABEL_COLOR;\n }\n else if (pathFill) {\n return LIGHT_LABEL_COLOR;\n }\n }\n return DARK_LABEL_COLOR;\n };\n Path.prototype.getInsideTextStroke = function (textFill) {\n var pathFill = this.style.fill;\n if (isString(pathFill)) {\n var zr = this.__zr;\n var isDarkMode = !!(zr && zr.isDarkMode());\n var isDarkLabel = lum(textFill, 0) < DARK_MODE_THRESHOLD;\n if (isDarkMode === isDarkLabel) {\n return pathFill;\n }\n }\n };\n Path.prototype.buildPath = function (ctx, shapeCfg, inBundle) { };\n Path.prototype.pathUpdated = function () {\n this.__dirty &= ~SHAPE_CHANGED_BIT;\n };\n Path.prototype.createPathProxy = function () {\n this.path = new PathProxy(false);\n };\n Path.prototype.hasStroke = function () {\n var style = this.style;\n var stroke = style.stroke;\n return !(stroke == null || stroke === 'none' || !(style.lineWidth > 0));\n };\n Path.prototype.hasFill = function () {\n var style = this.style;\n var fill = style.fill;\n return fill != null && fill !== 'none';\n };\n Path.prototype.getBoundingRect = function () {\n var rect = this._rect;\n var style = this.style;\n var needsUpdateRect = !rect;\n if (needsUpdateRect) {\n var firstInvoke = false;\n if (!this.path) {\n firstInvoke = true;\n this.createPathProxy();\n }\n var path = this.path;\n if (firstInvoke || (this.__dirty & SHAPE_CHANGED_BIT)) {\n path.beginPath();\n this.buildPath(path, this.shape, false);\n this.pathUpdated();\n }\n rect = path.getBoundingRect();\n }\n this._rect = rect;\n if (this.hasStroke() && this.path && this.path.len() > 0) {\n var rectWithStroke = this._rectWithStroke || (this._rectWithStroke = rect.clone());\n if (this.__dirty || needsUpdateRect) {\n rectWithStroke.copy(rect);\n var lineScale = style.strokeNoScale ? this.getLineScale() : 1;\n var w = style.lineWidth;\n if (!this.hasFill()) {\n var strokeContainThreshold = this.strokeContainThreshold;\n w = Math.max(w, strokeContainThreshold == null ? 4 : strokeContainThreshold);\n }\n if (lineScale > 1e-10) {\n rectWithStroke.width += w / lineScale;\n rectWithStroke.height += w / lineScale;\n rectWithStroke.x -= w / lineScale / 2;\n rectWithStroke.y -= w / lineScale / 2;\n }\n }\n return rectWithStroke;\n }\n return rect;\n };\n Path.prototype.contain = function (x, y) {\n var localPos = this.transformCoordToLocal(x, y);\n var rect = this.getBoundingRect();\n var style = this.style;\n x = localPos[0];\n y = localPos[1];\n if (rect.contain(x, y)) {\n var pathProxy = this.path;\n if (this.hasStroke()) {\n var lineWidth = style.lineWidth;\n var lineScale = style.strokeNoScale ? this.getLineScale() : 1;\n if (lineScale > 1e-10) {\n if (!this.hasFill()) {\n lineWidth = Math.max(lineWidth, this.strokeContainThreshold);\n }\n if (pathContain.containStroke(pathProxy, lineWidth / lineScale, x, y)) {\n return true;\n }\n }\n }\n if (this.hasFill()) {\n return pathContain.contain(pathProxy, x, y);\n }\n }\n return false;\n };\n Path.prototype.dirtyShape = function () {\n this.__dirty |= SHAPE_CHANGED_BIT;\n if (this._rect) {\n this._rect = null;\n }\n if (this._decalEl) {\n this._decalEl.dirtyShape();\n }\n this.markRedraw();\n };\n Path.prototype.dirty = function () {\n this.dirtyStyle();\n this.dirtyShape();\n };\n Path.prototype.animateShape = function (loop) {\n return this.animate('shape', loop);\n };\n Path.prototype.updateDuringAnimation = function (targetKey) {\n if (targetKey === 'style') {\n this.dirtyStyle();\n }\n else if (targetKey === 'shape') {\n this.dirtyShape();\n }\n else {\n this.markRedraw();\n }\n };\n Path.prototype.attrKV = function (key, value) {\n if (key === 'shape') {\n this.setShape(value);\n }\n else {\n _super.prototype.attrKV.call(this, key, value);\n }\n };\n Path.prototype.setShape = function (keyOrObj, value) {\n var shape = this.shape;\n if (!shape) {\n shape = this.shape = {};\n }\n if (typeof keyOrObj === 'string') {\n shape[keyOrObj] = value;\n }\n else {\n extend(shape, keyOrObj);\n }\n this.dirtyShape();\n return this;\n };\n Path.prototype.shapeChanged = function () {\n return !!(this.__dirty & SHAPE_CHANGED_BIT);\n };\n Path.prototype.createStyle = function (obj) {\n return createObject(DEFAULT_PATH_STYLE, obj);\n };\n Path.prototype._innerSaveToNormal = function (toState) {\n _super.prototype._innerSaveToNormal.call(this, toState);\n var normalState = this._normalState;\n if (toState.shape && !normalState.shape) {\n normalState.shape = extend({}, this.shape);\n }\n };\n Path.prototype._applyStateObj = function (stateName, state, normalState, keepCurrentStates, transition, animationCfg) {\n _super.prototype._applyStateObj.call(this, stateName, state, normalState, keepCurrentStates, transition, animationCfg);\n var needsRestoreToNormal = !(state && keepCurrentStates);\n var targetShape;\n if (state && state.shape) {\n if (transition) {\n if (keepCurrentStates) {\n targetShape = state.shape;\n }\n else {\n targetShape = extend({}, normalState.shape);\n extend(targetShape, state.shape);\n }\n }\n else {\n targetShape = extend({}, keepCurrentStates ? this.shape : normalState.shape);\n extend(targetShape, state.shape);\n }\n }\n else if (needsRestoreToNormal) {\n targetShape = normalState.shape;\n }\n if (targetShape) {\n if (transition) {\n this.shape = extend({}, this.shape);\n var targetShapePrimaryProps = {};\n var shapeKeys = keys(targetShape);\n for (var i = 0; i < shapeKeys.length; i++) {\n var key = shapeKeys[i];\n if (typeof targetShape[key] === 'object') {\n this.shape[key] = targetShape[key];\n }\n else {\n targetShapePrimaryProps[key] = targetShape[key];\n }\n }\n this._transitionState(stateName, {\n shape: targetShapePrimaryProps\n }, animationCfg);\n }\n else {\n this.shape = targetShape;\n this.dirtyShape();\n }\n }\n };\n Path.prototype._mergeStates = function (states) {\n var mergedState = _super.prototype._mergeStates.call(this, states);\n var mergedShape;\n for (var i = 0; i < states.length; i++) {\n var state = states[i];\n if (state.shape) {\n mergedShape = mergedShape || {};\n this._mergeStyle(mergedShape, state.shape);\n }\n }\n if (mergedShape) {\n mergedState.shape = mergedShape;\n }\n return mergedState;\n };\n Path.prototype.getAnimationStyleProps = function () {\n return DEFAULT_PATH_ANIMATION_PROPS;\n };\n Path.prototype.isZeroArea = function () {\n return false;\n };\n Path.extend = function (defaultProps) {\n var Sub = (function (_super) {\n __extends(Sub, _super);\n function Sub(opts) {\n var _this = _super.call(this, opts) || this;\n defaultProps.init && defaultProps.init.call(_this, opts);\n return _this;\n }\n Sub.prototype.getDefaultStyle = function () {\n return clone(defaultProps.style);\n };\n Sub.prototype.getDefaultShape = function () {\n return clone(defaultProps.shape);\n };\n return Sub;\n }(Path));\n for (var key in defaultProps) {\n if (typeof defaultProps[key] === 'function') {\n Sub.prototype[key] = defaultProps[key];\n }\n }\n return Sub;\n };\n Path.initDefaultProps = (function () {\n var pathProto = Path.prototype;\n pathProto.type = 'path';\n pathProto.strokeContainThreshold = 5;\n pathProto.segmentIgnoreThreshold = 0;\n pathProto.subPixelOptimize = false;\n pathProto.autoBatch = false;\n pathProto.__dirty = REDARAW_BIT | STYLE_CHANGED_BIT | SHAPE_CHANGED_BIT;\n })();\n return Path;\n}(Displayable));\nexport default Path;\n","import { __extends } from \"tslib\";\nimport Displayable from './Displayable';\nimport { getBoundingRect, DEFAULT_FONT } from '../contain/text';\nimport { DEFAULT_PATH_STYLE } from './Path';\nimport { createObject, defaults } from '../core/util';\nexport var DEFAULT_TSPAN_STYLE = defaults({\n strokeFirst: true,\n font: DEFAULT_FONT,\n x: 0,\n y: 0,\n textAlign: 'left',\n textBaseline: 'top',\n miterLimit: 2\n}, DEFAULT_PATH_STYLE);\nvar TSpan = (function (_super) {\n __extends(TSpan, _super);\n function TSpan() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TSpan.prototype.hasStroke = function () {\n var style = this.style;\n var stroke = style.stroke;\n return stroke != null && stroke !== 'none' && style.lineWidth > 0;\n };\n TSpan.prototype.hasFill = function () {\n var style = this.style;\n var fill = style.fill;\n return fill != null && fill !== 'none';\n };\n TSpan.prototype.createStyle = function (obj) {\n return createObject(DEFAULT_TSPAN_STYLE, obj);\n };\n TSpan.prototype.setBoundingRect = function (rect) {\n this._rect = rect;\n };\n TSpan.prototype.getBoundingRect = function () {\n var style = this.style;\n if (!this._rect) {\n var text = style.text;\n text != null ? (text += '') : (text = '');\n var rect = getBoundingRect(text, style.font, style.textAlign, style.textBaseline);\n rect.x += style.x || 0;\n rect.y += style.y || 0;\n if (this.hasStroke()) {\n var w = style.lineWidth;\n rect.x -= w / 2;\n rect.y -= w / 2;\n rect.width += w;\n rect.height += w;\n }\n this._rect = rect;\n }\n return this._rect;\n };\n TSpan.initDefaultProps = (function () {\n var tspanProto = TSpan.prototype;\n tspanProto.dirtyRectTolerance = 10;\n })();\n return TSpan;\n}(Displayable));\nTSpan.prototype.type = 'tspan';\nexport default TSpan;\n","import { __extends } from \"tslib\";\nimport Displayable, { DEFAULT_COMMON_STYLE, DEFAULT_COMMON_ANIMATION_PROPS } from './Displayable';\nimport BoundingRect from '../core/BoundingRect';\nimport { defaults, createObject } from '../core/util';\nexport var DEFAULT_IMAGE_STYLE = defaults({\n x: 0,\n y: 0\n}, DEFAULT_COMMON_STYLE);\nexport var DEFAULT_IMAGE_ANIMATION_PROPS = {\n style: defaults({\n x: true,\n y: true,\n width: true,\n height: true,\n sx: true,\n sy: true,\n sWidth: true,\n sHeight: true\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n};\nfunction isImageLike(source) {\n return !!(source\n && typeof source !== 'string'\n && source.width && source.height);\n}\nvar ZRImage = (function (_super) {\n __extends(ZRImage, _super);\n function ZRImage() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ZRImage.prototype.createStyle = function (obj) {\n return createObject(DEFAULT_IMAGE_STYLE, obj);\n };\n ZRImage.prototype._getSize = function (dim) {\n var style = this.style;\n var size = style[dim];\n if (size != null) {\n return size;\n }\n var imageSource = isImageLike(style.image)\n ? style.image : this.__image;\n if (!imageSource) {\n return 0;\n }\n var otherDim = dim === 'width' ? 'height' : 'width';\n var otherDimSize = style[otherDim];\n if (otherDimSize == null) {\n return imageSource[dim];\n }\n else {\n return imageSource[dim] / imageSource[otherDim] * otherDimSize;\n }\n };\n ZRImage.prototype.getWidth = function () {\n return this._getSize('width');\n };\n ZRImage.prototype.getHeight = function () {\n return this._getSize('height');\n };\n ZRImage.prototype.getAnimationStyleProps = function () {\n return DEFAULT_IMAGE_ANIMATION_PROPS;\n };\n ZRImage.prototype.getBoundingRect = function () {\n var style = this.style;\n if (!this._rect) {\n this._rect = new BoundingRect(style.x || 0, style.y || 0, this.getWidth(), this.getHeight());\n }\n return this._rect;\n };\n return ZRImage;\n}(Displayable));\nZRImage.prototype.type = 'image';\nexport default ZRImage;\n","export function buildPath(ctx, shape) {\n var x = shape.x;\n var y = shape.y;\n var width = shape.width;\n var height = shape.height;\n var r = shape.r;\n var r1;\n var r2;\n var r3;\n var r4;\n if (width < 0) {\n x = x + width;\n width = -width;\n }\n if (height < 0) {\n y = y + height;\n height = -height;\n }\n if (typeof r === 'number') {\n r1 = r2 = r3 = r4 = r;\n }\n else if (r instanceof Array) {\n if (r.length === 1) {\n r1 = r2 = r3 = r4 = r[0];\n }\n else if (r.length === 2) {\n r1 = r3 = r[0];\n r2 = r4 = r[1];\n }\n else if (r.length === 3) {\n r1 = r[0];\n r2 = r4 = r[1];\n r3 = r[2];\n }\n else {\n r1 = r[0];\n r2 = r[1];\n r3 = r[2];\n r4 = r[3];\n }\n }\n else {\n r1 = r2 = r3 = r4 = 0;\n }\n var total;\n if (r1 + r2 > width) {\n total = r1 + r2;\n r1 *= width / total;\n r2 *= width / total;\n }\n if (r3 + r4 > width) {\n total = r3 + r4;\n r3 *= width / total;\n r4 *= width / total;\n }\n if (r2 + r3 > height) {\n total = r2 + r3;\n r2 *= height / total;\n r3 *= height / total;\n }\n if (r1 + r4 > height) {\n total = r1 + r4;\n r1 *= height / total;\n r4 *= height / total;\n }\n ctx.moveTo(x + r1, y);\n ctx.lineTo(x + width - r2, y);\n r2 !== 0 && ctx.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0);\n ctx.lineTo(x + width, y + height - r3);\n r3 !== 0 && ctx.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2);\n ctx.lineTo(x + r4, y + height);\n r4 !== 0 && ctx.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI);\n ctx.lineTo(x, y + r1);\n r1 !== 0 && ctx.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);\n}\n","var round = Math.round;\nexport function subPixelOptimizeLine(outputShape, inputShape, style) {\n if (!inputShape) {\n return;\n }\n var x1 = inputShape.x1;\n var x2 = inputShape.x2;\n var y1 = inputShape.y1;\n var y2 = inputShape.y2;\n outputShape.x1 = x1;\n outputShape.x2 = x2;\n outputShape.y1 = y1;\n outputShape.y2 = y2;\n var lineWidth = style && style.lineWidth;\n if (!lineWidth) {\n return outputShape;\n }\n if (round(x1 * 2) === round(x2 * 2)) {\n outputShape.x1 = outputShape.x2 = subPixelOptimize(x1, lineWidth, true);\n }\n if (round(y1 * 2) === round(y2 * 2)) {\n outputShape.y1 = outputShape.y2 = subPixelOptimize(y1, lineWidth, true);\n }\n return outputShape;\n}\nexport function subPixelOptimizeRect(outputShape, inputShape, style) {\n if (!inputShape) {\n return;\n }\n var originX = inputShape.x;\n var originY = inputShape.y;\n var originWidth = inputShape.width;\n var originHeight = inputShape.height;\n outputShape.x = originX;\n outputShape.y = originY;\n outputShape.width = originWidth;\n outputShape.height = originHeight;\n var lineWidth = style && style.lineWidth;\n if (!lineWidth) {\n return outputShape;\n }\n outputShape.x = subPixelOptimize(originX, lineWidth, true);\n outputShape.y = subPixelOptimize(originY, lineWidth, true);\n outputShape.width = Math.max(subPixelOptimize(originX + originWidth, lineWidth, false) - outputShape.x, originWidth === 0 ? 0 : 1);\n outputShape.height = Math.max(subPixelOptimize(originY + originHeight, lineWidth, false) - outputShape.y, originHeight === 0 ? 0 : 1);\n return outputShape;\n}\nexport function subPixelOptimize(position, lineWidth, positiveOrNegative) {\n if (!lineWidth) {\n return position;\n }\n var doubledPosition = round(position * 2);\n return (doubledPosition + round(lineWidth)) % 2 === 0\n ? doubledPosition / 2\n : (doubledPosition + (positiveOrNegative ? 1 : -1)) / 2;\n}\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as roundRectHelper from '../helper/roundRect';\nimport { subPixelOptimizeRect } from '../helper/subPixelOptimize';\nvar RectShape = (function () {\n function RectShape() {\n this.x = 0;\n this.y = 0;\n this.width = 0;\n this.height = 0;\n }\n return RectShape;\n}());\nexport { RectShape };\nvar subPixelOptimizeOutputShape = {};\nvar Rect = (function (_super) {\n __extends(Rect, _super);\n function Rect(opts) {\n return _super.call(this, opts) || this;\n }\n Rect.prototype.getDefaultShape = function () {\n return new RectShape();\n };\n Rect.prototype.buildPath = function (ctx, shape) {\n var x;\n var y;\n var width;\n var height;\n if (this.subPixelOptimize) {\n var optimizedShape = subPixelOptimizeRect(subPixelOptimizeOutputShape, shape, this.style);\n x = optimizedShape.x;\n y = optimizedShape.y;\n width = optimizedShape.width;\n height = optimizedShape.height;\n optimizedShape.r = shape.r;\n shape = optimizedShape;\n }\n else {\n x = shape.x;\n y = shape.y;\n width = shape.width;\n height = shape.height;\n }\n if (!shape.r) {\n ctx.rect(x, y, width, height);\n }\n else {\n roundRectHelper.buildPath(ctx, shape);\n }\n };\n Rect.prototype.isZeroArea = function () {\n return !this.shape.width || !this.shape.height;\n };\n return Rect;\n}(Path));\nRect.prototype.type = 'rect';\nexport default Rect;\n","import { __extends } from \"tslib\";\nimport { parseRichText, parsePlainText } from './helper/parseText';\nimport TSpan from './TSpan';\nimport { retrieve2, each, normalizeCssArray, trim, retrieve3, extend, keys, defaults } from '../core/util';\nimport { DEFAULT_FONT, adjustTextX, adjustTextY } from '../contain/text';\nimport ZRImage from './Image';\nimport Rect from './shape/Rect';\nimport BoundingRect from '../core/BoundingRect';\nimport { copy } from '../core/matrix';\nimport Displayable, { DEFAULT_COMMON_ANIMATION_PROPS } from './Displayable';\nvar DEFAULT_RICH_TEXT_COLOR = {\n fill: '#000'\n};\nvar DEFAULT_STROKE_LINE_WIDTH = 2;\nexport var DEFAULT_TEXT_ANIMATION_PROPS = {\n style: defaults({\n fill: true,\n stroke: true,\n fillOpacity: true,\n strokeOpacity: true,\n lineWidth: true,\n fontSize: true,\n lineHeight: true,\n width: true,\n height: true,\n textShadowColor: true,\n textShadowBlur: true,\n textShadowOffsetX: true,\n textShadowOffsetY: true,\n backgroundColor: true,\n padding: true,\n borderColor: true,\n borderWidth: true,\n borderRadius: true\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n};\nvar ZRText = (function (_super) {\n __extends(ZRText, _super);\n function ZRText(opts) {\n var _this = _super.call(this) || this;\n _this.type = 'text';\n _this._children = [];\n _this._defaultStyle = DEFAULT_RICH_TEXT_COLOR;\n _this.attr(opts);\n return _this;\n }\n ZRText.prototype.childrenRef = function () {\n return this._children;\n };\n ZRText.prototype.update = function () {\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n child.zlevel = this.zlevel;\n child.z = this.z;\n child.z2 = this.z2;\n child.culling = this.culling;\n child.cursor = this.cursor;\n child.invisible = this.invisible;\n }\n var attachedTransform = this.attachedTransform;\n if (attachedTransform) {\n attachedTransform.updateTransform();\n var m = attachedTransform.transform;\n if (m) {\n this.transform = this.transform || [];\n copy(this.transform, m);\n }\n else {\n this.transform = null;\n }\n }\n else {\n _super.prototype.update.call(this);\n }\n };\n ZRText.prototype.getComputedTransform = function () {\n if (this.__hostTarget) {\n this.__hostTarget.getComputedTransform();\n this.__hostTarget.updateInnerText(true);\n }\n return this.attachedTransform ? this.attachedTransform.getComputedTransform()\n : _super.prototype.getComputedTransform.call(this);\n };\n ZRText.prototype._updateSubTexts = function () {\n this._childCursor = 0;\n normalizeTextStyle(this.style);\n this.style.rich\n ? this._updateRichTexts()\n : this._updatePlainTexts();\n this._children.length = this._childCursor;\n this.styleUpdated();\n };\n ZRText.prototype.addSelfToZr = function (zr) {\n _super.prototype.addSelfToZr.call(this, zr);\n for (var i = 0; i < this._children.length; i++) {\n this._children[i].__zr = zr;\n }\n };\n ZRText.prototype.removeSelfFromZr = function (zr) {\n _super.prototype.removeSelfFromZr.call(this, zr);\n for (var i = 0; i < this._children.length; i++) {\n this._children[i].__zr = null;\n }\n };\n ZRText.prototype.getBoundingRect = function () {\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n if (!this._rect) {\n var tmpRect = new BoundingRect(0, 0, 0, 0);\n var children = this._children;\n var tmpMat = [];\n var rect = null;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n var childRect = child.getBoundingRect();\n var transform = child.getLocalTransform(tmpMat);\n if (transform) {\n tmpRect.copy(childRect);\n tmpRect.applyTransform(transform);\n rect = rect || tmpRect.clone();\n rect.union(tmpRect);\n }\n else {\n rect = rect || childRect.clone();\n rect.union(childRect);\n }\n }\n this._rect = rect || tmpRect;\n }\n return this._rect;\n };\n ZRText.prototype.setDefaultTextStyle = function (defaultTextStyle) {\n this._defaultStyle = defaultTextStyle || DEFAULT_RICH_TEXT_COLOR;\n };\n ZRText.prototype.setTextContent = function (textContent) {\n throw new Error('Can\\'t attach text on another text');\n };\n ZRText.prototype._mergeStyle = function (targetStyle, sourceStyle) {\n if (!sourceStyle) {\n return targetStyle;\n }\n var sourceRich = sourceStyle.rich;\n var targetRich = targetStyle.rich || (sourceRich && {});\n extend(targetStyle, sourceStyle);\n if (sourceRich && targetRich) {\n this._mergeRich(targetRich, sourceRich);\n targetStyle.rich = targetRich;\n }\n else if (targetRich) {\n targetStyle.rich = targetRich;\n }\n return targetStyle;\n };\n ZRText.prototype._mergeRich = function (targetRich, sourceRich) {\n var richNames = keys(sourceRich);\n for (var i = 0; i < richNames.length; i++) {\n var richName = richNames[i];\n targetRich[richName] = targetRich[richName] || {};\n extend(targetRich[richName], sourceRich[richName]);\n }\n };\n ZRText.prototype.getAnimationStyleProps = function () {\n return DEFAULT_TEXT_ANIMATION_PROPS;\n };\n ZRText.prototype._getOrCreateChild = function (Ctor) {\n var child = this._children[this._childCursor];\n if (!child || !(child instanceof Ctor)) {\n child = new Ctor();\n }\n this._children[this._childCursor++] = child;\n child.__zr = this.__zr;\n child.parent = this;\n return child;\n };\n ZRText.prototype._updatePlainTexts = function () {\n var style = this.style;\n var textFont = style.font || DEFAULT_FONT;\n var textPadding = style.padding;\n var text = getStyleText(style);\n var contentBlock = parsePlainText(text, style);\n var needDrawBg = needDrawBackground(style);\n var bgColorDrawn = !!(style.backgroundColor);\n var outerHeight = contentBlock.outerHeight;\n var textLines = contentBlock.lines;\n var lineHeight = contentBlock.lineHeight;\n var defaultStyle = this._defaultStyle;\n var baseX = style.x || 0;\n var baseY = style.y || 0;\n var textAlign = style.align || defaultStyle.align || 'left';\n var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign || 'top';\n var textX = baseX;\n var textY = adjustTextY(baseY, contentBlock.contentHeight, verticalAlign);\n if (needDrawBg || textPadding) {\n var outerWidth_1 = contentBlock.width;\n textPadding && (outerWidth_1 += textPadding[1] + textPadding[3]);\n var boxX = adjustTextX(baseX, outerWidth_1, textAlign);\n var boxY = adjustTextY(baseY, outerHeight, verticalAlign);\n needDrawBg && this._renderBackground(style, style, boxX, boxY, outerWidth_1, outerHeight);\n }\n textY += lineHeight / 2;\n if (textPadding) {\n textX = getTextXForPadding(baseX, textAlign, textPadding);\n if (verticalAlign === 'top') {\n textY += textPadding[0];\n }\n else if (verticalAlign === 'bottom') {\n textY -= textPadding[2];\n }\n }\n var defaultLineWidth = 0;\n var useDefaultFill = false;\n var textFill = getFill('fill' in style\n ? style.fill\n : (useDefaultFill = true, defaultStyle.fill));\n var textStroke = getStroke('stroke' in style\n ? style.stroke\n : (!bgColorDrawn\n && (!defaultStyle.autoStroke || useDefaultFill))\n ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)\n : null);\n var hasShadow = style.textShadowBlur > 0;\n var fixedBoundingRect = style.width != null\n && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');\n var calculatedLineHeight = contentBlock.calculatedLineHeight;\n for (var i = 0; i < textLines.length; i++) {\n var el = this._getOrCreateChild(TSpan);\n var subElStyle = el.createStyle();\n el.useStyle(subElStyle);\n subElStyle.text = textLines[i];\n subElStyle.x = textX;\n subElStyle.y = textY;\n if (textAlign) {\n subElStyle.textAlign = textAlign;\n }\n subElStyle.textBaseline = 'middle';\n subElStyle.opacity = style.opacity;\n subElStyle.strokeFirst = true;\n if (hasShadow) {\n subElStyle.shadowBlur = style.textShadowBlur || 0;\n subElStyle.shadowColor = style.textShadowColor || 'transparent';\n subElStyle.shadowOffsetX = style.textShadowOffsetX || 0;\n subElStyle.shadowOffsetY = style.textShadowOffsetY || 0;\n }\n if (textStroke) {\n subElStyle.stroke = textStroke;\n subElStyle.lineWidth = style.lineWidth || defaultLineWidth;\n subElStyle.lineDash = style.lineDash;\n subElStyle.lineDashOffset = style.lineDashOffset || 0;\n }\n if (textFill) {\n subElStyle.fill = textFill;\n }\n subElStyle.font = textFont;\n textY += lineHeight;\n if (fixedBoundingRect) {\n el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, style.width, subElStyle.textAlign), adjustTextY(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), style.width, calculatedLineHeight));\n }\n }\n };\n ZRText.prototype._updateRichTexts = function () {\n var style = this.style;\n var text = getStyleText(style);\n var contentBlock = parseRichText(text, style);\n var contentWidth = contentBlock.width;\n var outerWidth = contentBlock.outerWidth;\n var outerHeight = contentBlock.outerHeight;\n var textPadding = style.padding;\n var baseX = style.x || 0;\n var baseY = style.y || 0;\n var defaultStyle = this._defaultStyle;\n var textAlign = style.align || defaultStyle.align;\n var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;\n var boxX = adjustTextX(baseX, outerWidth, textAlign);\n var boxY = adjustTextY(baseY, outerHeight, verticalAlign);\n var xLeft = boxX;\n var lineTop = boxY;\n if (textPadding) {\n xLeft += textPadding[3];\n lineTop += textPadding[0];\n }\n var xRight = xLeft + contentWidth;\n if (needDrawBackground(style)) {\n this._renderBackground(style, style, boxX, boxY, outerWidth, outerHeight);\n }\n var bgColorDrawn = !!(style.backgroundColor);\n for (var i = 0; i < contentBlock.lines.length; i++) {\n var line = contentBlock.lines[i];\n var tokens = line.tokens;\n var tokenCount = tokens.length;\n var lineHeight = line.lineHeight;\n var remainedWidth = line.width;\n var leftIndex = 0;\n var lineXLeft = xLeft;\n var lineXRight = xRight;\n var rightIndex = tokenCount - 1;\n var token = void 0;\n while (leftIndex < tokenCount\n && (token = tokens[leftIndex], !token.align || token.align === 'left')) {\n this._placeToken(token, style, lineHeight, lineTop, lineXLeft, 'left', bgColorDrawn);\n remainedWidth -= token.width;\n lineXLeft += token.width;\n leftIndex++;\n }\n while (rightIndex >= 0\n && (token = tokens[rightIndex], token.align === 'right')) {\n this._placeToken(token, style, lineHeight, lineTop, lineXRight, 'right', bgColorDrawn);\n remainedWidth -= token.width;\n lineXRight -= token.width;\n rightIndex--;\n }\n lineXLeft += (contentWidth - (lineXLeft - xLeft) - (xRight - lineXRight) - remainedWidth) / 2;\n while (leftIndex <= rightIndex) {\n token = tokens[leftIndex];\n this._placeToken(token, style, lineHeight, lineTop, lineXLeft + token.width / 2, 'center', bgColorDrawn);\n lineXLeft += token.width;\n leftIndex++;\n }\n lineTop += lineHeight;\n }\n };\n ZRText.prototype._placeToken = function (token, style, lineHeight, lineTop, x, textAlign, parentBgColorDrawn) {\n var tokenStyle = style.rich[token.styleName] || {};\n tokenStyle.text = token.text;\n var verticalAlign = token.verticalAlign;\n var y = lineTop + lineHeight / 2;\n if (verticalAlign === 'top') {\n y = lineTop + token.height / 2;\n }\n else if (verticalAlign === 'bottom') {\n y = lineTop + lineHeight - token.height / 2;\n }\n var needDrawBg = !token.isLineHolder && needDrawBackground(tokenStyle);\n needDrawBg && this._renderBackground(tokenStyle, style, textAlign === 'right'\n ? x - token.width\n : textAlign === 'center'\n ? x - token.width / 2\n : x, y - token.height / 2, token.width, token.height);\n var bgColorDrawn = !!tokenStyle.backgroundColor;\n var textPadding = token.textPadding;\n if (textPadding) {\n x = getTextXForPadding(x, textAlign, textPadding);\n y -= token.height / 2 - textPadding[0] - token.innerHeight / 2;\n }\n var el = this._getOrCreateChild(TSpan);\n var subElStyle = el.createStyle();\n el.useStyle(subElStyle);\n var defaultStyle = this._defaultStyle;\n var useDefaultFill = false;\n var defaultLineWidth = 0;\n var textFill = getStroke('fill' in tokenStyle ? tokenStyle.fill\n : 'fill' in style ? style.fill\n : (useDefaultFill = true, defaultStyle.fill));\n var textStroke = getStroke('stroke' in tokenStyle ? tokenStyle.stroke\n : 'stroke' in style ? style.stroke\n : (!bgColorDrawn\n && !parentBgColorDrawn\n && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)\n : null);\n var hasShadow = tokenStyle.textShadowBlur > 0\n || style.textShadowBlur > 0;\n subElStyle.text = token.text;\n subElStyle.x = x;\n subElStyle.y = y;\n if (hasShadow) {\n subElStyle.shadowBlur = tokenStyle.textShadowBlur || style.textShadowBlur || 0;\n subElStyle.shadowColor = tokenStyle.textShadowColor || style.textShadowColor || 'transparent';\n subElStyle.shadowOffsetX = tokenStyle.textShadowOffsetX || style.textShadowOffsetX || 0;\n subElStyle.shadowOffsetY = tokenStyle.textShadowOffsetY || style.textShadowOffsetY || 0;\n }\n subElStyle.textAlign = textAlign;\n subElStyle.textBaseline = 'middle';\n subElStyle.font = token.font || DEFAULT_FONT;\n subElStyle.opacity = retrieve3(tokenStyle.opacity, style.opacity, 1);\n if (textStroke) {\n subElStyle.lineWidth = retrieve3(tokenStyle.lineWidth, style.lineWidth, defaultLineWidth);\n subElStyle.lineDash = retrieve2(tokenStyle.lineDash, style.lineDash);\n subElStyle.lineDashOffset = style.lineDashOffset || 0;\n subElStyle.stroke = textStroke;\n }\n if (textFill) {\n subElStyle.fill = textFill;\n }\n var textWidth = token.contentWidth;\n var textHeight = token.contentHeight;\n el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign), adjustTextY(subElStyle.y, textHeight, subElStyle.textBaseline), textWidth, textHeight));\n };\n ZRText.prototype._renderBackground = function (style, topStyle, x, y, width, height) {\n var textBackgroundColor = style.backgroundColor;\n var textBorderWidth = style.borderWidth;\n var textBorderColor = style.borderColor;\n var isImageBg = textBackgroundColor && textBackgroundColor.image;\n var isPlainOrGradientBg = textBackgroundColor && !isImageBg;\n var textBorderRadius = style.borderRadius;\n var self = this;\n var rectEl;\n var imgEl;\n if (isPlainOrGradientBg || (textBorderWidth && textBorderColor)) {\n rectEl = this._getOrCreateChild(Rect);\n rectEl.useStyle(rectEl.createStyle());\n rectEl.style.fill = null;\n var rectShape = rectEl.shape;\n rectShape.x = x;\n rectShape.y = y;\n rectShape.width = width;\n rectShape.height = height;\n rectShape.r = textBorderRadius;\n rectEl.dirtyShape();\n }\n if (isPlainOrGradientBg) {\n var rectStyle = rectEl.style;\n rectStyle.fill = textBackgroundColor || null;\n rectStyle.fillOpacity = retrieve2(style.fillOpacity, 1);\n }\n else if (isImageBg) {\n imgEl = this._getOrCreateChild(ZRImage);\n imgEl.onload = function () {\n self.dirtyStyle();\n };\n var imgStyle = imgEl.style;\n imgStyle.image = textBackgroundColor.image;\n imgStyle.x = x;\n imgStyle.y = y;\n imgStyle.width = width;\n imgStyle.height = height;\n }\n if (textBorderWidth && textBorderColor) {\n var rectStyle = rectEl.style;\n rectStyle.lineWidth = textBorderWidth;\n rectStyle.stroke = textBorderColor;\n rectStyle.strokeOpacity = retrieve2(style.strokeOpacity, 1);\n rectStyle.lineDash = style.borderDash;\n rectStyle.lineDashOffset = style.borderDashOffset || 0;\n rectEl.strokeContainThreshold = 0;\n if (rectEl.hasFill() && rectEl.hasStroke()) {\n rectStyle.strokeFirst = true;\n rectStyle.lineWidth *= 2;\n }\n }\n var commonStyle = (rectEl || imgEl).style;\n commonStyle.shadowBlur = style.shadowBlur || 0;\n commonStyle.shadowColor = style.shadowColor || 'transparent';\n commonStyle.shadowOffsetX = style.shadowOffsetX || 0;\n commonStyle.shadowOffsetY = style.shadowOffsetY || 0;\n commonStyle.opacity = retrieve3(style.opacity, topStyle.opacity, 1);\n };\n ZRText.makeFont = function (style) {\n var font = '';\n if (style.fontSize || style.fontFamily || style.fontWeight) {\n var fontSize = '';\n if (typeof style.fontSize === 'string'\n && (style.fontSize.indexOf('px') !== -1\n || style.fontSize.indexOf('rem') !== -1\n || style.fontSize.indexOf('em') !== -1)) {\n fontSize = style.fontSize;\n }\n else if (!isNaN(+style.fontSize)) {\n fontSize = style.fontSize + 'px';\n }\n else {\n fontSize = '12px';\n }\n font = [\n style.fontStyle,\n style.fontWeight,\n fontSize,\n style.fontFamily || 'sans-serif'\n ].join(' ');\n }\n return font && trim(font) || style.textFont || style.font;\n };\n return ZRText;\n}(Displayable));\nvar VALID_TEXT_ALIGN = { left: true, right: 1, center: 1 };\nvar VALID_TEXT_VERTICAL_ALIGN = { top: 1, bottom: 1, middle: 1 };\nexport function normalizeTextStyle(style) {\n normalizeStyle(style);\n each(style.rich, normalizeStyle);\n return style;\n}\nfunction normalizeStyle(style) {\n if (style) {\n style.font = ZRText.makeFont(style);\n var textAlign = style.align;\n textAlign === 'middle' && (textAlign = 'center');\n style.align = (textAlign == null || VALID_TEXT_ALIGN[textAlign]) ? textAlign : 'left';\n var verticalAlign = style.verticalAlign;\n verticalAlign === 'center' && (verticalAlign = 'middle');\n style.verticalAlign = (verticalAlign == null || VALID_TEXT_VERTICAL_ALIGN[verticalAlign]) ? verticalAlign : 'top';\n var textPadding = style.padding;\n if (textPadding) {\n style.padding = normalizeCssArray(style.padding);\n }\n }\n}\nfunction getStroke(stroke, lineWidth) {\n return (stroke == null || lineWidth <= 0 || stroke === 'transparent' || stroke === 'none')\n ? null\n : (stroke.image || stroke.colorStops)\n ? '#000'\n : stroke;\n}\nfunction getFill(fill) {\n return (fill == null || fill === 'none')\n ? null\n : (fill.image || fill.colorStops)\n ? '#000'\n : fill;\n}\nfunction getTextXForPadding(x, textAlign, textPadding) {\n return textAlign === 'right'\n ? (x - textPadding[1])\n : textAlign === 'center'\n ? (x + textPadding[3] / 2 - textPadding[1] / 2)\n : (x + textPadding[3]);\n}\nfunction getStyleText(style) {\n var text = style.text;\n text != null && (text += '');\n return text;\n}\nfunction needDrawBackground(style) {\n return !!(style.backgroundColor\n || (style.borderWidth && style.borderColor));\n}\nexport default ZRText;\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/*\n* A third-party license is embeded for some of the code in this file:\n* The method \"quantile\" was copied from \"d3.js\".\n* (See more details in the comment of the method below.)\n* The use of the source code of this file is also subject to the terms\n* and consitions of the license of \"d3.js\" (BSD-3Clause, see\n* ).\n*/\nimport * as zrUtil from 'zrender/lib/core/util';\nvar RADIAN_EPSILON = 1e-4; // Although chrome already enlarge this number to 100 for `toFixed`, but\n// we sill follow the spec for compatibility.\n\nvar ROUND_SUPPORTED_PRECISION_MAX = 20;\n\nfunction _trim(str) {\n return str.replace(/^\\s+|\\s+$/g, '');\n}\n/**\n * Linear mapping a value from domain to range\n * @param val\n * @param domain Domain extent domain[0] can be bigger than domain[1]\n * @param range Range extent range[0] can be bigger than range[1]\n * @param clamp Default to be false\n */\n\n\nexport function linearMap(val, domain, range, clamp) {\n var d0 = domain[0];\n var d1 = domain[1];\n var r0 = range[0];\n var r1 = range[1];\n var subDomain = d1 - d0;\n var subRange = r1 - r0;\n\n if (subDomain === 0) {\n return subRange === 0 ? r0 : (r0 + r1) / 2;\n } // Avoid accuracy problem in edge, such as\n // 146.39 - 62.83 === 83.55999999999999.\n // See echarts/test/ut/spec/util/number.js#linearMap#accuracyError\n // It is a little verbose for efficiency considering this method\n // is a hotspot.\n\n\n if (clamp) {\n if (subDomain > 0) {\n if (val <= d0) {\n return r0;\n } else if (val >= d1) {\n return r1;\n }\n } else {\n if (val >= d0) {\n return r0;\n } else if (val <= d1) {\n return r1;\n }\n }\n } else {\n if (val === d0) {\n return r0;\n }\n\n if (val === d1) {\n return r1;\n }\n }\n\n return (val - d0) / subDomain * subRange + r0;\n}\n/**\n * Convert a percent string to absolute number.\n * Returns NaN if percent is not a valid string or number\n */\n\nexport function parsePercent(percent, all) {\n switch (percent) {\n case 'center':\n case 'middle':\n percent = '50%';\n break;\n\n case 'left':\n case 'top':\n percent = '0%';\n break;\n\n case 'right':\n case 'bottom':\n percent = '100%';\n break;\n }\n\n if (typeof percent === 'string') {\n if (_trim(percent).match(/%$/)) {\n return parseFloat(percent) / 100 * all;\n }\n\n return parseFloat(percent);\n }\n\n return percent == null ? NaN : +percent;\n}\nexport function round(x, precision, returnStr) {\n if (precision == null) {\n precision = 10;\n } // Avoid range error\n\n\n precision = Math.min(Math.max(0, precision), ROUND_SUPPORTED_PRECISION_MAX); // PENDING: 1.005.toFixed(2) is '1.00' rather than '1.01'\n\n x = (+x).toFixed(precision);\n return returnStr ? x : +x;\n}\n/**\n * Inplacd asc sort arr.\n * The input arr will be modified.\n */\n\nexport function asc(arr) {\n arr.sort(function (a, b) {\n return a - b;\n });\n return arr;\n}\n/**\n * Get precision.\n */\n\nexport function getPrecision(val) {\n val = +val;\n\n if (isNaN(val)) {\n return 0;\n } // It is much faster than methods converting number to string as follows\n // let tmp = val.toString();\n // return tmp.length - 1 - tmp.indexOf('.');\n // especially when precision is low\n // Notice:\n // (1) If the loop count is over about 20, it is slower than `getPrecisionSafe`.\n // (see https://jsbench.me/2vkpcekkvw/1)\n // (2) If the val is less than for example 1e-15, the result may be incorrect.\n // (see test/ut/spec/util/number.test.ts `getPrecision_equal_random`)\n\n\n if (val > 1e-14) {\n var e = 1;\n\n for (var i = 0; i < 15; i++, e *= 10) {\n if (Math.round(val * e) / e === val) {\n return i;\n }\n }\n }\n\n return getPrecisionSafe(val);\n}\n/**\n * Get precision with slow but safe method\n */\n\nexport function getPrecisionSafe(val) {\n // toLowerCase for: '3.4E-12'\n var str = val.toString().toLowerCase(); // Consider scientific notation: '3.4e-12' '3.4e+12'\n\n var eIndex = str.indexOf('e');\n var exp = eIndex > 0 ? +str.slice(eIndex + 1) : 0;\n var significandPartLen = eIndex > 0 ? eIndex : str.length;\n var dotIndex = str.indexOf('.');\n var decimalPartLen = dotIndex < 0 ? 0 : significandPartLen - 1 - dotIndex;\n return Math.max(0, decimalPartLen - exp);\n}\n/**\n * Minimal dicernible data precisioin according to a single pixel.\n */\n\nexport function getPixelPrecision(dataExtent, pixelExtent) {\n var log = Math.log;\n var LN10 = Math.LN10;\n var dataQuantity = Math.floor(log(dataExtent[1] - dataExtent[0]) / LN10);\n var sizeQuantity = Math.round(log(Math.abs(pixelExtent[1] - pixelExtent[0])) / LN10); // toFixed() digits argument must be between 0 and 20.\n\n var precision = Math.min(Math.max(-dataQuantity + sizeQuantity, 0), 20);\n return !isFinite(precision) ? 20 : precision;\n}\n/**\n * Get a data of given precision, assuring the sum of percentages\n * in valueList is 1.\n * The largest remainer method is used.\n * https://en.wikipedia.org/wiki/Largest_remainder_method\n *\n * @param valueList a list of all data\n * @param idx index of the data to be processed in valueList\n * @param precision integer number showing digits of precision\n * @return percent ranging from 0 to 100\n */\n\nexport function getPercentWithPrecision(valueList, idx, precision) {\n if (!valueList[idx]) {\n return 0;\n }\n\n var sum = zrUtil.reduce(valueList, function (acc, val) {\n return acc + (isNaN(val) ? 0 : val);\n }, 0);\n\n if (sum === 0) {\n return 0;\n }\n\n var digits = Math.pow(10, precision);\n var votesPerQuota = zrUtil.map(valueList, function (val) {\n return (isNaN(val) ? 0 : val) / sum * digits * 100;\n });\n var targetSeats = digits * 100;\n var seats = zrUtil.map(votesPerQuota, function (votes) {\n // Assign automatic seats.\n return Math.floor(votes);\n });\n var currentSum = zrUtil.reduce(seats, function (acc, val) {\n return acc + val;\n }, 0);\n var remainder = zrUtil.map(votesPerQuota, function (votes, idx) {\n return votes - seats[idx];\n }); // Has remainding votes.\n\n while (currentSum < targetSeats) {\n // Find next largest remainder.\n var max = Number.NEGATIVE_INFINITY;\n var maxId = null;\n\n for (var i = 0, len = remainder.length; i < len; ++i) {\n if (remainder[i] > max) {\n max = remainder[i];\n maxId = i;\n }\n } // Add a vote to max remainder.\n\n\n ++seats[maxId];\n remainder[maxId] = 0;\n ++currentSum;\n }\n\n return seats[idx] / digits;\n}\n/**\n * Solve the floating point adding problem like 0.1 + 0.2 === 0.30000000000000004\n * See \n */\n\nexport function addSafe(val0, val1) {\n var maxPrecision = Math.max(getPrecision(val0), getPrecision(val1)); // const multiplier = Math.pow(10, maxPrecision);\n // return (Math.round(val0 * multiplier) + Math.round(val1 * multiplier)) / multiplier;\n\n var sum = val0 + val1; // // PENDING: support more?\n\n return maxPrecision > ROUND_SUPPORTED_PRECISION_MAX ? sum : round(sum, maxPrecision);\n} // Number.MAX_SAFE_INTEGER, ie do not support.\n\nexport var MAX_SAFE_INTEGER = 9007199254740991;\n/**\n * To 0 - 2 * PI, considering negative radian.\n */\n\nexport function remRadian(radian) {\n var pi2 = Math.PI * 2;\n return (radian % pi2 + pi2) % pi2;\n}\n/**\n * @param {type} radian\n * @return {boolean}\n */\n\nexport function isRadianAroundZero(val) {\n return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;\n} // eslint-disable-next-line\n\nvar TIME_REG = /^(?:(\\d{4})(?:[-\\/](\\d{1,2})(?:[-\\/](\\d{1,2})(?:[T ](\\d{1,2})(?::(\\d{1,2})(?::(\\d{1,2})(?:[.,](\\d+))?)?)?(Z|[\\+\\-]\\d\\d:?\\d\\d)?)?)?)?)?$/; // jshint ignore:line\n\n/**\n * @param value valid type: number | string | Date, otherwise return `new Date(NaN)`\n * These values can be accepted:\n * + An instance of Date, represent a time in its own time zone.\n * + Or string in a subset of ISO 8601, only including:\n * + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06',\n * + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123',\n * + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00',\n * all of which will be treated as local time if time zone is not specified\n * (see ).\n * + Or other string format, including (all of which will be treated as loacal time):\n * '2012', '2012-3-1', '2012/3/1', '2012/03/01',\n * '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123'\n * + a timestamp, which represent a time in UTC.\n * @return date Never be null/undefined. If invalid, return `new Date(NaN)`.\n */\n\nexport function parseDate(value) {\n if (value instanceof Date) {\n return value;\n } else if (typeof value === 'string') {\n // Different browsers parse date in different way, so we parse it manually.\n // Some other issues:\n // new Date('1970-01-01') is UTC,\n // new Date('1970/01/01') and new Date('1970-1-01') is local.\n // See issue #3623\n var match = TIME_REG.exec(value);\n\n if (!match) {\n // return Invalid Date.\n return new Date(NaN);\n } // Use local time when no timezone offset specifed.\n\n\n if (!match[8]) {\n // match[n] can only be string or undefined.\n // But take care of '12' + 1 => '121'.\n return new Date(+match[1], +(match[2] || 1) - 1, +match[3] || 1, +match[4] || 0, +(match[5] || 0), +match[6] || 0, +match[7] || 0);\n } // Timezoneoffset of Javascript Date has considered DST (Daylight Saving Time,\n // https://tc39.github.io/ecma262/#sec-daylight-saving-time-adjustment).\n // For example, system timezone is set as \"Time Zone: America/Toronto\",\n // then these code will get different result:\n // `new Date(1478411999999).getTimezoneOffset(); // get 240`\n // `new Date(1478412000000).getTimezoneOffset(); // get 300`\n // So we should not use `new Date`, but use `Date.UTC`.\n else {\n var hour = +match[4] || 0;\n\n if (match[8].toUpperCase() !== 'Z') {\n hour -= +match[8].slice(0, 3);\n }\n\n return new Date(Date.UTC(+match[1], +(match[2] || 1) - 1, +match[3] || 1, hour, +(match[5] || 0), +match[6] || 0, +match[7] || 0));\n }\n } else if (value == null) {\n return new Date(NaN);\n }\n\n return new Date(Math.round(value));\n}\n/**\n * Quantity of a number. e.g. 0.1, 1, 10, 100\n *\n * @param val\n * @return\n */\n\nexport function quantity(val) {\n return Math.pow(10, quantityExponent(val));\n}\n/**\n * Exponent of the quantity of a number\n * e.g., 1234 equals to 1.234*10^3, so quantityExponent(1234) is 3\n *\n * @param val non-negative value\n * @return\n */\n\nexport function quantityExponent(val) {\n if (val === 0) {\n return 0;\n }\n\n var exp = Math.floor(Math.log(val) / Math.LN10);\n /**\n * exp is expected to be the rounded-down result of the base-10 log of val.\n * But due to the precision loss with Math.log(val), we need to restore it\n * using 10^exp to make sure we can get val back from exp. #11249\n */\n\n if (val / Math.pow(10, exp) >= 10) {\n exp++;\n }\n\n return exp;\n}\n/**\n * find a “nice” number approximately equal to x. Round the number if round = true,\n * take ceiling if round = false. The primary observation is that the “nicest”\n * numbers in decimal are 1, 2, and 5, and all power-of-ten multiples of these numbers.\n *\n * See \"Nice Numbers for Graph Labels\" of Graphic Gems.\n *\n * @param val Non-negative value.\n * @param round\n * @return Niced number\n */\n\nexport function nice(val, round) {\n var exponent = quantityExponent(val);\n var exp10 = Math.pow(10, exponent);\n var f = val / exp10; // 1 <= f < 10\n\n var nf;\n\n if (round) {\n if (f < 1.5) {\n nf = 1;\n } else if (f < 2.5) {\n nf = 2;\n } else if (f < 4) {\n nf = 3;\n } else if (f < 7) {\n nf = 5;\n } else {\n nf = 10;\n }\n } else {\n if (f < 1) {\n nf = 1;\n } else if (f < 2) {\n nf = 2;\n } else if (f < 3) {\n nf = 3;\n } else if (f < 5) {\n nf = 5;\n } else {\n nf = 10;\n }\n }\n\n val = nf * exp10; // Fix 3 * 0.1 === 0.30000000000000004 issue (see IEEE 754).\n // 20 is the uppper bound of toFixed.\n\n return exponent >= -20 ? +val.toFixed(exponent < 0 ? -exponent : 0) : val;\n}\n/**\n * This code was copied from \"d3.js\"\n * .\n * See the license statement at the head of this file.\n * @param ascArr\n */\n\nexport function quantile(ascArr, p) {\n var H = (ascArr.length - 1) * p + 1;\n var h = Math.floor(H);\n var v = +ascArr[h - 1];\n var e = H - h;\n return e ? v + e * (ascArr[h] - v) : v;\n}\n/**\n * Order intervals asc, and split them when overlap.\n * expect(numberUtil.reformIntervals([\n * {interval: [18, 62], close: [1, 1]},\n * {interval: [-Infinity, -70], close: [0, 0]},\n * {interval: [-70, -26], close: [1, 1]},\n * {interval: [-26, 18], close: [1, 1]},\n * {interval: [62, 150], close: [1, 1]},\n * {interval: [106, 150], close: [1, 1]},\n * {interval: [150, Infinity], close: [0, 0]}\n * ])).toEqual([\n * {interval: [-Infinity, -70], close: [0, 0]},\n * {interval: [-70, -26], close: [1, 1]},\n * {interval: [-26, 18], close: [0, 1]},\n * {interval: [18, 62], close: [0, 1]},\n * {interval: [62, 150], close: [0, 1]},\n * {interval: [150, Infinity], close: [0, 0]}\n * ]);\n * @param list, where `close` mean open or close\n * of the interval, and Infinity can be used.\n * @return The origin list, which has been reformed.\n */\n\nexport function reformIntervals(list) {\n list.sort(function (a, b) {\n return littleThan(a, b, 0) ? -1 : 1;\n });\n var curr = -Infinity;\n var currClose = 1;\n\n for (var i = 0; i < list.length;) {\n var interval = list[i].interval;\n var close_1 = list[i].close;\n\n for (var lg = 0; lg < 2; lg++) {\n if (interval[lg] <= curr) {\n interval[lg] = curr;\n close_1[lg] = !lg ? 1 - currClose : 1;\n }\n\n curr = interval[lg];\n currClose = close_1[lg];\n }\n\n if (interval[0] === interval[1] && close_1[0] * close_1[1] !== 1) {\n list.splice(i, 1);\n } else {\n i++;\n }\n }\n\n return list;\n\n function littleThan(a, b, lg) {\n return a.interval[lg] < b.interval[lg] || a.interval[lg] === b.interval[lg] && (a.close[lg] - b.close[lg] === (!lg ? 1 : -1) || !lg && littleThan(a, b, 1));\n }\n}\n/**\n * [Numberic is defined as]:\n * `parseFloat(val) == val`\n * For example:\n * numeric:\n * typeof number except NaN, '-123', '123', '2e3', '-2e3', '011', 'Infinity', Infinity,\n * and they rounded by white-spaces or line-terminal like ' -123 \\n ' (see es spec)\n * not-numeric:\n * null, undefined, [], {}, true, false, 'NaN', NaN, '123ab',\n * empty string, string with only white-spaces or line-terminal (see es spec),\n * 0x12, '0x12', '-0x12', 012, '012', '-012',\n * non-string, ...\n *\n * @test See full test cases in `test/ut/spec/util/number.js`.\n * @return Must be a typeof number. If not numeric, return NaN.\n */\n\nexport function numericToNumber(val) {\n var valFloat = parseFloat(val);\n return valFloat == val // eslint-disable-line eqeqeq\n && (valFloat !== 0 || typeof val !== 'string' || val.indexOf('x') <= 0) // For case ' 0x0 '.\n ? valFloat : NaN;\n}\n/**\n * Definition of \"numeric\": see `numericToNumber`.\n */\n\nexport function isNumeric(val) {\n return !isNaN(numericToNumber(val));\n}\n/**\n * Use random base to prevent users hard code depending on\n * this auto generated marker id.\n * @return An positive integer.\n */\n\nexport function getRandomIdBase() {\n return Math.round(Math.random() * 9);\n}\n/**\n * Get the greatest common dividor\n *\n * @param {number} a one number\n * @param {number} b the other number\n */\n\nexport function getGreatestCommonDividor(a, b) {\n if (b === 0) {\n return a;\n }\n\n return getGreatestCommonDividor(b, a % b);\n}\n/**\n * Get the least common multiple\n *\n * @param {number} a one number\n * @param {number} b the other number\n */\n\nexport function getLeastCommonMultiple(a, b) {\n if (a == null) {\n return b;\n }\n\n if (b == null) {\n return a;\n }\n\n return a * b / getGreatestCommonDividor(a, b);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { map, isString, isFunction, eqNaN, isRegExp } from 'zrender/lib/core/util';\nvar ECHARTS_PREFIX = '[ECharts] ';\nvar storedLogs = {};\nvar hasConsole = typeof console !== 'undefined' // eslint-disable-next-line\n&& console.warn && console.log;\nexport function log(str) {\n if (hasConsole) {\n // eslint-disable-next-line\n console.log(ECHARTS_PREFIX + str);\n }\n}\nexport function warn(str) {\n if (hasConsole) {\n console.warn(ECHARTS_PREFIX + str);\n }\n}\nexport function error(str) {\n if (hasConsole) {\n console.error(ECHARTS_PREFIX + str);\n }\n}\nexport function deprecateLog(str) {\n if (process.env.NODE_ENV !== 'production') {\n if (storedLogs[str]) {\n // Not display duplicate message.\n return;\n }\n\n if (hasConsole) {\n storedLogs[str] = true;\n console.warn(ECHARTS_PREFIX + 'DEPRECATED: ' + str);\n }\n }\n}\nexport function deprecateReplaceLog(oldOpt, newOpt, scope) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateLog((scope ? \"[\" + scope + \"]\" : '') + (oldOpt + \" is deprecated, use \" + newOpt + \" instead.\"));\n }\n}\nexport function consoleLog() {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n if (process.env.NODE_ENV !== 'production') {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && console.log) {\n console.log.apply(console, args);\n }\n /* eslint-enable no-console */\n\n }\n}\n/**\n * If in __DEV__ environment, get console printable message for users hint.\n * Parameters are separated by ' '.\n * @usuage\n * makePrintable('This is an error on', someVar, someObj);\n *\n * @param hintInfo anything about the current execution context to hint users.\n * @throws Error\n */\n\nexport function makePrintable() {\n var hintInfo = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n hintInfo[_i] = arguments[_i];\n }\n\n var msg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n // Fuzzy stringify for print.\n // This code only exist in dev environment.\n var makePrintableStringIfPossible_1 = function (val) {\n return val === void 0 ? 'undefined' : val === Infinity ? 'Infinity' : val === -Infinity ? '-Infinity' : eqNaN(val) ? 'NaN' : val instanceof Date ? 'Date(' + val.toISOString() + ')' : isFunction(val) ? 'function () { ... }' : isRegExp(val) ? val + '' : null;\n };\n\n msg = map(hintInfo, function (arg) {\n if (isString(arg)) {\n // Print without quotation mark for some statement.\n return arg;\n } else {\n var printableStr = makePrintableStringIfPossible_1(arg);\n\n if (printableStr != null) {\n return printableStr;\n } else if (typeof JSON !== 'undefined' && JSON.stringify) {\n try {\n return JSON.stringify(arg, function (n, val) {\n var printableStr = makePrintableStringIfPossible_1(val);\n return printableStr == null ? val : printableStr;\n }); // In most cases the info object is small, so do not line break.\n } catch (err) {\n return '?';\n }\n } else {\n return '?';\n }\n }\n }).join(' ');\n }\n\n return msg;\n}\n/**\n * @throws Error\n */\n\nexport function throwError(msg) {\n throw new Error(msg);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { each, isObject, isArray, createHashMap, map, assert, isString, indexOf, isStringSafe } from 'zrender/lib/core/util';\nimport env from 'zrender/lib/core/env';\nimport { isNumeric, getRandomIdBase, getPrecision, round } from './number';\nimport { interpolateNumber } from 'zrender/lib/animation/Animator';\nimport { warn } from './log';\n/**\n * Make the name displayable. But we should\n * make sure it is not duplicated with user\n * specified name, so use '\\0';\n */\n\nvar DUMMY_COMPONENT_NAME_PREFIX = 'series\\0';\nvar INTERNAL_COMPONENT_ID_PREFIX = '\\0_ec_\\0';\n/**\n * If value is not array, then translate it to array.\n * @param {*} value\n * @return {Array} [value] or value\n */\n\nexport function normalizeToArray(value) {\n return value instanceof Array ? value : value == null ? [] : [value];\n}\n/**\n * Sync default option between normal and emphasis like `position` and `show`\n * In case some one will write code like\n * label: {\n * show: false,\n * position: 'outside',\n * fontSize: 18\n * },\n * emphasis: {\n * label: { show: true }\n * }\n */\n\nexport function defaultEmphasis(opt, key, subOpts) {\n // Caution: performance sensitive.\n if (opt) {\n opt[key] = opt[key] || {};\n opt.emphasis = opt.emphasis || {};\n opt.emphasis[key] = opt.emphasis[key] || {}; // Default emphasis option from normal\n\n for (var i = 0, len = subOpts.length; i < len; i++) {\n var subOptName = subOpts[i];\n\n if (!opt.emphasis[key].hasOwnProperty(subOptName) && opt[key].hasOwnProperty(subOptName)) {\n opt.emphasis[key][subOptName] = opt[key][subOptName];\n }\n }\n }\n}\nexport var TEXT_STYLE_OPTIONS = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'rich', 'tag', 'color', 'textBorderColor', 'textBorderWidth', 'width', 'height', 'lineHeight', 'align', 'verticalAlign', 'baseline', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY', 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY', 'backgroundColor', 'borderColor', 'borderWidth', 'borderRadius', 'padding']; // modelUtil.LABEL_OPTIONS = modelUtil.TEXT_STYLE_OPTIONS.concat([\n// 'position', 'offset', 'rotate', 'origin', 'show', 'distance', 'formatter',\n// 'fontStyle', 'fontWeight', 'fontSize', 'fontFamily',\n// // FIXME: deprecated, check and remove it.\n// 'textStyle'\n// ]);\n\n/**\n * The method do not ensure performance.\n * data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]\n * This helper method retieves value from data.\n */\n\nexport function getDataItemValue(dataItem) {\n return isObject(dataItem) && !isArray(dataItem) && !(dataItem instanceof Date) ? dataItem.value : dataItem;\n}\n/**\n * data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]\n * This helper method determine if dataItem has extra option besides value\n */\n\nexport function isDataItemOption(dataItem) {\n return isObject(dataItem) && !(dataItem instanceof Array); // // markLine data can be array\n // && !(dataItem[0] && isObject(dataItem[0]) && !(dataItem[0] instanceof Array));\n}\n;\n/**\n * Mapping to existings for merge.\n *\n * Mode \"normalMege\":\n * The mapping result (merge result) will keep the order of the existing\n * component, rather than the order of new option. Because we should ensure\n * some specified index reference (like xAxisIndex) keep work.\n * And in most cases, \"merge option\" is used to update partial option but not\n * be expected to change the order.\n *\n * Mode \"replaceMege\":\n * (1) Only the id mapped components will be merged.\n * (2) Other existing components (except internal compoonets) will be removed.\n * (3) Other new options will be used to create new component.\n * (4) The index of the existing compoents will not be modified.\n * That means their might be \"hole\" after the removal.\n * The new components are created first at those available index.\n *\n * Mode \"replaceAll\":\n * This mode try to support that reproduce an echarts instance from another\n * echarts instance (via `getOption`) in some simple cases.\n * In this senario, the `result` index are exactly the consistent with the `newCmptOptions`,\n * which ensures the compoennt index referring (like `xAxisIndex: ?`) corrent. That is,\n * the \"hole\" in `newCmptOptions` will also be kept.\n * On the contrary, other modes try best to eliminate holes.\n * PENDING: This is an experimental mode yet.\n *\n * @return See the comment of .\n */\n\nexport function mappingToExists(existings, newCmptOptions, mode) {\n var isNormalMergeMode = mode === 'normalMerge';\n var isReplaceMergeMode = mode === 'replaceMerge';\n var isReplaceAllMode = mode === 'replaceAll';\n existings = existings || [];\n newCmptOptions = (newCmptOptions || []).slice();\n var existingIdIdxMap = createHashMap(); // Validate id and name on user input option.\n\n each(newCmptOptions, function (cmptOption, index) {\n if (!isObject(cmptOption)) {\n newCmptOptions[index] = null;\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // There is some legacy case that name is set as `false`.\n // But should work normally rather than throw error.\n if (cmptOption.id != null && !isValidIdOrName(cmptOption.id)) {\n warnInvalidateIdOrName(cmptOption.id);\n }\n\n if (cmptOption.name != null && !isValidIdOrName(cmptOption.name)) {\n warnInvalidateIdOrName(cmptOption.name);\n }\n }\n });\n var result = prepareResult(existings, existingIdIdxMap, mode);\n\n if (isNormalMergeMode || isReplaceMergeMode) {\n mappingById(result, existings, existingIdIdxMap, newCmptOptions);\n }\n\n if (isNormalMergeMode) {\n mappingByName(result, newCmptOptions);\n }\n\n if (isNormalMergeMode || isReplaceMergeMode) {\n mappingByIndex(result, newCmptOptions, isReplaceMergeMode);\n } else if (isReplaceAllMode) {\n mappingInReplaceAllMode(result, newCmptOptions);\n }\n\n makeIdAndName(result); // The array `result` MUST NOT contain elided items, otherwise the\n // forEach will ommit those items and result in incorrect result.\n\n return result;\n}\n\nfunction prepareResult(existings, existingIdIdxMap, mode) {\n var result = [];\n\n if (mode === 'replaceAll') {\n return result;\n } // Do not use native `map` to in case that the array `existings`\n // contains elided items, which will be ommited.\n\n\n for (var index = 0; index < existings.length; index++) {\n var existing = existings[index]; // Because of replaceMerge, `existing` may be null/undefined.\n\n if (existing && existing.id != null) {\n existingIdIdxMap.set(existing.id, index);\n } // For non-internal-componnets:\n // Mode \"normalMerge\": all existings kept.\n // Mode \"replaceMerge\": all existing removed unless mapped by id.\n // For internal-components:\n // go with \"replaceMerge\" approach in both mode.\n\n\n result.push({\n existing: mode === 'replaceMerge' || isComponentIdInternal(existing) ? null : existing,\n newOption: null,\n keyInfo: null,\n brandNew: null\n });\n }\n\n return result;\n}\n\nfunction mappingById(result, existings, existingIdIdxMap, newCmptOptions) {\n // Mapping by id if specified.\n each(newCmptOptions, function (cmptOption, index) {\n if (!cmptOption || cmptOption.id == null) {\n return;\n }\n\n var optionId = makeComparableKey(cmptOption.id);\n var existingIdx = existingIdIdxMap.get(optionId);\n\n if (existingIdx != null) {\n var resultItem = result[existingIdx];\n assert(!resultItem.newOption, 'Duplicated option on id \"' + optionId + '\".');\n resultItem.newOption = cmptOption; // In both mode, if id matched, new option will be merged to\n // the existings rather than creating new component model.\n\n resultItem.existing = existings[existingIdx];\n newCmptOptions[index] = null;\n }\n });\n}\n\nfunction mappingByName(result, newCmptOptions) {\n // Mapping by name if specified.\n each(newCmptOptions, function (cmptOption, index) {\n if (!cmptOption || cmptOption.name == null) {\n return;\n }\n\n for (var i = 0; i < result.length; i++) {\n var existing = result[i].existing;\n\n if (!result[i].newOption // Consider name: two map to one.\n // Can not match when both ids existing but different.\n && existing && (existing.id == null || cmptOption.id == null) && !isComponentIdInternal(cmptOption) && !isComponentIdInternal(existing) && keyExistAndEqual('name', existing, cmptOption)) {\n result[i].newOption = cmptOption;\n newCmptOptions[index] = null;\n return;\n }\n }\n });\n}\n\nfunction mappingByIndex(result, newCmptOptions, brandNew) {\n each(newCmptOptions, function (cmptOption) {\n if (!cmptOption) {\n return;\n } // Find the first place that not mapped by id and not internal component (consider the \"hole\").\n\n\n var resultItem;\n var nextIdx = 0;\n\n while ( // Be `!resultItem` only when `nextIdx >= result.length`.\n (resultItem = result[nextIdx]) && ( // (1) Existing models that already have id should be able to mapped to. Because\n // after mapping performed, model will always be assigned with an id if user not given.\n // After that all models have id.\n // (2) If new option has id, it can only set to a hole or append to the last. It should\n // not be merged to the existings with different id. Because id should not be overwritten.\n // (3) Name can be overwritten, because axis use name as 'show label text'.\n resultItem.newOption || isComponentIdInternal(resultItem.existing) || // In mode \"replaceMerge\", here no not-mapped-non-internal-existing.\n resultItem.existing && cmptOption.id != null && !keyExistAndEqual('id', cmptOption, resultItem.existing))) {\n nextIdx++;\n }\n\n if (resultItem) {\n resultItem.newOption = cmptOption;\n resultItem.brandNew = brandNew;\n } else {\n result.push({\n newOption: cmptOption,\n brandNew: brandNew,\n existing: null,\n keyInfo: null\n });\n }\n\n nextIdx++;\n });\n}\n\nfunction mappingInReplaceAllMode(result, newCmptOptions) {\n each(newCmptOptions, function (cmptOption) {\n // The feature \"reproduce\" requires \"hole\" will also reproduced\n // in case that compoennt index referring are broken.\n result.push({\n newOption: cmptOption,\n brandNew: true,\n existing: null,\n keyInfo: null\n });\n });\n}\n/**\n * Make id and name for mapping result (result of mappingToExists)\n * into `keyInfo` field.\n */\n\n\nfunction makeIdAndName(mapResult) {\n // We use this id to hash component models and view instances\n // in echarts. id can be specified by user, or auto generated.\n // The id generation rule ensures new view instance are able\n // to mapped to old instance when setOption are called in\n // no-merge mode. So we generate model id by name and plus\n // type in view id.\n // name can be duplicated among components, which is convenient\n // to specify multi components (like series) by one name.\n // Ensure that each id is distinct.\n var idMap = createHashMap();\n each(mapResult, function (item) {\n var existing = item.existing;\n existing && idMap.set(existing.id, item);\n });\n each(mapResult, function (item) {\n var opt = item.newOption; // Force ensure id not duplicated.\n\n assert(!opt || opt.id == null || !idMap.get(opt.id) || idMap.get(opt.id) === item, 'id duplicates: ' + (opt && opt.id));\n opt && opt.id != null && idMap.set(opt.id, item);\n !item.keyInfo && (item.keyInfo = {});\n }); // Make name and id.\n\n each(mapResult, function (item, index) {\n var existing = item.existing;\n var opt = item.newOption;\n var keyInfo = item.keyInfo;\n\n if (!isObject(opt)) {\n return;\n } // name can be overwitten. Consider case: axis.name = '20km'.\n // But id generated by name will not be changed, which affect\n // only in that case: setOption with 'not merge mode' and view\n // instance will be recreated, which can be accepted.\n\n\n keyInfo.name = opt.name != null ? makeComparableKey(opt.name) : existing ? existing.name // Avoid diffferent series has the same name,\n // because name may be used like in color pallet.\n : DUMMY_COMPONENT_NAME_PREFIX + index;\n\n if (existing) {\n keyInfo.id = makeComparableKey(existing.id);\n } else if (opt.id != null) {\n keyInfo.id = makeComparableKey(opt.id);\n } else {\n // Consider this situatoin:\n // optionA: [{name: 'a'}, {name: 'a'}, {..}]\n // optionB [{..}, {name: 'a'}, {name: 'a'}]\n // Series with the same name between optionA and optionB\n // should be mapped.\n var idNum = 0;\n\n do {\n keyInfo.id = '\\0' + keyInfo.name + '\\0' + idNum++;\n } while (idMap.get(keyInfo.id));\n }\n\n idMap.set(keyInfo.id, item);\n });\n}\n\nfunction keyExistAndEqual(attr, obj1, obj2) {\n var key1 = convertOptionIdName(obj1[attr], null);\n var key2 = convertOptionIdName(obj2[attr], null); // See `MappingExistingItem`. `id` and `name` trade string equals to number.\n\n return key1 != null && key2 != null && key1 === key2;\n}\n/**\n * @return return null if not exist.\n */\n\n\nfunction makeComparableKey(val) {\n if (process.env.NODE_ENV !== 'production') {\n if (val == null) {\n throw new Error();\n }\n }\n\n return convertOptionIdName(val, '');\n}\n\nexport function convertOptionIdName(idOrName, defaultValue) {\n if (idOrName == null) {\n return defaultValue;\n }\n\n var type = typeof idOrName;\n return type === 'string' ? idOrName : type === 'number' || isStringSafe(idOrName) ? idOrName + '' : defaultValue;\n}\n\nfunction warnInvalidateIdOrName(idOrName) {\n if (process.env.NODE_ENV !== 'production') {\n warn('`' + idOrName + '` is invalid id or name. Must be a string or number.');\n }\n}\n\nfunction isValidIdOrName(idOrName) {\n return isStringSafe(idOrName) || isNumeric(idOrName);\n}\n\nexport function isNameSpecified(componentModel) {\n var name = componentModel.name; // Is specified when `indexOf` get -1 or > 0.\n\n return !!(name && name.indexOf(DUMMY_COMPONENT_NAME_PREFIX));\n}\n/**\n * @public\n * @param {Object} cmptOption\n * @return {boolean}\n */\n\nexport function isComponentIdInternal(cmptOption) {\n return cmptOption && cmptOption.id != null && makeComparableKey(cmptOption.id).indexOf(INTERNAL_COMPONENT_ID_PREFIX) === 0;\n}\nexport function makeInternalComponentId(idSuffix) {\n return INTERNAL_COMPONENT_ID_PREFIX + idSuffix;\n}\nexport function setComponentTypeToKeyInfo(mappingResult, mainType, componentModelCtor) {\n // Set mainType and complete subType.\n each(mappingResult, function (item) {\n var newOption = item.newOption;\n\n if (isObject(newOption)) {\n item.keyInfo.mainType = mainType;\n item.keyInfo.subType = determineSubType(mainType, newOption, item.existing, componentModelCtor);\n }\n });\n}\n\nfunction determineSubType(mainType, newCmptOption, existComponent, componentModelCtor) {\n var subType = newCmptOption.type ? newCmptOption.type : existComponent ? existComponent.subType // Use determineSubType only when there is no existComponent.\n : componentModelCtor.determineSubType(mainType, newCmptOption); // tooltip, markline, markpoint may always has no subType\n\n return subType;\n}\n/**\n * A helper for removing duplicate items between batchA and batchB,\n * and in themselves, and categorize by series.\n *\n * @param batchA Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...]\n * @param batchB Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...]\n * @return result: [resultBatchA, resultBatchB]\n */\n\n\nexport function compressBatches(batchA, batchB) {\n var mapA = {};\n var mapB = {};\n makeMap(batchA || [], mapA);\n makeMap(batchB || [], mapB, mapA);\n return [mapToArray(mapA), mapToArray(mapB)];\n\n function makeMap(sourceBatch, map, otherMap) {\n for (var i = 0, len = sourceBatch.length; i < len; i++) {\n var seriesId = convertOptionIdName(sourceBatch[i].seriesId, null);\n\n if (seriesId == null) {\n return;\n }\n\n var dataIndices = normalizeToArray(sourceBatch[i].dataIndex);\n var otherDataIndices = otherMap && otherMap[seriesId];\n\n for (var j = 0, lenj = dataIndices.length; j < lenj; j++) {\n var dataIndex = dataIndices[j];\n\n if (otherDataIndices && otherDataIndices[dataIndex]) {\n otherDataIndices[dataIndex] = null;\n } else {\n (map[seriesId] || (map[seriesId] = {}))[dataIndex] = 1;\n }\n }\n }\n }\n\n function mapToArray(map, isData) {\n var result = [];\n\n for (var i in map) {\n if (map.hasOwnProperty(i) && map[i] != null) {\n if (isData) {\n result.push(+i);\n } else {\n var dataIndices = mapToArray(map[i], true);\n dataIndices.length && result.push({\n seriesId: i,\n dataIndex: dataIndices\n });\n }\n }\n }\n\n return result;\n }\n}\n/**\n * @param payload Contains dataIndex (means rawIndex) / dataIndexInside / name\n * each of which can be Array or primary type.\n * @return dataIndex If not found, return undefined/null.\n */\n\nexport function queryDataIndex(data, payload) {\n if (payload.dataIndexInside != null) {\n return payload.dataIndexInside;\n } else if (payload.dataIndex != null) {\n return isArray(payload.dataIndex) ? map(payload.dataIndex, function (value) {\n return data.indexOfRawIndex(value);\n }) : data.indexOfRawIndex(payload.dataIndex);\n } else if (payload.name != null) {\n return isArray(payload.name) ? map(payload.name, function (value) {\n return data.indexOfName(value);\n }) : data.indexOfName(payload.name);\n }\n}\n/**\n * Enable property storage to any host object.\n * Notice: Serialization is not supported.\n *\n * For example:\n * let inner = zrUitl.makeInner();\n *\n * function some1(hostObj) {\n * inner(hostObj).someProperty = 1212;\n * ...\n * }\n * function some2() {\n * let fields = inner(this);\n * fields.someProperty1 = 1212;\n * fields.someProperty2 = 'xx';\n * ...\n * }\n *\n * @return {Function}\n */\n\nexport function makeInner() {\n var key = '__ec_inner_' + innerUniqueIndex++;\n return function (hostObj) {\n return hostObj[key] || (hostObj[key] = {});\n };\n}\nvar innerUniqueIndex = getRandomIdBase();\n/**\n * The same behavior as `component.getReferringComponents`.\n */\n\nexport function parseFinder(ecModel, finderInput, opt) {\n var _a = preParseFinder(finderInput, opt),\n mainTypeSpecified = _a.mainTypeSpecified,\n queryOptionMap = _a.queryOptionMap,\n others = _a.others;\n\n var result = others;\n var defaultMainType = opt ? opt.defaultMainType : null;\n\n if (!mainTypeSpecified && defaultMainType) {\n queryOptionMap.set(defaultMainType, {});\n }\n\n queryOptionMap.each(function (queryOption, mainType) {\n var queryResult = queryReferringComponents(ecModel, mainType, queryOption, {\n useDefault: defaultMainType === mainType,\n enableAll: opt && opt.enableAll != null ? opt.enableAll : true,\n enableNone: opt && opt.enableNone != null ? opt.enableNone : true\n });\n result[mainType + 'Models'] = queryResult.models;\n result[mainType + 'Model'] = queryResult.models[0];\n });\n return result;\n}\nexport function preParseFinder(finderInput, opt) {\n var finder;\n\n if (isString(finderInput)) {\n var obj = {};\n obj[finderInput + 'Index'] = 0;\n finder = obj;\n } else {\n finder = finderInput;\n }\n\n var queryOptionMap = createHashMap();\n var others = {};\n var mainTypeSpecified = false;\n each(finder, function (value, key) {\n // Exclude 'dataIndex' and other illgal keys.\n if (key === 'dataIndex' || key === 'dataIndexInside') {\n others[key] = value;\n return;\n }\n\n var parsedKey = key.match(/^(\\w+)(Index|Id|Name)$/) || [];\n var mainType = parsedKey[1];\n var queryType = (parsedKey[2] || '').toLowerCase();\n\n if (!mainType || !queryType || opt && opt.includeMainTypes && indexOf(opt.includeMainTypes, mainType) < 0) {\n return;\n }\n\n mainTypeSpecified = mainTypeSpecified || !!mainType;\n var queryOption = queryOptionMap.get(mainType) || queryOptionMap.set(mainType, {});\n queryOption[queryType] = value;\n });\n return {\n mainTypeSpecified: mainTypeSpecified,\n queryOptionMap: queryOptionMap,\n others: others\n };\n}\nexport var SINGLE_REFERRING = {\n useDefault: true,\n enableAll: false,\n enableNone: false\n};\nexport var MULTIPLE_REFERRING = {\n useDefault: false,\n enableAll: true,\n enableNone: true\n};\nexport function queryReferringComponents(ecModel, mainType, userOption, opt) {\n opt = opt || SINGLE_REFERRING;\n var indexOption = userOption.index;\n var idOption = userOption.id;\n var nameOption = userOption.name;\n var result = {\n models: null,\n specified: indexOption != null || idOption != null || nameOption != null\n };\n\n if (!result.specified) {\n // Use the first as default if `useDefault`.\n var firstCmpt = void 0;\n result.models = opt.useDefault && (firstCmpt = ecModel.getComponent(mainType)) ? [firstCmpt] : [];\n return result;\n }\n\n if (indexOption === 'none' || indexOption === false) {\n assert(opt.enableNone, '`\"none\"` or `false` is not a valid value on index option.');\n result.models = [];\n return result;\n } // `queryComponents` will return all components if\n // both all of index/id/name are null/undefined.\n\n\n if (indexOption === 'all') {\n assert(opt.enableAll, '`\"all\"` is not a valid value on index option.');\n indexOption = idOption = nameOption = null;\n }\n\n result.models = ecModel.queryComponents({\n mainType: mainType,\n index: indexOption,\n id: idOption,\n name: nameOption\n });\n return result;\n}\nexport function setAttribute(dom, key, value) {\n dom.setAttribute ? dom.setAttribute(key, value) : dom[key] = value;\n}\nexport function getAttribute(dom, key) {\n return dom.getAttribute ? dom.getAttribute(key) : dom[key];\n}\nexport function getTooltipRenderMode(renderModeOption) {\n if (renderModeOption === 'auto') {\n // Using html when `document` exists, use richText otherwise\n return env.domSupported ? 'html' : 'richText';\n } else {\n return renderModeOption || 'html';\n }\n}\n/**\n * Group a list by key.\n */\n\nexport function groupData(array, getKey // return key\n) {\n var buckets = createHashMap();\n var keys = [];\n each(array, function (item) {\n var key = getKey(item);\n (buckets.get(key) || (keys.push(key), buckets.set(key, []))).push(item);\n });\n return {\n keys: keys,\n buckets: buckets\n };\n}\n/**\n * Interpolate raw values of a series with percent\n *\n * @param data data\n * @param labelModel label model of the text element\n * @param sourceValue start value. May be null/undefined when init.\n * @param targetValue end value\n * @param percent 0~1 percentage; 0 uses start value while 1 uses end value\n * @return interpolated values\n * If `sourceValue` and `targetValue` are `number`, return `number`.\n * If `sourceValue` and `targetValue` are `string`, return `string`.\n * If `sourceValue` and `targetValue` are `(string | number)[]`, return `(string | number)[]`.\n * Other cases do not supported.\n */\n\nexport function interpolateRawValues(data, precision, sourceValue, targetValue, percent) {\n var isAutoPrecision = precision == null || precision === 'auto';\n\n if (targetValue == null) {\n return targetValue;\n }\n\n if (typeof targetValue === 'number') {\n var value = interpolateNumber(sourceValue || 0, targetValue, percent);\n return round(value, isAutoPrecision ? Math.max(getPrecision(sourceValue || 0), getPrecision(targetValue)) : precision);\n } else if (typeof targetValue === 'string') {\n return percent < 1 ? sourceValue : targetValue;\n } else {\n var interpolated = [];\n var leftArr = sourceValue;\n var rightArr = targetValue;\n var length_1 = Math.max(leftArr ? leftArr.length : 0, rightArr.length);\n\n for (var i = 0; i < length_1; ++i) {\n var info = data.getDimensionInfo(i); // Don't interpolate ordinal dims\n\n if (info.type === 'ordinal') {\n // In init, there is no `sourceValue`, but should better not to get undefined result.\n interpolated[i] = (percent < 1 && leftArr ? leftArr : rightArr)[i];\n } else {\n var leftVal = leftArr && leftArr[i] ? leftArr[i] : 0;\n var rightVal = rightArr[i];\n var value = interpolateNumber(leftVal, rightVal, percent);\n interpolated[i] = round(value, isAutoPrecision ? Math.max(getPrecision(leftVal), getPrecision(rightVal)) : precision);\n }\n }\n\n return interpolated;\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { makeInner } from './model';\nexport var getECData = makeInner();","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport LRU from 'zrender/lib/core/LRU';\nimport { extend, indexOf, isArrayLike, isObject, keys, isArray, each } from 'zrender/lib/core/util';\nimport { getECData } from './innerStore';\nimport * as colorTool from 'zrender/lib/tool/color';\nimport { queryDataIndex, makeInner } from './model';\nimport Path from 'zrender/lib/graphic/Path';\nimport { error } from './log'; // Reserve 0 as default.\n\nvar _highlightNextDigit = 1;\nvar _highlightKeyMap = {};\nvar getSavedStates = makeInner();\nexport var HOVER_STATE_NORMAL = 0;\nexport var HOVER_STATE_BLUR = 1;\nexport var HOVER_STATE_EMPHASIS = 2;\nexport var SPECIAL_STATES = ['emphasis', 'blur', 'select'];\nexport var DISPLAY_STATES = ['normal', 'emphasis', 'blur', 'select'];\nexport var Z2_EMPHASIS_LIFT = 10;\nexport var Z2_SELECT_LIFT = 9;\nexport var HIGHLIGHT_ACTION_TYPE = 'highlight';\nexport var DOWNPLAY_ACTION_TYPE = 'downplay';\nexport var SELECT_ACTION_TYPE = 'select';\nexport var UNSELECT_ACTION_TYPE = 'unselect';\nexport var TOGGLE_SELECT_ACTION_TYPE = 'toggleSelect';\n\nfunction hasFillOrStroke(fillOrStroke) {\n return fillOrStroke != null && fillOrStroke !== 'none';\n} // Most lifted color are duplicated.\n\n\nvar liftedColorCache = new LRU(100);\n\nfunction liftColor(color) {\n if (typeof color !== 'string') {\n return color;\n }\n\n var liftedColor = liftedColorCache.get(color);\n\n if (!liftedColor) {\n liftedColor = colorTool.lift(color, -0.1);\n liftedColorCache.put(color, liftedColor);\n }\n\n return liftedColor;\n}\n\nfunction doChangeHoverState(el, stateName, hoverStateEnum) {\n if (el.onHoverStateChange && (el.hoverState || 0) !== hoverStateEnum) {\n el.onHoverStateChange(stateName);\n }\n\n el.hoverState = hoverStateEnum;\n}\n\nfunction singleEnterEmphasis(el) {\n // Only mark the flag.\n // States will be applied in the echarts.ts in next frame.\n doChangeHoverState(el, 'emphasis', HOVER_STATE_EMPHASIS);\n}\n\nfunction singleLeaveEmphasis(el) {\n // Only mark the flag.\n // States will be applied in the echarts.ts in next frame.\n if (el.hoverState === HOVER_STATE_EMPHASIS) {\n doChangeHoverState(el, 'normal', HOVER_STATE_NORMAL);\n }\n}\n\nfunction singleEnterBlur(el) {\n doChangeHoverState(el, 'blur', HOVER_STATE_BLUR);\n}\n\nfunction singleLeaveBlur(el) {\n if (el.hoverState === HOVER_STATE_BLUR) {\n doChangeHoverState(el, 'normal', HOVER_STATE_NORMAL);\n }\n}\n\nfunction singleEnterSelect(el) {\n el.selected = true;\n}\n\nfunction singleLeaveSelect(el) {\n el.selected = false;\n}\n\nfunction updateElementState(el, updater, commonParam) {\n updater(el, commonParam);\n}\n\nfunction traverseUpdateState(el, updater, commonParam) {\n updateElementState(el, updater, commonParam);\n el.isGroup && el.traverse(function (child) {\n updateElementState(child, updater, commonParam);\n });\n}\n\nexport function setStatesFlag(el, stateName) {\n switch (stateName) {\n case 'emphasis':\n el.hoverState = HOVER_STATE_EMPHASIS;\n break;\n\n case 'normal':\n el.hoverState = HOVER_STATE_NORMAL;\n break;\n\n case 'blur':\n el.hoverState = HOVER_STATE_BLUR;\n break;\n\n case 'select':\n el.selected = true;\n }\n}\n/**\n * If we reuse elements when rerender.\n * DONT forget to clearStates before we update the style and shape.\n * Or we may update on the wrong state instead of normal state.\n */\n\nexport function clearStates(el) {\n if (el.isGroup) {\n el.traverse(function (child) {\n child.clearStates();\n });\n } else {\n el.clearStates();\n }\n}\n\nfunction getFromStateStyle(el, props, toStateName, defaultValue) {\n var style = el.style;\n var fromState = {};\n\n for (var i = 0; i < props.length; i++) {\n var propName = props[i];\n var val = style[propName];\n fromState[propName] = val == null ? defaultValue && defaultValue[propName] : val;\n }\n\n for (var i = 0; i < el.animators.length; i++) {\n var animator = el.animators[i];\n\n if (animator.__fromStateTransition // Dont consider the animation to emphasis state.\n && animator.__fromStateTransition.indexOf(toStateName) < 0 && animator.targetName === 'style') {\n animator.saveFinalToTarget(fromState, props);\n }\n }\n\n return fromState;\n}\n\nfunction createEmphasisDefaultState(el, stateName, targetStates, state) {\n var hasSelect = targetStates && indexOf(targetStates, 'select') >= 0;\n var cloned = false;\n\n if (el instanceof Path) {\n var store = getSavedStates(el);\n var fromFill = hasSelect ? store.selectFill || store.normalFill : store.normalFill;\n var fromStroke = hasSelect ? store.selectStroke || store.normalStroke : store.normalStroke;\n\n if (hasFillOrStroke(fromFill) || hasFillOrStroke(fromStroke)) {\n state = state || {}; // Apply default color lift\n\n var emphasisStyle = state.style || {};\n\n if (!hasFillOrStroke(emphasisStyle.fill) && hasFillOrStroke(fromFill)) {\n cloned = true; // Not modify the original value.\n\n state = extend({}, state);\n emphasisStyle = extend({}, emphasisStyle); // Already being applied 'emphasis'. DON'T lift color multiple times.\n\n emphasisStyle.fill = liftColor(fromFill);\n } // Not highlight stroke if fill has been highlighted.\n else if (!hasFillOrStroke(emphasisStyle.stroke) && hasFillOrStroke(fromStroke)) {\n if (!cloned) {\n state = extend({}, state);\n emphasisStyle = extend({}, emphasisStyle);\n }\n\n emphasisStyle.stroke = liftColor(fromStroke);\n }\n\n state.style = emphasisStyle;\n }\n }\n\n if (state) {\n // TODO Share with textContent?\n if (state.z2 == null) {\n if (!cloned) {\n state = extend({}, state);\n }\n\n var z2EmphasisLift = el.z2EmphasisLift;\n state.z2 = el.z2 + (z2EmphasisLift != null ? z2EmphasisLift : Z2_EMPHASIS_LIFT);\n }\n }\n\n return state;\n}\n\nfunction createSelectDefaultState(el, stateName, state) {\n // const hasSelect = indexOf(el.currentStates, stateName) >= 0;\n if (state) {\n // TODO Share with textContent?\n if (state.z2 == null) {\n state = extend({}, state);\n var z2SelectLift = el.z2SelectLift;\n state.z2 = el.z2 + (z2SelectLift != null ? z2SelectLift : Z2_SELECT_LIFT);\n }\n }\n\n return state;\n}\n\nfunction createBlurDefaultState(el, stateName, state) {\n var hasBlur = indexOf(el.currentStates, stateName) >= 0;\n var currentOpacity = el.style.opacity;\n var fromState = !hasBlur ? getFromStateStyle(el, ['opacity'], stateName, {\n opacity: 1\n }) : null;\n state = state || {};\n var blurStyle = state.style || {};\n\n if (blurStyle.opacity == null) {\n // clone state\n state = extend({}, state);\n blurStyle = extend({\n // Already being applied 'emphasis'. DON'T mul opacity multiple times.\n opacity: hasBlur ? currentOpacity : fromState.opacity * 0.1\n }, blurStyle);\n state.style = blurStyle;\n }\n\n return state;\n}\n\nfunction elementStateProxy(stateName, targetStates) {\n var state = this.states[stateName];\n\n if (this.style) {\n if (stateName === 'emphasis') {\n return createEmphasisDefaultState(this, stateName, targetStates, state);\n } else if (stateName === 'blur') {\n return createBlurDefaultState(this, stateName, state);\n } else if (stateName === 'select') {\n return createSelectDefaultState(this, stateName, state);\n }\n }\n\n return state;\n}\n/**FI\n * Set hover style (namely \"emphasis style\") of element.\n * @param el Should not be `zrender/graphic/Group`.\n * @param focus 'self' | 'selfInSeries' | 'series'\n */\n\n\nexport function setDefaultStateProxy(el) {\n el.stateProxy = elementStateProxy;\n var textContent = el.getTextContent();\n var textGuide = el.getTextGuideLine();\n\n if (textContent) {\n textContent.stateProxy = elementStateProxy;\n }\n\n if (textGuide) {\n textGuide.stateProxy = elementStateProxy;\n }\n}\nexport function enterEmphasisWhenMouseOver(el, e) {\n !shouldSilent(el, e) // \"emphasis\" event highlight has higher priority than mouse highlight.\n && !el.__highByOuter && traverseUpdateState(el, singleEnterEmphasis);\n}\nexport function leaveEmphasisWhenMouseOut(el, e) {\n !shouldSilent(el, e) // \"emphasis\" event highlight has higher priority than mouse highlight.\n && !el.__highByOuter && traverseUpdateState(el, singleLeaveEmphasis);\n}\nexport function enterEmphasis(el, highlightDigit) {\n el.__highByOuter |= 1 << (highlightDigit || 0);\n traverseUpdateState(el, singleEnterEmphasis);\n}\nexport function leaveEmphasis(el, highlightDigit) {\n !(el.__highByOuter &= ~(1 << (highlightDigit || 0))) && traverseUpdateState(el, singleLeaveEmphasis);\n}\nexport function enterBlur(el) {\n traverseUpdateState(el, singleEnterBlur);\n}\nexport function leaveBlur(el) {\n traverseUpdateState(el, singleLeaveBlur);\n}\nexport function enterSelect(el) {\n traverseUpdateState(el, singleEnterSelect);\n}\nexport function leaveSelect(el) {\n traverseUpdateState(el, singleLeaveSelect);\n}\n\nfunction shouldSilent(el, e) {\n return el.__highDownSilentOnTouch && e.zrByTouch;\n}\n\nexport function allLeaveBlur(api) {\n var model = api.getModel();\n model.eachComponent(function (componentType, componentModel) {\n var view = componentType === 'series' ? api.getViewOfSeriesModel(componentModel) : api.getViewOfComponentModel(componentModel); // Leave blur anyway\n\n view.group.traverse(function (child) {\n singleLeaveBlur(child);\n });\n });\n}\nexport function blurSeries(targetSeriesIndex, focus, blurScope, api) {\n var ecModel = api.getModel();\n blurScope = blurScope || 'coordinateSystem';\n\n function leaveBlurOfIndices(data, dataIndices) {\n for (var i = 0; i < dataIndices.length; i++) {\n var itemEl = data.getItemGraphicEl(dataIndices[i]);\n itemEl && leaveBlur(itemEl);\n }\n }\n\n if (targetSeriesIndex == null) {\n return;\n }\n\n if (!focus || focus === 'none') {\n return;\n }\n\n var targetSeriesModel = ecModel.getSeriesByIndex(targetSeriesIndex);\n var targetCoordSys = targetSeriesModel.coordinateSystem;\n\n if (targetCoordSys && targetCoordSys.master) {\n targetCoordSys = targetCoordSys.master;\n }\n\n var blurredSeries = [];\n ecModel.eachSeries(function (seriesModel) {\n var sameSeries = targetSeriesModel === seriesModel;\n var coordSys = seriesModel.coordinateSystem;\n\n if (coordSys && coordSys.master) {\n coordSys = coordSys.master;\n }\n\n var sameCoordSys = coordSys && targetCoordSys ? coordSys === targetCoordSys : sameSeries; // If there is no coordinate system. use sameSeries instead.\n\n if (!( // Not blur other series if blurScope series\n blurScope === 'series' && !sameSeries // Not blur other coordinate system if blurScope is coordinateSystem\n || blurScope === 'coordinateSystem' && !sameCoordSys // Not blur self series if focus is series.\n || focus === 'series' && sameSeries // TODO blurScope: coordinate system\n )) {\n var view = api.getViewOfSeriesModel(seriesModel);\n view.group.traverse(function (child) {\n singleEnterBlur(child);\n });\n\n if (isArrayLike(focus)) {\n leaveBlurOfIndices(seriesModel.getData(), focus);\n } else if (isObject(focus)) {\n var dataTypes = keys(focus);\n\n for (var d = 0; d < dataTypes.length; d++) {\n leaveBlurOfIndices(seriesModel.getData(dataTypes[d]), focus[dataTypes[d]]);\n }\n }\n\n blurredSeries.push(seriesModel);\n }\n });\n ecModel.eachComponent(function (componentType, componentModel) {\n if (componentType === 'series') {\n return;\n }\n\n var view = api.getViewOfComponentModel(componentModel);\n\n if (view && view.blurSeries) {\n view.blurSeries(blurredSeries, ecModel);\n }\n });\n}\nexport function blurComponent(componentMainType, componentIndex, api) {\n if (componentMainType == null || componentIndex == null) {\n return;\n }\n\n var componentModel = api.getModel().getComponent(componentMainType, componentIndex);\n\n if (!componentModel) {\n return;\n }\n\n var view = api.getViewOfComponentModel(componentModel);\n\n if (!view || !view.focusBlurEnabled) {\n return;\n }\n\n view.group.traverse(function (child) {\n singleEnterBlur(child);\n });\n}\nexport function blurSeriesFromHighlightPayload(seriesModel, payload, api) {\n var seriesIndex = seriesModel.seriesIndex;\n var data = seriesModel.getData(payload.dataType);\n var dataIndex = queryDataIndex(data, payload); // Pick the first one if there is multiple/none exists.\n\n dataIndex = (isArray(dataIndex) ? dataIndex[0] : dataIndex) || 0;\n var el = data.getItemGraphicEl(dataIndex);\n\n if (!el) {\n var count = data.count();\n var current = 0; // If data on dataIndex is NaN.\n\n while (!el && current < count) {\n el = data.getItemGraphicEl(current++);\n }\n }\n\n if (el) {\n var ecData = getECData(el);\n blurSeries(seriesIndex, ecData.focus, ecData.blurScope, api);\n } else {\n // If there is no element put on the data. Try getting it from raw option\n // TODO Should put it on seriesModel?\n var focus_1 = seriesModel.get(['emphasis', 'focus']);\n var blurScope = seriesModel.get(['emphasis', 'blurScope']);\n\n if (focus_1 != null) {\n blurSeries(seriesIndex, focus_1, blurScope, api);\n }\n }\n}\nexport function findComponentHighDownDispatchers(componentMainType, componentIndex, name, api) {\n var ret = {\n focusSelf: false,\n dispatchers: null\n };\n\n if (componentMainType == null || componentMainType === 'series' || componentIndex == null || name == null) {\n return ret;\n }\n\n var componentModel = api.getModel().getComponent(componentMainType, componentIndex);\n\n if (!componentModel) {\n return ret;\n }\n\n var view = api.getViewOfComponentModel(componentModel);\n\n if (!view || !view.findHighDownDispatchers) {\n return ret;\n }\n\n var dispatchers = view.findHighDownDispatchers(name); // At presnet, the component (like Geo) only blur inside itself.\n // So we do not use `blurScope` in component.\n\n var focusSelf;\n\n for (var i = 0; i < dispatchers.length; i++) {\n if (process.env.NODE_ENV !== 'production' && !isHighDownDispatcher(dispatchers[i])) {\n error('param should be highDownDispatcher');\n }\n\n if (getECData(dispatchers[i]).focus === 'self') {\n focusSelf = true;\n break;\n }\n }\n\n return {\n focusSelf: focusSelf,\n dispatchers: dispatchers\n };\n}\nexport function handleGlobalMouseOverForHighDown(dispatcher, e, api) {\n if (process.env.NODE_ENV !== 'production' && !isHighDownDispatcher(dispatcher)) {\n error('param should be highDownDispatcher');\n }\n\n var ecData = getECData(dispatcher);\n\n var _a = findComponentHighDownDispatchers(ecData.componentMainType, ecData.componentIndex, ecData.componentHighDownName, api),\n dispatchers = _a.dispatchers,\n focusSelf = _a.focusSelf; // If `findHighDownDispatchers` is supported on the component,\n // highlight/downplay elements with the same name.\n\n\n if (dispatchers) {\n if (focusSelf) {\n blurComponent(ecData.componentMainType, ecData.componentIndex, api);\n }\n\n each(dispatchers, function (dispatcher) {\n return enterEmphasisWhenMouseOver(dispatcher, e);\n });\n } else {\n // Try blur all in the related series. Then emphasis the hoverred.\n // TODO. progressive mode.\n blurSeries(ecData.seriesIndex, ecData.focus, ecData.blurScope, api);\n\n if (ecData.focus === 'self') {\n blurComponent(ecData.componentMainType, ecData.componentIndex, api);\n } // Other than series, component that not support `findHighDownDispatcher` will\n // also use it. But in this case, highlight/downplay are only supported in\n // mouse hover but not in dispatchAction.\n\n\n enterEmphasisWhenMouseOver(dispatcher, e);\n }\n}\nexport function handleGlboalMouseOutForHighDown(dispatcher, e, api) {\n if (process.env.NODE_ENV !== 'production' && !isHighDownDispatcher(dispatcher)) {\n error('param should be highDownDispatcher');\n }\n\n allLeaveBlur(api);\n var ecData = getECData(dispatcher);\n var dispatchers = findComponentHighDownDispatchers(ecData.componentMainType, ecData.componentIndex, ecData.componentHighDownName, api).dispatchers;\n\n if (dispatchers) {\n each(dispatchers, function (dispatcher) {\n return leaveEmphasisWhenMouseOut(dispatcher, e);\n });\n } else {\n leaveEmphasisWhenMouseOut(dispatcher, e);\n }\n}\nexport function toggleSelectionFromPayload(seriesModel, payload, api) {\n if (!isSelectChangePayload(payload)) {\n return;\n }\n\n var dataType = payload.dataType;\n var data = seriesModel.getData(dataType);\n var dataIndex = queryDataIndex(data, payload);\n\n if (!isArray(dataIndex)) {\n dataIndex = [dataIndex];\n }\n\n seriesModel[payload.type === TOGGLE_SELECT_ACTION_TYPE ? 'toggleSelect' : payload.type === SELECT_ACTION_TYPE ? 'select' : 'unselect'](dataIndex, dataType);\n}\nexport function updateSeriesElementSelection(seriesModel) {\n var allData = seriesModel.getAllData();\n each(allData, function (_a) {\n var data = _a.data,\n type = _a.type;\n data.eachItemGraphicEl(function (el, idx) {\n seriesModel.isSelected(idx, type) ? enterSelect(el) : leaveSelect(el);\n });\n });\n}\nexport function getAllSelectedIndices(ecModel) {\n var ret = [];\n ecModel.eachSeries(function (seriesModel) {\n var allData = seriesModel.getAllData();\n each(allData, function (_a) {\n var data = _a.data,\n type = _a.type;\n var dataIndices = seriesModel.getSelectedDataIndices();\n\n if (dataIndices.length > 0) {\n var item = {\n dataIndex: dataIndices,\n seriesIndex: seriesModel.seriesIndex\n };\n\n if (type != null) {\n item.dataType = type;\n }\n\n ret.push(item);\n }\n });\n });\n return ret;\n}\n/**\n * Enable the function that mouseover will trigger the emphasis state.\n *\n * NOTE:\n * This function should be used on the element with dataIndex, seriesIndex.\n *\n */\n\nexport function enableHoverEmphasis(el, focus, blurScope) {\n setAsHighDownDispatcher(el, true);\n traverseUpdateState(el, setDefaultStateProxy);\n enableHoverFocus(el, focus, blurScope);\n}\nexport function enableHoverFocus(el, focus, blurScope) {\n var ecData = getECData(el);\n\n if (focus != null) {\n // TODO dataIndex may be set after this function. This check is not useful.\n // if (ecData.dataIndex == null) {\n // if (__DEV__) {\n // console.warn('focus can only been set on element with dataIndex');\n // }\n // }\n // else {\n ecData.focus = focus;\n ecData.blurScope = blurScope; // }\n } else if (ecData.focus) {\n ecData.focus = null;\n }\n}\nvar OTHER_STATES = ['emphasis', 'blur', 'select'];\nvar defaultStyleGetterMap = {\n itemStyle: 'getItemStyle',\n lineStyle: 'getLineStyle',\n areaStyle: 'getAreaStyle'\n};\n/**\n * Set emphasis/blur/selected states of element.\n */\n\nexport function setStatesStylesFromModel(el, itemModel, styleType, // default itemStyle\ngetter) {\n styleType = styleType || 'itemStyle';\n\n for (var i = 0; i < OTHER_STATES.length; i++) {\n var stateName = OTHER_STATES[i];\n var model = itemModel.getModel([stateName, styleType]);\n var state = el.ensureState(stateName); // Let it throw error if getterType is not found.\n\n state.style = getter ? getter(model) : model[defaultStyleGetterMap[styleType]]();\n }\n}\n/**\n * @parame el\n * @param el.highDownSilentOnTouch\n * In touch device, mouseover event will be trigger on touchstart event\n * (see module:zrender/dom/HandlerProxy). By this mechanism, we can\n * conveniently use hoverStyle when tap on touch screen without additional\n * code for compatibility.\n * But if the chart/component has select feature, which usually also use\n * hoverStyle, there might be conflict between 'select-highlight' and\n * 'hover-highlight' especially when roam is enabled (see geo for example).\n * In this case, `highDownSilentOnTouch` should be used to disable\n * hover-highlight on touch device.\n * @param asDispatcher If `false`, do not set as \"highDownDispatcher\".\n */\n\nexport function setAsHighDownDispatcher(el, asDispatcher) {\n var disable = asDispatcher === false;\n var extendedEl = el; // Make `highDownSilentOnTouch` and `onStateChange` only work after\n // `setAsHighDownDispatcher` called. Avoid it is modified by user unexpectedly.\n\n if (el.highDownSilentOnTouch) {\n extendedEl.__highDownSilentOnTouch = el.highDownSilentOnTouch;\n } // Simple optimize, since this method might be\n // called for each elements of a group in some cases.\n\n\n if (!disable || extendedEl.__highDownDispatcher) {\n // Emphasis, normal can be triggered manually by API or other components like hover link.\n // el[method]('emphasis', onElementEmphasisEvent)[method]('normal', onElementNormalEvent);\n // Also keep previous record.\n extendedEl.__highByOuter = extendedEl.__highByOuter || 0;\n extendedEl.__highDownDispatcher = !disable;\n }\n}\nexport function isHighDownDispatcher(el) {\n return !!(el && el.__highDownDispatcher);\n}\n/**\n * Enable component highlight/downplay features:\n * + hover link (within the same name)\n * + focus blur in component\n */\n\nexport function enableComponentHighDownFeatures(el, componentModel, componentHighDownName) {\n var ecData = getECData(el);\n ecData.componentMainType = componentModel.mainType;\n ecData.componentIndex = componentModel.componentIndex;\n ecData.componentHighDownName = componentHighDownName;\n}\n/**\n * Support hightlight/downplay record on each elements.\n * For the case: hover highlight/downplay (legend, visualMap, ...) and\n * user triggerred hightlight/downplay should not conflict.\n * Only all of the highlightDigit cleared, return to normal.\n * @param {string} highlightKey\n * @return {number} highlightDigit\n */\n\nexport function getHighlightDigit(highlightKey) {\n var highlightDigit = _highlightKeyMap[highlightKey];\n\n if (highlightDigit == null && _highlightNextDigit <= 32) {\n highlightDigit = _highlightKeyMap[highlightKey] = _highlightNextDigit++;\n }\n\n return highlightDigit;\n}\nexport function isSelectChangePayload(payload) {\n var payloadType = payload.type;\n return payloadType === SELECT_ACTION_TYPE || payloadType === UNSELECT_ACTION_TYPE || payloadType === TOGGLE_SELECT_ACTION_TYPE;\n}\nexport function isHighDownPayload(payload) {\n var payloadType = payload.type;\n return payloadType === HIGHLIGHT_ACTION_TYPE || payloadType === DOWNPLAY_ACTION_TYPE;\n}\nexport function savePathStates(el) {\n var store = getSavedStates(el);\n store.normalFill = el.style.fill;\n store.normalStroke = el.style.stroke;\n var selectState = el.states.select || {};\n store.selectFill = selectState.style && selectState.style.fill || null;\n store.selectStroke = selectState.style && selectState.style.stroke || null;\n}","import PathProxy from '../core/PathProxy';\nimport { applyTransform as v2ApplyTransform } from '../core/vector';\nvar CMD = PathProxy.CMD;\nvar points = [[], [], []];\nvar mathSqrt = Math.sqrt;\nvar mathAtan2 = Math.atan2;\nexport default function transformPath(path, m) {\n var data = path.data;\n var len = path.len();\n var cmd;\n var nPoint;\n var i;\n var j;\n var k;\n var p;\n var M = CMD.M;\n var C = CMD.C;\n var L = CMD.L;\n var R = CMD.R;\n var A = CMD.A;\n var Q = CMD.Q;\n for (i = 0, j = 0; i < len;) {\n cmd = data[i++];\n j = i;\n nPoint = 0;\n switch (cmd) {\n case M:\n nPoint = 1;\n break;\n case L:\n nPoint = 1;\n break;\n case C:\n nPoint = 3;\n break;\n case Q:\n nPoint = 2;\n break;\n case A:\n var x = m[4];\n var y = m[5];\n var sx = mathSqrt(m[0] * m[0] + m[1] * m[1]);\n var sy = mathSqrt(m[2] * m[2] + m[3] * m[3]);\n var angle = mathAtan2(-m[1] / sy, m[0] / sx);\n data[i] *= sx;\n data[i++] += x;\n data[i] *= sy;\n data[i++] += y;\n data[i++] *= sx;\n data[i++] *= sy;\n data[i++] += angle;\n data[i++] += angle;\n i += 2;\n j = i;\n break;\n case R:\n p[0] = data[i++];\n p[1] = data[i++];\n v2ApplyTransform(p, p, m);\n data[j++] = p[0];\n data[j++] = p[1];\n p[0] += data[i++];\n p[1] += data[i++];\n v2ApplyTransform(p, p, m);\n data[j++] = p[0];\n data[j++] = p[1];\n }\n for (k = 0; k < nPoint; k++) {\n var p_1 = points[k];\n p_1[0] = data[i++];\n p_1[1] = data[i++];\n v2ApplyTransform(p_1, p_1, m);\n data[j++] = p_1[0];\n data[j++] = p_1[1];\n }\n }\n path.increaseVersion();\n}\n","import { __extends } from \"tslib\";\nimport Path from '../graphic/Path';\nimport PathProxy from '../core/PathProxy';\nimport transformPath from './transformPath';\nimport { extend } from '../core/util';\nvar mathSqrt = Math.sqrt;\nvar mathSin = Math.sin;\nvar mathCos = Math.cos;\nvar PI = Math.PI;\nfunction vMag(v) {\n return Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n}\n;\nfunction vRatio(u, v) {\n return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));\n}\n;\nfunction vAngle(u, v) {\n return (u[0] * v[1] < u[1] * v[0] ? -1 : 1)\n * Math.acos(vRatio(u, v));\n}\n;\nfunction processArc(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg, cmd, path) {\n var psi = psiDeg * (PI / 180.0);\n var xp = mathCos(psi) * (x1 - x2) / 2.0\n + mathSin(psi) * (y1 - y2) / 2.0;\n var yp = -1 * mathSin(psi) * (x1 - x2) / 2.0\n + mathCos(psi) * (y1 - y2) / 2.0;\n var lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);\n if (lambda > 1) {\n rx *= mathSqrt(lambda);\n ry *= mathSqrt(lambda);\n }\n var f = (fa === fs ? -1 : 1)\n * mathSqrt((((rx * rx) * (ry * ry))\n - ((rx * rx) * (yp * yp))\n - ((ry * ry) * (xp * xp))) / ((rx * rx) * (yp * yp)\n + (ry * ry) * (xp * xp))) || 0;\n var cxp = f * rx * yp / ry;\n var cyp = f * -ry * xp / rx;\n var cx = (x1 + x2) / 2.0\n + mathCos(psi) * cxp\n - mathSin(psi) * cyp;\n var cy = (y1 + y2) / 2.0\n + mathSin(psi) * cxp\n + mathCos(psi) * cyp;\n var theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);\n var u = [(xp - cxp) / rx, (yp - cyp) / ry];\n var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];\n var dTheta = vAngle(u, v);\n if (vRatio(u, v) <= -1) {\n dTheta = PI;\n }\n if (vRatio(u, v) >= 1) {\n dTheta = 0;\n }\n if (dTheta < 0) {\n var n = Math.round(dTheta / PI * 1e6) / 1e6;\n dTheta = PI * 2 + (n % 2) * PI;\n }\n path.addData(cmd, cx, cy, rx, ry, theta, dTheta, psi, fs);\n}\nvar commandReg = /([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig;\nvar numberReg = /-?([0-9]*\\.)?[0-9]+([eE]-?[0-9]+)?/g;\nfunction createPathProxyFromString(data) {\n var path = new PathProxy();\n if (!data) {\n return path;\n }\n var cpx = 0;\n var cpy = 0;\n var subpathX = cpx;\n var subpathY = cpy;\n var prevCmd;\n var CMD = PathProxy.CMD;\n var cmdList = data.match(commandReg);\n if (!cmdList) {\n return path;\n }\n for (var l = 0; l < cmdList.length; l++) {\n var cmdText = cmdList[l];\n var cmdStr = cmdText.charAt(0);\n var cmd = void 0;\n var p = cmdText.match(numberReg) || [];\n var pLen = p.length;\n for (var i = 0; i < pLen; i++) {\n p[i] = parseFloat(p[i]);\n }\n var off = 0;\n while (off < pLen) {\n var ctlPtx = void 0;\n var ctlPty = void 0;\n var rx = void 0;\n var ry = void 0;\n var psi = void 0;\n var fa = void 0;\n var fs = void 0;\n var x1 = cpx;\n var y1 = cpy;\n var len = void 0;\n var pathData = void 0;\n switch (cmdStr) {\n case 'l':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'L':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'm':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'l';\n break;\n case 'M':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'L';\n break;\n case 'h':\n cpx += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'H':\n cpx = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'v':\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'V':\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'C':\n cmd = CMD.C;\n path.addData(cmd, p[off++], p[off++], p[off++], p[off++], p[off++], p[off++]);\n cpx = p[off - 2];\n cpy = p[off - 1];\n break;\n case 'c':\n cmd = CMD.C;\n path.addData(cmd, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy);\n cpx += p[off - 2];\n cpy += p[off - 1];\n break;\n case 'S':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 's':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = cpx + p[off++];\n y1 = cpy + p[off++];\n cpx += p[off++];\n cpy += p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 'Q':\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'q':\n x1 = p[off++] + cpx;\n y1 = p[off++] + cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'T':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 't':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 'A':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n x1 = cpx, y1 = cpy;\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.A;\n processArc(x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path);\n break;\n case 'a':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n x1 = cpx, y1 = cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.A;\n processArc(x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path);\n break;\n }\n }\n if (cmdStr === 'z' || cmdStr === 'Z') {\n cmd = CMD.Z;\n path.addData(cmd);\n cpx = subpathX;\n cpy = subpathY;\n }\n prevCmd = cmd;\n }\n path.toStatic();\n return path;\n}\nvar SVGPath = (function (_super) {\n __extends(SVGPath, _super);\n function SVGPath() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SVGPath.prototype.applyTransform = function (m) { };\n return SVGPath;\n}(Path));\nfunction isPathProxy(path) {\n return path.setData != null;\n}\nfunction createPathOptions(str, opts) {\n var pathProxy = createPathProxyFromString(str);\n var innerOpts = extend({}, opts);\n innerOpts.buildPath = function (path) {\n if (isPathProxy(path)) {\n path.setData(pathProxy.data);\n var ctx = path.getContext();\n if (ctx) {\n path.rebuildPath(ctx, 1);\n }\n }\n else {\n var ctx = path;\n pathProxy.rebuildPath(ctx, 1);\n }\n };\n innerOpts.applyTransform = function (m) {\n transformPath(pathProxy, m);\n this.dirtyShape();\n };\n return innerOpts;\n}\nexport function createFromString(str, opts) {\n return new SVGPath(createPathOptions(str, opts));\n}\nexport function extendFromString(str, defaultOpts) {\n var innerOpts = createPathOptions(str, defaultOpts);\n var Sub = (function (_super) {\n __extends(Sub, _super);\n function Sub(opts) {\n var _this = _super.call(this, opts) || this;\n _this.applyTransform = innerOpts.applyTransform;\n _this.buildPath = innerOpts.buildPath;\n return _this;\n }\n return Sub;\n }(SVGPath));\n return Sub;\n}\nexport function mergePath(pathEls, opts) {\n var pathList = [];\n var len = pathEls.length;\n for (var i = 0; i < len; i++) {\n var pathEl = pathEls[i];\n if (!pathEl.path) {\n pathEl.createPathProxy();\n }\n if (pathEl.shapeChanged()) {\n pathEl.buildPath(pathEl.path, pathEl.shape, true);\n }\n pathList.push(pathEl.path);\n }\n var pathBundle = new Path(opts);\n pathBundle.createPathProxy();\n pathBundle.buildPath = function (path) {\n if (isPathProxy(path)) {\n path.appendPath(pathList);\n var ctx = path.getContext();\n if (ctx) {\n path.rebuildPath(ctx, 1);\n }\n }\n };\n return pathBundle;\n}\n","import { __extends } from \"tslib\";\nimport * as zrUtil from '../core/util';\nimport Element from '../Element';\nimport BoundingRect from '../core/BoundingRect';\nvar Group = (function (_super) {\n __extends(Group, _super);\n function Group(opts) {\n var _this = _super.call(this) || this;\n _this.isGroup = true;\n _this._children = [];\n _this.attr(opts);\n return _this;\n }\n Group.prototype.childrenRef = function () {\n return this._children;\n };\n Group.prototype.children = function () {\n return this._children.slice();\n };\n Group.prototype.childAt = function (idx) {\n return this._children[idx];\n };\n Group.prototype.childOfName = function (name) {\n var children = this._children;\n for (var i = 0; i < children.length; i++) {\n if (children[i].name === name) {\n return children[i];\n }\n }\n };\n Group.prototype.childCount = function () {\n return this._children.length;\n };\n Group.prototype.add = function (child) {\n if (child) {\n if (child !== this && child.parent !== this) {\n this._children.push(child);\n this._doAdd(child);\n }\n if (child.__hostTarget) {\n throw 'This elemenet has been used as an attachment';\n }\n }\n return this;\n };\n Group.prototype.addBefore = function (child, nextSibling) {\n if (child && child !== this && child.parent !== this\n && nextSibling && nextSibling.parent === this) {\n var children = this._children;\n var idx = children.indexOf(nextSibling);\n if (idx >= 0) {\n children.splice(idx, 0, child);\n this._doAdd(child);\n }\n }\n return this;\n };\n Group.prototype.replaceAt = function (child, index) {\n var children = this._children;\n var old = children[index];\n if (child && child !== this && child.parent !== this && child !== old) {\n children[index] = child;\n old.parent = null;\n var zr = this.__zr;\n if (zr) {\n old.removeSelfFromZr(zr);\n }\n this._doAdd(child);\n }\n return this;\n };\n Group.prototype._doAdd = function (child) {\n if (child.parent) {\n child.parent.remove(child);\n }\n child.parent = this;\n var zr = this.__zr;\n if (zr && zr !== child.__zr) {\n child.addSelfToZr(zr);\n }\n zr && zr.refresh();\n };\n Group.prototype.remove = function (child) {\n var zr = this.__zr;\n var children = this._children;\n var idx = zrUtil.indexOf(children, child);\n if (idx < 0) {\n return this;\n }\n children.splice(idx, 1);\n child.parent = null;\n if (zr) {\n child.removeSelfFromZr(zr);\n }\n zr && zr.refresh();\n return this;\n };\n Group.prototype.removeAll = function () {\n var children = this._children;\n var zr = this.__zr;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (zr) {\n child.removeSelfFromZr(zr);\n }\n child.parent = null;\n }\n children.length = 0;\n return this;\n };\n Group.prototype.eachChild = function (cb, context) {\n var children = this._children;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n cb.call(context, child, i);\n }\n return this;\n };\n Group.prototype.traverse = function (cb, context) {\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n var stopped = cb.call(context, child);\n if (child.isGroup && !stopped) {\n child.traverse(cb, context);\n }\n }\n return this;\n };\n Group.prototype.addSelfToZr = function (zr) {\n _super.prototype.addSelfToZr.call(this, zr);\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n child.addSelfToZr(zr);\n }\n };\n Group.prototype.removeSelfFromZr = function (zr) {\n _super.prototype.removeSelfFromZr.call(this, zr);\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n child.removeSelfFromZr(zr);\n }\n };\n Group.prototype.getBoundingRect = function (includeChildren) {\n var tmpRect = new BoundingRect(0, 0, 0, 0);\n var children = includeChildren || this._children;\n var tmpMat = [];\n var rect = null;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (child.ignore || child.invisible) {\n continue;\n }\n var childRect = child.getBoundingRect();\n var transform = child.getLocalTransform(tmpMat);\n if (transform) {\n BoundingRect.applyTransform(tmpRect, childRect, transform);\n rect = rect || tmpRect.clone();\n rect.union(tmpRect);\n }\n else {\n rect = rect || childRect.clone();\n rect.union(childRect);\n }\n }\n return rect || tmpRect;\n };\n return Group;\n}(Element));\nGroup.prototype.type = 'group';\nexport default Group;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nvar CircleShape = (function () {\n function CircleShape() {\n this.cx = 0;\n this.cy = 0;\n this.r = 0;\n }\n return CircleShape;\n}());\nexport { CircleShape };\nvar Circle = (function (_super) {\n __extends(Circle, _super);\n function Circle(opts) {\n return _super.call(this, opts) || this;\n }\n Circle.prototype.getDefaultShape = function () {\n return new CircleShape();\n };\n Circle.prototype.buildPath = function (ctx, shape, inBundle) {\n if (inBundle) {\n ctx.moveTo(shape.cx + shape.r, shape.cy);\n }\n ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2);\n };\n return Circle;\n}(Path));\n;\nCircle.prototype.type = 'circle';\nexport default Circle;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nvar EllipseShape = (function () {\n function EllipseShape() {\n this.cx = 0;\n this.cy = 0;\n this.rx = 0;\n this.ry = 0;\n }\n return EllipseShape;\n}());\nexport { EllipseShape };\nvar Ellipse = (function (_super) {\n __extends(Ellipse, _super);\n function Ellipse(opts) {\n return _super.call(this, opts) || this;\n }\n Ellipse.prototype.getDefaultShape = function () {\n return new EllipseShape();\n };\n Ellipse.prototype.buildPath = function (ctx, shape) {\n var k = 0.5522848;\n var x = shape.cx;\n var y = shape.cy;\n var a = shape.rx;\n var b = shape.ry;\n var ox = a * k;\n var oy = b * k;\n ctx.moveTo(x - a, y);\n ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);\n ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);\n ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);\n ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);\n ctx.closePath();\n };\n return Ellipse;\n}(Path));\nEllipse.prototype.type = 'ellipse';\nexport default Ellipse;\n","import { normalizeArcAngles } from '../../core/PathProxy';\nvar PI = Math.PI;\nvar PI2 = PI * 2;\nvar mathSin = Math.sin;\nvar mathCos = Math.cos;\nvar mathACos = Math.acos;\nvar mathATan2 = Math.atan2;\nvar mathAbs = Math.abs;\nvar mathSqrt = Math.sqrt;\nvar mathMax = Math.max;\nvar mathMin = Math.min;\nvar e = 1e-4;\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0;\n var y10 = y1 - y0;\n var x32 = x3 - x2;\n var y32 = y3 - y2;\n var t = y32 * x10 - x32 * y10;\n if (t * t < e) {\n return;\n }\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\nfunction computeCornerTangents(x0, y0, x1, y1, radius, cr, clockwise) {\n var x01 = x0 - x1;\n var y01 = y0 - y1;\n var lo = (clockwise ? cr : -cr) / mathSqrt(x01 * x01 + y01 * y01);\n var ox = lo * y01;\n var oy = -lo * x01;\n var x11 = x0 + ox;\n var y11 = y0 + oy;\n var x10 = x1 + ox;\n var y10 = y1 + oy;\n var x00 = (x11 + x10) / 2;\n var y00 = (y11 + y10) / 2;\n var dx = x10 - x11;\n var dy = y10 - y11;\n var d2 = dx * dx + dy * dy;\n var r = radius - cr;\n var s = x11 * y10 - x10 * y11;\n var d = (dy < 0 ? -1 : 1) * mathSqrt(mathMax(0, r * r * d2 - s * s));\n var cx0 = (s * dy - dx * d) / d2;\n var cy0 = (-s * dx - dy * d) / d2;\n var cx1 = (s * dy + dx * d) / d2;\n var cy1 = (-s * dx + dy * d) / d2;\n var dx0 = cx0 - x00;\n var dy0 = cy0 - y00;\n var dx1 = cx1 - x00;\n var dy1 = cy1 - y00;\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {\n cx0 = cx1;\n cy0 = cy1;\n }\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (radius / r - 1),\n y11: cy0 * (radius / r - 1)\n };\n}\nexport function buildPath(ctx, shape) {\n var radius = mathMax(shape.r, 0);\n var innerRadius = mathMax(shape.r0 || 0, 0);\n var hasRadius = radius > 0;\n var hasInnerRadius = innerRadius > 0;\n if (!hasRadius && !hasInnerRadius) {\n return;\n }\n if (!hasRadius) {\n radius = innerRadius;\n innerRadius = 0;\n }\n if (innerRadius > radius) {\n var tmp = radius;\n radius = innerRadius;\n innerRadius = tmp;\n }\n var clockwise = !!shape.clockwise;\n var startAngle = shape.startAngle;\n var endAngle = shape.endAngle;\n var arc;\n if (startAngle === endAngle) {\n arc = 0;\n }\n else {\n var tmpAngles = [startAngle, endAngle];\n normalizeArcAngles(tmpAngles, !clockwise);\n arc = mathAbs(tmpAngles[0] - tmpAngles[1]);\n }\n var x = shape.cx;\n var y = shape.cy;\n var cornerRadius = shape.cornerRadius || 0;\n var innerCornerRadius = shape.innerCornerRadius || 0;\n if (!(radius > e)) {\n ctx.moveTo(x, y);\n }\n else if (arc > PI2 - e) {\n ctx.moveTo(x + radius * mathCos(startAngle), y + radius * mathSin(startAngle));\n ctx.arc(x, y, radius, startAngle, endAngle, !clockwise);\n if (innerRadius > e) {\n ctx.moveTo(x + innerRadius * mathCos(endAngle), y + innerRadius * mathSin(endAngle));\n ctx.arc(x, y, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n else {\n var halfRd = mathAbs(radius - innerRadius) / 2;\n var cr = mathMin(halfRd, cornerRadius);\n var icr = mathMin(halfRd, innerCornerRadius);\n var cr0 = icr;\n var cr1 = cr;\n var xrs = radius * mathCos(startAngle);\n var yrs = radius * mathSin(startAngle);\n var xire = innerRadius * mathCos(endAngle);\n var yire = innerRadius * mathSin(endAngle);\n var xre = void 0;\n var yre = void 0;\n var xirs = void 0;\n var yirs = void 0;\n if (cr > e || icr > e) {\n xre = radius * mathCos(endAngle);\n yre = radius * mathSin(endAngle);\n xirs = innerRadius * mathCos(startAngle);\n yirs = innerRadius * mathSin(startAngle);\n if (arc < PI) {\n var it_1 = intersect(xrs, yrs, xirs, yirs, xre, yre, xire, yire);\n if (it_1) {\n var x0 = xrs - it_1[0];\n var y0 = yrs - it_1[1];\n var x1 = xre - it_1[0];\n var y1 = yre - it_1[1];\n var a = 1 / mathSin(mathACos((x0 * x1 + y0 * y1) / (mathSqrt(x0 * x0 + y0 * y0) * mathSqrt(x1 * x1 + y1 * y1))) / 2);\n var b = mathSqrt(it_1[0] * it_1[0] + it_1[1] * it_1[1]);\n cr0 = mathMin(icr, (innerRadius - b) / (a - 1));\n cr1 = mathMin(cr, (radius - b) / (a + 1));\n }\n }\n }\n if (!(arc > e)) {\n ctx.moveTo(x + xrs, y + yrs);\n }\n else if (cr1 > e) {\n var ct0 = computeCornerTangents(xirs, yirs, xrs, yrs, radius, cr1, clockwise);\n var ct1 = computeCornerTangents(xre, yre, xire, yire, radius, cr1, clockwise);\n ctx.moveTo(x + ct0.cx + ct0.x01, y + ct0.cy + ct0.y01);\n if (cr1 < cr) {\n ctx.arc(x + ct0.cx, y + ct0.cy, cr1, mathATan2(ct0.y01, ct0.x01), mathATan2(ct1.y01, ct1.x01), !clockwise);\n }\n else {\n ctx.arc(x + ct0.cx, y + ct0.cy, cr1, mathATan2(ct0.y01, ct0.x01), mathATan2(ct0.y11, ct0.x11), !clockwise);\n ctx.arc(x, y, radius, mathATan2(ct0.cy + ct0.y11, ct0.cx + ct0.x11), mathATan2(ct1.cy + ct1.y11, ct1.cx + ct1.x11), !clockwise);\n ctx.arc(x + ct1.cx, y + ct1.cy, cr1, mathATan2(ct1.y11, ct1.x11), mathATan2(ct1.y01, ct1.x01), !clockwise);\n }\n }\n else {\n ctx.moveTo(x + xrs, y + yrs);\n ctx.arc(x, y, radius, startAngle, endAngle, !clockwise);\n }\n if (!(innerRadius > e) || !(arc > e)) {\n ctx.lineTo(x + xire, y + yire);\n }\n else if (cr0 > e) {\n var ct0 = computeCornerTangents(xire, yire, xre, yre, innerRadius, -cr0, clockwise);\n var ct1 = computeCornerTangents(xrs, yrs, xirs, yirs, innerRadius, -cr0, clockwise);\n ctx.lineTo(x + ct0.cx + ct0.x01, y + ct0.cy + ct0.y01);\n if (cr0 < icr) {\n ctx.arc(x + ct0.cx, y + ct0.cy, cr0, mathATan2(ct0.y01, ct0.x01), mathATan2(ct1.y01, ct1.x01), !clockwise);\n }\n else {\n ctx.arc(x + ct0.cx, y + ct0.cy, cr0, mathATan2(ct0.y01, ct0.x01), mathATan2(ct0.y11, ct0.x11), !clockwise);\n ctx.arc(x, y, innerRadius, mathATan2(ct0.cy + ct0.y11, ct0.cx + ct0.x11), mathATan2(ct1.cy + ct1.y11, ct1.cx + ct1.x11), clockwise);\n ctx.arc(x + ct1.cx, y + ct1.cy, cr0, mathATan2(ct1.y11, ct1.x11), mathATan2(ct1.y01, ct1.x01), !clockwise);\n }\n }\n else {\n ctx.lineTo(x + xire, y + yire);\n ctx.arc(x, y, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n ctx.closePath();\n}\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as roundSectorHelper from '../helper/roundSector';\nvar SectorShape = (function () {\n function SectorShape() {\n this.cx = 0;\n this.cy = 0;\n this.r0 = 0;\n this.r = 0;\n this.startAngle = 0;\n this.endAngle = Math.PI * 2;\n this.clockwise = true;\n this.cornerRadius = 0;\n this.innerCornerRadius = 0;\n }\n return SectorShape;\n}());\nexport { SectorShape };\nvar Sector = (function (_super) {\n __extends(Sector, _super);\n function Sector(opts) {\n return _super.call(this, opts) || this;\n }\n Sector.prototype.getDefaultShape = function () {\n return new SectorShape();\n };\n Sector.prototype.buildPath = function (ctx, shape) {\n roundSectorHelper.buildPath(ctx, shape);\n };\n Sector.prototype.isZeroArea = function () {\n return this.shape.startAngle === this.shape.endAngle\n || this.shape.r === this.shape.r0;\n };\n return Sector;\n}(Path));\nSector.prototype.type = 'sector';\nexport default Sector;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nvar RingShape = (function () {\n function RingShape() {\n this.cx = 0;\n this.cy = 0;\n this.r = 0;\n this.r0 = 0;\n }\n return RingShape;\n}());\nexport { RingShape };\nvar Ring = (function (_super) {\n __extends(Ring, _super);\n function Ring(opts) {\n return _super.call(this, opts) || this;\n }\n Ring.prototype.getDefaultShape = function () {\n return new RingShape();\n };\n Ring.prototype.buildPath = function (ctx, shape) {\n var x = shape.cx;\n var y = shape.cy;\n var PI2 = Math.PI * 2;\n ctx.moveTo(x + shape.r, y);\n ctx.arc(x, y, shape.r, 0, PI2, false);\n ctx.moveTo(x + shape.r0, y);\n ctx.arc(x, y, shape.r0, 0, PI2, true);\n };\n return Ring;\n}(Path));\nRing.prototype.type = 'ring';\nexport default Ring;\n","import { distance as v2Distance } from '../../core/vector';\nfunction interpolate(p0, p1, p2, p3, t, t2, t3) {\n var v0 = (p2 - p0) * 0.5;\n var v1 = (p3 - p1) * 0.5;\n return (2 * (p1 - p2) + v0 + v1) * t3\n + (-3 * (p1 - p2) - 2 * v0 - v1) * t2\n + v0 * t + p1;\n}\nexport default function smoothSpline(points, isLoop) {\n var len = points.length;\n var ret = [];\n var distance = 0;\n for (var i = 1; i < len; i++) {\n distance += v2Distance(points[i - 1], points[i]);\n }\n var segs = distance / 2;\n segs = segs < len ? len : segs;\n for (var i = 0; i < segs; i++) {\n var pos = i / (segs - 1) * (isLoop ? len : len - 1);\n var idx = Math.floor(pos);\n var w = pos - idx;\n var p0 = void 0;\n var p1 = points[idx % len];\n var p2 = void 0;\n var p3 = void 0;\n if (!isLoop) {\n p0 = points[idx === 0 ? idx : idx - 1];\n p2 = points[idx > len - 2 ? len - 1 : idx + 1];\n p3 = points[idx > len - 3 ? len - 1 : idx + 2];\n }\n else {\n p0 = points[(idx - 1 + len) % len];\n p2 = points[(idx + 1) % len];\n p3 = points[(idx + 2) % len];\n }\n var w2 = w * w;\n var w3 = w * w2;\n ret.push([\n interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),\n interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)\n ]);\n }\n return ret;\n}\n","import { min as v2Min, max as v2Max, scale as v2Scale, distance as v2Distance, add as v2Add, clone as v2Clone, sub as v2Sub } from '../../core/vector';\nexport default function smoothBezier(points, smooth, isLoop, constraint) {\n var cps = [];\n var v = [];\n var v1 = [];\n var v2 = [];\n var prevPoint;\n var nextPoint;\n var min;\n var max;\n if (constraint) {\n min = [Infinity, Infinity];\n max = [-Infinity, -Infinity];\n for (var i = 0, len = points.length; i < len; i++) {\n v2Min(min, min, points[i]);\n v2Max(max, max, points[i]);\n }\n v2Min(min, min, constraint[0]);\n v2Max(max, max, constraint[1]);\n }\n for (var i = 0, len = points.length; i < len; i++) {\n var point = points[i];\n if (isLoop) {\n prevPoint = points[i ? i - 1 : len - 1];\n nextPoint = points[(i + 1) % len];\n }\n else {\n if (i === 0 || i === len - 1) {\n cps.push(v2Clone(points[i]));\n continue;\n }\n else {\n prevPoint = points[i - 1];\n nextPoint = points[i + 1];\n }\n }\n v2Sub(v, nextPoint, prevPoint);\n v2Scale(v, v, smooth);\n var d0 = v2Distance(point, prevPoint);\n var d1 = v2Distance(point, nextPoint);\n var sum = d0 + d1;\n if (sum !== 0) {\n d0 /= sum;\n d1 /= sum;\n }\n v2Scale(v1, v, -d0);\n v2Scale(v2, v, d1);\n var cp0 = v2Add([], point, v1);\n var cp1 = v2Add([], point, v2);\n if (constraint) {\n v2Max(cp0, cp0, min);\n v2Min(cp0, cp0, max);\n v2Max(cp1, cp1, min);\n v2Min(cp1, cp1, max);\n }\n cps.push(cp0);\n cps.push(cp1);\n }\n if (isLoop) {\n cps.push(cps.shift());\n }\n return cps;\n}\n","import smoothSpline from './smoothSpline';\nimport smoothBezier from './smoothBezier';\nexport function buildPath(ctx, shape, closePath) {\n var smooth = shape.smooth;\n var points = shape.points;\n if (points && points.length >= 2) {\n if (smooth && smooth !== 'spline') {\n var controlPoints = smoothBezier(points, smooth, closePath, shape.smoothConstraint);\n ctx.moveTo(points[0][0], points[0][1]);\n var len = points.length;\n for (var i = 0; i < (closePath ? len : len - 1); i++) {\n var cp1 = controlPoints[i * 2];\n var cp2 = controlPoints[i * 2 + 1];\n var p = points[(i + 1) % len];\n ctx.bezierCurveTo(cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]);\n }\n }\n else {\n if (smooth === 'spline') {\n points = smoothSpline(points, closePath);\n }\n ctx.moveTo(points[0][0], points[0][1]);\n for (var i = 1, l = points.length; i < l; i++) {\n ctx.lineTo(points[i][0], points[i][1]);\n }\n }\n closePath && ctx.closePath();\n }\n}\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as polyHelper from '../helper/poly';\nvar PolygonShape = (function () {\n function PolygonShape() {\n this.points = null;\n this.smooth = 0;\n this.smoothConstraint = null;\n }\n return PolygonShape;\n}());\nexport { PolygonShape };\nvar Polygon = (function (_super) {\n __extends(Polygon, _super);\n function Polygon(opts) {\n return _super.call(this, opts) || this;\n }\n Polygon.prototype.getDefaultShape = function () {\n return new PolygonShape();\n };\n Polygon.prototype.buildPath = function (ctx, shape) {\n polyHelper.buildPath(ctx, shape, true);\n };\n return Polygon;\n}(Path));\n;\nPolygon.prototype.type = 'polygon';\nexport default Polygon;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as polyHelper from '../helper/poly';\nvar PolylineShape = (function () {\n function PolylineShape() {\n this.points = null;\n this.percent = 1;\n this.smooth = 0;\n this.smoothConstraint = null;\n }\n return PolylineShape;\n}());\nexport { PolylineShape };\nvar Polyline = (function (_super) {\n __extends(Polyline, _super);\n function Polyline(opts) {\n return _super.call(this, opts) || this;\n }\n Polyline.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n Polyline.prototype.getDefaultShape = function () {\n return new PolylineShape();\n };\n Polyline.prototype.buildPath = function (ctx, shape) {\n polyHelper.buildPath(ctx, shape, false);\n };\n return Polyline;\n}(Path));\nPolyline.prototype.type = 'polyline';\nexport default Polyline;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport { subPixelOptimizeLine } from '../helper/subPixelOptimize';\nvar subPixelOptimizeOutputShape = {};\nvar LineShape = (function () {\n function LineShape() {\n this.x1 = 0;\n this.y1 = 0;\n this.x2 = 0;\n this.y2 = 0;\n this.percent = 1;\n }\n return LineShape;\n}());\nexport { LineShape };\nvar Line = (function (_super) {\n __extends(Line, _super);\n function Line(opts) {\n return _super.call(this, opts) || this;\n }\n Line.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n Line.prototype.getDefaultShape = function () {\n return new LineShape();\n };\n Line.prototype.buildPath = function (ctx, shape) {\n var x1;\n var y1;\n var x2;\n var y2;\n if (this.subPixelOptimize) {\n var optimizedShape = subPixelOptimizeLine(subPixelOptimizeOutputShape, shape, this.style);\n x1 = optimizedShape.x1;\n y1 = optimizedShape.y1;\n x2 = optimizedShape.x2;\n y2 = optimizedShape.y2;\n }\n else {\n x1 = shape.x1;\n y1 = shape.y1;\n x2 = shape.x2;\n y2 = shape.y2;\n }\n var percent = shape.percent;\n if (percent === 0) {\n return;\n }\n ctx.moveTo(x1, y1);\n if (percent < 1) {\n x2 = x1 * (1 - percent) + x2 * percent;\n y2 = y1 * (1 - percent) + y2 * percent;\n }\n ctx.lineTo(x2, y2);\n };\n Line.prototype.pointAt = function (p) {\n var shape = this.shape;\n return [\n shape.x1 * (1 - p) + shape.x2 * p,\n shape.y1 * (1 - p) + shape.y2 * p\n ];\n };\n return Line;\n}(Path));\nLine.prototype.type = 'line';\nexport default Line;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as vec2 from '../../core/vector';\nimport { quadraticSubdivide, cubicSubdivide, quadraticAt, cubicAt, quadraticDerivativeAt, cubicDerivativeAt } from '../../core/curve';\nvar out = [];\nvar BezierCurveShape = (function () {\n function BezierCurveShape() {\n this.x1 = 0;\n this.y1 = 0;\n this.x2 = 0;\n this.y2 = 0;\n this.cpx1 = 0;\n this.cpy1 = 0;\n this.percent = 1;\n }\n return BezierCurveShape;\n}());\nexport { BezierCurveShape };\nfunction someVectorAt(shape, t, isTangent) {\n var cpx2 = shape.cpx2;\n var cpy2 = shape.cpy2;\n if (cpx2 === null || cpy2 === null) {\n return [\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.x1, shape.cpx1, shape.cpx2, shape.x2, t),\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.y1, shape.cpy1, shape.cpy2, shape.y2, t)\n ];\n }\n else {\n return [\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.x1, shape.cpx1, shape.x2, t),\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.y1, shape.cpy1, shape.y2, t)\n ];\n }\n}\nvar BezierCurve = (function (_super) {\n __extends(BezierCurve, _super);\n function BezierCurve(opts) {\n return _super.call(this, opts) || this;\n }\n BezierCurve.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n BezierCurve.prototype.getDefaultShape = function () {\n return new BezierCurveShape();\n };\n BezierCurve.prototype.buildPath = function (ctx, shape) {\n var x1 = shape.x1;\n var y1 = shape.y1;\n var x2 = shape.x2;\n var y2 = shape.y2;\n var cpx1 = shape.cpx1;\n var cpy1 = shape.cpy1;\n var cpx2 = shape.cpx2;\n var cpy2 = shape.cpy2;\n var percent = shape.percent;\n if (percent === 0) {\n return;\n }\n ctx.moveTo(x1, y1);\n if (cpx2 == null || cpy2 == null) {\n if (percent < 1) {\n quadraticSubdivide(x1, cpx1, x2, percent, out);\n cpx1 = out[1];\n x2 = out[2];\n quadraticSubdivide(y1, cpy1, y2, percent, out);\n cpy1 = out[1];\n y2 = out[2];\n }\n ctx.quadraticCurveTo(cpx1, cpy1, x2, y2);\n }\n else {\n if (percent < 1) {\n cubicSubdivide(x1, cpx1, cpx2, x2, percent, out);\n cpx1 = out[1];\n cpx2 = out[2];\n x2 = out[3];\n cubicSubdivide(y1, cpy1, cpy2, y2, percent, out);\n cpy1 = out[1];\n cpy2 = out[2];\n y2 = out[3];\n }\n ctx.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x2, y2);\n }\n };\n BezierCurve.prototype.pointAt = function (t) {\n return someVectorAt(this.shape, t, false);\n };\n BezierCurve.prototype.tangentAt = function (t) {\n var p = someVectorAt(this.shape, t, true);\n return vec2.normalize(p, p);\n };\n return BezierCurve;\n}(Path));\n;\nBezierCurve.prototype.type = 'bezier-curve';\nexport default BezierCurve;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nvar ArcShape = (function () {\n function ArcShape() {\n this.cx = 0;\n this.cy = 0;\n this.r = 0;\n this.startAngle = 0;\n this.endAngle = Math.PI * 2;\n this.clockwise = true;\n }\n return ArcShape;\n}());\nexport { ArcShape };\nvar Arc = (function (_super) {\n __extends(Arc, _super);\n function Arc(opts) {\n return _super.call(this, opts) || this;\n }\n Arc.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n Arc.prototype.getDefaultShape = function () {\n return new ArcShape();\n };\n Arc.prototype.buildPath = function (ctx, shape) {\n var x = shape.cx;\n var y = shape.cy;\n var r = Math.max(shape.r, 0);\n var startAngle = shape.startAngle;\n var endAngle = shape.endAngle;\n var clockwise = shape.clockwise;\n var unitX = Math.cos(startAngle);\n var unitY = Math.sin(startAngle);\n ctx.moveTo(unitX * r + x, unitY * r + y);\n ctx.arc(x, y, r, startAngle, endAngle, !clockwise);\n };\n return Arc;\n}(Path));\nArc.prototype.type = 'arc';\nexport default Arc;\n","import { __extends } from \"tslib\";\nimport Path from './Path';\nvar CompoundPath = (function (_super) {\n __extends(CompoundPath, _super);\n function CompoundPath() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.type = 'compound';\n return _this;\n }\n CompoundPath.prototype._updatePathDirty = function () {\n var paths = this.shape.paths;\n var dirtyPath = this.shapeChanged();\n for (var i = 0; i < paths.length; i++) {\n dirtyPath = dirtyPath || paths[i].shapeChanged();\n }\n if (dirtyPath) {\n this.dirtyShape();\n }\n };\n CompoundPath.prototype.beforeBrush = function () {\n this._updatePathDirty();\n var paths = this.shape.paths || [];\n var scale = this.getGlobalScale();\n for (var i = 0; i < paths.length; i++) {\n if (!paths[i].path) {\n paths[i].createPathProxy();\n }\n paths[i].path.setScale(scale[0], scale[1], paths[i].segmentIgnoreThreshold);\n }\n };\n CompoundPath.prototype.buildPath = function (ctx, shape) {\n var paths = shape.paths || [];\n for (var i = 0; i < paths.length; i++) {\n paths[i].buildPath(ctx, paths[i].shape, true);\n }\n };\n CompoundPath.prototype.afterBrush = function () {\n var paths = this.shape.paths || [];\n for (var i = 0; i < paths.length; i++) {\n paths[i].pathUpdated();\n }\n };\n CompoundPath.prototype.getBoundingRect = function () {\n this._updatePathDirty.call(this);\n return Path.prototype.getBoundingRect.call(this);\n };\n return CompoundPath;\n}(Path));\nexport default CompoundPath;\n","var Gradient = (function () {\n function Gradient(colorStops) {\n this.colorStops = colorStops || [];\n }\n Gradient.prototype.addColorStop = function (offset, color) {\n this.colorStops.push({\n offset: offset,\n color: color\n });\n };\n return Gradient;\n}());\nexport default Gradient;\n","import { __extends } from \"tslib\";\nimport Gradient from './Gradient';\nvar LinearGradient = (function (_super) {\n __extends(LinearGradient, _super);\n function LinearGradient(x, y, x2, y2, colorStops, globalCoord) {\n var _this = _super.call(this, colorStops) || this;\n _this.x = x == null ? 0 : x;\n _this.y = y == null ? 0 : y;\n _this.x2 = x2 == null ? 1 : x2;\n _this.y2 = y2 == null ? 0 : y2;\n _this.type = 'linear';\n _this.global = globalCoord || false;\n return _this;\n }\n return LinearGradient;\n}(Gradient));\nexport default LinearGradient;\n;\n","import { __extends } from \"tslib\";\nimport Gradient from './Gradient';\nvar RadialGradient = (function (_super) {\n __extends(RadialGradient, _super);\n function RadialGradient(x, y, r, colorStops, globalCoord) {\n var _this = _super.call(this, colorStops) || this;\n _this.x = x == null ? 0.5 : x;\n _this.y = y == null ? 0.5 : y;\n _this.r = r == null ? 0.5 : r;\n _this.type = 'radial';\n _this.global = globalCoord || false;\n return _this;\n }\n return RadialGradient;\n}(Gradient));\nexport default RadialGradient;\n","import Point from './Point';\nvar extent = [0, 0];\nvar extent2 = [0, 0];\nvar minTv = new Point();\nvar maxTv = new Point();\nvar OrientedBoundingRect = (function () {\n function OrientedBoundingRect(rect, transform) {\n this._corners = [];\n this._axes = [];\n this._origin = [0, 0];\n for (var i = 0; i < 4; i++) {\n this._corners[i] = new Point();\n }\n for (var i = 0; i < 2; i++) {\n this._axes[i] = new Point();\n }\n if (rect) {\n this.fromBoundingRect(rect, transform);\n }\n }\n OrientedBoundingRect.prototype.fromBoundingRect = function (rect, transform) {\n var corners = this._corners;\n var axes = this._axes;\n var x = rect.x;\n var y = rect.y;\n var x2 = x + rect.width;\n var y2 = y + rect.height;\n corners[0].set(x, y);\n corners[1].set(x2, y);\n corners[2].set(x2, y2);\n corners[3].set(x, y2);\n if (transform) {\n for (var i = 0; i < 4; i++) {\n corners[i].transform(transform);\n }\n }\n Point.sub(axes[0], corners[1], corners[0]);\n Point.sub(axes[1], corners[3], corners[0]);\n axes[0].normalize();\n axes[1].normalize();\n for (var i = 0; i < 2; i++) {\n this._origin[i] = axes[i].dot(corners[0]);\n }\n };\n OrientedBoundingRect.prototype.intersect = function (other, mtv) {\n var overlapped = true;\n var noMtv = !mtv;\n minTv.set(Infinity, Infinity);\n maxTv.set(0, 0);\n if (!this._intersectCheckOneSide(this, other, minTv, maxTv, noMtv, 1)) {\n overlapped = false;\n if (noMtv) {\n return overlapped;\n }\n }\n if (!this._intersectCheckOneSide(other, this, minTv, maxTv, noMtv, -1)) {\n overlapped = false;\n if (noMtv) {\n return overlapped;\n }\n }\n if (!noMtv) {\n Point.copy(mtv, overlapped ? minTv : maxTv);\n }\n return overlapped;\n };\n OrientedBoundingRect.prototype._intersectCheckOneSide = function (self, other, minTv, maxTv, noMtv, inverse) {\n var overlapped = true;\n for (var i = 0; i < 2; i++) {\n var axis = this._axes[i];\n this._getProjMinMaxOnAxis(i, self._corners, extent);\n this._getProjMinMaxOnAxis(i, other._corners, extent2);\n if (extent[1] < extent2[0] || extent[0] > extent2[1]) {\n overlapped = false;\n if (noMtv) {\n return overlapped;\n }\n var dist0 = Math.abs(extent2[0] - extent[1]);\n var dist1 = Math.abs(extent[0] - extent2[1]);\n if (Math.min(dist0, dist1) > maxTv.len()) {\n if (dist0 < dist1) {\n Point.scale(maxTv, axis, -dist0 * inverse);\n }\n else {\n Point.scale(maxTv, axis, dist1 * inverse);\n }\n }\n }\n else if (minTv) {\n var dist0 = Math.abs(extent2[0] - extent[1]);\n var dist1 = Math.abs(extent[0] - extent2[1]);\n if (Math.min(dist0, dist1) < minTv.len()) {\n if (dist0 < dist1) {\n Point.scale(minTv, axis, dist0 * inverse);\n }\n else {\n Point.scale(minTv, axis, -dist1 * inverse);\n }\n }\n }\n }\n return overlapped;\n };\n OrientedBoundingRect.prototype._getProjMinMaxOnAxis = function (dim, corners, out) {\n var axis = this._axes[dim];\n var origin = this._origin;\n var proj = corners[0].dot(axis) + origin[dim];\n var min = proj;\n var max = proj;\n for (var i = 1; i < corners.length; i++) {\n var proj_1 = corners[i].dot(axis) + origin[dim];\n min = Math.min(proj_1, min);\n max = Math.max(proj_1, max);\n }\n out[0] = min;\n out[1] = max;\n };\n return OrientedBoundingRect;\n}());\nexport default OrientedBoundingRect;\n","import { __extends } from \"tslib\";\nimport Displayble from './Displayable';\nimport BoundingRect from '../core/BoundingRect';\nvar m = [];\nvar IncrementalDisplayable = (function (_super) {\n __extends(IncrementalDisplayable, _super);\n function IncrementalDisplayable() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.notClear = true;\n _this.incremental = true;\n _this._displayables = [];\n _this._temporaryDisplayables = [];\n _this._cursor = 0;\n return _this;\n }\n IncrementalDisplayable.prototype.traverse = function (cb, context) {\n cb.call(context, this);\n };\n IncrementalDisplayable.prototype.useStyle = function () {\n this.style = {};\n };\n IncrementalDisplayable.prototype.getCursor = function () {\n return this._cursor;\n };\n IncrementalDisplayable.prototype.innerAfterBrush = function () {\n this._cursor = this._displayables.length;\n };\n IncrementalDisplayable.prototype.clearDisplaybles = function () {\n this._displayables = [];\n this._temporaryDisplayables = [];\n this._cursor = 0;\n this.markRedraw();\n this.notClear = false;\n };\n IncrementalDisplayable.prototype.clearTemporalDisplayables = function () {\n this._temporaryDisplayables = [];\n };\n IncrementalDisplayable.prototype.addDisplayable = function (displayable, notPersistent) {\n if (notPersistent) {\n this._temporaryDisplayables.push(displayable);\n }\n else {\n this._displayables.push(displayable);\n }\n this.markRedraw();\n };\n IncrementalDisplayable.prototype.addDisplayables = function (displayables, notPersistent) {\n notPersistent = notPersistent || false;\n for (var i = 0; i < displayables.length; i++) {\n this.addDisplayable(displayables[i], notPersistent);\n }\n };\n IncrementalDisplayable.prototype.getDisplayables = function () {\n return this._displayables;\n };\n IncrementalDisplayable.prototype.getTemporalDisplayables = function () {\n return this._temporaryDisplayables;\n };\n IncrementalDisplayable.prototype.eachPendingDisplayable = function (cb) {\n for (var i = this._cursor; i < this._displayables.length; i++) {\n cb && cb(this._displayables[i]);\n }\n for (var i = 0; i < this._temporaryDisplayables.length; i++) {\n cb && cb(this._temporaryDisplayables[i]);\n }\n };\n IncrementalDisplayable.prototype.update = function () {\n this.updateTransform();\n for (var i = this._cursor; i < this._displayables.length; i++) {\n var displayable = this._displayables[i];\n displayable.parent = this;\n displayable.update();\n displayable.parent = null;\n }\n for (var i = 0; i < this._temporaryDisplayables.length; i++) {\n var displayable = this._temporaryDisplayables[i];\n displayable.parent = this;\n displayable.update();\n displayable.parent = null;\n }\n };\n IncrementalDisplayable.prototype.getBoundingRect = function () {\n if (!this._rect) {\n var rect = new BoundingRect(Infinity, Infinity, -Infinity, -Infinity);\n for (var i = 0; i < this._displayables.length; i++) {\n var displayable = this._displayables[i];\n var childRect = displayable.getBoundingRect().clone();\n if (displayable.needLocalTransform()) {\n childRect.applyTransform(displayable.getLocalTransform(m));\n }\n rect.union(childRect);\n }\n this._rect = rect;\n }\n return this._rect;\n };\n IncrementalDisplayable.prototype.contain = function (x, y) {\n var localPos = this.transformCoordToLocal(x, y);\n var rect = this.getBoundingRect();\n if (rect.contain(localPos[0], localPos[1])) {\n for (var i = 0; i < this._displayables.length; i++) {\n var displayable = this._displayables[i];\n if (displayable.contain(x, y)) {\n return true;\n }\n }\n }\n return false;\n };\n return IncrementalDisplayable;\n}(Displayble));\nexport default IncrementalDisplayable;\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as pathTool from 'zrender/lib/tool/path';\nimport * as matrix from 'zrender/lib/core/matrix';\nimport * as vector from 'zrender/lib/core/vector';\nimport Path from 'zrender/lib/graphic/Path';\nimport Transformable from 'zrender/lib/core/Transformable';\nimport ZRImage from 'zrender/lib/graphic/Image';\nimport Group from 'zrender/lib/graphic/Group';\nimport ZRText from 'zrender/lib/graphic/Text';\nimport Circle from 'zrender/lib/graphic/shape/Circle';\nimport Ellipse from 'zrender/lib/graphic/shape/Ellipse';\nimport Sector from 'zrender/lib/graphic/shape/Sector';\nimport Ring from 'zrender/lib/graphic/shape/Ring';\nimport Polygon from 'zrender/lib/graphic/shape/Polygon';\nimport Polyline from 'zrender/lib/graphic/shape/Polyline';\nimport Rect from 'zrender/lib/graphic/shape/Rect';\nimport Line from 'zrender/lib/graphic/shape/Line';\nimport BezierCurve from 'zrender/lib/graphic/shape/BezierCurve';\nimport Arc from 'zrender/lib/graphic/shape/Arc';\nimport CompoundPath from 'zrender/lib/graphic/CompoundPath';\nimport LinearGradient from 'zrender/lib/graphic/LinearGradient';\nimport RadialGradient from 'zrender/lib/graphic/RadialGradient';\nimport BoundingRect from 'zrender/lib/core/BoundingRect';\nimport OrientedBoundingRect from 'zrender/lib/core/OrientedBoundingRect';\nimport Point from 'zrender/lib/core/Point';\nimport IncrementalDisplayable from 'zrender/lib/graphic/IncrementalDisplayable';\nimport * as subPixelOptimizeUtil from 'zrender/lib/graphic/helper/subPixelOptimize';\nimport { extend, isArrayLike, map, defaults, isObject, retrieve2, isString, keys, each, hasOwn } from 'zrender/lib/core/util';\nimport { getECData } from './innerStore';\nvar mathMax = Math.max;\nvar mathMin = Math.min;\nvar _customShapeMap = {};\n/**\n * Extend shape with parameters\n */\n\nexport function extendShape(opts) {\n return Path.extend(opts);\n}\nvar extendPathFromString = pathTool.extendFromString;\n/**\n * Extend path\n */\n\nexport function extendPath(pathData, opts) {\n return extendPathFromString(pathData, opts);\n}\n/**\n * Register a user defined shape.\n * The shape class can be fetched by `getShapeClass`\n * This method will overwrite the registered shapes, including\n * the registered built-in shapes, if using the same `name`.\n * The shape can be used in `custom series` and\n * `graphic component` by declaring `{type: name}`.\n *\n * @param name\n * @param ShapeClass Can be generated by `extendShape`.\n */\n\nexport function registerShape(name, ShapeClass) {\n _customShapeMap[name] = ShapeClass;\n}\n/**\n * Find shape class registered by `registerShape`. Usually used in\n * fetching user defined shape.\n *\n * [Caution]:\n * (1) This method **MUST NOT be used inside echarts !!!**, unless it is prepared\n * to use user registered shapes.\n * Because the built-in shape (see `getBuiltInShape`) will be registered by\n * `registerShape` by default. That enables users to get both built-in\n * shapes as well as the shapes belonging to themsleves. But users can overwrite\n * the built-in shapes by using names like 'circle', 'rect' via calling\n * `registerShape`. So the echarts inner featrues should not fetch shapes from here\n * in case that it is overwritten by users, except that some features, like\n * `custom series`, `graphic component`, do it deliberately.\n *\n * (2) In the features like `custom series`, `graphic component`, the user input\n * `{tpye: 'xxx'}` does not only specify shapes but also specify other graphic\n * elements like `'group'`, `'text'`, `'image'` or event `'path'`. Those names\n * are reserved names, that is, if some user register a shape named `'image'`,\n * the shape will not be used. If we intending to add some more reserved names\n * in feature, that might bring break changes (disable some existing user shape\n * names). But that case probably rearly happen. So we dont make more mechanism\n * to resolve this issue here.\n *\n * @param name\n * @return The shape class. If not found, return nothing.\n */\n\nexport function getShapeClass(name) {\n if (_customShapeMap.hasOwnProperty(name)) {\n return _customShapeMap[name];\n }\n}\n/**\n * Create a path element from path data string\n * @param pathData\n * @param opts\n * @param rect\n * @param layout 'center' or 'cover' default to be cover\n */\n\nexport function makePath(pathData, opts, rect, layout) {\n var path = pathTool.createFromString(pathData, opts);\n\n if (rect) {\n if (layout === 'center') {\n rect = centerGraphic(rect, path.getBoundingRect());\n }\n\n resizePath(path, rect);\n }\n\n return path;\n}\n/**\n * Create a image element from image url\n * @param imageUrl image url\n * @param opts options\n * @param rect constrain rect\n * @param layout 'center' or 'cover'. Default to be 'cover'\n */\n\nexport function makeImage(imageUrl, rect, layout) {\n var zrImg = new ZRImage({\n style: {\n image: imageUrl,\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height\n },\n onload: function (img) {\n if (layout === 'center') {\n var boundingRect = {\n width: img.width,\n height: img.height\n };\n zrImg.setStyle(centerGraphic(rect, boundingRect));\n }\n }\n });\n return zrImg;\n}\n/**\n * Get position of centered element in bounding box.\n *\n * @param rect element local bounding box\n * @param boundingRect constraint bounding box\n * @return element position containing x, y, width, and height\n */\n\nfunction centerGraphic(rect, boundingRect) {\n // Set rect to center, keep width / height ratio.\n var aspect = boundingRect.width / boundingRect.height;\n var width = rect.height * aspect;\n var height;\n\n if (width <= rect.width) {\n height = rect.height;\n } else {\n width = rect.width;\n height = width / aspect;\n }\n\n var cx = rect.x + rect.width / 2;\n var cy = rect.y + rect.height / 2;\n return {\n x: cx - width / 2,\n y: cy - height / 2,\n width: width,\n height: height\n };\n}\n\nexport var mergePath = pathTool.mergePath;\n/**\n * Resize a path to fit the rect\n * @param path\n * @param rect\n */\n\nexport function resizePath(path, rect) {\n if (!path.applyTransform) {\n return;\n }\n\n var pathRect = path.getBoundingRect();\n var m = pathRect.calculateTransform(rect);\n path.applyTransform(m);\n}\n/**\n * Sub pixel optimize line for canvas\n */\n\nexport function subPixelOptimizeLine(param) {\n subPixelOptimizeUtil.subPixelOptimizeLine(param.shape, param.shape, param.style);\n return param;\n}\n/**\n * Sub pixel optimize rect for canvas\n */\n\nexport function subPixelOptimizeRect(param) {\n subPixelOptimizeUtil.subPixelOptimizeRect(param.shape, param.shape, param.style);\n return param;\n}\n/**\n * Sub pixel optimize for canvas\n *\n * @param position Coordinate, such as x, y\n * @param lineWidth Should be nonnegative integer.\n * @param positiveOrNegative Default false (negative).\n * @return Optimized position.\n */\n\nexport var subPixelOptimize = subPixelOptimizeUtil.subPixelOptimize;\n\nfunction animateOrSetProps(animationType, el, props, animatableModel, dataIndex, cb, during) {\n var isFrom = false;\n var removeOpt;\n\n if (typeof dataIndex === 'function') {\n during = cb;\n cb = dataIndex;\n dataIndex = null;\n } else if (isObject(dataIndex)) {\n cb = dataIndex.cb;\n during = dataIndex.during;\n isFrom = dataIndex.isFrom;\n removeOpt = dataIndex.removeOpt;\n dataIndex = dataIndex.dataIndex;\n }\n\n var isUpdate = animationType === 'update';\n var isRemove = animationType === 'remove';\n var animationPayload; // Check if there is global animation configuration from dataZoom/resize can override the config in option.\n // If animation is enabled. Will use this animation config in payload.\n // If animation is disabled. Just ignore it.\n\n if (animatableModel && animatableModel.ecModel) {\n var updatePayload = animatableModel.ecModel.getUpdatePayload();\n animationPayload = updatePayload && updatePayload.animation;\n }\n\n var animationEnabled = animatableModel && animatableModel.isAnimationEnabled();\n\n if (!isRemove) {\n // Must stop the remove animation.\n el.stopAnimation('remove');\n }\n\n if (animationEnabled) {\n var duration = void 0;\n var animationEasing = void 0;\n var animationDelay = void 0;\n\n if (animationPayload) {\n duration = animationPayload.duration || 0;\n animationEasing = animationPayload.easing || 'cubicOut';\n animationDelay = animationPayload.delay || 0;\n } else if (isRemove) {\n removeOpt = removeOpt || {};\n duration = retrieve2(removeOpt.duration, 200);\n animationEasing = retrieve2(removeOpt.easing, 'cubicOut');\n animationDelay = 0;\n } else {\n duration = animatableModel.getShallow(isUpdate ? 'animationDurationUpdate' : 'animationDuration');\n animationEasing = animatableModel.getShallow(isUpdate ? 'animationEasingUpdate' : 'animationEasing');\n animationDelay = animatableModel.getShallow(isUpdate ? 'animationDelayUpdate' : 'animationDelay');\n }\n\n if (typeof animationDelay === 'function') {\n animationDelay = animationDelay(dataIndex, animatableModel.getAnimationDelayParams ? animatableModel.getAnimationDelayParams(el, dataIndex) : null);\n }\n\n if (typeof duration === 'function') {\n duration = duration(dataIndex);\n }\n\n duration > 0 ? isFrom ? el.animateFrom(props, {\n duration: duration,\n delay: animationDelay || 0,\n easing: animationEasing,\n done: cb,\n force: !!cb || !!during,\n scope: animationType,\n during: during\n }) : el.animateTo(props, {\n duration: duration,\n delay: animationDelay || 0,\n easing: animationEasing,\n done: cb,\n force: !!cb || !!during,\n setToFinal: true,\n scope: animationType,\n during: during\n }) : ( // FIXME:\n // If `duration` is 0, only the animation on props\n // can be stoped, other animation should be continued?\n // But at present using duration 0 in `animateTo`, `animateFrom`\n // might cause unexpected behavior.\n el.stopAnimation(), // If `isFrom`, the props is the \"from\" props.\n !isFrom && el.attr(props), cb && cb());\n } else {\n el.stopAnimation();\n !isFrom && el.attr(props); // Call during once.\n\n during && during(1);\n cb && cb();\n }\n}\n/**\n * Update graphic element properties with or without animation according to the\n * configuration in series.\n *\n * Caution: this method will stop previous animation.\n * So do not use this method to one element twice before\n * animation starts, unless you know what you are doing.\n * @example\n * graphic.updateProps(el, {\n * position: [100, 100]\n * }, seriesModel, dataIndex, function () { console.log('Animation done!'); });\n * // Or\n * graphic.updateProps(el, {\n * position: [100, 100]\n * }, seriesModel, function () { console.log('Animation done!'); });\n */\n\n\nfunction updateProps(el, props, // TODO: TYPE AnimatableModel\nanimatableModel, dataIndex, cb, during) {\n animateOrSetProps('update', el, props, animatableModel, dataIndex, cb, during);\n}\n\nexport { updateProps };\n/**\n * Init graphic element properties with or without animation according to the\n * configuration in series.\n *\n * Caution: this method will stop previous animation.\n * So do not use this method to one element twice before\n * animation starts, unless you know what you are doing.\n */\n\nexport function initProps(el, props, animatableModel, dataIndex, cb, during) {\n animateOrSetProps('init', el, props, animatableModel, dataIndex, cb, during);\n}\n/**\n * Remove graphic element\n */\n\nexport function removeElement(el, props, animatableModel, dataIndex, cb, during) {\n // Don't do remove animation twice.\n if (isElementRemoved(el)) {\n return;\n }\n\n animateOrSetProps('remove', el, props, animatableModel, dataIndex, cb, during);\n}\n\nfunction fadeOutDisplayable(el, animatableModel, dataIndex, done) {\n el.removeTextContent();\n el.removeTextGuideLine();\n removeElement(el, {\n style: {\n opacity: 0\n }\n }, animatableModel, dataIndex, done);\n}\n\nexport function removeElementWithFadeOut(el, animatableModel, dataIndex) {\n function doRemove() {\n el.parent && el.parent.remove(el);\n } // Hide label and labelLine first\n // TODO Also use fade out animation?\n\n\n if (!el.isGroup) {\n fadeOutDisplayable(el, animatableModel, dataIndex, doRemove);\n } else {\n el.traverse(function (disp) {\n if (!disp.isGroup) {\n // Can invoke doRemove multiple times.\n fadeOutDisplayable(disp, animatableModel, dataIndex, doRemove);\n }\n });\n }\n}\n/**\n * If element is removed.\n * It can determine if element is having remove animation.\n */\n\nexport function isElementRemoved(el) {\n if (!el.__zr) {\n return true;\n }\n\n for (var i = 0; i < el.animators.length; i++) {\n var animator = el.animators[i];\n\n if (animator.scope === 'remove') {\n return true;\n }\n }\n\n return false;\n}\n/**\n * Get transform matrix of target (param target),\n * in coordinate of its ancestor (param ancestor)\n *\n * @param target\n * @param [ancestor]\n */\n\nexport function getTransform(target, ancestor) {\n var mat = matrix.identity([]);\n\n while (target && target !== ancestor) {\n matrix.mul(mat, target.getLocalTransform(), mat);\n target = target.parent;\n }\n\n return mat;\n}\n/**\n * Apply transform to an vertex.\n * @param target [x, y]\n * @param transform Can be:\n * + Transform matrix: like [1, 0, 0, 1, 0, 0]\n * + {position, rotation, scale}, the same as `zrender/Transformable`.\n * @param invert Whether use invert matrix.\n * @return [x, y]\n */\n\nexport function applyTransform(target, transform, invert) {\n if (transform && !isArrayLike(transform)) {\n transform = Transformable.getLocalTransform(transform);\n }\n\n if (invert) {\n transform = matrix.invert([], transform);\n }\n\n return vector.applyTransform([], target, transform);\n}\n/**\n * @param direction 'left' 'right' 'top' 'bottom'\n * @param transform Transform matrix: like [1, 0, 0, 1, 0, 0]\n * @param invert Whether use invert matrix.\n * @return Transformed direction. 'left' 'right' 'top' 'bottom'\n */\n\nexport function transformDirection(direction, transform, invert) {\n // Pick a base, ensure that transform result will not be (0, 0).\n var hBase = transform[4] === 0 || transform[5] === 0 || transform[0] === 0 ? 1 : Math.abs(2 * transform[4] / transform[0]);\n var vBase = transform[4] === 0 || transform[5] === 0 || transform[2] === 0 ? 1 : Math.abs(2 * transform[4] / transform[2]);\n var vertex = [direction === 'left' ? -hBase : direction === 'right' ? hBase : 0, direction === 'top' ? -vBase : direction === 'bottom' ? vBase : 0];\n vertex = applyTransform(vertex, transform, invert);\n return Math.abs(vertex[0]) > Math.abs(vertex[1]) ? vertex[0] > 0 ? 'right' : 'left' : vertex[1] > 0 ? 'bottom' : 'top';\n}\n\nfunction isNotGroup(el) {\n return !el.isGroup;\n}\n\nfunction isPath(el) {\n return el.shape != null;\n}\n/**\n * Apply group transition animation from g1 to g2.\n * If no animatableModel, no animation.\n */\n\n\nexport function groupTransition(g1, g2, animatableModel) {\n if (!g1 || !g2) {\n return;\n }\n\n function getElMap(g) {\n var elMap = {};\n g.traverse(function (el) {\n if (isNotGroup(el) && el.anid) {\n elMap[el.anid] = el;\n }\n });\n return elMap;\n }\n\n function getAnimatableProps(el) {\n var obj = {\n x: el.x,\n y: el.y,\n rotation: el.rotation\n };\n\n if (isPath(el)) {\n obj.shape = extend({}, el.shape);\n }\n\n return obj;\n }\n\n var elMap1 = getElMap(g1);\n g2.traverse(function (el) {\n if (isNotGroup(el) && el.anid) {\n var oldEl = elMap1[el.anid];\n\n if (oldEl) {\n var newProp = getAnimatableProps(el);\n el.attr(getAnimatableProps(oldEl));\n updateProps(el, newProp, animatableModel, getECData(el).dataIndex);\n }\n }\n });\n}\nexport function clipPointsByRect(points, rect) {\n // FIXME: this way migth be incorrect when grpahic clipped by a corner.\n // and when element have border.\n return map(points, function (point) {\n var x = point[0];\n x = mathMax(x, rect.x);\n x = mathMin(x, rect.x + rect.width);\n var y = point[1];\n y = mathMax(y, rect.y);\n y = mathMin(y, rect.y + rect.height);\n return [x, y];\n });\n}\n/**\n * Return a new clipped rect. If rect size are negative, return undefined.\n */\n\nexport function clipRectByRect(targetRect, rect) {\n var x = mathMax(targetRect.x, rect.x);\n var x2 = mathMin(targetRect.x + targetRect.width, rect.x + rect.width);\n var y = mathMax(targetRect.y, rect.y);\n var y2 = mathMin(targetRect.y + targetRect.height, rect.y + rect.height); // If the total rect is cliped, nothing, including the border,\n // should be painted. So return undefined.\n\n if (x2 >= x && y2 >= y) {\n return {\n x: x,\n y: y,\n width: x2 - x,\n height: y2 - y\n };\n }\n}\nexport function createIcon(iconStr, // Support 'image://' or 'path://' or direct svg path.\nopt, rect) {\n var innerOpts = extend({\n rectHover: true\n }, opt);\n var style = innerOpts.style = {\n strokeNoScale: true\n };\n rect = rect || {\n x: -1,\n y: -1,\n width: 2,\n height: 2\n };\n\n if (iconStr) {\n return iconStr.indexOf('image://') === 0 ? (style.image = iconStr.slice(8), defaults(style, rect), new ZRImage(innerOpts)) : makePath(iconStr.replace('path://', ''), innerOpts, rect, 'center');\n }\n}\n/**\n * Return `true` if the given line (line `a`) and the given polygon\n * are intersect.\n * Note that we do not count colinear as intersect here because no\n * requirement for that. We could do that if required in future.\n */\n\nexport function linePolygonIntersect(a1x, a1y, a2x, a2y, points) {\n for (var i = 0, p2 = points[points.length - 1]; i < points.length; i++) {\n var p = points[i];\n\n if (lineLineIntersect(a1x, a1y, a2x, a2y, p[0], p[1], p2[0], p2[1])) {\n return true;\n }\n\n p2 = p;\n }\n}\n/**\n * Return `true` if the given two lines (line `a` and line `b`)\n * are intersect.\n * Note that we do not count colinear as intersect here because no\n * requirement for that. We could do that if required in future.\n */\n\nexport function lineLineIntersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) {\n // let `vec_m` to be `vec_a2 - vec_a1` and `vec_n` to be `vec_b2 - vec_b1`.\n var mx = a2x - a1x;\n var my = a2y - a1y;\n var nx = b2x - b1x;\n var ny = b2y - b1y; // `vec_m` and `vec_n` are parallel iff\n // exising `k` such that `vec_m = k · vec_n`, equivalent to `vec_m X vec_n = 0`.\n\n var nmCrossProduct = crossProduct2d(nx, ny, mx, my);\n\n if (nearZero(nmCrossProduct)) {\n return false;\n } // `vec_m` and `vec_n` are intersect iff\n // existing `p` and `q` in [0, 1] such that `vec_a1 + p * vec_m = vec_b1 + q * vec_n`,\n // such that `q = ((vec_a1 - vec_b1) X vec_m) / (vec_n X vec_m)`\n // and `p = ((vec_a1 - vec_b1) X vec_n) / (vec_n X vec_m)`.\n\n\n var b1a1x = a1x - b1x;\n var b1a1y = a1y - b1y;\n var q = crossProduct2d(b1a1x, b1a1y, mx, my) / nmCrossProduct;\n\n if (q < 0 || q > 1) {\n return false;\n }\n\n var p = crossProduct2d(b1a1x, b1a1y, nx, ny) / nmCrossProduct;\n\n if (p < 0 || p > 1) {\n return false;\n }\n\n return true;\n}\n/**\n * Cross product of 2-dimension vector.\n */\n\nfunction crossProduct2d(x1, y1, x2, y2) {\n return x1 * y2 - x2 * y1;\n}\n\nfunction nearZero(val) {\n return val <= 1e-6 && val >= -1e-6;\n}\n\nexport function setTooltipConfig(opt) {\n var itemTooltipOption = opt.itemTooltipOption;\n var componentModel = opt.componentModel;\n var itemName = opt.itemName;\n var itemTooltipOptionObj = isString(itemTooltipOption) ? {\n formatter: itemTooltipOption\n } : itemTooltipOption;\n var mainType = componentModel.mainType;\n var componentIndex = componentModel.componentIndex;\n var formatterParams = {\n componentType: mainType,\n name: itemName,\n $vars: ['name']\n };\n formatterParams[mainType + 'Index'] = componentIndex;\n var formatterParamsExtra = opt.formatterParamsExtra;\n\n if (formatterParamsExtra) {\n each(keys(formatterParamsExtra), function (key) {\n if (!hasOwn(formatterParams, key)) {\n formatterParams[key] = formatterParamsExtra[key];\n formatterParams.$vars.push(key);\n }\n });\n }\n\n var ecData = getECData(opt.el);\n ecData.componentMainType = mainType;\n ecData.componentIndex = componentIndex;\n ecData.tooltipConfig = {\n name: itemName,\n option: defaults({\n content: itemName,\n formatterParams: formatterParams\n }, itemTooltipOptionObj)\n };\n} // Register built-in shapes. These shapes might be overwirtten\n// by users, although we do not recommend that.\n\nregisterShape('circle', Circle);\nregisterShape('ellipse', Ellipse);\nregisterShape('sector', Sector);\nregisterShape('ring', Ring);\nregisterShape('polygon', Polygon);\nregisterShape('polyline', Polyline);\nregisterShape('rect', Rect);\nregisterShape('line', Line);\nregisterShape('bezierCurve', BezierCurve);\nregisterShape('arc', Arc);\nexport { Group, ZRImage as Image, ZRText as Text, Circle, Ellipse, Sector, Ring, Polygon, Polyline, Rect, Line, BezierCurve, Arc, IncrementalDisplayable, CompoundPath, LinearGradient, RadialGradient, BoundingRect, OrientedBoundingRect, Point, Path };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport ZRText from 'zrender/lib/graphic/Text';\nimport { isFunction, retrieve2, extend, keys, trim } from 'zrender/lib/core/util';\nimport { SPECIAL_STATES, DISPLAY_STATES } from '../util/states';\nimport { deprecateReplaceLog } from '../util/log';\nimport { makeInner, interpolateRawValues } from '../util/model';\nimport { initProps, updateProps } from '../util/graphic';\nvar EMPTY_OBJ = {};\nexport function setLabelText(label, labelTexts) {\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n var text = labelTexts[stateName];\n var state = label.ensureState(stateName);\n state.style = state.style || {};\n state.style.text = text;\n }\n\n var oldStates = label.currentStates.slice();\n label.clearStates(true);\n label.setStyle({\n text: labelTexts.normal\n });\n label.useStates(oldStates, true);\n}\n\nfunction getLabelText(opt, stateModels, interpolatedValue) {\n var labelFetcher = opt.labelFetcher;\n var labelDataIndex = opt.labelDataIndex;\n var labelDimIndex = opt.labelDimIndex;\n var normalModel = stateModels.normal;\n var baseText;\n\n if (labelFetcher) {\n baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, normalModel && normalModel.get('formatter'), interpolatedValue != null ? {\n interpolatedValue: interpolatedValue\n } : null);\n }\n\n if (baseText == null) {\n baseText = isFunction(opt.defaultText) ? opt.defaultText(labelDataIndex, opt, interpolatedValue) : opt.defaultText;\n }\n\n var statesText = {\n normal: baseText\n };\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n var stateModel = stateModels[stateName];\n statesText[stateName] = retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, stateName, null, labelDimIndex, stateModel && stateModel.get('formatter')) : null, baseText);\n }\n\n return statesText;\n}\n\nfunction setLabelStyle(targetEl, labelStatesModels, opt, stateSpecified // TODO specified position?\n) {\n opt = opt || EMPTY_OBJ;\n var isSetOnText = targetEl instanceof ZRText;\n var needsCreateText = false;\n\n for (var i = 0; i < DISPLAY_STATES.length; i++) {\n var stateModel = labelStatesModels[DISPLAY_STATES[i]];\n\n if (stateModel && stateModel.getShallow('show')) {\n needsCreateText = true;\n break;\n }\n }\n\n var textContent = isSetOnText ? targetEl : targetEl.getTextContent();\n\n if (needsCreateText) {\n if (!isSetOnText) {\n // Reuse the previous\n if (!textContent) {\n textContent = new ZRText();\n targetEl.setTextContent(textContent);\n } // Use same state proxy\n\n\n if (targetEl.stateProxy) {\n textContent.stateProxy = targetEl.stateProxy;\n }\n }\n\n var labelStatesTexts = getLabelText(opt, labelStatesModels);\n var normalModel = labelStatesModels.normal;\n var showNormal = !!normalModel.getShallow('show');\n var normalStyle = createTextStyle(normalModel, stateSpecified && stateSpecified.normal, opt, false, !isSetOnText);\n normalStyle.text = labelStatesTexts.normal;\n\n if (!isSetOnText) {\n // Always create new\n targetEl.setTextConfig(createTextConfig(normalModel, opt, false));\n }\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n var stateModel = labelStatesModels[stateName];\n\n if (stateModel) {\n var stateObj = textContent.ensureState(stateName);\n var stateShow = !!retrieve2(stateModel.getShallow('show'), showNormal);\n\n if (stateShow !== showNormal) {\n stateObj.ignore = !stateShow;\n }\n\n stateObj.style = createTextStyle(stateModel, stateSpecified && stateSpecified[stateName], opt, true, !isSetOnText);\n stateObj.style.text = labelStatesTexts[stateName];\n\n if (!isSetOnText) {\n var targetElEmphasisState = targetEl.ensureState(stateName);\n targetElEmphasisState.textConfig = createTextConfig(stateModel, opt, true);\n }\n }\n } // PENDING: if there is many requirements that emphasis position\n // need to be different from normal position, we might consider\n // auto slient is those cases.\n\n\n textContent.silent = !!normalModel.getShallow('silent'); // Keep x and y\n\n if (textContent.style.x != null) {\n normalStyle.x = textContent.style.x;\n }\n\n if (textContent.style.y != null) {\n normalStyle.y = textContent.style.y;\n }\n\n textContent.ignore = !showNormal; // Always create new style.\n\n textContent.useStyle(normalStyle);\n textContent.dirty();\n\n if (opt.enableTextSetter) {\n labelInner(textContent).setLabelText = function (interpolatedValue) {\n var labelStatesTexts = getLabelText(opt, labelStatesModels, interpolatedValue);\n setLabelText(textContent, labelStatesTexts);\n };\n }\n } else if (textContent) {\n // Not display rich text.\n textContent.ignore = true;\n }\n\n targetEl.dirty();\n}\n\nexport { setLabelStyle };\nexport function getLabelStatesModels(itemModel, labelName) {\n labelName = labelName || 'label';\n var statesModels = {\n normal: itemModel.getModel(labelName)\n };\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n statesModels[stateName] = itemModel.getModel([stateName, labelName]);\n }\n\n return statesModels;\n}\n/**\n * Set basic textStyle properties.\n */\n\nexport function createTextStyle(textStyleModel, specifiedTextStyle, // Fixed style in the code. Can't be set by model.\nopt, isNotNormal, isAttached // If text is attached on an element. If so, auto color will handling in zrender.\n) {\n var textStyle = {};\n setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttached);\n specifiedTextStyle && extend(textStyle, specifiedTextStyle); // textStyle.host && textStyle.host.dirty && textStyle.host.dirty(false);\n\n return textStyle;\n}\nexport function createTextConfig(textStyleModel, opt, isNotNormal) {\n opt = opt || {};\n var textConfig = {};\n var labelPosition;\n var labelRotate = textStyleModel.getShallow('rotate');\n var labelDistance = retrieve2(textStyleModel.getShallow('distance'), isNotNormal ? null : 5);\n var labelOffset = textStyleModel.getShallow('offset');\n labelPosition = textStyleModel.getShallow('position') || (isNotNormal ? null : 'inside'); // 'outside' is not a valid zr textPostion value, but used\n // in bar series, and magric type should be considered.\n\n labelPosition === 'outside' && (labelPosition = opt.defaultOutsidePosition || 'top');\n\n if (labelPosition != null) {\n textConfig.position = labelPosition;\n }\n\n if (labelOffset != null) {\n textConfig.offset = labelOffset;\n }\n\n if (labelRotate != null) {\n labelRotate *= Math.PI / 180;\n textConfig.rotation = labelRotate;\n }\n\n if (labelDistance != null) {\n textConfig.distance = labelDistance;\n } // fill and auto is determined by the color of path fill if it's not specified by developers.\n\n\n textConfig.outsideFill = textStyleModel.get('color') === 'inherit' ? opt.inheritColor || null : 'auto';\n return textConfig;\n}\n/**\n * The uniform entry of set text style, that is, retrieve style definitions\n * from `model` and set to `textStyle` object.\n *\n * Never in merge mode, but in overwrite mode, that is, all of the text style\n * properties will be set. (Consider the states of normal and emphasis and\n * default value can be adopted, merge would make the logic too complicated\n * to manage.)\n */\n\nfunction setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttached) {\n // Consider there will be abnormal when merge hover style to normal style if given default value.\n opt = opt || EMPTY_OBJ;\n var ecModel = textStyleModel.ecModel;\n var globalTextStyle = ecModel && ecModel.option.textStyle; // Consider case:\n // {\n // data: [{\n // value: 12,\n // label: {\n // rich: {\n // // no 'a' here but using parent 'a'.\n // }\n // }\n // }],\n // rich: {\n // a: { ... }\n // }\n // }\n\n var richItemNames = getRichItemNames(textStyleModel);\n var richResult;\n\n if (richItemNames) {\n richResult = {};\n\n for (var name_1 in richItemNames) {\n if (richItemNames.hasOwnProperty(name_1)) {\n // Cascade is supported in rich.\n var richTextStyle = textStyleModel.getModel(['rich', name_1]); // In rich, never `disableBox`.\n // FIXME: consider `label: {formatter: '{a|xx}', color: 'blue', rich: {a: {}}}`,\n // the default color `'blue'` will not be adopted if no color declared in `rich`.\n // That might confuses users. So probably we should put `textStyleModel` as the\n // root ancestor of the `richTextStyle`. But that would be a break change.\n\n setTokenTextStyle(richResult[name_1] = {}, richTextStyle, globalTextStyle, opt, isNotNormal, isAttached, false, true);\n }\n }\n }\n\n if (richResult) {\n textStyle.rich = richResult;\n }\n\n var overflow = textStyleModel.get('overflow');\n\n if (overflow) {\n textStyle.overflow = overflow;\n }\n\n var margin = textStyleModel.get('minMargin');\n\n if (margin != null) {\n textStyle.margin = margin;\n }\n\n setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isNotNormal, isAttached, true, false);\n} // Consider case:\n// {\n// data: [{\n// value: 12,\n// label: {\n// rich: {\n// // no 'a' here but using parent 'a'.\n// }\n// }\n// }],\n// rich: {\n// a: { ... }\n// }\n// }\n// TODO TextStyleModel\n\n\nfunction getRichItemNames(textStyleModel) {\n // Use object to remove duplicated names.\n var richItemNameMap;\n\n while (textStyleModel && textStyleModel !== textStyleModel.ecModel) {\n var rich = (textStyleModel.option || EMPTY_OBJ).rich;\n\n if (rich) {\n richItemNameMap = richItemNameMap || {};\n var richKeys = keys(rich);\n\n for (var i = 0; i < richKeys.length; i++) {\n var richKey = richKeys[i];\n richItemNameMap[richKey] = 1;\n }\n }\n\n textStyleModel = textStyleModel.parentModel;\n }\n\n return richItemNameMap;\n}\n\nvar TEXT_PROPS_WITH_GLOBAL = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'];\nvar TEXT_PROPS_SELF = ['align', 'lineHeight', 'width', 'height', 'tag', 'verticalAlign'];\nvar TEXT_PROPS_BOX = ['padding', 'borderWidth', 'borderRadius', 'borderDashOffset', 'backgroundColor', 'borderColor', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'];\n\nfunction setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isNotNormal, isAttached, isBlock, inRich) {\n // In merge mode, default value should not be given.\n globalTextStyle = !isNotNormal && globalTextStyle || EMPTY_OBJ;\n var inheritColor = opt && opt.inheritColor;\n var fillColor = textStyleModel.getShallow('color');\n var strokeColor = textStyleModel.getShallow('textBorderColor');\n var opacity = retrieve2(textStyleModel.getShallow('opacity'), globalTextStyle.opacity);\n\n if (fillColor === 'inherit' || fillColor === 'auto') {\n if (process.env.NODE_ENV !== 'production') {\n if (fillColor === 'auto') {\n deprecateReplaceLog('color: \\'auto\\'', 'color: \\'inherit\\'');\n }\n }\n\n if (inheritColor) {\n fillColor = inheritColor;\n } else {\n fillColor = null;\n }\n }\n\n if (strokeColor === 'inherit' || strokeColor === 'auto') {\n if (process.env.NODE_ENV !== 'production') {\n if (strokeColor === 'auto') {\n deprecateReplaceLog('color: \\'auto\\'', 'color: \\'inherit\\'');\n }\n }\n\n if (inheritColor) {\n strokeColor = inheritColor;\n } else {\n strokeColor = null;\n }\n }\n\n if (!isAttached) {\n // Only use default global textStyle.color if text is individual.\n // Otherwise it will use the strategy of attached text color because text may be on a path.\n fillColor = fillColor || globalTextStyle.color;\n strokeColor = strokeColor || globalTextStyle.textBorderColor;\n }\n\n if (fillColor != null) {\n textStyle.fill = fillColor;\n }\n\n if (strokeColor != null) {\n textStyle.stroke = strokeColor;\n }\n\n var textBorderWidth = retrieve2(textStyleModel.getShallow('textBorderWidth'), globalTextStyle.textBorderWidth);\n\n if (textBorderWidth != null) {\n textStyle.lineWidth = textBorderWidth;\n }\n\n var textBorderType = retrieve2(textStyleModel.getShallow('textBorderType'), globalTextStyle.textBorderType);\n\n if (textBorderType != null) {\n textStyle.lineDash = textBorderType;\n }\n\n var textBorderDashOffset = retrieve2(textStyleModel.getShallow('textBorderDashOffset'), globalTextStyle.textBorderDashOffset);\n\n if (textBorderDashOffset != null) {\n textStyle.lineDashOffset = textBorderDashOffset;\n }\n\n if (!isNotNormal && opacity == null && !inRich) {\n opacity = opt && opt.defaultOpacity;\n }\n\n if (opacity != null) {\n textStyle.opacity = opacity;\n } // TODO\n\n\n if (!isNotNormal && !isAttached) {\n // Set default finally.\n if (textStyle.fill == null && opt.inheritColor) {\n textStyle.fill = opt.inheritColor;\n }\n } // Do not use `getFont` here, because merge should be supported, where\n // part of these properties may be changed in emphasis style, and the\n // others should remain their original value got from normal style.\n\n\n for (var i = 0; i < TEXT_PROPS_WITH_GLOBAL.length; i++) {\n var key = TEXT_PROPS_WITH_GLOBAL[i];\n var val = retrieve2(textStyleModel.getShallow(key), globalTextStyle[key]);\n\n if (val != null) {\n textStyle[key] = val;\n }\n }\n\n for (var i = 0; i < TEXT_PROPS_SELF.length; i++) {\n var key = TEXT_PROPS_SELF[i];\n var val = textStyleModel.getShallow(key);\n\n if (val != null) {\n textStyle[key] = val;\n }\n }\n\n if (textStyle.verticalAlign == null) {\n var baseline = textStyleModel.getShallow('baseline');\n\n if (baseline != null) {\n textStyle.verticalAlign = baseline;\n }\n }\n\n if (!isBlock || !opt.disableBox) {\n for (var i = 0; i < TEXT_PROPS_BOX.length; i++) {\n var key = TEXT_PROPS_BOX[i];\n var val = textStyleModel.getShallow(key);\n\n if (val != null) {\n textStyle[key] = val;\n }\n }\n\n var borderType = textStyleModel.getShallow('borderType');\n\n if (borderType != null) {\n textStyle.borderDash = borderType;\n }\n\n if ((textStyle.backgroundColor === 'auto' || textStyle.backgroundColor === 'inherit') && inheritColor) {\n if (process.env.NODE_ENV !== 'production') {\n if (textStyle.backgroundColor === 'auto') {\n deprecateReplaceLog('backgroundColor: \\'auto\\'', 'backgroundColor: \\'inherit\\'');\n }\n }\n\n textStyle.backgroundColor = inheritColor;\n }\n\n if ((textStyle.borderColor === 'auto' || textStyle.borderColor === 'inherit') && inheritColor) {\n if (process.env.NODE_ENV !== 'production') {\n if (textStyle.borderColor === 'auto') {\n deprecateReplaceLog('borderColor: \\'auto\\'', 'borderColor: \\'inherit\\'');\n }\n }\n\n textStyle.borderColor = inheritColor;\n }\n }\n}\n\nexport function getFont(opt, ecModel) {\n var gTextStyleModel = ecModel && ecModel.getModel('textStyle');\n return trim([// FIXME in node-canvas fontWeight is before fontStyle\n opt.fontStyle || gTextStyleModel && gTextStyleModel.getShallow('fontStyle') || '', opt.fontWeight || gTextStyleModel && gTextStyleModel.getShallow('fontWeight') || '', (opt.fontSize || gTextStyleModel && gTextStyleModel.getShallow('fontSize') || 12) + 'px', opt.fontFamily || gTextStyleModel && gTextStyleModel.getShallow('fontFamily') || 'sans-serif'].join(' '));\n}\nexport var labelInner = makeInner();\nexport function setLabelValueAnimation(label, labelStatesModels, value, getDefaultText) {\n if (!label) {\n return;\n }\n\n var obj = labelInner(label);\n obj.prevValue = obj.value;\n obj.value = value;\n var normalLabelModel = labelStatesModels.normal;\n obj.valueAnimation = normalLabelModel.get('valueAnimation');\n\n if (obj.valueAnimation) {\n obj.precision = normalLabelModel.get('precision');\n obj.defaultInterpolatedText = getDefaultText;\n obj.statesModels = labelStatesModels;\n }\n}\nexport function animateLabelValue(textEl, dataIndex, data, animatableModel, labelFetcher) {\n var labelInnerStore = labelInner(textEl);\n\n if (!labelInnerStore.valueAnimation) {\n return;\n }\n\n var defaultInterpolatedText = labelInnerStore.defaultInterpolatedText; // Consider the case that being animating, do not use the `obj.value`,\n // Otherwise it will jump to the `obj.value` when this new animation started.\n\n var currValue = retrieve2(labelInnerStore.interpolatedValue, labelInnerStore.prevValue);\n var targetValue = labelInnerStore.value;\n\n function during(percent) {\n var interpolated = interpolateRawValues(data, labelInnerStore.precision, currValue, targetValue, percent);\n labelInnerStore.interpolatedValue = percent === 1 ? null : interpolated;\n var labelText = getLabelText({\n labelDataIndex: dataIndex,\n labelFetcher: labelFetcher,\n defaultText: defaultInterpolatedText ? defaultInterpolatedText(interpolated) : interpolated + ''\n }, labelInnerStore.statesModels, interpolated);\n setLabelText(textEl, labelText);\n }\n\n (currValue == null ? initProps : updateProps)(textEl, {}, animatableModel, dataIndex, null, during);\n}","/**\n * Provide orbit control for 3D objects\n *\n * @module echarts-gl/util/OrbitControl\n * @author Yi Shen(http://github.com/pissang)\n */\n\n// TODO Remove magic numbers on sensitivity\nimport Base from 'claygl/src/core/Base';\nimport Vector2 from 'claygl/src/math/Vector2';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Quaternion from 'claygl/src/math/Quaternion';\nimport retrieve from './retrieve';\nvar firstNotNull = retrieve.firstNotNull;\n\n\nvar MOUSE_BUTTON_KEY_MAP = {\n left: 0,\n middle: 1,\n right: 2\n};\n\nfunction convertToArray(val) {\n if (!(val instanceof Array)) {\n val = [val, val];\n }\n return val;\n}\n\n/**\n * @alias module:echarts-x/util/OrbitControl\n */\nvar OrbitControl = Base.extend(function () {\n\n return {\n /**\n * @type {module:zrender~ZRender}\n */\n zr: null,\n\n /**\n * @type {module:echarts-gl/core/ViewGL}\n */\n viewGL: null,\n\n /**\n * @type {clay.math.Vector3}\n */\n _center: new Vector3(),\n\n /**\n * Minimum distance to the center\n * Only available when camera is perspective.\n * @type {number}\n * @default 0.5\n */\n minDistance: 0.5,\n\n /**\n * Maximum distance to the center\n * Only available when camera is perspective.\n * @type {number}\n * @default 2\n */\n maxDistance: 1.5,\n\n /**\n * Only available when camera is orthographic\n */\n maxOrthographicSize: 300,\n\n /**\n * Only available when camera is orthographic\n */\n minOrthographicSize: 30,\n\n /**\n * Minimum alpha rotation\n */\n minAlpha: -90,\n\n /**\n * Maximum alpha rotation\n */\n maxAlpha: 90,\n\n /**\n * Minimum beta rotation\n */\n minBeta: -Infinity,\n /**\n * Maximum beta rotation\n */\n maxBeta: Infinity,\n\n /**\n * Start auto rotating after still for the given time\n */\n autoRotateAfterStill: 0,\n\n /**\n * Direction of autoRotate. cw or ccw when looking top down.\n */\n autoRotateDirection: 'cw',\n\n /**\n * Degree per second\n */\n autoRotateSpeed: 60,\n\n /**\n * @param {number}\n */\n damping: 0.8,\n\n /**\n * @param {number}\n */\n rotateSensitivity: 1,\n\n /**\n * @param {number}\n */\n zoomSensitivity: 1,\n\n /**\n * @param {number}\n */\n panSensitivity: 1,\n\n panMouseButton: 'middle',\n rotateMouseButton: 'left',\n\n /**\n * Pan or rotate\n * @private\n * @type {String}\n */\n _mode: 'rotate',\n\n /**\n * @private\n * @type {clay.Camera}\n */\n _camera: null,\n\n _needsUpdate: false,\n\n _rotating: false,\n\n // Rotation around yAxis in radian\n _phi: 0,\n // Rotation around xAxis in radian\n _theta: 0,\n\n _mouseX: 0,\n _mouseY: 0,\n\n _rotateVelocity: new Vector2(),\n\n _panVelocity: new Vector2(),\n\n _distance: 500,\n\n _zoomSpeed: 0,\n\n _stillTimeout: 0,\n\n _animators: []\n };\n}, function () {\n // Each OrbitControl has it's own handler\n ['_mouseDownHandler', '_mouseWheelHandler', '_mouseMoveHandler', '_mouseUpHandler',\n '_pinchHandler', '_contextMenuHandler', '_update'].forEach(function (hdlName) {\n this[hdlName] = this[hdlName].bind(this);\n }, this);\n}, {\n /**\n * Initialize.\n * Mouse event binding\n */\n init: function () {\n var zr = this.zr;\n\n if (zr) {\n zr.on('mousedown', this._mouseDownHandler);\n zr.on('globalout', this._mouseUpHandler);\n zr.on('mousewheel', this._mouseWheelHandler);\n zr.on('pinch', this._pinchHandler);\n\n zr.animation.on('frame', this._update);\n\n zr.dom.addEventListener('contextmenu', this._contextMenuHandler);\n }\n },\n\n /**\n * Dispose.\n * Mouse event unbinding\n */\n dispose: function () {\n var zr = this.zr;\n\n if (zr) {\n zr.off('mousedown', this._mouseDownHandler);\n zr.off('mousemove', this._mouseMoveHandler);\n zr.off('mouseup', this._mouseUpHandler);\n zr.off('mousewheel', this._mouseWheelHandler);\n zr.off('pinch', this._pinchHandler);\n zr.off('globalout', this._mouseUpHandler);\n zr.dom.removeEventListener('contextmenu', this._contextMenuHandler);\n\n zr.animation.off('frame', this._update);\n }\n this.stopAllAnimation();\n },\n\n /**\n * Get distance\n * @return {number}\n */\n getDistance: function () {\n return this._distance;\n },\n\n /**\n * Set distance\n * @param {number} distance\n */\n setDistance: function (distance) {\n this._distance = distance;\n this._needsUpdate = true;\n },\n\n /**\n * Get size of orthographic viewing volume\n * @return {number}\n */\n getOrthographicSize: function () {\n return this._orthoSize;\n },\n\n /**\n * Set size of orthographic viewing volume\n * @param {number} size\n */\n setOrthographicSize: function (size) {\n this._orthoSize = size;\n this._needsUpdate = true;\n },\n\n /**\n * Get alpha rotation\n * Alpha angle for top-down rotation. Positive to rotate to top.\n *\n * Which means camera rotation around x axis.\n */\n getAlpha: function () {\n return this._theta / Math.PI * 180;\n },\n\n /**\n * Get beta rotation\n * Beta angle for left-right rotation. Positive to rotate to right.\n *\n * Which means camera rotation around y axis.\n */\n getBeta: function () {\n return -this._phi / Math.PI * 180;\n },\n\n /**\n * Get control center\n * @return {Array.}\n */\n getCenter: function () {\n return this._center.toArray();\n },\n\n /**\n * Set alpha rotation angle\n * @param {number} alpha\n */\n setAlpha: function (alpha) {\n alpha = Math.max(Math.min(this.maxAlpha, alpha), this.minAlpha);\n\n this._theta = alpha / 180 * Math.PI;\n this._needsUpdate = true;\n },\n\n /**\n * Set beta rotation angle\n * @param {number} beta\n */\n setBeta: function (beta) {\n beta = Math.max(Math.min(this.maxBeta, beta), this.minBeta);\n\n this._phi = -beta / 180 * Math.PI;\n this._needsUpdate = true;\n },\n\n /**\n * Set control center\n * @param {Array.} center\n */\n setCenter: function (centerArr) {\n this._center.setArray(centerArr);\n },\n\n /**\n * @param {module:echarts-gl/core/ViewGL} viewGL\n */\n setViewGL: function (viewGL) {\n this.viewGL = viewGL;\n },\n\n /**\n * @return {clay.Camera}\n */\n getCamera: function () {\n return this.viewGL.camera;\n },\n\n setFromViewControlModel: function (viewControlModel, extraOpts) {\n extraOpts = extraOpts || {};\n var baseDistance = extraOpts.baseDistance || 0;\n var baseOrthoSize = extraOpts.baseOrthoSize || 1;\n\n var projection = viewControlModel.get('projection');\n if (projection !== 'perspective' && projection !== 'orthographic' && projection !== 'isometric') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Unkown projection type %s, use perspective projection instead.', projection);\n }\n projection = 'perspective';\n }\n this._projection = projection;\n this.viewGL.setProjection(projection);\n\n var targetDistance = viewControlModel.get('distance') + baseDistance;\n var targetOrthographicSize = viewControlModel.get('orthographicSize') + baseOrthoSize;\n\n [\n ['damping', 0.8],\n ['autoRotate', false],\n ['autoRotateAfterStill', 3],\n ['autoRotateDirection', 'cw'],\n ['autoRotateSpeed', 10],\n ['minDistance', 30],\n ['maxDistance', 400],\n ['minOrthographicSize', 30],\n ['maxOrthographicSize', 300],\n ['minAlpha', -90],\n ['maxAlpha', 90],\n ['minBeta', -Infinity],\n ['maxBeta', Infinity],\n ['rotateSensitivity', 1],\n ['zoomSensitivity', 1],\n ['panSensitivity', 1],\n ['panMouseButton', 'left'],\n ['rotateMouseButton', 'middle'],\n ].forEach(function (prop) {\n this[prop[0]] = firstNotNull(viewControlModel.get(prop[0]), prop[1]);\n }, this);\n\n this.minDistance += baseDistance;\n this.maxDistance += baseDistance;\n this.minOrthographicSize += baseOrthoSize,\n this.maxOrthographicSize += baseOrthoSize;\n\n var ecModel = viewControlModel.ecModel;\n\n var animationOpts = {};\n ['animation', 'animationDurationUpdate', 'animationEasingUpdate'].forEach(function (key) {\n animationOpts[key] = firstNotNull(\n viewControlModel.get(key), ecModel && ecModel.get(key)\n );\n });\n\n var alpha = firstNotNull(extraOpts.alpha, viewControlModel.get('alpha')) || 0;\n var beta = firstNotNull(extraOpts.beta, viewControlModel.get('beta')) || 0;\n var center = firstNotNull(extraOpts.center, viewControlModel.get('center')) || [0, 0, 0];\n if (animationOpts.animation && animationOpts.animationDurationUpdate > 0 && this._notFirst) {\n this.animateTo({\n alpha: alpha,\n beta: beta,\n center: center,\n distance: targetDistance,\n orthographicSize: targetOrthographicSize,\n easing: animationOpts.animationEasingUpdate,\n duration: animationOpts.animationDurationUpdate\n });\n }\n else {\n this.setDistance(targetDistance);\n this.setAlpha(alpha);\n this.setBeta(beta);\n this.setCenter(center);\n this.setOrthographicSize(targetOrthographicSize);\n }\n\n this._notFirst = true;\n\n this._validateProperties();\n },\n\n _validateProperties: function () {\n if (process.env.NODE_ENV !== 'production') {\n if (MOUSE_BUTTON_KEY_MAP[this.panMouseButton] == null) {\n console.error('Unkown panMouseButton %s. It should be left|middle|right', this.panMouseButton);\n }\n if (MOUSE_BUTTON_KEY_MAP[this.rotateMouseButton] == null) {\n console.error('Unkown rotateMouseButton %s. It should be left|middle|right', this.rotateMouseButton);\n }\n if (this.autoRotateDirection !== 'cw' && this.autoRotateDirection !== 'ccw') {\n console.error('Unkown autoRotateDirection %s. It should be cw|ccw', this.autoRotateDirection);\n }\n }\n },\n\n /**\n * @param {Object} opts\n * @param {number} opts.distance\n * @param {number} opts.alpha\n * @param {number} opts.beta\n * @param {number} opts.orthographicSize\n * @param {number} [opts.duration=1000]\n * @param {number} [opts.easing='linear']\n */\n animateTo: function (opts) {\n var zr = this.zr;\n var self = this;\n\n var obj = {};\n var target = {};\n\n if (opts.distance != null) {\n obj.distance = this.getDistance();\n target.distance = opts.distance;\n }\n if (opts.orthographicSize != null) {\n obj.orthographicSize = this.getOrthographicSize();\n target.orthographicSize = opts.orthographicSize;\n }\n if (opts.alpha != null) {\n obj.alpha = this.getAlpha();\n target.alpha = opts.alpha;\n }\n if (opts.beta != null) {\n obj.beta = this.getBeta();\n target.beta = opts.beta;\n }\n if (opts.center != null) {\n obj.center = this.getCenter();\n target.center = opts.center;\n }\n\n return this._addAnimator(\n zr.animation.animate(obj)\n .when(opts.duration || 1000, target)\n .during(function () {\n if (obj.alpha != null) {\n self.setAlpha(obj.alpha);\n }\n if (obj.beta != null) {\n self.setBeta(obj.beta);\n }\n if (obj.distance != null) {\n self.setDistance(obj.distance);\n }\n if (obj.center != null) {\n self.setCenter(obj.center);\n }\n if (obj.orthographicSize != null) {\n self.setOrthographicSize(obj.orthographicSize);\n }\n self._needsUpdate = true;\n })\n ).start(opts.easing || 'linear');\n },\n\n /**\n * Stop all animation\n */\n stopAllAnimation: function () {\n for (var i = 0; i < this._animators.length; i++) {\n this._animators[i].stop();\n }\n this._animators.length = 0;\n },\n\n update: function () {\n this._needsUpdate = true;\n this._update(20);\n },\n\n _isAnimating: function () {\n return this._animators.length > 0;\n },\n /**\n * Call update each frame\n * @param {number} deltaTime Frame time\n */\n _update: function (deltaTime) {\n\n if (this._rotating) {\n var radian = (this.autoRotateDirection === 'cw' ? 1 : -1)\n * this.autoRotateSpeed / 180 * Math.PI;\n this._phi -= radian * deltaTime / 1000;\n this._needsUpdate = true;\n }\n else if (this._rotateVelocity.len() > 0) {\n this._needsUpdate = true;\n }\n\n if (Math.abs(this._zoomSpeed) > 0.1 || this._panVelocity.len() > 0) {\n this._needsUpdate = true;\n }\n\n if (!this._needsUpdate) {\n return;\n }\n\n deltaTime = Math.min(deltaTime, 50);\n\n this._updateDistanceOrSize(deltaTime);\n\n this._updatePan(deltaTime);\n\n this._updateRotate(deltaTime);\n\n this._updateTransform();\n\n this.getCamera().update();\n\n this.zr && this.zr.refresh();\n\n this.trigger('update');\n\n this._needsUpdate = false;\n },\n\n _updateRotate: function (deltaTime) {\n var velocity = this._rotateVelocity;\n this._phi = velocity.y * deltaTime / 20 + this._phi;\n this._theta = velocity.x * deltaTime / 20 + this._theta;\n\n this.setAlpha(this.getAlpha());\n this.setBeta(this.getBeta());\n\n this._vectorDamping(velocity, Math.pow(this.damping, deltaTime / 16));\n },\n\n _updateDistanceOrSize: function (deltaTime) {\n if (this._projection === 'perspective') {\n this._setDistance(this._distance + this._zoomSpeed * deltaTime / 20);\n }\n else {\n this._setOrthoSize(this._orthoSize + this._zoomSpeed * deltaTime / 20);\n }\n\n this._zoomSpeed *= Math.pow(this.damping, deltaTime / 16);\n },\n\n\n _setDistance: function (distance) {\n this._distance = Math.max(Math.min(distance, this.maxDistance), this.minDistance);\n },\n\n _setOrthoSize: function (size) {\n this._orthoSize = Math.max(Math.min(size, this.maxOrthographicSize), this.minOrthographicSize);\n var camera = this.getCamera();\n var cameraHeight = this._orthoSize;\n var cameraWidth = cameraHeight / this.viewGL.viewport.height * this.viewGL.viewport.width;\n camera.left = -cameraWidth / 2;\n camera.right = cameraWidth / 2;\n camera.top = cameraHeight / 2;\n camera.bottom = -cameraHeight / 2;\n },\n\n _updatePan: function (deltaTime) {\n\n var velocity = this._panVelocity;\n var len = this._distance;\n\n var target = this.getCamera();\n var yAxis = target.worldTransform.y;\n var xAxis = target.worldTransform.x;\n\n // PENDING\n this._center\n .scaleAndAdd(xAxis, -velocity.x * len / 200)\n .scaleAndAdd(yAxis, -velocity.y * len / 200);\n\n this._vectorDamping(velocity, 0);\n },\n\n _updateTransform: function () {\n var camera = this.getCamera();\n\n var dir = new Vector3();\n var theta = this._theta + Math.PI / 2;\n var phi = this._phi + Math.PI / 2;\n var r = Math.sin(theta);\n\n dir.x = r * Math.cos(phi);\n dir.y = -Math.cos(theta);\n dir.z = r * Math.sin(phi);\n\n camera.position.copy(this._center).scaleAndAdd(dir, this._distance);\n camera.rotation.identity()\n // First around y, then around x\n .rotateY(-this._phi)\n .rotateX(-this._theta);\n },\n\n _startCountingStill: function () {\n clearTimeout(this._stillTimeout);\n\n var time = this.autoRotateAfterStill;\n var self = this;\n if (!isNaN(time) && time > 0) {\n this._stillTimeout = setTimeout(function () {\n self._rotating = true;\n }, time * 1000);\n }\n },\n\n _vectorDamping: function (v, damping) {\n var speed = v.len();\n speed = speed * damping;\n if (speed < 1e-4) {\n speed = 0;\n }\n v.normalize().scale(speed);\n },\n\n _decomposeTransform: function () {\n if (!this.getCamera()) {\n return;\n }\n\n this.getCamera().updateWorldTransform();\n\n var forward = this.getCamera().worldTransform.z;\n var alpha = Math.asin(forward.y);\n var beta = Math.atan2(forward.x, forward.z);\n\n this._theta = alpha;\n this._phi = -beta;\n\n this.setBeta(this.getBeta());\n this.setAlpha(this.getAlpha());\n\n // Is perspective\n if (this.getCamera().aspect) {\n this._setDistance(this.getCamera().position.dist(this._center));\n }\n else {\n this._setOrthoSize(this.getCamera().top - this.getCamera().bottom);\n }\n },\n\n _mouseDownHandler: function (e) {\n if (e.target) {\n // If mouseon some zrender element.\n return;\n }\n if (this._isAnimating()) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY;\n if (this.viewGL && !this.viewGL.containPoint(x, y)) {\n return;\n }\n\n this.zr.on('mousemove', this._mouseMoveHandler);\n this.zr.on('mouseup', this._mouseUpHandler);\n\n if (e.event.targetTouches) {\n if (e.event.targetTouches.length === 1) {\n this._mode = 'rotate';\n }\n }\n else {\n if (e.event.button === MOUSE_BUTTON_KEY_MAP[this.rotateMouseButton]) {\n this._mode = 'rotate';\n }\n else if (e.event.button === MOUSE_BUTTON_KEY_MAP[this.panMouseButton]) {\n this._mode = 'pan';\n }\n else {\n this._mode = '';\n }\n }\n\n // Reset rotate velocity\n this._rotateVelocity.set(0, 0);\n this._rotating = false;\n if (this.autoRotate) {\n this._startCountingStill();\n }\n\n this._mouseX = e.offsetX;\n this._mouseY = e.offsetY;\n },\n\n _mouseMoveHandler: function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n if (this._isAnimating()) {\n return;\n }\n\n var panSensitivity = convertToArray(this.panSensitivity);\n var rotateSensitivity = convertToArray(this.rotateSensitivity);\n\n if (this._mode === 'rotate') {\n this._rotateVelocity.y = (e.offsetX - this._mouseX) / this.zr.getHeight() * 2 * rotateSensitivity[0];\n this._rotateVelocity.x = (e.offsetY - this._mouseY) / this.zr.getWidth() * 2 * rotateSensitivity[1];\n }\n else if (this._mode === 'pan') {\n this._panVelocity.x = (e.offsetX - this._mouseX) / this.zr.getWidth() * panSensitivity[0] * 400;\n this._panVelocity.y = (-e.offsetY + this._mouseY) / this.zr.getHeight() * panSensitivity[1] * 400;\n }\n\n\n this._mouseX = e.offsetX;\n this._mouseY = e.offsetY;\n\n e.event.preventDefault();\n },\n\n _mouseWheelHandler: function (e) {\n if (this._isAnimating()) {\n return;\n }\n var delta = e.event.wheelDelta // Webkit\n || -e.event.detail; // Firefox\n this._zoomHandler(e, delta);\n },\n\n _pinchHandler: function (e) {\n if (this._isAnimating()) {\n return;\n }\n this._zoomHandler(e, e.pinchScale > 1 ? 1 : -1);\n // Not rotate when pinch\n this._mode = '';\n },\n\n _zoomHandler: function (e, delta) {\n if (delta === 0) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY;\n if (this.viewGL && !this.viewGL.containPoint(x, y)) {\n return;\n }\n\n var speed;\n if (this._projection === 'perspective') {\n speed = Math.max(Math.max(Math.min(\n this._distance - this.minDistance,\n this.maxDistance - this._distance\n )) / 20, 0.5);\n }\n else {\n speed = Math.max(Math.max(Math.min(\n this._orthoSize - this.minOrthographicSize,\n this.maxOrthographicSize - this._orthoSize\n )) / 20, 0.5);\n }\n this._zoomSpeed = (delta > 0 ? -1 : 1) * speed * this.zoomSensitivity;\n\n this._rotating = false;\n\n if (this.autoRotate && this._mode === 'rotate') {\n this._startCountingStill();\n }\n\n e.event.preventDefault();\n },\n\n _mouseUpHandler: function () {\n this.zr.off('mousemove', this._mouseMoveHandler);\n this.zr.off('mouseup', this._mouseUpHandler);\n },\n\n _isRightMouseButtonUsed: function () {\n return this.rotateMouseButton === 'right'\n || this.panMouseButton === 'right';\n },\n\n _contextMenuHandler: function (e) {\n if (this._isRightMouseButtonUsed()) {\n e.preventDefault();\n }\n },\n\n _addAnimator: function (animator) {\n var animators = this._animators;\n animators.push(animator);\n animator.done(function () {\n var idx = animators.indexOf(animator);\n if (idx >= 0) {\n animators.splice(idx, 1);\n }\n });\n return animator;\n }\n});\n\n/**\n * If auto rotate the target\n * @type {boolean}\n * @default false\n */\nObject.defineProperty(OrbitControl.prototype, 'autoRotate', {\n get: function (val) {\n return this._autoRotate;\n },\n set: function (val) {\n this._autoRotate = val;\n this._rotating = val;\n }\n});\n\n\nexport default OrbitControl;","export default {\n convertToDynamicArray: function (clear) {\n if (clear) {\n this.resetOffset();\n }\n var attributes = this.attributes;\n for (var name in attributes) {\n if (clear || !attributes[name].value) {\n attributes[name].value = [];\n }\n else {\n attributes[name].value = Array.prototype.slice.call(attributes[name].value);\n }\n }\n if (clear || !this.indices) {\n this.indices = [];\n }\n else {\n this.indices = Array.prototype.slice.call(this.indices);\n }\n },\n\n convertToTypedArray: function () {\n var attributes = this.attributes;\n for (var name in attributes) {\n if (attributes[name].value && attributes[name].value.length > 0) {\n attributes[name].value = new Float32Array(attributes[name].value);\n }\n else {\n attributes[name].value = null;\n }\n }\n if (this.indices && this.indices.length > 0) {\n this.indices = this.vertexCount > 0xffff ? new Uint32Array(this.indices) : new Uint16Array(this.indices);\n }\n\n this.dirty();\n }\n};","/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.2.2\n */\n\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport vec2 from './vec2';\nimport vec3 from './vec3';\nimport vec4 from './vec4';\nimport mat2 from './mat2';\nimport mat2d from './mat2d';\nimport mat3 from './mat3';\nimport mat4 from './mat4';\nimport quat from './quat';\n\nexport default {\n vec2: vec2,\n vec3: vec3,\n vec4: vec4,\n mat2: mat2,\n mat2d: mat2d,\n mat3: mat3,\n mat4: mat4,\n quat: quat\n};\n","// DEPRECATED\nimport glmatrix from '../glmatrix';\n\nexport default glmatrix;\n","/**\n * Lines geometry\n * Use screen space projected lines lineWidth > MAX_LINE_WIDTH\n * https://mattdesl.svbtle.com/drawing-lines-is-hard\n * @module echarts-gl/util/geometry/LinesGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\nimport dynamicConvertMixin from './dynamicConvertMixin';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\n// var CURVE_RECURSION_LIMIT = 8;\n// var CURVE_COLLINEAR_EPSILON = 40;\n\nvar sampleLinePoints = [[0, 0], [1, 1]];\n/**\n * @constructor\n * @alias module:echarts-gl/util/geometry/LinesGeometry\n * @extends clay.Geometry\n */\n\nvar LinesGeometry = Geometry.extend(function () {\n return {\n\n segmentScale: 1,\n\n dynamic: true,\n /**\n * Need to use mesh to expand lines if lineWidth > MAX_LINE_WIDTH\n */\n useNativeLine: true,\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION'),\n positionPrev: new Geometry.Attribute('positionPrev', 'float', 3),\n positionNext: new Geometry.Attribute('positionNext', 'float', 3),\n prevPositionPrev: new Geometry.Attribute('prevPositionPrev', 'float', 3),\n prevPosition: new Geometry.Attribute('prevPosition', 'float', 3),\n prevPositionNext: new Geometry.Attribute('prevPositionNext', 'float', 3),\n offset: new Geometry.Attribute('offset', 'float', 1),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR')\n }\n };\n},\n/** @lends module: echarts-gl/util/geometry/LinesGeometry.prototype */\n{\n\n /**\n * Reset offset\n */\n resetOffset: function () {\n this._vertexOffset = 0;\n this._triangleOffset = 0;\n\n this._itemVertexOffsets = [];\n },\n\n /**\n * @param {number} nVertex\n */\n setVertexCount: function (nVertex) {\n var attributes = this.attributes;\n if (this.vertexCount !== nVertex) {\n attributes.position.init(nVertex);\n attributes.color.init(nVertex);\n\n if (!this.useNativeLine) {\n attributes.positionPrev.init(nVertex);\n attributes.positionNext.init(nVertex);\n attributes.offset.init(nVertex);\n }\n\n if (nVertex > 0xffff) {\n if (this.indices instanceof Uint16Array) {\n this.indices = new Uint32Array(this.indices);\n }\n }\n else {\n if (this.indices instanceof Uint32Array) {\n this.indices = new Uint16Array(this.indices);\n }\n }\n }\n },\n\n /**\n * @param {number} nTriangle\n */\n setTriangleCount: function (nTriangle) {\n if (this.triangleCount !== nTriangle) {\n if (nTriangle === 0) {\n this.indices = null;\n }\n else {\n this.indices = this.vertexCount > 0xffff ? new Uint32Array(nTriangle * 3) : new Uint16Array(nTriangle * 3);\n }\n }\n },\n\n _getCubicCurveApproxStep: function (p0, p1, p2, p3) {\n var len = vec3.dist(p0, p1) + vec3.dist(p2, p1) + vec3.dist(p3, p2);\n var step = 1 / (len + 1) * this.segmentScale;\n return step;\n },\n\n /**\n * Get vertex count of cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @return number\n */\n getCubicCurveVertexCount: function (p0, p1, p2, p3) {\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n var segCount = Math.ceil(1 / step);\n if (!this.useNativeLine) {\n return segCount * 2 + 2;\n }\n else {\n return segCount * 2;\n }\n },\n\n /**\n * Get face count of cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @return number\n */\n getCubicCurveTriangleCount: function (p0, p1, p2, p3) {\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n var segCount = Math.ceil(1 / step);\n if (!this.useNativeLine) {\n return segCount * 2;\n }\n else {\n return 0;\n }\n },\n\n /**\n * Get vertex count of line\n * @return {number}\n */\n getLineVertexCount: function () {\n return this.getPolylineVertexCount(sampleLinePoints);\n },\n\n /**\n * Get face count of line\n * @return {number}\n */\n getLineTriangleCount: function () {\n return this.getPolylineTriangleCount(sampleLinePoints);\n },\n\n /**\n * Get how many vertices will polyline take.\n * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount.\n * @return {number}\n */\n getPolylineVertexCount: function (points) {\n var pointsLen;\n if (typeof points === 'number') {\n pointsLen = points;\n }\n else {\n var is2DArray = typeof points[0] !== 'number';\n pointsLen = is2DArray ? points.length : (points.length / 3);\n }\n return !this.useNativeLine ? ((pointsLen - 1) * 2 + 2) : (pointsLen - 1) * 2;\n },\n\n /**\n * Get how many triangles will polyline take.\n * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount.\n * @return {number}\n */\n getPolylineTriangleCount: function (points) {\n var pointsLen;\n if (typeof points === 'number') {\n pointsLen = points;\n }\n else {\n var is2DArray = typeof points[0] !== 'number';\n pointsLen = is2DArray ? points.length : (points.length / 3);\n }\n return !this.useNativeLine ? Math.max(pointsLen - 1, 0) * 2 : 0;\n },\n\n /**\n * Add a cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @param {Array.} color\n * @param {number} [lineWidth=1]\n */\n addCubicCurve: function (p0, p1, p2, p3, color, lineWidth) {\n if (lineWidth == null) {\n lineWidth = 1;\n }\n // incremental interpolation\n // http://antigrain.com/research/bezier_interpolation/index.html#PAGE_BEZIER_INTERPOLATION\n var x0 = p0[0], y0 = p0[1], z0 = p0[2];\n var x1 = p1[0], y1 = p1[1], z1 = p1[2];\n var x2 = p2[0], y2 = p2[1], z2 = p2[2];\n var x3 = p3[0], y3 = p3[1], z3 = p3[2];\n\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n\n var step2 = step * step;\n var step3 = step2 * step;\n\n var pre1 = 3.0 * step;\n var pre2 = 3.0 * step2;\n var pre4 = 6.0 * step2;\n var pre5 = 6.0 * step3;\n\n var tmp1x = x0 - x1 * 2.0 + x2;\n var tmp1y = y0 - y1 * 2.0 + y2;\n var tmp1z = z0 - z1 * 2.0 + z2;\n\n var tmp2x = (x1 - x2) * 3.0 - x0 + x3;\n var tmp2y = (y1 - y2) * 3.0 - y0 + y3;\n var tmp2z = (z1 - z2) * 3.0 - z0 + z3;\n\n var fx = x0;\n var fy = y0;\n var fz = z0;\n\n var dfx = (x1 - x0) * pre1 + tmp1x * pre2 + tmp2x * step3;\n var dfy = (y1 - y0) * pre1 + tmp1y * pre2 + tmp2y * step3;\n var dfz = (z1 - z0) * pre1 + tmp1z * pre2 + tmp2z * step3;\n\n var ddfx = tmp1x * pre4 + tmp2x * pre5;\n var ddfy = tmp1y * pre4 + tmp2y * pre5;\n var ddfz = tmp1z * pre4 + tmp2z * pre5;\n\n var dddfx = tmp2x * pre5;\n var dddfy = tmp2y * pre5;\n var dddfz = tmp2z * pre5;\n\n var t = 0;\n\n var k = 0;\n var segCount = Math.ceil(1 / step);\n\n var points = new Float32Array((segCount + 1) * 3);\n var points = [];\n var offset = 0;\n for (var k = 0; k < segCount + 1; k++) {\n points[offset++] = fx;\n points[offset++] = fy;\n points[offset++] = fz;\n\n fx += dfx; fy += dfy; fz += dfz;\n dfx += ddfx; dfy += ddfy; dfz += ddfz;\n ddfx += dddfx; ddfy += dddfy; ddfz += dddfz;\n t += step;\n\n if (t > 1) {\n fx = dfx > 0 ? Math.min(fx, x3) : Math.max(fx, x3);\n fy = dfy > 0 ? Math.min(fy, y3) : Math.max(fy, y3);\n fz = dfz > 0 ? Math.min(fz, z3) : Math.max(fz, z3);\n }\n }\n\n return this.addPolyline(points, color, lineWidth);\n },\n\n /**\n * Add a straight line\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} color\n * @param {number} [lineWidth=1]\n */\n addLine: function (p0, p1, color, lineWidth) {\n return this.addPolyline([p0, p1], color, lineWidth);\n },\n\n /**\n * Add a straight line\n * @param {Array. | Array.} points\n * @param {Array. | Array.} color\n * @param {number} [lineWidth=1]\n * @param {number} [startOffset=0]\n * @param {number} [pointsCount] Default to be amount of points in the first argument\n */\n addPolyline: function (points, color, lineWidth, startOffset, pointsCount) {\n if (!points.length) {\n return;\n }\n var is2DArray = typeof points[0] !== 'number';\n if (pointsCount == null) {\n pointsCount = is2DArray ? points.length : points.length / 3;\n }\n if (pointsCount < 2) {\n return;\n }\n if (startOffset == null) {\n startOffset = 0;\n }\n if (lineWidth == null) {\n lineWidth = 1;\n }\n\n this._itemVertexOffsets.push(this._vertexOffset);\n\n var is2DArray = typeof points[0] !== 'number';\n var notSharingColor = is2DArray\n ? typeof color[0] !== 'number'\n : color.length / 4 === pointsCount;\n\n var positionAttr = this.attributes.position;\n var positionPrevAttr = this.attributes.positionPrev;\n var positionNextAttr = this.attributes.positionNext;\n var colorAttr = this.attributes.color;\n var offsetAttr = this.attributes.offset;\n var indices = this.indices;\n\n var vertexOffset = this._vertexOffset;\n var point;\n var pointColor;\n\n lineWidth = Math.max(lineWidth, 0.01);\n\n for (var k = startOffset; k < pointsCount; k++) {\n if (is2DArray) {\n point = points[k];\n if (notSharingColor) {\n pointColor = color[k];\n }\n else {\n pointColor = color;\n }\n }\n else {\n var k3 = k * 3;\n point = point || [];\n point[0] = points[k3];\n point[1] = points[k3 + 1];\n point[2] = points[k3 + 2];\n\n if (notSharingColor) {\n var k4 = k * 4;\n pointColor = pointColor || [];\n pointColor[0] = color[k4];\n pointColor[1] = color[k4 + 1];\n pointColor[2] = color[k4 + 2];\n pointColor[3] = color[k4 + 3];\n }\n else {\n pointColor = color;\n }\n }\n if (!this.useNativeLine) {\n if (k < pointsCount - 1) {\n // Set to next two points\n positionPrevAttr.set(vertexOffset + 2, point);\n positionPrevAttr.set(vertexOffset + 3, point);\n }\n if (k > 0) {\n // Set to previous two points\n positionNextAttr.set(vertexOffset - 2, point);\n positionNextAttr.set(vertexOffset - 1, point);\n }\n\n positionAttr.set(vertexOffset, point);\n positionAttr.set(vertexOffset + 1, point);\n\n colorAttr.set(vertexOffset, pointColor);\n colorAttr.set(vertexOffset + 1, pointColor);\n\n offsetAttr.set(vertexOffset, lineWidth / 2);\n offsetAttr.set(vertexOffset + 1, -lineWidth / 2);\n\n vertexOffset += 2;\n }\n else {\n if (k > 1) {\n positionAttr.copy(vertexOffset, vertexOffset - 1);\n colorAttr.copy(vertexOffset, vertexOffset - 1);\n vertexOffset++;\n }\n }\n\n if (!this.useNativeLine) {\n if (k > 0) {\n var idx3 = this._triangleOffset * 3;\n var indices = this.indices;\n // 0-----2\n // 1-----3\n // 0->1->2, 1->3->2\n indices[idx3] = vertexOffset - 4;\n indices[idx3 + 1] = vertexOffset - 3;\n indices[idx3 + 2] = vertexOffset - 2;\n\n indices[idx3 + 3] = vertexOffset - 3;\n indices[idx3 + 4] = vertexOffset - 1;\n indices[idx3 + 5] = vertexOffset - 2;\n\n this._triangleOffset += 2;\n }\n }\n else {\n colorAttr.set(vertexOffset, pointColor);\n positionAttr.set(vertexOffset, point);\n vertexOffset++;\n }\n }\n if (!this.useNativeLine) {\n var start = this._vertexOffset;\n var end = this._vertexOffset + pointsCount * 2;\n positionPrevAttr.copy(start, start + 2);\n positionPrevAttr.copy(start + 1, start + 3);\n positionNextAttr.copy(end - 1, end - 3);\n positionNextAttr.copy(end - 2, end - 4);\n }\n\n this._vertexOffset = vertexOffset;\n\n return this._vertexOffset;\n },\n\n /**\n * Set color of single line.\n */\n setItemColor: function (idx, color) {\n var startOffset = this._itemVertexOffsets[idx];\n var endOffset = idx < this._itemVertexOffsets.length - 1 ? this._itemVertexOffsets[idx + 1] : this._vertexOffset;\n\n for (var i = startOffset; i < endOffset; i++) {\n this.attributes.color.set(i, color);\n }\n this.dirty('color');\n },\n\n /**\n * @return {number}\n */\n currentTriangleOffset: function () {\n return this._triangleOffset;\n },\n\n /**\n * @return {number}\n */\n currentVertexOffset: function () {\n return this._vertexOffset;\n }\n});\n\necharts.util.defaults(LinesGeometry.prototype, dynamicConvertMixin);\n\nexport default LinesGeometry;","/**\n * Texture Atlas for the sprites.\n * It uses zrender for 2d element management and rendering\n * @module echarts-gl/util/ZRTextureAtlasSurface\n */\n\n// TODO Expand.\nimport * as echarts from 'echarts/lib/echarts';\nimport Texture2D from 'claygl/src/Texture2D';\n\nfunction ZRTextureAtlasSurfaceNode(zr, offsetX, offsetY, width, height, gap, dpr) {\n this._zr = zr;\n\n /**\n * Current cursor x\n * @type {number}\n * @private\n */\n this._x = 0;\n\n /**\n * Current cursor y\n * @type {number}\n */\n this._y = 0;\n\n this._rowHeight = 0;\n /**\n * width without dpr.\n * @type {number}\n * @private\n */\n this.width = width;\n\n /**\n * height without dpr.\n * @type {number}\n * @private\n */\n this.height = height;\n\n /**\n * offsetX without dpr\n * @type {number}\n */\n this.offsetX = offsetX;\n /**\n * offsetY without dpr\n * @type {number}\n */\n this.offsetY = offsetY;\n\n this.dpr = dpr;\n\n this.gap = gap;\n}\n\nZRTextureAtlasSurfaceNode.prototype = {\n\n constructor: ZRTextureAtlasSurfaceNode,\n\n clear: function () {\n this._x = 0;\n this._y = 0;\n this._rowHeight = 0;\n },\n\n /**\n * Add shape to atlas\n * @param {module:zrender/graphic/Displayable} shape\n * @param {number} width\n * @param {number} height\n * @return {Array}\n */\n add: function (el, width, height) {\n // FIXME Text element not consider textAlign and textVerticalAlign.\n\n // TODO, inner text, shadow\n var rect = el.getBoundingRect();\n\n // FIXME aspect ratio\n if (width == null) {\n width = rect.width;\n }\n if (height == null) {\n height = rect.height;\n }\n width *= this.dpr;\n height *= this.dpr;\n\n this._fitElement(el, width, height);\n\n // var aspect = el.scale[1] / el.scale[0];\n // Adjust aspect ratio to make the text more clearly\n // FIXME If height > width, width is useless ?\n // width = height * aspect;\n // el.position[0] *= aspect;\n // el.scale[0] = el.scale[1];\n\n var x = this._x;\n var y = this._y;\n\n var canvasWidth = this.width * this.dpr;\n var canvasHeight = this.height * this.dpr;\n var gap = this.gap;\n\n if (x + width + gap > canvasWidth) {\n // Change a new row\n x = this._x = 0;\n y += this._rowHeight + gap;\n this._y = y;\n // Reset row height\n this._rowHeight = 0;\n }\n\n this._x += width + gap;\n\n this._rowHeight = Math.max(this._rowHeight, height);\n\n if (y + height + gap > canvasHeight) {\n // There is no space anymore\n return null;\n }\n\n // Shift the el\n el.x += this.offsetX * this.dpr + x;\n el.y += this.offsetY * this.dpr + y;\n\n this._zr.add(el);\n\n var coordsOffset = [\n this.offsetX / this.width,\n this.offsetY / this.height\n ];\n var coords = [\n [x / canvasWidth + coordsOffset[0], y / canvasHeight + coordsOffset[1]],\n [(x + width) / canvasWidth + coordsOffset[0], (y + height) / canvasHeight + coordsOffset[1]]\n ];\n\n return coords;\n },\n\n /**\n * Fit element size by correct its position and scaling\n * @param {module:zrender/graphic/Displayable} el\n * @param {number} spriteWidth\n * @param {number} spriteHeight\n */\n _fitElement: function (el, spriteWidth, spriteHeight) {\n // TODO, inner text, shadow\n var rect = el.getBoundingRect();\n\n var scaleX = spriteWidth / rect.width;\n var scaleY = spriteHeight / rect.height;\n el.x = -rect.x * scaleX;\n el.y = -rect.y * scaleY;\n el.scaleX = scaleX;\n el.scaleY = scaleY;\n el.update();\n }\n}\n/**\n * constructor\n * @alias module:echarts-gl/util/ZRTextureAtlasSurface\n * @param {number} opt.width\n * @param {number} opt.height\n * @param {number} opt.devicePixelRatio\n * @param {number} opt.gap Gap for safe.\n * @param {Function} opt.onupdate\n */\nfunction ZRTextureAtlasSurface (opt) {\n\n opt = opt || {};\n opt.width = opt.width || 512;\n opt.height = opt.height || 512;\n opt.devicePixelRatio = opt.devicePixelRatio || 1;\n opt.gap = opt.gap == null ? 2 : opt.gap;\n\n var canvas = document.createElement('canvas');\n canvas.width = opt.width * opt.devicePixelRatio;\n canvas.height = opt.height * opt.devicePixelRatio;\n\n this._canvas = canvas;\n\n this._texture = new Texture2D({\n image: canvas,\n flipY: false\n });\n\n var self = this;\n /**\n * zrender instance in the Chart\n * @type {zrender~ZRender}\n */\n this._zr = echarts.zrender.init(canvas);\n var oldRefreshImmediately = this._zr.refreshImmediately;\n this._zr.refreshImmediately = function () {\n oldRefreshImmediately.call(this);\n self._texture.dirty();\n self.onupdate && self.onupdate();\n };\n\n this._dpr = opt.devicePixelRatio;\n\n /**\n * Texture coords map for each sprite image\n * @type {Object}\n */\n this._coords = {};\n\n this.onupdate = opt.onupdate;\n\n this._gap = opt.gap;\n\n // Left sub atlas.\n this._textureAtlasNodes = [new ZRTextureAtlasSurfaceNode(\n this._zr, 0, 0, opt.width, opt.height, this._gap, this._dpr\n )];\n\n this._nodeWidth = opt.width;\n this._nodeHeight = opt.height;\n\n this._currentNodeIdx = 0;\n}\n\nZRTextureAtlasSurface.prototype = {\n\n /**\n * Clear the texture atlas\n */\n clear: function () {\n\n for (var i = 0; i < this._textureAtlasNodes.length; i++) {\n this._textureAtlasNodes[i].clear();\n }\n\n this._currentNodeIdx = 0;\n\n this._zr.clear();\n this._coords = {};\n },\n\n /**\n * @return {number}\n */\n getWidth: function () {\n return this._width;\n },\n\n /**\n * @return {number}\n */\n getHeight: function () {\n return this._height;\n },\n\n /**\n * @return {number}\n */\n getTexture: function () {\n return this._texture;\n },\n\n /**\n * @return {number}\n */\n getDevicePixelRatio: function () {\n return this._dpr;\n },\n\n getZr: function () {\n return this._zr;\n },\n\n _getCurrentNode: function () {\n return this._textureAtlasNodes[this._currentNodeIdx];\n },\n\n _expand: function () {\n this._currentNodeIdx++;\n if (this._textureAtlasNodes[this._currentNodeIdx]) {\n // Use the node created previously.\n return this._textureAtlasNodes[this._currentNodeIdx];\n }\n\n var maxSize = 4096 / this._dpr;\n var textureAtlasNodes = this._textureAtlasNodes;\n var nodeLen = textureAtlasNodes.length;\n var offsetX = (nodeLen * this._nodeWidth) % maxSize;\n var offsetY = Math.floor(nodeLen * this._nodeWidth / maxSize) * this._nodeHeight;\n if (offsetY >= maxSize) {\n // Failed if image is too large.\n if (process.env.NODE_ENV !== 'production') {\n console.error('Too much labels. Some will be ignored.');\n }\n return;\n }\n\n var width = (offsetX + this._nodeWidth) * this._dpr;\n var height = (offsetY + this._nodeHeight) * this._dpr;\n try {\n // Resize will error in node.\n this._zr.resize({\n width: width,\n height: height\n });\n }\n catch (e) {\n this._canvas.width = width;\n this._canvas.height = height;\n }\n\n var newNode = new ZRTextureAtlasSurfaceNode(\n this._zr, offsetX, offsetY, this._nodeWidth, this._nodeHeight, this._gap, this._dpr\n );\n this._textureAtlasNodes.push(newNode);\n\n return newNode;\n },\n\n add: function (el, width, height) {\n if (this._coords[el.id]) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Element already been add');\n }\n return this._coords[el.id];\n }\n var coords = this._getCurrentNode().add(el, width, height);\n if (!coords) {\n var newNode = this._expand();\n if (!newNode) {\n // To maximum\n return;\n }\n coords = newNode.add(el, width, height);\n }\n\n this._coords[el.id] = coords;\n\n return coords;\n },\n\n /**\n * Get coord scale after texture atlas is expanded.\n * @return {Array.}\n */\n getCoordsScale: function () {\n var dpr = this._dpr;\n return [this._nodeWidth / this._canvas.width * dpr, this._nodeHeight / this._canvas.height * dpr];\n },\n\n /**\n * Get texture coords of sprite image\n * @param {string} id Image id\n * @return {Array}\n */\n getCoords: function (id) {\n return this._coords[id];\n },\n\n dispose: function () {\n this._zr.dispose();\n }\n};\n\nexport default ZRTextureAtlasSurface;","import graphicGL from '../../util/graphicGL';\nimport Skybox from 'claygl/src/plugin/Skybox';\nimport * as echarts from 'echarts/lib/echarts';\n\nfunction SceneHelper() {\n}\n\nSceneHelper.prototype = {\n constructor: SceneHelper,\n\n setScene: function (scene) {\n this._scene = scene;\n\n if (this._skybox) {\n this._skybox.attachScene(this._scene);\n }\n },\n\n initLight: function (rootNode) {\n this._lightRoot = rootNode;\n /**\n * @type {clay.light.Directional}\n */\n this.mainLight = new graphicGL.DirectionalLight({\n shadowBias: 0.005\n });\n\n /**\n * @type {clay.light.Ambient}\n */\n this.ambientLight = new graphicGL.AmbientLight();\n\n rootNode.add(this.mainLight);\n rootNode.add(this.ambientLight);\n },\n\n dispose: function () {\n if (this._lightRoot) {\n this._lightRoot.remove(this.mainLight);\n this._lightRoot.remove(this.ambientLight);\n }\n },\n\n updateLight: function (componentModel) {\n\n var mainLight = this.mainLight;\n var ambientLight = this.ambientLight;\n\n var lightModel = componentModel.getModel('light');\n var mainLightModel = lightModel.getModel('main');\n var ambientLightModel = lightModel.getModel('ambient');\n\n mainLight.intensity = mainLightModel.get('intensity');\n ambientLight.intensity = ambientLightModel.get('intensity');\n mainLight.color = graphicGL.parseColor(mainLightModel.get('color')).slice(0, 3);\n ambientLight.color = graphicGL.parseColor(ambientLightModel.get('color')).slice(0, 3);\n\n var alpha = mainLightModel.get('alpha') || 0;\n var beta = mainLightModel.get('beta') || 0;\n mainLight.position.setArray(graphicGL.directionFromAlphaBeta(alpha, beta));\n mainLight.lookAt(graphicGL.Vector3.ZERO);\n\n mainLight.castShadow = mainLightModel.get('shadow');\n mainLight.shadowResolution = graphicGL.getShadowResolution(mainLightModel.get('shadowQuality'));\n },\n\n updateAmbientCubemap: function (renderer, componentModel, api) {\n var ambientCubemapModel = componentModel.getModel('light.ambientCubemap');\n\n var textureUrl = ambientCubemapModel.get('texture');\n if (textureUrl) {\n this._cubemapLightsCache = this._cubemapLightsCache || {};\n var lights = this._cubemapLightsCache[textureUrl];\n if (!lights) {\n var self = this;\n lights = this._cubemapLightsCache[textureUrl]\n = graphicGL.createAmbientCubemap(ambientCubemapModel.option, renderer, api, function () {\n // Use prefitered cubemap\n if (self._isSkyboxFromAmbientCubemap) {\n self._skybox.setEnvironmentMap(lights.specular.cubemap);\n }\n\n api.getZr().refresh();\n });\n }\n this._lightRoot.add(lights.diffuse);\n this._lightRoot.add(lights.specular);\n\n this._currentCubemapLights = lights;\n }\n else if (this._currentCubemapLights) {\n this._lightRoot.remove(this._currentCubemapLights.diffuse);\n this._lightRoot.remove(this._currentCubemapLights.specular);\n this._currentCubemapLights = null;\n }\n },\n\n updateSkybox: function (renderer, componentModel, api) {\n var environmentUrl = componentModel.get('environment');\n\n var self = this;\n function getSkybox() {\n self._skybox = self._skybox || new Skybox();\n return self._skybox;\n }\n\n var skybox = getSkybox();\n if (environmentUrl && environmentUrl !== 'none') {\n if (environmentUrl === 'auto') {\n this._isSkyboxFromAmbientCubemap = true;\n // Use environment in ambient cubemap\n if (this._currentCubemapLights) {\n var cubemap = this._currentCubemapLights.specular.cubemap;\n skybox.setEnvironmentMap(cubemap);\n if (this._scene) {\n skybox.attachScene(this._scene);\n }\n skybox.material.set('lod', 3);\n }\n else if (this._skybox) {\n this._skybox.detachScene();\n }\n }\n // Is gradient or color string\n else if ((typeof environmentUrl === 'object' && environmentUrl.colorStops)\n || (typeof environmentUrl === 'string' && echarts.color.parse(environmentUrl))\n ) {\n this._isSkyboxFromAmbientCubemap = false;\n var texture = new graphicGL.Texture2D({\n anisotropic: 8,\n flipY: false\n });\n skybox.setEnvironmentMap(texture);\n var canvas = texture.image = document.createElement('canvas');\n canvas.width = canvas.height = 16;\n var ctx = canvas.getContext('2d');\n var rect = new echarts.graphic.Rect({\n shape: { x: 0, y: 0, width: 16, height: 16 },\n style: { fill: environmentUrl }\n });\n echarts.innerDrawElementOnCanvas(ctx, rect);\n\n skybox.attachScene(this._scene);\n }\n else {\n this._isSkyboxFromAmbientCubemap = false;\n // Panorama\n var texture = graphicGL.loadTexture(environmentUrl, api, {\n anisotropic: 8,\n flipY: false\n });\n skybox.setEnvironmentMap(texture);\n\n skybox.attachScene(this._scene);\n }\n }\n else {\n if (this._skybox) {\n this._skybox.detachScene(this._scene);\n }\n this._skybox = null;\n }\n\n var coordSys = componentModel.coordinateSystem;\n if (this._skybox) {\n if (coordSys && coordSys.viewGL\n && environmentUrl !== 'auto'\n && !(environmentUrl.match && environmentUrl.match(/.hdr$/))\n ) {\n var srgbDefineMethod = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._skybox.material[srgbDefineMethod]('fragment', 'SRGB_DECODE');\n }\n else {\n this._skybox.material.undefine('fragment', 'SRGB_DECODE');\n }\n // var ambientCubemapUrl = environmentUrl === 'auto'\n // ? componentModel.get('light.ambientCubemap.texture')\n // : environmentUrl;\n }\n }\n};\n\nexport default SceneHelper;","/**\n * @module echarts-gl/util/geometry/QuadsGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\nimport dynamicConvertMixin from './dynamicConvertMixin';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\n/**\n * @constructor\n * @alias module:echarts-gl/util/geometry/QuadsGeometry\n * @extends clay.Geometry\n */\n\nvar QuadsGeometry = Geometry.extend(function () {\n return {\n\n segmentScale: 1,\n\n /**\n * Need to use mesh to expand lines if lineWidth > MAX_LINE_WIDTH\n */\n useNativeLine: true,\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION'),\n normal: new Geometry.Attribute('normal', 'float', 3, 'NORMAL'),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR')\n }\n };\n},\n/** @lends module: echarts-gl/util/geometry/QuadsGeometry.prototype */\n{\n\n /**\n * Reset offset\n */\n resetOffset: function () {\n this._vertexOffset = 0;\n this._faceOffset = 0;\n },\n\n /**\n * @param {number} nQuad\n */\n setQuadCount: function (nQuad) {\n var attributes = this.attributes;\n var vertexCount = this.getQuadVertexCount() * nQuad;\n var triangleCount = this.getQuadTriangleCount() * nQuad;\n if (this.vertexCount !== vertexCount) {\n attributes.position.init(vertexCount);\n attributes.normal.init(vertexCount);\n attributes.color.init(vertexCount);\n }\n if (this.triangleCount !== triangleCount) {\n this.indices = vertexCount > 0xffff ? new Uint32Array(triangleCount * 3) : new Uint16Array(triangleCount * 3);\n }\n },\n\n getQuadVertexCount: function () {\n return 4;\n },\n\n getQuadTriangleCount: function () {\n return 2;\n },\n\n /**\n * Add a quad, which in following order:\n * 0-----1\n * 3-----2\n */\n addQuad: (function () {\n var a = vec3.create();\n var b = vec3.create();\n var normal = vec3.create();\n var indices = [0, 3, 1, 3, 2, 1];\n return function (coords, color) {\n var positionAttr = this.attributes.position;\n var normalAttr = this.attributes.normal;\n var colorAttr = this.attributes.color;\n\n vec3.sub(a, coords[1], coords[0]);\n vec3.sub(b, coords[2], coords[1]);\n vec3.cross(normal, a, b);\n vec3.normalize(normal, normal);\n\n for (var i = 0; i < 4; i++) {\n positionAttr.set(this._vertexOffset + i, coords[i]);\n colorAttr.set(this._vertexOffset + i, color);\n normalAttr.set(this._vertexOffset + i, normal);\n }\n var idx = this._faceOffset * 3;\n for (var i = 0; i < 6; i++) {\n this.indices[idx + i] = indices[i] + this._vertexOffset;\n }\n this._vertexOffset += 4;\n this._faceOffset += 2;\n };\n })()\n});\n\necharts.util.defaults(QuadsGeometry.prototype, dynamicConvertMixin);\n\nexport default QuadsGeometry;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport QuadsGeometry from '../../util/geometry/Quads';\nvar firstNotNull = retrieve.firstNotNull;\n\nvar dimIndicesMap = {\n // Left to right\n x: 0,\n // Far to near\n y: 2,\n // Bottom to up\n z: 1\n};\n\nfunction updateFacePlane(node, plane, otherAxis, dir) {\n var coord = [0, 0, 0];\n var distance = dir < 0 ? otherAxis.getExtentMin() : otherAxis.getExtentMax();\n coord[dimIndicesMap[otherAxis.dim]] = distance;\n node.position.setArray(coord);\n node.rotation.identity();\n\n // Negative distance because on the opposite of normal direction.\n plane.distance = -Math.abs(distance);\n plane.normal.set(0, 0, 0);\n if (otherAxis.dim === 'x') {\n node.rotation.rotateY(dir * Math.PI / 2);\n plane.normal.x = -dir;\n }\n else if (otherAxis.dim === 'z') {\n node.rotation.rotateX(-dir * Math.PI / 2);\n plane.normal.y = -dir;\n }\n else {\n if (dir > 0) {\n node.rotation.rotateY(Math.PI);\n }\n plane.normal.z = -dir;\n }\n}\n\n\nfunction Grid3DFace(faceInfo, linesMaterial, quadsMaterial) {\n this.rootNode = new graphicGL.Node();\n\n var linesMesh = new graphicGL.Mesh({\n geometry: new Lines3DGeometry({ useNativeLine: false }),\n material: linesMaterial,\n castShadow: false,\n ignorePicking: true,\n $ignorePicking: true,\n renderOrder: 1\n });\n var quadsMesh = new graphicGL.Mesh({\n geometry: new QuadsGeometry(),\n material: quadsMaterial,\n castShadow: false,\n culling: false,\n ignorePicking: true,\n $ignorePicking: true,\n renderOrder: 0\n });\n // Quads are behind lines.\n this.rootNode.add(quadsMesh);\n this.rootNode.add(linesMesh);\n\n this.faceInfo = faceInfo;\n this.plane =new graphicGL.Plane();\n this.linesMesh =linesMesh;\n this.quadsMesh =quadsMesh;\n}\n\nGrid3DFace.prototype.update = function (grid3DModel, ecModel, api) {\n var cartesian = grid3DModel.coordinateSystem;\n var axes = [\n cartesian.getAxis(this.faceInfo[0]),\n cartesian.getAxis(this.faceInfo[1])\n ];\n var lineGeometry = this.linesMesh.geometry;\n var quadsGeometry = this.quadsMesh.geometry;\n\n lineGeometry.convertToDynamicArray(true);\n quadsGeometry.convertToDynamicArray(true);\n this._updateSplitLines(lineGeometry, axes, grid3DModel, api);\n this._udpateSplitAreas(quadsGeometry, axes, grid3DModel, api);\n lineGeometry.convertToTypedArray();\n quadsGeometry.convertToTypedArray();\n\n\n var otherAxis = cartesian.getAxis(this.faceInfo[2]);\n updateFacePlane(this.rootNode, this.plane, otherAxis, this.faceInfo[3]);\n};\n\nGrid3DFace.prototype._updateSplitLines = function (geometry, axes, grid3DModel, api) {\n var dpr = api.getDevicePixelRatio();\n axes.forEach(function (axis, idx) {\n var axisModel = axis.model;\n var otherExtent = axes[1 - idx].getExtent();\n\n if (axis.scale.isBlank()) {\n return;\n }\n\n var splitLineModel = axisModel.getModel('splitLine', grid3DModel.getModel('splitLine'));\n // Render splitLines\n if (splitLineModel.get('show')) {\n var lineStyleModel = splitLineModel.getModel('lineStyle');\n var lineColors = lineStyleModel.get('color');\n var opacity = firstNotNull(lineStyleModel.get('opacity'), 1.0);\n var lineWidth = firstNotNull(lineStyleModel.get('width'), 1.0);\n\n lineColors = echarts.util.isArray(lineColors) ? lineColors : [lineColors];\n\n var ticksCoords = axis.getTicksCoords({\n tickModel: splitLineModel\n });\n\n var count = 0;\n for (var i = 0; i < ticksCoords.length; i++) {\n var tickCoord = ticksCoords[i].coord;\n var lineColor = graphicGL.parseColor(lineColors[count % lineColors.length]);\n lineColor[3] *= opacity;\n\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n // 0 - x, 1 - y\n p0[idx] = p1[idx] = tickCoord;\n p0[1 - idx] = otherExtent[0];\n p1[1 - idx] = otherExtent[1];\n\n geometry.addLine(p0, p1, lineColor, lineWidth * dpr);\n\n count++;\n }\n }\n });\n};\n\nGrid3DFace.prototype._udpateSplitAreas = function (geometry, axes, grid3DModel, api) {\n axes.forEach(function (axis, idx) {\n var axisModel = axis.model;\n var otherExtent = axes[1 - idx].getExtent();\n\n if (axis.scale.isBlank()) {\n return;\n }\n\n var splitAreaModel = axisModel.getModel('splitArea', grid3DModel.getModel('splitArea'));\n // Render splitAreas\n if (splitAreaModel.get('show')) {\n var areaStyleModel = splitAreaModel.getModel('areaStyle');\n var colors = areaStyleModel.get('color');\n var opacity = firstNotNull(areaStyleModel.get('opacity'), 1.0);\n\n colors = echarts.util.isArray(colors) ? colors : [colors];\n\n var ticksCoords = axis.getTicksCoords({\n tickModel: splitAreaModel,\n clamp: true\n });\n\n var count = 0;\n var prevP0 = [0, 0, 0];\n var prevP1 = [0, 0, 0];\n // 0 - x, 1 - y\n for (var i = 0; i < ticksCoords.length; i++) {\n var tickCoord = ticksCoords[i].coord;\n\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n // 0 - x, 1 - y\n p0[idx] = p1[idx] = tickCoord;\n p0[1 - idx] = otherExtent[0];\n p1[1 - idx] = otherExtent[1];\n\n if (i === 0) {\n prevP0 = p0;\n prevP1 = p1;\n continue;\n }\n\n var color = graphicGL.parseColor(colors[count % colors.length]);\n color[3] *= opacity;\n geometry.addQuad([prevP0, p0, p1, prevP1], color);\n\n prevP0 = p0;\n prevP1 = p1;\n\n count++;\n }\n }\n });\n};\n\nexport default Grid3DFace;","/**\n * Geometry collecting sprites\n *\n * @module echarts-gl/util/geometry/Sprites\n * @author Yi Shen(https://github.com/pissang)\n */\nimport * as echarts from 'echarts/lib/echarts';\nimport Geometry from 'claygl/src/Geometry';\nimport dynamicConvertMixin from './dynamicConvertMixin';\n\nvar squareTriangles = [\n 0, 1, 2, 0, 2, 3\n];\n\nvar SpritesGeometry = Geometry.extend(function () {\n return {\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION'),\n texcoord: new Geometry.Attribute('texcoord', 'float', 2, 'TEXCOORD_0'),\n offset: new Geometry.Attribute('offset', 'float', 2),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR')\n }\n };\n}, {\n resetOffset: function () {\n this._vertexOffset = 0;\n this._faceOffset = 0;\n },\n setSpriteCount: function (spriteCount) {\n this._spriteCount = spriteCount;\n\n var vertexCount = spriteCount * 4;\n var triangleCount = spriteCount * 2;\n\n if (this.vertexCount !== vertexCount) {\n this.attributes.position.init(vertexCount);\n this.attributes.offset.init(vertexCount);\n this.attributes.color.init(vertexCount);\n }\n if (this.triangleCount !== triangleCount) {\n this.indices = vertexCount > 0xffff ? new Uint32Array(triangleCount * 3) : new Uint16Array(triangleCount * 3);\n }\n },\n\n setSpriteAlign: function (spriteOffset, size, align, verticalAlign, margin) {\n if (align == null) {\n align = 'left';\n }\n if (verticalAlign == null) {\n verticalAlign = 'top';\n }\n\n var leftOffset, topOffset, rightOffset, bottomOffset;\n margin = margin || 0;\n switch (align) {\n case 'left':\n leftOffset = margin;\n rightOffset = size[0] + margin;\n break;\n case 'center':\n case 'middle':\n leftOffset = -size[0] / 2;\n rightOffset = size[0] / 2;\n break;\n case 'right':\n leftOffset = -size[0] - margin;\n rightOffset = -margin;\n break;\n }\n switch (verticalAlign) {\n case 'bottom':\n topOffset = margin;\n bottomOffset = size[1] + margin;\n break;\n case 'middle':\n topOffset = -size[1] / 2;\n bottomOffset = size[1] / 2;\n break;\n case 'top':\n topOffset = -size[1] - margin;\n bottomOffset = -margin;\n break;\n }\n // 3----2\n // 0----1\n var vertexOffset = spriteOffset * 4;\n var offsetAttr = this.attributes.offset;\n offsetAttr.set(vertexOffset, [leftOffset, bottomOffset]);\n offsetAttr.set(vertexOffset + 1, [rightOffset, bottomOffset]);\n offsetAttr.set(vertexOffset + 2, [rightOffset, topOffset]);\n offsetAttr.set(vertexOffset + 3, [leftOffset, topOffset]);\n },\n /**\n * Add sprite\n * @param {Array.} position\n * @param {Array.} size [width, height]\n * @param {Array.} coords [leftBottom, rightTop]\n * @param {string} [align='left'] 'left' 'center' 'right'\n * @param {string} [verticalAlign='top'] 'top' 'middle' 'bottom'\n * @param {number} [screenMargin=0]\n */\n addSprite: function (position, size, coords, align, verticalAlign, screenMargin) {\n var vertexOffset = this._vertexOffset;\n this.setSprite(\n this._vertexOffset / 4, position, size, coords, align, verticalAlign, screenMargin\n )\n for (var i = 0; i < squareTriangles.length; i++) {\n this.indices[this._faceOffset * 3 + i] = squareTriangles[i] + vertexOffset;\n }\n this._faceOffset += 2;\n this._vertexOffset += 4;\n\n return vertexOffset / 4;\n },\n\n setSprite: function (spriteOffset, position, size, coords, align, verticalAlign, screenMargin) {\n var vertexOffset = spriteOffset * 4;\n\n var attributes = this.attributes;\n for (var i = 0; i < 4; i++) {\n attributes.position.set(vertexOffset + i, position);\n }\n // 3----2\n // 0----1\n var texcoordAttr = attributes.texcoord;\n\n texcoordAttr.set(vertexOffset, [coords[0][0], coords[0][1]]);\n texcoordAttr.set(vertexOffset + 1, [coords[1][0], coords[0][1]]);\n texcoordAttr.set(vertexOffset + 2, [coords[1][0], coords[1][1]]);\n texcoordAttr.set(vertexOffset + 3, [coords[0][0], coords[1][1]]);\n\n this.setSpriteAlign(spriteOffset, size, align, verticalAlign, screenMargin);\n }\n});\n\necharts.util.defaults(SpritesGeometry.prototype, dynamicConvertMixin);\n\nexport default SpritesGeometry;","export default \"@export ecgl.labels.vertex\\n\\nattribute vec3 position: POSITION;\\nattribute vec2 texcoord: TEXCOORD_0;\\nattribute vec2 offset;\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform vec4 viewport : VIEWPORT;\\n\\nvarying vec2 v_Texcoord;\\n\\nvoid main()\\n{\\n vec4 proj = worldViewProjection * vec4(position, 1.0);\\n\\n vec2 screen = (proj.xy / abs(proj.w) + 1.0) * 0.5 * viewport.zw;\\n\\n screen += offset;\\n\\n proj.xy = (screen / viewport.zw - 0.5) * 2.0 * abs(proj.w);\\n gl_Position = proj;\\n#ifdef VERTEX_COLOR\\n v_Color = a_Color;\\n#endif\\n v_Texcoord = texcoord;\\n}\\n@end\\n\\n\\n@export ecgl.labels.fragment\\n\\nuniform vec3 color : [1.0, 1.0, 1.0];\\nuniform float alpha : 1.0;\\nuniform sampler2D textureAtlas;\\nuniform vec2 uvScale: [1.0, 1.0];\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\nvarying float v_Miter;\\n\\nvarying vec2 v_Texcoord;\\n\\nvoid main()\\n{\\n gl_FragColor = vec4(color, alpha) * texture2D(textureAtlas, v_Texcoord * uvScale);\\n#ifdef VERTEX_COLOR\\n gl_FragColor *= v_Color;\\n#endif\\n}\\n\\n@end\";\n","import graphicGL from '../graphicGL';\nimport SpritesGeometry from '../geometry/Sprites';\n\nimport labelsGLSL from '../shader/labels.glsl.js';\ngraphicGL.Shader.import(labelsGLSL);\n\nexport default graphicGL.Mesh.extend(function () {\n var geometry = new SpritesGeometry({\n dynamic: true\n });\n var material = new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.labels'),\n transparent: true,\n depthMask: false\n });\n\n return {\n geometry: geometry,\n material: material,\n culling: false,\n castShadow: false,\n ignorePicking: true\n };\n});","import * as echarts from 'echarts/lib/echarts';\nimport {createTextStyle} from 'echarts/lib/label/labelStyle';\n\nimport graphicGL from '../../util/graphicGL';\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport retrieve from '../../util/retrieve';\nimport LabelsMesh from '../../util/mesh/LabelsMesh';\n\nvar firstNotNull = retrieve.firstNotNull;\n\nvar dimIndicesMap = {\n // Left to right\n x: 0,\n // Far to near\n y: 2,\n // Bottom to up\n z: 1\n};\n\nfunction Grid3DAxis(dim, linesMaterial) {\n var linesMesh = new graphicGL.Mesh({\n geometry: new Lines3DGeometry({ useNativeLine: false }),\n material: linesMaterial,\n castShadow: false,\n ignorePicking: true, renderOrder: 2\n });\n var axisLabelsMesh = new LabelsMesh();\n axisLabelsMesh.material.depthMask = false;\n\n var rootNode = new graphicGL.Node();\n rootNode.add(linesMesh);\n rootNode.add(axisLabelsMesh);\n\n this.rootNode = rootNode;\n this.dim = dim;\n\n this.linesMesh = linesMesh;\n this.labelsMesh = axisLabelsMesh;\n this.axisLineCoords = null;\n this.labelElements = [];\n}\n\nvar otherDim = {\n x: 'y', y: 'x', z: 'y'\n};\nGrid3DAxis.prototype.update = function (\n grid3DModel, axisLabelSurface, api\n) {\n var cartesian = grid3DModel.coordinateSystem;\n var axis = cartesian.getAxis(this.dim);\n\n var linesGeo = this.linesMesh.geometry;\n var labelsGeo = this.labelsMesh.geometry;\n linesGeo.convertToDynamicArray(true);\n labelsGeo.convertToDynamicArray(true);\n var axisModel = axis.model;\n var extent = axis.getExtent();\n\n var dpr = api.getDevicePixelRatio();\n var axisLineModel = axisModel.getModel('axisLine', grid3DModel.getModel('axisLine'));\n var axisTickModel = axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));\n var axisLabelModel = axisModel.getModel('axisLabel', grid3DModel.getModel('axisLabel'));\n var axisLineColor = axisLineModel.get('lineStyle.color');\n // Render axisLine\n if (axisLineModel.get('show')) {\n var axisLineStyleModel = axisLineModel.getModel('lineStyle');\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n var idx = dimIndicesMap[axis.dim];\n p0[idx] = extent[0];\n p1[idx] = extent[1];\n\n // Save some useful info.\n this.axisLineCoords =[p0, p1];\n\n var color = graphicGL.parseColor(axisLineColor);\n var lineWidth = firstNotNull(axisLineStyleModel.get('width'), 1.0);\n var opacity = firstNotNull(axisLineStyleModel.get('opacity'), 1.0);\n color[3] *= opacity;\n linesGeo.addLine(p0, p1, color, lineWidth * dpr);\n }\n // Render axis ticksCoords\n if (axisTickModel.get('show')) {\n var lineStyleModel = axisTickModel.getModel('lineStyle');\n var lineColor = graphicGL.parseColor(\n firstNotNull(lineStyleModel.get('color'), axisLineColor)\n );\n var lineWidth = firstNotNull(lineStyleModel.get('width'), 1.0);\n lineColor[3] *= firstNotNull(lineStyleModel.get('opacity'), 1.0);\n var ticksCoords = axis.getTicksCoords();\n var tickLength = axisTickModel.get('length');\n\n for (var i = 0; i < ticksCoords.length; i++) {\n var tickCoord = ticksCoords[i].coord;\n\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n var idx = dimIndicesMap[axis.dim];\n var otherIdx = dimIndicesMap[otherDim[axis.dim]];\n // 0 : x, 1 : y\n p0[idx] = p1[idx] = tickCoord;\n p1[otherIdx] = tickLength;\n\n linesGeo.addLine(p0, p1, lineColor, lineWidth * dpr);\n }\n }\n\n this.labelElements = [];\n var dpr = api.getDevicePixelRatio();\n if (axisLabelModel.get('show')) {\n var ticksCoords = axis.getTicksCoords();\n var categoryData = axisModel.get('data');\n\n var labelMargin = axisLabelModel.get('margin');\n var labels = axis.getViewLabels();\n\n for (var i = 0; i < labels.length; i++) {\n var tickValue = labels[i].tickValue;\n var formattedLabel = labels[i].formattedLabel;\n var rawLabel = labels[i].rawLabel;\n\n var tickCoord = axis.dataToCoord(tickValue);\n\n var p = [0, 0, 0];\n var idx = dimIndicesMap[axis.dim];\n var otherIdx = dimIndicesMap[otherDim[axis.dim]];\n // 0 : x, 1 : y\n p[idx] = p[idx] = tickCoord;\n p[otherIdx] = labelMargin;\n\n var itemTextStyleModel = axisLabelModel;\n if (categoryData && categoryData[tickValue] && categoryData[tickValue].textStyle) {\n itemTextStyleModel = new echarts.Model(\n categoryData[tickValue].textStyle, axisLabelModel, axisModel.ecModel\n );\n }\n var textColor = firstNotNull(itemTextStyleModel.get('color'), axisLineColor);\n\n var textEl = new echarts.graphic.Text({\n style: createTextStyle(itemTextStyleModel, {\n text: formattedLabel,\n fill: typeof textColor === 'function'\n ? textColor(\n // (1) In category axis with data zoom, tick is not the original\n // index of axis.data. So tick should not be exposed to user\n // in category axis.\n // (2) Compatible with previous version, which always returns labelStr.\n // But in interval scale labelStr is like '223,445', which maked\n // user repalce ','. So we modify it to return original val but remain\n // it as 'string' to avoid error in replacing.\n axis.type === 'category' ? rawLabel : axis.type === 'value' ? tickValue + '' : tickValue,\n i\n )\n : textColor,\n verticalAlign: 'top',\n align: 'left'\n })\n });\n\n var coords = axisLabelSurface.add(textEl);\n var rect = textEl.getBoundingRect();\n labelsGeo.addSprite(p, [rect.width * dpr, rect.height * dpr], coords);\n\n this.labelElements.push(textEl);\n }\n }\n\n if (axisModel.get('name')) {\n var nameTextStyleModel = axisModel.getModel('nameTextStyle');\n var p = [0, 0, 0];\n var idx = dimIndicesMap[axis.dim];\n var otherIdx = dimIndicesMap[otherDim[axis.dim]];\n var labelColor = firstNotNull(nameTextStyleModel.get('color'), axisLineColor);\n var strokeColor = nameTextStyleModel.get('borderColor');\n var lineWidth = nameTextStyleModel.get('borderWidth');\n // TODO start and end\n p[idx] = p[idx] = (extent[0] + extent[1]) / 2;\n p[otherIdx] = axisModel.get('nameGap');\n\n var textEl = new echarts.graphic.Text({\n style: createTextStyle(nameTextStyleModel, {\n text: axisModel.get('name'),\n fill: labelColor,\n stroke: strokeColor,\n lineWidth: lineWidth\n })\n });\n\n var coords = axisLabelSurface.add(textEl);\n var rect = textEl.getBoundingRect();\n labelsGeo.addSprite(p, [rect.width * dpr, rect.height * dpr], coords);\n\n textEl.__idx = this.labelElements.length;\n this.nameLabelElement = textEl;\n }\n\n this.labelsMesh.material.set('textureAtlas', axisLabelSurface.getTexture());\n this.labelsMesh.material.set('uvScale', axisLabelSurface.getCoordsScale());\n\n linesGeo.convertToTypedArray();\n labelsGeo.convertToTypedArray();\n};\n\nGrid3DAxis.prototype.setSpriteAlign = function (textAlign, textVerticalAlign, api) {\n var dpr = api.getDevicePixelRatio();\n var labelGeo = this.labelsMesh.geometry;\n for (var i = 0; i < this.labelElements.length; i++) {\n var labelEl = this.labelElements[i];\n var rect = labelEl.getBoundingRect();\n\n labelGeo.setSpriteAlign(i, [rect.width * dpr, rect.height * dpr], textAlign, textVerticalAlign);\n }\n // name label\n var nameLabelEl = this.nameLabelElement;\n if (nameLabelEl) {\n var rect = nameLabelEl.getBoundingRect();\n labelGeo.setSpriteAlign(nameLabelEl.__idx, [rect.width * dpr, rect.height * dpr], textAlign, textVerticalAlign);\n labelGeo.dirty();\n }\n\n this.textAlign = textAlign;\n this.textVerticalAlign = textVerticalAlign;\n};\n\nexport default Grid3DAxis;","export default \"@export ecgl.lines3D.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nattribute vec3 position: POSITION;\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n\\nvoid main()\\n{\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n v_Color = a_Color;\\n}\\n\\n@end\\n\\n@export ecgl.lines3D.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nvarying vec4 v_Color;\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color * v_Color);\\n#else\\n gl_FragColor = color * v_Color;\\n#endif\\n}\\n@end\\n\\n\\n\\n@export ecgl.lines3D.clipNear\\n\\nvec4 clipNear(vec4 p1, vec4 p2) {\\n float n = (p1.w - near) / (p1.w - p2.w);\\n return vec4(mix(p1.xy, p2.xy, n), -near, near);\\n}\\n\\n@end\\n\\n@export ecgl.lines3D.expandLine\\n#ifdef VERTEX_ANIMATION\\n vec4 prevProj = worldViewProjection * vec4(mix(prevPositionPrev, positionPrev, percent), 1.0);\\n vec4 currProj = worldViewProjection * vec4(mix(prevPosition, position, percent), 1.0);\\n vec4 nextProj = worldViewProjection * vec4(mix(prevPositionNext, positionNext, percent), 1.0);\\n#else\\n vec4 prevProj = worldViewProjection * vec4(positionPrev, 1.0);\\n vec4 currProj = worldViewProjection * vec4(position, 1.0);\\n vec4 nextProj = worldViewProjection * vec4(positionNext, 1.0);\\n#endif\\n\\n if (currProj.w < 0.0) {\\n if (nextProj.w > 0.0) {\\n currProj = clipNear(currProj, nextProj);\\n }\\n else if (prevProj.w > 0.0) {\\n currProj = clipNear(currProj, prevProj);\\n }\\n }\\n\\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\\n\\n vec2 dir;\\n float len = offset;\\n if (position == positionPrev) {\\n dir = normalize(nextScreen - currScreen);\\n }\\n else if (position == positionNext) {\\n dir = normalize(currScreen - prevScreen);\\n }\\n else {\\n vec2 dirA = normalize(currScreen - prevScreen);\\n vec2 dirB = normalize(nextScreen - currScreen);\\n\\n vec2 tanget = normalize(dirA + dirB);\\n\\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\\n len *= miter;\\n dir = tanget;\\n }\\n\\n dir = vec2(-dir.y, dir.x) * len;\\n currScreen += dir;\\n\\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\\n@end\\n\\n\\n@export ecgl.meshLines3D.vertex\\n\\nattribute vec3 position: POSITION;\\nattribute vec3 positionPrev;\\nattribute vec3 positionNext;\\nattribute float offset;\\nattribute vec4 a_Color : COLOR;\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nattribute vec3 prevPositionPrev;\\nattribute vec3 prevPositionNext;\\nuniform float percent : 1.0;\\n#endif\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform vec4 viewport : VIEWPORT;\\nuniform float near : NEAR;\\n\\nvarying vec4 v_Color;\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n@import ecgl.lines3D.clipNear\\n\\nvoid main()\\n{\\n @import ecgl.lines3D.expandLine\\n\\n gl_Position = currProj;\\n\\n v_Color = a_Color;\\n\\n @import ecgl.common.wireframe.vertexMain\\n}\\n@end\\n\\n\\n@export ecgl.meshLines3D.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nvarying vec4 v_Color;\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color * v_Color);\\n#else\\n gl_FragColor = color * v_Color;\\n#endif\\n\\n @import ecgl.common.wireframe.fragmentMain\\n}\\n\\n@end\";\n","// TODO orthographic camera\n\nimport * as echarts from 'echarts/lib/echarts';\nimport {createTextStyle} from 'echarts/lib/label/labelStyle';\nimport graphicGL from '../../util/graphicGL';\nimport OrbitControl from '../../util/OrbitControl';\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport retrieve from '../../util/retrieve';\nvar firstNotNull = retrieve.firstNotNull;\nimport ZRTextureAtlasSurface from '../../util/ZRTextureAtlasSurface';\nimport SceneHelper from '../common/SceneHelper';\nimport Grid3DFace from './Grid3DFace';\nimport Grid3DAxis from './Grid3DAxis';\nimport LabelsMesh from '../../util/mesh/LabelsMesh';\n\nimport lines3DGLSL from '../../util/shader/lines3D.glsl.js';\ngraphicGL.Shader.import(lines3DGLSL);\n\nvar dimIndicesMap = {\n // Left to right\n x: 0,\n // Far to near\n y: 2,\n // Bottom to up\n z: 1\n};\n\nexport default echarts.ComponentView.extend({\n\n type: 'grid3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n var FACES = [\n // planeDim0, planeDim1, offsetDim, dir on dim3 axis(gl), plane.\n ['y', 'z', 'x', -1, 'left'],\n ['y', 'z', 'x', 1, 'right'],\n ['x', 'y', 'z', -1, 'bottom'],\n ['x', 'y','z', 1, 'top'],\n ['x', 'z', 'y', -1, 'far'],\n ['x', 'z','y', 1, 'near']\n ];\n\n var DIMS = ['x', 'y', 'z'];\n\n var quadsMaterial = new graphicGL.Material({\n // transparent: true,\n shader: graphicGL.createShader('ecgl.color'),\n depthMask: false,\n transparent: true\n });\n var linesMaterial = new graphicGL.Material({\n // transparent: true,\n shader: graphicGL.createShader('ecgl.meshLines3D'),\n depthMask: false,\n transparent: true\n });\n quadsMaterial.define('fragment', 'DOUBLE_SIDED');\n quadsMaterial.define('both', 'VERTEX_COLOR');\n\n this.groupGL = new graphicGL.Node();\n\n this._control = new OrbitControl({\n zr: api.getZr()\n });\n this._control.init();\n\n // Save mesh and other infos for each face.\n this._faces = FACES.map(function (faceInfo) {\n var face = new Grid3DFace(faceInfo, linesMaterial, quadsMaterial);\n this.groupGL.add(face.rootNode);\n return face;\n }, this);\n\n // Save mesh and other infos for each axis.\n this._axes = DIMS.map(function (dim) {\n var axis = new Grid3DAxis(dim, linesMaterial);\n this.groupGL.add(axis.rootNode);\n return axis;\n }, this);\n\n var dpr = api.getDevicePixelRatio();\n // Texture surface for label.\n this._axisLabelSurface = new ZRTextureAtlasSurface({\n width: 256, height: 256,\n devicePixelRatio: dpr\n });\n this._axisLabelSurface.onupdate = function () {\n api.getZr().refresh();\n };\n\n this._axisPointerLineMesh = new graphicGL.Mesh({\n geometry: new Lines3DGeometry({ useNativeLine: false }),\n material: linesMaterial,\n castShadow: false,\n // PENDING\n ignorePicking: true,\n renderOrder: 3\n });\n this.groupGL.add(this._axisPointerLineMesh);\n\n this._axisPointerLabelsSurface = new ZRTextureAtlasSurface({\n width: 128, height: 128,\n devicePixelRatio: dpr\n });\n this._axisPointerLabelsMesh = new LabelsMesh({\n ignorePicking: true, renderOrder: 4,\n castShadow: false\n });\n this._axisPointerLabelsMesh.material.set('textureAtlas', this._axisPointerLabelsSurface.getTexture());\n this.groupGL.add(this._axisPointerLabelsMesh);\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper();\n this._sceneHelper.initLight(this._lightRoot);\n },\n\n render: function (grid3DModel, ecModel, api) {\n\n this._model = grid3DModel;\n this._api = api;\n\n var cartesian = grid3DModel.coordinateSystem;\n\n // Always have light.\n cartesian.viewGL.add(this._lightRoot);\n\n if (grid3DModel.get('show')) {\n cartesian.viewGL.add(this.groupGL);\n }\n else {\n cartesian.viewGL.remove(this.groupGL);\n }\n\n // cartesian.viewGL.setCameraType(grid3DModel.get('viewControl.projection'));\n\n var control = this._control;\n control.setViewGL(cartesian.viewGL);\n\n var viewControlModel = grid3DModel.getModel('viewControl');\n control.setFromViewControlModel(viewControlModel, 0);\n\n this._axisLabelSurface.clear();\n\n control.off('update');\n if (grid3DModel.get('show')) {\n this._faces.forEach(function (face) {\n face.update(grid3DModel, ecModel, api);\n }, this);\n this._axes.forEach(function (axis) {\n axis.update(grid3DModel, this._axisLabelSurface, api);\n }, this);\n }\n\n control.on('update', this._onCameraChange.bind(this, grid3DModel, api), this);\n\n this._sceneHelper.setScene(cartesian.viewGL.scene);\n this._sceneHelper.updateLight(grid3DModel);\n\n // Set post effect\n cartesian.viewGL.setPostEffect(grid3DModel.getModel('postEffect'), api);\n cartesian.viewGL.setTemporalSuperSampling(grid3DModel.getModel('temporalSuperSampling'));\n\n this._initMouseHandler(grid3DModel);\n },\n\n afterRender: function (grid3DModel, ecModel, api, layerGL) {\n // Create ambient cubemap after render because we need to know the renderer.\n // TODO\n var renderer = layerGL.renderer;\n\n this._sceneHelper.updateAmbientCubemap(renderer, grid3DModel, api);\n\n this._sceneHelper.updateSkybox(renderer, grid3DModel, api);\n },\n\n /**\n * showAxisPointer will be triggered by action.\n */\n showAxisPointer: function (grid3dModel, ecModel, api, payload) {\n this._doShowAxisPointer();\n this._updateAxisPointer(payload.value);\n },\n\n /**\n * hideAxisPointer will be triggered by action.\n */\n hideAxisPointer: function (grid3dModel, ecModel, api, payload) {\n this._doHideAxisPointer();\n },\n\n _initMouseHandler: function (grid3DModel) {\n var cartesian = grid3DModel.coordinateSystem;\n var viewGL = cartesian.viewGL;\n\n // TODO xAxis3D.axisPointer.show ?\n if (grid3DModel.get('show') && grid3DModel.get('axisPointer.show')) {\n viewGL.on('mousemove', this._updateAxisPointerOnMousePosition, this);\n }\n else {\n viewGL.off('mousemove', this._updateAxisPointerOnMousePosition);\n }\n },\n\n /**\n * Try find and show axisPointer on the intersect point\n * of mouse ray with grid plane.\n */\n _updateAxisPointerOnMousePosition: function (e) {\n // Ignore if mouse is on the element.\n if (e.target) {\n return;\n }\n var grid3DModel = this._model;\n var cartesian = grid3DModel.coordinateSystem;\n var viewGL = cartesian.viewGL;\n\n var ray = viewGL.castRay(e.offsetX, e.offsetY, new graphicGL.Ray());\n\n var nearestIntersectPoint;\n for (var i = 0; i < this._faces.length; i++) {\n var face = this._faces[i];\n if (face.rootNode.invisible) {\n continue;\n }\n\n // Plane is not face the camera. flip it\n if (face.plane.normal.dot(viewGL.camera.worldTransform.z) < 0) {\n face.plane.normal.negate();\n }\n\n var point = ray.intersectPlane(face.plane);\n if (!point) {\n continue;\n }\n var axis0 = cartesian.getAxis(face.faceInfo[0]);\n var axis1 = cartesian.getAxis(face.faceInfo[1]);\n var idx0 = dimIndicesMap[face.faceInfo[0]];\n var idx1 = dimIndicesMap[face.faceInfo[1]];\n if (axis0.contain(point.array[idx0]) && axis1.contain(point.array[idx1])) {\n nearestIntersectPoint = point;\n }\n }\n\n if (nearestIntersectPoint) {\n var data = cartesian.pointToData(nearestIntersectPoint.array, [], true);\n this._updateAxisPointer(data);\n\n this._doShowAxisPointer();\n }\n else {\n this._doHideAxisPointer();\n }\n },\n\n _onCameraChange: function (grid3DModel, api) {\n\n if (grid3DModel.get('show')) {\n this._updateFaceVisibility();\n this._updateAxisLinePosition();\n }\n\n var control = this._control;\n\n api.dispatchAction({\n type: 'grid3DChangeCamera',\n alpha: control.getAlpha(),\n beta: control.getBeta(),\n distance: control.getDistance(),\n center: control.getCenter(),\n from: this.uid,\n grid3DId: grid3DModel.id\n });\n },\n\n /**\n * Update visibility of each face when camera view changed, front face will be invisible.\n * @private\n */\n _updateFaceVisibility: function () {\n var camera = this._control.getCamera();\n var viewSpacePos = new graphicGL.Vector3();\n camera.update();\n for (var idx = 0; idx < this._faces.length / 2; idx++) {\n var depths = [];\n for (var k = 0; k < 2; k++) {\n var face = this._faces[idx * 2 + k];\n face.rootNode.getWorldPosition(viewSpacePos);\n viewSpacePos.transformMat4(camera.viewMatrix);\n depths[k] = viewSpacePos.z;\n }\n // Set the front face invisible\n var frontIndex = depths[0] > depths[1] ? 0 : 1;\n var frontFace = this._faces[idx * 2 + frontIndex];\n var backFace = this._faces[idx * 2 + 1 - frontIndex];\n // Update rotation.\n frontFace.rootNode.invisible = true;\n backFace.rootNode.invisible = false;\n }\n },\n\n /**\n * Update axis line position when camera view changed.\n * @private\n */\n _updateAxisLinePosition: function () {\n // Put xAxis, yAxis on x, y visible plane.\n // Put zAxis on the left.\n // TODO\n var cartesian = this._model.coordinateSystem;\n var xAxis = cartesian.getAxis('x');\n var yAxis = cartesian.getAxis('y');\n var zAxis = cartesian.getAxis('z');\n var top = zAxis.getExtentMax();\n var bottom = zAxis.getExtentMin();\n var left = xAxis.getExtentMin();\n var right = xAxis.getExtentMax();\n var near = yAxis.getExtentMax();\n var far = yAxis.getExtentMin();\n\n var xAxisNode = this._axes[0].rootNode;\n var yAxisNode = this._axes[1].rootNode;\n var zAxisNode = this._axes[2].rootNode;\n\n var faces = this._faces;\n // Notice: in cartesian up axis is z, but in webgl up axis is y.\n var xAxisZOffset = (faces[4].rootNode.invisible ? far : near);\n var xAxisYOffset = (faces[2].rootNode.invisible ? top : bottom);\n var yAxisXOffset = (faces[0].rootNode.invisible ? left : right);\n var yAxisYOffset = (faces[2].rootNode.invisible ? top : bottom);\n var zAxisXOffset = (faces[0].rootNode.invisible ? right : left);\n var zAxisZOffset = (faces[4].rootNode.invisible ? far : near);\n\n xAxisNode.rotation.identity();\n yAxisNode.rotation.identity();\n zAxisNode.rotation.identity();\n if (faces[4].rootNode.invisible) {\n this._axes[0].flipped = true;\n xAxisNode.rotation.rotateX(Math.PI);\n }\n if (faces[0].rootNode.invisible) {\n this._axes[1].flipped = true;\n yAxisNode.rotation.rotateZ(Math.PI);\n }\n if (faces[4].rootNode.invisible) {\n this._axes[2].flipped = true;\n zAxisNode.rotation.rotateY(Math.PI);\n }\n\n xAxisNode.position.set(0, xAxisYOffset, xAxisZOffset);\n yAxisNode.position.set(yAxisXOffset, yAxisYOffset, 0); // Actually z\n zAxisNode.position.set(zAxisXOffset, 0, zAxisZOffset); // Actually y\n\n xAxisNode.update();\n yAxisNode.update();\n zAxisNode.update();\n\n this._updateAxisLabelAlign();\n },\n\n /**\n * Update label align on axis when axisLine position changed.\n * @private\n */\n _updateAxisLabelAlign: function () {\n // var cartesian = this._model.coordinateSystem;\n var camera = this._control.getCamera();\n var coords = [new graphicGL.Vector4(), new graphicGL.Vector4()];\n var center = new graphicGL.Vector4();\n this.groupGL.getWorldPosition(center);\n center.w = 1.0;\n center.transformMat4(camera.viewMatrix)\n .transformMat4(camera.projectionMatrix);\n center.x /= center.w;\n center.y /= center.w;\n this._axes.forEach(function (axisInfo) {\n var lineCoords = axisInfo.axisLineCoords;\n var labelGeo = axisInfo.labelsMesh.geometry;\n for (var i = 0; i < coords.length; i++) {\n coords[i].setArray(lineCoords[i]);\n coords[i].w = 1.0;\n coords[i].transformMat4(axisInfo.rootNode.worldTransform)\n .transformMat4(camera.viewMatrix)\n .transformMat4(camera.projectionMatrix);\n coords[i].x /= coords[i].w;\n coords[i].y /= coords[i].w;\n }\n var dx = coords[1].x - coords[0].x;\n var dy = coords[1].y - coords[0].y;\n var cx = (coords[1].x + coords[0].x) / 2;\n var cy = (coords[1].y + coords[0].y) / 2;\n var textAlign;\n var verticalAlign;\n if (Math.abs(dy / dx) < 0.5) {\n textAlign = 'center';\n verticalAlign = cy > center.y ? 'bottom' : 'top';\n }\n else {\n verticalAlign = 'middle';\n textAlign = cx > center.x ? 'left' : 'right';\n }\n\n // axis labels\n axisInfo.setSpriteAlign(textAlign, verticalAlign, this._api);\n }, this);\n },\n\n _doShowAxisPointer: function () {\n if (!this._axisPointerLineMesh.invisible) {\n return;\n }\n\n this._axisPointerLineMesh.invisible = false;\n this._axisPointerLabelsMesh.invisible = false;\n this._api.getZr().refresh();\n },\n\n _doHideAxisPointer: function () {\n if (this._axisPointerLineMesh.invisible) {\n return;\n }\n\n this._axisPointerLineMesh.invisible = true;\n this._axisPointerLabelsMesh.invisible = true;\n this._api.getZr().refresh();\n },\n /**\n * @private updateAxisPointer.\n */\n _updateAxisPointer: function (data) {\n var cartesian = this._model.coordinateSystem;\n var point = cartesian.dataToPoint(data);\n\n var axisPointerLineMesh = this._axisPointerLineMesh;\n var linesGeo = axisPointerLineMesh.geometry;\n\n var axisPointerParentModel = this._model.getModel('axisPointer');\n\n var dpr = this._api.getDevicePixelRatio();\n linesGeo.convertToDynamicArray(true);\n\n\n function ifShowAxisPointer(axis) {\n return retrieve.firstNotNull(\n axis.model.get('axisPointer.show'),\n axisPointerParentModel.get('show')\n );\n }\n function getAxisColorAndLineWidth(axis) {\n var axisPointerModel = axis.model.getModel('axisPointer', axisPointerParentModel);\n var lineStyleModel = axisPointerModel.getModel('lineStyle');\n\n var color = graphicGL.parseColor(lineStyleModel.get('color'));\n var lineWidth = firstNotNull(lineStyleModel.get('width'), 1);\n var opacity = firstNotNull(lineStyleModel.get('opacity'), 1);\n color[3] *= opacity;\n\n return {\n color: color,\n lineWidth: lineWidth\n };\n }\n for (var k = 0; k < this._faces.length; k++) {\n var face = this._faces[k];\n if (face.rootNode.invisible) {\n continue;\n }\n\n var faceInfo = face.faceInfo;\n var otherCoord = faceInfo[3] < 0\n ? cartesian.getAxis(faceInfo[2]).getExtentMin()\n : cartesian.getAxis(faceInfo[2]).getExtentMax();\n var otherDimIdx = dimIndicesMap[faceInfo[2]];\n\n // Line on face.\n for (var i = 0; i < 2; i++) {\n var dim = faceInfo[i];\n var faceOtherDim = faceInfo[1 - i];\n var axis = cartesian.getAxis(dim);\n var faceOtherAxis = cartesian.getAxis(faceOtherDim);\n\n if (!ifShowAxisPointer(axis)) {\n continue;\n }\n\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n var dimIdx = dimIndicesMap[dim];\n var faceOtherDimIdx = dimIndicesMap[faceOtherDim];\n p0[dimIdx] = p1[dimIdx] = point[dimIdx];\n\n p0[otherDimIdx] = p1[otherDimIdx] = otherCoord;\n p0[faceOtherDimIdx] = faceOtherAxis.getExtentMin();\n p1[faceOtherDimIdx] = faceOtherAxis.getExtentMax();\n\n var colorAndLineWidth = getAxisColorAndLineWidth(axis);\n linesGeo.addLine(p0, p1, colorAndLineWidth.color, colorAndLineWidth.lineWidth * dpr);\n }\n\n // Project line.\n if (ifShowAxisPointer(cartesian.getAxis(faceInfo[2]))) {\n var p0 = point.slice();\n var p1 = point.slice();\n p1[otherDimIdx] = otherCoord;\n var colorAndLineWidth = getAxisColorAndLineWidth(cartesian.getAxis(faceInfo[2]));\n linesGeo.addLine(p0, p1, colorAndLineWidth.color, colorAndLineWidth.lineWidth * dpr);\n }\n }\n linesGeo.convertToTypedArray();\n\n this._updateAxisPointerLabelsMesh(data);\n\n this._api.getZr().refresh();\n },\n\n _updateAxisPointerLabelsMesh: function (data) {\n var grid3dModel = this._model;\n var axisPointerLabelsMesh = this._axisPointerLabelsMesh;\n var axisPointerLabelsSurface = this._axisPointerLabelsSurface;\n var cartesian = grid3dModel.coordinateSystem;\n\n var axisPointerParentModel = grid3dModel.getModel('axisPointer');\n\n axisPointerLabelsMesh.geometry.convertToDynamicArray(true);\n axisPointerLabelsSurface.clear();\n\n var otherDim = {\n x: 'y', y: 'x', z: 'y'\n };\n this._axes.forEach(function (axisInfo, idx) {\n var axis = cartesian.getAxis(axisInfo.dim);\n var axisModel = axis.model;\n var axisPointerModel = axisModel.getModel('axisPointer', axisPointerParentModel);\n var labelModel = axisPointerModel.getModel('label');\n var lineColor = axisPointerModel.get('lineStyle.color');\n if (!labelModel.get('show') || !axisPointerModel.get('show')) {\n return;\n }\n var val = data[idx];\n var formatter = labelModel.get('formatter');\n var text = axis.scale.getLabel({ value: val });\n if (formatter != null) {\n text = formatter(text, data);\n }\n else {\n if (axis.scale.type === 'interval' || axis.scale.type === 'log') {\n var precision = echarts.number.getPrecisionSafe(axis.scale.getTicks()[0]);\n text = val.toFixed(precision + 2);\n }\n }\n\n var labelColor = labelModel.get('color');\n var textEl = new echarts.graphic.Text({\n style: createTextStyle(labelModel, {\n text: text,\n fill: labelColor || lineColor,\n align: 'left',\n verticalAlign: 'top'\n })\n });\n\n var coords = axisPointerLabelsSurface.add(textEl);\n var rect = textEl.getBoundingRect();\n var dpr = this._api.getDevicePixelRatio();\n var pos = axisInfo.rootNode.position.toArray();\n var otherIdx = dimIndicesMap[otherDim[axisInfo.dim]];\n pos[otherIdx] += (axisInfo.flipped ? -1 : 1) * labelModel.get('margin');\n pos[dimIndicesMap[axisInfo.dim]] = axis.dataToCoord(data[idx]);\n\n axisPointerLabelsMesh.geometry.addSprite(\n pos, [rect.width * dpr, rect.height * dpr], coords,\n axisInfo.textAlign, axisInfo.textVerticalAlign\n );\n }, this);\n axisPointerLabelsSurface.getZr().refreshImmediately();\n axisPointerLabelsMesh.material.set('uvScale', axisPointerLabelsSurface.getCoordsScale());\n axisPointerLabelsMesh.geometry.convertToTypedArray();\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n this._control.dispose();\n this._axisLabelSurface.dispose();\n this._axisPointerLabelsSurface.dispose();\n }\n});","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util';\n\nvar Cartesian =\n/** @class */\nfunction () {\n function Cartesian(name) {\n this.type = 'cartesian';\n this._dimList = [];\n this._axes = {};\n this.name = name || '';\n }\n\n Cartesian.prototype.getAxis = function (dim) {\n return this._axes[dim];\n };\n\n Cartesian.prototype.getAxes = function () {\n return zrUtil.map(this._dimList, function (dim) {\n return this._axes[dim];\n }, this);\n };\n\n Cartesian.prototype.getAxesByScale = function (scaleType) {\n scaleType = scaleType.toLowerCase();\n return zrUtil.filter(this.getAxes(), function (axis) {\n return axis.scale.type === scaleType;\n });\n };\n\n Cartesian.prototype.addAxis = function (axis) {\n var dim = axis.dim;\n this._axes[dim] = axis;\n\n this._dimList.push(dim);\n };\n\n return Cartesian;\n}();\n\n;\nexport default Cartesian;","import * as echarts from 'echarts/lib/echarts';\nimport Cartesian from 'echarts/lib/coord/cartesian/Cartesian';\n\nfunction Cartesian3D(name) {\n\n Cartesian.call(this, name);\n\n this.type = 'cartesian3D';\n\n this.dimensions = ['x', 'y', 'z'];\n\n this.size = [0, 0, 0];\n}\n\nCartesian3D.prototype = {\n\n constructor: Cartesian3D,\n\n\n model: null,\n\n containPoint: function (point) {\n return this.getAxis('x').contain(point[0])\n && this.getAxis('y').contain(point[2])\n && this.getAxis('z').contain(point[1]);\n },\n\n containData: function (data) {\n return this.getAxis('x').containData(data[0])\n && this.getAxis('y').containData(data[1])\n && this.getAxis('z').containData(data[2]);\n },\n\n dataToPoint: function (data, out, clamp) {\n out = out || [];\n out[0] = this.getAxis('x').dataToCoord(data[0], clamp);\n out[2] = this.getAxis('y').dataToCoord(data[1], clamp);\n out[1] = this.getAxis('z').dataToCoord(data[2], clamp);\n return out;\n },\n\n pointToData: function (point, out, clamp) {\n out = out || [];\n out[0] = this.getAxis('x').coordToData(point[0], clamp);\n out[1] = this.getAxis('y').coordToData(point[2], clamp);\n out[2] = this.getAxis('z').coordToData(point[1], clamp);\n return out;\n }\n};\n\necharts.util.inherits(Cartesian3D, Cartesian);\n\nexport default Cartesian3D;","import * as echarts from 'echarts/lib/echarts';\n\nfunction Axis3D(dim, scale, extent) {\n\n echarts.Axis.call(this, dim, scale, extent);\n}\n\nAxis3D.prototype = {\n constructor: Axis3D,\n\n getExtentMin: function () {\n var extent = this._extent;\n return Math.min(extent[0], extent[1]);\n },\n\n getExtentMax: function () {\n var extent = this._extent;\n return Math.max(extent[0], extent[1]);\n },\n\n calculateCategoryInterval: function () {\n // TODO consider label length\n return Math.floor(this.scale.count() / 8);\n }\n};\n\necharts.util.inherits(Axis3D, echarts.Axis);\n\nexport default Axis3D;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __spreadArrays } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util';\nvar TYPE_DELIMITER = '.';\nvar IS_CONTAINER = '___EC__COMPONENT__CONTAINER___';\nvar IS_EXTENDED_CLASS = '___EC__EXTENDED_CLASS___';\n/**\n * Notice, parseClassType('') should returns {main: '', sub: ''}\n * @public\n */\n\nexport function parseClassType(componentType) {\n var ret = {\n main: '',\n sub: ''\n };\n\n if (componentType) {\n var typeArr = componentType.split(TYPE_DELIMITER);\n ret.main = typeArr[0] || '';\n ret.sub = typeArr[1] || '';\n }\n\n return ret;\n}\n/**\n * @public\n */\n\nfunction checkClassType(componentType) {\n zrUtil.assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(componentType), 'componentType \"' + componentType + '\" illegal');\n}\n\nexport function isExtendedClass(clz) {\n return !!(clz && clz[IS_EXTENDED_CLASS]);\n}\n/**\n * Implements `ExtendableConstructor` for `rootClz`.\n *\n * @usage\n * ```ts\n * class Xxx {}\n * type XxxConstructor = typeof Xxx & ExtendableConstructor\n * enableClassExtend(Xxx as XxxConstructor);\n * ```\n */\n\nexport function enableClassExtend(rootClz, mandatoryMethods) {\n rootClz.$constructor = rootClz; // FIXME: not necessary?\n\n rootClz.extend = function (proto) {\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.each(mandatoryMethods, function (method) {\n if (!proto[method]) {\n console.warn('Method `' + method + '` should be implemented' + (proto.type ? ' in ' + proto.type : '') + '.');\n }\n });\n }\n\n var superClass = this; // For backward compat, we both support ts class inheritance and this\n // \"extend\" approach.\n // The constructor should keep the same behavior as ts class inheritance:\n // If this constructor/$constructor is not declared, auto invoke the super\n // constructor.\n // If this constructor/$constructor is declared, it is responsible for\n // calling the super constructor.\n\n function ExtendedClass() {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n if (!proto.$constructor) {\n if (!isESClass(superClass)) {\n // Will throw error if superClass is an es6 native class.\n superClass.apply(this, arguments);\n } else {\n var ins = zrUtil.createObject( // @ts-ignore\n ExtendedClass.prototype, new (superClass.bind.apply(superClass, __spreadArrays([void 0], args)))());\n return ins;\n }\n } else {\n proto.$constructor.apply(this, arguments);\n }\n }\n\n ExtendedClass[IS_EXTENDED_CLASS] = true;\n zrUtil.extend(ExtendedClass.prototype, proto);\n ExtendedClass.extend = this.extend;\n ExtendedClass.superCall = superCall;\n ExtendedClass.superApply = superApply;\n zrUtil.inherits(ExtendedClass, this);\n ExtendedClass.superClass = superClass;\n return ExtendedClass;\n };\n}\n\nfunction isESClass(fn) {\n return typeof fn === 'function' && /^class\\s/.test(Function.prototype.toString.call(fn));\n}\n/**\n * A work around to both support ts extend and this extend mechanism.\n * on sub-class.\n * @usage\n * ```ts\n * class Component { ... }\n * classUtil.enableClassExtend(Component);\n * classUtil.enableClassManagement(Component, {registerWhenExtend: true});\n *\n * class Series extends Component { ... }\n * // Without calling `markExtend`, `registerWhenExtend` will not work.\n * Component.markExtend(Series);\n * ```\n */\n\n\nexport function mountExtend(SubClz, SupperClz) {\n SubClz.extend = SupperClz.extend;\n} // A random offset.\n\nvar classBase = Math.round(Math.random() * 10);\n/**\n * Implements `CheckableConstructor` for `target`.\n * Can not use instanceof, consider different scope by\n * cross domain or es module import in ec extensions.\n * Mount a method \"isInstance()\" to Clz.\n *\n * @usage\n * ```ts\n * class Xxx {}\n * type XxxConstructor = typeof Xxx & CheckableConstructor;\n * enableClassCheck(Xxx as XxxConstructor)\n * ```\n */\n\nexport function enableClassCheck(target) {\n var classAttr = ['__\\0is_clz', classBase++].join('_');\n target.prototype[classAttr] = true;\n\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.assert(!target.isInstance, 'The method \"is\" can not be defined.');\n }\n\n target.isInstance = function (obj) {\n return !!(obj && obj[classAttr]);\n };\n} // superCall should have class info, which can not be fetch from 'this'.\n// Consider this case:\n// class A has method f,\n// class B inherits class A, overrides method f, f call superApply('f'),\n// class C inherits class B, do not overrides method f,\n// then when method of class C is called, dead loop occured.\n\nfunction superCall(context, methodName) {\n var args = [];\n\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n\n return this.superClass.prototype[methodName].apply(context, args);\n}\n\nfunction superApply(context, methodName, args) {\n return this.superClass.prototype[methodName].apply(context, args);\n}\n/**\n * Implements `ClassManager` for `target`\n *\n * @usage\n * ```ts\n * class Xxx {}\n * type XxxConstructor = typeof Xxx & ClassManager\n * enableClassManagement(Xxx as XxxConstructor);\n * ```\n */\n\n\nexport function enableClassManagement(target) {\n /**\n * Component model classes\n * key: componentType,\n * value:\n * componentClass, when componentType is 'xxx'\n * or Object., when componentType is 'xxx.yy'\n */\n var storage = {};\n\n target.registerClass = function (clz) {\n // `type` should not be a \"instance memeber\".\n // If using TS class, should better declared as `static type = 'series.pie'`.\n // otherwise users have to mount `type` on prototype manually.\n // For backward compat and enable instance visit type via `this.type`,\n // we stil support fetch `type` from prototype.\n var componentFullType = clz.type || clz.prototype.type;\n\n if (componentFullType) {\n checkClassType(componentFullType); // If only static type declared, we assign it to prototype mandatorily.\n\n clz.prototype.type = componentFullType;\n var componentTypeInfo = parseClassType(componentFullType);\n\n if (!componentTypeInfo.sub) {\n if (process.env.NODE_ENV !== 'production') {\n if (storage[componentTypeInfo.main]) {\n console.warn(componentTypeInfo.main + ' exists.');\n }\n }\n\n storage[componentTypeInfo.main] = clz;\n } else if (componentTypeInfo.sub !== IS_CONTAINER) {\n var container = makeContainer(componentTypeInfo);\n container[componentTypeInfo.sub] = clz;\n }\n }\n\n return clz;\n };\n\n target.getClass = function (mainType, subType, throwWhenNotFound) {\n var clz = storage[mainType];\n\n if (clz && clz[IS_CONTAINER]) {\n clz = subType ? clz[subType] : null;\n }\n\n if (throwWhenNotFound && !clz) {\n throw new Error(!subType ? mainType + '.' + 'type should be specified.' : 'Component ' + mainType + '.' + (subType || '') + ' is used but not imported.');\n }\n\n return clz;\n };\n\n target.getClassesByMainType = function (componentType) {\n var componentTypeInfo = parseClassType(componentType);\n var result = [];\n var obj = storage[componentTypeInfo.main];\n\n if (obj && obj[IS_CONTAINER]) {\n zrUtil.each(obj, function (o, type) {\n type !== IS_CONTAINER && result.push(o);\n });\n } else {\n result.push(obj);\n }\n\n return result;\n };\n\n target.hasClass = function (componentType) {\n // Just consider componentType.main.\n var componentTypeInfo = parseClassType(componentType);\n return !!storage[componentTypeInfo.main];\n };\n /**\n * @return Like ['aa', 'bb'], but can not be ['aa.xx']\n */\n\n\n target.getAllClassMainTypes = function () {\n var types = [];\n zrUtil.each(storage, function (obj, type) {\n types.push(type);\n });\n return types;\n };\n /**\n * If a main type is container and has sub types\n */\n\n\n target.hasSubTypes = function (componentType) {\n var componentTypeInfo = parseClassType(componentType);\n var obj = storage[componentTypeInfo.main];\n return obj && obj[IS_CONTAINER];\n };\n\n function makeContainer(componentTypeInfo) {\n var container = storage[componentTypeInfo.main];\n\n if (!container || !container[IS_CONTAINER]) {\n container = storage[componentTypeInfo.main] = {};\n container[IS_CONTAINER] = true;\n }\n\n return container;\n }\n} // /**\n// * @param {string|Array.} properties\n// */\n// export function setReadOnly(obj, properties) {\n// FIXME It seems broken in IE8 simulation of IE11\n// if (!zrUtil.isArray(properties)) {\n// properties = properties != null ? [properties] : [];\n// }\n// zrUtil.each(properties, function (prop) {\n// let value = obj[prop];\n// Object.defineProperty\n// && Object.defineProperty(obj, prop, {\n// value: value, writable: false\n// });\n// zrUtil.isArray(obj[prop])\n// && Object.freeze\n// && Object.freeze(obj[prop]);\n// });\n// }","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// TODO Parse shadow style\n// TODO Only shallow path support\nimport * as zrUtil from 'zrender/lib/core/util';\nexport default function makeStyleMapper(properties, ignoreParent) {\n // Normalize\n for (var i = 0; i < properties.length; i++) {\n if (!properties[i][1]) {\n properties[i][1] = properties[i][0];\n }\n }\n\n ignoreParent = ignoreParent || false;\n return function (model, excludes, includes) {\n var style = {};\n\n for (var i = 0; i < properties.length; i++) {\n var propName = properties[i][1];\n\n if (excludes && zrUtil.indexOf(excludes, propName) >= 0 || includes && zrUtil.indexOf(includes, propName) < 0) {\n continue;\n }\n\n var val = model.getShallow(propName, ignoreParent);\n\n if (val != null) {\n style[properties[i][0]] = val;\n }\n } // TODO Text or image?\n\n\n return style;\n };\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport makeStyleMapper from './makeStyleMapper';\nexport var AREA_STYLE_KEY_MAP = [['fill', 'color'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['opacity'], ['shadowColor'] // Option decal is in `DecalObject` but style.decal is in `PatternObject`.\n// So do not transfer decal directly.\n];\nvar getAreaStyle = makeStyleMapper(AREA_STYLE_KEY_MAP);\n\nvar AreaStyleMixin =\n/** @class */\nfunction () {\n function AreaStyleMixin() {}\n\n AreaStyleMixin.prototype.getAreaStyle = function (excludes, includes) {\n return getAreaStyle(this, excludes, includes);\n };\n\n return AreaStyleMixin;\n}();\n\n;\nexport { AreaStyleMixin };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { getFont } from '../../label/labelStyle';\nimport ZRText from 'zrender/lib/graphic/Text';\nvar PATH_COLOR = ['textStyle', 'color']; // TODO Performance improvement?\n\nvar tmpRichText = new ZRText();\n\nvar TextStyleMixin =\n/** @class */\nfunction () {\n function TextStyleMixin() {}\n /**\n * Get color property or get color from option.textStyle.color\n */\n // TODO Callback\n\n\n TextStyleMixin.prototype.getTextColor = function (isEmphasis) {\n var ecModel = this.ecModel;\n return this.getShallow('color') || (!isEmphasis && ecModel ? ecModel.get(PATH_COLOR) : null);\n };\n /**\n * Create font string from fontStyle, fontWeight, fontSize, fontFamily\n * @return {string}\n */\n\n\n TextStyleMixin.prototype.getFont = function () {\n return getFont({\n fontStyle: this.getShallow('fontStyle'),\n fontWeight: this.getShallow('fontWeight'),\n fontSize: this.getShallow('fontSize'),\n fontFamily: this.getShallow('fontFamily')\n }, this.ecModel);\n };\n\n TextStyleMixin.prototype.getTextRect = function (text) {\n tmpRichText.useStyle({\n text: text,\n fontStyle: this.getShallow('fontStyle'),\n fontWeight: this.getShallow('fontWeight'),\n fontSize: this.getShallow('fontSize'),\n fontFamily: this.getShallow('fontFamily'),\n verticalAlign: this.getShallow('verticalAlign') || this.getShallow('baseline'),\n padding: this.getShallow('padding'),\n lineHeight: this.getShallow('lineHeight'),\n rich: this.getShallow('rich')\n });\n tmpRichText.update();\n return tmpRichText.getBoundingRect();\n };\n\n return TextStyleMixin;\n}();\n\n;\nexport default TextStyleMixin;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport makeStyleMapper from './makeStyleMapper';\nexport var LINE_STYLE_KEY_MAP = [['lineWidth', 'width'], ['stroke', 'color'], ['opacity'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor'], ['lineDash', 'type'], ['lineDashOffset', 'dashOffset'], ['lineCap', 'cap'], ['lineJoin', 'join'], ['miterLimit'] // Option decal is in `DecalObject` but style.decal is in `PatternObject`.\n// So do not transfer decal directly.\n];\nvar getLineStyle = makeStyleMapper(LINE_STYLE_KEY_MAP);\n\nvar LineStyleMixin =\n/** @class */\nfunction () {\n function LineStyleMixin() {}\n\n LineStyleMixin.prototype.getLineStyle = function (excludes) {\n return getLineStyle(this, excludes);\n };\n\n return LineStyleMixin;\n}();\n\n;\nexport { LineStyleMixin };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport makeStyleMapper from './makeStyleMapper';\nexport var ITEM_STYLE_KEY_MAP = [['fill', 'color'], ['stroke', 'borderColor'], ['lineWidth', 'borderWidth'], ['opacity'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor'], ['lineDash', 'borderType'], ['lineDashOffset', 'borderDashOffset'], ['lineCap', 'borderCap'], ['lineJoin', 'borderJoin'], ['miterLimit', 'borderMiterLimit'] // Option decal is in `DecalObject` but style.decal is in `PatternObject`.\n// So do not transfer decal directly.\n];\nvar getItemStyle = makeStyleMapper(ITEM_STYLE_KEY_MAP);\n\nvar ItemStyleMixin =\n/** @class */\nfunction () {\n function ItemStyleMixin() {}\n\n ItemStyleMixin.prototype.getItemStyle = function (excludes, includes) {\n return getItemStyle(this, excludes, includes);\n };\n\n return ItemStyleMixin;\n}();\n\nexport { ItemStyleMixin };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport env from 'zrender/lib/core/env';\nimport { enableClassExtend, enableClassCheck } from '../util/clazz';\nimport { AreaStyleMixin } from './mixin/areaStyle';\nimport TextStyleMixin from './mixin/textStyle';\nimport { LineStyleMixin } from './mixin/lineStyle';\nimport { ItemStyleMixin } from './mixin/itemStyle';\nimport { mixin, clone, merge } from 'zrender/lib/core/util';\n\nvar Model =\n/** @class */\nfunction () {\n function Model(option, parentModel, ecModel) {\n this.parentModel = parentModel;\n this.ecModel = ecModel;\n this.option = option; // Simple optimization\n // if (this.init) {\n // if (arguments.length <= 4) {\n // this.init(option, parentModel, ecModel, extraOpt);\n // }\n // else {\n // this.init.apply(this, arguments);\n // }\n // }\n }\n\n Model.prototype.init = function (option, parentModel, ecModel) {\n var rest = [];\n\n for (var _i = 3; _i < arguments.length; _i++) {\n rest[_i - 3] = arguments[_i];\n }\n };\n /**\n * Merge the input option to me.\n */\n\n\n Model.prototype.mergeOption = function (option, ecModel) {\n merge(this.option, option, true);\n }; // `path` can be 'xxx.yyy.zzz', so the return value type have to be `ModelOption`\n // TODO: TYPE strict key check?\n // get(path: string | string[], ignoreParent?: boolean): ModelOption;\n\n\n Model.prototype.get = function (path, ignoreParent) {\n if (path == null) {\n return this.option;\n }\n\n return this._doGet(this.parsePath(path), !ignoreParent && this.parentModel);\n };\n\n Model.prototype.getShallow = function (key, ignoreParent) {\n var option = this.option;\n var val = option == null ? option : option[key];\n\n if (val == null && !ignoreParent) {\n var parentModel = this.parentModel;\n\n if (parentModel) {\n // FIXME:TS do not know how to make it works\n val = parentModel.getShallow(key);\n }\n }\n\n return val;\n }; // `path` can be 'xxx.yyy.zzz', so the return value type have to be `Model`\n // getModel(path: string | string[], parentModel?: Model): Model;\n // TODO 'xxx.yyy.zzz' is deprecated\n\n\n Model.prototype.getModel = function (path, parentModel) {\n var hasPath = path != null;\n var pathFinal = hasPath ? this.parsePath(path) : null;\n var obj = hasPath ? this._doGet(pathFinal) : this.option;\n parentModel = parentModel || this.parentModel && this.parentModel.getModel(this.resolveParentPath(pathFinal));\n return new Model(obj, parentModel, this.ecModel);\n };\n /**\n * Squash option stack into one.\n * parentModel will be removed after squashed.\n *\n * NOTE: resolveParentPath will not be applied here for simplicity. DON'T use this function\n * if resolveParentPath is modified.\n *\n * @param deepMerge If do deep merge. Default to be false.\n */\n // squash(\n // deepMerge?: boolean,\n // handleCallback?: (func: () => object) => object\n // ) {\n // const optionStack = [];\n // let model: Model = this;\n // while (model) {\n // if (model.option) {\n // optionStack.push(model.option);\n // }\n // model = model.parentModel;\n // }\n // const newOption = {} as Opt;\n // let option;\n // while (option = optionStack.pop()) { // Top down merge\n // if (isFunction(option) && handleCallback) {\n // option = handleCallback(option);\n // }\n // if (deepMerge) {\n // merge(newOption, option);\n // }\n // else {\n // extend(newOption, option);\n // }\n // }\n // // Remove parentModel\n // this.option = newOption;\n // this.parentModel = null;\n // }\n\n /**\n * If model has option\n */\n\n\n Model.prototype.isEmpty = function () {\n return this.option == null;\n };\n\n Model.prototype.restoreData = function () {}; // Pending\n\n\n Model.prototype.clone = function () {\n var Ctor = this.constructor;\n return new Ctor(clone(this.option));\n }; // setReadOnly(properties): void {\n // clazzUtil.setReadOnly(this, properties);\n // }\n // If path is null/undefined, return null/undefined.\n\n\n Model.prototype.parsePath = function (path) {\n if (typeof path === 'string') {\n return path.split('.');\n }\n\n return path;\n }; // Resolve path for parent. Perhaps useful when parent use a different property.\n // Default to be a identity resolver.\n // Can be modified to a different resolver.\n\n\n Model.prototype.resolveParentPath = function (path) {\n return path;\n }; // FIXME:TS check whether put this method here\n\n\n Model.prototype.isAnimationEnabled = function () {\n if (!env.node && this.option) {\n if (this.option.animation != null) {\n return !!this.option.animation;\n } else if (this.parentModel) {\n return this.parentModel.isAnimationEnabled();\n }\n }\n };\n\n Model.prototype._doGet = function (pathArr, parentModel) {\n var obj = this.option;\n\n if (!pathArr) {\n return obj;\n }\n\n for (var i = 0; i < pathArr.length; i++) {\n // Ignore empty\n if (!pathArr[i]) {\n continue;\n } // obj could be number/string/... (like 0)\n\n\n obj = obj && typeof obj === 'object' ? obj[pathArr[i]] : null;\n\n if (obj == null) {\n break;\n }\n }\n\n if (obj == null && parentModel) {\n obj = parentModel._doGet(this.resolveParentPath(pathArr), parentModel.parentModel);\n }\n\n return obj;\n };\n\n return Model;\n}();\n\n; // Enable Model.extend.\n\nenableClassExtend(Model);\nenableClassCheck(Model);\nmixin(Model, LineStyleMixin);\nmixin(Model, ItemStyleMixin);\nmixin(Model, AreaStyleMixin);\nmixin(Model, TextStyleMixin);\nexport default Model;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * Language: English.\n */\nexport default {\n time: {\n month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n monthAbbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n dayOfWeek: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n dayOfWeekAbbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\n },\n legend: {\n selector: {\n all: 'All',\n inverse: 'Inv'\n }\n },\n toolbox: {\n brush: {\n title: {\n rect: 'Box Select',\n polygon: 'Lasso Select',\n lineX: 'Horizontally Select',\n lineY: 'Vertically Select',\n keep: 'Keep Selections',\n clear: 'Clear Selections'\n }\n },\n dataView: {\n title: 'Data View',\n lang: ['Data View', 'Close', 'Refresh']\n },\n dataZoom: {\n title: {\n zoom: 'Zoom',\n back: 'Zoom Reset'\n }\n },\n magicType: {\n title: {\n line: 'Switch to Line Chart',\n bar: 'Switch to Bar Chart',\n stack: 'Stack',\n tiled: 'Tile'\n }\n },\n restore: {\n title: 'Restore'\n },\n saveAsImage: {\n title: 'Save as Image',\n lang: ['Right Click to Save Image']\n }\n },\n series: {\n typeNames: {\n pie: 'Pie chart',\n bar: 'Bar chart',\n line: 'Line chart',\n scatter: 'Scatter plot',\n effectScatter: 'Ripple scatter plot',\n radar: 'Radar chart',\n tree: 'Tree',\n treemap: 'Treemap',\n boxplot: 'Boxplot',\n candlestick: 'Candlestick',\n k: 'K line chart',\n heatmap: 'Heat map',\n map: 'Map',\n parallel: 'Parallel coordinate map',\n lines: 'Line graph',\n graph: 'Relationship graph',\n sankey: 'Sankey diagram',\n funnel: 'Funnel chart',\n gauge: 'Gauge',\n pictorialBar: 'Pictorial bar',\n themeRiver: 'Theme River Map',\n sunburst: 'Sunburst'\n }\n },\n aria: {\n general: {\n withTitle: 'This is a chart about \"{title}\"',\n withoutTitle: 'This is a chart'\n },\n series: {\n single: {\n prefix: '',\n withName: ' with type {seriesType} named {seriesName}.',\n withoutName: ' with type {seriesType}.'\n },\n multiple: {\n prefix: '. It consists of {seriesCount} series count.',\n withName: ' The {seriesId} series is a {seriesType} representing {seriesName}.',\n withoutName: ' The {seriesId} series is a {seriesType}.',\n separator: {\n middle: '',\n end: ''\n }\n }\n },\n data: {\n allData: 'The data is as follows: ',\n partialData: 'The first {displayCnt} items are: ',\n withName: 'the data for {name} is {value}',\n withoutName: '{value}',\n separator: {\n middle: ', ',\n end: '. '\n }\n }\n }\n};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\nexport default {\n time: {\n month: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],\n monthAbbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],\n dayOfWeek: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],\n dayOfWeekAbbr: ['日', '一', '二', '三', '四', '五', '六']\n },\n legend: {\n selector: {\n all: '全选',\n inverse: '反选'\n }\n },\n toolbox: {\n brush: {\n title: {\n rect: '矩形选择',\n polygon: '圈选',\n lineX: '横向选择',\n lineY: '纵向选择',\n keep: '保持选择',\n clear: '清除选择'\n }\n },\n dataView: {\n title: '数据视图',\n lang: ['数据视图', '关闭', '刷新']\n },\n dataZoom: {\n title: {\n zoom: '区域缩放',\n back: '区域缩放还原'\n }\n },\n magicType: {\n title: {\n line: '切换为折线图',\n bar: '切换为柱状图',\n stack: '切换为堆叠',\n tiled: '切换为平铺'\n }\n },\n restore: {\n title: '还原'\n },\n saveAsImage: {\n title: '保存为图片',\n lang: ['右键另存为图片']\n }\n },\n series: {\n typeNames: {\n pie: '饼图',\n bar: '柱状图',\n line: '折线图',\n scatter: '散点图',\n effectScatter: '涟漪散点图',\n radar: '雷达图',\n tree: '树图',\n treemap: '矩形树图',\n boxplot: '箱型图',\n candlestick: 'K线图',\n k: 'K线图',\n heatmap: '热力图',\n map: '地图',\n parallel: '平行坐标图',\n lines: '线图',\n graph: '关系图',\n sankey: '桑基图',\n funnel: '漏斗图',\n gauge: '仪表盘图',\n pictorialBar: '象形柱图',\n themeRiver: '主题河流图',\n sunburst: '旭日图'\n }\n },\n aria: {\n general: {\n withTitle: '这是一个关于“{title}”的图表。',\n withoutTitle: '这是一个图表,'\n },\n series: {\n single: {\n prefix: '',\n withName: '图表类型是{seriesType},表示{seriesName}。',\n withoutName: '图表类型是{seriesType}。'\n },\n multiple: {\n prefix: '它由{seriesCount}个图表系列组成。',\n withName: '第{seriesId}个系列是一个表示{seriesName}的{seriesType},',\n withoutName: '第{seriesId}个系列是一个{seriesType},',\n separator: {\n middle: ';',\n end: '。'\n }\n }\n },\n data: {\n allData: '其数据是——',\n partialData: '其中,前{displayCnt}项是——',\n withName: '{name}的数据是{value}',\n withoutName: '{value}',\n separator: {\n middle: ',',\n end: ''\n }\n }\n }\n};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport Model from '../model/Model';\nimport env from 'zrender/lib/core/env'; // default import ZH and EN lang\n\nimport langEN from '../i18n/langEN';\nimport langZH from '../i18n/langZH';\nimport { isString, clone, merge } from 'zrender/lib/core/util';\nvar LOCALE_ZH = 'ZH';\nvar LOCALE_EN = 'EN';\nvar DEFAULT_LOCALE = LOCALE_EN;\nvar localeStorage = {};\nvar localeModels = {};\nexport var SYSTEM_LANG = !env.domSupported ? DEFAULT_LOCALE : function () {\n var langStr = (\n /* eslint-disable-next-line */\n document.documentElement.lang || navigator.language || navigator.browserLanguage).toUpperCase();\n return langStr.indexOf(LOCALE_ZH) > -1 ? LOCALE_ZH : DEFAULT_LOCALE;\n}();\nexport function registerLocale(locale, localeObj) {\n locale = locale.toUpperCase();\n localeModels[locale] = new Model(localeObj);\n localeStorage[locale] = localeObj;\n} // export function getLocale(locale: string) {\n// return localeStorage[locale];\n// }\n\nexport function createLocaleObject(locale) {\n if (isString(locale)) {\n var localeObj = localeStorage[locale.toUpperCase()] || {};\n\n if (locale === LOCALE_ZH || locale === LOCALE_EN) {\n return clone(localeObj);\n } else {\n return merge(clone(localeObj), clone(localeStorage[DEFAULT_LOCALE]), false);\n }\n } else {\n return merge(clone(locale), clone(localeStorage[DEFAULT_LOCALE]), false);\n }\n}\nexport function getLocaleModel(lang) {\n return localeModels[lang];\n}\nexport function getDefaultLocaleModel() {\n return localeModels[DEFAULT_LOCALE];\n} // Default locale\n\nregisterLocale(LOCALE_EN, langEN);\nregisterLocale(LOCALE_ZH, langZH);","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util';\nimport * as numberUtil from './number';\nimport { getDefaultLocaleModel, getLocaleModel, SYSTEM_LANG } from '../core/locale';\nimport Model from '../model/Model';\nexport var ONE_SECOND = 1000;\nexport var ONE_MINUTE = ONE_SECOND * 60;\nexport var ONE_HOUR = ONE_MINUTE * 60;\nexport var ONE_DAY = ONE_HOUR * 24;\nexport var ONE_YEAR = ONE_DAY * 365;\nexport var defaultLeveledFormatter = {\n year: '{yyyy}',\n month: '{MMM}',\n day: '{d}',\n hour: '{HH}:{mm}',\n minute: '{HH}:{mm}',\n second: '{HH}:{mm}:{ss}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}'\n};\nvar fullDayFormatter = '{yyyy}-{MM}-{dd}';\nexport var fullLeveledFormatter = {\n year: '{yyyy}',\n month: '{yyyy}-{MM}',\n day: fullDayFormatter,\n hour: fullDayFormatter + ' ' + defaultLeveledFormatter.hour,\n minute: fullDayFormatter + ' ' + defaultLeveledFormatter.minute,\n second: fullDayFormatter + ' ' + defaultLeveledFormatter.second,\n millisecond: defaultLeveledFormatter.none\n};\nexport var primaryTimeUnits = ['year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond'];\nexport var timeUnits = ['year', 'half-year', 'quarter', 'month', 'week', 'half-week', 'day', 'half-day', 'quarter-day', 'hour', 'minute', 'second', 'millisecond'];\nexport function pad(str, len) {\n str += '';\n return '0000'.substr(0, len - str.length) + str;\n}\nexport function getPrimaryTimeUnit(timeUnit) {\n switch (timeUnit) {\n case 'half-year':\n case 'quarter':\n return 'month';\n\n case 'week':\n case 'half-week':\n return 'day';\n\n case 'half-day':\n case 'quarter-day':\n return 'hour';\n\n default:\n // year, minutes, second, milliseconds\n return timeUnit;\n }\n}\nexport function isPrimaryTimeUnit(timeUnit) {\n return timeUnit === getPrimaryTimeUnit(timeUnit);\n}\nexport function getDefaultFormatPrecisionOfInterval(timeUnit) {\n switch (timeUnit) {\n case 'year':\n case 'month':\n return 'day';\n\n case 'millisecond':\n return 'millisecond';\n\n default:\n // Also for day, hour, minute, second\n return 'second';\n }\n}\nexport function format( // Note: The result based on `isUTC` are totally different, which can not be just simply\n// substituted by the result without `isUTC`. So we make the param `isUTC` mandatory.\ntime, template, isUTC, lang) {\n var date = numberUtil.parseDate(time);\n var y = date[fullYearGetterName(isUTC)]();\n var M = date[monthGetterName(isUTC)]() + 1;\n var q = Math.floor((M - 1) / 4) + 1;\n var d = date[dateGetterName(isUTC)]();\n var e = date['get' + (isUTC ? 'UTC' : '') + 'Day']();\n var H = date[hoursGetterName(isUTC)]();\n var h = (H - 1) % 12 + 1;\n var m = date[minutesGetterName(isUTC)]();\n var s = date[secondsGetterName(isUTC)]();\n var S = date[millisecondsGetterName(isUTC)]();\n var localeModel = lang instanceof Model ? lang : getLocaleModel(lang || SYSTEM_LANG) || getDefaultLocaleModel();\n var timeModel = localeModel.getModel('time');\n var month = timeModel.get('month');\n var monthAbbr = timeModel.get('monthAbbr');\n var dayOfWeek = timeModel.get('dayOfWeek');\n var dayOfWeekAbbr = timeModel.get('dayOfWeekAbbr');\n return (template || '').replace(/{yyyy}/g, y + '').replace(/{yy}/g, y % 100 + '').replace(/{Q}/g, q + '').replace(/{MMMM}/g, month[M - 1]).replace(/{MMM}/g, monthAbbr[M - 1]).replace(/{MM}/g, pad(M, 2)).replace(/{M}/g, M + '').replace(/{dd}/g, pad(d, 2)).replace(/{d}/g, d + '').replace(/{eeee}/g, dayOfWeek[e]).replace(/{ee}/g, dayOfWeekAbbr[e]).replace(/{e}/g, e + '').replace(/{HH}/g, pad(H, 2)).replace(/{H}/g, H + '').replace(/{hh}/g, pad(h + '', 2)).replace(/{h}/g, h + '').replace(/{mm}/g, pad(m, 2)).replace(/{m}/g, m + '').replace(/{ss}/g, pad(s, 2)).replace(/{s}/g, s + '').replace(/{SSS}/g, pad(S, 3)).replace(/{S}/g, S + '');\n}\nexport function leveledFormat(tick, idx, formatter, lang, isUTC) {\n var template = null;\n\n if (typeof formatter === 'string') {\n // Single formatter for all units at all levels\n template = formatter;\n } else if (typeof formatter === 'function') {\n // Callback formatter\n template = formatter(tick.value, idx, {\n level: tick.level\n });\n } else {\n var defaults = zrUtil.extend({}, defaultLeveledFormatter);\n\n if (tick.level > 0) {\n for (var i = 0; i < primaryTimeUnits.length; ++i) {\n defaults[primaryTimeUnits[i]] = \"{primary|\" + defaults[primaryTimeUnits[i]] + \"}\";\n }\n }\n\n var mergedFormatter = formatter ? formatter.inherit === false ? formatter // Use formatter with bigger units\n : zrUtil.defaults(formatter, defaults) : defaults;\n var unit = getUnitFromValue(tick.value, isUTC);\n\n if (mergedFormatter[unit]) {\n template = mergedFormatter[unit];\n } else if (mergedFormatter.inherit) {\n // Unit formatter is not defined and should inherit from bigger units\n var targetId = timeUnits.indexOf(unit);\n\n for (var i = targetId - 1; i >= 0; --i) {\n if (mergedFormatter[unit]) {\n template = mergedFormatter[unit];\n break;\n }\n }\n\n template = template || defaults.none;\n }\n\n if (zrUtil.isArray(template)) {\n var levelId = tick.level == null ? 0 : tick.level >= 0 ? tick.level : template.length + tick.level;\n levelId = Math.min(levelId, template.length - 1);\n template = template[levelId];\n }\n }\n\n return format(new Date(tick.value), template, isUTC, lang);\n}\nexport function getUnitFromValue(value, isUTC) {\n var date = numberUtil.parseDate(value);\n var M = date[monthGetterName(isUTC)]() + 1;\n var d = date[dateGetterName(isUTC)]();\n var h = date[hoursGetterName(isUTC)]();\n var m = date[minutesGetterName(isUTC)]();\n var s = date[secondsGetterName(isUTC)]();\n var S = date[millisecondsGetterName(isUTC)]();\n var isSecond = S === 0;\n var isMinute = isSecond && s === 0;\n var isHour = isMinute && m === 0;\n var isDay = isHour && h === 0;\n var isMonth = isDay && d === 1;\n var isYear = isMonth && M === 1;\n\n if (isYear) {\n return 'year';\n } else if (isMonth) {\n return 'month';\n } else if (isDay) {\n return 'day';\n } else if (isHour) {\n return 'hour';\n } else if (isMinute) {\n return 'minute';\n } else if (isSecond) {\n return 'second';\n } else {\n return 'millisecond';\n }\n}\nexport function getUnitValue(value, unit, isUTC) {\n var date = typeof value === 'number' ? numberUtil.parseDate(value) : value;\n unit = unit || getUnitFromValue(value, isUTC);\n\n switch (unit) {\n case 'year':\n return date[fullYearGetterName(isUTC)]();\n\n case 'half-year':\n return date[monthGetterName(isUTC)]() >= 6 ? 1 : 0;\n\n case 'quarter':\n return Math.floor((date[monthGetterName(isUTC)]() + 1) / 4);\n\n case 'month':\n return date[monthGetterName(isUTC)]();\n\n case 'day':\n return date[dateGetterName(isUTC)]();\n\n case 'half-day':\n return date[hoursGetterName(isUTC)]() / 24;\n\n case 'hour':\n return date[hoursGetterName(isUTC)]();\n\n case 'minute':\n return date[minutesGetterName(isUTC)]();\n\n case 'second':\n return date[secondsGetterName(isUTC)]();\n\n case 'millisecond':\n return date[millisecondsGetterName(isUTC)]();\n }\n}\nexport function fullYearGetterName(isUTC) {\n return isUTC ? 'getUTCFullYear' : 'getFullYear';\n}\nexport function monthGetterName(isUTC) {\n return isUTC ? 'getUTCMonth' : 'getMonth';\n}\nexport function dateGetterName(isUTC) {\n return isUTC ? 'getUTCDate' : 'getDate';\n}\nexport function hoursGetterName(isUTC) {\n return isUTC ? 'getUTCHours' : 'getHours';\n}\nexport function minutesGetterName(isUTC) {\n return isUTC ? 'getUTCMinutes' : 'getMinutes';\n}\nexport function secondsGetterName(isUTC) {\n return isUTC ? 'getUTCSeconds' : 'getSeconds';\n}\nexport function millisecondsGetterName(isUTC) {\n return isUTC ? 'getUTCSeconds' : 'getSeconds';\n}\nexport function fullYearSetterName(isUTC) {\n return isUTC ? 'setUTCFullYear' : 'setFullYear';\n}\nexport function monthSetterName(isUTC) {\n return isUTC ? 'setUTCMonth' : 'setMonth';\n}\nexport function dateSetterName(isUTC) {\n return isUTC ? 'setUTCDate' : 'setDate';\n}\nexport function hoursSetterName(isUTC) {\n return isUTC ? 'setUTCHours' : 'setHours';\n}\nexport function minutesSetterName(isUTC) {\n return isUTC ? 'setUTCMinutes' : 'setMinutes';\n}\nexport function secondsSetterName(isUTC) {\n return isUTC ? 'setUTCSeconds' : 'setSeconds';\n}\nexport function millisecondsSetterName(isUTC) {\n return isUTC ? 'setUTCSeconds' : 'setSeconds';\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { Text } from '../util/graphic';\nimport { deprecateLog } from '../util/log';\nexport function getTextRect(text, font, align, verticalAlign, padding, rich, truncate, lineHeight) {\n deprecateLog('getTextRect is deprecated.');\n var textEl = new Text({\n style: {\n text: text,\n font: font,\n align: align,\n verticalAlign: verticalAlign,\n padding: padding,\n rich: rich,\n overflow: truncate ? 'truncate' : null,\n lineHeight: lineHeight\n }\n });\n return textEl.getBoundingRect();\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util';\nimport { parseDate, isNumeric, numericToNumber } from './number';\nimport { format as timeFormat, pad } from './time';\nimport { deprecateReplaceLog } from './log';\n/**\n * Add a comma each three digit.\n */\n\nexport function addCommas(x) {\n if (!isNumeric(x)) {\n return zrUtil.isString(x) ? x : '-';\n }\n\n var parts = (x + '').split('.');\n return parts[0].replace(/(\\d{1,3})(?=(?:\\d{3})+(?!\\d))/g, '$1,') + (parts.length > 1 ? '.' + parts[1] : '');\n}\nexport function toCamelCase(str, upperCaseFirst) {\n str = (str || '').toLowerCase().replace(/-(.)/g, function (match, group1) {\n return group1.toUpperCase();\n });\n\n if (upperCaseFirst && str) {\n str = str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n return str;\n}\nexport var normalizeCssArray = zrUtil.normalizeCssArray;\nvar replaceReg = /([&<>\"'])/g;\nvar replaceMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n '\\'': '''\n};\nexport function encodeHTML(source) {\n return source == null ? '' : (source + '').replace(replaceReg, function (str, c) {\n return replaceMap[c];\n });\n}\n/**\n * Make value user readable for tooltip and label.\n * \"User readable\":\n * Try to not print programmer-specific text like NaN, Infinity, null, undefined.\n * Avoid to display an empty string, which users can not recognize there is\n * a value and it might look like a bug.\n */\n\nexport function makeValueReadable(value, valueType, useUTC) {\n var USER_READABLE_DEFUALT_TIME_PATTERN = '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}';\n\n function stringToUserReadable(str) {\n return str && zrUtil.trim(str) ? str : '-';\n }\n\n function isNumberUserReadable(num) {\n return !!(num != null && !isNaN(num) && isFinite(num));\n }\n\n var isTypeTime = valueType === 'time';\n var isValueDate = value instanceof Date;\n\n if (isTypeTime || isValueDate) {\n var date = isTypeTime ? parseDate(value) : value;\n\n if (!isNaN(+date)) {\n return timeFormat(date, USER_READABLE_DEFUALT_TIME_PATTERN, useUTC);\n } else if (isValueDate) {\n return '-';\n } // In other cases, continue to try to display the value in the following code.\n\n }\n\n if (valueType === 'ordinal') {\n return zrUtil.isStringSafe(value) ? stringToUserReadable(value) : zrUtil.isNumber(value) ? isNumberUserReadable(value) ? value + '' : '-' : '-';\n } // By default.\n\n\n var numericResult = numericToNumber(value);\n return isNumberUserReadable(numericResult) ? addCommas(numericResult) : zrUtil.isStringSafe(value) ? stringToUserReadable(value) : '-';\n}\nvar TPL_VAR_ALIAS = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];\n\nvar wrapVar = function (varName, seriesIdx) {\n return '{' + varName + (seriesIdx == null ? '' : seriesIdx) + '}';\n};\n/**\n * Template formatter\n * @param {Array.|Object} paramsList\n */\n\n\nexport function formatTpl(tpl, paramsList, encode) {\n if (!zrUtil.isArray(paramsList)) {\n paramsList = [paramsList];\n }\n\n var seriesLen = paramsList.length;\n\n if (!seriesLen) {\n return '';\n }\n\n var $vars = paramsList[0].$vars || [];\n\n for (var i = 0; i < $vars.length; i++) {\n var alias = TPL_VAR_ALIAS[i];\n tpl = tpl.replace(wrapVar(alias), wrapVar(alias, 0));\n }\n\n for (var seriesIdx = 0; seriesIdx < seriesLen; seriesIdx++) {\n for (var k = 0; k < $vars.length; k++) {\n var val = paramsList[seriesIdx][$vars[k]];\n tpl = tpl.replace(wrapVar(TPL_VAR_ALIAS[k], seriesIdx), encode ? encodeHTML(val) : val);\n }\n }\n\n return tpl;\n}\n/**\n * simple Template formatter\n */\n\nexport function formatTplSimple(tpl, param, encode) {\n zrUtil.each(param, function (value, key) {\n tpl = tpl.replace('{' + key + '}', encode ? encodeHTML(value) : value);\n });\n return tpl;\n}\nexport function getTooltipMarker(inOpt, extraCssText) {\n var opt = zrUtil.isString(inOpt) ? {\n color: inOpt,\n extraCssText: extraCssText\n } : inOpt || {};\n var color = opt.color;\n var type = opt.type;\n extraCssText = opt.extraCssText;\n var renderMode = opt.renderMode || 'html';\n\n if (!color) {\n return '';\n }\n\n if (renderMode === 'html') {\n return type === 'subItem' ? '' : '';\n } else {\n // Should better not to auto generate style name by auto-increment number here.\n // Because this util is usually called in tooltip formatter, which is probably\n // called repeatly when mouse move and the auto-increment number increases fast.\n // Users can make their own style name by theirselves, make it unique and readable.\n var markerId = opt.markerId || 'markerX';\n return {\n renderMode: renderMode,\n content: '{' + markerId + '|} ',\n style: type === 'subItem' ? {\n width: 4,\n height: 4,\n borderRadius: 2,\n backgroundColor: color\n } : {\n width: 10,\n height: 10,\n borderRadius: 5,\n backgroundColor: color\n }\n };\n }\n}\n/**\n * @deprecated Use `time/format` instead.\n * ISO Date format\n * @param {string} tpl\n * @param {number} value\n * @param {boolean} [isUTC=false] Default in local time.\n * see `module:echarts/scale/Time`\n * and `module:echarts/util/number#parseDate`.\n * @inner\n */\n\nexport function formatTime(tpl, value, isUTC) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('echarts.format.formatTime', 'echarts.time.format');\n }\n\n if (tpl === 'week' || tpl === 'month' || tpl === 'quarter' || tpl === 'half-year' || tpl === 'year') {\n tpl = 'MM-dd\\nyyyy';\n }\n\n var date = parseDate(value);\n var utc = isUTC ? 'UTC' : '';\n var y = date['get' + utc + 'FullYear']();\n var M = date['get' + utc + 'Month']() + 1;\n var d = date['get' + utc + 'Date']();\n var h = date['get' + utc + 'Hours']();\n var m = date['get' + utc + 'Minutes']();\n var s = date['get' + utc + 'Seconds']();\n var S = date['get' + utc + 'Milliseconds']();\n tpl = tpl.replace('MM', pad(M, 2)).replace('M', M).replace('yyyy', y).replace('yy', y % 100 + '').replace('dd', pad(d, 2)).replace('d', d).replace('hh', pad(h, 2)).replace('h', h).replace('mm', pad(m, 2)).replace('m', m).replace('ss', pad(s, 2)).replace('s', s).replace('SSS', pad(S, 3));\n return tpl;\n}\n/**\n * Capital first\n * @param {string} str\n * @return {string}\n */\n\nexport function capitalFirst(str) {\n return str ? str.charAt(0).toUpperCase() + str.substr(1) : str;\n}\n/**\n * @return Never be null/undefined.\n */\n\nexport function convertToColorString(color, defaultColor) {\n defaultColor = defaultColor || 'transparent';\n return zrUtil.isString(color) ? color : zrUtil.isObject(color) ? color.colorStops && (color.colorStops[0] || {}).color || defaultColor : defaultColor;\n}\nexport { truncateText } from 'zrender/lib/graphic/helper/parseText';\n/**\n * open new tab\n * @param link url\n * @param target blank or self\n */\n\nexport function windowOpen(link, target) {\n /* global window */\n if (target === '_blank' || target === 'blank') {\n var blank = window.open();\n blank.opener = null;\n blank.location.href = link;\n } else {\n window.open(link, target);\n }\n}\nexport { getTextRect } from '../legacy/getTextRect';","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// Layout helpers for each component positioning\nimport * as zrUtil from 'zrender/lib/core/util';\nimport BoundingRect from 'zrender/lib/core/BoundingRect';\nimport { parsePercent } from './number';\nimport * as formatUtil from './format';\nvar each = zrUtil.each;\n/**\n * @public\n */\n\nexport var LOCATION_PARAMS = ['left', 'right', 'top', 'bottom', 'width', 'height'];\n/**\n * @public\n */\n\nexport var HV_NAMES = [['width', 'left', 'right'], ['height', 'top', 'bottom']];\n\nfunction boxLayout(orient, group, gap, maxWidth, maxHeight) {\n var x = 0;\n var y = 0;\n\n if (maxWidth == null) {\n maxWidth = Infinity;\n }\n\n if (maxHeight == null) {\n maxHeight = Infinity;\n }\n\n var currentLineMaxSize = 0;\n group.eachChild(function (child, idx) {\n var rect = child.getBoundingRect();\n var nextChild = group.childAt(idx + 1);\n var nextChildRect = nextChild && nextChild.getBoundingRect();\n var nextX;\n var nextY;\n\n if (orient === 'horizontal') {\n var moveX = rect.width + (nextChildRect ? -nextChildRect.x + rect.x : 0);\n nextX = x + moveX; // Wrap when width exceeds maxWidth or meet a `newline` group\n // FIXME compare before adding gap?\n\n if (nextX > maxWidth || child.newline) {\n x = 0;\n nextX = moveX;\n y += currentLineMaxSize + gap;\n currentLineMaxSize = rect.height;\n } else {\n // FIXME: consider rect.y is not `0`?\n currentLineMaxSize = Math.max(currentLineMaxSize, rect.height);\n }\n } else {\n var moveY = rect.height + (nextChildRect ? -nextChildRect.y + rect.y : 0);\n nextY = y + moveY; // Wrap when width exceeds maxHeight or meet a `newline` group\n\n if (nextY > maxHeight || child.newline) {\n x += currentLineMaxSize + gap;\n y = 0;\n nextY = moveY;\n currentLineMaxSize = rect.width;\n } else {\n currentLineMaxSize = Math.max(currentLineMaxSize, rect.width);\n }\n }\n\n if (child.newline) {\n return;\n }\n\n child.x = x;\n child.y = y;\n child.markRedraw();\n orient === 'horizontal' ? x = nextX + gap : y = nextY + gap;\n });\n}\n/**\n * VBox or HBox layouting\n * @param {string} orient\n * @param {module:zrender/graphic/Group} group\n * @param {number} gap\n * @param {number} [width=Infinity]\n * @param {number} [height=Infinity]\n */\n\n\nexport var box = boxLayout;\n/**\n * VBox layouting\n * @param {module:zrender/graphic/Group} group\n * @param {number} gap\n * @param {number} [width=Infinity]\n * @param {number} [height=Infinity]\n */\n\nexport var vbox = zrUtil.curry(boxLayout, 'vertical');\n/**\n * HBox layouting\n * @param {module:zrender/graphic/Group} group\n * @param {number} gap\n * @param {number} [width=Infinity]\n * @param {number} [height=Infinity]\n */\n\nexport var hbox = zrUtil.curry(boxLayout, 'horizontal');\n/**\n * If x or x2 is not specified or 'center' 'left' 'right',\n * the width would be as long as possible.\n * If y or y2 is not specified or 'middle' 'top' 'bottom',\n * the height would be as long as possible.\n */\n\nexport function getAvailableSize(positionInfo, containerRect, margin) {\n var containerWidth = containerRect.width;\n var containerHeight = containerRect.height;\n var x = parsePercent(positionInfo.left, containerWidth);\n var y = parsePercent(positionInfo.top, containerHeight);\n var x2 = parsePercent(positionInfo.right, containerWidth);\n var y2 = parsePercent(positionInfo.bottom, containerHeight);\n (isNaN(x) || isNaN(parseFloat(positionInfo.left))) && (x = 0);\n (isNaN(x2) || isNaN(parseFloat(positionInfo.right))) && (x2 = containerWidth);\n (isNaN(y) || isNaN(parseFloat(positionInfo.top))) && (y = 0);\n (isNaN(y2) || isNaN(parseFloat(positionInfo.bottom))) && (y2 = containerHeight);\n margin = formatUtil.normalizeCssArray(margin || 0);\n return {\n width: Math.max(x2 - x - margin[1] - margin[3], 0),\n height: Math.max(y2 - y - margin[0] - margin[2], 0)\n };\n}\n/**\n * Parse position info.\n */\n\nexport function getLayoutRect(positionInfo, containerRect, margin) {\n margin = formatUtil.normalizeCssArray(margin || 0);\n var containerWidth = containerRect.width;\n var containerHeight = containerRect.height;\n var left = parsePercent(positionInfo.left, containerWidth);\n var top = parsePercent(positionInfo.top, containerHeight);\n var right = parsePercent(positionInfo.right, containerWidth);\n var bottom = parsePercent(positionInfo.bottom, containerHeight);\n var width = parsePercent(positionInfo.width, containerWidth);\n var height = parsePercent(positionInfo.height, containerHeight);\n var verticalMargin = margin[2] + margin[0];\n var horizontalMargin = margin[1] + margin[3];\n var aspect = positionInfo.aspect; // If width is not specified, calculate width from left and right\n\n if (isNaN(width)) {\n width = containerWidth - right - horizontalMargin - left;\n }\n\n if (isNaN(height)) {\n height = containerHeight - bottom - verticalMargin - top;\n }\n\n if (aspect != null) {\n // If width and height are not given\n // 1. Graph should not exceeds the container\n // 2. Aspect must be keeped\n // 3. Graph should take the space as more as possible\n // FIXME\n // Margin is not considered, because there is no case that both\n // using margin and aspect so far.\n if (isNaN(width) && isNaN(height)) {\n if (aspect > containerWidth / containerHeight) {\n width = containerWidth * 0.8;\n } else {\n height = containerHeight * 0.8;\n }\n } // Calculate width or height with given aspect\n\n\n if (isNaN(width)) {\n width = aspect * height;\n }\n\n if (isNaN(height)) {\n height = width / aspect;\n }\n } // If left is not specified, calculate left from right and width\n\n\n if (isNaN(left)) {\n left = containerWidth - right - width - horizontalMargin;\n }\n\n if (isNaN(top)) {\n top = containerHeight - bottom - height - verticalMargin;\n } // Align left and top\n\n\n switch (positionInfo.left || positionInfo.right) {\n case 'center':\n left = containerWidth / 2 - width / 2 - margin[3];\n break;\n\n case 'right':\n left = containerWidth - width - horizontalMargin;\n break;\n }\n\n switch (positionInfo.top || positionInfo.bottom) {\n case 'middle':\n case 'center':\n top = containerHeight / 2 - height / 2 - margin[0];\n break;\n\n case 'bottom':\n top = containerHeight - height - verticalMargin;\n break;\n } // If something is wrong and left, top, width, height are calculated as NaN\n\n\n left = left || 0;\n top = top || 0;\n\n if (isNaN(width)) {\n // Width may be NaN if only one value is given except width\n width = containerWidth - horizontalMargin - left - (right || 0);\n }\n\n if (isNaN(height)) {\n // Height may be NaN if only one value is given except height\n height = containerHeight - verticalMargin - top - (bottom || 0);\n }\n\n var rect = new BoundingRect(left + margin[3], top + margin[0], width, height);\n rect.margin = margin;\n return rect;\n}\n/**\n * Position a zr element in viewport\n * Group position is specified by either\n * {left, top}, {right, bottom}\n * If all properties exists, right and bottom will be igonred.\n *\n * Logic:\n * 1. Scale (against origin point in parent coord)\n * 2. Rotate (against origin point in parent coord)\n * 3. Traslate (with el.position by this method)\n * So this method only fixes the last step 'Traslate', which does not affect\n * scaling and rotating.\n *\n * If be called repeatly with the same input el, the same result will be gotten.\n *\n * @param el Should have `getBoundingRect` method.\n * @param positionInfo\n * @param positionInfo.left\n * @param positionInfo.top\n * @param positionInfo.right\n * @param positionInfo.bottom\n * @param positionInfo.width Only for opt.boundingModel: 'raw'\n * @param positionInfo.height Only for opt.boundingModel: 'raw'\n * @param containerRect\n * @param margin\n * @param opt\n * @param opt.hv Only horizontal or only vertical. Default to be [1, 1]\n * @param opt.boundingMode\n * Specify how to calculate boundingRect when locating.\n * 'all': Position the boundingRect that is transformed and uioned\n * both itself and its descendants.\n * This mode simplies confine the elements in the bounding\n * of their container (e.g., using 'right: 0').\n * 'raw': Position the boundingRect that is not transformed and only itself.\n * This mode is useful when you want a element can overflow its\n * container. (Consider a rotated circle needs to be located in a corner.)\n * In this mode positionInfo.width/height can only be number.\n */\n\nexport function positionElement(el, positionInfo, containerRect, margin, opt) {\n var h = !opt || !opt.hv || opt.hv[0];\n var v = !opt || !opt.hv || opt.hv[1];\n var boundingMode = opt && opt.boundingMode || 'all';\n\n if (!h && !v) {\n return;\n }\n\n var rect;\n\n if (boundingMode === 'raw') {\n rect = el.type === 'group' ? new BoundingRect(0, 0, +positionInfo.width || 0, +positionInfo.height || 0) : el.getBoundingRect();\n } else {\n rect = el.getBoundingRect();\n\n if (el.needLocalTransform()) {\n var transform = el.getLocalTransform(); // Notice: raw rect may be inner object of el,\n // which should not be modified.\n\n rect = rect.clone();\n rect.applyTransform(transform);\n }\n } // The real width and height can not be specified but calculated by the given el.\n\n\n var layoutRect = getLayoutRect(zrUtil.defaults({\n width: rect.width,\n height: rect.height\n }, positionInfo), containerRect, margin); // Because 'tranlate' is the last step in transform\n // (see zrender/core/Transformable#getLocalTransform),\n // we can just only modify el.position to get final result.\n\n var dx = h ? layoutRect.x - rect.x : 0;\n var dy = v ? layoutRect.y - rect.y : 0;\n\n if (boundingMode === 'raw') {\n el.x = dx;\n el.y = dy;\n } else {\n el.x += dx;\n el.y += dy;\n }\n\n el.markRedraw();\n}\n/**\n * @param option Contains some of the properties in HV_NAMES.\n * @param hvIdx 0: horizontal; 1: vertical.\n */\n\nexport function sizeCalculable(option, hvIdx) {\n return option[HV_NAMES[hvIdx][0]] != null || option[HV_NAMES[hvIdx][1]] != null && option[HV_NAMES[hvIdx][2]] != null;\n}\nexport function fetchLayoutMode(ins) {\n var layoutMode = ins.layoutMode || ins.constructor.layoutMode;\n return zrUtil.isObject(layoutMode) ? layoutMode : layoutMode ? {\n type: layoutMode\n } : null;\n}\n/**\n * Consider Case:\n * When default option has {left: 0, width: 100}, and we set {right: 0}\n * through setOption or media query, using normal zrUtil.merge will cause\n * {right: 0} does not take effect.\n *\n * @example\n * ComponentModel.extend({\n * init: function () {\n * ...\n * let inputPositionParams = layout.getLayoutParams(option);\n * this.mergeOption(inputPositionParams);\n * },\n * mergeOption: function (newOption) {\n * newOption && zrUtil.merge(thisOption, newOption, true);\n * layout.mergeLayoutParam(thisOption, newOption);\n * }\n * });\n *\n * @param targetOption\n * @param newOption\n * @param opt\n */\n\nexport function mergeLayoutParam(targetOption, newOption, opt) {\n var ignoreSize = opt && opt.ignoreSize;\n !zrUtil.isArray(ignoreSize) && (ignoreSize = [ignoreSize, ignoreSize]);\n var hResult = merge(HV_NAMES[0], 0);\n var vResult = merge(HV_NAMES[1], 1);\n copy(HV_NAMES[0], targetOption, hResult);\n copy(HV_NAMES[1], targetOption, vResult);\n\n function merge(names, hvIdx) {\n var newParams = {};\n var newValueCount = 0;\n var merged = {};\n var mergedValueCount = 0;\n var enoughParamNumber = 2;\n each(names, function (name) {\n merged[name] = targetOption[name];\n });\n each(names, function (name) {\n // Consider case: newOption.width is null, which is\n // set by user for removing width setting.\n hasProp(newOption, name) && (newParams[name] = merged[name] = newOption[name]);\n hasValue(newParams, name) && newValueCount++;\n hasValue(merged, name) && mergedValueCount++;\n });\n\n if (ignoreSize[hvIdx]) {\n // Only one of left/right is premitted to exist.\n if (hasValue(newOption, names[1])) {\n merged[names[2]] = null;\n } else if (hasValue(newOption, names[2])) {\n merged[names[1]] = null;\n }\n\n return merged;\n } // Case: newOption: {width: ..., right: ...},\n // or targetOption: {right: ...} and newOption: {width: ...},\n // There is no conflict when merged only has params count\n // little than enoughParamNumber.\n\n\n if (mergedValueCount === enoughParamNumber || !newValueCount) {\n return merged;\n } // Case: newOption: {width: ..., right: ...},\n // Than we can make sure user only want those two, and ignore\n // all origin params in targetOption.\n else if (newValueCount >= enoughParamNumber) {\n return newParams;\n } else {\n // Chose another param from targetOption by priority.\n for (var i = 0; i < names.length; i++) {\n var name_1 = names[i];\n\n if (!hasProp(newParams, name_1) && hasProp(targetOption, name_1)) {\n newParams[name_1] = targetOption[name_1];\n break;\n }\n }\n\n return newParams;\n }\n }\n\n function hasProp(obj, name) {\n return obj.hasOwnProperty(name);\n }\n\n function hasValue(obj, name) {\n return obj[name] != null && obj[name] !== 'auto';\n }\n\n function copy(names, target, source) {\n each(names, function (name) {\n target[name] = source[name];\n });\n }\n}\n/**\n * Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object.\n */\n\nexport function getLayoutParams(source) {\n return copyLayoutParams({}, source);\n}\n/**\n * Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object.\n * @param {Object} source\n * @return {Object} Result contains those props.\n */\n\nexport function copyLayoutParams(target, source) {\n source && target && each(LOCATION_PARAMS, function (name) {\n source.hasOwnProperty(name) && (target[name] = source[name]);\n });\n return target;\n}","import Texture2D from '../Texture2D';\nimport glenum from '../core/glenum';\nimport util from '../core/util';\n\nvar TexturePool = function () {\n\n this._pool = {};\n\n this._allocatedTextures = [];\n};\n\nTexturePool.prototype = {\n\n constructor: TexturePool,\n\n get: function (parameters) {\n var key = generateKey(parameters);\n if (!this._pool.hasOwnProperty(key)) {\n this._pool[key] = [];\n }\n var list = this._pool[key];\n if (!list.length) {\n var texture = new Texture2D(parameters);\n this._allocatedTextures.push(texture);\n return texture;\n }\n return list.pop();\n },\n\n put: function (texture) {\n var key = generateKey(texture);\n if (!this._pool.hasOwnProperty(key)) {\n this._pool[key] = [];\n }\n var list = this._pool[key];\n list.push(texture);\n },\n\n clear: function (renderer) {\n for (var i = 0; i < this._allocatedTextures.length; i++) {\n this._allocatedTextures[i].dispose(renderer);\n }\n this._pool = {};\n this._allocatedTextures = [];\n }\n};\n\nvar defaultParams = {\n width: 512,\n height: 512,\n type: glenum.UNSIGNED_BYTE,\n format: glenum.RGBA,\n wrapS: glenum.CLAMP_TO_EDGE,\n wrapT: glenum.CLAMP_TO_EDGE,\n minFilter: glenum.LINEAR_MIPMAP_LINEAR,\n magFilter: glenum.LINEAR,\n useMipmap: true,\n anisotropic: 1,\n flipY: true,\n unpackAlignment: 4,\n premultiplyAlpha: false\n};\n\nvar defaultParamPropList = Object.keys(defaultParams);\n\nfunction generateKey(parameters) {\n util.defaultsWithPropList(parameters, defaultParams, defaultParamPropList);\n fallBack(parameters);\n\n var key = '';\n for (var i = 0; i < defaultParamPropList.length; i++) {\n var name = defaultParamPropList[i];\n var chunk = parameters[name].toString();\n key += chunk;\n }\n return key;\n}\n\nfunction fallBack(target) {\n\n var IPOT = isPowerOfTwo(target.width, target.height);\n\n if (target.format === glenum.DEPTH_COMPONENT) {\n target.useMipmap = false;\n }\n\n if (!IPOT || !target.useMipmap) {\n if (target.minFilter == glenum.NEAREST_MIPMAP_NEAREST ||\n target.minFilter == glenum.NEAREST_MIPMAP_LINEAR) {\n target.minFilter = glenum.NEAREST;\n } else if (\n target.minFilter == glenum.LINEAR_MIPMAP_LINEAR ||\n target.minFilter == glenum.LINEAR_MIPMAP_NEAREST\n ) {\n target.minFilter = glenum.LINEAR;\n }\n }\n if (!IPOT) {\n target.wrapS = glenum.CLAMP_TO_EDGE;\n target.wrapT = glenum.CLAMP_TO_EDGE;\n }\n}\n\nfunction isPowerOfTwo(width, height) {\n return (width & (width-1)) === 0 &&\n (height & (height-1)) === 0;\n}\n\nexport default TexturePool;\n","export default \"@export clay.sm.depth.vertex\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nattribute vec3 position : POSITION;\\nattribute vec2 texcoord : TEXCOORD_0;\\nuniform vec2 uvRepeat = vec2(1.0, 1.0);\\nuniform vec2 uvOffset = vec2(0.0, 0.0);\\n@import clay.chunk.skinning_header\\n@import clay.chunk.instancing_header\\nvarying vec4 v_ViewPosition;\\nvarying vec2 v_Texcoord;\\nvoid main(){\\n vec4 P = vec4(position, 1.0);\\n#ifdef SKINNING\\n @import clay.chunk.skin_matrix\\n P = skinMatrixWS * P;\\n#endif\\n#ifdef INSTANCING\\n @import clay.chunk.instancing_matrix\\n P = instanceMat * P;\\n#endif\\n v_ViewPosition = worldViewProjection * P;\\n gl_Position = v_ViewPosition;\\n v_Texcoord = texcoord * uvRepeat + uvOffset;\\n}\\n@end\\n@export clay.sm.depth.fragment\\nvarying vec4 v_ViewPosition;\\nvarying vec2 v_Texcoord;\\nuniform float bias : 0.001;\\nuniform float slopeScale : 1.0;\\nuniform sampler2D alphaMap;\\nuniform float alphaCutoff: 0.0;\\n@import clay.util.encode_float\\nvoid main(){\\n float depth = v_ViewPosition.z / v_ViewPosition.w;\\n if (alphaCutoff > 0.0) {\\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\\n discard;\\n }\\n }\\n#ifdef USE_VSM\\n depth = depth * 0.5 + 0.5;\\n float moment1 = depth;\\n float moment2 = depth * depth;\\n #ifdef SUPPORT_STANDARD_DERIVATIVES\\n float dx = dFdx(depth);\\n float dy = dFdy(depth);\\n moment2 += 0.25*(dx*dx+dy*dy);\\n #endif\\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\\n#else\\n #ifdef SUPPORT_STANDARD_DERIVATIVES\\n float dx = dFdx(depth);\\n float dy = dFdy(depth);\\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\\n #else\\n depth += bias;\\n #endif\\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\\n#endif\\n}\\n@end\\n@export clay.sm.debug_depth\\nuniform sampler2D depthMap;\\nvarying vec2 v_Texcoord;\\n@import clay.util.decode_float\\nvoid main() {\\n vec4 tex = texture2D(depthMap, v_Texcoord);\\n#ifdef USE_VSM\\n gl_FragColor = vec4(tex.rgb, 1.0);\\n#else\\n float depth = decodeFloat(tex);\\n gl_FragColor = vec4(depth, depth, depth, 1.0);\\n#endif\\n}\\n@end\\n@export clay.sm.distance.vertex\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform mat4 world : WORLD;\\nattribute vec3 position : POSITION;\\n@import clay.chunk.skinning_header\\nvarying vec3 v_WorldPosition;\\nvoid main (){\\n vec4 P = vec4(position, 1.0);\\n#ifdef SKINNING\\n @import clay.chunk.skin_matrix\\n P = skinMatrixWS * P;\\n#endif\\n#ifdef INSTANCING\\n @import clay.chunk.instancing_matrix\\n P = instanceMat * P;\\n#endif\\n gl_Position = worldViewProjection * P;\\n v_WorldPosition = (world * P).xyz;\\n}\\n@end\\n@export clay.sm.distance.fragment\\nuniform vec3 lightPosition;\\nuniform float range : 100;\\nvarying vec3 v_WorldPosition;\\n@import clay.util.encode_float\\nvoid main(){\\n float dist = distance(lightPosition, v_WorldPosition);\\n#ifdef USE_VSM\\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\\n#else\\n dist = dist / range;\\n gl_FragColor = encodeFloat(dist);\\n#endif\\n}\\n@end\\n@export clay.plugin.shadow_map_common\\n@import clay.util.decode_float\\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\\n vec4 tex = texture2D(map, uv);\\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\\n}\\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\\n float shadowContrib = tapShadowMap(map, uv, z);\\n vec2 offset = vec2(1.0 / textureSize) * scale;\\n#ifdef PCF_KERNEL_SIZE\\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\\n }}\\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\\n#else\\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\\n return shadowContrib / 9.0;\\n#endif\\n}\\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\\n return pcf(map, uv, z, textureSize, vec2(1.0));\\n}\\nfloat chebyshevUpperBound(vec2 moments, float z){\\n float p = 0.0;\\n z = z * 0.5 + 0.5;\\n if (z <= moments.x) {\\n p = 1.0;\\n }\\n float variance = moments.y - moments.x * moments.x;\\n variance = max(variance, 0.0000001);\\n float mD = moments.x - z;\\n float pMax = variance / (variance + mD * mD);\\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\\n return max(p, pMax);\\n}\\nfloat computeShadowContrib(\\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\\n) {\\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\\n posInLightSpace.xyz /= posInLightSpace.w;\\n float z = posInLightSpace.z;\\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\\n #ifdef USE_VSM\\n vec2 moments = texture2D(map, uv * scale + offset).xy;\\n return chebyshevUpperBound(moments, z);\\n #else\\n return pcf(map, uv * scale + offset, z, textureSize, scale);\\n #endif\\n }\\n return 1.0;\\n}\\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\\n}\\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\\n{\\n float dist = length(direction);\\n vec4 shadowTex = textureCube(map, direction);\\n#ifdef USE_VSM\\n vec2 moments = shadowTex.xy;\\n float variance = moments.y - moments.x * moments.x;\\n float mD = moments.x - dist;\\n float p = variance / (variance + mD * mD);\\n if(moments.x + 0.001 < dist){\\n return clamp(p, 0.0, 1.0);\\n }else{\\n return 1.0;\\n }\\n#else\\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\\n#endif\\n}\\n@end\\n@export clay.plugin.compute_shadow_map\\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\n#endif\\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\\n#if defined(SHADOW_CASCADE)\\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\\n#else\\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\n#endif\\n#endif\\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\n#endif\\nuniform bool shadowEnabled : true;\\n#ifdef PCF_KERNEL_SIZE\\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\\n#endif\\n@import clay.plugin.shadow_map_common\\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\\n float shadowContrib;\\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\\n shadowContrib = computeShadowContrib(\\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\\n spotLightShadowMapSizes[_idx_]\\n );\\n shadowContribs[_idx_] = shadowContrib;\\n }}\\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\\n shadowContribs[_idx_] = 1.0;\\n }}\\n}\\n#endif\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n#ifdef SHADOW_CASCADE\\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\\n / (gl_DepthRange.far - gl_DepthRange.near);\\n float shadowContrib;\\n shadowContribs[0] = 1.0;\\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\\n if (\\n depth >= shadowCascadeClipsNear[_idx_] &&\\n depth <= shadowCascadeClipsFar[_idx_]\\n ) {\\n shadowContrib = computeShadowContrib(\\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\\n directionalLightShadowMapSizes[0],\\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\\n );\\n shadowContribs[0] = shadowContrib;\\n }\\n }}\\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\\n shadowContribs[_idx_] = 1.0;\\n }}\\n}\\n#else\\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\\n float shadowContrib;\\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\\n shadowContrib = computeShadowContrib(\\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\\n directionalLightShadowMapSizes[_idx_]\\n );\\n shadowContribs[_idx_] = shadowContrib;\\n }}\\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\\n shadowContribs[_idx_] = 1.0;\\n }}\\n}\\n#endif\\n#endif\\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\\n vec3 lightPosition;\\n vec3 direction;\\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\\n lightPosition = pointLightPosition[_idx_];\\n direction = position - lightPosition;\\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\\n }}\\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\\n shadowContribs[_idx_] = 1.0;\\n }}\\n}\\n#endif\\n#endif\\n@end\";\n","import Base from '../core/Base';\nimport glenum from '../core/glenum';\nimport Vector3 from '../math/Vector3';\nimport BoundingBox from '../math/BoundingBox';\nimport Frustum from '../math/Frustum';\nimport Matrix4 from '../math/Matrix4';\nimport Renderer from '../Renderer';\nimport Shader from '../Shader';\nimport Material from '../Material';\nimport FrameBuffer from '../FrameBuffer';\nimport Texture from '../Texture';\nimport Texture2D from '../Texture2D';\nimport TextureCube from '../TextureCube';\nimport PerspectiveCamera from '../camera/Perspective';\nimport OrthoCamera from '../camera/Orthographic';\n\nimport Pass from '../compositor/Pass';\nimport TexturePool from '../compositor/TexturePool';\n\nimport mat4 from '../glmatrix/mat4';\n\nvar targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\nimport shadowmapEssl from '../shader/source/shadowmap.glsl.js';\nShader['import'](shadowmapEssl);\n\nfunction getDepthMaterialUniform(renderable, depthMaterial, symbol) {\n if (symbol === 'alphaMap') {\n return renderable.material.get('diffuseMap');\n }\n else if (symbol === 'alphaCutoff') {\n if (renderable.material.isDefined('fragment', 'ALPHA_TEST')\n && renderable.material.get('diffuseMap')\n ) {\n var alphaCutoff = renderable.material.get('alphaCutoff');\n return alphaCutoff || 0;\n }\n return 0;\n }\n else if (symbol === 'uvRepeat') {\n return renderable.material.get('uvRepeat');\n }\n else if (symbol === 'uvOffset') {\n return renderable.material.get('uvOffset');\n }\n else {\n return depthMaterial.get(symbol);\n }\n}\n\nfunction isDepthMaterialChanged(renderable, prevRenderable) {\n var matA = renderable.material;\n var matB = prevRenderable.material;\n return matA.get('diffuseMap') !== matB.get('diffuseMap')\n || (matA.get('alphaCutoff') || 0) !== (matB.get('alphaCutoff') || 0);\n}\n\n/**\n * Pass rendering shadow map.\n *\n * @constructor clay.prePass.ShadowMap\n * @extends clay.core.Base\n * @example\n * var shadowMapPass = new clay.prePass.ShadowMap({\n * softShadow: clay.prePass.ShadowMap.VSM\n * });\n * ...\n * animation.on('frame', function (frameTime) {\n * shadowMapPass.render(renderer, scene, camera);\n * renderer.render(scene, camera);\n * });\n */\nvar ShadowMapPass = Base.extend(function () {\n return /** @lends clay.prePass.ShadowMap# */ {\n /**\n * Soft shadow technique.\n * Can be {@link clay.prePass.ShadowMap.PCF} or {@link clay.prePass.ShadowMap.VSM}\n * @type {number}\n */\n softShadow: ShadowMapPass.PCF,\n\n /**\n * Soft shadow blur size\n * @type {number}\n */\n shadowBlur: 1.0,\n\n lightFrustumBias: 'auto',\n\n kernelPCF: new Float32Array([\n 1, 0,\n 1, 1,\n -1, 1,\n 0, 1,\n -1, 0,\n -1, -1,\n 1, -1,\n 0, -1\n ]),\n\n precision: 'highp',\n\n _lastRenderNotCastShadow: false,\n\n _frameBuffer: new FrameBuffer(),\n\n _textures: {},\n _shadowMapNumber: {\n 'POINT_LIGHT': 0,\n 'DIRECTIONAL_LIGHT': 0,\n 'SPOT_LIGHT': 0\n },\n\n _depthMaterials: {},\n _distanceMaterials: {},\n\n _receivers: [],\n _lightsCastShadow: [],\n\n _lightCameras: {},\n _lightMaterials: {},\n\n _texturePool: new TexturePool()\n };\n}, function () {\n // Gaussian filter pass for VSM\n this._gaussianPassH = new Pass({\n fragment: Shader.source('clay.compositor.gaussian_blur')\n });\n this._gaussianPassV = new Pass({\n fragment: Shader.source('clay.compositor.gaussian_blur')\n });\n this._gaussianPassH.setUniform('blurSize', this.shadowBlur);\n this._gaussianPassH.setUniform('blurDir', 0.0);\n this._gaussianPassV.setUniform('blurSize', this.shadowBlur);\n this._gaussianPassV.setUniform('blurDir', 1.0);\n\n this._outputDepthPass = new Pass({\n fragment: Shader.source('clay.sm.debug_depth')\n });\n}, {\n /**\n * Render scene to shadow textures\n * @param {clay.Renderer} renderer\n * @param {clay.Scene} scene\n * @param {clay.Camera} sceneCamera\n * @param {boolean} [notUpdateScene=false]\n * @memberOf clay.prePass.ShadowMap.prototype\n */\n render: function (renderer, scene, sceneCamera, notUpdateScene) {\n if (!sceneCamera) {\n sceneCamera = scene.getMainCamera();\n }\n this.trigger('beforerender', this, renderer, scene, sceneCamera);\n this._renderShadowPass(renderer, scene, sceneCamera, notUpdateScene);\n this.trigger('afterrender', this, renderer, scene, sceneCamera);\n },\n\n /**\n * Debug rendering of shadow textures\n * @param {clay.Renderer} renderer\n * @param {number} size\n * @memberOf clay.prePass.ShadowMap.prototype\n */\n renderDebug: function (renderer, size) {\n renderer.saveClear();\n var viewport = renderer.viewport;\n var x = 0, y = 0;\n var width = size || viewport.width / 4;\n var height = width;\n if (this.softShadow === ShadowMapPass.VSM) {\n this._outputDepthPass.material.define('fragment', 'USE_VSM');\n }\n else {\n this._outputDepthPass.material.undefine('fragment', 'USE_VSM');\n }\n for (var name in this._textures) {\n var texture = this._textures[name];\n renderer.setViewport(x, y, width * texture.width / texture.height, height);\n this._outputDepthPass.setUniform('depthMap', texture);\n this._outputDepthPass.render(renderer);\n x += width * texture.width / texture.height;\n }\n renderer.setViewport(viewport);\n renderer.restoreClear();\n },\n\n _updateReceivers: function (renderer, mesh) {\n if (mesh.receiveShadow) {\n this._receivers.push(mesh);\n mesh.material.set('shadowEnabled', 1);\n\n mesh.material.set('pcfKernel', this.kernelPCF);\n }\n else {\n mesh.material.set('shadowEnabled', 0);\n }\n\n if (this.softShadow === ShadowMapPass.VSM) {\n mesh.material.define('fragment', 'USE_VSM');\n mesh.material.undefine('fragment', 'PCF_KERNEL_SIZE');\n }\n else {\n mesh.material.undefine('fragment', 'USE_VSM');\n var kernelPCF = this.kernelPCF;\n if (kernelPCF && kernelPCF.length) {\n mesh.material.define('fragment', 'PCF_KERNEL_SIZE', kernelPCF.length / 2);\n }\n else {\n mesh.material.undefine('fragment', 'PCF_KERNEL_SIZE');\n }\n }\n },\n\n _update: function (renderer, scene) {\n var self = this;\n scene.traverse(function (renderable) {\n if (renderable.isRenderable()) {\n self._updateReceivers(renderer, renderable);\n }\n });\n\n for (var i = 0; i < scene.lights.length; i++) {\n var light = scene.lights[i];\n if (light.castShadow && !light.invisible) {\n this._lightsCastShadow.push(light);\n }\n }\n },\n\n _renderShadowPass: function (renderer, scene, sceneCamera, notUpdateScene) {\n // reset\n for (var name in this._shadowMapNumber) {\n this._shadowMapNumber[name] = 0;\n }\n this._lightsCastShadow.length = 0;\n this._receivers.length = 0;\n\n var _gl = renderer.gl;\n\n if (!notUpdateScene) {\n scene.update();\n }\n if (sceneCamera) {\n sceneCamera.update();\n }\n\n scene.updateLights();\n this._update(renderer, scene);\n\n // Needs to update the receivers again if shadows come from 1 to 0.\n if (!this._lightsCastShadow.length && this._lastRenderNotCastShadow) {\n return;\n }\n\n this._lastRenderNotCastShadow = this._lightsCastShadow === 0;\n\n _gl.enable(_gl.DEPTH_TEST);\n _gl.depthMask(true);\n _gl.disable(_gl.BLEND);\n\n // Clear with high-z, so the part not rendered will not been shadowed\n // TODO\n // TODO restore\n _gl.clearColor(1.0, 1.0, 1.0, 1.0);\n\n // Shadow uniforms\n var spotLightShadowMaps = [];\n var spotLightMatrices = [];\n var directionalLightShadowMaps = [];\n var directionalLightMatrices = [];\n var shadowCascadeClips = [];\n var pointLightShadowMaps = [];\n\n var dirLightHasCascade;\n // Create textures for shadow map\n for (var i = 0; i < this._lightsCastShadow.length; i++) {\n var light = this._lightsCastShadow[i];\n if (light.type === 'DIRECTIONAL_LIGHT') {\n\n if (dirLightHasCascade) {\n console.warn('Only one direectional light supported with shadow cascade');\n continue;\n }\n if (light.shadowCascade > 4) {\n console.warn('Support at most 4 cascade');\n continue;\n }\n if (light.shadowCascade > 1) {\n dirLightHasCascade = light;\n }\n\n this.renderDirectionalLightShadow(\n renderer,\n scene,\n sceneCamera,\n light,\n shadowCascadeClips,\n directionalLightMatrices,\n directionalLightShadowMaps\n );\n }\n else if (light.type === 'SPOT_LIGHT') {\n this.renderSpotLightShadow(\n renderer,\n scene,\n light,\n spotLightMatrices,\n spotLightShadowMaps\n );\n }\n else if (light.type === 'POINT_LIGHT') {\n this.renderPointLightShadow(\n renderer,\n scene,\n light,\n pointLightShadowMaps\n );\n }\n\n this._shadowMapNumber[light.type]++;\n }\n\n for (var lightType in this._shadowMapNumber) {\n var number = this._shadowMapNumber[lightType];\n var key = lightType + '_SHADOWMAP_COUNT';\n for (var i = 0; i < this._receivers.length; i++) {\n var mesh = this._receivers[i];\n var material = mesh.material;\n if (material.fragmentDefines[key] !== number) {\n if (number > 0) {\n material.define('fragment', key, number);\n }\n else if (material.isDefined('fragment', key)) {\n material.undefine('fragment', key);\n }\n }\n }\n }\n for (var i = 0; i < this._receivers.length; i++) {\n var mesh = this._receivers[i];\n var material = mesh.material;\n if (dirLightHasCascade) {\n material.define('fragment', 'SHADOW_CASCADE', dirLightHasCascade.shadowCascade);\n }\n else {\n material.undefine('fragment', 'SHADOW_CASCADE');\n }\n }\n\n var shadowUniforms = scene.shadowUniforms;\n\n function getSize(texture) {\n return texture.height;\n }\n if (directionalLightShadowMaps.length > 0) {\n var directionalLightShadowMapSizes = directionalLightShadowMaps.map(getSize);\n shadowUniforms.directionalLightShadowMaps = { value: directionalLightShadowMaps, type: 'tv' };\n shadowUniforms.directionalLightMatrices = { value: directionalLightMatrices, type: 'm4v' };\n shadowUniforms.directionalLightShadowMapSizes = { value: directionalLightShadowMapSizes, type: '1fv' };\n if (dirLightHasCascade) {\n var shadowCascadeClipsNear = shadowCascadeClips.slice();\n var shadowCascadeClipsFar = shadowCascadeClips.slice();\n shadowCascadeClipsNear.pop();\n shadowCascadeClipsFar.shift();\n\n // Iterate from far to near\n shadowCascadeClipsNear.reverse();\n shadowCascadeClipsFar.reverse();\n // directionalLightShadowMaps.reverse();\n directionalLightMatrices.reverse();\n shadowUniforms.shadowCascadeClipsNear = { value: shadowCascadeClipsNear, type: '1fv' };\n shadowUniforms.shadowCascadeClipsFar = { value: shadowCascadeClipsFar, type: '1fv' };\n }\n }\n\n if (spotLightShadowMaps.length > 0) {\n var spotLightShadowMapSizes = spotLightShadowMaps.map(getSize);\n var shadowUniforms = scene.shadowUniforms;\n shadowUniforms.spotLightShadowMaps = { value: spotLightShadowMaps, type: 'tv' };\n shadowUniforms.spotLightMatrices = { value: spotLightMatrices, type: 'm4v' };\n shadowUniforms.spotLightShadowMapSizes = { value: spotLightShadowMapSizes, type: '1fv' };\n }\n\n if (pointLightShadowMaps.length > 0) {\n shadowUniforms.pointLightShadowMaps = { value: pointLightShadowMaps, type: 'tv' };\n }\n },\n\n renderDirectionalLightShadow: (function () {\n\n var splitFrustum = new Frustum();\n var splitProjMatrix = new Matrix4();\n var cropBBox = new BoundingBox();\n var cropMatrix = new Matrix4();\n var lightViewMatrix = new Matrix4();\n var lightViewProjMatrix = new Matrix4();\n var lightProjMatrix = new Matrix4();\n\n return function (renderer, scene, sceneCamera, light, shadowCascadeClips, directionalLightMatrices, directionalLightShadowMaps) {\n\n var defaultShadowMaterial = this._getDepthMaterial(light);\n var passConfig = {\n getMaterial: function (renderable) {\n return renderable.shadowDepthMaterial || defaultShadowMaterial;\n },\n isMaterialChanged: isDepthMaterialChanged,\n getUniform: getDepthMaterialUniform,\n ifRender: function (renderable) {\n return renderable.castShadow;\n },\n sortCompare: Renderer.opaqueSortCompare\n };\n\n // First frame\n if (!scene.viewBoundingBoxLastFrame.isFinite()) {\n var boundingBox = scene.getBoundingBox();\n scene.viewBoundingBoxLastFrame\n .copy(boundingBox).applyTransform(sceneCamera.viewMatrix);\n }\n // Considering moving speed since the bounding box is from last frame\n // TODO: add a bias\n var clippedFar = Math.min(-scene.viewBoundingBoxLastFrame.min.z, sceneCamera.far);\n var clippedNear = Math.max(-scene.viewBoundingBoxLastFrame.max.z, sceneCamera.near);\n\n var lightCamera = this._getDirectionalLightCamera(light, scene, sceneCamera);\n\n var lvpMat4Arr = lightViewProjMatrix.array;\n lightProjMatrix.copy(lightCamera.projectionMatrix);\n mat4.invert(lightViewMatrix.array, lightCamera.worldTransform.array);\n mat4.multiply(lightViewMatrix.array, lightViewMatrix.array, sceneCamera.worldTransform.array);\n mat4.multiply(lvpMat4Arr, lightProjMatrix.array, lightViewMatrix.array);\n\n var clipPlanes = [];\n var isPerspective = sceneCamera instanceof PerspectiveCamera;\n\n var scaleZ = (sceneCamera.near + sceneCamera.far) / (sceneCamera.near - sceneCamera.far);\n var offsetZ = 2 * sceneCamera.near * sceneCamera.far / (sceneCamera.near - sceneCamera.far);\n for (var i = 0; i <= light.shadowCascade; i++) {\n var clog = clippedNear * Math.pow(clippedFar / clippedNear, i / light.shadowCascade);\n var cuni = clippedNear + (clippedFar - clippedNear) * i / light.shadowCascade;\n var c = clog * light.cascadeSplitLogFactor + cuni * (1 - light.cascadeSplitLogFactor);\n clipPlanes.push(c);\n shadowCascadeClips.push(-(-c * scaleZ + offsetZ) / -c);\n }\n var texture = this._getTexture(light, light.shadowCascade);\n directionalLightShadowMaps.push(texture);\n\n var viewport = renderer.viewport;\n\n var _gl = renderer.gl;\n this._frameBuffer.attach(texture);\n this._frameBuffer.bind(renderer);\n _gl.clear(_gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT);\n\n for (var i = 0; i < light.shadowCascade; i++) {\n // Get the splitted frustum\n var nearPlane = clipPlanes[i];\n var farPlane = clipPlanes[i + 1];\n if (isPerspective) {\n mat4.perspective(splitProjMatrix.array, sceneCamera.fov / 180 * Math.PI, sceneCamera.aspect, nearPlane, farPlane);\n }\n else {\n mat4.ortho(\n splitProjMatrix.array,\n sceneCamera.left, sceneCamera.right, sceneCamera.bottom, sceneCamera.top,\n nearPlane, farPlane\n );\n }\n splitFrustum.setFromProjection(splitProjMatrix);\n splitFrustum.getTransformedBoundingBox(cropBBox, lightViewMatrix);\n cropBBox.applyProjection(lightProjMatrix);\n var _min = cropBBox.min.array;\n var _max = cropBBox.max.array;\n _min[0] = Math.max(_min[0], -1);\n _min[1] = Math.max(_min[1], -1);\n _max[0] = Math.min(_max[0], 1);\n _max[1] = Math.min(_max[1], 1);\n cropMatrix.ortho(_min[0], _max[0], _min[1], _max[1], 1, -1);\n lightCamera.projectionMatrix.multiplyLeft(cropMatrix);\n\n var shadowSize = light.shadowResolution || 512;\n\n // Reversed, left to right => far to near\n renderer.setViewport((light.shadowCascade - i - 1) * shadowSize, 0, shadowSize, shadowSize, 1);\n\n var renderList = scene.updateRenderList(lightCamera);\n renderer.renderPass(renderList.opaque, lightCamera, passConfig);\n\n // Filter for VSM\n if (this.softShadow === ShadowMapPass.VSM) {\n this._gaussianFilter(renderer, texture, texture.width);\n }\n\n var matrix = new Matrix4();\n matrix.copy(lightCamera.viewMatrix)\n .multiplyLeft(lightCamera.projectionMatrix);\n\n directionalLightMatrices.push(matrix.array);\n\n lightCamera.projectionMatrix.copy(lightProjMatrix);\n }\n\n this._frameBuffer.unbind(renderer);\n\n renderer.setViewport(viewport);\n };\n })(),\n\n renderSpotLightShadow: function (renderer, scene, light, spotLightMatrices, spotLightShadowMaps) {\n\n var texture = this._getTexture(light);\n var lightCamera = this._getSpotLightCamera(light);\n var _gl = renderer.gl;\n\n this._frameBuffer.attach(texture);\n this._frameBuffer.bind(renderer);\n\n _gl.clear(_gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT);\n\n var defaultShadowMaterial = this._getDepthMaterial(light);\n var passConfig = {\n getMaterial: function (renderable) {\n return renderable.shadowDepthMaterial || defaultShadowMaterial;\n },\n isMaterialChanged: isDepthMaterialChanged,\n getUniform: getDepthMaterialUniform,\n ifRender: function (renderable) {\n return renderable.castShadow;\n },\n sortCompare: Renderer.opaqueSortCompare\n };\n\n var renderList = scene.updateRenderList(lightCamera);\n renderer.renderPass(renderList.opaque, lightCamera, passConfig);\n\n this._frameBuffer.unbind(renderer);\n\n // Filter for VSM\n if (this.softShadow === ShadowMapPass.VSM) {\n this._gaussianFilter(renderer, texture, texture.width);\n }\n\n var matrix = new Matrix4();\n matrix.copy(lightCamera.worldTransform)\n .invert()\n .multiplyLeft(lightCamera.projectionMatrix);\n\n spotLightShadowMaps.push(texture);\n spotLightMatrices.push(matrix.array);\n },\n\n renderPointLightShadow: function (renderer, scene, light, pointLightShadowMaps) {\n var texture = this._getTexture(light);\n var _gl = renderer.gl;\n pointLightShadowMaps.push(texture);\n\n var defaultShadowMaterial = this._getDepthMaterial(light);\n var passConfig = {\n getMaterial: function (renderable) {\n return renderable.shadowDepthMaterial || defaultShadowMaterial;\n },\n getUniform: getDepthMaterialUniform,\n sortCompare: Renderer.opaqueSortCompare\n };\n\n var renderListEachSide = {\n px: [], py: [], pz: [], nx: [], ny: [], nz: []\n };\n var bbox = new BoundingBox();\n var lightWorldPosition = light.getWorldPosition().array;\n var lightBBox = new BoundingBox();\n var range = light.range;\n lightBBox.min.setArray(lightWorldPosition);\n lightBBox.max.setArray(lightWorldPosition);\n var extent = new Vector3(range, range, range);\n lightBBox.max.add(extent);\n lightBBox.min.sub(extent);\n\n var targetsNeedRender = { px: false, py: false, pz: false, nx: false, ny: false, nz: false };\n scene.traverse(function (renderable) {\n if (renderable.isRenderable() && renderable.castShadow) {\n var geometry = renderable.geometry;\n if (!geometry.boundingBox) {\n for (var i = 0; i < targets.length; i++) {\n renderListEachSide[targets[i]].push(renderable);\n }\n return;\n }\n bbox.transformFrom(geometry.boundingBox, renderable.worldTransform);\n if (!bbox.intersectBoundingBox(lightBBox)) {\n return;\n }\n\n bbox.updateVertices();\n for (var i = 0; i < targets.length; i++) {\n targetsNeedRender[targets[i]] = false;\n }\n for (var i = 0; i < 8; i++) {\n var vtx = bbox.vertices[i];\n var x = vtx[0] - lightWorldPosition[0];\n var y = vtx[1] - lightWorldPosition[1];\n var z = vtx[2] - lightWorldPosition[2];\n var absx = Math.abs(x);\n var absy = Math.abs(y);\n var absz = Math.abs(z);\n if (absx > absy) {\n if (absx > absz) {\n targetsNeedRender[x > 0 ? 'px' : 'nx'] = true;\n }\n else {\n targetsNeedRender[z > 0 ? 'pz' : 'nz'] = true;\n }\n }\n else {\n if (absy > absz) {\n targetsNeedRender[y > 0 ? 'py' : 'ny'] = true;\n }\n else {\n targetsNeedRender[z > 0 ? 'pz' : 'nz'] = true;\n }\n }\n }\n for (var i = 0; i < targets.length; i++) {\n if (targetsNeedRender[targets[i]]) {\n renderListEachSide[targets[i]].push(renderable);\n }\n }\n }\n });\n\n for (var i = 0; i < 6; i++) {\n var target = targets[i];\n var camera = this._getPointLightCamera(light, target);\n\n this._frameBuffer.attach(texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i);\n this._frameBuffer.bind(renderer);\n _gl.clear(_gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT);\n\n renderer.renderPass(renderListEachSide[target], camera, passConfig);\n }\n\n this._frameBuffer.unbind(renderer);\n },\n\n _getDepthMaterial: function (light) {\n var shadowMaterial = this._lightMaterials[light.__uid__];\n var isPointLight = light.type === 'POINT_LIGHT';\n if (!shadowMaterial) {\n var shaderPrefix = isPointLight ? 'clay.sm.distance.' : 'clay.sm.depth.';\n shadowMaterial = new Material({\n precision: this.precision,\n shader: new Shader(Shader.source(shaderPrefix + 'vertex'), Shader.source(shaderPrefix + 'fragment'))\n });\n\n this._lightMaterials[light.__uid__] = shadowMaterial;\n }\n if (light.shadowSlopeScale != null) {\n shadowMaterial.setUniform('slopeScale', light.shadowSlopeScale);\n }\n if (light.shadowBias != null) {\n shadowMaterial.setUniform('bias', light.shadowBias);\n }\n if (this.softShadow === ShadowMapPass.VSM) {\n shadowMaterial.define('fragment', 'USE_VSM');\n }\n else {\n shadowMaterial.undefine('fragment', 'USE_VSM');\n }\n\n if (isPointLight) {\n shadowMaterial.set('lightPosition', light.getWorldPosition().array);\n shadowMaterial.set('range', light.range);\n }\n\n return shadowMaterial;\n },\n\n _gaussianFilter: function (renderer, texture, size) {\n var parameter = {\n width: size,\n height: size,\n type: Texture.FLOAT\n };\n var tmpTexture = this._texturePool.get(parameter);\n\n this._frameBuffer.attach(tmpTexture);\n this._frameBuffer.bind(renderer);\n this._gaussianPassH.setUniform('texture', texture);\n this._gaussianPassH.setUniform('textureWidth', size);\n this._gaussianPassH.render(renderer);\n\n this._frameBuffer.attach(texture);\n this._gaussianPassV.setUniform('texture', tmpTexture);\n this._gaussianPassV.setUniform('textureHeight', size);\n this._gaussianPassV.render(renderer);\n this._frameBuffer.unbind(renderer);\n\n this._texturePool.put(tmpTexture);\n },\n\n _getTexture: function (light, cascade) {\n var key = light.__uid__;\n var texture = this._textures[key];\n var resolution = light.shadowResolution || 512;\n cascade = cascade || 1;\n if (!texture) {\n if (light.type === 'POINT_LIGHT') {\n texture = new TextureCube();\n }\n else {\n texture = new Texture2D();\n }\n // At most 4 cascade\n // TODO share with height ?\n texture.width = resolution * cascade;\n texture.height = resolution;\n if (this.softShadow === ShadowMapPass.VSM) {\n texture.type = Texture.FLOAT;\n texture.anisotropic = 4;\n }\n else {\n texture.minFilter = glenum.NEAREST;\n texture.magFilter = glenum.NEAREST;\n texture.useMipmap = false;\n }\n this._textures[key] = texture;\n }\n\n return texture;\n },\n\n _getPointLightCamera: function (light, target) {\n if (!this._lightCameras.point) {\n this._lightCameras.point = {\n px: new PerspectiveCamera(),\n nx: new PerspectiveCamera(),\n py: new PerspectiveCamera(),\n ny: new PerspectiveCamera(),\n pz: new PerspectiveCamera(),\n nz: new PerspectiveCamera()\n };\n }\n var camera = this._lightCameras.point[target];\n\n camera.far = light.range;\n camera.fov = 90;\n camera.position.set(0, 0, 0);\n switch (target) {\n case 'px':\n camera.lookAt(Vector3.POSITIVE_X, Vector3.NEGATIVE_Y);\n break;\n case 'nx':\n camera.lookAt(Vector3.NEGATIVE_X, Vector3.NEGATIVE_Y);\n break;\n case 'py':\n camera.lookAt(Vector3.POSITIVE_Y, Vector3.POSITIVE_Z);\n break;\n case 'ny':\n camera.lookAt(Vector3.NEGATIVE_Y, Vector3.NEGATIVE_Z);\n break;\n case 'pz':\n camera.lookAt(Vector3.POSITIVE_Z, Vector3.NEGATIVE_Y);\n break;\n case 'nz':\n camera.lookAt(Vector3.NEGATIVE_Z, Vector3.NEGATIVE_Y);\n break;\n }\n light.getWorldPosition(camera.position);\n camera.update();\n\n return camera;\n },\n\n _getDirectionalLightCamera: (function () {\n var lightViewMatrix = new Matrix4();\n var sceneViewBoundingBox = new BoundingBox();\n var lightViewBBox = new BoundingBox();\n // Camera of directional light will be adjusted\n // to contain the view frustum and scene bounding box as tightly as possible\n return function (light, scene, sceneCamera) {\n if (!this._lightCameras.directional) {\n this._lightCameras.directional = new OrthoCamera();\n }\n var camera = this._lightCameras.directional;\n\n sceneViewBoundingBox.copy(scene.viewBoundingBoxLastFrame);\n sceneViewBoundingBox.intersection(sceneCamera.frustum.boundingBox);\n // Move to the center of frustum(in world space)\n camera.position\n .copy(sceneViewBoundingBox.min)\n .add(sceneViewBoundingBox.max)\n .scale(0.5)\n .transformMat4(sceneCamera.worldTransform);\n camera.rotation.copy(light.rotation);\n camera.scale.copy(light.scale);\n camera.updateWorldTransform();\n\n // Transform to light view space\n Matrix4.invert(lightViewMatrix, camera.worldTransform);\n Matrix4.multiply(lightViewMatrix, lightViewMatrix, sceneCamera.worldTransform);\n\n lightViewBBox.copy(sceneViewBoundingBox).applyTransform(lightViewMatrix);\n\n var min = lightViewBBox.min.array;\n var max = lightViewBBox.max.array;\n\n // Move camera to adjust the near to 0\n camera.position.set((min[0] + max[0]) / 2, (min[1] + max[1]) / 2, max[2])\n .transformMat4(camera.worldTransform);\n camera.near = 0;\n camera.far = -min[2] + max[2];\n // Make sure receivers not in the frustum will stil receive the shadow.\n if (isNaN(this.lightFrustumBias)) {\n camera.far *= 4;\n }\n else {\n camera.far += this.lightFrustumBias;\n }\n camera.left = min[0];\n camera.right = max[0];\n camera.top = max[1];\n camera.bottom = min[1];\n camera.update(true);\n\n return camera;\n };\n })(),\n\n _getSpotLightCamera: function (light) {\n if (!this._lightCameras.spot) {\n this._lightCameras.spot = new PerspectiveCamera();\n }\n var camera = this._lightCameras.spot;\n // Update properties\n camera.fov = light.penumbraAngle * 2;\n camera.far = light.range;\n camera.worldTransform.copy(light.worldTransform);\n camera.updateProjectionMatrix();\n mat4.invert(camera.viewMatrix.array, camera.worldTransform.array);\n\n return camera;\n },\n\n /**\n * @param {clay.Renderer|WebGLRenderingContext} [renderer]\n * @memberOf clay.prePass.ShadowMap.prototype\n */\n // PENDING Renderer or WebGLRenderingContext\n dispose: function (renderer) {\n var _gl = renderer.gl || renderer;\n\n if (this._frameBuffer) {\n this._frameBuffer.dispose(_gl);\n }\n\n for (var name in this._textures) {\n this._textures[name].dispose(_gl);\n }\n\n this._texturePool.clear(renderer.gl);\n\n this._depthMaterials = {};\n this._distanceMaterials = {};\n this._textures = {};\n this._lightCameras = {};\n this._shadowMapNumber = {\n 'POINT_LIGHT': 0,\n 'DIRECTIONAL_LIGHT': 0,\n 'SPOT_LIGHT': 0\n };\n this._meshMaterials = {};\n\n for (var i = 0; i < this._receivers.length; i++) {\n var mesh = this._receivers[i];\n // Mesh may be disposed\n if (mesh.material) {\n var material = mesh.material;\n material.undefine('fragment', 'POINT_LIGHT_SHADOW_COUNT');\n material.undefine('fragment', 'DIRECTIONAL_LIGHT_SHADOW_COUNT');\n material.undefine('fragment', 'AMBIENT_LIGHT_SHADOW_COUNT');\n material.set('shadowEnabled', 0);\n }\n }\n\n this._receivers = [];\n this._lightsCastShadow = [];\n }\n});\n\n/**\n * @name clay.prePass.ShadowMap.VSM\n * @type {number}\n */\nShadowMapPass.VSM = 1;\n\n/**\n * @name clay.prePass.ShadowMap.PCF\n * @type {number}\n */\nShadowMapPass.PCF = 2;\n\nexport default ShadowMapPass;\n","import Base from '../core/Base';\n\n// PENDING\n// Use topological sort ?\n\n/**\n * Node of graph based post processing.\n *\n * @constructor clay.compositor.CompositorNode\n * @extends clay.core.Base\n *\n */\nvar CompositorNode = Base.extend(function () {\n return /** @lends clay.compositor.CompositorNode# */ {\n /**\n * @type {string}\n */\n name: '',\n\n /**\n * Input links, will be updated by the graph\n * @example:\n * inputName: {\n * node: someNode,\n * pin: 'xxxx'\n * }\n * @type {Object}\n */\n inputLinks: {},\n\n /**\n * Output links, will be updated by the graph\n * @example:\n * outputName: {\n * node: someNode,\n * pin: 'xxxx'\n * }\n * @type {Object}\n */\n outputLinks: {},\n\n // Save the output texture of previous frame\n // Will be used when there exist a circular reference\n _prevOutputTextures: {},\n _outputTextures: {},\n\n // Example: { name: 2 }\n _outputReferences: {},\n\n _rendering: false,\n // If rendered in this frame\n _rendered: false,\n\n _compositor: null\n };\n},\n/** @lends clay.compositor.CompositorNode.prototype */\n{\n\n // TODO Remove parameter function callback\n updateParameter: function (outputName, renderer) {\n var outputInfo = this.outputs[outputName];\n var parameters = outputInfo.parameters;\n var parametersCopy = outputInfo._parametersCopy;\n if (!parametersCopy) {\n parametersCopy = outputInfo._parametersCopy = {};\n }\n if (parameters) {\n for (var key in parameters) {\n if (key !== 'width' && key !== 'height') {\n parametersCopy[key] = parameters[key];\n }\n }\n }\n var width, height;\n if (parameters.width instanceof Function) {\n width = parameters.width.call(this, renderer);\n }\n else {\n width = parameters.width;\n }\n if (parameters.height instanceof Function) {\n height = parameters.height.call(this, renderer);\n }\n else {\n height = parameters.height;\n }\n if (\n parametersCopy.width !== width\n || parametersCopy.height !== height\n ) {\n if (this._outputTextures[outputName]) {\n this._outputTextures[outputName].dispose(renderer.gl);\n }\n }\n parametersCopy.width = width;\n parametersCopy.height = height;\n\n return parametersCopy;\n },\n\n /**\n * Set parameter\n * @param {string} name\n * @param {} value\n */\n setParameter: function (name, value) {},\n /**\n * Get parameter value\n * @param {string} name\n * @return {}\n */\n getParameter: function (name) {},\n /**\n * Set parameters\n * @param {Object} obj\n */\n setParameters: function (obj) {\n for (var name in obj) {\n this.setParameter(name, obj[name]);\n }\n },\n\n render: function () {},\n\n getOutput: function (renderer /*optional*/, name) {\n if (name == null) {\n // Return the output texture without rendering\n name = renderer;\n return this._outputTextures[name];\n }\n var outputInfo = this.outputs[name];\n if (!outputInfo) {\n return ;\n }\n\n // Already been rendered in this frame\n if (this._rendered) {\n // Force return texture in last frame\n if (outputInfo.outputLastFrame) {\n return this._prevOutputTextures[name];\n }\n else {\n return this._outputTextures[name];\n }\n }\n else if (\n // TODO\n this._rendering // Solve Circular Reference\n ) {\n if (!this._prevOutputTextures[name]) {\n // Create a blank texture at first pass\n this._prevOutputTextures[name] = this._compositor.allocateTexture(outputInfo.parameters || {});\n }\n return this._prevOutputTextures[name];\n }\n\n this.render(renderer);\n\n return this._outputTextures[name];\n },\n\n removeReference: function (outputName) {\n this._outputReferences[outputName]--;\n if (this._outputReferences[outputName] === 0) {\n var outputInfo = this.outputs[outputName];\n if (outputInfo.keepLastFrame) {\n if (this._prevOutputTextures[outputName]) {\n this._compositor.releaseTexture(this._prevOutputTextures[outputName]);\n }\n this._prevOutputTextures[outputName] = this._outputTextures[outputName];\n }\n else {\n // Output of this node have alreay been used by all other nodes\n // Put the texture back to the pool.\n this._compositor.releaseTexture(this._outputTextures[outputName]);\n }\n }\n },\n\n link: function (inputPinName, fromNode, fromPinName) {\n\n // The relationship from output pin to input pin is one-on-multiple\n this.inputLinks[inputPinName] = {\n node: fromNode,\n pin: fromPinName\n };\n if (!fromNode.outputLinks[fromPinName]) {\n fromNode.outputLinks[fromPinName] = [];\n }\n fromNode.outputLinks[fromPinName].push({\n node: this,\n pin: inputPinName\n });\n\n // Enabled the pin texture in shader\n this.pass.material.enableTexture(inputPinName);\n },\n\n clear: function () {\n this.inputLinks = {};\n this.outputLinks = {};\n },\n\n updateReference: function (outputName) {\n if (!this._rendering) {\n this._rendering = true;\n for (var inputName in this.inputLinks) {\n var link = this.inputLinks[inputName];\n link.node.updateReference(link.pin);\n }\n this._rendering = false;\n }\n if (outputName) {\n this._outputReferences[outputName] ++;\n }\n },\n\n beforeFrame: function () {\n this._rendered = false;\n\n for (var name in this.outputLinks) {\n this._outputReferences[name] = 0;\n }\n },\n\n afterFrame: function () {\n // Put back all the textures to pool\n for (var name in this.outputLinks) {\n if (this._outputReferences[name] > 0) {\n var outputInfo = this.outputs[name];\n if (outputInfo.keepLastFrame) {\n if (this._prevOutputTextures[name]) {\n this._compositor.releaseTexture(this._prevOutputTextures[name]);\n }\n this._prevOutputTextures[name] = this._outputTextures[name];\n }\n else {\n this._compositor.releaseTexture(this._outputTextures[name]);\n }\n }\n }\n }\n});\n\nexport default CompositorNode;\n","import Base from '../core/Base';\nimport GraphNode from './CompositorNode';\n\n/**\n * @constructor clay.compositor.Graph\n * @extends clay.core.Base\n */\nvar Graph = Base.extend(function () {\n return /** @lends clay.compositor.Graph# */ {\n /**\n * @type {Array.}\n */\n nodes: []\n };\n},\n/** @lends clay.compositor.Graph.prototype */\n{\n\n /**\n * Mark to update\n */\n dirty: function () {\n this._dirty = true;\n },\n /**\n * @param {clay.compositor.CompositorNode} node\n */\n addNode: function (node) {\n\n if (this.nodes.indexOf(node) >= 0) {\n return;\n }\n\n this.nodes.push(node);\n\n this._dirty = true;\n },\n /**\n * @param {clay.compositor.CompositorNode|string} node\n */\n removeNode: function (node) {\n if (typeof node === 'string') {\n node = this.getNodeByName(node);\n }\n var idx = this.nodes.indexOf(node);\n if (idx >= 0) {\n this.nodes.splice(idx, 1);\n this._dirty = true;\n }\n },\n /**\n * @param {string} name\n * @return {clay.compositor.CompositorNode}\n */\n getNodeByName: function (name) {\n for (var i = 0; i < this.nodes.length; i++) {\n if (this.nodes[i].name === name) {\n return this.nodes[i];\n }\n }\n },\n /**\n * Update links of graph\n */\n update: function () {\n for (var i = 0; i < this.nodes.length; i++) {\n this.nodes[i].clear();\n }\n // Traverse all the nodes and build the graph\n for (var i = 0; i < this.nodes.length; i++) {\n var node = this.nodes[i];\n\n if (!node.inputs) {\n continue;\n }\n for (var inputName in node.inputs) {\n if (!node.inputs[inputName]) {\n continue;\n }\n if (node.pass && !node.pass.material.isUniformEnabled(inputName)) {\n console.warn('Pin ' + node.name + '.' + inputName + ' not used.');\n continue;\n }\n var fromPinInfo = node.inputs[inputName];\n\n var fromPin = this.findPin(fromPinInfo);\n if (fromPin) {\n node.link(inputName, fromPin.node, fromPin.pin);\n }\n else {\n if (typeof fromPinInfo === 'string') {\n console.warn('Node ' + fromPinInfo + ' not exist');\n }\n else {\n console.warn('Pin of ' + fromPinInfo.node + '.' + fromPinInfo.pin + ' not exist');\n }\n }\n }\n }\n },\n\n findPin: function (input) {\n var node;\n // Try to take input as a directly a node\n if (typeof input === 'string' || input instanceof GraphNode) {\n input = {\n node: input\n };\n }\n\n if (typeof input.node === 'string') {\n for (var i = 0; i < this.nodes.length; i++) {\n var tmp = this.nodes[i];\n if (tmp.name === input.node) {\n node = tmp;\n }\n }\n }\n else {\n node = input.node;\n }\n if (node) {\n var inputPin = input.pin;\n if (!inputPin) {\n // Use first pin defaultly\n if (node.outputs) {\n inputPin = Object.keys(node.outputs)[0];\n }\n }\n if (node.outputs[inputPin]) {\n return {\n node: node,\n pin: inputPin\n };\n }\n }\n }\n});\n\nexport default Graph;\n","import Graph from './Graph';\nimport TexturePool from './TexturePool';\nimport FrameBuffer from '../FrameBuffer';\n\n/**\n * Compositor provide graph based post processing\n *\n * @constructor clay.compositor.Compositor\n * @extends clay.compositor.Graph\n *\n */\nvar Compositor = Graph.extend(function() {\n return {\n // Output node\n _outputs: [],\n\n _texturePool: new TexturePool(),\n\n _frameBuffer: new FrameBuffer({\n depthBuffer: false\n })\n };\n},\n/** @lends clay.compositor.Compositor.prototype */\n{\n addNode: function(node) {\n Graph.prototype.addNode.call(this, node);\n node._compositor = this;\n },\n /**\n * @param {clay.Renderer} renderer\n */\n render: function(renderer, frameBuffer) {\n if (this._dirty) {\n this.update();\n this._dirty = false;\n\n this._outputs.length = 0;\n for (var i = 0; i < this.nodes.length; i++) {\n if (!this.nodes[i].outputs) {\n this._outputs.push(this.nodes[i]);\n }\n }\n }\n\n for (var i = 0; i < this.nodes.length; i++) {\n // Update the reference number of each output texture\n this.nodes[i].beforeFrame();\n }\n\n for (var i = 0; i < this._outputs.length; i++) {\n this._outputs[i].updateReference();\n }\n\n for (var i = 0; i < this._outputs.length; i++) {\n this._outputs[i].render(renderer, frameBuffer);\n }\n\n for (var i = 0; i < this.nodes.length; i++) {\n // Clear up\n this.nodes[i].afterFrame();\n }\n },\n\n allocateTexture: function (parameters) {\n return this._texturePool.get(parameters);\n },\n\n releaseTexture: function (parameters) {\n this._texturePool.put(parameters);\n },\n\n getFrameBuffer: function () {\n return this._frameBuffer;\n },\n\n /**\n * Dispose compositor\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n this._texturePool.clear(renderer);\n }\n});\n\nexport default Compositor;\n","import CompositorNode from './CompositorNode';\nimport glenum from '../core/glenum';\nimport FrameBuffer from '../FrameBuffer';\n\n/**\n * @constructor clay.compositor.SceneNode\n * @extends clay.compositor.CompositorNode\n */\nvar SceneNode = CompositorNode.extend(\n/** @lends clay.compositor.SceneNode# */\n{\n name: 'scene',\n /**\n * @type {clay.Scene}\n */\n scene: null,\n /**\n * @type {clay.Camera}\n */\n camera: null,\n /**\n * @type {boolean}\n */\n autoUpdateScene: true,\n /**\n * @type {boolean}\n */\n preZ: false\n\n}, function() {\n this.frameBuffer = new FrameBuffer();\n}, {\n render: function(renderer) {\n\n this._rendering = true;\n var _gl = renderer.gl;\n\n this.trigger('beforerender');\n\n var renderInfo;\n\n if (!this.outputs) {\n\n renderInfo = renderer.render(this.scene, this.camera, !this.autoUpdateScene, this.preZ);\n\n }\n else {\n\n var frameBuffer = this.frameBuffer;\n for (var name in this.outputs) {\n var parameters = this.updateParameter(name, renderer);\n var outputInfo = this.outputs[name];\n var texture = this._compositor.allocateTexture(parameters);\n this._outputTextures[name] = texture;\n\n var attachment = outputInfo.attachment || _gl.COLOR_ATTACHMENT0;\n if (typeof(attachment) == 'string') {\n attachment = _gl[attachment];\n }\n frameBuffer.attach(texture, attachment);\n }\n frameBuffer.bind(renderer);\n\n // MRT Support in chrome\n // https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/ext-draw-buffers.html\n var ext = renderer.getGLExtension('EXT_draw_buffers');\n if (ext) {\n var bufs = [];\n for (var attachment in this.outputs) {\n attachment = parseInt(attachment);\n if (attachment >= _gl.COLOR_ATTACHMENT0 && attachment <= _gl.COLOR_ATTACHMENT0 + 8) {\n bufs.push(attachment);\n }\n }\n ext.drawBuffersEXT(bufs);\n }\n\n // Always clear\n // PENDING\n renderer.saveClear();\n renderer.clearBit = glenum.DEPTH_BUFFER_BIT | glenum.COLOR_BUFFER_BIT;\n renderInfo = renderer.render(this.scene, this.camera, !this.autoUpdateScene, this.preZ);\n renderer.restoreClear();\n\n frameBuffer.unbind(renderer);\n }\n\n this.trigger('afterrender', renderInfo);\n\n this._rendering = false;\n this._rendered = true;\n }\n});\n\nexport default SceneNode;\n","import CompositorNode from './CompositorNode';\n\n/**\n * @constructor clay.compositor.TextureNode\n * @extends clay.compositor.CompositorNode\n */\nvar TextureNode = CompositorNode.extend(function() {\n return /** @lends clay.compositor.TextureNode# */ {\n /**\n * @type {clay.Texture2D}\n */\n texture: null,\n\n // Texture node must have output without parameters\n outputs: {\n color: {}\n }\n };\n}, function () {\n}, {\n\n getOutput: function (renderer, name) {\n return this.texture;\n },\n\n // Do nothing\n beforeFrame: function () {},\n afterFrame: function () {}\n});\n\nexport default TextureNode;\n","// TODO Shader library\nimport Pass from './Pass';\nimport CompositorNode from './CompositorNode';\n\n// TODO curlnoise demo wrong\n\n// PENDING\n// Use topological sort ?\n\n/**\n * Filter node\n *\n * @constructor clay.compositor.FilterNode\n * @extends clay.compositor.CompositorNode\n *\n * @example\n var node = new clay.compositor.FilterNode({\n name: 'fxaa',\n shader: clay.Shader.source('clay.compositor.fxaa'),\n inputs: {\n texture: {\n node: 'scene',\n pin: 'color'\n }\n },\n // Multiple outputs is preserved for MRT support in WebGL2.0\n outputs: {\n color: {\n attachment: clay.FrameBuffer.COLOR_ATTACHMENT0\n parameters: {\n format: clay.Texture.RGBA,\n width: 512,\n height: 512\n },\n // Node will keep the RTT rendered in last frame\n keepLastFrame: true,\n // Force the node output the RTT rendered in last frame\n outputLastFrame: true\n }\n }\n });\n *\n */\nvar FilterNode = CompositorNode.extend(function () {\n return /** @lends clay.compositor.FilterNode# */ {\n /**\n * @type {string}\n */\n name: '',\n\n /**\n * @type {Object}\n */\n inputs: {},\n\n /**\n * @type {Object}\n */\n outputs: null,\n\n /**\n * @type {string}\n */\n shader: '',\n\n /**\n * Input links, will be updated by the graph\n * @example:\n * inputName: {\n * node: someNode,\n * pin: 'xxxx'\n * }\n * @type {Object}\n */\n inputLinks: {},\n\n /**\n * Output links, will be updated by the graph\n * @example:\n * outputName: {\n * node: someNode,\n * pin: 'xxxx'\n * }\n * @type {Object}\n */\n outputLinks: {},\n\n /**\n * @type {clay.compositor.Pass}\n */\n pass: null,\n\n // Save the output texture of previous frame\n // Will be used when there exist a circular reference\n _prevOutputTextures: {},\n _outputTextures: {},\n\n // Example: { name: 2 }\n _outputReferences: {},\n\n _rendering: false,\n // If rendered in this frame\n _rendered: false,\n\n _compositor: null\n };\n}, function () {\n\n var pass = new Pass({\n fragment: this.shader\n });\n this.pass = pass;\n},\n/** @lends clay.compositor.FilterNode.prototype */\n{\n /**\n * @param {clay.Renderer} renderer\n */\n render: function (renderer, frameBuffer) {\n this.trigger('beforerender', renderer);\n\n this._rendering = true;\n\n var _gl = renderer.gl;\n\n for (var inputName in this.inputLinks) {\n var link = this.inputLinks[inputName];\n var inputTexture = link.node.getOutput(renderer, link.pin);\n this.pass.setUniform(inputName, inputTexture);\n }\n // Output\n if (!this.outputs) {\n this.pass.outputs = null;\n\n this._compositor.getFrameBuffer().unbind(renderer);\n\n this.pass.render(renderer, frameBuffer);\n }\n else {\n this.pass.outputs = {};\n\n var attachedTextures = {};\n for (var name in this.outputs) {\n var parameters = this.updateParameter(name, renderer);\n if (isNaN(parameters.width)) {\n this.updateParameter(name, renderer);\n }\n var outputInfo = this.outputs[name];\n var texture = this._compositor.allocateTexture(parameters);\n this._outputTextures[name] = texture;\n var attachment = outputInfo.attachment || _gl.COLOR_ATTACHMENT0;\n if (typeof(attachment) === 'string') {\n attachment = _gl[attachment];\n }\n attachedTextures[attachment] = texture;\n }\n this._compositor.getFrameBuffer().bind(renderer);\n\n for (var attachment in attachedTextures) {\n // FIXME attachment changes in different nodes\n this._compositor.getFrameBuffer().attach(\n attachedTextures[attachment], attachment\n );\n }\n\n this.pass.render(renderer);\n\n // Because the data of texture is changed over time,\n // Here update the mipmaps of texture each time after rendered;\n this._compositor.getFrameBuffer().updateMipmap(renderer);\n }\n\n for (var inputName in this.inputLinks) {\n var link = this.inputLinks[inputName];\n link.node.removeReference(link.pin);\n }\n\n this._rendering = false;\n this._rendered = true;\n\n this.trigger('afterrender', renderer);\n },\n\n // TODO Remove parameter function callback\n updateParameter: function (outputName, renderer) {\n var outputInfo = this.outputs[outputName];\n var parameters = outputInfo.parameters;\n var parametersCopy = outputInfo._parametersCopy;\n if (!parametersCopy) {\n parametersCopy = outputInfo._parametersCopy = {};\n }\n if (parameters) {\n for (var key in parameters) {\n if (key !== 'width' && key !== 'height') {\n parametersCopy[key] = parameters[key];\n }\n }\n }\n var width, height;\n if (typeof parameters.width === 'function') {\n width = parameters.width.call(this, renderer);\n }\n else {\n width = parameters.width;\n }\n if (typeof parameters.height === 'function') {\n height = parameters.height.call(this, renderer);\n }\n else {\n height = parameters.height;\n }\n width = Math.ceil(width);\n height = Math.ceil(height);\n if (\n parametersCopy.width !== width\n || parametersCopy.height !== height\n ) {\n if (this._outputTextures[outputName]) {\n this._outputTextures[outputName].dispose(renderer);\n }\n }\n parametersCopy.width = width;\n parametersCopy.height = height;\n\n return parametersCopy;\n },\n\n /**\n * Set parameter\n * @param {string} name\n * @param {} value\n */\n setParameter: function (name, value) {\n this.pass.setUniform(name, value);\n },\n /**\n * Get parameter value\n * @param {string} name\n * @return {}\n */\n getParameter: function (name) {\n return this.pass.getUniform(name);\n },\n /**\n * Set parameters\n * @param {Object} obj\n */\n setParameters: function (obj) {\n for (var name in obj) {\n this.setParameter(name, obj[name]);\n }\n },\n // /**\n // * Set shader code\n // * @param {string} shaderStr\n // */\n // setShader: function (shaderStr) {\n // var material = this.pass.material;\n // material.shader.setFragment(shaderStr);\n // material.attachShader(material.shader, true);\n // },\n /**\n * Proxy of pass.material.define('fragment', xxx);\n * @param {string} symbol\n * @param {number} [val]\n */\n define: function (symbol, val) {\n this.pass.material.define('fragment', symbol, val);\n },\n\n /**\n * Proxy of pass.material.undefine('fragment', xxx)\n * @param {string} symbol\n */\n undefine: function (symbol) {\n this.pass.material.undefine('fragment', symbol);\n },\n\n removeReference: function (outputName) {\n this._outputReferences[outputName]--;\n if (this._outputReferences[outputName] === 0) {\n var outputInfo = this.outputs[outputName];\n if (outputInfo.keepLastFrame) {\n if (this._prevOutputTextures[outputName]) {\n this._compositor.releaseTexture(this._prevOutputTextures[outputName]);\n }\n this._prevOutputTextures[outputName] = this._outputTextures[outputName];\n }\n else {\n // Output of this node have alreay been used by all other nodes\n // Put the texture back to the pool.\n this._compositor.releaseTexture(this._outputTextures[outputName]);\n }\n }\n },\n\n clear: function () {\n CompositorNode.prototype.clear.call(this);\n\n // Default disable all texture\n this.pass.material.disableTexturesAll();\n }\n});\n\nexport default FilterNode;\n","export default \"@export clay.compositor.coloradjust\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float brightness : 0.0;\\nuniform float contrast : 1.0;\\nuniform float exposure : 0.0;\\nuniform float gamma : 1.0;\\nuniform float saturation : 1.0;\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\nvoid main()\\n{\\n vec4 tex = texture2D( texture, v_Texcoord);\\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\\n float luminance = dot( color, w );\\n color = mix(vec3(luminance), color, saturation);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.brightness\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float brightness : 0.0;\\nvoid main()\\n{\\n vec4 tex = texture2D( texture, v_Texcoord);\\n vec3 color = tex.rgb + vec3(brightness);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.contrast\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float contrast : 1.0;\\nvoid main()\\n{\\n vec4 tex = texture2D( texture, v_Texcoord);\\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.exposure\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float exposure : 0.0;\\nvoid main()\\n{\\n vec4 tex = texture2D(texture, v_Texcoord);\\n vec3 color = tex.rgb * pow(2.0, exposure);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.gamma\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float gamma : 1.0;\\nvoid main()\\n{\\n vec4 tex = texture2D(texture, v_Texcoord);\\n vec3 color = pow(tex.rgb, vec3(gamma));\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.saturation\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float saturation : 1.0;\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\nvoid main()\\n{\\n vec4 tex = texture2D(texture, v_Texcoord);\\n vec3 color = tex.rgb;\\n float luminance = dot(color, w);\\n color = mix(vec3(luminance), color, saturation);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\";\n","export default \"@export clay.compositor.kernel.gaussian_9\\nfloat gaussianKernel[9];\\ngaussianKernel[0] = 0.07;\\ngaussianKernel[1] = 0.09;\\ngaussianKernel[2] = 0.12;\\ngaussianKernel[3] = 0.14;\\ngaussianKernel[4] = 0.16;\\ngaussianKernel[5] = 0.14;\\ngaussianKernel[6] = 0.12;\\ngaussianKernel[7] = 0.09;\\ngaussianKernel[8] = 0.07;\\n@end\\n@export clay.compositor.kernel.gaussian_13\\nfloat gaussianKernel[13];\\ngaussianKernel[0] = 0.02;\\ngaussianKernel[1] = 0.03;\\ngaussianKernel[2] = 0.06;\\ngaussianKernel[3] = 0.08;\\ngaussianKernel[4] = 0.11;\\ngaussianKernel[5] = 0.13;\\ngaussianKernel[6] = 0.14;\\ngaussianKernel[7] = 0.13;\\ngaussianKernel[8] = 0.11;\\ngaussianKernel[9] = 0.08;\\ngaussianKernel[10] = 0.06;\\ngaussianKernel[11] = 0.03;\\ngaussianKernel[12] = 0.02;\\n@end\\n@export clay.compositor.gaussian_blur\\n#define SHADER_NAME gaussian_blur\\nuniform sampler2D texture;varying vec2 v_Texcoord;\\nuniform float blurSize : 2.0;\\nuniform vec2 textureSize : [512.0, 512.0];\\nuniform float blurDir : 0.0;\\n@import clay.util.rgbm\\n@import clay.util.clamp_sample\\nvoid main (void)\\n{\\n @import clay.compositor.kernel.gaussian_9\\n vec2 off = blurSize / textureSize;\\n off *= vec2(1.0 - blurDir, blurDir);\\n vec4 sum = vec4(0.0);\\n float weightAll = 0.0;\\n for (int i = 0; i < 9; i++) {\\n float w = gaussianKernel[i];\\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\\n sum += texel * w;\\n weightAll += w;\\n }\\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\\n}\\n@end\\n\";\n","export default \"@export clay.compositor.hdr.log_lum\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\\n float luminance = dot(tex.rgb, w);\\n luminance = log(luminance + 0.001);\\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\\n}\\n@end\\n@export clay.compositor.hdr.lum_adaption\\nvarying vec2 v_Texcoord;\\nuniform sampler2D adaptedLum;\\nuniform sampler2D currentLum;\\nuniform float frameTime : 0.02;\\n@import clay.util.rgbm\\nvoid main()\\n{\\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\\n}\\n@end\\n@export clay.compositor.lum\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\nvoid main()\\n{\\n vec4 tex = texture2D( texture, v_Texcoord );\\n float luminance = dot(tex.rgb, w);\\n gl_FragColor = vec4(vec3(luminance), 1.0);\\n}\\n@end\";\n","export default \"\\n@export clay.compositor.lut\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform sampler2D lookup;\\nvoid main()\\n{\\n vec4 tex = texture2D(texture, v_Texcoord);\\n float blueColor = tex.b * 63.0;\\n vec2 quad1;\\n quad1.y = floor(floor(blueColor) / 8.0);\\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\\n vec2 quad2;\\n quad2.y = floor(ceil(blueColor) / 8.0);\\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\\n vec2 texPos1;\\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\\n vec2 texPos2;\\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\\n vec4 newColor1 = texture2D(lookup, texPos1);\\n vec4 newColor2 = texture2D(lookup, texPos2);\\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\\n gl_FragColor = vec4(newColor.rgb, tex.w);\\n}\\n@end\";\n","export default \"@export clay.compositor.vignette\\n#define OUTPUT_ALPHA\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float darkness: 1;\\nuniform float offset: 1;\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\\n gl_FragColor.rgb = texel.rgb;\\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\\n}\\n@end\";\n","export default \"@export clay.compositor.output\\n#define OUTPUT_ALPHA\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\\n gl_FragColor.rgb = tex.rgb;\\n#ifdef OUTPUT_ALPHA\\n gl_FragColor.a = tex.a;\\n#else\\n gl_FragColor.a = 1.0;\\n#endif\\n gl_FragColor = encodeHDR(gl_FragColor);\\n#ifdef PREMULTIPLY_ALPHA\\n gl_FragColor.rgb *= gl_FragColor.a;\\n#endif\\n}\\n@end\";\n","export default \"@export clay.compositor.bright\\nuniform sampler2D texture;\\nuniform float threshold : 1;\\nuniform float scale : 1.0;\\nuniform vec2 textureSize: [512, 512];\\nvarying vec2 v_Texcoord;\\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\\n@import clay.util.rgbm\\nvec4 median(vec4 a, vec4 b, vec4 c)\\n{\\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\\n}\\nvoid main()\\n{\\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\\n#ifdef ANTI_FLICKER\\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\\n texel = median(median(texel, s1, s2), s3, s4);\\n#endif\\n float lum = dot(texel.rgb , lumWeight);\\n vec4 color;\\n if (lum > threshold && texel.a > 0.0)\\n {\\n color = vec4(texel.rgb * scale, texel.a * scale);\\n }\\n else\\n {\\n color = vec4(0.0);\\n }\\n gl_FragColor = encodeHDR(color);\\n}\\n@end\\n\";\n","export default \"@export clay.compositor.downsample\\nuniform sampler2D texture;\\nuniform vec2 textureSize : [512, 512];\\nvarying vec2 v_Texcoord;\\n@import clay.util.rgbm\\nfloat brightness(vec3 c)\\n{\\n return max(max(c.r, c.g), c.b);\\n}\\n@import clay.util.clamp_sample\\nvoid main()\\n{\\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\\n#ifdef ANTI_FLICKER\\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\\n float s1w = 1.0 / (brightness(s1) + 1.0);\\n float s2w = 1.0 / (brightness(s2) + 1.0);\\n float s3w = 1.0 / (brightness(s3) + 1.0);\\n float s4w = 1.0 / (brightness(s4) + 1.0);\\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\\n vec4 color = vec4(\\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\\n 1.0\\n );\\n#else\\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\\n color *= 0.25;\\n#endif\\n gl_FragColor = encodeHDR(color);\\n}\\n@end\";\n","export default \"\\n@export clay.compositor.upsample\\n#define HIGH_QUALITY\\nuniform sampler2D texture;\\nuniform vec2 textureSize : [512, 512];\\nuniform float sampleScale: 0.5;\\nvarying vec2 v_Texcoord;\\n@import clay.util.rgbm\\n@import clay.util.clamp_sample\\nvoid main()\\n{\\n#ifdef HIGH_QUALITY\\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\\n vec4 s;\\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\\n gl_FragColor = encodeHDR(s / 16.0);\\n#else\\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\\n vec4 s;\\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\\n gl_FragColor = encodeHDR(s / 4.0);\\n#endif\\n}\\n@end\";\n","export default \"@export clay.compositor.hdr.composite\\n#define TONEMAPPING\\nuniform sampler2D texture;\\n#ifdef BLOOM_ENABLED\\nuniform sampler2D bloom;\\n#endif\\n#ifdef LENSFLARE_ENABLED\\nuniform sampler2D lensflare;\\nuniform sampler2D lensdirt;\\n#endif\\n#ifdef LUM_ENABLED\\nuniform sampler2D lum;\\n#endif\\n#ifdef LUT_ENABLED\\nuniform sampler2D lut;\\n#endif\\n#ifdef COLOR_CORRECTION\\nuniform float brightness : 0.0;\\nuniform float contrast : 1.0;\\nuniform float saturation : 1.0;\\n#endif\\n#ifdef VIGNETTE\\nuniform float vignetteDarkness: 1.0;\\nuniform float vignetteOffset: 1.0;\\n#endif\\nuniform float exposure : 1.0;\\nuniform float bloomIntensity : 0.25;\\nuniform float lensflareIntensity : 1;\\nvarying vec2 v_Texcoord;\\n@import clay.util.srgb\\nvec3 ACESToneMapping(vec3 color)\\n{\\n const float A = 2.51;\\n const float B = 0.03;\\n const float C = 2.43;\\n const float D = 0.59;\\n const float E = 0.14;\\n return (color * (A * color + B)) / (color * (C * color + D) + E);\\n}\\nfloat eyeAdaption(float fLum)\\n{\\n return mix(0.2, fLum, 0.5);\\n}\\n#ifdef LUT_ENABLED\\nvec3 lutTransform(vec3 color) {\\n float blueColor = color.b * 63.0;\\n vec2 quad1;\\n quad1.y = floor(floor(blueColor) / 8.0);\\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\\n vec2 quad2;\\n quad2.y = floor(ceil(blueColor) / 8.0);\\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\\n vec2 texPos1;\\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\\n vec2 texPos2;\\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\\n vec4 newColor1 = texture2D(lut, texPos1);\\n vec4 newColor2 = texture2D(lut, texPos2);\\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\\n return newColor.rgb;\\n}\\n#endif\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 texel = vec4(0.0);\\n vec4 originalTexel = vec4(0.0);\\n#ifdef TEXTURE_ENABLED\\n texel = decodeHDR(texture2D(texture, v_Texcoord));\\n originalTexel = texel;\\n#endif\\n#ifdef BLOOM_ENABLED\\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\\n texel.rgb += bloomTexel.rgb * bloomIntensity;\\n texel.a += bloomTexel.a * bloomIntensity;\\n#endif\\n#ifdef LENSFLARE_ENABLED\\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\\n#endif\\n texel.a = min(texel.a, 1.0);\\n#ifdef LUM_ENABLED\\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\\n float exposureBias = adaptedLumDest * exposure;\\n#else\\n float exposureBias = exposure;\\n#endif\\n#ifdef TONEMAPPING\\n texel.rgb *= exposureBias;\\n texel.rgb = ACESToneMapping(texel.rgb);\\n#endif\\n texel = linearTosRGB(texel);\\n#ifdef LUT_ENABLED\\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\\n#endif\\n#ifdef COLOR_CORRECTION\\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\\n#endif\\n#ifdef VIGNETTE\\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\\n#endif\\n gl_FragColor = encodeHDR(texel);\\n#ifdef DEBUG\\n #if DEBUG == 1\\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\\n #elif DEBUG == 2\\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\\n #elif DEBUG == 3\\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\\n #endif\\n#endif\\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\\n }\\n#ifdef PREMULTIPLY_ALPHA\\n gl_FragColor.rgb *= gl_FragColor.a;\\n#endif\\n}\\n@end\";\n","export default \"@export clay.compositor.lensflare\\n#define SAMPLE_NUMBER 8\\nuniform sampler2D texture;\\nuniform sampler2D lenscolor;\\nuniform vec2 textureSize : [512, 512];\\nuniform float dispersal : 0.3;\\nuniform float haloWidth : 0.4;\\nuniform float distortion : 1.0;\\nvarying vec2 v_Texcoord;\\n@import clay.util.rgbm\\nvec4 textureDistorted(\\n in vec2 texcoord,\\n in vec2 direction,\\n in vec3 distortion\\n) {\\n return vec4(\\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\\n 1.0\\n );\\n}\\nvoid main()\\n{\\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\\n vec2 haloVec = normalize(ghostVec) * haloWidth;\\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\\n vec4 result = vec4(0.0);\\n for (int i = 0; i < SAMPLE_NUMBER; i++)\\n {\\n vec2 offset = fract(texcoord + ghostVec * float(i));\\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\\n weight = pow(1.0 - weight, 10.0);\\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\\n }\\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\\n weight = pow(1.0 - weight, 10.0);\\n vec2 offset = fract(texcoord + haloVec);\\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\\n gl_FragColor = result;\\n}\\n@end\";\n","export default \"@export clay.compositor.blend\\n#define SHADER_NAME blend\\n#ifdef TEXTURE1_ENABLED\\nuniform sampler2D texture1;\\nuniform float weight1 : 1.0;\\n#endif\\n#ifdef TEXTURE2_ENABLED\\nuniform sampler2D texture2;\\nuniform float weight2 : 1.0;\\n#endif\\n#ifdef TEXTURE3_ENABLED\\nuniform sampler2D texture3;\\nuniform float weight3 : 1.0;\\n#endif\\n#ifdef TEXTURE4_ENABLED\\nuniform sampler2D texture4;\\nuniform float weight4 : 1.0;\\n#endif\\n#ifdef TEXTURE5_ENABLED\\nuniform sampler2D texture5;\\nuniform float weight5 : 1.0;\\n#endif\\n#ifdef TEXTURE6_ENABLED\\nuniform sampler2D texture6;\\nuniform float weight6 : 1.0;\\n#endif\\nvarying vec2 v_Texcoord;\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 tex = vec4(0.0);\\n#ifdef TEXTURE1_ENABLED\\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\\n#endif\\n#ifdef TEXTURE2_ENABLED\\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\\n#endif\\n#ifdef TEXTURE3_ENABLED\\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\\n#endif\\n#ifdef TEXTURE4_ENABLED\\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\\n#endif\\n#ifdef TEXTURE5_ENABLED\\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\\n#endif\\n#ifdef TEXTURE6_ENABLED\\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\\n#endif\\n gl_FragColor = encodeHDR(tex);\\n}\\n@end\";\n","export default \"@export clay.compositor.fxaa\\nuniform sampler2D texture;\\nuniform vec4 viewport : VIEWPORT;\\nvarying vec2 v_Texcoord;\\n#define FXAA_REDUCE_MIN (1.0/128.0)\\n#define FXAA_REDUCE_MUL (1.0/8.0)\\n#define FXAA_SPAN_MAX 8.0\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec2 resolution = 1.0 / viewport.zw;\\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\\n vec3 rgbM = rgbaM.xyz;\\n float opacity = rgbaM.w;\\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\\n float lumaNW = dot( rgbNW, luma );\\n float lumaNE = dot( rgbNE, luma );\\n float lumaSW = dot( rgbSW, luma );\\n float lumaSE = dot( rgbSE, luma );\\n float lumaM = dot( rgbM, luma );\\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\\n vec2 dir;\\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\\n dir * rcpDirMin)) * resolution;\\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\\n rgbA *= 0.5;\\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\\n rgbB *= 0.25;\\n rgbB += rgbA * 0.5;\\n float lumaB = dot( rgbB, luma );\\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\\n {\\n gl_FragColor = vec4( rgbA, opacity );\\n }\\n else {\\n gl_FragColor = vec4( rgbB, opacity );\\n }\\n}\\n@end\";\n","import coloradjustEssl from './source/compositor/coloradjust.glsl.js';\nimport blurEssl from './source/compositor/blur.glsl.js';\nimport lumEssl from './source/compositor/lum.glsl.js';\nimport lutEssl from './source/compositor/lut.glsl.js';\nimport vigentteEssl from './source/compositor/vignette.glsl.js';\nimport outputEssl from './source/compositor/output.glsl.js';\nimport brightEssl from './source/compositor/bright.glsl.js';\nimport downsampleEssl from './source/compositor/downsample.glsl.js';\nimport upsampleEssl from './source/compositor/upsample.glsl.js';\nimport hdrEssl from './source/compositor/hdr.glsl.js';\nimport lensflareEssl from './source/compositor/lensflare.glsl.js';\nimport blendEssl from './source/compositor/blend.glsl.js';\nimport fxaaEssl from './source/compositor/fxaa.glsl.js';\n// import fxaa3Essl from './source/compositor/fxaa3.glsl.js';\n\n// TODO Must export a module and be used in the other modules. Or it will be tree shaked\nexport default function register(Shader) {\n // Some build in shaders\n Shader['import'](coloradjustEssl);\n Shader['import'](blurEssl);\n Shader['import'](lumEssl);\n Shader['import'](lutEssl);\n Shader['import'](vigentteEssl);\n Shader['import'](outputEssl);\n Shader['import'](brightEssl);\n Shader['import'](downsampleEssl);\n Shader['import'](upsampleEssl);\n Shader['import'](hdrEssl);\n Shader['import'](lensflareEssl);\n Shader['import'](blendEssl);\n\n Shader['import'](fxaaEssl);\n\n}","import util from './core/util';\nimport Compositor from './compositor/Compositor';\nimport CompoSceneNode from './compositor/SceneNode';\nimport CompoTextureNode from './compositor/TextureNode';\nimport CompoFilterNode from './compositor/FilterNode';\nimport Shader from './Shader';\nimport Texture from './Texture';\nimport Texture2D from './Texture2D';\nimport TextureCube from './TextureCube';\n\nimport registerBuiltinCompositor from './shader/registerBuiltinCompositor';\n\nregisterBuiltinCompositor(Shader);\n\nvar shaderSourceReg = /^#source\\((.*?)\\)/;\n\n/**\n * @name clay.createCompositor\n * @function\n * @param {Object} json\n * @param {Object} [opts]\n * @return {clay.compositor.Compositor}\n */\nfunction createCompositor(json, opts) {\n var compositor = new Compositor();\n opts = opts || {};\n\n var lib = {\n textures: {},\n parameters: {}\n };\n var afterLoad = function(shaderLib, textureLib) {\n for (var i = 0; i < json.nodes.length; i++) {\n var nodeInfo = json.nodes[i];\n var node = createNode(nodeInfo, lib, opts);\n if (node) {\n compositor.addNode(node);\n }\n }\n };\n\n for (var name in json.parameters) {\n var paramInfo = json.parameters[name];\n lib.parameters[name] = convertParameter(paramInfo);\n }\n // TODO load texture asynchronous\n loadTextures(json, lib, opts, function(textureLib) {\n lib.textures = textureLib;\n afterLoad();\n });\n\n return compositor;\n}\n\nfunction createNode(nodeInfo, lib, opts) {\n var type = nodeInfo.type || 'filter';\n var shaderSource;\n var inputs;\n var outputs;\n\n if (type === 'filter') {\n var shaderExp = nodeInfo.shader.trim();\n var res = shaderSourceReg.exec(shaderExp);\n if (res) {\n shaderSource = Shader.source(res[1].trim());\n }\n else if (shaderExp.charAt(0) === '#') {\n shaderSource = lib.shaders[shaderExp.substr(1)];\n }\n if (!shaderSource) {\n shaderSource = shaderExp;\n }\n if (!shaderSource) {\n return;\n }\n }\n\n if (nodeInfo.inputs) {\n inputs = {};\n for (var name in nodeInfo.inputs) {\n if (typeof nodeInfo.inputs[name] === 'string') {\n inputs[name] = nodeInfo.inputs[name];\n }\n else {\n inputs[name] = {\n node: nodeInfo.inputs[name].node,\n pin: nodeInfo.inputs[name].pin\n };\n }\n }\n }\n if (nodeInfo.outputs) {\n outputs = {};\n for (var name in nodeInfo.outputs) {\n var outputInfo = nodeInfo.outputs[name];\n outputs[name] = {};\n if (outputInfo.attachment != null) {\n outputs[name].attachment = outputInfo.attachment;\n }\n if (outputInfo.keepLastFrame != null) {\n outputs[name].keepLastFrame = outputInfo.keepLastFrame;\n }\n if (outputInfo.outputLastFrame != null) {\n outputs[name].outputLastFrame = outputInfo.outputLastFrame;\n }\n if (outputInfo.parameters) {\n outputs[name].parameters = convertParameter(outputInfo.parameters);\n }\n }\n }\n var node;\n if (type === 'scene') {\n node = new CompoSceneNode({\n name: nodeInfo.name,\n scene: opts.scene,\n camera: opts.camera,\n outputs: outputs\n });\n }\n else if (type === 'texture') {\n node = new CompoTextureNode({\n name: nodeInfo.name,\n outputs: outputs\n });\n }\n // Default is filter\n else {\n node = new CompoFilterNode({\n name: nodeInfo.name,\n shader: shaderSource,\n inputs: inputs,\n outputs: outputs\n });\n }\n if (node) {\n if (nodeInfo.parameters) {\n for (var name in nodeInfo.parameters) {\n var val = nodeInfo.parameters[name];\n if (typeof val === 'string') {\n val = val.trim();\n if (val.charAt(0) === '#') {\n val = lib.textures[val.substr(1)];\n }\n else {\n node.on(\n 'beforerender', createSizeSetHandler(\n name, tryConvertExpr(val)\n )\n );\n }\n }\n else if (typeof val === 'function') {\n node.on('beforerender', val);\n }\n node.setParameter(name, val);\n }\n }\n if (nodeInfo.defines && node.pass) {\n for (var name in nodeInfo.defines) {\n var val = nodeInfo.defines[name];\n node.pass.material.define('fragment', name, val);\n }\n }\n }\n return node;\n}\n\nfunction defaultWidthFunc(width, height) {\n return width;\n}\nfunction defaultHeightFunc(width, height) {\n return height;\n}\n\nfunction convertParameter(paramInfo) {\n var param = {};\n if (!paramInfo) {\n return param;\n }\n ['type', 'minFilter', 'magFilter', 'wrapS', 'wrapT', 'flipY', 'useMipmap']\n .forEach(function(name) {\n var val = paramInfo[name];\n if (val != null) {\n // Convert string to enum\n if (typeof val === 'string') {\n val = Texture[val];\n }\n param[name] = val;\n }\n });\n\n var sizeScale = paramInfo.scale || 1;\n ['width', 'height']\n .forEach(function(name) {\n if (paramInfo[name] != null) {\n var val = paramInfo[name];\n if (typeof val === 'string') {\n val = val.trim();\n param[name] = createSizeParser(\n name, tryConvertExpr(val), sizeScale\n );\n }\n else {\n param[name] = val;\n }\n }\n });\n if (!param.width) {\n param.width = defaultWidthFunc;\n }\n if (!param.height) {\n param.height = defaultHeightFunc;\n }\n\n if (paramInfo.useMipmap != null) {\n param.useMipmap = paramInfo.useMipmap;\n }\n return param;\n}\n\nfunction loadTextures(json, lib, opts, callback) {\n if (!json.textures) {\n callback({});\n return;\n }\n var textures = {};\n var loading = 0;\n\n var cbd = false;\n var textureRootPath = opts.textureRootPath;\n util.each(json.textures, function(textureInfo, name) {\n var texture;\n var path = textureInfo.path;\n var parameters = convertParameter(textureInfo.parameters);\n if (Array.isArray(path) && path.length === 6) {\n if (textureRootPath) {\n path = path.map(function(item) {\n return util.relative2absolute(item, textureRootPath);\n });\n }\n texture = new TextureCube(parameters);\n }\n else if(typeof path === 'string') {\n if (textureRootPath) {\n path = util.relative2absolute(path, textureRootPath);\n }\n texture = new Texture2D(parameters);\n }\n else {\n return;\n }\n\n texture.load(path);\n loading++;\n texture.once('success', function() {\n textures[name] = texture;\n loading--;\n if (loading === 0) {\n callback(textures);\n cbd = true;\n }\n });\n });\n\n if (loading === 0 && !cbd) {\n callback(textures);\n }\n}\n\nfunction createSizeSetHandler(name, exprFunc) {\n return function (renderer) {\n // PENDING viewport size or window size\n var dpr = renderer.getDevicePixelRatio();\n // PENDING If multiply dpr ?\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n var result = exprFunc(width, height, dpr);\n this.setParameter(name, result);\n };\n}\n\nfunction createSizeParser(name, exprFunc, scale) {\n scale = scale || 1;\n return function (renderer) {\n var dpr = renderer.getDevicePixelRatio();\n var width = renderer.getWidth() * scale;\n var height = renderer.getHeight() * scale;\n return exprFunc(width, height, dpr);\n };\n}\n\nfunction tryConvertExpr(string) {\n // PENDING\n var exprRes = /^expr\\((.*)\\)$/.exec(string);\n if (exprRes) {\n try {\n var func = new Function('width', 'height', 'dpr', 'return ' + exprRes[1]);\n // Try run t\n func(1, 1);\n\n return func;\n }\n catch (e) {\n throw new Error('Invalid expression.');\n }\n }\n}\n\nexport default createCompositor;\n","// DEPRECATED\nimport createCompositor from '../createCompositor';\nexport default createCompositor;","\n// Generate halton sequence\n// https://en.wikipedia.org/wiki/Halton_sequence\nfunction halton(index, base) {\n\n var result = 0;\n var f = 1 / base;\n var i = index;\n while (i > 0) {\n result = result + f * (i % base);\n i = Math.floor(i / base);\n f = f / base;\n }\n return result;\n}\n\n\nexport default halton;","export default \"@export ecgl.ssao.estimate\\n\\nuniform sampler2D depthTex;\\n\\nuniform sampler2D normalTex;\\n\\nuniform sampler2D noiseTex;\\n\\nuniform vec2 depthTexSize;\\n\\nuniform vec2 noiseTexSize;\\n\\nuniform mat4 projection;\\n\\nuniform mat4 projectionInv;\\n\\nuniform mat4 viewInverseTranspose;\\n\\nuniform vec3 kernel[KERNEL_SIZE];\\n\\nuniform float radius : 1;\\n\\nuniform float power : 1;\\n\\nuniform float bias: 1e-2;\\n\\nuniform float intensity: 1.0;\\n\\nvarying vec2 v_Texcoord;\\n\\nfloat ssaoEstimator(in vec3 originPos, in mat3 kernelBasis) {\\n float occlusion = 0.0;\\n\\n for (int i = 0; i < KERNEL_SIZE; i++) {\\n vec3 samplePos = kernel[i];\\n#ifdef NORMALTEX_ENABLED\\n samplePos = kernelBasis * samplePos;\\n#endif\\n samplePos = samplePos * radius + originPos;\\n\\n vec4 texCoord = projection * vec4(samplePos, 1.0);\\n texCoord.xy /= texCoord.w;\\n\\n vec4 depthTexel = texture2D(depthTex, texCoord.xy * 0.5 + 0.5);\\n\\n float sampleDepth = depthTexel.r * 2.0 - 1.0;\\n if (projection[3][3] == 0.0) {\\n sampleDepth = projection[3][2] / (sampleDepth * projection[2][3] - projection[2][2]);\\n }\\n else {\\n sampleDepth = (sampleDepth - projection[3][2]) / projection[2][2];\\n }\\n \\n float rangeCheck = smoothstep(0.0, 1.0, radius / abs(originPos.z - sampleDepth));\\n occlusion += rangeCheck * step(samplePos.z, sampleDepth - bias);\\n }\\n#ifdef NORMALTEX_ENABLED\\n occlusion = 1.0 - occlusion / float(KERNEL_SIZE);\\n#else\\n occlusion = 1.0 - clamp((occlusion / float(KERNEL_SIZE) - 0.6) * 2.5, 0.0, 1.0);\\n#endif\\n return pow(occlusion, power);\\n}\\n\\nvoid main()\\n{\\n\\n vec4 depthTexel = texture2D(depthTex, v_Texcoord);\\n\\n#ifdef NORMALTEX_ENABLED\\n vec4 tex = texture2D(normalTex, v_Texcoord);\\n if (dot(tex.rgb, tex.rgb) == 0.0) {\\n gl_FragColor = vec4(1.0);\\n return;\\n }\\n vec3 N = tex.rgb * 2.0 - 1.0;\\n N = (viewInverseTranspose * vec4(N, 0.0)).xyz;\\n\\n vec2 noiseTexCoord = depthTexSize / vec2(noiseTexSize) * v_Texcoord;\\n vec3 rvec = texture2D(noiseTex, noiseTexCoord).rgb * 2.0 - 1.0;\\n vec3 T = normalize(rvec - N * dot(rvec, N));\\n vec3 BT = normalize(cross(N, T));\\n mat3 kernelBasis = mat3(T, BT, N);\\n#else\\n if (depthTexel.r > 0.99999) {\\n gl_FragColor = vec4(1.0);\\n return;\\n }\\n mat3 kernelBasis;\\n#endif\\n\\n float z = depthTexel.r * 2.0 - 1.0;\\n\\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\\n vec4 p4 = projectionInv * projectedPos;\\n\\n vec3 position = p4.xyz / p4.w;\\n\\n float ao = ssaoEstimator(position, kernelBasis);\\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\\n gl_FragColor = vec4(vec3(ao), 1.0);\\n}\\n\\n@end\\n\\n\\n@export ecgl.ssao.blur\\n#define SHADER_NAME SSAO_BLUR\\n\\nuniform sampler2D ssaoTexture;\\n\\n#ifdef NORMALTEX_ENABLED\\nuniform sampler2D normalTex;\\n#endif\\n\\nvarying vec2 v_Texcoord;\\n\\nuniform vec2 textureSize;\\nuniform float blurSize : 1.0;\\n\\nuniform int direction: 0.0;\\n\\n#ifdef DEPTHTEX_ENABLED\\nuniform sampler2D depthTex;\\nuniform mat4 projection;\\nuniform float depthRange : 0.5;\\n\\nfloat getLinearDepth(vec2 coord)\\n{\\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\\n}\\n#endif\\n\\nvoid main()\\n{\\n float kernel[5];\\n kernel[0] = 0.122581;\\n kernel[1] = 0.233062;\\n kernel[2] = 0.288713;\\n kernel[3] = 0.233062;\\n kernel[4] = 0.122581;\\n\\n vec2 off = vec2(0.0);\\n if (direction == 0) {\\n off[0] = blurSize / textureSize.x;\\n }\\n else {\\n off[1] = blurSize / textureSize.y;\\n }\\n\\n vec2 coord = v_Texcoord;\\n\\n float sum = 0.0;\\n float weightAll = 0.0;\\n\\n#ifdef NORMALTEX_ENABLED\\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\\n#endif\\n#if defined(DEPTHTEX_ENABLED)\\n float centerDepth = getLinearDepth(v_Texcoord);\\n#endif\\n\\n for (int i = 0; i < 5; i++) {\\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\\n\\n float w = kernel[i];\\n#ifdef NORMALTEX_ENABLED\\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\\n#endif\\n#ifdef DEPTHTEX_ENABLED\\n float d = getLinearDepth(coord);\\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\\n#endif\\n\\n weightAll += w;\\n sum += texture2D(ssaoTexture, coord).r * w;\\n }\\n\\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\\n}\\n\\n@end\\n\";\n","import Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Pass from 'claygl/src/compositor/Pass';\nimport Shader from 'claygl/src/Shader';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport halton from './halton';\n\nimport SSAOGLSL from './SSAO.glsl.js';\nShader.import(SSAOGLSL);\n\nfunction generateNoiseData(size) {\n var data = new Uint8Array(size * size * 4);\n var n = 0;\n var v3 = new Vector3();\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n v3.set(Math.random() * 2 - 1, Math.random() * 2 - 1, 0).normalize();\n data[n++] = (v3.x * 0.5 + 0.5) * 255;\n data[n++] = (v3.y * 0.5 + 0.5) * 255;\n data[n++] = 0;\n data[n++] = 255;\n }\n }\n return data;\n}\n\nfunction generateNoiseTexture(size) {\n return new Texture2D({\n pixels: generateNoiseData(size),\n wrapS: Texture.REPEAT,\n wrapT: Texture.REPEAT,\n width: size,\n height: size\n });\n}\n\nfunction generateKernel(size, offset, hemisphere) {\n var kernel = new Float32Array(size * 3);\n offset = offset || 0;\n for (var i = 0; i < size; i++) {\n var phi = halton(i + offset, 2) * (hemisphere ? 1 : 2) * Math.PI;\n var theta = halton(i + offset, 3) * Math.PI;\n var r = Math.random();\n var x = Math.cos(phi) * Math.sin(theta) * r;\n var y = Math.cos(theta) * r;\n var z = Math.sin(phi) * Math.sin(theta) * r;\n\n kernel[i * 3] = x;\n kernel[i * 3 + 1] = y;\n kernel[i * 3 + 2] = z;\n }\n return kernel;\n\n // var kernel = new Float32Array(size * 3);\n // var v3 = new Vector3();\n // for (var i = 0; i < size; i++) {\n // v3.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random())\n // .normalize().scale(Math.random());\n // kernel[i * 3] = v3.x;\n // kernel[i * 3 + 1] = v3.y;\n // kernel[i * 3 + 2] = v3.z;\n // }\n // return kernel;\n}\n\nfunction SSAOPass(opt) {\n opt = opt || {};\n\n this._ssaoPass = new Pass({\n fragment: Shader.source('ecgl.ssao.estimate')\n });\n this._blurPass = new Pass({\n fragment: Shader.source('ecgl.ssao.blur')\n });\n this._framebuffer = new FrameBuffer({\n depthBuffer: false\n });\n\n this._ssaoTexture = new Texture2D();\n this._blurTexture = new Texture2D();\n this._blurTexture2 = new Texture2D();\n\n this._depthTex = opt.depthTexture;\n this._normalTex = opt.normalTexture;\n\n this.setNoiseSize(4);\n this.setKernelSize(opt.kernelSize || 12);\n if (opt.radius != null) {\n this.setParameter('radius', opt.radius);\n }\n if (opt.power != null) {\n this.setParameter('power', opt.power);\n }\n\n if (!this._normalTex) {\n this._ssaoPass.material.disableTexture('normalTex');\n this._blurPass.material.disableTexture('normalTex');\n }\n if (!this._depthTex) {\n this._blurPass.material.disableTexture('depthTex');\n }\n\n this._blurPass.material.setUniform('normalTex', this._normalTex);\n this._blurPass.material.setUniform('depthTex', this._depthTex);\n}\n\nSSAOPass.prototype.setDepthTexture = function (depthTex) {\n this._depthTex = depthTex;\n};\n\nSSAOPass.prototype.setNormalTexture = function (normalTex) {\n this._normalTex = normalTex;\n this._ssaoPass.material[normalTex ? 'enableTexture' : 'disableTexture']('normalTex');\n // Switch between hemisphere and shere kernel.\n this.setKernelSize(this._kernelSize);\n};\n\nSSAOPass.prototype.update = function (renderer, camera, frame) {\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n\n var ssaoPass = this._ssaoPass;\n var blurPass = this._blurPass;\n\n ssaoPass.setUniform('kernel', this._kernels[frame % this._kernels.length]);\n ssaoPass.setUniform('depthTex', this._depthTex);\n if (this._normalTex != null) {\n ssaoPass.setUniform('normalTex', this._normalTex);\n }\n ssaoPass.setUniform('depthTexSize', [this._depthTex.width, this._depthTex.height]);\n\n var viewInverseTranspose = new Matrix4();\n Matrix4.transpose(viewInverseTranspose, camera.worldTransform);\n\n ssaoPass.setUniform('projection', camera.projectionMatrix.array);\n ssaoPass.setUniform('projectionInv', camera.invProjectionMatrix.array);\n ssaoPass.setUniform('viewInverseTranspose', viewInverseTranspose.array);\n\n var ssaoTexture = this._ssaoTexture;\n var blurTexture = this._blurTexture;\n var blurTexture2 = this._blurTexture2;\n\n ssaoTexture.width = width / 2;\n ssaoTexture.height = height / 2;\n blurTexture.width = width;\n blurTexture.height = height;\n blurTexture2.width = width;\n blurTexture2.height = height;\n\n this._framebuffer.attach(ssaoTexture);\n this._framebuffer.bind(renderer);\n renderer.gl.clearColor(1, 1, 1, 1);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT);\n ssaoPass.render(renderer);\n\n blurPass.setUniform('textureSize', [width / 2, height / 2]);\n blurPass.setUniform('projection', camera.projectionMatrix.array);\n this._framebuffer.attach(blurTexture);\n blurPass.setUniform('direction', 0);\n blurPass.setUniform('ssaoTexture', ssaoTexture);\n blurPass.render(renderer);\n\n this._framebuffer.attach(blurTexture2);\n blurPass.setUniform('textureSize', [width, height]);\n blurPass.setUniform('direction', 1);\n blurPass.setUniform('ssaoTexture', blurTexture);\n blurPass.render(renderer);\n\n this._framebuffer.unbind(renderer);\n\n // Restore clear\n var clearColor = renderer.clearColor;\n renderer.gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);\n};\n\nSSAOPass.prototype.getTargetTexture = function () {\n return this._blurTexture2;\n}\n\nSSAOPass.prototype.setParameter = function (name, val) {\n if (name === 'noiseTexSize') {\n this.setNoiseSize(val);\n }\n else if (name === 'kernelSize') {\n this.setKernelSize(val);\n }\n else if (name === 'intensity') {\n this._ssaoPass.material.set('intensity', val);\n }\n else {\n this._ssaoPass.setUniform(name, val);\n }\n};\n\nSSAOPass.prototype.setKernelSize = function (size) {\n this._kernelSize = size;\n this._ssaoPass.material.define('fragment', 'KERNEL_SIZE', size);\n this._kernels = this._kernels || [];\n for (var i = 0; i < 30; i++) {\n this._kernels[i] = generateKernel(size, i * size, !!this._normalTex);\n }\n};\n\nSSAOPass.prototype.setNoiseSize = function (size) {\n var texture = this._ssaoPass.getUniform('noiseTex');\n if (!texture) {\n texture = generateNoiseTexture(size);\n this._ssaoPass.setUniform('noiseTex', generateNoiseTexture(size));\n }\n else {\n texture.data = generateNoiseData(size);\n texture.width = texture.height = size;\n texture.dirty();\n }\n\n this._ssaoPass.setUniform('noiseTexSize', [size, size]);\n};\n\nSSAOPass.prototype.dispose = function (renderer) {\n this._blurTexture.dispose(renderer);\n this._ssaoTexture.dispose(renderer);\n this._blurTexture2.dispose(renderer);\n};\n\nexport default SSAOPass;","export default \"@export ecgl.ssr.main\\n\\n#define SHADER_NAME SSR\\n#define MAX_ITERATION 20;\\n#define SAMPLE_PER_FRAME 5;\\n#define TOTAL_SAMPLES 128;\\n\\nuniform sampler2D sourceTexture;\\nuniform sampler2D gBufferTexture1;\\nuniform sampler2D gBufferTexture2;\\nuniform sampler2D gBufferTexture3;\\nuniform samplerCube specularCubemap;\\nuniform float specularIntensity: 1;\\n\\nuniform mat4 projection;\\nuniform mat4 projectionInv;\\nuniform mat4 toViewSpace;\\nuniform mat4 toWorldSpace;\\n\\nuniform float maxRayDistance: 200;\\n\\nuniform float pixelStride: 16;\\nuniform float pixelStrideZCutoff: 50; \\nuniform float screenEdgeFadeStart: 0.9; \\nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \\nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\\n\\nuniform float nearZ;\\nuniform vec2 viewportSize : VIEWPORT_SIZE;\\n\\nuniform float jitterOffset: 0;\\n\\nvarying vec2 v_Texcoord;\\n\\n#ifdef DEPTH_DECODE\\n@import clay.util.decode_float\\n#endif\\n\\n#ifdef PHYSICALLY_CORRECT\\nuniform sampler2D normalDistribution;\\nuniform float sampleOffset: 0;\\nuniform vec2 normalDistributionSize;\\n\\nvec3 transformNormal(vec3 H, vec3 N) {\\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\\n vec3 tangentX = normalize(cross(N, upVector));\\n vec3 tangentZ = cross(N, tangentX);\\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\\n}\\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\\n return transformNormal(H, N);\\n}\\nfloat G_Smith(float g, float ndv, float ndl) {\\n float roughness = 1.0 - g;\\n float k = roughness * roughness / 2.0;\\n float G1V = ndv / (ndv * (1.0 - k) + k);\\n float G1L = ndl / (ndl * (1.0 - k) + k);\\n return G1L * G1V;\\n}\\nvec3 F_Schlick(float ndv, vec3 spec) {\\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\\n}\\n#endif\\n\\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\\n{\\n vec4 depthTexel = texture2D(depthTexture, uv);\\n return depthTexel.r * 2.0 - 1.0;\\n}\\n\\nfloat linearDepth(float depth)\\n{\\n if (projection[3][3] == 0.0) {\\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\\n }\\n else {\\n return (depth - projection[3][2]) / projection[2][2];\\n }\\n}\\n\\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\\n{\\n if (rayZFar > rayZNear)\\n {\\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\\n }\\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\\n}\\n\\n\\nbool traceScreenSpaceRay(\\n vec3 rayOrigin, vec3 rayDir, float jitter,\\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\\n)\\n{\\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\\n\\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\\n\\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\\n vec4 H1 = projection * vec4(rayEnd, 1.0);\\n\\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\\n\\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\\n\\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\\n\\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\\n vec2 delta = P1 - P0;\\n\\n bool permute = false;\\n if (abs(delta.x) < abs(delta.y)) {\\n permute = true;\\n delta = delta.yx;\\n P0 = P0.yx;\\n P1 = P1.yx;\\n }\\n float stepDir = sign(delta.x);\\n float invdx = stepDir / delta.x;\\n\\n vec3 dQ = (Q1 - Q0) * invdx;\\n float dk = (k1 - k0) * invdx;\\n\\n vec2 dP = vec2(stepDir, delta.y * invdx);\\n\\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\\n float pixStride = 1.0 + strideScaler * pixelStride;\\n\\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\\n\\n vec4 pqk = vec4(P0, Q0.z, k0);\\n vec4 dPQK = vec4(dP, dQ.z, dk);\\n\\n pqk += dPQK * jitter;\\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\\n float rayZNear;\\n\\n bool intersect = false;\\n\\n vec2 texelSize = 1.0 / viewportSize;\\n\\n iterationCount = 0.0;\\n\\n for (int i = 0; i < MAX_ITERATION; i++)\\n {\\n pqk += dPQK;\\n\\n rayZNear = rayZFar;\\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\\n\\n hitPixel = permute ? pqk.yx : pqk.xy;\\n hitPixel *= texelSize;\\n\\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\\n\\n iterationCount += 1.0;\\n\\n dPQK *= 1.2;\\n\\n if (intersect) {\\n break;\\n }\\n }\\n\\n Q0.xy += dQ.xy * iterationCount;\\n Q0.z = pqk.z;\\n hitPoint = Q0 / pqk.w;\\n\\n return intersect;\\n}\\n\\nfloat calculateAlpha(\\n float iterationCount, float reflectivity,\\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\\n)\\n{\\n float alpha = clamp(reflectivity, 0.0, 1.0);\\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\\n\\n float _eyeFadeStart = eyeFadeStart;\\n float _eyeFadeEnd = eyeFadeEnd;\\n if (_eyeFadeStart > _eyeFadeEnd) {\\n float tmp = _eyeFadeEnd;\\n _eyeFadeEnd = _eyeFadeStart;\\n _eyeFadeStart = tmp;\\n }\\n\\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\\n\\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\\n\\n return alpha;\\n}\\n\\n@import clay.util.rand\\n\\n@import clay.util.rgbm\\n\\nvoid main()\\n{\\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\\n\\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\\n discard;\\n }\\n\\n float g = normalAndGloss.a;\\n#if !defined(PHYSICALLY_CORRECT)\\n if (g <= minGlossiness) {\\n discard;\\n }\\n#endif\\n\\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\\n\\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\\n\\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\\n vec4 pos = projectionInv * projectedPos;\\n vec3 rayOrigin = pos.xyz / pos.w;\\n vec3 V = -normalize(rayOrigin);\\n\\n float ndv = clamp(dot(N, V), 0.0, 1.0);\\n float iterationCount;\\n float jitter = rand(fract(v_Texcoord + jitterOffset));\\n\\n#ifdef PHYSICALLY_CORRECT\\n vec4 color = vec4(vec3(0.0), 1.0);\\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\\n vec3 albedo = albedoMetalness.rgb;\\n float m = albedoMetalness.a;\\n vec3 diffuseColor = albedo * (1.0 - m);\\n vec3 spec = mix(vec3(0.04), albedo, m);\\n\\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\\n\\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\\n vec3 rayDir = normalize(reflect(-V, H));\\n#else\\n vec3 rayDir = normalize(reflect(-V, N));\\n#endif\\n vec2 hitPixel;\\n vec3 hitPoint;\\n\\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\\n\\n float dist = distance(rayOrigin, hitPoint);\\n\\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\\n#ifdef PHYSICALLY_CORRECT\\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\\n float vdh = clamp(dot(V, H), 0.0, 1.0);\\n float ndh = clamp(dot(N, H), 0.0, 1.0);\\n vec3 litTexel = vec3(0.0);\\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\\n\\n }\\n else {\\n #ifdef SPECULARCUBEMAP_ENABLED\\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\\n#endif\\n }\\n color.rgb += ndl * litTexel * (\\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\\n );\\n }\\n color.rgb /= float(SAMPLE_PER_FRAME);\\n#else\\n #if !defined(SPECULARCUBEMAP_ENABLED)\\n if (dot(hitNormal, rayDir) >= 0.0) {\\n discard;\\n }\\n if (!intersect) {\\n discard;\\n }\\n#endif\\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\\n vec4 color = texture2D(sourceTexture, hitPixel);\\n color.rgb *= alpha;\\n\\n#ifdef SPECULARCUBEMAP_ENABLED\\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\\n alpha = alpha * (intersect ? 1.0 : 0.0);\\n float bias = (1.0 -g) * 5.0;\\n color.rgb += (1.0 - alpha)\\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\\n * specularIntensity;\\n#endif\\n\\n#endif\\n\\n gl_FragColor = encodeHDR(color);\\n}\\n@end\\n\\n@export ecgl.ssr.blur\\n\\nuniform sampler2D texture;\\nuniform sampler2D gBufferTexture1;\\nuniform sampler2D gBufferTexture2;\\nuniform mat4 projection;\\nuniform float depthRange : 0.05;\\n\\nvarying vec2 v_Texcoord;\\n\\nuniform vec2 textureSize;\\nuniform float blurSize : 1.0;\\n\\n#ifdef BLEND\\n #ifdef SSAOTEX_ENABLED\\nuniform sampler2D ssaoTex;\\n #endif\\nuniform sampler2D sourceTexture;\\n#endif\\n\\nfloat getLinearDepth(vec2 coord)\\n{\\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\\n}\\n\\n@import clay.util.rgbm\\n\\n\\nvoid main()\\n{\\n @import clay.compositor.kernel.gaussian_9\\n\\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\\n float g = centerNTexel.a;\\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\\n#ifdef VERTICAL\\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\\n#else\\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\\n#endif\\n\\n vec2 coord = v_Texcoord;\\n\\n vec4 sum = vec4(0.0);\\n float weightAll = 0.0;\\n\\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\\n float cD = getLinearDepth(v_Texcoord);\\n for (int i = 0; i < 9; i++) {\\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\\n float w = gaussianKernel[i]\\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\\n float d = getLinearDepth(coord);\\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\\n\\n weightAll += w;\\n sum += decodeHDR(texture2D(texture, coord)) * w;\\n }\\n\\n#ifdef BLEND\\n float aoFactor = 1.0;\\n #ifdef SSAOTEX_ENABLED\\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\\n #endif\\n gl_FragColor = encodeHDR(\\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\\n );\\n#else\\n gl_FragColor = encodeHDR(sum / weightAll);\\n#endif\\n}\\n\\n@end\";\n","import Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Pass from 'claygl/src/compositor/Pass';\nimport Shader from 'claygl/src/Shader';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport halton from './halton';\nimport cubemapUtil from 'claygl/src/util/cubemap';\n\nimport SSRGLSLCode from './SSR.glsl.js';\n\nShader.import(SSRGLSLCode);\n\nfunction SSRPass(opt) {\n opt = opt || {};\n\n this._ssrPass = new Pass({\n fragment: Shader.source('ecgl.ssr.main'),\n clearColor: [0, 0, 0, 0]\n });\n this._blurPass1 = new Pass({\n fragment: Shader.source('ecgl.ssr.blur'),\n clearColor: [0, 0, 0, 0]\n });\n this._blurPass2 = new Pass({\n fragment: Shader.source('ecgl.ssr.blur'),\n clearColor: [0, 0, 0, 0]\n });\n this._blendPass = new Pass({\n fragment: Shader.source('clay.compositor.blend')\n });\n this._blendPass.material.disableTexturesAll();\n this._blendPass.material.enableTexture(['texture1', 'texture2']);\n\n this._ssrPass.setUniform('gBufferTexture1', opt.normalTexture);\n this._ssrPass.setUniform('gBufferTexture2', opt.depthTexture);\n // this._ssrPass.setUniform('gBufferTexture3', opt.albedoTexture);\n\n this._blurPass1.setUniform('gBufferTexture1', opt.normalTexture);\n this._blurPass1.setUniform('gBufferTexture2', opt.depthTexture);\n\n this._blurPass2.setUniform('gBufferTexture1', opt.normalTexture);\n this._blurPass2.setUniform('gBufferTexture2', opt.depthTexture);\n\n this._blurPass2.material.define('fragment', 'VERTICAL');\n this._blurPass2.material.define('fragment', 'BLEND');\n\n this._ssrTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._texture2 = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._texture3 = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._prevTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._currentTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n\n this._frameBuffer = new FrameBuffer({\n depthBuffer: false\n });\n\n this._normalDistribution = null;\n\n this._totalSamples = 256;\n this._samplePerFrame = 4;\n\n this._ssrPass.material.define('fragment', 'SAMPLE_PER_FRAME', this._samplePerFrame);\n this._ssrPass.material.define('fragment', 'TOTAL_SAMPLES', this._totalSamples);\n\n this._downScale = 1;\n}\n\nSSRPass.prototype.setAmbientCubemap = function (specularCubemap, specularIntensity) {\n this._ssrPass.material.set('specularCubemap', specularCubemap);\n this._ssrPass.material.set('specularIntensity', specularIntensity);\n\n var enableSpecularMap = specularCubemap && specularIntensity;\n this._ssrPass.material[enableSpecularMap ? 'enableTexture' : 'disableTexture']('specularCubemap');\n};\n\nSSRPass.prototype.update = function (renderer, camera, sourceTexture, frame) {\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n var ssrTexture = this._ssrTexture;\n var texture2 = this._texture2;\n var texture3 = this._texture3;\n ssrTexture.width = this._prevTexture.width = this._currentTexture.width = width / this._downScale;\n ssrTexture.height = this._prevTexture.height = this._currentTexture.height = height / this._downScale;\n\n texture2.width = texture3.width = width;\n texture2.height = texture3.height = height;\n\n var frameBuffer = this._frameBuffer;\n\n var ssrPass = this._ssrPass;\n var blurPass1 = this._blurPass1;\n var blurPass2 = this._blurPass2;\n var blendPass = this._blendPass;\n\n var toViewSpace = new Matrix4();\n var toWorldSpace = new Matrix4();\n Matrix4.transpose(toViewSpace, camera.worldTransform);\n Matrix4.transpose(toWorldSpace, camera.viewMatrix);\n\n ssrPass.setUniform('sourceTexture', sourceTexture);\n ssrPass.setUniform('projection', camera.projectionMatrix.array);\n ssrPass.setUniform('projectionInv', camera.invProjectionMatrix.array);\n ssrPass.setUniform('toViewSpace', toViewSpace.array);\n ssrPass.setUniform('toWorldSpace', toWorldSpace.array);\n ssrPass.setUniform('nearZ', camera.near);\n\n var percent = frame / this._totalSamples * this._samplePerFrame;\n ssrPass.setUniform('jitterOffset', percent);\n ssrPass.setUniform('sampleOffset', frame * this._samplePerFrame);\n\n blurPass1.setUniform('textureSize', [ssrTexture.width, ssrTexture.height]);\n blurPass2.setUniform('textureSize', [width, height]);\n blurPass2.setUniform('sourceTexture', sourceTexture);\n\n blurPass1.setUniform('projection', camera.projectionMatrix.array);\n blurPass2.setUniform('projection', camera.projectionMatrix.array);\n\n frameBuffer.attach(ssrTexture);\n frameBuffer.bind(renderer);\n ssrPass.render(renderer);\n\n if (this._physicallyCorrect) {\n frameBuffer.attach(this._currentTexture);\n blendPass.setUniform('texture1', this._prevTexture);\n blendPass.setUniform('texture2', ssrTexture);\n blendPass.material.set({\n 'weight1': frame >= 1 ? 0.95 : 0,\n 'weight2': frame >= 1 ? 0.05 : 1\n // weight1: frame >= 1 ? 1 : 0,\n // weight2: 1\n });\n blendPass.render(renderer);\n }\n\n frameBuffer.attach(texture2);\n blurPass1.setUniform('texture', this._physicallyCorrect ? this._currentTexture : ssrTexture);\n blurPass1.render(renderer);\n\n frameBuffer.attach(texture3);\n blurPass2.setUniform('texture', texture2);\n blurPass2.render(renderer);\n frameBuffer.unbind(renderer);\n\n if (this._physicallyCorrect) {\n var tmp = this._prevTexture;\n this._prevTexture = this._currentTexture;\n this._currentTexture = tmp;\n }\n};\n\nSSRPass.prototype.getTargetTexture = function () {\n return this._texture3;\n};\n\nSSRPass.prototype.setParameter = function (name, val) {\n if (name === 'maxIteration') {\n this._ssrPass.material.define('fragment', 'MAX_ITERATION', val);\n }\n else {\n this._ssrPass.setUniform(name, val);\n }\n};\n\nSSRPass.prototype.setPhysicallyCorrect = function (isPhysicallyCorrect) {\n if (isPhysicallyCorrect) {\n if (!this._normalDistribution) {\n this._normalDistribution = cubemapUtil.generateNormalDistribution(64, this._totalSamples);\n }\n this._ssrPass.material.define('fragment', 'PHYSICALLY_CORRECT');\n this._ssrPass.material.set('normalDistribution', this._normalDistribution);\n this._ssrPass.material.set('normalDistributionSize', [64, this._totalSamples]);\n }\n else {\n this._ssrPass.material.undefine('fragment', 'PHYSICALLY_CORRECT');\n }\n\n this._physicallyCorrect = isPhysicallyCorrect;\n};\n\nSSRPass.prototype.setSSAOTexture = function (texture) {\n var blendPass = this._blurPass2;\n if (texture) {\n blendPass.material.enableTexture('ssaoTex');\n blendPass.material.set('ssaoTex', texture);\n }\n else {\n blendPass.material.disableTexture('ssaoTex');\n }\n};\n\nSSRPass.prototype.isFinished = function (frame) {\n if (this._physicallyCorrect) {\n return frame > (this._totalSamples / this._samplePerFrame);\n }\n else {\n return true;\n }\n};\n\nSSRPass.prototype.dispose = function (renderer) {\n this._ssrTexture.dispose(renderer);\n this._texture2.dispose(renderer);\n this._texture3.dispose(renderer);\n this._prevTexture.dispose(renderer);\n this._currentTexture.dispose(renderer);\n this._frameBuffer.dispose(renderer);\n};\n\nexport default SSRPass;","// Based on https://bl.ocks.org/mbostock/19168c663618b707158\n\nexport default [\n0.0, 0.0,\n-0.321585265978, -0.154972575841,\n0.458126042375, 0.188473391593,\n0.842080129861, 0.527766490688,\n0.147304551086, -0.659453822776,\n-0.331943915203, -0.940619700594,\n0.0479226680259, 0.54812163202,\n0.701581552186, -0.709825561388,\n-0.295436780218, 0.940589268233,\n-0.901489676764, 0.237713156085,\n0.973570876096, -0.109899459384,\n-0.866792314779, -0.451805525005,\n0.330975007087, 0.800048655954,\n-0.344275183665, 0.381779221166,\n-0.386139432542, -0.437418421534,\n-0.576478634965, -0.0148463392551,\n0.385798197415, -0.262426961053,\n-0.666302061145, 0.682427250835,\n-0.628010632582, -0.732836215494,\n0.10163141741, -0.987658134403,\n0.711995289051, -0.320024291314,\n0.0296005138058, 0.950296523438,\n0.0130612307608, -0.351024443122,\n-0.879596633704, -0.10478487883,\n0.435712737232, 0.504254490347,\n0.779203817497, 0.206477676721,\n0.388264289969, -0.896736162545,\n-0.153106280781, -0.629203242522,\n-0.245517550697, 0.657969239148,\n0.126830499058, 0.26862328493,\n-0.634888119007, -0.302301223431,\n0.617074219636, 0.779817204925\n];","export default \"@export ecgl.normal.vertex\\n\\n@import ecgl.common.transformUniforms\\n\\n@import ecgl.common.uv.header\\n\\n@import ecgl.common.attributes\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\n@import ecgl.common.normalMap.vertexHeader\\n\\n@import ecgl.common.vertexAnimation.header\\n\\nvoid main()\\n{\\n\\n @import ecgl.common.vertexAnimation.main\\n\\n @import ecgl.common.uv.main\\n\\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\\n\\n @import ecgl.common.normalMap.vertexMain\\n\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n\\n}\\n\\n\\n@end\\n\\n\\n@export ecgl.normal.fragment\\n\\n#define ROUGHNESS_CHANEL 0\\n\\nuniform bool useBumpMap;\\nuniform bool useRoughnessMap;\\nuniform bool doubleSide;\\nuniform float roughness;\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform mat4 viewInverse : VIEWINVERSE;\\n\\n@import ecgl.common.normalMap.fragmentHeader\\n@import ecgl.common.bumpMap.header\\n\\nuniform sampler2D roughnessMap;\\n\\nvoid main()\\n{\\n vec3 N = v_Normal;\\n \\n bool flipNormal = false;\\n if (doubleSide) {\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(eyePos - v_WorldPosition);\\n\\n if (dot(N, V) < 0.0) {\\n flipNormal = true;\\n }\\n }\\n\\n @import ecgl.common.normalMap.fragmentMain\\n\\n if (useBumpMap) {\\n N = bumpNormal(v_WorldPosition, v_Normal, N);\\n }\\n\\n float g = 1.0 - roughness;\\n\\n if (useRoughnessMap) {\\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\\n }\\n\\n if (flipNormal) {\\n N = -N;\\n }\\n\\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\\n gl_FragColor.a = g;\\n}\\n@end\";\n","// NormalPass will generate normal and depth data.\n\n// TODO Animation\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Shader from 'claygl/src/Shader';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport Material from 'claygl/src/Material';\nimport Pass from 'claygl/src/compositor/Pass';\nimport textureUtil from 'claygl/src/util/texture';\n\nimport normalGLSL from '../util/shader/normal.glsl.js';\nShader.import(normalGLSL);\n\nfunction attachTextureToSlot(renderer, program, symbol, texture, slot) {\n var gl = renderer.gl;\n program.setUniform(gl, '1i', symbol, slot);\n\n gl.activeTexture(gl.TEXTURE0 + slot);\n // Maybe texture is not loaded yet;\n if (texture.isRenderable()) {\n texture.bind(renderer);\n }\n else {\n // Bind texture to null\n texture.unbind(renderer);\n }\n}\n\n// TODO Use globalShader insteadof globalMaterial?\nfunction getBeforeRenderHook (renderer, defaultNormalMap, defaultBumpMap, defaultRoughnessMap, normalMaterial) {\n\n var previousNormalMap;\n var previousBumpMap;\n var previousRoughnessMap;\n var previousRenderable;\n var gl = renderer.gl;\n\n return function (renderable, normalMaterial, prevNormalMaterial) {\n // Material not change\n if (previousRenderable && previousRenderable.material === renderable.material) {\n return;\n }\n\n var material = renderable.material;\n var program = renderable.__program;\n\n var roughness = material.get('roughness');\n if (roughness == null) {\n roughness = 1;\n }\n\n var normalMap = material.get('normalMap') || defaultNormalMap;\n var roughnessMap = material.get('roughnessMap');\n var bumpMap = material.get('bumpMap');\n var uvRepeat = material.get('uvRepeat');\n var uvOffset = material.get('uvOffset');\n var detailUvRepeat = material.get('detailUvRepeat');\n var detailUvOffset = material.get('detailUvOffset');\n\n var useBumpMap = !!bumpMap && material.isTextureEnabled('bumpMap');\n var useRoughnessMap = !!roughnessMap && material.isTextureEnabled('roughnessMap');\n var doubleSide = material.isDefined('fragment', 'DOUBLE_SIDED');\n\n bumpMap = bumpMap || defaultBumpMap;\n roughnessMap = roughnessMap || defaultRoughnessMap;\n\n if (prevNormalMaterial !== normalMaterial) {\n normalMaterial.set('normalMap', normalMap);\n normalMaterial.set('bumpMap', bumpMap);\n normalMaterial.set('roughnessMap', roughnessMap);\n normalMaterial.set('useBumpMap', useBumpMap);\n normalMaterial.set('useRoughnessMap', useRoughnessMap);\n normalMaterial.set('doubleSide', doubleSide);\n uvRepeat != null && normalMaterial.set('uvRepeat', uvRepeat);\n uvOffset != null && normalMaterial.set('uvOffset', uvOffset);\n detailUvRepeat != null && normalMaterial.set('detailUvRepeat', detailUvRepeat);\n detailUvOffset != null && normalMaterial.set('detailUvOffset', detailUvOffset);\n\n normalMaterial.set('roughness', roughness);\n }\n else {\n program.setUniform(gl, '1f', 'roughness', roughness);\n\n if (previousNormalMap !== normalMap) {\n attachTextureToSlot(renderer, program, 'normalMap', normalMap, 0);\n }\n if (previousBumpMap !== bumpMap && bumpMap) {\n attachTextureToSlot(renderer, program, 'bumpMap', bumpMap, 1);\n }\n if (previousRoughnessMap !== roughnessMap && roughnessMap) {\n attachTextureToSlot(renderer, program, 'roughnessMap', roughnessMap, 2);\n }\n if (uvRepeat != null) {\n program.setUniform(gl, '2f', 'uvRepeat', uvRepeat);\n }\n if (uvOffset != null) {\n program.setUniform(gl, '2f', 'uvOffset', uvOffset);\n }\n if (detailUvRepeat != null) {\n program.setUniform(gl, '2f', 'detailUvRepeat', detailUvRepeat);\n }\n if (detailUvOffset != null) {\n program.setUniform(gl, '2f', 'detailUvOffset', detailUvOffset);\n }\n program.setUniform(gl, '1i', 'useBumpMap', +useBumpMap);\n program.setUniform(gl, '1i', 'useRoughnessMap', +useRoughnessMap);\n program.setUniform(gl, '1i', 'doubleSide', +doubleSide);\n }\n\n previousNormalMap = normalMap;\n previousBumpMap = bumpMap;\n previousRoughnessMap = roughnessMap;\n\n previousRenderable = renderable;\n };\n}\n\nfunction NormalPass(opt) {\n opt = opt || {};\n\n this._depthTex = new Texture2D({\n format: Texture.DEPTH_COMPONENT,\n type: Texture.UNSIGNED_INT\n });\n this._normalTex = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n\n this._framebuffer = new FrameBuffer();\n this._framebuffer.attach(this._normalTex);\n this._framebuffer.attach(this._depthTex, FrameBuffer.DEPTH_ATTACHMENT);\n\n this._normalMaterial = new Material({\n shader: new Shader(\n Shader.source('ecgl.normal.vertex'),\n Shader.source('ecgl.normal.fragment')\n )\n });\n this._normalMaterial.enableTexture(['normalMap', 'bumpMap', 'roughnessMap']);\n\n this._defaultNormalMap = textureUtil.createBlank('#000');\n this._defaultBumpMap = textureUtil.createBlank('#000');\n this._defaultRoughessMap = textureUtil.createBlank('#000');\n\n\n this._debugPass = new Pass({\n fragment: Shader.source('clay.compositor.output')\n });\n this._debugPass.setUniform('texture', this._normalTex);\n this._debugPass.material.undefine('fragment', 'OUTPUT_ALPHA');\n}\n\nNormalPass.prototype.getDepthTexture = function () {\n return this._depthTex;\n};\n\nNormalPass.prototype.getNormalTexture = function () {\n return this._normalTex;\n};\n\nNormalPass.prototype.update = function (renderer, scene, camera) {\n\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n\n var depthTexture = this._depthTex;\n var normalTexture = this._normalTex;\n var normalMaterial = this._normalMaterial;\n\n depthTexture.width = width;\n depthTexture.height = height;\n normalTexture.width = width;\n normalTexture.height = height;\n\n var opaqueList = scene.getRenderList(camera).opaque;\n\n this._framebuffer.bind(renderer);\n renderer.gl.clearColor(0, 0, 0, 0);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT | renderer.gl.DEPTH_BUFFER_BIT);\n renderer.gl.disable(renderer.gl.BLEND);\n\n renderer.renderPass(opaqueList, camera, {\n getMaterial: function () {\n return normalMaterial;\n },\n ifRender: function (object) {\n return object.renderNormal;\n },\n beforeRender: getBeforeRenderHook(\n renderer, this._defaultNormalMap, this._defaultBumpMap, this._defaultRoughessMap, this._normalMaterial\n ),\n sort: renderer.opaqueSortCompare\n });\n this._framebuffer.unbind(renderer);\n};\n\nNormalPass.prototype.renderDebug = function (renderer) {\n this._debugPass.render(renderer);\n};\n\nNormalPass.prototype.dispose = function (renderer) {\n this._depthTex.dispose(renderer);\n this._normalTex.dispose(renderer);\n}\n\nexport default NormalPass;","import Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Pass from 'claygl/src/compositor/Pass';\nimport Shader from 'claygl/src/Shader';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\n\nfunction EdgePass(opt) {\n opt = opt || {};\n\n this._edgePass = new Pass({\n fragment: Shader.source('ecgl.edge')\n });\n\n this._edgePass.setUniform('normalTexture', opt.normalTexture);\n this._edgePass.setUniform('depthTexture', opt.depthTexture);\n\n this._targetTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n\n this._frameBuffer = new FrameBuffer();\n this._frameBuffer.attach(this._targetTexture);\n}\n\nEdgePass.prototype.update = function (renderer, camera, sourceTexture, frame) {\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n var texture = this._targetTexture;\n texture.width = width;\n texture.height = height;\n var frameBuffer = this._frameBuffer;\n\n frameBuffer.bind(renderer);\n this._edgePass.setUniform('projectionInv', camera.invProjectionMatrix.array);\n this._edgePass.setUniform('textureSize', [width, height]);\n this._edgePass.setUniform('texture', sourceTexture);\n this._edgePass.render(renderer);\n\n frameBuffer.unbind(renderer);\n};\n\nEdgePass.prototype.getTargetTexture = function () {\n return this._targetTexture;\n};\n\nEdgePass.prototype.setParameter = function (name, val) {\n this._edgePass.setUniform(name, val);\n};\n\nEdgePass.prototype.dispose = function (renderer) {\n this._targetTexture.dispose(renderer);\n this._frameBuffer.dispose(renderer);\n};\n\nexport default EdgePass;","export default {\n 'type' : 'compositor',\n 'nodes' : [\n {\n 'name': 'source',\n 'type': 'texture',\n 'outputs': {\n 'color': {}\n }\n },\n {\n 'name': 'source_half',\n 'shader': '#source(clay.compositor.downsample)',\n 'inputs': {\n 'texture': 'source'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0 / 2)',\n 'height': 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n }\n },\n\n\n {\n 'name' : 'bright',\n 'shader' : '#source(clay.compositor.bright)',\n 'inputs' : {\n 'texture' : 'source_half'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 2)',\n 'height' : 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'threshold' : 2,\n 'scale': 4,\n 'textureSize': 'expr([width * 1.0 / 2, height / 2])'\n }\n },\n\n {\n 'name': 'bright_downsample_4',\n 'shader' : '#source(clay.compositor.downsample)',\n 'inputs' : {\n 'texture' : 'bright'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 4)',\n 'height' : 'expr(height * 1.0 / 4)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0 / 2, height / 2] )'\n }\n },\n {\n 'name': 'bright_downsample_8',\n 'shader' : '#source(clay.compositor.downsample)',\n 'inputs' : {\n 'texture' : 'bright_downsample_4'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 8)',\n 'height' : 'expr(height * 1.0 / 8)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0 / 4, height / 4] )'\n }\n },\n {\n 'name': 'bright_downsample_16',\n 'shader' : '#source(clay.compositor.downsample)',\n 'inputs' : {\n 'texture' : 'bright_downsample_8'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 16)',\n 'height' : 'expr(height * 1.0 / 16)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0 / 8, height / 8] )'\n }\n },\n {\n 'name': 'bright_downsample_32',\n 'shader' : '#source(clay.compositor.downsample)',\n 'inputs' : {\n 'texture' : 'bright_downsample_16'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 32)',\n 'height' : 'expr(height * 1.0 / 32)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0 / 16, height / 16] )'\n }\n },\n\n\n {\n 'name' : 'bright_upsample_16_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_downsample_32'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 16)',\n 'height' : 'expr(height * 1.0 / 16)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 32, height / 32] )'\n }\n },\n {\n 'name' : 'bright_upsample_16_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_16_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 16)',\n 'height' : 'expr(height * 1.0 / 16)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0 / 16, height * 1.0 / 16] )'\n }\n },\n\n\n\n {\n 'name' : 'bright_upsample_8_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_downsample_16'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 8)',\n 'height' : 'expr(height * 1.0 / 8)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 16, height * 1.0 / 16] )'\n }\n },\n {\n 'name' : 'bright_upsample_8_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_8_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 8)',\n 'height' : 'expr(height * 1.0 / 8)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0 / 8, height * 1.0 / 8] )'\n }\n },\n {\n 'name' : 'bright_upsample_8_blend',\n 'shader' : '#source(clay.compositor.blend)',\n 'inputs' : {\n 'texture1' : 'bright_upsample_8_blur_v',\n 'texture2' : 'bright_upsample_16_blur_v'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 8)',\n 'height' : 'expr(height * 1.0 / 8)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'weight1' : 0.3,\n 'weight2' : 0.7\n }\n },\n\n\n {\n 'name' : 'bright_upsample_4_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_downsample_8'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 4)',\n 'height' : 'expr(height * 1.0 / 4)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 8, height * 1.0 / 8] )'\n }\n },\n {\n 'name' : 'bright_upsample_4_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_4_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 4)',\n 'height' : 'expr(height * 1.0 / 4)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0 / 4, height * 1.0 / 4] )'\n }\n },\n {\n 'name' : 'bright_upsample_4_blend',\n 'shader' : '#source(clay.compositor.blend)',\n 'inputs' : {\n 'texture1' : 'bright_upsample_4_blur_v',\n 'texture2' : 'bright_upsample_8_blend'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 4)',\n 'height' : 'expr(height * 1.0 / 4)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'weight1' : 0.3,\n 'weight2' : 0.7\n }\n },\n\n\n\n\n\n {\n 'name' : 'bright_upsample_2_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_downsample_4'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 2)',\n 'height' : 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 4, height * 1.0 / 4] )'\n }\n },\n {\n 'name' : 'bright_upsample_2_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_2_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 2)',\n 'height' : 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0 / 2, height * 1.0 / 2] )'\n }\n },\n {\n 'name' : 'bright_upsample_2_blend',\n 'shader' : '#source(clay.compositor.blend)',\n 'inputs' : {\n 'texture1' : 'bright_upsample_2_blur_v',\n 'texture2' : 'bright_upsample_4_blend'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 2)',\n 'height' : 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'weight1' : 0.3,\n 'weight2' : 0.7\n }\n },\n\n\n\n {\n 'name' : 'bright_upsample_full_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0)',\n 'height' : 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 2, height * 1.0 / 2] )'\n }\n },\n {\n 'name' : 'bright_upsample_full_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_full_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0)',\n 'height' : 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n }\n },\n {\n 'name' : 'bloom_composite',\n 'shader' : '#source(clay.compositor.blend)',\n 'inputs' : {\n 'texture1' : 'bright_upsample_full_blur_v',\n 'texture2' : 'bright_upsample_2_blend'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0)',\n 'height' : 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'weight1' : 0.3,\n 'weight2' : 0.7\n }\n },\n\n\n {\n 'name': 'coc',\n 'shader': '#source(ecgl.dof.coc)',\n 'outputs': {\n 'color': {\n 'parameters': {\n 'minFilter': 'NEAREST',\n 'magFilter': 'NEAREST',\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)'\n }\n }\n },\n 'parameters': {\n 'focalDist': 50,\n 'focalRange': 30\n }\n },\n\n {\n 'name': 'dof_far_blur',\n 'shader': '#source(ecgl.dof.diskBlur)',\n 'inputs': {\n 'texture': 'source',\n 'coc': 'coc'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters': {\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n }\n },\n {\n 'name': 'dof_near_blur',\n 'shader': '#source(ecgl.dof.diskBlur)',\n 'inputs': {\n 'texture': 'source',\n 'coc': 'coc'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters': {\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n },\n 'defines': {\n 'BLUR_NEARFIELD': null\n }\n },\n\n\n {\n 'name': 'dof_coc_blur',\n 'shader': '#source(ecgl.dof.diskBlur)',\n 'inputs': {\n 'texture': 'coc'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'minFilter': 'NEAREST',\n 'magFilter': 'NEAREST',\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)'\n }\n }\n },\n 'parameters': {\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n },\n 'defines': {\n 'BLUR_COC': null\n }\n },\n\n {\n 'name': 'dof_composite',\n 'shader': '#source(ecgl.dof.composite)',\n 'inputs': {\n 'original': 'source',\n 'blurred': 'dof_far_blur',\n 'nearfield': 'dof_near_blur',\n 'coc': 'coc',\n 'nearcoc': 'dof_coc_blur'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n }\n },\n {\n 'name' : 'composite',\n 'shader' : '#source(clay.compositor.hdr.composite)',\n 'inputs' : {\n 'texture': 'source',\n 'bloom' : 'bloom_composite'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)'\n }\n }\n },\n 'defines': {\n // Images are all premultiplied alpha before composite because of blending.\n // 'PREMULTIPLY_ALPHA': null,\n // 'DEBUG': 2\n }\n },\n {\n 'name' : 'FXAA',\n 'shader' : '#source(clay.compositor.fxaa)',\n 'inputs' : {\n 'texture' : 'composite'\n }\n }\n ]\n};","export default \"@export ecgl.dof.coc\\n\\nuniform sampler2D depth;\\n\\nuniform float zNear: 0.1;\\nuniform float zFar: 2000;\\n\\nuniform float focalDistance: 3;\\nuniform float focalRange: 1;\\nuniform float focalLength: 30;\\nuniform float fstop: 2.8;\\n\\nvarying vec2 v_Texcoord;\\n\\n@import clay.util.encode_float\\n\\nvoid main()\\n{\\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\\n\\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\\n\\n float aperture = focalLength / fstop;\\n\\n float coc;\\n\\n float uppper = focalDistance + focalRange;\\n float lower = focalDistance - focalRange;\\n if (dist <= uppper && dist >= lower) {\\n coc = 0.5;\\n }\\n else {\\n float focalAdjusted = dist > uppper ? uppper : lower;\\n\\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\\n\\n if (dist < lower) {\\n coc = -coc;\\n }\\n coc = coc * 0.5 + 0.5;\\n }\\n\\n gl_FragColor = encodeFloat(coc);\\n}\\n@end\\n\\n\\n@export ecgl.dof.composite\\n\\n#define DEBUG 0\\n\\nuniform sampler2D original;\\nuniform sampler2D blurred;\\nuniform sampler2D nearfield;\\nuniform sampler2D coc;\\nuniform sampler2D nearcoc;\\nvarying vec2 v_Texcoord;\\n\\n@import clay.util.rgbm\\n@import clay.util.float\\n\\nvoid main()\\n{\\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\\n vec4 originalColor = texture2D(original, v_Texcoord);\\n\\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\\n\\n fCoc = abs(fCoc * 2.0 - 1.0);\\n\\n float weight = smoothstep(0.0, 1.0, fCoc);\\n \\n#ifdef NEARFIELD_ENABLED\\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\\n\\n gl_FragColor = encodeHDR(\\n mix(\\n nearfieldColor, mix(originalColor, blurredColor, weight),\\n pow(1.0 - fNearCoc, 4.0)\\n )\\n );\\n#else\\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\\n#endif\\n\\n}\\n\\n@end\\n\\n\\n\\n@export ecgl.dof.diskBlur\\n\\n#define POISSON_KERNEL_SIZE 16;\\n\\nuniform sampler2D texture;\\nuniform sampler2D coc;\\nvarying vec2 v_Texcoord;\\n\\nuniform float blurRadius : 10.0;\\nuniform vec2 textureSize : [512.0, 512.0];\\n\\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\\n\\nuniform float percent;\\n\\nfloat nrand(const in vec2 n) {\\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\\n}\\n\\n@import clay.util.rgbm\\n@import clay.util.float\\n\\n\\nvoid main()\\n{\\n vec2 offset = blurRadius / textureSize;\\n\\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\\n float cosa = cos(rnd);\\n float sina = sin(rnd);\\n vec4 basis = vec4(cosa, -sina, sina, cosa);\\n\\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\\n#endif\\n\\n#ifdef BLUR_COC\\n float cocSum = 0.0;\\n#else\\n vec4 color = vec4(0.0);\\n#endif\\n\\n\\n float weightSum = 0.0;\\n\\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\\n vec2 ofs = poissonKernel[i];\\n\\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\\n\\n vec2 uv = v_Texcoord + ofs * offset;\\n vec4 texel = texture2D(texture, uv);\\n\\n float w = 1.0;\\n#ifdef BLUR_COC\\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\\n#else\\n texel = texel;\\n #if !defined(BLUR_NEARFIELD)\\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\\n w *= abs(fCoc);\\n #endif\\n texel.rgb *= texel.a;\\n color += texel * w;\\n#endif\\n\\n weightSum += w;\\n }\\n\\n#ifdef BLUR_COC\\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\\n#else\\n color /= weightSum;\\n color.rgb /= (color.a + 0.0001);\\n gl_FragColor = color;\\n#endif\\n}\\n\\n@end\";\n","export default \"@export ecgl.edge\\n\\nuniform sampler2D texture;\\n\\nuniform sampler2D normalTexture;\\nuniform sampler2D depthTexture;\\n\\nuniform mat4 projectionInv;\\n\\nuniform vec2 textureSize;\\n\\nuniform vec4 edgeColor: [0,0,0,0.8];\\n\\nvarying vec2 v_Texcoord;\\n\\nvec3 packColor(vec2 coord) {\\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\\n vec4 p4 = projectionInv * p;\\n\\n return vec3(\\n texture2D(normalTexture, coord).rg,\\n -p4.z / p4.w / 5.0\\n );\\n}\\n\\nvoid main() {\\n vec2 cc = v_Texcoord;\\n vec3 center = packColor(cc);\\n\\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\\n float dx = size / textureSize.x;\\n float dy = size / textureSize.y;\\n\\n vec2 coord;\\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\\n vec3 top = packColor(cc+vec2(0.0, -dy));\\n vec3 topRight = packColor(cc+vec2(dx, -dy));\\n vec3 left = packColor(cc+vec2(-dx, 0.0));\\n vec3 right = packColor(cc+vec2(dx, 0.0));\\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\\n vec3 bottom = packColor(cc+vec2(0.0, dy));\\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\\n\\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\\n\\n float edge = sqrt(dot(h, h) + dot(v, v));\\n\\n edge = smoothstep(0.8, 1.0, edge);\\n\\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\\n}\\n@end\";\n","import Shader from 'claygl/src/Shader';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport createCompositor from 'claygl/src/compositor/createCompositor';\nimport SSAOPass from './SSAOPass';\nimport SSRPass from './SSRPass';\nimport poissonKernel from './poissonKernel';\nimport graphicGL from '../util/graphicGL';\nimport NormalPass from './NormalPass';\nimport EdgePass from './EdgePass';\n\nimport effectJson from './composite.js';\n\nimport blurCode from 'claygl/src/shader/source/compositor/blur.glsl.js';\nimport lutCode from 'claygl/src/shader/source/compositor/lut.glsl.js';\nimport outputCode from 'claygl/src/shader/source/compositor/output.glsl.js';\nimport brightCode from 'claygl/src/shader/source/compositor/bright.glsl.js';\nimport downsampleCode from 'claygl/src/shader/source/compositor/downsample.glsl.js';\nimport upsampleCode from 'claygl/src/shader/source/compositor/upsample.glsl.js';\nimport hdrCode from 'claygl/src/shader/source/compositor/hdr.glsl.js';\nimport blendCode from 'claygl/src/shader/source/compositor/blend.glsl.js';\nimport fxaaCode from 'claygl/src/shader/source/compositor/fxaa.glsl.js';\nimport DOFCode from './DOF.glsl.js';\nimport edgeCode from './edge.glsl.js';\n\nShader['import'](blurCode);\nShader['import'](lutCode);\nShader['import'](outputCode);\nShader['import'](brightCode);\nShader['import'](downsampleCode);\nShader['import'](upsampleCode);\nShader['import'](hdrCode);\nShader['import'](blendCode);\nShader['import'](fxaaCode);\nShader['import'](DOFCode);\nShader['import'](edgeCode);\n\n\nfunction makeCommonOutputs(getWidth, getHeight) {\n return {\n color: {\n parameters: {\n width: getWidth,\n height: getHeight\n }\n }\n };\n}\n\nvar FINAL_NODES_CHAIN = ['composite', 'FXAA'];\n\nfunction EffectCompositor() {\n this._width;\n this._height;\n this._dpr;\n\n\n this._sourceTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._depthTexture = new Texture2D({\n format: Texture.DEPTH_COMPONENT,\n type: Texture.UNSIGNED_INT\n });\n\n this._framebuffer = new FrameBuffer();\n this._framebuffer.attach(this._sourceTexture);\n this._framebuffer.attach(this._depthTexture, FrameBuffer.DEPTH_ATTACHMENT);\n\n this._normalPass = new NormalPass();\n\n this._compositor = createCompositor(effectJson);\n\n var sourceNode = this._compositor.getNodeByName('source');\n sourceNode.texture = this._sourceTexture;\n var cocNode = this._compositor.getNodeByName('coc');\n\n this._sourceNode = sourceNode;\n this._cocNode = cocNode;\n this._compositeNode = this._compositor.getNodeByName('composite');\n this._fxaaNode = this._compositor.getNodeByName('FXAA');\n\n this._dofBlurNodes = ['dof_far_blur', 'dof_near_blur', 'dof_coc_blur'].map(function (name) {\n return this._compositor.getNodeByName(name);\n }, this);\n\n this._dofBlurKernel = 0;\n this._dofBlurKernelSize = new Float32Array(0);\n\n this._finalNodesChain = FINAL_NODES_CHAIN.map(function (name) {\n return this._compositor.getNodeByName(name);\n }, this);\n\n var gBufferObj = {\n normalTexture: this._normalPass.getNormalTexture(),\n depthTexture: this._normalPass.getDepthTexture()\n };\n this._ssaoPass = new SSAOPass(gBufferObj);\n this._ssrPass = new SSRPass(gBufferObj);\n this._edgePass = new EdgePass(gBufferObj);\n}\n\nEffectCompositor.prototype.resize = function (width, height, dpr) {\n dpr = dpr || 1;\n var width = width * dpr;\n var height = height * dpr;\n var sourceTexture = this._sourceTexture;\n var depthTexture = this._depthTexture;\n\n sourceTexture.width = width;\n sourceTexture.height = height;\n depthTexture.width = width;\n depthTexture.height = height;\n\n var rendererMock = {\n getWidth: function () {\n return width;\n },\n getHeight: function () {\n return height;\n },\n getDevicePixelRatio: function () {\n return dpr;\n }\n };\n function wrapCallback(obj, key) {\n if (typeof obj[key] === 'function') {\n var oldFunc = obj[key].__original || obj[key];\n // Use viewport width/height instead of renderer width/height\n obj[key] = function (renderer) {\n return oldFunc.call(this, rendererMock);\n };\n obj[key].__original = oldFunc;\n }\n }\n this._compositor.nodes.forEach(function (node) {\n for (var outKey in node.outputs) {\n var parameters = node.outputs[outKey].parameters;\n if (parameters) {\n wrapCallback(parameters, 'width');\n wrapCallback(parameters, 'height');\n }\n }\n for (var paramKey in node.parameters) {\n wrapCallback(node.parameters, paramKey);\n }\n });\n\n this._width = width;\n this._height = height;\n this._dpr = dpr;\n};\n\nEffectCompositor.prototype.getWidth = function () {\n return this._width;\n};\nEffectCompositor.prototype.getHeight = function () {\n return this._height;\n};\n\nEffectCompositor.prototype._ifRenderNormalPass = function () {\n return this._enableSSAO || this._enableEdge || this._enableSSR;\n};\n\nEffectCompositor.prototype._getPrevNode = function (node) {\n var idx = FINAL_NODES_CHAIN.indexOf(node.name) - 1;\n var prevNode = this._finalNodesChain[idx];\n while (prevNode && !this._compositor.getNodeByName(prevNode.name)) {\n idx -= 1;\n prevNode = this._finalNodesChain[idx];\n }\n return prevNode;\n};\nEffectCompositor.prototype._getNextNode = function (node) {\n var idx = FINAL_NODES_CHAIN.indexOf(node.name) + 1;\n var nextNode = this._finalNodesChain[idx];\n while (nextNode && !this._compositor.getNodeByName(nextNode.name)) {\n idx += 1;\n nextNode = this._finalNodesChain[idx];\n }\n return nextNode;\n};\nEffectCompositor.prototype._addChainNode = function (node) {\n var prevNode = this._getPrevNode(node);\n var nextNode = this._getNextNode(node);\n if (!prevNode) {\n return;\n }\n\n node.inputs.texture = prevNode.name;\n if (nextNode) {\n node.outputs = makeCommonOutputs(this.getWidth.bind(this), this.getHeight.bind(this));\n nextNode.inputs.texture = node.name;\n }\n else {\n node.outputs = null;\n }\n this._compositor.addNode(node);\n};\nEffectCompositor.prototype._removeChainNode = function (node) {\n var prevNode = this._getPrevNode(node);\n var nextNode = this._getNextNode(node);\n if (!prevNode) {\n return;\n }\n\n if (nextNode) {\n prevNode.outputs = makeCommonOutputs(this.getWidth.bind(this), this.getHeight.bind(this));\n nextNode.inputs.texture = prevNode.name;\n }\n else {\n prevNode.outputs = null;\n }\n this._compositor.removeNode(node);\n};\n/**\n * Update normal\n */\nEffectCompositor.prototype.updateNormal = function (renderer, scene, camera, frame) {\n if (this._ifRenderNormalPass()) {\n this._normalPass.update(renderer, scene, camera);\n }\n};\n\n/**\n * Render SSAO after render the scene, before compositing\n */\nEffectCompositor.prototype.updateSSAO = function (renderer, scene, camera, frame) {\n this._ssaoPass.update(renderer, camera, frame);\n};\n\n/**\n * Enable SSAO effect\n */\nEffectCompositor.prototype.enableSSAO = function () {\n this._enableSSAO = true;\n};\n\n/**\n * Disable SSAO effect\n */\nEffectCompositor.prototype.disableSSAO = function () {\n this._enableSSAO = false;\n};\n\n/**\n * Enable SSR effect\n */\nEffectCompositor.prototype.enableSSR = function () {\n this._enableSSR = true;\n // this._normalPass.enableTargetTexture3 = true;\n};\n/**\n * Disable SSR effect\n */\nEffectCompositor.prototype.disableSSR = function () {\n this._enableSSR = false;\n // this._normalPass.enableTargetTexture3 = false;\n};\n\n/**\n * Render SSAO after render the scene, before compositing\n */\nEffectCompositor.prototype.getSSAOTexture = function () {\n return this._ssaoPass.getTargetTexture();\n};\n\n/**\n * @return {clay.FrameBuffer}\n */\nEffectCompositor.prototype.getSourceFrameBuffer = function () {\n return this._framebuffer;\n};\n\n/**\n * @return {clay.Texture2D}\n */\nEffectCompositor.prototype.getSourceTexture = function () {\n return this._sourceTexture;\n};\n\n/**\n * Disable fxaa effect\n */\nEffectCompositor.prototype.disableFXAA = function () {\n this._removeChainNode(this._fxaaNode);\n};\n\n/**\n * Enable fxaa effect\n */\nEffectCompositor.prototype.enableFXAA = function () {\n this._addChainNode(this._fxaaNode);\n};\n\n/**\n * Enable bloom effect\n */\nEffectCompositor.prototype.enableBloom = function () {\n this._compositeNode.inputs.bloom = 'bloom_composite';\n this._compositor.dirty();\n};\n\n/**\n * Disable bloom effect\n */\nEffectCompositor.prototype.disableBloom = function () {\n this._compositeNode.inputs.bloom = null;\n this._compositor.dirty();\n};\n\n/**\n * Enable depth of field effect\n */\nEffectCompositor.prototype.enableDOF = function () {\n this._compositeNode.inputs.texture = 'dof_composite';\n this._compositor.dirty();\n};\n/**\n * Disable depth of field effect\n */\nEffectCompositor.prototype.disableDOF = function () {\n this._compositeNode.inputs.texture = 'source';\n this._compositor.dirty();\n};\n\n/**\n * Enable color correction\n */\nEffectCompositor.prototype.enableColorCorrection = function () {\n this._compositeNode.define('COLOR_CORRECTION');\n this._enableColorCorrection = true;\n};\n/**\n * Disable color correction\n */\nEffectCompositor.prototype.disableColorCorrection = function () {\n this._compositeNode.undefine('COLOR_CORRECTION');\n this._enableColorCorrection = false;\n};\n\n/**\n * Enable edge detection\n */\nEffectCompositor.prototype.enableEdge = function () {\n this._enableEdge = true;\n};\n\n/**\n * Disable edge detection\n */\nEffectCompositor.prototype.disableEdge = function () {\n this._enableEdge = false;\n};\n\n/**\n * Set bloom intensity\n * @param {number} value\n */\nEffectCompositor.prototype.setBloomIntensity = function (value) {\n this._compositeNode.setParameter('bloomIntensity', value);\n};\n\nEffectCompositor.prototype.setSSAOParameter = function (name, value) {\n switch (name) {\n case 'quality':\n // PENDING\n var kernelSize = ({\n low: 6,\n medium: 12,\n high: 32,\n ultra: 62\n })[value] || 12;\n this._ssaoPass.setParameter('kernelSize', kernelSize);\n break;\n case 'radius':\n this._ssaoPass.setParameter(name, value);\n this._ssaoPass.setParameter('bias', value / 200);\n break;\n case 'intensity':\n this._ssaoPass.setParameter(name, value);\n break;\n default:\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown SSAO parameter ' + name);\n }\n }\n};\n\nEffectCompositor.prototype.setDOFParameter = function (name, value) {\n switch (name) {\n case 'focalDistance':\n case 'focalRange':\n case 'fstop':\n this._cocNode.setParameter(name, value);\n break;\n case 'blurRadius':\n for (var i = 0; i < this._dofBlurNodes.length; i++) {\n this._dofBlurNodes[i].setParameter('blurRadius', value);\n }\n break;\n case 'quality':\n var kernelSize = ({\n low: 4, medium: 8, high: 16, ultra: 32\n })[value] || 8;\n this._dofBlurKernelSize = kernelSize;\n for (var i = 0; i < this._dofBlurNodes.length; i++) {\n this._dofBlurNodes[i].pass.material.define('POISSON_KERNEL_SIZE', kernelSize);\n }\n this._dofBlurKernel = new Float32Array(kernelSize * 2);\n break;\n default:\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown DOF parameter ' + name);\n }\n }\n};\n\nEffectCompositor.prototype.setSSRParameter = function (name, value) {\n if (value == null) {\n return;\n }\n switch (name) {\n case 'quality':\n // PENDING\n var maxIteration = ({\n low: 10,\n medium: 15,\n high: 30,\n ultra: 80\n })[value] || 20;\n var pixelStride = ({\n low: 32,\n medium: 16,\n high: 8,\n ultra: 4\n })[value] || 16;\n this._ssrPass.setParameter('maxIteration', maxIteration);\n this._ssrPass.setParameter('pixelStride', pixelStride);\n break;\n case 'maxRoughness':\n this._ssrPass.setParameter('minGlossiness', Math.max(Math.min(1.0 - value, 1.0), 0.0));\n break;\n case 'physical':\n this.setPhysicallyCorrectSSR(value);\n break;\n default:\n console.warn('Unkown SSR parameter ' + name);\n }\n};\n\nEffectCompositor.prototype.setPhysicallyCorrectSSR = function (physical) {\n this._ssrPass.setPhysicallyCorrect(physical);\n};\n\n/**\n * Set color of edge\n */\nEffectCompositor.prototype.setEdgeColor = function (value) {\n var color = graphicGL.parseColor(value);\n this._edgePass.setParameter('edgeColor', color);\n};\n\nEffectCompositor.prototype.setExposure = function (value) {\n this._compositeNode.setParameter('exposure', Math.pow(2, value));\n};\n\nEffectCompositor.prototype.setColorLookupTexture = function (image, api) {\n this._compositeNode.pass.material.setTextureImage('lut', this._enableColorCorrection ? image : 'none', api, {\n minFilter: graphicGL.Texture.NEAREST,\n magFilter: graphicGL.Texture.NEAREST,\n flipY: false\n });\n};\nEffectCompositor.prototype.setColorCorrection = function (type, value) {\n this._compositeNode.setParameter(type, value);\n};\n\nEffectCompositor.prototype.isSSREnabled = function () {\n return this._enableSSR;\n};\n\nEffectCompositor.prototype.composite = function (renderer, scene, camera, framebuffer, frame) {\n\n var sourceTexture = this._sourceTexture;\n var targetTexture = sourceTexture;\n if (this._enableEdge) {\n this._edgePass.update(renderer, camera, sourceTexture, frame);\n sourceTexture = targetTexture = this._edgePass.getTargetTexture();\n }\n if (this._enableSSR) {\n this._ssrPass.update(renderer, camera, sourceTexture, frame);\n targetTexture = this._ssrPass.getTargetTexture();\n\n this._ssrPass.setSSAOTexture(\n this._enableSSAO ? this._ssaoPass.getTargetTexture() : null\n );\n // var lights = scene.getLights();\n // for (var i = 0; i < lights.length; i++) {\n // if (lights[i].cubemap) {\n // this._ssrPass.setAmbientCubemap(lights[i].cubemap, lights[i].intensity);\n // }\n // }\n }\n this._sourceNode.texture = targetTexture;\n\n this._cocNode.setParameter('depth', this._depthTexture);\n\n var blurKernel = this._dofBlurKernel;\n var blurKernelSize = this._dofBlurKernelSize;\n var frameAll = Math.floor(poissonKernel.length / 2 / blurKernelSize);\n var kernelOffset = frame % frameAll;\n\n for (var i = 0; i < blurKernelSize * 2; i++) {\n blurKernel[i] = poissonKernel[i + kernelOffset * blurKernelSize * 2];\n }\n\n for (var i = 0; i < this._dofBlurNodes.length; i++) {\n this._dofBlurNodes[i].setParameter('percent', frame / 30.0);\n this._dofBlurNodes[i].setParameter('poissonKernel', blurKernel);\n }\n\n this._cocNode.setParameter('zNear', camera.near);\n this._cocNode.setParameter('zFar', camera.far);\n\n this._compositor.render(renderer, framebuffer);\n};\n\nEffectCompositor.prototype.dispose = function (renderer) {\n this._sourceTexture.dispose(renderer);\n this._depthTexture.dispose(renderer);\n this._framebuffer.dispose(renderer);\n this._compositor.dispose(renderer);\n\n this._normalPass.dispose(renderer);\n this._ssaoPass.dispose(renderer);\n};\n\nexport default EffectCompositor;","// Temporal Super Sample for static Scene\nimport halton from './halton';\nimport Pass from 'claygl/src/compositor/Pass';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Shader from 'claygl/src/Shader';\nimport Matrix4 from 'claygl/src/math/Matrix4';\n\nfunction TemporalSuperSampling (frames) {\n var haltonSequence = [];\n\n for (var i = 0; i < 30; i++) {\n haltonSequence.push([halton(i, 2), halton(i, 3)]);\n }\n\n this._haltonSequence = haltonSequence;\n\n this._frame = 0;\n\n this._sourceTex = new Texture2D();\n this._sourceFb = new FrameBuffer();\n this._sourceFb.attach(this._sourceTex);\n\n // Frame texture before temporal supersampling\n this._prevFrameTex = new Texture2D();\n this._outputTex = new Texture2D();\n\n var blendPass = this._blendPass = new Pass({\n fragment: Shader.source('clay.compositor.blend')\n });\n blendPass.material.disableTexturesAll();\n blendPass.material.enableTexture(['texture1', 'texture2']);\n\n this._blendFb = new FrameBuffer({\n depthBuffer: false\n });\n\n this._outputPass = new Pass({\n fragment: Shader.source('clay.compositor.output'),\n // TODO, alpha is premultiplied?\n blendWithPrevious: true\n });\n this._outputPass.material.define('fragment', 'OUTPUT_ALPHA');\n this._outputPass.material.blend = function (_gl) {\n // FIXME.\n // Output is premultiplied alpha when BLEND is enabled ?\n // http://stackoverflow.com/questions/2171085/opengl-blending-with-previous-contents-of-framebuffer\n _gl.blendEquationSeparate(_gl.FUNC_ADD, _gl.FUNC_ADD);\n _gl.blendFuncSeparate(_gl.ONE, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA);\n };\n}\n\nTemporalSuperSampling.prototype = {\n\n constructor: TemporalSuperSampling,\n\n /**\n * Jitter camera projectionMatrix\n * @parma {clay.Renderer} renderer\n * @param {clay.Camera} camera\n */\n jitterProjection: function (renderer, camera) {\n var viewport = renderer.viewport;\n var dpr = viewport.devicePixelRatio || renderer.getDevicePixelRatio();\n var width = viewport.width * dpr;\n var height = viewport.height * dpr;\n\n var offset = this._haltonSequence[this._frame % this._haltonSequence.length];\n\n var translationMat = new Matrix4();\n translationMat.array[12] = (offset[0] * 2.0 - 1.0) / width;\n translationMat.array[13] = (offset[1] * 2.0 - 1.0) / height;\n\n Matrix4.mul(camera.projectionMatrix, translationMat, camera.projectionMatrix);\n\n Matrix4.invert(camera.invProjectionMatrix, camera.projectionMatrix);\n },\n\n /**\n * Reset accumulating frame\n */\n resetFrame: function () {\n this._frame = 0;\n },\n\n /**\n * Return current frame\n */\n getFrame: function () {\n return this._frame;\n },\n\n /**\n * Get source framebuffer for usage\n */\n getSourceFrameBuffer: function () {\n return this._sourceFb;\n },\n\n getOutputTexture: function () {\n return this._outputTex;\n },\n\n resize: function (width, height) {\n this._prevFrameTex.width = width;\n this._prevFrameTex.height = height;\n\n this._outputTex.width = width;\n this._outputTex.height = height;\n\n this._sourceTex.width = width;\n this._sourceTex.height = height;\n\n this._prevFrameTex.dirty();\n this._outputTex.dirty();\n this._sourceTex.dirty();\n },\n\n isFinished: function () {\n return this._frame >= this._haltonSequence.length;\n },\n\n render: function (renderer, sourceTex, notOutput) {\n var blendPass = this._blendPass;\n if (this._frame === 0) {\n // Direct output\n blendPass.setUniform('weight1', 0);\n blendPass.setUniform('weight2', 1);\n }\n else {\n blendPass.setUniform('weight1', 0.9);\n blendPass.setUniform('weight2', 0.1);\n }\n blendPass.setUniform('texture1', this._prevFrameTex);\n blendPass.setUniform('texture2', sourceTex || this._sourceTex);\n\n this._blendFb.attach(this._outputTex);\n this._blendFb.bind(renderer);\n blendPass.render(renderer);\n this._blendFb.unbind(renderer);\n\n if (!notOutput) {\n this._outputPass.setUniform('texture', this._outputTex);\n this._outputPass.render(renderer);\n }\n\n // Swap texture\n var tmp = this._prevFrameTex;\n this._prevFrameTex = this._outputTex;\n this._outputTex = tmp;\n\n this._frame++;\n },\n\n dispose: function (renderer) {\n this._sourceFb.dispose(renderer);\n this._blendFb.dispose(renderer);\n this._prevFrameTex.dispose(renderer);\n this._outputTex.dispose(renderer);\n this._sourceTex.dispose(renderer);\n this._outputPass.dispose(renderer);\n this._blendPass.dispose(renderer);\n }\n};\n\nexport default TemporalSuperSampling;","/*\n * @module echarts-gl/core/ViewGL\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport * as echarts from 'echarts/lib/echarts';\n\nimport Scene from 'claygl/src/Scene';\nimport ShadowMapPass from 'claygl/src/prePass/ShadowMap';\nimport PerspectiveCamera from 'claygl/src/camera/Perspective';\nimport OrthographicCamera from 'claygl/src/camera/Orthographic';\nimport Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Vector2 from 'claygl/src/math/Vector2';\n\nimport notifier from 'claygl/src/core/mixin/notifier';\n\nimport EffectCompositor from '../effect/EffectCompositor';\nimport TemporalSuperSampling from '../effect/TemporalSuperSampling';\nimport halton from '../effect/halton';\n\n/**\n * @constructor\n * @alias module:echarts-gl/core/ViewGL\n * @param {string} [projection='perspective']\n */\nfunction ViewGL(projection) {\n\n projection = projection || 'perspective';\n\n /**\n * @type {module:echarts-gl/core/LayerGL}\n */\n this.layer = null;\n /**\n * @type {clay.Scene}\n */\n this.scene = new Scene();\n\n /**\n * @type {clay.Node}\n */\n this.rootNode = this.scene;\n\n this.viewport = {\n x: 0, y: 0, width: 0, height: 0\n };\n\n this.setProjection(projection);\n\n this._compositor = new EffectCompositor();\n\n this._temporalSS = new TemporalSuperSampling();\n\n this._shadowMapPass = new ShadowMapPass();\n\n var pcfKernels = [];\n var off = 0;\n for (var i = 0; i < 30; i++) {\n var pcfKernel = [];\n for (var k = 0; k < 6; k++) {\n pcfKernel.push(halton(off, 2) * 4.0 - 2.0);\n pcfKernel.push(halton(off, 3) * 4.0 - 2.0);\n off++;\n }\n pcfKernels.push(pcfKernel);\n }\n this._pcfKernels = pcfKernels;\n\n this.scene.on('beforerender', function (renderer, scene, camera) {\n if (this.needsTemporalSS()) {\n this._temporalSS.jitterProjection(renderer, camera);\n }\n }, this);\n}\n\n/**\n * Set camera type of group\n * @param {string} cameraType 'perspective' | 'orthographic'\n */\nViewGL.prototype.setProjection = function (projection) {\n var oldCamera = this.camera;\n oldCamera && oldCamera.update();\n if (projection === 'perspective') {\n if (!(this.camera instanceof PerspectiveCamera)) {\n this.camera = new PerspectiveCamera();\n if (oldCamera) {\n this.camera.setLocalTransform(oldCamera.localTransform);\n }\n }\n }\n else {\n if (!(this.camera instanceof OrthographicCamera)) {\n this.camera = new OrthographicCamera();\n if (oldCamera) {\n this.camera.setLocalTransform(oldCamera.localTransform);\n }\n }\n }\n // PENDING\n this.camera.near = 0.1;\n this.camera.far = 2000;\n};\n\n/**\n * Set viewport of group\n * @param {number} x Viewport left bottom x\n * @param {number} y Viewport left bottom y\n * @param {number} width Viewport height\n * @param {number} height Viewport height\n * @param {number} [dpr=1]\n */\nViewGL.prototype.setViewport = function (x, y, width, height, dpr) {\n if (this.camera instanceof PerspectiveCamera) {\n this.camera.aspect = width / height;\n }\n dpr = dpr || 1;\n\n this.viewport.x = x;\n this.viewport.y = y;\n this.viewport.width = width;\n this.viewport.height = height;\n this.viewport.devicePixelRatio = dpr;\n\n // Source and output of compositor use high dpr texture.\n // But the intermediate texture of bloom, dof effects use fixed 1.0 dpr\n this._compositor.resize(width * dpr, height * dpr);\n this._temporalSS.resize(width * dpr, height * dpr);\n};\n\n/**\n * If contain screen point x, y\n * @param {number} x offsetX\n * @param {number} y offsetY\n * @return {boolean}\n */\nViewGL.prototype.containPoint = function (x, y) {\n var viewport = this.viewport;\n var height = this.layer.renderer.getHeight();\n // Flip y;\n y = height - y;\n return x >= viewport.x && y >= viewport.y\n && x <= viewport.x + viewport.width && y <= viewport.y + viewport.height;\n};\n\n/**\n * Cast a ray\n * @param {number} x offsetX\n * @param {number} y offsetY\n * @param {clay.math.Ray} out\n * @return {clay.math.Ray}\n */\nvar ndc = new Vector2();\nViewGL.prototype.castRay = function (x, y, out) {\n var renderer = this.layer.renderer;\n\n var oldViewport = renderer.viewport;\n renderer.viewport = this.viewport;\n renderer.screenToNDC(x, y, ndc);\n this.camera.castRay(ndc, out);\n renderer.viewport = oldViewport;\n\n return out;\n};\n\n/**\n * Prepare and update scene before render\n */\nViewGL.prototype.prepareRender = function () {\n this.scene.update();\n this.camera.update();\n this.scene.updateLights();\n var renderList = this.scene.updateRenderList(this.camera);\n\n this._needsSortProgressively = false;\n // If has any transparent mesh needs sort triangles progressively.\n for (var i = 0; i < renderList.transparent.length; i++) {\n var renderable = renderList.transparent[i];\n var geometry = renderable.geometry;\n if (geometry.needsSortVerticesProgressively && geometry.needsSortVerticesProgressively()) {\n this._needsSortProgressively = true;\n }\n if (geometry.needsSortTrianglesProgressively && geometry.needsSortTrianglesProgressively()) {\n this._needsSortProgressively = true;\n }\n }\n\n this._frame = 0;\n this._temporalSS.resetFrame();\n\n // var lights = this.scene.getLights();\n // for (var i = 0; i < lights.length; i++) {\n // if (lights[i].cubemap) {\n // if (this._compositor && this._compositor.isSSREnabled()) {\n // lights[i].invisible = true;\n // }\n // else {\n // lights[i].invisible = false;\n // }\n // }\n // }\n};\n\nViewGL.prototype.render = function (renderer, accumulating) {\n this._doRender(renderer, accumulating, this._frame);\n this._frame++;\n};\n\nViewGL.prototype.needsAccumulate = function () {\n return this.needsTemporalSS() || this._needsSortProgressively;\n};\n\nViewGL.prototype.needsTemporalSS = function () {\n var enableTemporalSS = this._enableTemporalSS;\n if (enableTemporalSS === 'auto') {\n enableTemporalSS = this._enablePostEffect;\n }\n return enableTemporalSS;\n};\n\nViewGL.prototype.hasDOF = function () {\n return this._enableDOF;\n};\n\nViewGL.prototype.isAccumulateFinished = function () {\n return this.needsTemporalSS() ? this._temporalSS.isFinished()\n : (this._frame > 30);\n};\n\nViewGL.prototype._doRender = function (renderer, accumulating, accumFrame) {\n\n var scene = this.scene;\n var camera = this.camera;\n\n accumFrame = accumFrame || 0;\n\n this._updateTransparent(renderer, scene, camera, accumFrame);\n\n if (!accumulating) {\n this._shadowMapPass.kernelPCF = this._pcfKernels[0];\n // Not render shadowmap pass in accumulating frame.\n this._shadowMapPass.render(renderer, scene, camera, true);\n }\n\n this._updateShadowPCFKernel(accumFrame);\n\n // Shadowmap will set clear color.\n var bgColor = renderer.clearColor;\n renderer.gl.clearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]);\n\n if (this._enablePostEffect) {\n // normal render also needs to be jittered when have edge pass.\n if (this.needsTemporalSS()) {\n this._temporalSS.jitterProjection(renderer, camera);\n }\n this._compositor.updateNormal(renderer, scene, camera, this._temporalSS.getFrame());\n }\n\n // Always update SSAO to make sure have correct ssaoMap status\n this._updateSSAO(renderer, scene, camera, this._temporalSS.getFrame());\n\n if (this._enablePostEffect) {\n\n var frameBuffer = this._compositor.getSourceFrameBuffer();\n frameBuffer.bind(renderer);\n renderer.gl.clear(renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT);\n renderer.render(scene, camera, true, true);\n frameBuffer.unbind(renderer);\n\n if (this.needsTemporalSS() && accumulating) {\n this._compositor.composite(renderer, scene, camera, this._temporalSS.getSourceFrameBuffer(), this._temporalSS.getFrame());\n renderer.setViewport(this.viewport);\n this._temporalSS.render(renderer);\n }\n else {\n renderer.setViewport(this.viewport);\n this._compositor.composite(renderer, scene, camera, null, 0);\n }\n }\n else {\n if (this.needsTemporalSS() && accumulating) {\n var frameBuffer = this._temporalSS.getSourceFrameBuffer();\n frameBuffer.bind(renderer);\n renderer.saveClear();\n renderer.clearBit = renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT;\n renderer.render(scene, camera, true, true);\n renderer.restoreClear();\n frameBuffer.unbind(renderer);\n\n renderer.setViewport(this.viewport);\n this._temporalSS.render(renderer);\n }\n else {\n renderer.setViewport(this.viewport);\n renderer.render(scene, camera, true, true);\n }\n }\n\n // this._shadowMapPass.renderDebug(renderer);\n // this._compositor._normalPass.renderDebug(renderer);\n};\n\nViewGL.prototype._updateTransparent = function (renderer, scene, camera, frame) {\n\n var v3 = new Vector3();\n var invWorldTransform = new Matrix4();\n var cameraWorldPosition = camera.getWorldPosition();\n var transparentList = scene.getRenderList(camera).transparent;\n\n // Sort transparent object.\n for (var i = 0; i < transparentList.length; i++) {\n var renderable = transparentList[i];\n var geometry = renderable.geometry;\n Matrix4.invert(invWorldTransform, renderable.worldTransform);\n Vector3.transformMat4(v3, cameraWorldPosition, invWorldTransform);\n if (geometry.needsSortTriangles && geometry.needsSortTriangles()) {\n geometry.doSortTriangles(v3, frame);\n }\n if (geometry.needsSortVertices && geometry.needsSortVertices()) {\n geometry.doSortVertices(v3, frame);\n }\n }\n};\n\nViewGL.prototype._updateSSAO = function (renderer, scene, camera) {\n var ifEnableSSAO = this._enableSSAO && this._enablePostEffect;\n if (ifEnableSSAO) {\n this._compositor.updateSSAO(renderer, scene, camera, this._temporalSS.getFrame());\n }\n var renderList = scene.getRenderList(camera);\n\n for (var i = 0; i < renderList.opaque.length; i++) {\n var renderable = renderList.opaque[i];\n // PENDING\n if (renderable.renderNormal) {\n renderable.material[ifEnableSSAO ? 'enableTexture' : 'disableTexture']('ssaoMap');\n }\n if (ifEnableSSAO) {\n renderable.material.set('ssaoMap', this._compositor.getSSAOTexture());\n }\n }\n};\n\nViewGL.prototype._updateShadowPCFKernel = function (frame) {\n var pcfKernel = this._pcfKernels[frame % this._pcfKernels.length];\n var renderList = this.scene.getRenderList(this.camera);\n var opaqueList = renderList.opaque;\n for (var i = 0; i < opaqueList.length; i++) {\n if (opaqueList[i].receiveShadow) {\n opaqueList[i].material.set('pcfKernel', pcfKernel);\n opaqueList[i].material.define('fragment', 'PCF_KERNEL_SIZE', pcfKernel.length / 2);\n }\n }\n};\n\nViewGL.prototype.dispose = function (renderer) {\n this._compositor.dispose(renderer.gl);\n this._temporalSS.dispose(renderer.gl);\n this._shadowMapPass.dispose(renderer);\n};\n/**\n * @param {module:echarts/Model} Post effect model\n */\nViewGL.prototype.setPostEffect = function (postEffectModel, api) {\n var compositor = this._compositor;\n this._enablePostEffect = postEffectModel.get('enable');\n var bloomModel = postEffectModel.getModel('bloom');\n var edgeModel = postEffectModel.getModel('edge');\n var dofModel = postEffectModel.getModel('DOF', postEffectModel.getModel('depthOfField'));\n var ssaoModel = postEffectModel.getModel('SSAO', postEffectModel.getModel('screenSpaceAmbientOcclusion'));\n var ssrModel = postEffectModel.getModel('SSR', postEffectModel.getModel('screenSpaceReflection'));\n var fxaaModel = postEffectModel.getModel('FXAA');\n var colorCorrModel = postEffectModel.getModel('colorCorrection');\n bloomModel.get('enable') ? compositor.enableBloom() : compositor.disableBloom();\n dofModel.get('enable') ? compositor.enableDOF() : compositor.disableDOF();\n ssrModel.get('enable') ? compositor.enableSSR() : compositor.disableSSR();\n colorCorrModel.get('enable') ? compositor.enableColorCorrection() : compositor.disableColorCorrection();\n edgeModel.get('enable') ? compositor.enableEdge() : compositor.disableEdge();\n fxaaModel.get('enable') ? compositor.enableFXAA() : compositor.disableFXAA();\n\n this._enableDOF = dofModel.get('enable');\n this._enableSSAO = ssaoModel.get('enable');\n\n this._enableSSAO ? compositor.enableSSAO() : compositor.disableSSAO();\n\n compositor.setBloomIntensity(bloomModel.get('intensity'));\n compositor.setEdgeColor(edgeModel.get('color'));\n compositor.setColorLookupTexture(colorCorrModel.get('lookupTexture'), api);\n compositor.setExposure(colorCorrModel.get('exposure'));\n\n ['radius', 'quality', 'intensity'].forEach(function (name) {\n compositor.setSSAOParameter(name, ssaoModel.get(name));\n });\n ['quality', 'maxRoughness', 'physical'].forEach(function (name) {\n compositor.setSSRParameter(name, ssrModel.get(name));\n });\n ['quality', 'focalDistance', 'focalRange', 'blurRadius', 'fstop'].forEach(function (name) {\n compositor.setDOFParameter(name, dofModel.get(name));\n });\n ['brightness', 'contrast', 'saturation'].forEach(function (name) {\n compositor.setColorCorrection(name, colorCorrModel.get(name));\n });\n\n};\n\nViewGL.prototype.setDOFFocusOnPoint = function (depth) {\n if (this._enablePostEffect) {\n\n if (depth > this.camera.far || depth < this.camera.near) {\n return;\n }\n\n this._compositor.setDOFParameter('focalDistance', depth);\n return true;\n }\n};\n\nViewGL.prototype.setTemporalSuperSampling = function (temporalSuperSamplingModel) {\n this._enableTemporalSS = temporalSuperSamplingModel.get('enable');\n};\n\nViewGL.prototype.isLinearSpace = function () {\n return this._enablePostEffect;\n};\n\nViewGL.prototype.setRootNode = function (rootNode) {\n if (this.rootNode === rootNode) {\n return;\n }\n var children = this.rootNode.children();\n for (var i = 0; i < children.length; i++) {\n rootNode.add(children[i]);\n }\n if (rootNode !== this.scene) {\n this.scene.add(rootNode);\n }\n\n this.rootNode = rootNode;\n};\n// Proxies\nViewGL.prototype.add = function (node3D) {\n this.rootNode.add(node3D);\n};\nViewGL.prototype.remove = function (node3D) {\n this.rootNode.remove(node3D);\n};\nViewGL.prototype.removeAll = function (node3D) {\n this.rootNode.removeAll(node3D);\n};\n\nObject.assign(ViewGL.prototype, notifier);\n\nexport default ViewGL;","import Cartesian3D from './grid3D/Cartesian3D';\nimport Axis3D from './grid3D/Axis3D';\nimport * as echarts from 'echarts/lib/echarts';\nimport {getLayoutRect} from 'echarts/lib/util/layout';\nimport ViewGL from '../core/ViewGL';\nimport retrieve from '../util/retrieve';\n\nfunction resizeCartesian3D(grid3DModel, api) {\n // Use left/top/width/height\n var boxLayoutOption = grid3DModel.getBoxLayoutParams();\n\n var viewport = getLayoutRect(boxLayoutOption, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n\n // Flip Y\n viewport.y = api.getHeight() - viewport.y - viewport.height;\n\n this.viewGL.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, api.getDevicePixelRatio());\n\n var boxWidth = grid3DModel.get('boxWidth');\n var boxHeight = grid3DModel.get('boxHeight');\n var boxDepth = grid3DModel.get('boxDepth');\n\n if (process.env.NODE_ENV !== 'production') {\n ['x', 'y', 'z'].forEach(function (dim) {\n if (!this.getAxis(dim)) {\n throw new Error('Grid' + grid3DModel.id + ' don\\'t have ' + dim + 'Axis');\n }\n }, this);\n }\n this.getAxis('x').setExtent(-boxWidth / 2, boxWidth / 2);\n // From near to far\n this.getAxis('y').setExtent(boxDepth / 2, -boxDepth / 2);\n this.getAxis('z').setExtent(-boxHeight / 2, boxHeight / 2);\n\n this.size = [boxWidth, boxHeight, boxDepth];\n}\n\nfunction updateCartesian3D(ecModel, api) {\n var dataExtents = {};\n function unionDataExtents(dim, extent) {\n dataExtents[dim] = dataExtents[dim] || [Infinity, -Infinity];\n dataExtents[dim][0] = Math.min(extent[0], dataExtents[dim][0]);\n dataExtents[dim][1] = Math.max(extent[1], dataExtents[dim][1]);\n }\n // Get data extents for scale.\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.coordinateSystem !== this) {\n return;\n }\n var data = seriesModel.getData();\n ['x', 'y', 'z'].forEach(function (coordDim) {\n data.mapDimensionsAll(coordDim, true).forEach(function (dataDim) {\n unionDataExtents(\n coordDim, data.getDataExtent(dataDim, true)\n );\n });\n });\n }, this);\n\n ['xAxis3D', 'yAxis3D', 'zAxis3D'].forEach(function (axisType) {\n ecModel.eachComponent(axisType, function (axisModel) {\n var dim = axisType.charAt(0);\n var grid3DModel = axisModel.getReferringComponents('grid3D').models[0];\n\n var cartesian3D = grid3DModel.coordinateSystem;\n if (cartesian3D !== this) {\n return;\n }\n\n var axis = cartesian3D.getAxis(dim);\n if (axis) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Can\\'t have two %s in one grid3D', axisType);\n }\n return;\n }\n var scale = echarts.helper.createScale(\n dataExtents[dim] || [Infinity, -Infinity], axisModel\n );\n axis = new Axis3D(dim, scale);\n axis.type = axisModel.get('type');\n var isCategory = axis.type === 'category';\n axis.onBand = isCategory && axisModel.get('boundaryGap');\n axis.inverse = axisModel.get('inverse');\n\n axisModel.axis = axis;\n axis.model = axisModel;\n\n // override `echarts/coord/Axis#getLabelModel`\n axis.getLabelModel = function () {\n return axisModel.getModel('axisLabel', grid3DModel.getModel('axisLabel'));\n };\n // override `echarts/coord/Axis#getTickModel`\n axis.getTickModel = function () {\n return axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));\n };\n\n cartesian3D.addAxis(axis);\n }, this);\n }, this);\n\n this.resize(this.model, api);\n}\n\nvar grid3DCreator = {\n\n dimensions: Cartesian3D.prototype.dimensions,\n\n create: function (ecModel, api) {\n\n var cartesian3DList = [];\n\n ecModel.eachComponent('grid3D', function (grid3DModel) {\n // FIXME\n grid3DModel.__viewGL = grid3DModel.__viewGL || new ViewGL();\n\n var cartesian3D = new Cartesian3D();\n cartesian3D.model = grid3DModel;\n cartesian3D.viewGL = grid3DModel.__viewGL;\n\n grid3DModel.coordinateSystem = cartesian3D;\n cartesian3DList.push(cartesian3D);\n\n // Inject resize and update\n cartesian3D.resize = resizeCartesian3D;\n\n cartesian3D.update = updateCartesian3D;\n });\n\n var axesTypes = ['xAxis3D', 'yAxis3D', 'zAxis3D'];\n function findAxesModels(seriesModel, ecModel) {\n return axesTypes.map(function (axisType) {\n var axisModel = seriesModel.getReferringComponents(axisType).models[0];\n if (axisModel == null) {\n axisModel = ecModel.getComponent(axisType);\n }\n if (process.env.NODE_ENV !== 'production') {\n if (!axisModel) {\n throw new Error(axisType + ' \"' + retrieve.firstNotNull(\n seriesModel.get(axisType + 'Index'),\n seriesModel.get(axisType + 'Id'),\n 0\n ) + '\" not found');\n }\n }\n return axisModel;\n });\n }\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') !== 'cartesian3D') {\n return;\n }\n var firstGridModel = seriesModel.getReferringComponents('grid3D').models[0];\n\n if (firstGridModel == null) {\n var axesModels = findAxesModels(seriesModel, ecModel);\n var firstGridModel = axesModels[0].getCoordSysModel();\n axesModels.forEach(function (axisModel) {\n var grid3DModel = axisModel.getCoordSysModel();\n if (process.env.NODE_ENV !== 'production') {\n if (!grid3DModel) {\n throw new Error(\n 'grid3D \"' + retrieve.firstNotNull(\n axisModel.get('gridIndex'),\n axisModel.get('gridId'),\n 0\n ) + '\" not found'\n );\n }\n if (grid3DModel !== firstGridModel) {\n throw new Error('xAxis3D, yAxis3D, zAxis3D must use the same grid');\n }\n }\n });\n }\n\n var coordSys = firstGridModel.coordinateSystem;\n seriesModel.coordinateSystem = coordSys;\n });\n\n return cartesian3DList;\n }\n};\n\nexport default grid3DCreator;","import * as echarts from 'echarts/lib/echarts';\n\nvar Axis3DModel = echarts.ComponentModel.extend({\n\n type: 'cartesian3DAxis',\n\n axis: null,\n\n /**\n * @override\n */\n getCoordSysModel: function () {\n return this.ecModel.queryComponents({\n mainType: 'grid3D',\n index: this.option.gridIndex,\n id: this.option.gridId\n })[0];\n }\n});\n\necharts.helper.mixinAxisModelCommonMethods(Axis3DModel);\n\nexport default Axis3DModel;","import * as echarts from 'echarts/lib/echarts';\n\nvar defaultOption = {\n show: true,\n\n grid3DIndex: 0,\n // 反向坐标轴\n inverse: false,\n\n // 坐标轴名字\n name: '',\n // 坐标轴名字位置\n nameLocation: 'middle',\n\n nameTextStyle: {\n fontSize: 16\n },\n // 文字与轴线距离\n nameGap: 20,\n\n axisPointer: {},\n\n axisLine: {},\n // 坐标轴小标记\n axisTick: {},\n axisLabel: {},\n // 分隔区域\n splitArea: {}\n};\n\nvar categoryAxis = echarts.util.merge({\n // 类目起始和结束两端空白策略\n boundaryGap: true,\n // splitArea: {\n // show: false\n // },\n // 坐标轴小标记\n axisTick: {\n // If tick is align with label when boundaryGap is true\n // Default with axisTick\n alignWithLabel: false,\n interval: 'auto'\n },\n // 坐标轴文本标签,详见axis.axisLabel\n axisLabel: {\n interval: 'auto'\n },\n axisPointer: {\n label: {\n show: false\n }\n }\n}, defaultOption);\n\nvar valueAxis = echarts.util.merge({\n // 数值起始和结束两端空白策略\n boundaryGap: [0, 0],\n // 最小值, 设置成 'dataMin' 则从数据中计算最小值\n // min: null,\n // 最大值,设置成 'dataMax' 则从数据中计算最大值\n // max: null,\n // 脱离0值比例,放大聚焦到最终_min,_max区间\n // scale: false,\n // 分割段数,默认为5\n splitNumber: 5,\n // Minimum interval\n // minInterval: null\n\n axisPointer: {\n label: {\n }\n }\n}, defaultOption);\n\n// FIXME\nvar timeAxis = echarts.util.defaults({\n scale: true,\n min: 'dataMin',\n max: 'dataMax'\n}, valueAxis);\nvar logAxis = echarts.util.defaults({\n logBase: 10\n}, valueAxis);\nlogAxis.scale = true;\n\nexport default {\n categoryAxis3D: categoryAxis,\n valueAxis3D: valueAxis,\n timeAxis3D: timeAxis,\n logAxis3D: logAxis\n};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { createHashMap, isObject, map } from 'zrender/lib/core/util';\n\nvar OrdinalMeta =\n/** @class */\nfunction () {\n function OrdinalMeta(opt) {\n this.categories = opt.categories || [];\n this._needCollect = opt.needCollect;\n this._deduplication = opt.deduplication;\n }\n\n OrdinalMeta.createByAxisModel = function (axisModel) {\n var option = axisModel.option;\n var data = option.data;\n var categories = data && map(data, getName);\n return new OrdinalMeta({\n categories: categories,\n needCollect: !categories,\n // deduplication is default in axis.\n deduplication: option.dedplication !== false\n });\n };\n\n ;\n\n OrdinalMeta.prototype.getOrdinal = function (category) {\n // @ts-ignore\n return this._getOrCreateMap().get(category);\n };\n /**\n * @return The ordinal. If not found, return NaN.\n */\n\n\n OrdinalMeta.prototype.parseAndCollect = function (category) {\n var index;\n var needCollect = this._needCollect; // The value of category dim can be the index of the given category set.\n // This feature is only supported when !needCollect, because we should\n // consider a common case: a value is 2017, which is a number but is\n // expected to be tread as a category. This case usually happen in dataset,\n // where it happent to be no need of the index feature.\n\n if (typeof category !== 'string' && !needCollect) {\n return category;\n } // Optimize for the scenario:\n // category is ['2012-01-01', '2012-01-02', ...], where the input\n // data has been ensured not duplicate and is large data.\n // Notice, if a dataset dimension provide categroies, usually echarts\n // should remove duplication except user tell echarts dont do that\n // (set axis.deduplication = false), because echarts do not know whether\n // the values in the category dimension has duplication (consider the\n // parallel-aqi example)\n\n\n if (needCollect && !this._deduplication) {\n index = this.categories.length;\n this.categories[index] = category;\n return index;\n }\n\n var map = this._getOrCreateMap(); // @ts-ignore\n\n\n index = map.get(category);\n\n if (index == null) {\n if (needCollect) {\n index = this.categories.length;\n this.categories[index] = category; // @ts-ignore\n\n map.set(category, index);\n } else {\n index = NaN;\n }\n }\n\n return index;\n }; // Consider big data, do not create map until needed.\n\n\n OrdinalMeta.prototype._getOrCreateMap = function () {\n return this._map || (this._map = createHashMap(this.categories));\n };\n\n return OrdinalMeta;\n}();\n\nfunction getName(obj) {\n if (isObject(obj) && obj.value != null) {\n return obj.value;\n } else {\n return obj + '';\n }\n}\n\nexport default OrdinalMeta;","import * as echarts from 'echarts/lib/echarts';\nimport axisDefault from './axis3DDefault';\n\nimport OrdinalMeta from 'echarts/lib/data/OrdinalMeta';\n\nvar AXIS_TYPES = ['value', 'category', 'time', 'log'];\n/**\n * Generate sub axis model class\n * @param {} registers\n * @param {string} dim 'x' 'y' 'radius' 'angle' 'parallel'\n * @param {module:echarts/model/Component} BaseAxisModelClass\n * @param {Function} axisTypeDefaulter\n * @param {Object} [extraDefaultOption]\n */\nexport default function (registers, dim, BaseAxisModelClass, axisTypeDefaulter, extraDefaultOption) {\n\n AXIS_TYPES.forEach(function (axisType) {\n\n var AxisModel = BaseAxisModelClass.extend({\n\n type: dim + 'Axis3D.' + axisType,\n\n /**\n * @type readOnly\n */\n __ordinalMeta: null,\n\n mergeDefaultAndTheme: function (option, ecModel) {\n\n var themeModel = ecModel.getTheme();\n echarts.util.merge(option, themeModel.get(axisType + 'Axis3D'));\n echarts.util.merge(option, this.getDefaultOption());\n\n option.type = axisTypeDefaulter(dim, option);\n },\n\n /**\n * @override\n */\n optionUpdated: function () {\n var thisOption = this.option;\n\n if (thisOption.type === 'category') {\n this.__ordinalMeta = OrdinalMeta.createByAxisModel(this);\n }\n },\n\n getCategories: function () {\n if (this.option.type === 'category') {\n return this.__ordinalMeta.categories;\n }\n },\n\n getOrdinalMeta: function () {\n return this.__ordinalMeta;\n },\n\n defaultOption: echarts.util.merge(\n echarts.util.clone(axisDefault[axisType + 'Axis3D']),\n extraDefaultOption || {},\n true\n )\n });\n\n registers.registerComponentModel(AxisModel);\n });\n\n // TODO\n registers.registerSubTypeDefaulter(\n dim + 'Axis3D',\n echarts.util.curry(axisTypeDefaulter, dim)\n );\n};","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Grid3DModel from './Grid3DModel';\nimport Grid3DView from './Grid3DView';\nimport grid3DCreator from '../../coord/grid3DCreator';\nimport Axis3DModel from './Axis3DModel';\nimport createAxis3DModel from './createAxis3DModel';\n\n\nfunction getAxisType(axisDim, option) {\n // Default axis with data is category axis\n return option.type || (option.data ? 'category' : 'value');\n}\nexport function install(registers) {\n registers.registerComponentModel(Grid3DModel);\n registers.registerComponentView(Grid3DView);\n\n registers.registerCoordinateSystem('grid3D', grid3DCreator);\n\n\n ['x', 'y', 'z'].forEach(function (dim) {\n createAxis3DModel(registers, dim, Axis3DModel, getAxisType, {\n name: dim.toUpperCase()\n });\n const AxisView = registers.ComponentView.extend({\n type: dim + 'Axis3D'\n });\n registers.registerComponentView(AxisView);\n });\n\n\n registers.registerAction({\n type: 'grid3DChangeCamera',\n event: 'grid3dcamerachanged',\n update: 'series:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'grid3D', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n\n registers.registerAction({\n type: 'grid3DShowAxisPointer',\n event: 'grid3dshowaxispointer',\n update: 'grid3D:showAxisPointer'\n }, function (payload, ecModel) {\n });\n\n registers.registerAction({\n type: 'grid3DHideAxisPointer',\n event: 'grid3dhideaxispointer',\n update: 'grid3D:hideAxisPointer'\n }, function (payload, ecModel) {\n });\n}\n\n","import { use } from 'echarts/lib/echarts';\nimport { install } from './grid3D/install';\nuse(install);","export default {\n defaultOption: {\n shading: null,\n\n realisticMaterial: {\n textureTiling: 1,\n textureOffset: 0,\n\n detailTexture: null\n },\n\n lambertMaterial: {\n textureTiling: 1,\n textureOffset: 0,\n\n detailTexture: null\n },\n\n colorMaterial: {\n textureTiling: 1,\n textureOffset: 0,\n\n detailTexture: null\n },\n\n hatchingMaterial: {\n textureTiling: 1,\n textureOffset: 0,\n\n paperColor: '#fff'\n }\n }\n};","import * as echarts from 'echarts/lib/echarts';\n\nexport default {\n\n getFilledRegions: function (regions, mapData) {\n var regionsArr = (regions || []).slice();\n\n var geoJson;\n if (typeof mapData === 'string') {\n mapData = echarts.getMap(mapData);\n geoJson = mapData && mapData.geoJson;\n }\n else {\n if (mapData && mapData.features) {\n geoJson = mapData;\n }\n }\n if (!geoJson) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Map ' + mapData + ' not exists. You can download map file on http://echarts.baidu.com/download-map.html');\n if (!geoJson.features) {\n console.error('Invalid GeoJSON for map3D');\n }\n }\n return [];\n }\n\n var dataNameMap = {};\n var features = geoJson.features;\n for (var i = 0; i < regionsArr.length; i++) {\n dataNameMap[regionsArr[i].name] = regionsArr[i];\n }\n\n for (var i = 0; i < features.length; i++) {\n var name = features[i].properties.name;\n if (!dataNameMap[name]) {\n regionsArr.push({\n name: name\n });\n }\n }\n\n return regionsArr;\n },\n\n defaultOption: {\n show: true,\n\n zlevel: -10,\n\n // geoJson used by geo3D\n map: '',\n\n // Layout used for viewport\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n\n boxWidth: 100,\n boxHeight: 10,\n boxDepth: 'auto',\n\n regionHeight: 3,\n\n environment: 'auto',\n\n groundPlane: {\n show: false,\n color: '#aaa'\n },\n\n shading: 'lambert',\n\n light: {\n main: {\n alpha: 40,\n beta: 30\n }\n },\n\n viewControl: {\n alpha: 40,\n beta: 0,\n distance: 100,\n orthographicSize: 60,\n\n minAlpha: 5,\n minBeta: -80,\n maxBeta: 80\n },\n\n label: {\n show: false,\n // Distance in 3d space.\n distance: 2,\n\n textStyle: {\n fontSize: 20,\n color: '#000',\n backgroundColor: 'rgba(255,255,255,0.7)',\n padding: 3,\n borderRadius: 4\n }\n },\n\n // TODO\n // altitude: {\n // min: 'auto',\n // max: 'auto',\n\n // height: []\n // },\n\n\n // labelLine\n\n // light\n // postEffect\n // temporalSuperSampling\n\n itemStyle: {\n color: '#fff',\n borderWidth: 0,\n borderColor: '#333'\n },\n\n emphasis: {\n itemStyle: {\n // color: '#f94b59'\n color: '#639fc0'\n },\n label: {\n show: true\n }\n }\n }\n};","import * as echarts from 'echarts/lib/echarts';\nimport componentViewControlMixin from '../common/componentViewControlMixin';\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\nimport componentShadingMixin from '../common/componentShadingMixin';\nimport geo3DModelMixin from '../../coord/geo3D/geo3DModelMixin';\n\nvar Geo3DModel = echarts.ComponentModel.extend({\n\n type: 'geo3D',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n optionUpdated: function () {\n var option = this.option;\n\n option.regions = this.getFilledRegions(option.regions, option.map);\n\n var dimensions = echarts.helper.createDimensions(option.data || [], {\n coordDimensions: ['value'],\n encodeDefine: this.get('encode'),\n dimensionsDefine: this.get('dimensions')\n });\n var list = new echarts.List(dimensions, this);\n list.initData(option.regions);\n\n var regionModelMap = {};\n list.each(function (idx) {\n var name = list.getName(idx);\n var itemModel = list.getItemModel(idx);\n regionModelMap[name] = itemModel;\n });\n\n this._regionModelMap = regionModelMap;\n\n this._data = list;\n },\n\n getData: function () {\n return this._data;\n },\n\n getRegionModel: function (idx) {\n var name = this.getData().getName(idx);\n return this._regionModelMap[name] || new echarts.Model(null, this);\n },\n\n getRegionPolygonCoords: function (idx) {\n var name = this.getData().getName(idx);\n var region = this.coordinateSystem.getRegion(name);\n\n return region ? region.geometries : [];\n },\n\n /**\n * Format label\n * @param {string} name Region name\n * @param {string} [status='normal'] 'normal' or 'emphasis'\n * @return {string}\n */\n getFormattedLabel: function (dataIndex, status) {\n var name = this._data.getName(dataIndex);\n var regionModel = this.getRegionModel(dataIndex);\n var formatter = regionModel.get(status === 'normal' ? ['label', 'formatter'] : ['emphasis', 'label', 'formatter']);\n if (formatter == null) {\n formatter = regionModel.get(['label', 'formatter']);\n }\n var params = {\n name: name\n };\n if (typeof formatter === 'function') {\n params.status = status;\n return formatter(params);\n }\n else if (typeof formatter === 'string') {\n var serName = params.seriesName;\n return formatter.replace('{a}', serName != null ? serName : '');\n }\n else {\n return name;\n }\n },\n\n defaultOption: {\n\n // itemStyle: {},\n // height,\n // label: {}\n // realisticMaterial\n regions: []\n }\n});\n\necharts.util.merge(Geo3DModel.prototype, geo3DModelMixin);\n\necharts.util.merge(Geo3DModel.prototype, componentViewControlMixin);\necharts.util.merge(Geo3DModel.prototype, componentPostEffectMixin);\necharts.util.merge(Geo3DModel.prototype, componentLightMixin);\necharts.util.merge(Geo3DModel.prototype, componentShadingMixin);\n\nexport default Geo3DModel;","// https://github.com/mapbox/earcut/blob/master/src/earcut.js\n\nexport default earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode) return triangles;\n\n var minX, minY, maxX, maxY, x, y, size;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and size are later used to transform coords into integers for z-order calculation\n size = Math.max(maxX - minX, maxY - minY);\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && size) indexCurve(ear, minX, minY, size);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertice leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(ear, triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, size);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, size) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, size),\n maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\n // first look for points inside the triangle in increasing z-order\n var p = ear.nextZ;\n\n while (p && p.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.nextZ;\n }\n\n // then look for points in decreasing z-order\n p = ear.prevZ;\n\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, size);\n earcutLinked(c, triangles, dim, minX, minY, size);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m.next;\n\n while (p !== stop) {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n }\n\n return m;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, size) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and size of the data bounding box\nfunction zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n if ((equals(p1, q1) && equals(p2, q2)) ||\n (equals(p1, q2) && equals(p2, q1))) return true;\n return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertice index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertice nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}","\nfunction swap(arr, a, b) {\n var tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n}\nfunction partition(arr, pivot, left, right, compare) {\n var storeIndex = left;\n var pivotValue = arr[pivot];\n\n // put the pivot on the right\n swap(arr, pivot, right);\n\n // go through the rest\n for(var v = left; v < right; v++) {\n if(compare(arr[v], pivotValue) < 0) {\n swap(arr, v, storeIndex);\n storeIndex++;\n }\n }\n\n // finally put the pivot in the correct place\n swap(arr, right, storeIndex);\n\n return storeIndex;\n}\n\nfunction quickSort(array, compare, left, right) {\n if(left < right) {\n var pivot = Math.floor((left + right) / 2);\n var newPivot = partition(array, pivot, left, right, compare);\n quickSort(array, compare, left, newPivot - 1);\n quickSort(array, compare, newPivot + 1, right);\n }\n}\n\n\n// TODO Test.\nfunction ProgressiveQuickSort() {\n\n // this._pivotList = new LinkedList();\n this._parts = [];\n}\n\nProgressiveQuickSort.prototype.step = function (arr, compare, frame) {\n\n var len = arr.length;\n if (frame === 0) {\n this._parts = [];\n this._sorted = false;\n\n // Pick a start pivot;\n var pivot = Math.floor(len / 2);\n this._parts.push({\n pivot: pivot,\n left: 0,\n right: len - 1\n });\n\n this._currentSortPartIdx = 0;\n }\n\n if (this._sorted) {\n return;\n }\n\n var parts = this._parts;\n if (parts.length === 0) {\n this._sorted = true;\n // Already finished.\n return true;\n }\n else if (parts.length < 512) {\n // Sort large parts in about 10 frames.\n for (var i = 0; i < parts.length; i++) {\n // Partition and Modify the pivot index.\n parts[i].pivot = partition(\n arr, parts[i].pivot, parts[i].left, parts[i].right, compare\n );\n }\n\n var subdividedParts = [];\n for (var i = 0; i < parts.length; i++) {\n // Subdivide left\n var left = parts[i].left;\n var right = parts[i].pivot - 1;\n if (right > left) {\n subdividedParts.push({\n pivot: Math.floor((right + left) / 2),\n left: left, right: right\n });\n }\n // Subdivide right\n var left = parts[i].pivot + 1;\n var right = parts[i].right;\n if (right > left) {\n subdividedParts.push({\n pivot: Math.floor((right + left) / 2),\n left: left, right: right\n });\n }\n }\n parts = this._parts = subdividedParts;\n }\n else {\n // console.time('sort');\n // Finally quick sort each parts in 10 frames.\n for (var i = 0; i < Math.floor(parts.length / 10); i++) {\n // Sort near parts first.\n var idx = parts.length - 1 - this._currentSortPartIdx;\n quickSort(arr, compare, parts[idx].left, parts[idx].right);\n this._currentSortPartIdx++;\n\n // Finish sort\n if (this._currentSortPartIdx === parts.length) {\n this._sorted = true;\n return true;\n }\n }\n // console.timeEnd('sort');\n\n }\n\n return false;\n};\n\nProgressiveQuickSort.sort = quickSort;\n\nexport default ProgressiveQuickSort;","import ProgressiveQuickSort from '../ProgressiveQuickSort';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\nvar p0 = vec3.create();\nvar p1 = vec3.create();\nvar p2 = vec3.create();\n// var cp = vec3.create();\n\nexport default {\n\n needsSortTriangles: function () {\n return this.indices && this.sortTriangles;\n },\n\n needsSortTrianglesProgressively: function () {\n return this.needsSortTriangles() && this.triangleCount >= 2e4;\n },\n\n doSortTriangles: function (cameraPos, frame) {\n var indices = this.indices;\n // Do progressive quick sort.\n if (frame === 0) {\n var posAttr = this.attributes.position;\n var cameraPos = cameraPos.array;\n\n if (!this._triangleZList || this._triangleZList.length !== this.triangleCount) {\n this._triangleZList = new Float32Array(this.triangleCount);\n this._sortedTriangleIndices = new Uint32Array(this.triangleCount);\n\n this._indicesTmp = new indices.constructor(indices.length);\n this._triangleZListTmp = new Float32Array(this.triangleCount);\n }\n\n var cursor = 0;\n var firstZ;\n for (var i = 0; i < indices.length;) {\n posAttr.get(indices[i++], p0);\n posAttr.get(indices[i++], p1);\n posAttr.get(indices[i++], p2);\n\n // FIXME If use center ?\n // cp[0] = (p0[0] + p1[0] + p2[0]) / 3;\n // cp[1] = (p0[1] + p1[1] + p2[1]) / 3;\n // cp[2] = (p0[2] + p1[2] + p2[2]) / 3;\n // Camera position is in object space\n\n // Use max of three points, PENDING\n var z0 = vec3.sqrDist(p0, cameraPos);\n var z1 = vec3.sqrDist(p1, cameraPos);\n var z2 = vec3.sqrDist(p2, cameraPos);\n var zMax = Math.min(z0, z1);\n zMax = Math.min(zMax, z2);\n if (i === 3) {\n firstZ = zMax;\n zMax = 0;\n }\n else {\n // Only store the difference to avoid the precision issue.\n zMax = zMax - firstZ;\n }\n this._triangleZList[cursor++] = zMax;\n }\n }\n\n\n var sortedTriangleIndices = this._sortedTriangleIndices;\n for (var i = 0; i < sortedTriangleIndices.length; i++) {\n sortedTriangleIndices[i] = i;\n }\n\n if (this.triangleCount < 2e4) {\n // Use simple timsort for simple geometries.\n if (frame === 0) {\n // Use native sort temporary.\n this._simpleSort(true);\n }\n }\n else {\n for (var i = 0; i < 3; i++) {\n this._progressiveQuickSort(frame * 3 + i);\n }\n }\n\n var targetIndices = this._indicesTmp;\n var targetTriangleZList = this._triangleZListTmp;\n var faceZList = this._triangleZList;\n for (var i = 0; i < this.triangleCount; i++) {\n var fromIdx3 = sortedTriangleIndices[i] * 3;\n var toIdx3 = i * 3;\n targetIndices[toIdx3++] = indices[fromIdx3++];\n targetIndices[toIdx3++] = indices[fromIdx3++];\n targetIndices[toIdx3] = indices[fromIdx3];\n\n targetTriangleZList[i] = faceZList[sortedTriangleIndices[i]];\n }\n\n // Swap indices.\n var tmp = this._indicesTmp;\n this._indicesTmp = this.indices;\n this.indices = tmp;\n var tmp = this._triangleZListTmp;\n this._triangleZListTmp = this._triangleZList;\n this._triangleZList = tmp;\n\n this.dirtyIndices();\n },\n\n _simpleSort: function (useNativeQuickSort) {\n var faceZList = this._triangleZList;\n var sortedTriangleIndices = this._sortedTriangleIndices;\n\n function compare(a, b) {\n // Sort from far to near. which is descending order\n return faceZList[b] - faceZList[a];\n }\n if (useNativeQuickSort) {\n Array.prototype.sort.call(sortedTriangleIndices, compare);\n }\n else {\n ProgressiveQuickSort.sort(sortedTriangleIndices, compare, 0, sortedTriangleIndices.length - 1);\n }\n },\n\n _progressiveQuickSort: function (frame) {\n var faceZList = this._triangleZList;\n var sortedTriangleIndices = this._sortedTriangleIndices;\n\n this._quickSort = this._quickSort || new ProgressiveQuickSort();\n\n this._quickSort.step(sortedTriangleIndices, function (a, b) {\n return faceZList[b] - faceZList[a];\n }, frame);\n }\n};","export function getVisualColor(data) {\n const style = data.getVisual('style');\n if (style) {\n const drawType = data.getVisual('drawType');\n return style[drawType];\n }\n}\nexport function getVisualOpacity(data) {\n const style = data.getVisual('style');\n return style.opacity;\n}\nexport function getItemVisualColor(data, idx) {\n const style = data.getItemVisual(idx, 'style');\n if (style) {\n const drawType = data.getVisual('drawType');\n return style[drawType];\n }\n}\nexport function getItemVisualOpacity(data, idx) {\n const style = data.getItemVisual(idx, 'style');\n return style && style.opacity;\n}","import * as echarts from 'echarts/lib/echarts';\nimport ZRTextureAtlasSurface from '../../util/ZRTextureAtlasSurface';\nimport LabelsMesh from '../../util/mesh/LabelsMesh';\nimport retrieve from '../../util/retrieve';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nimport {createTextStyle} from 'echarts/lib/label/labelStyle';\n\nvar LABEL_NORMAL_SHOW_BIT = 1;\nvar LABEL_EMPHASIS_SHOW_BIT = 2;\n\nfunction LabelsBuilder(width, height, api) {\n\n this._labelsMesh = new LabelsMesh();\n\n this._labelTextureSurface = new ZRTextureAtlasSurface({\n width: 512,\n height: 512,\n devicePixelRatio: api.getDevicePixelRatio(),\n onupdate: function () {\n api.getZr().refresh();\n }\n });\n this._api = api;\n\n this._labelsMesh.material.set('textureAtlas', this._labelTextureSurface.getTexture());\n}\n\nLabelsBuilder.prototype.getLabelPosition = function (dataIndex, positionDesc, distance) {\n return [0, 0, 0];\n};\n\nLabelsBuilder.prototype.getLabelDistance = function (dataIndex, positionDesc, distance) {\n return 0;\n};\n\nLabelsBuilder.prototype.getMesh = function () {\n return this._labelsMesh;\n};\n\nLabelsBuilder.prototype.updateData = function (data, start, end) {\n if (start == null) {\n start = 0;\n }\n if (end == null) {\n end = data.count();\n }\n\n if (!this._labelsVisibilitiesBits || this._labelsVisibilitiesBits.length !== (end - start)) {\n this._labelsVisibilitiesBits = new Uint8Array(end - start);\n }\n var normalLabelVisibilityQuery = ['label', 'show'];\n var emphasisLabelVisibilityQuery = ['emphasis', 'label', 'show'];\n\n for (var idx = start; idx < end; idx++) {\n var itemModel = data.getItemModel(idx);\n var normalVisibility = itemModel.get(normalLabelVisibilityQuery);\n var emphasisVisibility = itemModel.get(emphasisLabelVisibilityQuery);\n if (emphasisVisibility == null) {\n emphasisVisibility = normalVisibility;\n }\n var bit = (normalVisibility ? LABEL_NORMAL_SHOW_BIT : 0)\n | (emphasisVisibility ? LABEL_EMPHASIS_SHOW_BIT : 0);\n this._labelsVisibilitiesBits[idx - start] = bit;\n }\n\n this._start = start;\n this._end = end;\n\n this._data = data;\n};\n\nLabelsBuilder.prototype.updateLabels = function (highlightDataIndices) {\n\n if (!this._data) {\n return;\n }\n\n highlightDataIndices = highlightDataIndices || [];\n\n var hasHighlightData = highlightDataIndices.length > 0;\n var highlightDataIndicesMap = {};\n for (var i = 0; i < highlightDataIndices.length; i++) {\n highlightDataIndicesMap[highlightDataIndices[i]] = true;\n }\n\n this._labelsMesh.geometry.convertToDynamicArray(true);\n this._labelTextureSurface.clear();\n\n var normalLabelQuery = ['label'];\n var emphasisLabelQuery = ['emphasis', 'label'];\n var seriesModel = this._data.hostModel;\n var data = this._data;\n\n var seriesLabelModel = seriesModel.getModel(normalLabelQuery);\n var seriesLabelEmphasisModel = seriesModel.getModel(emphasisLabelQuery, seriesLabelModel);\n\n var textAlignMap = {\n left: 'right',\n right: 'left',\n top: 'center',\n bottom: 'center'\n };\n var textVerticalAlignMap = {\n left: 'middle',\n right: 'middle',\n top: 'bottom',\n bottom: 'top'\n };\n\n for (var dataIndex = this._start; dataIndex < this._end; dataIndex++) {\n var isEmphasis = false;\n if (hasHighlightData && highlightDataIndicesMap[dataIndex]) {\n isEmphasis = true;\n }\n var ifShow = this._labelsVisibilitiesBits[dataIndex - this._start]\n & (isEmphasis ? LABEL_EMPHASIS_SHOW_BIT : LABEL_NORMAL_SHOW_BIT);\n if (!ifShow) {\n continue;\n }\n\n var itemModel = data.getItemModel(dataIndex);\n var labelModel = itemModel.getModel(\n isEmphasis ? emphasisLabelQuery : normalLabelQuery,\n isEmphasis ? seriesLabelEmphasisModel : seriesLabelModel\n );\n var distance = labelModel.get('distance') || 0;\n var position = labelModel.get('position');\n\n var dpr = this._api.getDevicePixelRatio();\n var text = seriesModel.getFormattedLabel(dataIndex, isEmphasis ? 'emphasis' : 'normal');\n if (text == null || text === '') {\n return;\n }\n\n // TODO Background.\n var textEl = new echarts.graphic.Text({\n style: createTextStyle(labelModel, {\n text: text,\n fill: labelModel.get('color') || getItemVisualColor(data, dataIndex) || '#000',\n align: 'left',\n verticalAlign: 'top',\n opacity: retrieve.firstNotNull(labelModel.get('opacity'), getItemVisualOpacity(data, dataIndex), 1)\n })\n });\n\n var rect = textEl.getBoundingRect();\n var lineHeight = 1.2;\n rect.height *= lineHeight;\n\n var coords = this._labelTextureSurface.add(textEl);\n\n var textAlign = textAlignMap[position] || 'center';\n var textVerticalAlign = textVerticalAlignMap[position] || 'bottom';\n\n this._labelsMesh.geometry.addSprite(\n this.getLabelPosition(dataIndex, position, distance),\n [rect.width * dpr, rect.height * dpr], coords,\n textAlign, textVerticalAlign,\n this.getLabelDistance(dataIndex, position, distance) * dpr\n );\n }\n\n this._labelsMesh.material.set('uvScale', this._labelTextureSurface.getCoordsScale());\n\n // var canvas = this._labelTextureSurface.getTexture().image;\n // document.body.appendChild(canvas);\n // canvas.style.cssText = 'position:absolute;z-index: 1000';\n\n // Update image.\n this._labelTextureSurface.getZr().refreshImmediately();\n this._labelsMesh.geometry.convertToTypedArray();\n this._labelsMesh.geometry.dirty();\n};\n\nLabelsBuilder.prototype.dispose = function () {\n this._labelTextureSurface.dispose();\n}\n\nexport default LabelsBuilder;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport earcut from '../../util/earcut';\nimport LinesGeo from '../../util/geometry/Lines3D';\nimport retrieve from '../../util/retrieve';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport trianglesSortMixin from '../../util/geometry/trianglesSortMixin';\nimport LabelsBuilder from './LabelsBuilder';\nimport lines3DGLSL from '../../util/shader/lines3D.glsl.js';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nvar vec3 = glmatrix.vec3;\n\ngraphicGL.Shader.import(lines3DGLSL);\n\nfunction Geo3DBuilder(api) {\n\n this.rootNode = new graphicGL.Node();\n\n // Cache triangulation result\n this._triangulationResults = {};\n\n this._shadersMap = graphicGL.COMMON_SHADERS.filter(function (shaderName) {\n return shaderName !== 'shadow';\n }).reduce(function (obj, shaderName) {\n obj[shaderName] = graphicGL.createShader('ecgl.' + shaderName);\n return obj;\n }, {});\n\n this._linesShader = graphicGL.createShader('ecgl.meshLines3D');\n\n var groundMaterials = {};\n graphicGL.COMMON_SHADERS.forEach(function (shading) {\n groundMaterials[shading] = new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.' + shading)\n });\n });\n this._groundMaterials = groundMaterials;\n\n this._groundMesh = new graphicGL.Mesh({\n geometry: new graphicGL.PlaneGeometry({ dynamic: true }),\n castShadow: false,\n renderNormal: true,\n $ignorePicking: true\n });\n this._groundMesh.rotation.rotateX(-Math.PI / 2);\n\n this._labelsBuilder = new LabelsBuilder(512, 512, api);\n\n // Give a large render order.\n this._labelsBuilder.getMesh().renderOrder = 100;\n this._labelsBuilder.getMesh().material.depthTest = false;\n\n this.rootNode.add(this._labelsBuilder.getMesh());\n\n this._initMeshes();\n\n this._api = api;\n}\n\nGeo3DBuilder.prototype = {\n\n constructor: Geo3DBuilder,\n\n // Which dimension to extrude. Y or Z\n extrudeY: true,\n\n update: function (componentModel, ecModel, api, start, end) {\n\n var data = componentModel.getData();\n\n if (start == null) {\n start = 0;\n }\n if (end == null) {\n end = data.count();\n }\n\n this._startIndex = start;\n this._endIndex = end - 1;\n\n this._triangulation(componentModel, start, end);\n\n var shader = this._getShader(componentModel.get('shading'));\n\n this._prepareMesh(componentModel, shader, api, start, end);\n\n this.rootNode.updateWorldTransform();\n\n this._updateRegionMesh(componentModel, api, start, end);\n\n var coordSys = componentModel.coordinateSystem;\n // PENDING\n if (coordSys.type === 'geo3D') {\n this._updateGroundPlane(componentModel, coordSys, api);\n }\n\n var self = this;\n this._labelsBuilder.updateData(data, start, end);\n this._labelsBuilder.getLabelPosition = function (dataIndex, positionDesc, distance) {\n var name = data.getName(dataIndex);\n\n var center;\n var height = distance;\n if (coordSys.type === 'geo3D') {\n var region = coordSys.getRegion(name);\n if (!region) {\n return [NaN, NaN, NaN];\n }\n center = region.getCenter();\n var pos = coordSys.dataToPoint([center[0], center[1], height]);\n return pos;\n }\n else {\n var tmp = self._triangulationResults[dataIndex - self._startIndex];\n var center = self.extrudeY ? [\n (tmp.max[0] + tmp.min[0]) / 2,\n tmp.max[1] + height,\n (tmp.max[2] + tmp.min[2]) / 2\n ] : [\n (tmp.max[0] + tmp.min[0]) / 2,\n (tmp.max[1] + tmp.min[1]) / 2,\n tmp.max[2] + height\n ];\n }\n };\n\n this._data = data;\n\n this._labelsBuilder.updateLabels();\n\n this._updateDebugWireframe(componentModel);\n\n // Reset some state.\n this._lastHoverDataIndex = 0;\n },\n\n _initMeshes: function () {\n var self = this;\n function createPolygonMesh() {\n var mesh = new graphicGL.Mesh({\n name: 'Polygon',\n material: new graphicGL.Material({\n shader: self._shadersMap.lambert\n }),\n geometry: new graphicGL.Geometry({\n sortTriangles: true,\n dynamic: true\n }),\n // TODO Disable culling\n culling: false,\n ignorePicking: true,\n // Render normal in normal pass\n renderNormal: true\n });\n Object.assign(mesh.geometry, trianglesSortMixin);\n return mesh;\n }\n\n var polygonMesh = createPolygonMesh();\n\n var linesMesh = new graphicGL.Mesh({\n material: new graphicGL.Material({\n shader: this._linesShader\n }),\n castShadow: false,\n ignorePicking: true,\n $ignorePicking: true,\n geometry: new LinesGeo({\n useNativeLine: false\n })\n });\n\n this.rootNode.add(polygonMesh);\n this.rootNode.add(linesMesh);\n\n polygonMesh.material.define('both', 'VERTEX_COLOR');\n polygonMesh.material.define('fragment', 'DOUBLE_SIDED');\n\n this._polygonMesh = polygonMesh;\n this._linesMesh = linesMesh;\n\n this.rootNode.add(this._groundMesh);\n },\n\n _getShader: function (shading) {\n var shader = this._shadersMap[shading];\n if (!shader) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown shading ' + shading);\n }\n // Default use lambert shader.\n shader = this._shadersMap.lambert;\n }\n shader.__shading = shading;\n return shader;\n },\n\n _prepareMesh: function (componentModel, shader, api, start, end) {\n var polygonVertexCount = 0;\n var polygonTriangleCount = 0;\n var linesVertexCount = 0;\n var linesTriangleCount = 0;\n // TODO Lines\n for (var idx = start; idx < end; idx++) {\n var polyInfo = this._getRegionPolygonInfo(idx);\n var lineInfo = this._getRegionLinesInfo(idx, componentModel, this._linesMesh.geometry);\n polygonVertexCount += polyInfo.vertexCount;\n polygonTriangleCount += polyInfo.triangleCount;\n linesVertexCount += lineInfo.vertexCount;\n linesTriangleCount += lineInfo.triangleCount;\n }\n\n var polygonMesh = this._polygonMesh;\n var polygonGeo = polygonMesh.geometry;\n ['position', 'normal', 'texcoord0', 'color'].forEach(function (attrName) {\n polygonGeo.attributes[attrName].init(polygonVertexCount);\n });\n polygonGeo.indices = polygonVertexCount > 0xffff ? new Uint32Array(polygonTriangleCount * 3) : new Uint16Array(polygonTriangleCount * 3);\n\n if (polygonMesh.material.shader !== shader) {\n polygonMesh.material.attachShader(shader, true);\n }\n graphicGL.setMaterialFromModel(shader.__shading, polygonMesh.material, componentModel, api);\n\n if (linesVertexCount > 0) {\n this._linesMesh.geometry.resetOffset();\n this._linesMesh.geometry.setVertexCount(linesVertexCount);\n this._linesMesh.geometry.setTriangleCount(linesTriangleCount);\n }\n\n // Indexing data index from vertex index.\n this._dataIndexOfVertex = new Uint32Array(polygonVertexCount);\n // Indexing vertex index range from data index\n this._vertexRangeOfDataIndex = new Uint32Array((end - start) * 2);\n },\n\n _updateRegionMesh: function (componentModel, api, start, end) {\n\n var data = componentModel.getData();\n\n var vertexOffset = 0;\n var triangleOffset = 0;\n\n // Materials configurations.\n var hasTranparentRegion = false;\n\n var polygonMesh = this._polygonMesh;\n var linesMesh = this._linesMesh;\n\n for (var dataIndex = start; dataIndex < end; dataIndex++) {\n // Get bunch of visual properties.\n var regionModel = componentModel.getRegionModel(dataIndex);\n var itemStyleModel = regionModel.getModel('itemStyle');\n\n var color = retrieve.firstNotNull(\n getItemVisualColor(data, dataIndex),\n itemStyleModel.get('color'),\n '#fff'\n );\n var opacity = retrieve.firstNotNull(getItemVisualOpacity(data, dataIndex), 1);\n\n var colorArr = graphicGL.parseColor(color);\n var borderColorArr = graphicGL.parseColor(itemStyleModel.get('borderColor'));\n\n colorArr[3] *= opacity;\n borderColorArr[3] *= opacity;\n\n var isTransparent = colorArr[3] < 0.99;\n\n polygonMesh.material.set('color', [1, 1, 1, 1]);\n hasTranparentRegion = hasTranparentRegion || isTransparent;\n\n var regionHeight = retrieve.firstNotNull(regionModel.get('height', true), componentModel.get('regionHeight'));\n\n var newOffsets = this._updatePolygonGeometry(\n componentModel, polygonMesh.geometry, dataIndex, regionHeight,\n vertexOffset, triangleOffset, colorArr\n );\n\n for (var i = vertexOffset; i < newOffsets.vertexOffset; i++) {\n this._dataIndexOfVertex[i] = dataIndex;\n }\n this._vertexRangeOfDataIndex[(dataIndex - start) * 2] = vertexOffset;\n this._vertexRangeOfDataIndex[(dataIndex - start) * 2 + 1] = newOffsets.vertexOffset;\n\n vertexOffset = newOffsets.vertexOffset;\n triangleOffset = newOffsets.triangleOffset;\n\n // Update lines.\n var lineWidth = itemStyleModel.get('borderWidth');\n var hasLine = lineWidth > 0;\n if (hasLine) {\n lineWidth *= api.getDevicePixelRatio();\n this._updateLinesGeometry(\n linesMesh.geometry, componentModel, dataIndex, regionHeight, lineWidth,\n componentModel.coordinateSystem.transform\n );\n }\n linesMesh.invisible = !hasLine;\n linesMesh.material.set({\n color: borderColorArr\n });\n }\n\n var polygonMesh = this._polygonMesh;\n polygonMesh.material.transparent = hasTranparentRegion;\n polygonMesh.material.depthMask = !hasTranparentRegion;\n polygonMesh.geometry.updateBoundingBox();\n\n polygonMesh.frontFace = this.extrudeY ? graphicGL.Mesh.CCW : graphicGL.Mesh.CW;\n\n // Update tangents\n if (polygonMesh.material.get('normalMap')) {\n polygonMesh.geometry.generateTangents();\n }\n\n polygonMesh.seriesIndex = componentModel.seriesIndex;\n\n polygonMesh.on('mousemove', this._onmousemove, this);\n polygonMesh.on('mouseout', this._onmouseout, this);\n },\n\n _updateDebugWireframe: function (componentModel) {\n var debugWireframeModel = componentModel.getModel('debug.wireframe');\n\n // TODO Unshow\n if (debugWireframeModel.get('show')) {\n var color = graphicGL.parseColor(\n debugWireframeModel.get('lineStyle.color') || 'rgba(0,0,0,0.5)'\n );\n var width = retrieve.firstNotNull(\n debugWireframeModel.get('lineStyle.width'), 1\n );\n\n // TODO Will cause highlight wrong\n var mesh = this._polygonMesh;\n mesh.geometry.generateBarycentric();\n mesh.material.define('both', 'WIREFRAME_TRIANGLE');\n mesh.material.set('wireframeLineColor', color);\n mesh.material.set('wireframeLineWidth', width);\n }\n },\n\n _onmousemove: function (e) {\n var dataIndex = this._dataIndexOfVertex[e.triangle[0]];\n if (dataIndex == null) {\n dataIndex = -1;\n }\n if (dataIndex !== this._lastHoverDataIndex) {\n this.downplay(this._lastHoverDataIndex);\n this.highlight(dataIndex);\n this._labelsBuilder.updateLabels([dataIndex]);\n }\n this._lastHoverDataIndex = dataIndex;\n this._polygonMesh.dataIndex = dataIndex;\n },\n\n _onmouseout: function (e) {\n if (e.target) {\n this.downplay(this._lastHoverDataIndex);\n this._lastHoverDataIndex = -1;\n this._polygonMesh.dataIndex = -1;\n }\n\n this._labelsBuilder.updateLabels([]);\n },\n\n _updateGroundPlane: function (componentModel, geo3D, api) {\n var groundModel = componentModel.getModel('groundPlane', componentModel);\n this._groundMesh.invisible = !groundModel.get('show', true);\n if (this._groundMesh.invisible) {\n return;\n }\n\n var shading = componentModel.get('shading');\n var material = this._groundMaterials[shading];\n if (!material) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown shading ' + shading);\n }\n material = this._groundMaterials.lambert;\n }\n\n graphicGL.setMaterialFromModel(shading, material, groundModel, api);\n if (material.get('normalMap')) {\n this._groundMesh.geometry.generateTangents();\n }\n\n this._groundMesh.material = material;\n this._groundMesh.material.set('color', graphicGL.parseColor(groundModel.get('color')));\n\n this._groundMesh.scale.set(geo3D.size[0], geo3D.size[2], 1);\n },\n\n _triangulation: function (componentModel, start, end) {\n this._triangulationResults = [];\n\n var minAll = [Infinity, Infinity, Infinity];\n var maxAll = [-Infinity, -Infinity, -Infinity];\n\n var coordSys = componentModel.coordinateSystem;\n\n for (var idx = start; idx < end; idx++) {\n var polygons = [];\n var polygonCoords = componentModel.getRegionPolygonCoords(idx);\n for (var i = 0; i < polygonCoords.length; i++) {\n var exterior = polygonCoords[i].exterior;\n var interiors = polygonCoords[i].interiors;\n var points = [];\n var holes = [];\n if (exterior.length < 3) {\n continue;\n }\n var offset = 0;\n for (var j = 0; j < exterior.length; j++) {\n var p = exterior[j];\n points[offset++] = p[0];\n points[offset++] = p[1];\n }\n\n for (var j = 0; j < interiors.length; j++) {\n if (interiors[j].length < 3) {\n continue;\n }\n var startIdx = points.length / 2;\n for (var k = 0; k < interiors[j].length; k++) {\n var p = interiors[j][k];\n points.push(p[0]);\n points.push(p[1]);\n }\n\n holes.push(startIdx);\n }\n var triangles = earcut(points, holes);\n\n var points3 = new Float64Array(points.length / 2 * 3);\n var pos = [];\n var min = [Infinity, Infinity, Infinity];\n var max = [-Infinity, -Infinity, -Infinity];\n var off3 = 0;\n for (var j = 0; j < points.length;) {\n vec3.set(pos, points[j++], 0, points[j++]);\n if (coordSys && coordSys.transform) {\n vec3.transformMat4(pos, pos, coordSys.transform);\n }\n vec3.min(min, min, pos);\n vec3.max(max, max, pos);\n points3[off3++] = pos[0];\n points3[off3++] = pos[1];\n points3[off3++] = pos[2];\n }\n vec3.min(minAll, minAll, min);\n vec3.max(maxAll, maxAll, max);\n polygons.push({\n points: points3,\n indices: triangles,\n min: min,\n max: max\n });\n }\n this._triangulationResults.push(polygons);\n }\n\n this._geoBoundingBox = [minAll, maxAll];\n },\n\n /**\n * Get region vertex and triangle count\n */\n _getRegionPolygonInfo: function (idx) {\n\n var polygons = this._triangulationResults[idx - this._startIndex];\n\n var sideVertexCount = 0;\n var sideTriangleCount = 0;\n\n for (var i = 0; i < polygons.length; i++) {\n sideVertexCount += polygons[i].points.length / 3;\n sideTriangleCount += polygons[i].indices.length / 3;\n }\n\n var vertexCount = sideVertexCount * 2 + sideVertexCount * 4;\n var triangleCount = sideTriangleCount * 2 + sideVertexCount * 2;\n\n return {\n vertexCount: vertexCount,\n triangleCount: triangleCount\n };\n },\n\n _updatePolygonGeometry: function (\n componentModel, geometry, dataIndex, regionHeight,\n vertexOffset, triangleOffset, color\n ) {\n // FIXME\n var projectUVOnGround = componentModel.get('projectUVOnGround');\n\n var positionAttr = geometry.attributes.position;\n var normalAttr = geometry.attributes.normal;\n var texcoordAttr = geometry.attributes.texcoord0;\n var colorAttr = geometry.attributes.color;\n var polygons = this._triangulationResults[dataIndex - this._startIndex];\n\n var hasColor = colorAttr.value && color;\n\n var indices = geometry.indices;\n\n var extrudeCoordIndex = this.extrudeY ? 1 : 2;\n var sideCoordIndex = this.extrudeY ? 2 : 1;\n\n var scale = [\n this.rootNode.worldTransform.x.len(),\n this.rootNode.worldTransform.y.len(),\n this.rootNode.worldTransform.z.len()\n ];\n\n var min = vec3.mul([], this._geoBoundingBox[0], scale);\n var max = vec3.mul([], this._geoBoundingBox[1], scale);\n var maxDimSize = Math.max(max[0] - min[0], max[2] - min[2]);\n\n function addVertices(polygon, y, insideOffset) {\n var points = polygon.points;\n\n var pointsLen = points.length;\n var currentPosition = [];\n var uv = [];\n\n for (var k = 0; k < pointsLen; k += 3) {\n currentPosition[0] = points[k];\n currentPosition[extrudeCoordIndex] = y;\n currentPosition[sideCoordIndex] = points[k + 2];\n\n uv[0] = (points[k] * scale[0] - min[0]) / maxDimSize;\n uv[1] = (points[k + 2] * scale[sideCoordIndex] - min[2]) / maxDimSize;\n\n positionAttr.set(vertexOffset, currentPosition);\n if (hasColor) {\n colorAttr.set(vertexOffset, color);\n }\n texcoordAttr.set(vertexOffset++, uv);\n }\n }\n\n function buildTopBottom(polygon, y, insideOffset) {\n\n var startVertexOffset = vertexOffset;\n\n addVertices(polygon, y, insideOffset);\n\n var len = polygon.indices.length;\n for (var k = 0; k < len; k++) {\n indices[triangleOffset * 3 + k] = polygon.indices[k] + startVertexOffset;\n }\n triangleOffset += polygon.indices.length / 3;\n }\n\n var normalTop = this.extrudeY ? [0, 1, 0] : [0, 0, 1];\n var normalBottom = vec3.negate([], normalTop);\n for (var p = 0; p < polygons.length; p++) {\n var startVertexOffset = vertexOffset;\n var polygon = polygons[p];\n // BOTTOM\n buildTopBottom(polygon, 0, 0);\n // TOP\n buildTopBottom(polygon, regionHeight, 0);\n\n var ringVertexCount = polygon.points.length / 3;\n for (var v = 0; v < ringVertexCount; v++) {\n normalAttr.set(startVertexOffset + v, normalBottom);\n normalAttr.set(startVertexOffset + v + ringVertexCount, normalTop);\n }\n\n var quadToTriangle = [0, 3, 1, 1, 3, 2];\n\n var quadPos = [[], [], [], []];\n var a = [];\n var b = [];\n var normal = [];\n var uv = [];\n var len = 0;\n for (var v = 0; v < ringVertexCount; v++) {\n var next = (v + 1) % ringVertexCount;\n\n var dx = (polygon.points[next * 3] - polygon.points[v * 3]) * scale[0];\n var dy = (polygon.points[next * 3 + 2] - polygon.points[v * 3 + 2]) * scale[sideCoordIndex];\n var sideLen = Math.sqrt(dx * dx + dy * dy);\n\n // 0----1\n // 3----2\n for (var k = 0; k < 4; k++) {\n var isCurrent = (k === 0 || k === 3);\n var idx3 = (isCurrent ? v : next) * 3;\n quadPos[k][0] = polygon.points[idx3];\n quadPos[k][extrudeCoordIndex] = k > 1 ? regionHeight : 0;\n quadPos[k][sideCoordIndex] = polygon.points[idx3 + 2];\n\n positionAttr.set(vertexOffset + k, quadPos[k]);\n\n if (projectUVOnGround) {\n uv[0] = (polygon.points[idx3] * scale[0] - min[0]) / maxDimSize;\n uv[1] = (polygon.points[idx3 + 2] * scale[sideCoordIndex] - min[sideCoordIndex]) / maxDimSize;\n }\n else {\n uv[0] = (isCurrent ? len : (len + sideLen)) / maxDimSize;\n uv[1] = (quadPos[k][extrudeCoordIndex] * scale[extrudeCoordIndex] - min[extrudeCoordIndex]) / maxDimSize;\n }\n texcoordAttr.set(vertexOffset + k, uv);\n }\n vec3.sub(a, quadPos[1], quadPos[0]);\n vec3.sub(b, quadPos[3], quadPos[0]);\n vec3.cross(normal, a, b);\n vec3.normalize(normal, normal);\n\n for (var k = 0; k < 4; k++) {\n normalAttr.set(vertexOffset + k, normal);\n if (hasColor) {\n colorAttr.set(vertexOffset + k, color);\n }\n }\n\n for (var k = 0; k < 6; k++) {\n indices[triangleOffset * 3 + k] = quadToTriangle[k] + vertexOffset;\n }\n\n vertexOffset += 4;\n triangleOffset += 2;\n\n len += sideLen;\n }\n }\n\n geometry.dirty();\n\n return {\n vertexOffset: vertexOffset,\n triangleOffset: triangleOffset\n };\n },\n\n _getRegionLinesInfo: function (idx, componentModel, geometry) {\n var vertexCount = 0;\n var triangleCount = 0;\n\n var regionModel = componentModel.getRegionModel(idx);\n var itemStyleModel = regionModel.getModel('itemStyle');\n\n var lineWidth = itemStyleModel.get('borderWidth');\n if (lineWidth > 0) {\n var polygonCoords = componentModel.getRegionPolygonCoords(idx);\n polygonCoords.forEach(function (coords) {\n var exterior = coords.exterior;\n var interiors = coords.interiors;\n vertexCount += geometry.getPolylineVertexCount(exterior);\n triangleCount += geometry.getPolylineTriangleCount(exterior);\n for (var i = 0; i < interiors.length; i++) {\n vertexCount += geometry.getPolylineVertexCount(interiors[i]);\n triangleCount += geometry.getPolylineTriangleCount(interiors[i]);\n }\n }, this);\n }\n\n return {\n vertexCount: vertexCount,\n triangleCount: triangleCount\n };\n\n },\n\n _updateLinesGeometry: function (geometry, componentModel, dataIndex, regionHeight, lineWidth, transform) {\n function convertToPoints3(polygon) {\n var points = new Float64Array(polygon.length * 3);\n var offset = 0;\n var pos = [];\n for (var i = 0; i < polygon.length; i++) {\n pos[0] = polygon[i][0];\n // Add a offset to avoid z-fighting\n pos[1] = regionHeight + 0.1;\n pos[2] = polygon[i][1];\n\n if (transform) {\n vec3.transformMat4(pos, pos, transform);\n }\n\n points[offset++] = pos[0];\n points[offset++] = pos[1];\n points[offset++] = pos[2];\n }\n return points;\n }\n\n var whiteColor = [1, 1, 1, 1];\n var coords = componentModel.getRegionPolygonCoords(dataIndex);\n coords.forEach(function (geo) {\n var exterior = geo.exterior;\n var interiors = geo.interiors;\n\n geometry.addPolyline(convertToPoints3(exterior), whiteColor, lineWidth);\n\n for (var i = 0; i < interiors.length; i++) {\n geometry.addPolyline(convertToPoints3(interiors[i]), whiteColor, lineWidth);\n }\n });\n },\n\n highlight: function (dataIndex) {\n var data = this._data;\n if (!data) {\n return;\n }\n\n var itemModel = data.getItemModel(dataIndex);\n var emphasisItemStyleModel = itemModel.getModel(['emphasis', 'itemStyle']);\n var emphasisColor = emphasisItemStyleModel.get('color');\n var emphasisOpacity = retrieve.firstNotNull(\n emphasisItemStyleModel.get('opacity'),\n getItemVisualOpacity(data, dataIndex),\n 1\n );\n if (emphasisColor == null) {\n var color = getItemVisualColor(data, dataIndex);\n emphasisColor = echarts.color.lift(color, -0.4);\n }\n if (emphasisOpacity == null) {\n emphasisOpacity = getItemVisualOpacity(data, dataIndex);\n }\n var colorArr = graphicGL.parseColor(emphasisColor);\n colorArr[3] *= emphasisOpacity;\n\n this._setColorOfDataIndex(data, dataIndex, colorArr);\n },\n\n downplay: function (dataIndex) {\n\n var data = this._data;\n if (!data) {\n return;\n }\n\n var color = retrieve.firstNotNull(\n getItemVisualColor(data, dataIndex),\n data.getItemModel(dataIndex).get(['itemStyle', 'color']),\n '#fff'\n );\n var opacity = retrieve.firstNotNull(getItemVisualOpacity(data, dataIndex), 1);\n\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= opacity;\n\n this._setColorOfDataIndex(data, dataIndex, colorArr);\n },\n\n dispose: function () {\n this._labelsBuilder.dispose();\n },\n\n _setColorOfDataIndex: function (data, dataIndex, colorArr) {\n if (dataIndex < this._startIndex && dataIndex > this._endIndex) {\n return;\n }\n dataIndex -= this._startIndex;\n for (var i = this._vertexRangeOfDataIndex[dataIndex * 2]; i < this._vertexRangeOfDataIndex[dataIndex * 2 + 1]; i++) {\n this._polygonMesh.geometry.attributes.color.set(i, colorArr);\n }\n this._polygonMesh.geometry.dirty();\n this._api.getZr().refresh();\n }\n};\n\nexport default Geo3DBuilder;","import Geo3DBuilder from '../common/Geo3DBuilder';\nimport * as echarts from 'echarts/lib/echarts';\n\nimport graphicGL from '../../util/graphicGL';\nimport OrbitControl from '../../util/OrbitControl';\nimport SceneHelper from '../common/SceneHelper';\n\nexport default echarts.ComponentView.extend({\n\n type: 'geo3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this._geo3DBuilder = new Geo3DBuilder(api);\n this.groupGL = new graphicGL.Node();\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper(this._lightRoot);\n this._sceneHelper.initLight(this._lightRoot);\n\n this._control = new OrbitControl({\n zr: api.getZr()\n });\n this._control.init();\n },\n\n render: function (geo3DModel, ecModel, api) {\n this.groupGL.add(this._geo3DBuilder.rootNode);\n\n var geo3D = geo3DModel.coordinateSystem;\n\n if (!geo3D || !geo3D.viewGL) {\n return;\n }\n\n // Always have light.\n geo3D.viewGL.add(this._lightRoot);\n\n if (geo3DModel.get('show')) {\n geo3D.viewGL.add(this.groupGL);\n }\n else {\n geo3D.viewGL.remove(this.groupGL);\n }\n\n var control = this._control;\n control.setViewGL(geo3D.viewGL);\n\n var viewControlModel = geo3DModel.getModel('viewControl');\n control.setFromViewControlModel(viewControlModel, 0);\n\n this._sceneHelper.setScene(geo3D.viewGL.scene);\n this._sceneHelper.updateLight(geo3DModel);\n\n // Set post effect\n geo3D.viewGL.setPostEffect(geo3DModel.getModel('postEffect'), api);\n geo3D.viewGL.setTemporalSuperSampling(geo3DModel.getModel('temporalSuperSampling'));\n\n // Must update after geo3D.viewGL.setPostEffect\n this._geo3DBuilder.update(geo3DModel, ecModel, api, 0, geo3DModel.getData().count());\n var srgbDefineMethod = geo3D.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._geo3DBuilder.rootNode.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material[srgbDefineMethod]('fragment', 'SRGB_DECODE');\n }\n });\n\n control.off('update');\n control.on('update', function () {\n api.dispatchAction({\n type: 'geo3DChangeCamera',\n alpha: control.getAlpha(),\n beta: control.getBeta(),\n distance: control.getDistance(),\n center: control.getCenter(),\n from: this.uid,\n geo3DId: geo3DModel.id\n });\n });\n control.update();\n },\n\n afterRender: function (geo3DModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n this._sceneHelper.updateAmbientCubemap(renderer, geo3DModel, api);\n\n this._sceneHelper.updateSkybox(renderer, geo3DModel, api);\n },\n\n dispose: function () {\n this._control.dispose();\n this._geo3DBuilder.dispose();\n }\n});","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nvar coordsOffsetMap = {\n '南海诸岛': [32, 80],\n // 全国\n '广东': [0, -10],\n '香港': [10, 5],\n '澳门': [-10, 10],\n //'北京': [-10, 0],\n '天津': [5, 5]\n};\nexport default function fixTextCoords(mapType, region) {\n if (mapType === 'china') {\n var coordFix = coordsOffsetMap[region.name];\n\n if (coordFix) {\n var cp = region.getCenter();\n cp[0] += coordFix[0] / 10.5;\n cp[1] += -coordFix[1] / (10.5 / 0.75);\n region.setCenter(cp);\n }\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nvar geoCoordMap = {\n 'Russia': [100, 60],\n 'United States': [-99, 38],\n 'United States of America': [-99, 38]\n};\nexport default function fixGeoCoords(mapType, region) {\n if (mapType === 'world') {\n var geoCoord = geoCoordMap[region.name];\n\n if (geoCoord) {\n var cp = [geoCoord[0], geoCoord[1]];\n region.setCenter(cp);\n }\n }\n}","import * as echarts from 'echarts/lib/echarts';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\nvar mat4 = glmatrix.mat4;\n\nimport textCoord from 'echarts/lib/coord/geo/fix/textCoord';\nimport geoCoord from 'echarts/lib/coord/geo/fix/geoCoord';\n// Geo fix functions\nvar geoFixFuncs = [textCoord, geoCoord];\n\nfunction Geo3D(name, map, geoJson, specialAreas, nameMap) {\n\n this.name = name;\n\n this.map = map;\n\n this.regionHeight = 0;\n\n this.regions = [];\n\n this._nameCoordMap = {};\n\n this.loadGeoJson(geoJson, specialAreas, nameMap);\n\n this.transform = mat4.identity(new Float64Array(16));\n\n this.invTransform = mat4.identity(new Float64Array(16));\n\n // Which dimension to extrude. Y or Z\n this.extrudeY = true;\n\n this.altitudeAxis;\n}\n\nGeo3D.prototype = {\n\n constructor: Geo3D,\n\n type: 'geo3D',\n\n dimensions: ['lng', 'lat', 'alt'],\n\n containPoint: function () {},\n\n loadGeoJson: function (geoJson, specialAreas, nameMap) {\n var parseGeoJSON = echarts.parseGeoJSON || echarts.parseGeoJson;\n try {\n this.regions = geoJson ? parseGeoJSON(geoJson) : [];\n }\n catch (e) {\n throw 'Invalid geoJson format\\n' + e;\n }\n specialAreas = specialAreas || {};\n nameMap = nameMap || {};\n var regions = this.regions;\n var regionsMap = {};\n for (var i = 0; i < regions.length; i++) {\n var regionName = regions[i].name;\n // Try use the alias in nameMap\n regionName = nameMap[regionName] || regionName;\n regions[i].name = regionName;\n\n regionsMap[regionName] = regions[i];\n // Add geoJson\n this.addGeoCoord(regionName, regions[i].getCenter());\n\n // Some area like Alaska in USA map needs to be tansformed\n // to look better\n var specialArea = specialAreas[regionName];\n if (specialArea) {\n regions[i].transformTo(\n specialArea.left, specialArea.top, specialArea.width, specialArea.height\n );\n }\n }\n\n this._regionsMap = regionsMap;\n\n this._geoRect = null;\n\n geoFixFuncs.forEach(function (fixFunc) {\n fixFunc(this);\n }, this);\n },\n\n getGeoBoundingRect: function () {\n if (this._geoRect) {\n return this._geoRect;\n }\n var rect;\n\n var regions = this.regions;\n for (var i = 0; i < regions.length; i++) {\n var regionRect = regions[i].getBoundingRect();\n rect = rect || regionRect.clone();\n rect.union(regionRect);\n }\n // FIXME Always return new ?\n return (this._geoRect = rect || new echarts.graphic.BoundingRect(0, 0, 0, 0));\n },\n\n /**\n * Add geoCoord for indexing by name\n * @param {string} name\n * @param {Array.} geoCoord\n */\n addGeoCoord: function (name, geoCoord) {\n this._nameCoordMap[name] = geoCoord;\n },\n\n /**\n * @param {string} name\n * @return {module:echarts/coord/geo/Region}\n */\n getRegion: function (name) {\n return this._regionsMap[name];\n },\n\n getRegionByCoord: function (coord) {\n var regions = this.regions;\n for (var i = 0; i < regions.length; i++) {\n if (regions[i].contain(coord)) {\n return regions[i];\n }\n }\n },\n\n setSize: function (width, height, depth) {\n this.size = [width, height, depth];\n\n var rect = this.getGeoBoundingRect();\n\n var scaleX = width / rect.width;\n var scaleZ = -depth / rect.height;\n var translateX = -width / 2 - rect.x * scaleX;\n var translateZ = depth / 2 - rect.y * scaleZ;\n\n var position = this.extrudeY ? [translateX, 0, translateZ] : [translateX, translateZ, 0];\n var scale = this.extrudeY ? [scaleX, 1, scaleZ] : [scaleX, scaleZ, 1];\n\n var m = this.transform;\n mat4.identity(m);\n mat4.translate(m, m, position);\n mat4.scale(m, m, scale);\n\n mat4.invert(this.invTransform, m);\n },\n\n dataToPoint: function (data, out) {\n out = out || [];\n\n var extrudeCoordIndex = this.extrudeY ? 1 : 2;\n var sideCoordIndex = this.extrudeY ? 2 : 1;\n\n var altitudeVal = data[2];\n // PENDING.\n if (isNaN(altitudeVal)) {\n altitudeVal = 0;\n }\n // lng\n out[0] = data[0];\n // lat\n out[sideCoordIndex] = data[1];\n\n if (this.altitudeAxis) {\n out[extrudeCoordIndex] = this.altitudeAxis.dataToCoord(altitudeVal);\n }\n else {\n out[extrudeCoordIndex] = 0;\n }\n // PENDING different region height.\n out[extrudeCoordIndex] += this.regionHeight;\n\n vec3.transformMat4(out, out, this.transform);\n\n return out;\n },\n\n pointToData: function (point, out) {\n // TODO\n }\n};\n\nexport default Geo3D;","import Geo3D from './geo3D/Geo3D';\nimport * as echarts from 'echarts/lib/echarts';\nimport {getLayoutRect} from 'echarts/lib/util/layout';\nimport ViewGL from '../core/ViewGL';\nimport retrieve from '../util/retrieve';\n\nfunction resizeGeo3D(geo3DModel, api) {\n // Use left/top/width/height\n var boxLayoutOption = geo3DModel.getBoxLayoutParams();\n\n var viewport = getLayoutRect(boxLayoutOption, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n\n // Flip Y\n viewport.y = api.getHeight() - viewport.y - viewport.height;\n\n this.viewGL.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, api.getDevicePixelRatio());\n\n var geoRect = this.getGeoBoundingRect();\n var aspect = geoRect.width / geoRect.height * (geo3DModel.get('aspectScale') || 0.75);\n\n var width = geo3DModel.get('boxWidth');\n var depth = geo3DModel.get('boxDepth');\n var height = geo3DModel.get('boxHeight');\n if (height == null) {\n height = 5;\n }\n if (isNaN(width) && isNaN(depth)) {\n // Default to have 100 width\n width = 100;\n }\n if (isNaN(depth)) {\n depth = width / aspect;\n }\n else if (isNaN(width)) {\n width = depth / aspect;\n }\n\n this.setSize(width, height, depth);\n\n this.regionHeight = geo3DModel.get('regionHeight');\n\n if (this.altitudeAxis) {\n this.altitudeAxis.setExtent(0, Math.max(height - this.regionHeight, 0));\n }\n}\n\nfunction updateGeo3D(ecModel, api) {\n\n var altitudeDataExtent = [Infinity, -Infinity];\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.coordinateSystem !== this) {\n return;\n }\n if (seriesModel.type === 'series.map3D') {\n return;\n }\n // Get altitude data extent.\n var data = seriesModel.getData();\n var altDims = seriesModel.coordDimToDataDim('alt');\n var altDim = altDims && altDims[0];\n if (altDim) {\n // TODO altitiude is in coords of lines.\n var dataExtent = data.getDataExtent(altDim, true);\n altitudeDataExtent[0] = Math.min(\n altitudeDataExtent[0], dataExtent[0]\n );\n altitudeDataExtent[1] = Math.max(\n altitudeDataExtent[1], dataExtent[1]\n );\n }\n }, this);\n // Create altitude axis\n if (altitudeDataExtent && isFinite(altitudeDataExtent[1] - altitudeDataExtent[0])) {\n var scale = echarts.helper.createScale(\n altitudeDataExtent, {\n type: 'value',\n // PENDING\n min: 'dataMin',\n max: 'dataMax'\n }\n );\n this.altitudeAxis = new echarts.Axis('altitude', scale);\n // Resize again\n this.resize(this.model, api);\n }\n}\n\n\nif (process.env.NODE_ENV !== 'production') {\n var mapNotExistsError = function (name) {\n console.error('Map ' + name + ' not exists. You can download map file on http://echarts.baidu.com/download-map.html');\n };\n}\n\n\nvar idStart = 0;\n\nvar geo3DCreator = {\n\n dimensions: Geo3D.prototype.dimensions,\n\n create: function (ecModel, api) {\n\n var geo3DList = [];\n\n if (!echarts.getMap) {\n throw new Error('geo3D component depends on geo component');\n }\n\n function createGeo3D(componentModel, idx) {\n\n var geo3D = geo3DCreator.createGeo3D(componentModel);\n\n // FIXME\n componentModel.__viewGL = componentModel.__viewGL || new ViewGL();\n\n geo3D.viewGL = componentModel.__viewGL;\n\n componentModel.coordinateSystem = geo3D;\n geo3D.model = componentModel;\n\n geo3DList.push(geo3D);\n\n // Inject resize\n geo3D.resize = resizeGeo3D;\n geo3D.resize(componentModel, api);\n\n geo3D.update = updateGeo3D;\n }\n\n ecModel.eachComponent('geo3D', function (geo3DModel, idx) {\n createGeo3D(geo3DModel, idx);\n });\n\n ecModel.eachSeriesByType('map3D', function (map3DModel, idx) {\n var coordSys = map3DModel.get('coordinateSystem');\n if (coordSys == null) {\n coordSys = 'geo3D';\n }\n if (coordSys === 'geo3D') {\n createGeo3D(map3DModel, idx);\n }\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === 'geo3D') {\n if (seriesModel.type === 'series.map3D') {\n return;\n }\n var geo3DModel = seriesModel.getReferringComponents('geo3D').models[0];\n if (!geo3DModel) {\n geo3DModel = ecModel.getComponent('geo3D');\n }\n\n if (!geo3DModel) {\n throw new Error('geo \"' + retrieve.firstNotNull(\n seriesModel.get('geo3DIndex'),\n seriesModel.get('geo3DId'),\n 0\n ) + '\" not found');\n }\n\n seriesModel.coordinateSystem = geo3DModel.coordinateSystem;\n }\n });\n\n return geo3DList;\n },\n\n createGeo3D: function (componentModel) {\n\n var mapData = componentModel.get('map');\n var name;\n if (typeof mapData === 'string') {\n name = mapData;\n mapData = echarts.getMap(mapData);\n }\n else {\n if (mapData && mapData.features) {\n mapData = {\n geoJson: mapData\n };\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n if (!mapData) {\n mapNotExistsError(mapData);\n }\n if (!mapData.geoJson.features) {\n throw new Error('Invalid GeoJSON for map3D');\n }\n }\n if (name == null) {\n name = 'GEO_ANONYMOUS_' + idStart++;\n }\n\n return new Geo3D(\n name + idStart++, name,\n mapData && mapData.geoJson, mapData && mapData.specialAreas,\n componentModel.get('nameMap')\n );\n }\n};\n\nexport default geo3DCreator;","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Geo3DModel from './Geo3DModel';\nimport Geo3DView from './Geo3DView';\nimport geo3DCreator from '../../coord/geo3DCreator';\n\nexport function install(registers) {\n registers.registerComponentModel(Geo3DModel);\n registers.registerComponentView(Geo3DView);\n\n registers.registerAction({\n type: 'geo3DChangeCamera',\n event: 'geo3dcamerachanged',\n update: 'series:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'geo3D', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n\n registers.registerCoordinateSystem('geo3D', geo3DCreator);\n\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './geo3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport componentViewControlMixin from '../common/componentViewControlMixin';\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\nimport componentShadingMixin from '../common/componentShadingMixin';\n\n\nfunction defaultId(option, idx) {\n option.id = option.id || option.name || (idx + '');\n}\nvar GlobeModel = echarts.ComponentModel.extend({\n\n type: 'globe',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n init: function () {\n GlobeModel.superApply(this, 'init', arguments);\n\n echarts.util.each(this.option.layers, function (layerOption, idx) {\n echarts.util.merge(layerOption, this.defaultLayerOption);\n defaultId(layerOption, idx);\n }, this);\n },\n\n mergeOption: function (option) {\n // TODO test\n var oldLayers = this.option.layers;\n this.option.layers = null;\n GlobeModel.superApply(this, 'mergeOption', arguments);\n\n function createLayerMap(layers) {\n return echarts.util.reduce(layers, function (obj, layerOption, idx) {\n defaultId(layerOption, idx);\n obj[layerOption.id] = layerOption;\n return obj;\n }, {});\n }\n if (oldLayers && oldLayers.length) {\n var newLayerMap = createLayerMap(option.layers);\n var oldLayerMap = createLayerMap(oldLayers);\n for (var id in newLayerMap) {\n if (oldLayerMap[id]) {\n echarts.util.merge(oldLayerMap[id], newLayerMap[id], true);\n }\n else {\n oldLayers.push(option.layers[id]);\n }\n }\n // Copy back\n this.option.layers = oldLayers;\n }\n // else overwrite\n\n // Set default\n echarts.util.each(this.option.layers, function (layerOption) {\n echarts.util.merge(layerOption, this.defaultLayerOption);\n }, this);\n },\n\n optionUpdated: function () {\n this.updateDisplacementHash();\n },\n\n defaultLayerOption: {\n show: true,\n type: 'overlay'\n },\n\n defaultOption: {\n\n show: true,\n\n zlevel: -10,\n\n // Layout used for viewport\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n\n environment: 'auto',\n\n baseColor: '#fff',\n\n // Base albedo texture\n baseTexture: '',\n\n // Height texture for bump mapping and vertex displacement\n heightTexture: '',\n\n // Texture for vertex displacement, default use heightTexture\n displacementTexture: '',\n // Scale of vertex displacement, available only if displacementTexture is set.\n displacementScale: 0,\n\n // Detail of displacement. 'low', 'medium', 'high', 'ultra'\n displacementQuality: 'medium',\n\n // Globe radius\n globeRadius: 100,\n\n // Globe outer radius. Which is max of altitude.\n globeOuterRadius: 150,\n\n // Shading of globe\n shading: 'lambert',\n\n // Extend light\n light: {\n // Main sun light\n main: {\n // Time, default it will use system time\n time: ''\n }\n },\n\n // atmosphere\n atmosphere: {\n show: false,\n offset: 5,\n color: '#ffffff',\n glowPower: 6.0,\n innerGlowPower: 2.0\n },\n\n // light\n // postEffect\n // temporalSuperSampling\n\n viewControl: {\n autoRotate: true,\n\n panSensitivity: 0,\n\n targetCoord: null\n },\n\n\n // {\n // show: true,\n // name: 'cloud',\n // type: 'overlay',\n // shading: 'lambert',\n // distance: 10,\n // texture: ''\n // }\n // {\n // type: 'blend',\n // blendTo: 'albedo'\n // blendType: 'source-over'\n // }\n\n layers: []\n },\n\n setDisplacementData: function (data, width, height) {\n this.displacementData = data;\n this.displacementWidth = width;\n this.displacementHeight = height;\n },\n\n getDisplacementTexture: function () {\n return this.get('displacementTexture') || this.get('heightTexture');\n },\n\n getDisplacemenScale: function () {\n var displacementTexture = this.getDisplacementTexture();\n var displacementScale = this.get('displacementScale');\n if (!displacementTexture || displacementTexture === 'none') {\n displacementScale = 0;\n }\n return displacementScale;\n },\n\n hasDisplacement: function () {\n return this.getDisplacemenScale() > 0;\n },\n\n _displacementChanged: true,\n\n _displacementScale: 0,\n\n updateDisplacementHash: function () {\n var displacementTexture = this.getDisplacementTexture();\n var displacementScale = this.getDisplacemenScale();\n\n this._displacementChanged =\n this._displacementTexture !== displacementTexture\n || this._displacementScale !== displacementScale;\n\n this._displacementTexture = displacementTexture;\n this._displacementScale = displacementScale;\n },\n\n isDisplacementChanged: function () {\n return this._displacementChanged;\n }\n});\n\necharts.util.merge(GlobeModel.prototype, componentViewControlMixin);\necharts.util.merge(GlobeModel.prototype, componentPostEffectMixin);\necharts.util.merge(GlobeModel.prototype, componentLightMixin);\necharts.util.merge(GlobeModel.prototype, componentShadingMixin);\n\nexport default GlobeModel;","/*\n (c) 2011-2014, Vladimir Agafonkin\n SunCalc is a JavaScript library for calculating sun/mooon position and light phases.\n https://github.com/mourner/suncalc\n*/\n\n// shortcuts for easier to read formulas\n\nvar PI = Math.PI,\n sin = Math.sin,\n cos = Math.cos,\n tan = Math.tan,\n asin = Math.asin,\n atan = Math.atan2,\n rad = PI / 180;\n\n// sun calculations are based on http://aa.quae.nl/en/reken/zonpositie.html formulas\n\n\n// date/time constants and conversions\n\nvar dayMs = 1000 * 60 * 60 * 24,\n J1970 = 2440588,\n J2000 = 2451545;\n\nfunction toJulian (date) { return date.valueOf() / dayMs - 0.5 + J1970; }\nfunction toDays (date) { return toJulian(date) - J2000; }\n\n\n// general calculations for position\n\nvar e = rad * 23.4397; // obliquity of the Earth\n\nfunction rightAscension(l, b) { return atan(sin(l) * cos(e) - tan(b) * sin(e), cos(l)); }\nfunction declination(l, b) { return asin(sin(b) * cos(e) + cos(b) * sin(e) * sin(l)); }\n\nfunction azimuth(H, phi, dec) { return atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi)); }\nfunction altitude(H, phi, dec) { return asin(sin(phi) * sin(dec) + cos(phi) * cos(dec) * cos(H)); }\n\nfunction siderealTime(d, lw) { return rad * (280.16 + 360.9856235 * d) - lw; }\n\n\n// general sun calculations\n\nfunction solarMeanAnomaly(d) { return rad * (357.5291 + 0.98560028 * d); }\n\nfunction eclipticLongitude(M) {\n\n var C = rad * (1.9148 * sin(M) + 0.02 * sin(2 * M) + 0.0003 * sin(3 * M)), // equation of center\n P = rad * 102.9372; // perihelion of the Earth\n\n return M + C + P + PI;\n}\n\nfunction sunCoords(d) {\n\n var M = solarMeanAnomaly(d),\n L = eclipticLongitude(M);\n\n return {\n dec: declination(L, 0),\n ra: rightAscension(L, 0)\n };\n}\n\nvar SunCalc = {};\n\n// calculates sun position for a given date and latitude/longitude\n\nSunCalc.getPosition = function (date, lat, lng) {\n\n var lw = rad * -lng,\n phi = rad * lat,\n d = toDays(date),\n\n c = sunCoords(d),\n H = siderealTime(d, lw) - c.ra;\n\n return {\n azimuth: azimuth(H, phi, c.dec),\n altitude: altitude(H, phi, c.dec)\n };\n};\n\nexport default SunCalc;","export default \"@export ecgl.atmosphere.vertex\\nattribute vec3 position: POSITION;\\nattribute vec3 normal : NORMAL;\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\\n\\nvarying vec3 v_Normal;\\n\\nvoid main() {\\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n}\\n@end\\n\\n\\n@export ecgl.atmosphere.fragment\\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\\nuniform float glowPower;\\nuniform vec3 glowColor;\\n\\nvarying vec3 v_Normal;\\n\\nvoid main() {\\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\\n gl_FragColor = vec4(glowColor, intensity * intensity);\\n}\\n@end\";\n","import * as echarts from 'echarts/lib/echarts';\n\nimport graphicGL from '../../util/graphicGL';\nimport OrbitControl from '../../util/OrbitControl';\nimport SceneHelper from '../common/SceneHelper';\n\nimport sunCalc from '../../util/sunCalc';\nimport retrieve from '../../util/retrieve';\n\nimport utilShaderCode from 'claygl/src/shader/source/util.glsl.js';\nimport atmosphereShaderCode from './atmosphere.glsl.js';\n\ngraphicGL.Shader['import'](utilShaderCode);\ngraphicGL.Shader['import'](atmosphereShaderCode);\n\nexport default echarts.ComponentView.extend({\n\n type: 'globe',\n\n __ecgl__: true,\n\n _displacementScale: 0,\n\n init: function (ecModel, api) {\n this.groupGL = new graphicGL.Node();\n\n /**\n * @type {clay.geometry.Sphere}\n * @private\n */\n this._sphereGeometry = new graphicGL.SphereGeometry({\n widthSegments: 200,\n heightSegments: 100,\n dynamic: true\n });\n this._overlayGeometry = new graphicGL.SphereGeometry({\n widthSegments: 80,\n heightSegments: 40\n });\n\n /**\n * @type {clay.geometry.Plane}\n */\n this._planeGeometry = new graphicGL.PlaneGeometry();\n\n /**\n * @type {clay.geometry.Mesh}\n */\n this._earthMesh = new graphicGL.Mesh({\n renderNormal: true\n });\n\n /**\n * @type {clay.geometry.Mesh}\n */\n this._atmosphereMesh = new graphicGL.Mesh();\n this._atmosphereGeometry = new graphicGL.SphereGeometry({\n widthSegments: 80,\n heightSegments: 40\n });\n this._atmosphereMaterial = new graphicGL.Material({\n shader: new graphicGL.Shader(\n graphicGL.Shader.source('ecgl.atmosphere.vertex'),\n graphicGL.Shader.source('ecgl.atmosphere.fragment')\n ),\n transparent: true\n });\n this._atmosphereMesh.geometry = this._atmosphereGeometry;\n this._atmosphereMesh.material = this._atmosphereMaterial;\n this._atmosphereMesh.frontFace = graphicGL.Mesh.CW;\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper();\n this._sceneHelper.initLight(this._lightRoot);\n\n this.groupGL.add(this._atmosphereMesh);\n this.groupGL.add(this._earthMesh);\n\n this._control = new OrbitControl({\n zr: api.getZr()\n });\n\n this._control.init();\n\n this._layerMeshes = {};\n },\n\n render: function (globeModel, ecModel, api) {\n var coordSys = globeModel.coordinateSystem;\n var shading = globeModel.get('shading');\n\n // Always have light.\n coordSys.viewGL.add(this._lightRoot);\n\n if (globeModel.get('show')) {\n // Add self to scene;\n coordSys.viewGL.add(this.groupGL);\n }\n else {\n coordSys.viewGL.remove(this.groupGL);\n }\n\n this._sceneHelper.setScene(coordSys.viewGL.scene);\n\n // Set post effect\n coordSys.viewGL.setPostEffect(globeModel.getModel('postEffect'), api);\n coordSys.viewGL.setTemporalSuperSampling(globeModel.getModel('temporalSuperSampling'));\n\n var earthMesh = this._earthMesh;\n\n earthMesh.geometry = this._sphereGeometry;\n\n var shadingPrefix = 'ecgl.' + shading;\n if (!earthMesh.material || earthMesh.material.shader.name !== shadingPrefix) {\n earthMesh.material = graphicGL.createMaterial(shadingPrefix);\n }\n\n graphicGL.setMaterialFromModel(\n shading, earthMesh.material, globeModel, api\n );\n ['roughnessMap', 'metalnessMap', 'detailMap', 'normalMap'].forEach(function (texName) {\n var texture = earthMesh.material.get(texName);\n if (texture) {\n texture.flipY = false;\n }\n });\n\n earthMesh.material.set('color', graphicGL.parseColor(\n globeModel.get('baseColor')\n ));\n\n // shrink a little\n var scale = coordSys.radius * 0.99;\n earthMesh.scale.set(scale, scale, scale);\n\n if (globeModel.get('atmosphere.show')) {\n earthMesh.material.define('both', 'ATMOSPHERE_ENABLED');\n this._atmosphereMesh.invisible = false;\n this._atmosphereMaterial.setUniforms({\n glowPower: globeModel.get('atmosphere.glowPower') || 6.0,\n glowColor: globeModel.get('atmosphere.color') || '#ffffff'\n });\n earthMesh.material.setUniforms({\n glowPower: globeModel.get('atmosphere.innerGlowPower') || 2.0,\n glowColor: globeModel.get('atmosphere.color') || '#ffffff'\n });\n var offset = globeModel.get('atmosphere.offset') || 5;\n this._atmosphereMesh.scale.set(scale + offset, scale + offset, scale + offset);\n }\n else {\n earthMesh.material.undefine('both', 'ATMOSPHERE_ENABLED');\n this._atmosphereMesh.invisible = true;\n }\n\n var diffuseTexture = earthMesh.material.setTextureImage('diffuseMap', globeModel.get('baseTexture'), api, {\n flipY: false,\n anisotropic: 8\n });\n if (diffuseTexture && diffuseTexture.surface) {\n diffuseTexture.surface.attachToMesh(earthMesh);\n }\n\n // Update bump map\n var bumpTexture = earthMesh.material.setTextureImage('bumpMap', globeModel.get('heightTexture'), api, {\n flipY: false,\n anisotropic: 8\n });\n if (bumpTexture && bumpTexture.surface) {\n bumpTexture.surface.attachToMesh(earthMesh);\n }\n\n earthMesh.material[globeModel.get('postEffect.enable') ? 'define' : 'undefine']('fragment', 'SRGB_DECODE');\n\n this._updateLight(globeModel, api);\n\n this._displaceVertices(globeModel, api);\n\n this._updateViewControl(globeModel, api);\n\n this._updateLayers(globeModel, api);\n },\n\n afterRender: function (globeModel, ecModel, api, layerGL) {\n // Create ambient cubemap after render because we need to know the renderer.\n // TODO\n var renderer = layerGL.renderer;\n\n this._sceneHelper.updateAmbientCubemap(renderer, globeModel, api);\n\n this._sceneHelper.updateSkybox(renderer, globeModel, api);\n },\n\n\n _updateLayers: function (globeModel, api) {\n var coordSys = globeModel.coordinateSystem;\n var layers = globeModel.get('layers');\n\n var lastDistance = coordSys.radius;\n var layerDiffuseTextures = [];\n var layerDiffuseIntensity = [];\n\n var layerEmissiveTextures = [];\n var layerEmissionIntensity = [];\n echarts.util.each(layers, function (layerOption) {\n var layerModel = new echarts.Model(layerOption);\n var layerType = layerModel.get('type');\n\n var texture = graphicGL.loadTexture(layerModel.get('texture'), api, {\n flipY: false,\n anisotropic: 8\n });\n if (texture.surface) {\n texture.surface.attachToMesh(this._earthMesh);\n }\n\n if (layerType === 'blend') {\n var blendTo = layerModel.get('blendTo');\n var intensity = retrieve.firstNotNull(layerModel.get('intensity'), 1.0);\n if (blendTo === 'emission') {\n layerEmissiveTextures.push(texture);\n layerEmissionIntensity.push(intensity);\n }\n else { // Default is albedo\n layerDiffuseTextures.push(texture);\n layerDiffuseIntensity.push(intensity);\n }\n }\n else { // Default use overlay\n var id = layerModel.get('id');\n var overlayMesh = this._layerMeshes[id];\n if (!overlayMesh) {\n overlayMesh = this._layerMeshes[id] = new graphicGL.Mesh({\n geometry: this._overlayGeometry,\n castShadow: false,\n ignorePicking: true\n });\n }\n var shading = layerModel.get('shading');\n\n if (shading === 'lambert') {\n overlayMesh.material = overlayMesh.__lambertMaterial || new graphicGL.Material({\n autoUpdateTextureStatus: false,\n shader: graphicGL.createShader('ecgl.lambert'),\n transparent: true,\n depthMask: false\n });\n overlayMesh.__lambertMaterial = overlayMesh.material;\n }\n else { // color\n overlayMesh.material = overlayMesh.__colorMaterial || new graphicGL.Material({\n autoUpdateTextureStatus: false,\n shader: graphicGL.createShader('ecgl.color'),\n transparent: true,\n depthMask: false\n });\n overlayMesh.__colorMaterial = overlayMesh.material;\n }\n // overlay should be transparent if texture is not loaded yet.\n overlayMesh.material.enableTexture('diffuseMap');\n\n var distance = layerModel.get('distance');\n // Based on distance of last layer\n var radius = lastDistance + (distance == null ? coordSys.radius / 100 : distance);\n overlayMesh.scale.set(radius, radius, radius);\n\n lastDistance = radius;\n\n // FIXME Exists blink.\n var blankTexture = this._blankTexture || (this._blankTexture = graphicGL.createBlankTexture('rgba(255, 255, 255, 0)'));\n overlayMesh.material.set('diffuseMap', blankTexture);\n\n graphicGL.loadTexture(layerModel.get('texture'), api, {\n flipY: false,\n anisotropic: 8\n }, function (texture) {\n if (texture.surface) {\n texture.surface.attachToMesh(overlayMesh);\n }\n overlayMesh.material.set('diffuseMap', texture);\n api.getZr().refresh();\n });\n\n layerModel.get('show') ? this.groupGL.add(overlayMesh) : this.groupGL.remove(overlayMesh);\n }\n }, this);\n\n var earthMaterial = this._earthMesh.material;\n earthMaterial.define('fragment', 'LAYER_DIFFUSEMAP_COUNT', layerDiffuseTextures.length);\n earthMaterial.define('fragment', 'LAYER_EMISSIVEMAP_COUNT', layerEmissiveTextures.length);\n\n earthMaterial.set('layerDiffuseMap', layerDiffuseTextures);\n earthMaterial.set('layerDiffuseIntensity', layerDiffuseIntensity);\n earthMaterial.set('layerEmissiveMap', layerEmissiveTextures);\n earthMaterial.set('layerEmissionIntensity', layerEmissionIntensity);\n\n var debugWireframeModel = globeModel.getModel('debug.wireframe');\n if (debugWireframeModel.get('show')) {\n earthMaterial.define('both', 'WIREFRAME_TRIANGLE');\n var color = graphicGL.parseColor(\n debugWireframeModel.get('lineStyle.color') || 'rgba(0,0,0,0.5)'\n );\n var width = retrieve.firstNotNull(\n debugWireframeModel.get('lineStyle.width'), 1\n );\n earthMaterial.set('wireframeLineWidth', width);\n earthMaterial.set('wireframeLineColor', color);\n }\n else {\n earthMaterial.undefine('both', 'WIREFRAME_TRIANGLE');\n }\n },\n\n _updateViewControl: function (globeModel, api) {\n var coordSys = globeModel.coordinateSystem;\n // Update camera\n var viewControlModel = globeModel.getModel('viewControl');\n\n var camera = coordSys.viewGL.camera;\n var self = this;\n\n function makeAction() {\n return {\n type: 'globeChangeCamera',\n alpha: control.getAlpha(),\n beta: control.getBeta(),\n distance: control.getDistance() - coordSys.radius,\n center: control.getCenter(),\n from: self.uid,\n globeId: globeModel.id\n };\n }\n\n // Update control\n var control = this._control;\n control.setViewGL(coordSys.viewGL);\n\n var coord = viewControlModel.get('targetCoord');\n var alpha, beta;\n if (coord != null) {\n beta = coord[0] + 90;\n alpha = coord[1];\n }\n\n control.setFromViewControlModel(viewControlModel, {\n baseDistance: coordSys.radius,\n alpha: alpha,\n beta: beta\n });\n\n control.off('update');\n control.on('update', function () {\n api.dispatchAction(makeAction());\n });\n },\n\n _displaceVertices: function (globeModel, api) {\n var displacementQuality = globeModel.get('displacementQuality');\n var showDebugWireframe = globeModel.get('debug.wireframe.show');\n var globe = globeModel.coordinateSystem;\n\n if (!globeModel.isDisplacementChanged()\n && displacementQuality === this._displacementQuality\n && showDebugWireframe === this._showDebugWireframe\n ) {\n return;\n }\n\n this._displacementQuality = displacementQuality;\n this._showDebugWireframe = showDebugWireframe;\n\n var geometry = this._sphereGeometry;\n\n var widthSegments = ({\n low: 100,\n medium: 200,\n high: 400,\n ultra: 800\n })[displacementQuality] || 200;\n var heightSegments = widthSegments / 2;\n if (geometry.widthSegments !== widthSegments || showDebugWireframe) {\n geometry.widthSegments = widthSegments;\n geometry.heightSegments = heightSegments;\n geometry.build();\n }\n\n this._doDisplaceVertices(geometry, globe);\n\n if (showDebugWireframe) {\n geometry.generateBarycentric();\n }\n },\n\n _doDisplaceVertices: function (geometry, globe) {\n var positionArr = geometry.attributes.position.value;\n var uvArr = geometry.attributes.texcoord0.value;\n\n var originalPositionArr = geometry.__originalPosition;\n if (!originalPositionArr || originalPositionArr.length !== positionArr.length) {\n originalPositionArr = new Float32Array(positionArr.length);\n originalPositionArr.set(positionArr);\n geometry.__originalPosition = originalPositionArr;\n }\n\n var width = globe.displacementWidth;\n var height = globe.displacementHeight;\n var data = globe.displacementData;\n\n for (var i = 0; i < geometry.vertexCount; i++) {\n var i3 = i * 3;\n var i2 = i * 2;\n var x = originalPositionArr[i3 + 1];\n var y = originalPositionArr[i3 + 2];\n var z = originalPositionArr[i3 + 3];\n\n var u = uvArr[i2++];\n var v = uvArr[i2++];\n\n var j = Math.round(u * (width - 1));\n var k = Math.round(v * (height - 1));\n var idx = k * width + j;\n var scale = data ? data[idx] : 0;\n\n positionArr[i3 + 1] = x + x * scale;\n positionArr[i3 + 2] = y + y * scale;\n positionArr[i3 + 3] = z + z * scale;\n }\n\n geometry.generateVertexNormals();\n geometry.dirty();\n\n geometry.updateBoundingBox();\n },\n\n _updateLight: function (globeModel, api) {\n var earthMesh = this._earthMesh;\n\n this._sceneHelper.updateLight(globeModel);\n var mainLight = this._sceneHelper.mainLight;\n\n // Put sun in the right position\n var time = globeModel.get('light.main.time') || new Date();\n\n // http://en.wikipedia.org/wiki/Azimuth\n var pos = sunCalc.getPosition(echarts.number.parseDate(time), 0, 0);\n var r0 = Math.cos(pos.altitude);\n // FIXME How to calculate the y ?\n mainLight.position.y = -r0 * Math.cos(pos.azimuth);\n mainLight.position.x = Math.sin(pos.altitude);\n mainLight.position.z = r0 * Math.sin(pos.azimuth);\n mainLight.lookAt(earthMesh.getWorldPosition());\n },\n\n dispose: function (ecModel, api) {\n this.groupGL.removeAll();\n this._control.dispose();\n }\n});","import glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\n\nfunction Globe(radius) {\n\n this.radius = radius;\n\n this.viewGL = null;\n\n this.altitudeAxis;\n\n // Displacement data provided by texture.\n this.displacementData = null;\n this.displacementWidth;\n this.displacementHeight;\n}\n\nGlobe.prototype = {\n\n constructor: Globe,\n\n dimensions: ['lng', 'lat', 'alt'],\n\n type: 'globe',\n\n containPoint: function () {},\n\n setDisplacementData: function (data, width, height) {\n this.displacementData = data;\n this.displacementWidth = width;\n this.displacementHeight = height;\n },\n\n _getDisplacementScale: function (lng, lat) {\n var i = (lng + 180) / 360 * (this.displacementWidth - 1);\n var j = (90 - lat) / 180 * (this.displacementHeight - 1);\n // NEAREST SAMPLING\n // TODO Better bilinear sampling\n var idx = Math.round(i) + Math.round(j) * this.displacementWidth;\n return this.displacementData[idx];\n },\n\n dataToPoint: function (data, out) {\n var lng = data[0];\n var lat = data[1];\n // Default have 0 altitude\n var altVal = data[2] || 0;\n\n var r = this.radius;\n if (this.displacementData) {\n r *= 1 + this._getDisplacementScale(lng, lat);\n }\n if (this.altitudeAxis) {\n r += this.altitudeAxis.dataToCoord(altVal);\n }\n\n lng = lng * Math.PI / 180;\n lat = lat * Math.PI / 180;\n\n var r0 = Math.cos(lat) * r;\n\n out = out || [];\n // PENDING\n out[0] = -r0 * Math.cos(lng + Math.PI);\n out[1] = Math.sin(lat) * r;\n out[2] = r0 * Math.sin(lng + Math.PI);\n\n return out;\n },\n\n pointToData: function (point, out) {\n var x = point[0];\n var y = point[1];\n var z = point[2];\n var len = vec3.len(point);\n x /= len;\n y /= len;\n z /= len;\n\n var theta = Math.asin(y);\n var phi = Math.atan2(z, -x);\n if (phi < 0) {\n phi = Math.PI * 2 + phi;\n }\n\n var lat = theta * 180 / Math.PI;\n var lng = phi * 180 / Math.PI - 180;\n\n out = out || [];\n out[0] = lng;\n out[1] = lat;\n out[2] = len - this.radius;\n if (this.altitudeAxis) {\n out[2] = this.altitudeAxis.coordToData(out[2]);\n }\n\n return out;\n }\n};\n\nexport default Globe;","import Globe from './globe/Globe';\nimport * as echarts from 'echarts/lib/echarts';\nimport {getLayoutRect} from 'echarts/lib/util/layout';\nimport ViewGL from '../core/ViewGL';\nimport retrieve from '../util/retrieve';\nimport graphicGL from '../util/graphicGL';\n\nfunction getDisplacementData(img, displacementScale) {\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n var width = img.width;\n var height = img.height;\n canvas.width = width;\n canvas.height = height;\n ctx.drawImage(img, 0, 0, width, height);\n var rgbaArr = ctx.getImageData(0, 0, width, height).data;\n\n var displacementArr = new Float32Array(rgbaArr.length / 4);\n for (var i = 0; i < rgbaArr.length / 4; i++) {\n var x = rgbaArr[i * 4];\n displacementArr[i] = x / 255 * displacementScale;\n }\n return {\n data: displacementArr,\n width: width,\n height: height\n };\n}\n\nfunction resizeGlobe(globeModel, api) {\n // Use left/top/width/height\n var boxLayoutOption = globeModel.getBoxLayoutParams();\n\n var viewport = getLayoutRect(boxLayoutOption, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n\n // Flip Y\n viewport.y = api.getHeight() - viewport.y - viewport.height;\n\n this.viewGL.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, api.getDevicePixelRatio());\n\n this.radius = globeModel.get('globeRadius');\n\n var outerRadius = globeModel.get('globeOuterRadius');\n if (this.altitudeAxis) {\n this.altitudeAxis.setExtent(0, outerRadius - this.radius);\n }\n}\n\nfunction updateGlobe(ecModel, api) {\n\n var altitudeDataExtent = [Infinity, -Infinity];\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.coordinateSystem !== this) {\n return;\n }\n\n // Get altitude data extent.\n var data = seriesModel.getData();\n var altDims = seriesModel.coordDimToDataDim('alt');\n var altDim = altDims && altDims[0];\n if (altDim) {\n // TODO altitiude is in coords of lines.\n var dataExtent = data.getDataExtent(altDim, true);\n altitudeDataExtent[0] = Math.min(\n altitudeDataExtent[0], dataExtent[0]\n );\n altitudeDataExtent[1] = Math.max(\n altitudeDataExtent[1], dataExtent[1]\n );\n }\n }, this);\n // Create altitude axis\n if (altitudeDataExtent && isFinite(altitudeDataExtent[1] - altitudeDataExtent[0])) {\n var scale = echarts.helper.createScale(\n altitudeDataExtent, {\n type: 'value',\n // PENDING\n min: 'dataMin',\n max: 'dataMax'\n }\n );\n this.altitudeAxis = new echarts.Axis('altitude', scale);\n // Resize again\n this.resize(this.model, api);\n }\n}\n\nvar globeCreator = {\n\n dimensions: Globe.prototype.dimensions,\n\n create: function (ecModel, api) {\n\n var globeList = [];\n\n ecModel.eachComponent('globe', function (globeModel) {\n\n // FIXME\n globeModel.__viewGL = globeModel.__viewGL || new ViewGL();\n\n var globe = new Globe();\n globe.viewGL = globeModel.__viewGL;\n\n globeModel.coordinateSystem = globe;\n globe.model = globeModel;\n globeList.push(globe);\n\n // Inject resize\n globe.resize = resizeGlobe;\n globe.resize(globeModel, api);\n\n globe.update = updateGlobe;\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === 'globe') {\n var globeModel = seriesModel.getReferringComponents('globe').models[0];\n if (!globeModel) {\n globeModel = ecModel.getComponent('globe');\n }\n\n if (!globeModel) {\n throw new Error('globe \"' + retrieve.firstNotNull(\n seriesModel.get('globe3DIndex'),\n seriesModel.get('globe3DId'),\n 0\n ) + '\" not found');\n }\n\n var coordSys = globeModel.coordinateSystem;\n\n seriesModel.coordinateSystem = coordSys;\n }\n });\n\n ecModel.eachComponent('globe', function (globeModel, idx) {\n var globe = globeModel.coordinateSystem;\n\n // Update displacement data\n var displacementTextureValue = globeModel.getDisplacementTexture();\n var displacementScale = globeModel.getDisplacemenScale();\n\n if (globeModel.isDisplacementChanged()) {\n if (globeModel.hasDisplacement()) {\n var immediateLoaded = true;\n graphicGL.loadTexture(displacementTextureValue, api, function (texture) {\n var img = texture.image;\n var displacementData = getDisplacementData(img, displacementScale);\n globeModel.setDisplacementData(displacementData.data, displacementData.width, displacementData.height);\n if (!immediateLoaded) {\n // Update layouts\n api.dispatchAction({\n type: 'globeUpdateDisplacment'\n });\n }\n });\n immediateLoaded = false;\n }\n else {\n globe.setDisplacementData(null, 0, 0);\n }\n\n globe.setDisplacementData(\n globeModel.displacementData, globeModel.displacementWidth, globeModel.displacementHeight\n );\n }\n });\n\n return globeList;\n }\n};\n\nexport default globeCreator;","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport GlobeModel from './GlobeModel';\nimport GlobeView from './GlobeView';\nimport globeCreator from '../../coord/globeCreator';\n\nexport function install(registers) {\n registers.registerComponentModel(GlobeModel);\n registers.registerComponentView(GlobeView);\n\n registers.registerCoordinateSystem('globe', globeCreator);\n\n registers.registerAction({\n type: 'globeChangeCamera',\n event: 'globecamerachanged',\n update: 'series:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'globe', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n\n registers.registerAction({\n type: 'globeUpdateDisplacment',\n event: 'globedisplacementupdated',\n update: 'update'\n }, function (payload, ecModel) {\n // Noop\n });\n\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './globe/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\n\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\n\nvar MAPBOX_CAMERA_OPTION = ['zoom', 'center', 'pitch', 'bearing'];\n\nvar Mapbox3DModel = echarts.ComponentModel.extend({\n\n type: 'mapbox3D',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n defaultOption: {\n zlevel: -10,\n\n style: 'mapbox://styles/mapbox/light-v9',\n\n center: [0, 0],\n\n zoom: 0,\n\n pitch: 0,\n\n bearing: 0,\n\n light: {\n main: {\n alpha: 20,\n beta: 30\n }\n },\n\n altitudeScale: 1,\n // Default depend on altitudeScale\n boxHeight: 'auto'\n },\n\n getMapboxCameraOption: function () {\n var self = this;\n return MAPBOX_CAMERA_OPTION.reduce(function (obj, key) {\n obj[key] = self.get(key);\n return obj;\n }, {});\n },\n\n setMapboxCameraOption: function (option) {\n if (option != null) {\n MAPBOX_CAMERA_OPTION.forEach(function (key) {\n if (option[key] != null) {\n this.option[key] = option[key];\n }\n }, this);\n }\n },\n\n /**\n * Get mapbox instance\n */\n getMapbox: function () {\n return this._mapbox;\n },\n\n setMapbox: function (mapbox) {\n this._mapbox = mapbox;\n }\n});\n\necharts.util.merge(Mapbox3DModel.prototype, componentPostEffectMixin);\necharts.util.merge(Mapbox3DModel.prototype, componentLightMixin);\n\nexport default Mapbox3DModel;","/**\n * @constructor\n * @alias module:echarts-gl/component/mapbox3D/Mapbox3DLayer\n * @param {string} id Layer ID\n * @param {module:zrender/ZRender} zr\n */\nfunction Mapbox3DLayer (id, zr) {\n this.id = id;\n this.zr = zr;\n\n this.dom = document.createElement('div');\n this.dom.style.cssText = 'position:absolute;left:0;right:0;top:0;bottom:0;';\n\n // FIXME If in module environment.\n if (!mapboxgl) {\n throw new Error('Mapbox GL library must be included. See https://www.mapbox.com/mapbox-gl-js/api/');\n }\n\n this._mapbox = new mapboxgl.Map({\n container: this.dom\n });\n\n // Proxy events\n this._initEvents();\n\n}\n\nMapbox3DLayer.prototype.setUnpainted = function () {};\nMapbox3DLayer.prototype.resize = function () {\n this._mapbox.resize();\n};\n\nMapbox3DLayer.prototype.getMapbox = function () {\n return this._mapbox;\n};\n\nMapbox3DLayer.prototype.clear = function () {};\nMapbox3DLayer.prototype.refresh = function () {\n this._mapbox.resize();\n};\n\nvar EVENTS = ['mousedown', 'mouseup', 'click', 'dblclick', 'mousemove',\n 'mousewheel', 'wheel',\n 'touchstart', 'touchend', 'touchmove', 'touchcancel'\n];\nMapbox3DLayer.prototype._initEvents = function () {\n // Event is bound on canvas container.\n var mapboxRoot = this._mapbox.getCanvasContainer();\n this._handlers = this._handlers || {\n contextmenu: function (e) {\n e.preventDefault();\n return false;\n }\n };\n EVENTS.forEach(function (eName) {\n this._handlers[eName] = function (e) {\n var obj = {};\n for (var name in e) {\n obj[name] = e[name];\n }\n obj.bubbles = false;\n var newE = new e.constructor(e.type, obj);\n mapboxRoot.dispatchEvent(newE);\n };\n this.zr.dom.addEventListener(eName, this._handlers[eName]);\n }, this);\n\n // PENDING\n this.zr.dom.addEventListener('contextmenu', this._handlers.contextmenu);\n};\n\nMapbox3DLayer.prototype.dispose = function () {\n EVENTS.forEach(function (eName) {\n this.zr.dom.removeEventListener(eName, this._handlers[eName]);\n }, this);\n};\n\nexport default Mapbox3DLayer;","export default \"\\n@export ecgl.displayShadow.vertex\\n\\n@import ecgl.common.transformUniforms\\n\\n@import ecgl.common.uv.header\\n\\n@import ecgl.common.attributes\\n\\nvarying vec3 v_WorldPosition;\\n\\nvarying vec3 v_Normal;\\n\\nvoid main()\\n{\\n @import ecgl.common.uv.main\\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\\n\\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n}\\n\\n@end\\n\\n\\n@export ecgl.displayShadow.fragment\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform float roughness: 0.2;\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n@import clay.header.directional_light\\n#endif\\n\\n@import ecgl.common.ssaoMap.header\\n\\n@import clay.plugin.compute_shadow_map\\n\\nvoid main()\\n{\\n float shadow = 1.0;\\n\\n @import ecgl.common.ssaoMap.main\\n\\n#if defined(DIRECTIONAL_LIGHT_COUNT) && defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\\n if(shadowEnabled)\\n {\\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\\n }\\n for (int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++) {\\n shadow = min(shadow, shadowContribsDir[i] * 0.5 + 0.5);\\n }\\n#endif\\n\\n shadow *= 0.5 + ao * 0.5;\\n shadow = clamp(shadow, 0.0, 1.0);\\n\\n gl_FragColor = vec4(vec3(0.0), 1.0 - shadow);\\n}\\n\\n@end\";\n","import * as echarts from 'echarts/lib/echarts';\nimport Mapbox3DLayer from './Mapbox3DLayer';\nimport SceneHelper from '../common/SceneHelper';\nimport graphicGL from '../../util/graphicGL';\n\nimport displayShadowGLSL from '../../util/shader/displayShadow.glsl.js';\n\ngraphicGL.Shader.import(displayShadowGLSL);\n\nvar TILE_SIZE = 512;\n\nexport default echarts.ComponentView.extend({\n\n type: 'mapbox3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n var zr = api.getZr();\n this._zrLayer = new Mapbox3DLayer('mapbox3D', zr);\n zr.painter.insertLayer(-1000, this._zrLayer);\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper(this._lightRoot);\n this._sceneHelper.initLight(this._lightRoot);\n\n var mapbox = this._zrLayer.getMapbox();\n var dispatchInteractAction = this._dispatchInteractAction.bind(this, api, mapbox);\n\n // PENDING\n ['zoom', 'rotate', 'drag', 'pitch', 'rotate', 'move'].forEach(function (eName) {\n mapbox.on(eName, dispatchInteractAction);\n });\n\n this._groundMesh = new graphicGL.Mesh({\n geometry: new graphicGL.PlaneGeometry(),\n material: new graphicGL.Material({\n shader: new graphicGL.Shader({\n vertex: graphicGL.Shader.source('ecgl.displayShadow.vertex'),\n fragment: graphicGL.Shader.source('ecgl.displayShadow.fragment')\n }),\n depthMask: false\n }),\n // Render first\n renderOrder: -100,\n culling: false,\n castShadow: false,\n $ignorePicking: true,\n renderNormal: true\n });\n },\n\n render: function (mapbox3DModel, ecModel, api) {\n var mapbox = this._zrLayer.getMapbox();\n var styleDesc = mapbox3DModel.get('style');\n\n var styleStr = JSON.stringify(styleDesc);\n if (styleStr !== this._oldStyleStr) {\n if (styleDesc) {\n mapbox.setStyle(styleDesc);\n }\n }\n this._oldStyleStr = styleStr;\n\n mapbox.setCenter(mapbox3DModel.get('center'));\n mapbox.setZoom(mapbox3DModel.get('zoom'));\n mapbox.setPitch(mapbox3DModel.get('pitch'));\n mapbox.setBearing(mapbox3DModel.get('bearing'));\n\n mapbox3DModel.setMapbox(mapbox);\n\n var coordSys = mapbox3DModel.coordinateSystem;\n\n // Not add to rootNode. Or light direction will be stretched by rootNode scale\n coordSys.viewGL.scene.add(this._lightRoot);\n coordSys.viewGL.add(this._groundMesh);\n\n this._updateGroundMesh();\n\n // Update lights\n this._sceneHelper.setScene(coordSys.viewGL.scene);\n this._sceneHelper.updateLight(mapbox3DModel);\n\n // Update post effects\n coordSys.viewGL.setPostEffect(mapbox3DModel.getModel('postEffect'), api);\n coordSys.viewGL.setTemporalSuperSampling(mapbox3DModel.getModel('temporalSuperSampling'));\n\n this._mapbox3DModel = mapbox3DModel;\n },\n\n afterRender: function (mapbox3DModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n this._sceneHelper.updateAmbientCubemap(renderer, mapbox3DModel, api);\n this._sceneHelper.updateSkybox(renderer, mapbox3DModel, api);\n\n // FIXME If other series changes coordinate system.\n // FIXME When doing progressive rendering.\n mapbox3DModel.coordinateSystem.viewGL.scene.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material.define('fragment', 'NORMAL_UP_AXIS', 2);\n mesh.material.define('fragment', 'NORMAL_FRONT_AXIS', 1);\n }\n });\n },\n\n updateCamera: function (mapbox3DModel, ecModel, api, payload) {\n mapbox3DModel.coordinateSystem.setCameraOption(payload);\n\n this._updateGroundMesh();\n\n api.getZr().refresh();\n },\n\n _dispatchInteractAction: function (api, mapbox, mapbox3DModel) {\n api.dispatchAction({\n type: 'mapbox3DChangeCamera',\n pitch: mapbox.getPitch(),\n zoom: mapbox.getZoom(),\n center: mapbox.getCenter().toArray(),\n bearing: mapbox.getBearing(),\n mapbox3DId: this._mapbox3DModel && this._mapbox3DModel.id\n });\n },\n\n _updateGroundMesh: function () {\n if (this._mapbox3DModel) {\n var coordSys = this._mapbox3DModel.coordinateSystem;\n var pt = coordSys.dataToPoint(coordSys.center);\n this._groundMesh.position.set(pt[0], pt[1], -0.001);\n\n var plane = new graphicGL.Plane(new graphicGL.Vector3(0, 0, 1), 0);\n var ray1 = coordSys.viewGL.camera.castRay(new graphicGL.Vector2(-1, -1));\n var ray2 = coordSys.viewGL.camera.castRay(new graphicGL.Vector2(1, 1));\n var pos0 = ray1.intersectPlane(plane);\n var pos1 = ray2.intersectPlane(plane);\n var scale = pos0.dist(pos1) / coordSys.viewGL.rootNode.scale.x;\n this._groundMesh.scale.set(scale, scale, 1);\n }\n },\n\n dispose: function (ecModel, api) {\n if (this._zrLayer) {\n this._zrLayer.dispose();\n }\n api.getZr().painter.delLayer(-1000);\n }\n});","import glmatrix from 'claygl/src/dep/glmatrix';\nvar mat4 = glmatrix.mat4;\n\nvar TILE_SIZE = 512;\nvar FOV = 0.6435011087932844;\nvar PI = Math.PI;\n\nvar WORLD_SCALE = 1 / 10;\n\nfunction MapServiceCoordSys3D() {\n /**\n * Width of mapbox viewport\n */\n this.width = 0;\n /**\n * Height of mapbox viewport\n */\n this.height = 0;\n\n this.altitudeScale = 1;\n\n // TODO Change boxHeight won't have animation.\n this.boxHeight = 'auto';\n\n // Set by mapbox creator\n this.altitudeExtent;\n\n this.bearing = 0;\n this.pitch = 0;\n this.center = [0, 0];\n\n this._origin;\n\n this.zoom = 0;\n this._initialZoom;\n\n // Some parameters for different map services.\n this.maxPitch = 60;\n this.zoomOffset = 0;\n}\n\nMapServiceCoordSys3D.prototype = {\n\n constructor: MapServiceCoordSys3D,\n\n dimensions: ['lng', 'lat', 'alt'],\n\n containPoint: function () {},\n\n setCameraOption: function (option) {\n this.bearing = option.bearing;\n this.pitch = option.pitch;\n\n this.center = option.center;\n this.zoom = option.zoom;\n\n if (!this._origin) {\n this._origin = this.projectOnTileWithScale(this.center, TILE_SIZE);\n }\n if (this._initialZoom == null) {\n this._initialZoom = this.zoom;\n }\n\n this.updateTransform();\n },\n\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/geo/transform.js#L479\n updateTransform: function () {\n if (!this.height) { return; }\n\n var cameraToCenterDistance = 0.5 / Math.tan(FOV / 2) * this.height * WORLD_SCALE;\n // Convert to radian.\n var pitch = Math.max(Math.min(this.pitch, this.maxPitch), 0) / 180 * Math.PI;\n\n // Find the distance from the center point [width/2, height/2] to the\n // center top point [width/2, 0] in Z units, using the law of sines.\n // 1 Z unit is equivalent to 1 horizontal px at the center of the map\n // (the distance between[width/2, height/2] and [width/2 + 1, height/2])\n var halfFov = FOV / 2;\n var groundAngle = Math.PI / 2 + pitch;\n var topHalfSurfaceDistance = Math.sin(halfFov) * cameraToCenterDistance / Math.sin(Math.PI - groundAngle - halfFov);\n\n // Calculate z distance of the farthest fragment that should be rendered.\n var furthestDistance = Math.cos(Math.PI / 2 - pitch) * topHalfSurfaceDistance + cameraToCenterDistance;\n // Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance`\n var farZ = furthestDistance * 1.1;\n // Forced to be 1000\n if (this.pitch > 50) {\n farZ = 1000;\n }\n\n // matrix for conversion from location to GL coordinates (-1 .. 1)\n var m = [];\n mat4.perspective(m, FOV, this.width / this.height, 1, farZ);\n this.viewGL.camera.projectionMatrix.setArray(m);\n this.viewGL.camera.decomposeProjectionMatrix();\n\n var m = mat4.identity([]);\n var pt = this.dataToPoint(this.center);\n // Inverse\n mat4.scale(m, m, [1, -1, 1]);\n // Translate to altitude\n mat4.translate(m, m, [0, 0, -cameraToCenterDistance]);\n mat4.rotateX(m, m, pitch);\n mat4.rotateZ(m, m, -this.bearing / 180 * Math.PI);\n // Translate to center.\n mat4.translate(m, m, [-pt[0] * this.getScale() * WORLD_SCALE, -pt[1] * this.getScale() * WORLD_SCALE, 0]);\n\n this.viewGL.camera.viewMatrix.array = m;\n var invertM = [];\n mat4.invert(invertM, m);\n this.viewGL.camera.worldTransform.array = invertM;\n this.viewGL.camera.decomposeWorldTransform();\n\n // scale vertically to meters per pixel (inverse of ground resolution):\n // worldSize / (circumferenceOfEarth * cos(lat * π / 180))\n var worldSize = TILE_SIZE * this.getScale();\n var verticalScale;\n\n if (this.altitudeExtent && !isNaN(this.boxHeight)) {\n var range = this.altitudeExtent[1] - this.altitudeExtent[0];\n verticalScale = this.boxHeight / range * this.getScale() / Math.pow(2, this._initialZoom - this.zoomOffset);\n }\n else {\n verticalScale = worldSize / (2 * Math.PI * 6378000 * Math.abs(Math.cos(this.center[1] * (Math.PI / 180))))\n * this.altitudeScale * WORLD_SCALE;\n }\n // Include scale to avoid relayout when zooming\n // FIXME Camera scale may have problem in shadow\n this.viewGL.rootNode.scale.set(\n this.getScale() * WORLD_SCALE, this.getScale() * WORLD_SCALE, verticalScale\n );\n },\n\n getScale: function () {\n return Math.pow(2, this.zoom - this.zoomOffset);\n },\n\n projectOnTile: function (data, out) {\n return this.projectOnTileWithScale(data, this.getScale() * TILE_SIZE, out);\n },\n\n projectOnTileWithScale: function (data, scale, out) {\n var lng = data[0];\n var lat = data[1];\n var lambda2 = lng * PI / 180;\n var phi2 = lat * PI / 180;\n var x = scale * (lambda2 + PI) / (2 * PI);\n var y = scale * (PI - Math.log(Math.tan(PI / 4 + phi2 * 0.5))) / (2 * PI);\n out = out || [];\n out[0] = x;\n out[1] = y;\n return out;\n },\n\n unprojectFromTile: function (point, out) {\n return this.unprojectOnTileWithScale(point, this.getScale() * TILE_SIZE, out);\n },\n\n unprojectOnTileWithScale: function (point, scale, out) {\n var x = point[0];\n var y = point[1];\n var lambda2 = (x / scale) * (2 * PI) - PI;\n var phi2 = 2 * (Math.atan(Math.exp(PI - (y / scale) * (2 * PI))) - PI / 4);\n out = out || [];\n out[0] = lambda2 * 180 / PI;\n out[1] = phi2 * 180 / PI;\n return out;\n },\n\n dataToPoint: function (data, out) {\n out = this.projectOnTileWithScale(data, TILE_SIZE, out);\n // Add a origin to avoid precision issue in WebGL.\n out[0] -= this._origin[0];\n out[1] -= this._origin[1];\n // PENDING\n out[2] = !isNaN(data[2]) ? data[2] : 0;\n if (!isNaN(data[2])) {\n out[2] = data[2];\n if (this.altitudeExtent) {\n out[2] -= this.altitudeExtent[0];\n }\n }\n return out;\n }\n};\n\nexport default MapServiceCoordSys3D;","import MapService3D from '../mapServiceCommon/MapService3D';\n\nfunction Mapbox3D() {\n MapService3D.apply(this, arguments);\n}\n\nMapbox3D.prototype = new MapService3D();\nMapbox3D.prototype.constructor = Mapbox3D;\nMapbox3D.prototype.type = 'mapbox3D';\n\nexport default Mapbox3D;","import retrieve from '../../util/retrieve';\nimport graphicGL from '../../util/graphicGL';\nimport ViewGL from '../../core/ViewGL';\n\nexport default function (serviceComponentType, ServiceCtor, afterCreate) {\n\n function resizeMapService3D(mapService3DModel, api) {\n var width = api.getWidth();\n var height = api.getHeight();\n var dpr = api.getDevicePixelRatio();\n this.viewGL.setViewport(0, 0, width, height, dpr);\n\n this.width = width;\n this.height = height;\n\n this.altitudeScale = mapService3DModel.get('altitudeScale');\n\n this.boxHeight = mapService3DModel.get('boxHeight');\n // this.updateTransform();\n }\n\n\n function updateService3D(ecModel, api) {\n\n if (this.model.get('boxHeight') === 'auto') {\n return;\n }\n\n var altitudeDataExtent = [Infinity, -Infinity]\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.coordinateSystem !== this) {\n return;\n }\n\n // Get altitude data extent.\n var data = seriesModel.getData();\n var altDim = seriesModel.coordDimToDataDim('alt')[0];\n if (altDim) {\n // TODO altitiude is in coords of lines.\n var dataExtent = data.getDataExtent(altDim, true);\n altitudeDataExtent[0] = Math.min(\n altitudeDataExtent[0], dataExtent[0]\n );\n altitudeDataExtent[1] = Math.max(\n altitudeDataExtent[1], dataExtent[1]\n );\n }\n }, this);\n if (altitudeDataExtent && isFinite(altitudeDataExtent[1] - altitudeDataExtent[0])) {\n this.altitudeExtent = altitudeDataExtent;\n }\n }\n\n return {\n\n\n dimensions: ServiceCtor.prototype.dimensions,\n\n create: function (ecModel, api) {\n var mapService3DList = [];\n\n ecModel.eachComponent(serviceComponentType, function (mapService3DModel) {\n var viewGL = mapService3DModel.__viewGL;\n if (!viewGL) {\n viewGL = mapService3DModel.__viewGL = new ViewGL();\n viewGL.setRootNode(new graphicGL.Node());\n }\n\n var mapService3DCoordSys = new ServiceCtor();\n mapService3DCoordSys.viewGL = mapService3DModel.__viewGL;\n // Inject resize\n mapService3DCoordSys.resize = resizeMapService3D;\n mapService3DCoordSys.resize(mapService3DModel, api);\n\n mapService3DList.push(mapService3DCoordSys);\n\n mapService3DModel.coordinateSystem = mapService3DCoordSys;\n mapService3DCoordSys.model = mapService3DModel;\n\n mapService3DCoordSys.update = updateService3D;\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === serviceComponentType) {\n var mapService3DModel = seriesModel.getReferringComponents(serviceComponentType).models[0];\n if (!mapService3DModel) {\n mapService3DModel = ecModel.getComponent(serviceComponentType);\n }\n\n if (!mapService3DModel) {\n throw new Error(serviceComponentType + ' \"' + retrieve.firstNotNull(\n seriesModel.get(serviceComponentType + 'Index'),\n seriesModel.get(serviceComponentType + 'Id'),\n 0\n ) + '\" not found');\n }\n\n seriesModel.coordinateSystem = mapService3DModel.coordinateSystem;\n }\n });\n\n afterCreate && afterCreate(mapService3DList, ecModel, api);\n\n return mapService3DList;\n }\n };\n}\n","import Mapbox3D from './mapbox3D/Mapbox3D';\nimport createMapService3DCreator from './mapServiceCommon/createMapService3DCreator';\n\nvar mapbox3DCreator = createMapService3DCreator('mapbox3D', Mapbox3D, function (mapbox3DList) {\n mapbox3DList.forEach(function (mapbox3D) {\n mapbox3D.setCameraOption(mapbox3D.model.getMapboxCameraOption());\n });\n});\n\nexport default mapbox3DCreator;","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Mapbox3DModel from './Mapbox3DModel';\nimport Mapbox3DView from './Mapbox3DView';\nimport mapbox3DCreator from '../../coord/mapbox3DCreator';\n\nexport function install(registers) {\n registers.registerComponentModel(Mapbox3DModel);\n registers.registerComponentView(Mapbox3DView);\n\n registers.registerCoordinateSystem('mapbox3D', mapbox3DCreator);\n\n registers.registerAction({\n type: 'mapbox3DChangeCamera',\n event: 'mapbox3dcamerachanged',\n update: 'mapbox3D:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'mapbox3D', query: payload\n }, function (componentModel) {\n componentModel.setMapboxCameraOption(payload);\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './mapbox3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\n\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\n\nvar MAPTALKS_CAMERA_OPTION = ['zoom', 'center', 'pitch', 'bearing'];\n\nvar Maptalks3DModel = echarts.ComponentModel.extend({\n\n type: 'maptalks3D',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n defaultOption: {\n zlevel: -10,\n\n urlTemplate: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',\n attribution: '© OpenStreetMap contributors, © CARTO',\n\n center: [0, 0],\n\n zoom: 0,\n\n pitch: 0,\n\n bearing: 0,\n\n light: {\n main: {\n alpha: 20,\n beta: 30\n }\n },\n\n altitudeScale: 1,\n // Default depend on altitudeScale\n boxHeight: 'auto'\n },\n\n getMaptalksCameraOption: function () {\n var self = this;\n return MAPTALKS_CAMERA_OPTION.reduce(function (obj, key) {\n obj[key] = self.get(key);\n return obj;\n }, {});\n },\n\n setMaptalksCameraOption: function (option) {\n if (option != null) {\n MAPTALKS_CAMERA_OPTION.forEach(function (key) {\n if (option[key] != null) {\n this.option[key] = option[key];\n }\n }, this);\n }\n },\n\n /**\n * Get maptalks instance\n */\n getMaptalks: function () {\n return this._maptalks;\n },\n\n setMaptalks: function (maptalks) {\n this._maptalks = maptalks;\n }\n});\n\necharts.util.merge(Maptalks3DModel.prototype, componentPostEffectMixin);\necharts.util.merge(Maptalks3DModel.prototype, componentLightMixin);\n\nexport default Maptalks3DModel;","/**\n * @constructor\n * @alias module:echarts-gl/component/maptalks/Maptalks3DLayer\n * @param {string} id Layer ID\n * @param {module:zrender/ZRender} zr\n */\nfunction Maptalks3DLayer (id, zr, defaultCenter, defaultZoom) {\n this.id = id;\n this.zr = zr;\n\n this.dom = document.createElement('div');\n this.dom.style.cssText = 'position:absolute;left:0;right:0;top:0;bottom:0;';\n\n // FIXME If in module environment.\n if (!maptalks) {\n throw new Error('Maptalks library must be included. See https://maptalks.org');\n }\n\n this._maptalks = new maptalks.Map(this.dom, {\n center: defaultCenter,\n zoom: defaultZoom,\n doubleClickZoom:false,\n fog: false\n // fogColor: [0, 0, 0]\n });\n\n // Proxy events\n this._initEvents();\n\n}\n\nMaptalks3DLayer.prototype.setUnpainted = function () {};\nMaptalks3DLayer.prototype.resize = function () {\n this._maptalks.checkSize();\n};\n\nMaptalks3DLayer.prototype.getMaptalks = function () {\n return this._maptalks;\n};\n\nMaptalks3DLayer.prototype.clear = function () {};\nMaptalks3DLayer.prototype.refresh = function () {\n this._maptalks.checkSize();\n};\n\nvar EVENTS = ['mousedown', 'mouseup', 'click', 'dblclick', 'mousemove',\n 'mousewheel', 'DOMMouseScroll',\n 'touchstart', 'touchend', 'touchmove', 'touchcancel'\n];\nMaptalks3DLayer.prototype._initEvents = function () {\n // Event is bound on canvas container.\n var maptalksRoot = this.dom;\n this._handlers = this._handlers || {\n contextmenu: function (e) {\n e.preventDefault();\n return false;\n }\n };\n EVENTS.forEach(function (eName) {\n this._handlers[eName] = function (e) {\n var obj = {};\n for (var name in e) {\n obj[name] = e[name];\n }\n obj.bubbles = false;\n var newE = new e.constructor(e.type, obj);\n if (eName === 'mousewheel' || eName === 'DOMMouseScroll') {\n // maptalks listens events to different elements?\n maptalksRoot.dispatchEvent(newE);\n }\n else {\n maptalksRoot.firstElementChild.dispatchEvent(newE);\n }\n };\n this.zr.dom.addEventListener(eName, this._handlers[eName]);\n }, this);\n\n // PENDING\n this.zr.dom.addEventListener('contextmenu', this._handlers.contextmenu);\n};\n\nMaptalks3DLayer.prototype.dispose = function () {\n EVENTS.forEach(function (eName) {\n this.zr.dom.removeEventListener(eName, this._handlers[eName]);\n }, this);\n this._maptalks.remove();\n};\n\nexport default Maptalks3DLayer;\n","import * as echarts from 'echarts/lib/echarts';\nimport Maptalks3DLayer from './Maptalks3DLayer';\nimport SceneHelper from '../common/SceneHelper';\nimport graphicGL from '../../util/graphicGL';\n\nimport displayShadowGLSL from '../../util/shader/displayShadow.glsl.js';\n\ngraphicGL.Shader.import(displayShadowGLSL);\n\nexport default echarts.ComponentView.extend({\n\n type: 'maptalks3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this._groundMesh = new graphicGL.Mesh({\n geometry: new graphicGL.PlaneGeometry(),\n material: new graphicGL.Material({\n shader: new graphicGL.Shader({\n vertex: graphicGL.Shader.source('ecgl.displayShadow.vertex'),\n fragment: graphicGL.Shader.source('ecgl.displayShadow.fragment')\n }),\n depthMask: false\n }),\n // Render first\n renderOrder: -100,\n culling: false,\n castShadow: false,\n $ignorePicking: true,\n renderNormal: true\n });\n },\n\n _initMaptalksLayer: function (mapbox3DModel, api) {\n var zr = api.getZr();\n this._zrLayer = new Maptalks3DLayer('maptalks3D', zr, mapbox3DModel.get('center'), mapbox3DModel.get('zoom'));\n zr.painter.insertLayer(-1000, this._zrLayer);\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper(this._lightRoot);\n this._sceneHelper.initLight(this._lightRoot);\n\n var maptalks = this._zrLayer.getMaptalks();\n var dispatchInteractAction = this._dispatchInteractAction.bind(this, api, maptalks);\n\n // PENDING\n ['zoomend', 'zooming', 'zoomstart', 'dragrotating', 'pitch', 'pitchend', 'movestart',\n 'moving', 'moveend', 'resize', 'touchstart', 'touchmove', 'touchend','animating'].forEach(function (eName) {\n maptalks.on(eName, dispatchInteractAction);\n });\n\n },\n\n render: function (maptalks3DModel, ecModel, api) {\n if (!this._zrLayer) {\n this._initMaptalksLayer(maptalks3DModel, api);\n }\n\n var mtks = this._zrLayer.getMaptalks();\n var urlTemplate = maptalks3DModel.get('urlTemplate');\n\n var baseLayer = mtks.getBaseLayer();\n if (urlTemplate !== this._oldUrlTemplate) {\n if (!baseLayer) {\n baseLayer = new maptalks.TileLayer('maptalks-echarts-gl-baselayer', {\n urlTemplate: urlTemplate,\n // used sequentially to help with browser parallel requests per domain limitation\n subdomains: ['a', 'b', 'c'],\n attribution: maptalks3DModel.get('attribution')\n });\n mtks.setBaseLayer(baseLayer);\n }\n else {\n // PENDING setOptions may not work?\n baseLayer.setOptions({\n urlTemplate: urlTemplate,\n attribution: maptalks3DModel.get('attribution')\n });\n }\n }\n this._oldUrlTemplate = urlTemplate;\n\n mtks.setCenter(maptalks3DModel.get('center'));\n mtks.setZoom(maptalks3DModel.get('zoom'),{ animation: false });\n mtks.setPitch(maptalks3DModel.get('pitch'));\n mtks.setBearing(maptalks3DModel.get('bearing'));\n\n maptalks3DModel.setMaptalks(mtks);\n\n var coordSys = maptalks3DModel.coordinateSystem;\n\n // Not add to rootNode. Or light direction will be stretched by rootNode scale\n coordSys.viewGL.scene.add(this._lightRoot);\n coordSys.viewGL.add(this._groundMesh);\n\n this._updateGroundMesh();\n\n // Update lights\n this._sceneHelper.setScene(coordSys.viewGL.scene);\n this._sceneHelper.updateLight(maptalks3DModel);\n\n // Update post effects\n coordSys.viewGL.setPostEffect(maptalks3DModel.getModel('postEffect'), api);\n coordSys.viewGL.setTemporalSuperSampling(maptalks3DModel.getModel('temporalSuperSampling'));\n\n this._maptalks3DModel = maptalks3DModel;\n },\n\n afterRender: function (maptalks3DModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n this._sceneHelper.updateAmbientCubemap(renderer, maptalks3DModel, api);\n this._sceneHelper.updateSkybox(renderer, maptalks3DModel, api);\n\n // FIXME If other series changes coordinate system.\n // FIXME When doing progressive rendering.\n maptalks3DModel.coordinateSystem.viewGL.scene.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material.define('fragment', 'NORMAL_UP_AXIS', 2);\n mesh.material.define('fragment', 'NORMAL_FRONT_AXIS', 1);\n }\n });\n },\n\n updateCamera: function (maptalks3DModel, ecModel, api, payload) {\n maptalks3DModel.coordinateSystem.setCameraOption(payload);\n\n this._updateGroundMesh();\n\n api.getZr().refresh();\n },\n\n _dispatchInteractAction: function (api, maptalks, maptalks3DModel) {\n api.dispatchAction({\n type: 'maptalks3DChangeCamera',\n pitch: maptalks.getPitch(),\n zoom: getMapboxZoom(maptalks.getResolution()) + 1,\n center: maptalks.getCenter().toArray(),\n bearing: maptalks.getBearing(),\n maptalks3DId: this._maptalks3DModel && this._maptalks3DModel.id\n });\n },\n\n _updateGroundMesh: function () {\n if (this._maptalks3DModel) {\n var coordSys = this._maptalks3DModel.coordinateSystem;\n var pt = coordSys.dataToPoint(coordSys.center);\n this._groundMesh.position.set(pt[0], pt[1], -0.001);\n\n var plane = new graphicGL.Plane(new graphicGL.Vector3(0, 0, 1), 0);\n var ray1 = coordSys.viewGL.camera.castRay(new graphicGL.Vector2(-1, -1));\n var ray2 = coordSys.viewGL.camera.castRay(new graphicGL.Vector2(1, 1));\n var pos0 = ray1.intersectPlane(plane);\n var pos1 = ray2.intersectPlane(plane);\n var scale = pos0.dist(pos1) / coordSys.viewGL.rootNode.scale.x;\n this._groundMesh.scale.set(scale, scale, 1);\n }\n },\n\n dispose: function (ecModel, api) {\n if (this._zrLayer) {\n this._zrLayer.dispose();\n }\n api.getZr().painter.delLayer(-1000);\n }\n});\n\nconst MAX_RES = 2 * 6378137 * Math.PI / (256 * Math.pow(2, 20));\nfunction getMapboxZoom(res) {\n return 19 - Math.log(res / MAX_RES) / Math.LN2;\n}\n","import MapService3D from '../mapServiceCommon/MapService3D';\n\nfunction Maptalks3D() {\n MapService3D.apply(this, arguments);\n\n this.maxPitch = 85;\n this.zoomOffset = 1;\n}\n\nMaptalks3D.prototype = new MapService3D();\nMaptalks3D.prototype.constructor = Maptalks3D;\nMaptalks3D.prototype.type = 'maptalks3D';\n\nexport default Maptalks3D;","import Maptalks3D from './maptalks3D/Maptalks3D';\nimport createMapService3DCreator from './mapServiceCommon/createMapService3DCreator';\n\nvar maptalks3DCreator = createMapService3DCreator('maptalks3D', Maptalks3D, function (maptalks3DList) {\n maptalks3DList.forEach(function (maptalks3D) {\n maptalks3D.setCameraOption(maptalks3D.model.getMaptalksCameraOption());\n });\n});\n\nexport default maptalks3DCreator;","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Maptalks3DModel from './Maptalks3DModel';\nimport Maptalks3DView from './Maptalks3DView';\nimport maptalks3DCreator from '../../coord/maptalks3DCreator';\n\nexport function install(registers) {\n registers.registerComponentModel(Maptalks3DModel);\n registers.registerComponentView(Maptalks3DView);\n\n registers.registerCoordinateSystem('maptalks3D', maptalks3DCreator);\n\n registers.registerAction({\n type: 'maptalks3DChangeCamera',\n event: 'maptalks3dcamerachanged',\n update: 'maptalks3D:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'maptalks3D', query: payload\n }, function (componentModel) {\n componentModel.setMaptalksCameraOption(payload);\n });\n });\n}","// Thanks to https://gitee.com/iverson_hu/maptalks-echarts-gl\nimport { use } from 'echarts/lib/echarts';\nimport { install } from './maptalks3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\nvar isDimensionStacked = echarts.helper.dataStack.isDimensionStacked;\n\nfunction ifCrossZero(extent) {\n var min = extent[0];\n var max = extent[1];\n return !((min > 0 && max > 0) || (min < 0 && max < 0));\n};\n\nfunction cartesian3DLayout(seriesModel, coordSys) {\n\n var data = seriesModel.getData();\n // var barOnPlane = seriesModel.get('onGridPlane');\n\n var barSize = seriesModel.get('barSize');\n if (barSize == null) {\n var size = coordSys.size;\n var barWidth;\n var barDepth;\n var xAxis = coordSys.getAxis('x');\n var yAxis = coordSys.getAxis('y');\n\n if (xAxis.type === 'category') {\n barWidth = xAxis.getBandWidth() * 0.7;\n }\n else {\n // PENDING\n barWidth = Math.round(size[0] / Math.sqrt(data.count())) * 0.6;\n }\n if (yAxis.type === 'category') {\n barDepth = yAxis.getBandWidth() * 0.7;\n }\n else {\n barDepth = Math.round(size[1] / Math.sqrt(data.count())) * 0.6;\n }\n barSize = [barWidth, barDepth];\n }\n else if (!echarts.util.isArray(barSize)) {\n barSize = [barSize, barSize];\n }\n\n var zAxisExtent = coordSys.getAxis('z').scale.getExtent();\n var ifZAxisCrossZero = ifCrossZero(zAxisExtent);\n\n var dims = ['x', 'y', 'z'].map(function (coordDimName) {\n return seriesModel.coordDimToDataDim(coordDimName)[0];\n });\n\n var isStacked = isDimensionStacked(data, dims[2]);\n var valueDim = isStacked\n ? data.getCalculationInfo('stackResultDimension')\n : dims[2];\n\n data.each(dims, function (x, y, z, idx) {\n // TODO zAxis is inversed\n // TODO On different plane.\n var stackedValue = data.get(valueDim, idx);\n\n var baseValue = isStacked ? (stackedValue - z)\n : (ifZAxisCrossZero ? 0 : zAxisExtent[0]);\n\n var start = coordSys.dataToPoint([x, y, baseValue]);\n var end = coordSys.dataToPoint([x, y, stackedValue]);\n var height = vec3.dist(start, end);\n // PENDING When zAxis is not cross zero.\n var dir = [0, end[1] < start[1] ? -1 : 1, 0];\n if (Math.abs(height) === 0) {\n // TODO\n height = 0.1;\n }\n var size = [barSize[0], height, barSize[1]];\n data.setItemLayout(idx, [start, dir, size]);\n });\n\n data.setLayout('orient', [1, 0, 0]);\n}\n\nexport default cartesian3DLayout;","export default function (data, dimX, dimY) {\n var xExtent = data.getDataExtent(dimX);\n var yExtent = data.getDataExtent(dimY);\n\n // TODO Handle one data situation\n var xSpan = (xExtent[1] - xExtent[0]) || xExtent[0];\n var ySpan = (yExtent[1] - yExtent[0]) || yExtent[0];\n var dimSize = 50;\n var tmp = new Uint8Array(dimSize * dimSize);\n for (var i = 0; i < data.count(); i++) {\n var x = data.get(dimX, i);\n var y = data.get(dimY, i);\n var xIdx = Math.floor((x - xExtent[0]) / xSpan * (dimSize - 1));\n var yIdx = Math.floor((y - yExtent[0]) / ySpan * (dimSize - 1));\n var idx = yIdx * dimSize + xIdx;\n tmp[idx] = tmp[idx] || 1;\n }\n var filledCount = 0;\n for (var i = 0; i < tmp.length; i++) {\n if (tmp[i]) {\n filledCount++;\n }\n }\n return filledCount / tmp.length;\n};","import * as echarts from 'echarts/lib/echarts';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport cartesian3DLayout from './cartesian3DLayout';\nimport evaluateBarSparseness from './evaluateBarSparseness';\n\nvar vec3 = glmatrix.vec3;\nvar isDimensionStacked = echarts.helper.dataStack.isDimensionStacked;\n\nfunction globeLayout(seriesModel, coordSys) {\n var data = seriesModel.getData();\n var barMinHeight = seriesModel.get('minHeight') || 0;\n var barSize = seriesModel.get('barSize');\n var dims = ['lng', 'lat', 'alt'].map(function (coordDimName) {\n return seriesModel.coordDimToDataDim(coordDimName)[0];\n });\n if (barSize == null) {\n var perimeter = coordSys.radius * Math.PI;\n var fillRatio = evaluateBarSparseness(data, dims[0], dims[1]);\n barSize = [\n perimeter / Math.sqrt(data.count() / fillRatio),\n perimeter / Math.sqrt(data.count() / fillRatio)\n ];\n }\n else if (!echarts.util.isArray(barSize)) {\n barSize = [barSize, barSize];\n }\n\n var valueDim = getValueDimension(data, dims);\n\n data.each(dims, function (lng, lat, val, idx) {\n var stackedValue = data.get(valueDim.dimension, idx);\n var baseValue = valueDim.isStacked ? (stackedValue - val) : coordSys.altitudeAxis.scale.getExtent()[0];\n // TODO Stacked with minHeight.\n var height = Math.max(coordSys.altitudeAxis.dataToCoord(val), barMinHeight);\n var start = coordSys.dataToPoint([lng, lat, baseValue]);\n var end = coordSys.dataToPoint([lng, lat, stackedValue]);\n var dir = vec3.sub([], end, start);\n vec3.normalize(dir, dir);\n var size = [barSize[0], height, barSize[1]];\n data.setItemLayout(idx, [start, dir, size]);\n });\n\n data.setLayout('orient', Vector3.UP.array);\n}\n\nfunction geo3DLayout(seriesModel, coordSys) {\n var data = seriesModel.getData();\n var barSize = seriesModel.get('barSize');\n var barMinHeight = seriesModel.get('minHeight') || 0;\n var dims = ['lng', 'lat', 'alt'].map(function (coordDimName) {\n return seriesModel.coordDimToDataDim(coordDimName)[0];\n });\n if (barSize == null) {\n var size = Math.min(coordSys.size[0], coordSys.size[2]);\n\n var fillRatio = evaluateBarSparseness(data, dims[0], dims[1]);\n barSize = [\n size / Math.sqrt(data.count() / fillRatio),\n size / Math.sqrt(data.count() / fillRatio)\n ];\n }\n else if (!echarts.util.isArray(barSize)) {\n barSize = [barSize, barSize];\n }\n var dir = [0, 1, 0];\n\n var valueDim = getValueDimension(data, dims);\n\n data.each(dims, function (lng, lat, val, idx) {\n var stackedValue = data.get(valueDim.dimension, idx);\n var baseValue = valueDim.isStacked ? (stackedValue - val) : coordSys.altitudeAxis.scale.getExtent()[0];\n\n var height = Math.max(coordSys.altitudeAxis.dataToCoord(val), barMinHeight);\n var start = coordSys.dataToPoint([lng, lat, baseValue]);\n var size = [barSize[0], height, barSize[1]];\n data.setItemLayout(idx, [start, dir, size]);\n });\n\n data.setLayout('orient', [1, 0, 0]);\n}\n\nfunction mapService3DLayout(seriesModel, coordSys) {\n var data = seriesModel.getData();\n var dimLng = seriesModel.coordDimToDataDim('lng')[0];\n var dimLat = seriesModel.coordDimToDataDim('lat')[0];\n var dimAlt = seriesModel.coordDimToDataDim('alt')[0];\n var barSize = seriesModel.get('barSize');\n var barMinHeight = seriesModel.get('minHeight') || 0;\n\n if (barSize == null) {\n var xExtent = data.getDataExtent(dimLng);\n var yExtent = data.getDataExtent(dimLat);\n var corner0 = coordSys.dataToPoint([xExtent[0], yExtent[0]]);\n var corner1 = coordSys.dataToPoint([xExtent[1], yExtent[1]]);\n\n var size = Math.min(\n Math.abs(corner0[0] - corner1[0]),\n Math.abs(corner0[1] - corner1[1])\n ) || 1;\n\n var fillRatio = evaluateBarSparseness(data, dimLng, dimLat);\n // PENDING, data density\n barSize = [\n size / Math.sqrt(data.count() / fillRatio),\n size / Math.sqrt(data.count() / fillRatio)\n ];\n }\n else {\n if (!echarts.util.isArray(barSize)) {\n barSize = [barSize, barSize];\n }\n barSize[0] /= coordSys.getScale() / 16;\n barSize[1] /= coordSys.getScale() / 16;\n }\n\n var dir = [0, 0, 1];\n var dims = [dimLng, dimLat, dimAlt];\n\n var valueDim = getValueDimension(data, dims);\n\n data.each(dims, function (lng, lat, val, idx) {\n var stackedValue = data.get(valueDim.dimension, idx);\n var baseValue = valueDim.isStacked ? (stackedValue - val) : 0;\n\n var start = coordSys.dataToPoint([lng, lat, baseValue]);\n var end = coordSys.dataToPoint([lng, lat, stackedValue]);\n var height = Math.max(end[2] - start[2], barMinHeight);\n var size = [barSize[0], height, barSize[1]];\n data.setItemLayout(idx, [start, dir, size]);\n });\n\n data.setLayout('orient', [1, 0, 0]);\n}\n\nfunction getValueDimension(data, dataDims) {\n var isStacked = isDimensionStacked(data, dataDims[2]);\n return {\n dimension: isStacked\n ? data.getCalculationInfo('stackResultDimension')\n : dataDims[2],\n isStacked: isStacked\n };\n}\n\n\nexport default function registerBarLayout(registers) {\n registers.registerLayout(function (ecModel, api) {\n ecModel.eachSeriesByType('bar3D', function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n var coordSysType = coordSys && coordSys.type;\n if (coordSysType === 'globe') {\n globeLayout(seriesModel, coordSys);\n }\n else if (coordSysType === 'cartesian3D') {\n cartesian3DLayout(seriesModel, coordSys);\n }\n else if (coordSysType === 'geo3D') {\n geo3DLayout(seriesModel, coordSys);\n }\n else if (coordSysType === 'mapbox3D' || coordSysType === 'maptalks3D') {\n mapService3DLayout(seriesModel, coordSys);\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n if (!coordSys) {\n throw new Error('bar3D doesn\\'t have coordinate system.');\n }\n else {\n throw new Error('bar3D doesn\\'t support coordinate system ' + coordSys.type);\n }\n }\n }\n });\n });\n}","import * as echarts from 'echarts/lib/echarts';\n\nvar formatUtil = {};\nformatUtil.getFormattedLabel = function (seriesModel, dataIndex, status, dataType, dimIndex) {\n status = status || 'normal';\n var data = seriesModel.getData(dataType);\n var itemModel = data.getItemModel(dataIndex);\n\n var params = seriesModel.getDataParams(dataIndex, dataType);\n if (dimIndex != null && (params.value instanceof Array)) {\n params.value = params.value[dimIndex];\n }\n\n var formatter = itemModel.get(status === 'normal' ? ['label', 'formatter'] : ['emphasis', 'label', 'formatter']);\n if (formatter == null) {\n formatter = itemModel.get(['label', 'formatter']);\n }\n var text;\n if (typeof formatter === 'function') {\n params.status = status;\n text = formatter(params);\n }\n else if (typeof formatter === 'string') {\n text = echarts.format.formatTpl(formatter, params);\n }\n return text;\n};\n\n/**\n * If value is not array, then convert it to array.\n * @param {*} value\n * @return {Array} [value] or value\n */\nformatUtil.normalizeToArray = function (value) {\n return value instanceof Array\n ? value\n : value == null\n ? []\n : [value];\n};\n\nexport default formatUtil;","import * as echarts from 'echarts/lib/echarts';\nimport { getItemVisualColor } from '../../util/visual';\n\nfunction otherDimToDataDim (data, otherDim) {\n var dataDim = [];\n echarts.util.each(data.dimensions, function (dimName) {\n var dimItem = data.getDimensionInfo(dimName);\n var otherDims = dimItem.otherDims;\n var dimIndex = otherDims[otherDim];\n if (dimIndex != null && dimIndex !== false) {\n dataDim[dimIndex] = dimItem.name;\n }\n });\n return dataDim;\n}\n\nexport default function (seriesModel, dataIndex, multipleSeries) {\n function formatArrayValue(value) {\n var vertially = true;\n\n var result = [];\n var tooltipDims = otherDimToDataDim(data, 'tooltip');\n\n tooltipDims.length\n ? echarts.util.each(tooltipDims, function (dimIdx) {\n setEachItem(data.get(dimIdx, dataIndex), dimIdx);\n })\n // By default, all dims is used on tooltip.\n : echarts.util.each(value, setEachItem);\n\n function setEachItem(val, dimIdx) {\n var dimInfo = data.getDimensionInfo(dimIdx);\n // If `dimInfo.tooltip` is not set, show tooltip.\n if (!dimInfo || dimInfo.otherDims.tooltip === false) {\n return;\n }\n var dimType = dimInfo.type;\n var valStr = (vertially ? '- ' + (dimInfo.tooltipName || dimInfo.name) + ': ' : '')\n + (dimType === 'ordinal'\n ? val + ''\n : dimType === 'time'\n ? (multipleSeries ? '' : echarts.format.formatTime('yyyy/MM/dd hh:mm:ss', val))\n : echarts.format.addCommas(val)\n );\n valStr && result.push(echarts.format.encodeHTML(valStr));\n }\n\n return (vertially ? '
' : '') + result.join(vertially ? '
' : ', ');\n }\n\n var data = seriesModel.getData();\n\n var value = seriesModel.getRawValue(dataIndex);\n var formattedValue = echarts.util.isArray(value)\n ? formatArrayValue(value) : echarts.format.encodeHTML(echarts.format.addCommas(value));\n var name = data.getName(dataIndex);\n\n var color = getItemVisualColor(data, dataIndex);\n if (echarts.util.isObject(color) && color.colorStops) {\n color = (color.colorStops[0] || {}).color;\n }\n color = color || 'transparent';\n\n var colorEl = echarts.format.getTooltipMarker(color);\n\n var seriesName = seriesModel.name;\n // FIXME\n if (seriesName === '\\0-') {\n // Not show '-'\n seriesName = '';\n }\n seriesName = seriesName\n ? echarts.format.encodeHTML(seriesName) + (!multipleSeries ? '
' : ': ')\n : '';\n return !multipleSeries\n ? seriesName + colorEl\n + (name\n ? echarts.format.encodeHTML(name) + ': ' + formattedValue\n : formattedValue\n )\n : colorEl + seriesName + formattedValue;\n};","import * as echarts from 'echarts/lib/echarts';\n\nexport default function (seriesModel, dims, source) {\n source = source || seriesModel.getSource();\n\n var coordSysDimensions = dims || echarts.getCoordinateSystemDimensions(seriesModel.get('coordinateSystem')) || ['x', 'y', 'z'];\n\n var dimensions = echarts.helper.createDimensions(source, {\n dimensionsDefine: source.dimensionsDefine || seriesModel.get('dimensions'),\n encodeDefine: source.encodeDefine || seriesModel.get('encode'),\n coordDimensions: coordSysDimensions.map(function (dim) {\n var axis3DModel = seriesModel.getReferringComponents(dim + 'Axis3D').models[0];\n return {\n type: (axis3DModel && axis3DModel.get('type') === 'category') ? 'ordinal' : 'float',\n name: dim\n // Find stackable dimension. Which will represent value.\n // stackable: dim === 'z'\n };\n })\n });\n if (seriesModel.get('coordinateSystem') === 'cartesian3D') {\n dimensions.forEach(function (dimInfo) {\n if (coordSysDimensions.indexOf(dimInfo.coordDim) >= 0) {\n var axis3DModel = seriesModel.getReferringComponents(dimInfo.coordDim + 'Axis3D').models[0];\n if (axis3DModel && axis3DModel.get('type') === 'category') {\n dimInfo.ordinalMeta = axis3DModel.getOrdinalMeta();\n }\n }\n });\n }\n\n var stackCalculationInfo = echarts.helper.dataStack.enableDataStack(\n // Only support 'z' and `byIndex` now.\n seriesModel, dimensions, {byIndex: true, stackedCoordDimension: 'z'}\n );\n\n var data = new echarts.List(dimensions, seriesModel);\n\n data.setCalculationInfo(stackCalculationInfo);\n\n data.initData(source);\n\n return data;\n}","import * as echarts from 'echarts/lib/echarts';\nimport componentShadingMixin from '../../component/common/componentShadingMixin';\nimport formatUtil from '../../util/format';\nimport formatTooltip from '../common/formatTooltip';\nimport createList from '../common/createList';\n\nvar Bar3DSeries = echarts.SeriesModel.extend({\n\n type: 'series.bar3D',\n\n dependencies: ['globe'],\n\n visualStyleAccessPathvisu: 'itemStyle',\n\n getInitialData: function (option, ecModel) {\n return createList(this);\n },\n\n getFormattedLabel: function (dataIndex, status, dataType, dimIndex) {\n var text = formatUtil.getFormattedLabel(this, dataIndex, status, dataType, dimIndex);\n if (text == null) {\n text = this.getData().get('z', dataIndex);\n }\n return text;\n },\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n defaultOption: {\n\n coordinateSystem: 'cartesian3D',\n\n globeIndex: 0,\n\n grid3DIndex: 0,\n\n zlevel: -10,\n\n // bevelSize, 0 has no bevel\n bevelSize: 0,\n // higher is smoother\n bevelSmoothness: 2,\n\n // Bar width and depth\n // barSize: [1, 1],\n\n // On grid plane when coordinateSystem is cartesian3D\n onGridPlane: 'xy',\n\n // Shading of globe\n shading: 'color',\n\n minHeight: 0,\n\n itemStyle: {\n opacity: 1\n },\n\n label: {\n show: false,\n distance: 2,\n textStyle: {\n fontSize: 14,\n color: '#000',\n backgroundColor: 'rgba(255,255,255,0.7)',\n padding: 3,\n borderRadius: 3\n }\n },\n\n emphasis: {\n label: {\n show: true\n }\n },\n\n animationDurationUpdate: 500\n }\n});\n\necharts.util.merge(Bar3DSeries.prototype, componentShadingMixin);\n\nexport default Bar3DSeries;","/**\n * Geometry collecting bars data\n *\n * @module echarts-gl/chart/bars/BarsGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport * as echarts from 'echarts/lib/echarts';\nimport dynamicConvertMixin from './dynamicConvertMixin';\nimport trianglesSortMixin from './trianglesSortMixin';\nimport Geometry from 'claygl/src/Geometry';\n\nimport glMatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glMatrix.vec3;\nvar mat3 = glMatrix.mat3;\n\n/**\n * @constructor\n * @alias module:echarts-gl/chart/bars/BarsGeometry\n * @extends clay.Geometry\n */\nvar BarsGeometry = Geometry.extend(function () {\n return {\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION'),\n normal: new Geometry.Attribute('normal', 'float', 3, 'NORMAL'),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR'),\n\n prevPosition: new Geometry.Attribute('prevPosition', 'float', 3),\n prevNormal: new Geometry.Attribute('prevNormal', 'float', 3)\n },\n\n dynamic: true,\n\n enableNormal: false,\n\n bevelSize: 1,\n bevelSegments: 0,\n\n // Map from vertexIndex to dataIndex.\n _dataIndices: null,\n\n _vertexOffset: 0,\n _triangleOffset: 0\n };\n},\n/** @lends module:echarts-gl/chart/bars/BarsGeometry.prototype */\n{\n\n resetOffset: function () {\n this._vertexOffset = 0;\n this._triangleOffset = 0;\n },\n\n setBarCount: function (barCount) {\n var enableNormal = this.enableNormal;\n var vertexCount = this.getBarVertexCount() * barCount;\n var triangleCount = this.getBarTriangleCount() * barCount;\n\n if (this.vertexCount !== vertexCount) {\n this.attributes.position.init(vertexCount);\n if (enableNormal) {\n this.attributes.normal.init(vertexCount);\n }\n else {\n this.attributes.normal.value = null;\n }\n this.attributes.color.init(vertexCount);\n }\n\n if (this.triangleCount !== triangleCount) {\n this.indices = vertexCount > 0xffff ? new Uint32Array(triangleCount * 3) : new Uint16Array(triangleCount * 3);\n\n this._dataIndices = new Uint32Array(vertexCount);\n }\n },\n\n getBarVertexCount: function () {\n var bevelSegments = this.bevelSize > 0 ? this.bevelSegments : 0;\n return bevelSegments > 0 ? this._getBevelBarVertexCount(bevelSegments)\n : (this.enableNormal ? 24 : 8);\n },\n\n getBarTriangleCount: function () {\n var bevelSegments = this.bevelSize > 0 ? this.bevelSegments : 0;\n return bevelSegments > 0 ? this._getBevelBarTriangleCount(bevelSegments)\n : 12;\n },\n\n _getBevelBarVertexCount: function (bevelSegments) {\n return (bevelSegments + 1) * 4 * (bevelSegments + 1) * 2;\n },\n\n _getBevelBarTriangleCount: function (bevelSegments) {\n var widthSegments = bevelSegments * 4 + 3;\n var heightSegments = bevelSegments * 2 + 1;\n return (widthSegments + 1) * heightSegments * 2 + 4;\n },\n\n setColor: function (idx, color) {\n var vertexCount = this.getBarVertexCount();\n var start = vertexCount * idx;\n var end = vertexCount * (idx + 1);\n for (var i = start; i < end; i++) {\n this.attributes.color.set(i, color);\n }\n this.dirtyAttribute('color');\n },\n\n /**\n * Get dataIndex of vertex.\n * @param {number} vertexIndex\n */\n getDataIndexOfVertex: function (vertexIndex) {\n return this._dataIndices ? this._dataIndices[vertexIndex] : null;\n },\n\n /**\n * Add a bar\n * @param {Array.} start\n * @param {Array.} end\n * @param {Array.} orient right direction\n * @param {Array.} size size on x and z\n * @param {Array.} color\n */\n addBar: (function () {\n var v3Create = vec3.create;\n var v3ScaleAndAdd = vec3.scaleAndAdd;\n\n var end = v3Create();\n var px = v3Create();\n var py = v3Create();\n var pz = v3Create();\n var nx = v3Create();\n var ny = v3Create();\n var nz = v3Create();\n\n var pts = [];\n var normals = [];\n for (var i = 0; i < 8; i++) {\n pts[i] = v3Create();\n }\n\n var cubeFaces4 = [\n // PX\n [0, 1, 5, 4],\n // NX\n [2, 3, 7, 6],\n // PY\n [4, 5, 6, 7],\n // NY\n [3, 2, 1, 0],\n // PZ\n [0, 4, 7, 3],\n // NZ\n [1, 2, 6, 5]\n ];\n var face4To3 = [\n 0, 1, 2, 0, 2, 3\n ];\n var cubeFaces3 = [];\n for (var i = 0; i < cubeFaces4.length; i++) {\n var face4 = cubeFaces4[i];\n for (var j = 0; j < 2; j++) {\n var face = [];\n for (var k = 0; k < 3; k++) {\n face.push(face4[face4To3[j * 3 + k]]);\n }\n cubeFaces3.push(face);\n }\n }\n return function (start, dir, leftDir, size, color, dataIndex) {\n\n // Use vertex, triangle maybe sorted.\n var startVertex = this._vertexOffset;\n\n if (this.bevelSize > 0 && this.bevelSegments > 0) {\n this._addBevelBar(start, dir, leftDir, size, this.bevelSize, this.bevelSegments, color);\n }\n else {\n vec3.copy(py, dir);\n vec3.normalize(py, py);\n // x * y => z\n vec3.cross(pz, leftDir, py);\n vec3.normalize(pz, pz);\n // y * z => x\n vec3.cross(px, py, pz);\n vec3.normalize(pz, pz);\n\n vec3.negate(nx, px);\n vec3.negate(ny, py);\n vec3.negate(nz, pz);\n\n v3ScaleAndAdd(pts[0], start, px, size[0] / 2);\n v3ScaleAndAdd(pts[0], pts[0], pz, size[2] / 2);\n v3ScaleAndAdd(pts[1], start, px, size[0] / 2);\n v3ScaleAndAdd(pts[1], pts[1], nz, size[2] / 2);\n v3ScaleAndAdd(pts[2], start, nx, size[0] / 2);\n v3ScaleAndAdd(pts[2], pts[2], nz, size[2] / 2);\n v3ScaleAndAdd(pts[3], start, nx, size[0] / 2);\n v3ScaleAndAdd(pts[3], pts[3], pz, size[2] / 2);\n\n v3ScaleAndAdd(end, start, py, size[1]);\n\n v3ScaleAndAdd(pts[4], end, px, size[0] / 2);\n v3ScaleAndAdd(pts[4], pts[4], pz, size[2] / 2);\n v3ScaleAndAdd(pts[5], end, px, size[0] / 2);\n v3ScaleAndAdd(pts[5], pts[5], nz, size[2] / 2);\n v3ScaleAndAdd(pts[6], end, nx, size[0] / 2);\n v3ScaleAndAdd(pts[6], pts[6], nz, size[2] / 2);\n v3ScaleAndAdd(pts[7], end, nx, size[0] / 2);\n v3ScaleAndAdd(pts[7], pts[7], pz, size[2] / 2);\n\n var attributes = this.attributes;\n if (this.enableNormal) {\n normals[0] = px;\n normals[1] = nx;\n normals[2] = py;\n normals[3] = ny;\n normals[4] = pz;\n normals[5] = nz;\n\n var vertexOffset = this._vertexOffset;\n for (var i = 0; i < cubeFaces4.length; i++) {\n var idx3 = this._triangleOffset * 3;\n for (var k = 0; k < 6; k++) {\n this.indices[idx3++] = vertexOffset + face4To3[k];\n }\n vertexOffset += 4;\n this._triangleOffset += 2;\n }\n\n for (var i = 0; i < cubeFaces4.length; i++) {\n var normal = normals[i];\n for (var k = 0; k < 4; k++) {\n var idx = cubeFaces4[i][k];\n attributes.position.set(this._vertexOffset, pts[idx]);\n attributes.normal.set(this._vertexOffset, normal);\n attributes.color.set(this._vertexOffset++, color);\n }\n }\n }\n else {\n for (var i = 0; i < cubeFaces3.length; i++) {\n var idx3 = this._triangleOffset * 3;\n for (var k = 0; k < 3; k++) {\n this.indices[idx3 + k] = cubeFaces3[i][k] + this._vertexOffset;\n }\n this._triangleOffset++;\n }\n\n for (var i = 0; i < pts.length; i++) {\n attributes.position.set(this._vertexOffset, pts[i]);\n attributes.color.set(this._vertexOffset++, color);\n }\n }\n }\n\n var endVerex = this._vertexOffset;\n\n for (var i = startVertex; i < endVerex; i++) {\n this._dataIndices[i] = dataIndex;\n }\n };\n })(),\n\n /**\n * Add a bar with bevel\n * @param {Array.} start\n * @param {Array.} end\n * @param {Array.} orient right direction\n * @param {Array.} size size on x and z\n * @param {number} bevelSize\n * @param {number} bevelSegments\n * @param {Array.} color\n */\n _addBevelBar: (function () {\n var px = vec3.create();\n var py = vec3.create();\n var pz = vec3.create();\n\n var rotateMat = mat3.create();\n\n var bevelStartSize = [];\n\n var xOffsets = [1, -1, -1, 1];\n var zOffsets = [1, 1, -1, -1];\n var yOffsets = [2, 0];\n\n return function (start, dir, leftDir, size, bevelSize, bevelSegments, color) {\n vec3.copy(py, dir);\n vec3.normalize(py, py);\n // x * y => z\n vec3.cross(pz, leftDir, py);\n vec3.normalize(pz, pz);\n // y * z => x\n vec3.cross(px, py, pz);\n vec3.normalize(pz, pz);\n\n rotateMat[0] = px[0]; rotateMat[1] = px[1]; rotateMat[2] = px[2];\n rotateMat[3] = py[0]; rotateMat[4] = py[1]; rotateMat[5] = py[2];\n rotateMat[6] = pz[0]; rotateMat[7] = pz[1]; rotateMat[8] = pz[2];\n\n bevelSize = Math.min(size[0], size[2]) / 2 * bevelSize;\n\n for (var i = 0; i < 3; i++) {\n bevelStartSize[i] = Math.max(size[i] - bevelSize * 2, 0);\n }\n var rx = (size[0] - bevelStartSize[0]) / 2;\n var ry = (size[1] - bevelStartSize[1]) / 2;\n var rz = (size[2] - bevelStartSize[2]) / 2;\n\n var pos = [];\n var normal = [];\n var vertexOffset = this._vertexOffset;\n\n var endIndices = [];\n for (var i = 0; i < 2; i++) {\n endIndices[i] = endIndices[i] = [];\n\n for (var m = 0; m <= bevelSegments; m++) {\n for (var j = 0; j < 4; j++) {\n if ((m === 0 && i === 0) || (i === 1 && m === bevelSegments)) {\n endIndices[i].push(vertexOffset);\n }\n for (var n = 0; n <= bevelSegments; n++) {\n\n var phi = n / bevelSegments * Math.PI / 2 + Math.PI / 2 * j;\n var theta = m / bevelSegments * Math.PI / 2 + Math.PI / 2 * i;\n // var r = rx < ry ? (rz < rx ? rz : rx) : (rz < ry ? rz : ry);\n normal[0] = rx * Math.cos(phi) * Math.sin(theta);\n normal[1] = ry * Math.cos(theta);\n normal[2] = rz * Math.sin(phi) * Math.sin(theta);\n pos[0] = normal[0] + xOffsets[j] * bevelStartSize[0] / 2;\n pos[1] = (normal[1] + ry) + yOffsets[i] * bevelStartSize[1] / 2;\n pos[2] = normal[2] + zOffsets[j] * bevelStartSize[2] / 2;\n\n // Normal is not right if rx, ry, rz not equal.\n if (!(Math.abs(rx - ry) < 1e-6 && Math.abs(ry - rz) < 1e-6)) {\n normal[0] /= rx * rx;\n normal[1] /= ry * ry;\n normal[2] /= rz * rz;\n }\n vec3.normalize(normal, normal);\n\n vec3.transformMat3(pos, pos, rotateMat);\n vec3.transformMat3(normal, normal, rotateMat);\n vec3.add(pos, pos, start);\n\n this.attributes.position.set(vertexOffset, pos);\n if (this.enableNormal) {\n this.attributes.normal.set(vertexOffset, normal);\n }\n this.attributes.color.set(vertexOffset, color);\n vertexOffset++;\n }\n }\n }\n }\n\n var widthSegments = bevelSegments * 4 + 3;\n var heightSegments = bevelSegments * 2 + 1;\n\n var len = widthSegments + 1;\n\n for (var j = 0; j < heightSegments; j ++) {\n for (var i = 0; i <= widthSegments; i ++) {\n var i2 = j * len + i + this._vertexOffset;\n var i1 = (j * len + (i + 1) % len) + this._vertexOffset;\n var i4 = (j + 1) * len + (i + 1) % len + this._vertexOffset;\n var i3 = (j + 1) * len + i + this._vertexOffset;\n\n this.setTriangleIndices(this._triangleOffset++, [i4, i2, i1]);\n this.setTriangleIndices(this._triangleOffset++, [i4, i3, i2]);\n }\n }\n\n // Close top and bottom\n this.setTriangleIndices(this._triangleOffset++, [endIndices[0][0], endIndices[0][2], endIndices[0][1]]);\n this.setTriangleIndices(this._triangleOffset++, [endIndices[0][0], endIndices[0][3], endIndices[0][2]]);\n this.setTriangleIndices(this._triangleOffset++, [endIndices[1][0], endIndices[1][1], endIndices[1][2]]);\n this.setTriangleIndices(this._triangleOffset++, [endIndices[1][0], endIndices[1][2], endIndices[1][3]]);\n\n this._vertexOffset = vertexOffset;\n };\n })()\n});\n\necharts.util.defaults(BarsGeometry.prototype, dynamicConvertMixin);\necharts.util.defaults(BarsGeometry.prototype, trianglesSortMixin);\n\nexport default BarsGeometry;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport format from '../../util/format';\nimport BarsGeometry from '../../util/geometry/Bars3DGeometry';\nimport LabelsBuilder from '../../component/common/LabelsBuilder';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport {getItemVisualColor, getItemVisualOpacity} from '../../util/visual';\n\nvar vec3 = glmatrix.vec3;\n\nexport default echarts.ChartView.extend({\n\n type: 'bar3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n\n this._api = api;\n\n this._labelsBuilder = new LabelsBuilder(256, 256, api);\n var self = this;\n this._labelsBuilder.getLabelPosition = function (dataIndex, position, distance) {\n if (self._data) {\n var layout = self._data.getItemLayout(dataIndex);\n var start = layout[0];\n var dir = layout[1];\n var height = layout[2][1];\n return vec3.scaleAndAdd([], start, dir, distance + height);\n }\n else {\n return [0, 0];\n }\n };\n\n // Give a large render order.\n this._labelsBuilder.getMesh().renderOrder = 100;\n },\n\n render: function (seriesModel, ecModel, api) {\n\n // Swap barMesh\n var tmp = this._prevBarMesh;\n this._prevBarMesh = this._barMesh;\n this._barMesh = tmp;\n\n if (!this._barMesh) {\n this._barMesh = new graphicGL.Mesh({\n geometry: new BarsGeometry(),\n shadowDepthMaterial: new graphicGL.Material({\n shader: new graphicGL.Shader(\n graphicGL.Shader.source('ecgl.sm.depth.vertex'),\n graphicGL.Shader.source('ecgl.sm.depth.fragment')\n )\n }),\n // Only cartesian3D enable culling\n // FIXME Performance\n culling: seriesModel.coordinateSystem.type === 'cartesian3D',\n // Render after axes\n renderOrder: 10,\n // Render normal in normal pass\n renderNormal: true\n });\n }\n\n this.groupGL.remove(this._prevBarMesh);\n this.groupGL.add(this._barMesh);\n this.groupGL.add(this._labelsBuilder.getMesh());\n\n var coordSys = seriesModel.coordinateSystem;\n this._doRender(seriesModel, api);\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._barMesh.material[methodName]('fragment', 'SRGB_DECODE');\n }\n\n this._data = seriesModel.getData();\n\n this._labelsBuilder.updateData(this._data);\n\n this._labelsBuilder.updateLabels();\n\n this._updateAnimation(seriesModel);\n },\n\n _updateAnimation: function (seriesModel) {\n graphicGL.updateVertexAnimation(\n [['prevPosition', 'position'],\n ['prevNormal', 'normal']],\n this._prevBarMesh,\n this._barMesh,\n seriesModel\n );\n },\n\n _doRender: function (seriesModel, api) {\n var data = seriesModel.getData();\n var shading = seriesModel.get('shading');\n var enableNormal = shading !== 'color';\n var self = this;\n var barMesh = this._barMesh;\n\n var shadingPrefix = 'ecgl.' + shading;\n if (!barMesh.material || barMesh.material.shader.name !== shadingPrefix) {\n barMesh.material = graphicGL.createMaterial(shadingPrefix, ['VERTEX_COLOR']);\n }\n\n graphicGL.setMaterialFromModel(\n shading, barMesh.material, seriesModel, api\n );\n\n barMesh.geometry.enableNormal = enableNormal;\n\n barMesh.geometry.resetOffset();\n\n // Bevel settings\n var bevelSize = seriesModel.get('bevelSize');\n var bevelSegments = seriesModel.get('bevelSmoothness');\n barMesh.geometry.bevelSegments = bevelSegments;\n\n barMesh.geometry.bevelSize = bevelSize;\n\n var colorArr = [];\n var vertexColors = new Float32Array(data.count() * 4);\n var colorOffset = 0;\n var barCount = 0;\n var hasTransparent = false;\n\n data.each(function (idx) {\n if (!data.hasValue(idx)) {\n return;\n }\n var color = getItemVisualColor(data, idx);\n\n var opacity = getItemVisualOpacity(data, idx);\n if (opacity == null) {\n opacity = 1;\n }\n\n graphicGL.parseColor(color, colorArr);\n colorArr[3] *= opacity;\n vertexColors[colorOffset++] = colorArr[0];\n vertexColors[colorOffset++] = colorArr[1];\n vertexColors[colorOffset++] = colorArr[2];\n vertexColors[colorOffset++] = colorArr[3];\n\n if (colorArr[3] > 0) {\n barCount++;\n if (colorArr[3] < 0.99) {\n hasTransparent = true;\n }\n }\n });\n\n barMesh.geometry.setBarCount(barCount);\n\n var orient = data.getLayout('orient');\n\n // Map of dataIndex and barIndex.\n var barIndexOfData = this._barIndexOfData = new Int32Array(data.count());\n var barCount = 0;\n data.each(function (idx) {\n if (!data.hasValue(idx)) {\n barIndexOfData[idx] = -1;\n return;\n }\n var layout = data.getItemLayout(idx);\n var start = layout[0];\n var dir = layout[1];\n var size = layout[2];\n\n var idx4 = idx * 4;\n colorArr[0] = vertexColors[idx4++];\n colorArr[1] = vertexColors[idx4++];\n colorArr[2] = vertexColors[idx4++];\n colorArr[3] = vertexColors[idx4++];\n if (colorArr[3] > 0) {\n self._barMesh.geometry.addBar(start, dir, orient, size, colorArr, idx);\n barIndexOfData[idx] = barCount++;\n }\n });\n\n barMesh.geometry.dirty();\n barMesh.geometry.updateBoundingBox();\n\n var material = barMesh.material;\n material.transparent = hasTransparent;\n material.depthMask = !hasTransparent;\n barMesh.geometry.sortTriangles = hasTransparent;\n\n this._initHandler(seriesModel, api);\n },\n\n _initHandler: function (seriesModel, api) {\n var data = seriesModel.getData();\n var barMesh = this._barMesh;\n var isCartesian3D = seriesModel.coordinateSystem.type === 'cartesian3D';\n\n barMesh.seriesIndex = seriesModel.seriesIndex;\n\n var lastDataIndex = -1;\n barMesh.off('mousemove');\n barMesh.off('mouseout');\n barMesh.on('mousemove', function (e) {\n var dataIndex = barMesh.geometry.getDataIndexOfVertex(e.triangle[0]);\n if (dataIndex !== lastDataIndex) {\n this._downplay(lastDataIndex);\n this._highlight(dataIndex);\n this._labelsBuilder.updateLabels([dataIndex]);\n\n if (isCartesian3D) {\n api.dispatchAction({\n type: 'grid3DShowAxisPointer',\n value: [data.get('x', dataIndex), data.get('y', dataIndex), data.get('z', dataIndex, true)]\n });\n }\n }\n\n lastDataIndex = dataIndex;\n barMesh.dataIndex = dataIndex;\n }, this);\n barMesh.on('mouseout', function (e) {\n this._downplay(lastDataIndex);\n this._labelsBuilder.updateLabels();\n lastDataIndex = -1;\n barMesh.dataIndex = -1;\n\n if (isCartesian3D) {\n api.dispatchAction({\n type: 'grid3DHideAxisPointer'\n });\n }\n }, this);\n },\n\n _highlight: function (dataIndex) {\n var data = this._data;\n if (!data) {\n return;\n }\n var barIndex = this._barIndexOfData[dataIndex];\n if (barIndex < 0) {\n return;\n }\n\n var itemModel = data.getItemModel(dataIndex);\n var emphasisItemStyleModel = itemModel.getModel('emphasis.itemStyle');\n var emphasisColor = emphasisItemStyleModel.get('color');\n var emphasisOpacity = emphasisItemStyleModel.get('opacity');\n if (emphasisColor == null) {\n var color = getItemVisualColor(data, dataIndex);\n emphasisColor = echarts.color.lift(color, -0.4);\n }\n if (emphasisOpacity == null) {\n emphasisOpacity = getItemVisualOpacity(data, dataIndex);\n }\n var colorArr = graphicGL.parseColor(emphasisColor);\n colorArr[3] *= emphasisOpacity;\n\n this._barMesh.geometry.setColor(barIndex, colorArr);\n\n this._api.getZr().refresh();\n },\n\n _downplay: function (dataIndex) {\n var data = this._data;\n if (!data) {\n return;\n }\n var barIndex = this._barIndexOfData[dataIndex];\n if (barIndex < 0) {\n return;\n }\n\n var color = getItemVisualColor(data, dataIndex);\n var opacity = getItemVisualOpacity(data, dataIndex);\n\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= opacity;\n\n this._barMesh.geometry.setColor(barIndex, colorArr);\n\n this._api.getZr().refresh();\n },\n\n highlight: function (seriesModel, ecModel, api, payload) {\n this._toggleStatus('highlight', seriesModel, ecModel, api, payload);\n },\n\n downplay: function (seriesModel, ecModel, api, payload) {\n this._toggleStatus('downplay', seriesModel, ecModel, api, payload);\n },\n\n _toggleStatus: function (status, seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData();\n var dataIndex = retrieve.queryDataIndex(data, payload);\n\n var self = this;\n if (dataIndex != null) {\n echarts.util.each(format.normalizeToArray(dataIndex), function (dataIdx) {\n status === 'highlight' ? this._highlight(dataIdx) : this._downplay(dataIdx);\n }, this);\n }\n else {\n data.each(function (dataIdx) {\n status === 'highlight' ? self._highlight(dataIdx) : self._downplay(dataIdx);\n });\n }\n },\n\n remove: function () {\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n this._labelsBuilder.dispose();\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\n\nimport registerBarLayout from './bar3DLayout';\nimport Bar3DSeries from './Bar3DSeries';\nimport Bar3DView from './Bar3DView';\n\nexport function install(registers) {\n registers.registerChartView(Bar3DView);\n registers.registerSeriesModel(Bar3DSeries);\n\n registerBarLayout(registers);\n\n registers.registerProcessor(function (ecModel, api) {\n ecModel.eachSeriesByType('bar3d', function (seriesModel) {\n var data = seriesModel.getData();\n data.filterSelf(function (idx) {\n return data.hasValue(idx);\n });\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './bar3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport formatTooltip from '../common/formatTooltip';\nimport createList from '../common/createList';\n\nvar Line3DSeries = echarts.SeriesModel.extend({\n\n type: 'series.line3D',\n\n dependencies: ['grid3D'],\n\n visualStyleAccessPath: 'lineStyle',\n visualDrawType: 'stroke',\n\n getInitialData: function (option, ecModel) {\n return createList(this);\n },\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian3D',\n zlevel: -10,\n\n // Cartesian coordinate system\n grid3DIndex: 0,\n\n lineStyle: {\n width: 2\n },\n\n animationDurationUpdate: 500\n }\n});\n\nexport default Line3DSeries;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport * as lineContain from 'zrender/lib/contain/line';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nimport lines3DGLSL from '../../util/shader/lines3D.glsl.js';\n\nvar vec3 = glmatrix.vec3;\n\ngraphicGL.Shader.import(lines3DGLSL);\n\nexport default echarts.ChartView.extend({\n\n type: 'line3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n\n this._api = api;\n },\n\n render: function (seriesModel, ecModel, api) {\n var tmp = this._prevLine3DMesh;\n this._prevLine3DMesh = this._line3DMesh;\n this._line3DMesh = tmp;\n\n if (!this._line3DMesh) {\n this._line3DMesh = new graphicGL.Mesh({\n geometry: new Lines3DGeometry({\n useNativeLine: false,\n sortTriangles: true\n }),\n material: new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.meshLines3D')\n }),\n // Render after axes\n renderOrder: 10\n });\n this._line3DMesh.geometry.pick = this._pick.bind(this);\n }\n\n this.groupGL.remove(this._prevLine3DMesh);\n this.groupGL.add(this._line3DMesh);\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n // TODO\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._line3DMesh.material[methodName]('fragment', 'SRGB_DECODE');\n }\n this._doRender(seriesModel, api);\n\n this._data = seriesModel.getData();\n\n this._camera = coordSys.viewGL.camera;\n\n this.updateCamera();\n\n this._updateAnimation(seriesModel);\n },\n\n updateCamera: function () {\n this._updateNDCPosition();\n },\n\n _doRender: function (seriesModel, api) {\n var data = seriesModel.getData();\n var lineMesh = this._line3DMesh;\n\n lineMesh.geometry.resetOffset();\n\n var points = data.getLayout('points');\n\n var colorArr = [];\n var vertexColors = new Float32Array(points.length / 3 * 4);\n var colorOffset = 0;\n var hasTransparent = false;\n\n data.each(function (idx) {\n var color = getItemVisualColor(data, idx);\n var opacity = getItemVisualOpacity(data, idx);\n if (opacity == null) {\n opacity = 1;\n }\n\n graphicGL.parseColor(color, colorArr);\n colorArr[3] *= opacity;\n vertexColors[colorOffset++] = colorArr[0];\n vertexColors[colorOffset++] = colorArr[1];\n vertexColors[colorOffset++] = colorArr[2];\n vertexColors[colorOffset++] = colorArr[3];\n\n if (colorArr[3] < 0.99) {\n hasTransparent = true;\n }\n });\n\n lineMesh.geometry.setVertexCount(\n lineMesh.geometry.getPolylineVertexCount(points)\n );\n lineMesh.geometry.setTriangleCount(\n lineMesh.geometry.getPolylineTriangleCount(points)\n );\n\n lineMesh.geometry.addPolyline(\n points, vertexColors,\n retrieve.firstNotNull(seriesModel.get('lineStyle.width'), 1)\n );\n\n lineMesh.geometry.dirty();\n lineMesh.geometry.updateBoundingBox();\n\n var material = lineMesh.material;\n material.transparent = hasTransparent;\n material.depthMask = !hasTransparent;\n\n var debugWireframeModel = seriesModel.getModel('debug.wireframe');\n if (debugWireframeModel.get('show')) {\n lineMesh.geometry.createAttribute('barycentric', 'float', 3);\n lineMesh.geometry.generateBarycentric();\n lineMesh.material.set('both', 'WIREFRAME_TRIANGLE');\n lineMesh.material.set(\n 'wireframeLineColor', graphicGL.parseColor(\n debugWireframeModel.get('lineStyle.color') || 'rgba(0,0,0,0.5)'\n )\n );\n lineMesh.material.set(\n 'wireframeLineWidth', retrieve.firstNotNull(\n debugWireframeModel.get('lineStyle.width'), 1\n )\n );\n }\n else {\n lineMesh.material.set('both', 'WIREFRAME_TRIANGLE');\n }\n\n this._points = points;\n\n this._initHandler(seriesModel, api);\n },\n\n _updateAnimation: function (seriesModel) {\n graphicGL.updateVertexAnimation(\n [['prevPosition', 'position'],\n ['prevPositionPrev', 'positionPrev'],\n ['prevPositionNext', 'positionNext']],\n this._prevLine3DMesh,\n this._line3DMesh,\n seriesModel\n );\n },\n\n _initHandler: function (seriesModel, api) {\n var data = seriesModel.getData();\n var coordSys = seriesModel.coordinateSystem;\n var lineMesh = this._line3DMesh;\n\n var lastDataIndex = -1;\n\n lineMesh.seriesIndex = seriesModel.seriesIndex;\n\n lineMesh.off('mousemove');\n lineMesh.off('mouseout');\n lineMesh.on('mousemove', function (e) {\n var value = coordSys.pointToData(e.point.array);\n var dataIndex = data.indicesOfNearest('x', value[0])[0];\n if (dataIndex !== lastDataIndex) {\n // this._downplay(lastDataIndex);\n // this._highlight(dataIndex);\n\n api.dispatchAction({\n type: 'grid3DShowAxisPointer',\n value: [data.get('x', dataIndex), data.get('y', dataIndex), data.get('z', dataIndex)]\n });\n\n lineMesh.dataIndex = dataIndex;\n }\n\n\n lastDataIndex = dataIndex;\n }, this);\n lineMesh.on('mouseout', function (e) {\n // this._downplay(lastDataIndex);\n lastDataIndex = -1;\n lineMesh.dataIndex = -1;\n api.dispatchAction({\n type: 'grid3DHideAxisPointer'\n });\n }, this);\n },\n\n // _highlight: function (dataIndex) {\n // var data = this._data;\n // if (!data) {\n // return;\n // }\n\n // },\n\n // _downplay: function (dataIndex) {\n // var data = this._data;\n // if (!data) {\n // return;\n // }\n // },\n\n _updateNDCPosition: function () {\n\n var worldViewProjection = new Matrix4();\n var camera = this._camera;\n Matrix4.multiply(worldViewProjection, camera.projectionMatrix, camera.viewMatrix);\n\n var positionNDC = this._positionNDC;\n var points = this._points;\n var nPoints = points.length / 3;\n if (!positionNDC || positionNDC.length / 2 !== nPoints) {\n positionNDC = this._positionNDC = new Float32Array(nPoints * 2);\n }\n var pos = [];\n for (var i = 0; i < nPoints; i++) {\n var i3 = i * 3;\n var i2 = i * 2;\n pos[0] = points[i3];\n pos[1] = points[i3 + 1];\n pos[2] = points[i3 + 2];\n pos[3] = 1;\n\n vec3.transformMat4(pos, pos, worldViewProjection.array);\n positionNDC[i2] = pos[0] / pos[3];\n positionNDC[i2 + 1] = pos[1] / pos[3];\n }\n },\n\n _pick: function (x, y, renderer, camera, renderable, out) {\n var positionNDC = this._positionNDC;\n var seriesModel = this._data.hostModel;\n var lineWidth = seriesModel.get('lineStyle.width');\n\n var dataIndex = -1;\n var width = renderer.viewport.width;\n var height = renderer.viewport.height;\n\n var halfWidth = width * 0.5;\n var halfHeight = height * 0.5;\n x = (x + 1) * halfWidth;\n y = (y + 1) * halfHeight;\n\n for (var i = 1; i < positionNDC.length / 2; i++) {\n var x0 = (positionNDC[(i - 1) * 2] + 1) * halfWidth;\n var y0 = (positionNDC[(i - 1) * 2 + 1] + 1) * halfHeight;\n var x1 = (positionNDC[i * 2] + 1) * halfWidth;\n var y1 = (positionNDC[i * 2 + 1] + 1) * halfHeight;\n\n if (lineContain.containStroke(x0, y0, x1, y1, lineWidth, x, y)) {\n var dist0 = (x0 - x) * (x0 - x) + (y0 - y) * (y0 - y);\n var dist1 = (x1 - x) * (x1 - x) + (y1 - y) * (y1 - y);\n // Nearest point.\n dataIndex = dist0 < dist1 ? (i - 1) : i;\n }\n }\n\n if (dataIndex >= 0) {\n var i3 = dataIndex * 3;\n var point = new Vector3(\n this._points[i3],\n this._points[i3 + 1],\n this._points[i3 + 2]\n );\n\n out.push({\n dataIndex: dataIndex,\n point: point,\n pointWorld: point.clone(),\n target: this._line3DMesh,\n distance: this._camera.getWorldPosition().dist(point)\n });\n }\n },\n\n remove: function () {\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Line3DSeries from './Line3DSeries';\nimport Line3DView from './Line3DView';\n\nexport function install(registers) {\n registers.registerChartView(Line3DView);\n registers.registerSeriesModel(Line3DSeries);\n\n registers.registerLayout(function (ecModel, api) {\n ecModel.eachSeriesByType('line3D', function (seriesModel) {\n var data = seriesModel.getData();\n var coordSys = seriesModel.coordinateSystem;\n\n if (coordSys) {\n if (coordSys.type !== 'cartesian3D') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('line3D needs cartesian3D coordinateSystem');\n }\n return;\n }\n var points = new Float32Array(data.count() * 3);\n\n var item = [];\n var out = [];\n\n var coordDims = coordSys.dimensions;\n var dims = coordDims.map(function (coordDim) {\n return seriesModel.coordDimToDataDim(coordDim)[0];\n });\n\n if (coordSys) {\n data.each(dims, function (x, y, z, idx) {\n item[0] = x;\n item[1] = y;\n item[2] = z;\n\n coordSys.dataToPoint(item, out);\n points[idx * 3] = out[0];\n points[idx * 3 + 1] = out[1];\n points[idx * 3 + 2] = out[2];\n });\n }\n data.setLayout('points', points);\n }\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './line3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport formatUtil from '../../util/format';\nimport formatTooltip from '../common/formatTooltip';\nimport createList from '../common/createList';\n\nexport default echarts.SeriesModel.extend({\n\n type: 'series.scatter3D',\n\n dependencies: ['globe', 'grid3D', 'geo3D'],\n\n visualStyleAccessPath: 'itemStyle',\n\n hasSymbolVisual: true,\n\n getInitialData: function (option, ecModel) {\n return createList(this);\n },\n\n getFormattedLabel: function (dataIndex, status, dataType, dimIndex) {\n var text = formatUtil.getFormattedLabel(this, dataIndex, status, dataType, dimIndex);\n if (text == null) {\n var data = this.getData();\n var lastDim = data.dimensions[data.dimensions.length - 1];\n text = data.get(lastDim, dataIndex);\n }\n return text;\n },\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian3D',\n zlevel: -10,\n\n progressive: 1e5,\n progressiveThreshold: 1e5,\n\n // Cartesian coordinate system\n grid3DIndex: 0,\n\n globeIndex: 0,\n\n symbol: 'circle',\n symbolSize: 10,\n\n // Support source-over, lighter\n blendMode: 'source-over',\n\n label: {\n show: false,\n position: 'right',\n // Screen space distance\n distance: 5,\n\n textStyle: {\n fontSize: 14,\n color: '#000',\n backgroundColor: 'rgba(255,255,255,0.7)',\n padding: 3,\n borderRadius: 3\n }\n },\n\n itemStyle: {\n opacity: 0.8\n },\n\n emphasis: {\n label: {\n show: true\n }\n },\n\n animationDurationUpdate: 500\n }\n});","import * as echarts from 'echarts/lib/echarts';\n\nfunction makeSprite(size, canvas, draw) {\n // http://simonsarris.com/blog/346-how-you-clear-your-canvas-matters\n // http://jsperf.com/canvasclear\n // Set width and height is fast\n // And use the exist canvas if possible\n // http://jsperf.com/create-canvas-vs-set-width-height/2\n var canvas = canvas || document.createElement('canvas');\n canvas.width = size;\n canvas.height = size;\n var ctx = canvas.getContext('2d');\n\n draw && draw(ctx);\n\n return canvas;\n}\n\nfunction makePath(symbol, symbolSize, style, marginBias) {\n if (!echarts.util.isArray(symbolSize)) {\n symbolSize = [symbolSize, symbolSize];\n }\n var margin = spriteUtil.getMarginByStyle(style, marginBias);\n var width = symbolSize[0] + margin.left + margin.right;\n var height = symbolSize[1] + margin.top + margin.bottom;\n var path = echarts.helper.createSymbol(symbol, 0, 0, symbolSize[0], symbolSize[1]);\n\n var size = Math.max(width, height);\n\n path.x = margin.left;\n path.y = margin.top;\n if (width > height) {\n path.y += (size - height) / 2;\n }\n else {\n path.x += (size - width) / 2;\n }\n\n var rect = path.getBoundingRect();\n path.x -= rect.x;\n path.y -= rect.y;\n\n path.setStyle(style);\n\n path.update();\n\n path.__size = size;\n\n return path;\n}\n\n // http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf\nfunction generateSDF(ctx, sourceImageData, range) {\n\n var sourceWidth = sourceImageData.width;\n var sourceHeight = sourceImageData.height;\n\n var width = ctx.canvas.width;\n var height = ctx.canvas.height;\n\n var scaleX = sourceWidth / width;\n var scaleY = sourceHeight / height;\n\n function sign(r) {\n return r < 128 ? 1 : -1;\n }\n function searchMinDistance(x, y) {\n var minDistSqr = Infinity;\n x = Math.floor(x * scaleX);\n y = Math.floor(y * scaleY);\n var i = y * sourceWidth + x;\n var r = sourceImageData.data[i * 4];\n var a = sign(r);\n // Search for min distance\n for (var y2 = Math.max(y - range, 0); y2 < Math.min(y + range, sourceHeight); y2++) {\n for (var x2 = Math.max(x - range, 0); x2 < Math.min(x + range, sourceWidth); x2++) {\n var i = y2 * sourceWidth + x2;\n var r2 = sourceImageData.data[i * 4];\n var b = sign(r2);\n var dx = x2 - x;\n var dy = y2 - y;\n if (a !== b) {\n var distSqr = dx * dx + dy * dy;\n if (distSqr < minDistSqr) {\n minDistSqr = distSqr;\n }\n }\n }\n }\n return a * Math.sqrt(minDistSqr);\n }\n\n var sdfImageData = ctx.createImageData(width, height);\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width; x++) {\n var dist = searchMinDistance(x, y);\n\n var normalized = dist / range * 0.5 + 0.5;\n var i = (y * width + x) * 4;\n sdfImageData.data[i++] = (1.0 - normalized) * 255;\n sdfImageData.data[i++] = (1.0 - normalized) * 255;\n sdfImageData.data[i++] = (1.0 - normalized) * 255;\n sdfImageData.data[i++] = 255;\n }\n }\n\n return sdfImageData;\n}\n\nvar spriteUtil = {\n\n getMarginByStyle: function (style) {\n var minMargin = style.minMargin || 0;\n\n var lineWidth = 0;\n if (style.stroke && style.stroke !== 'none') {\n lineWidth = style.lineWidth == null ? 1 : style.lineWidth;\n }\n var shadowBlurSize = style.shadowBlur || 0;\n var shadowOffsetX = style.shadowOffsetX || 0;\n var shadowOffsetY = style.shadowOffsetY || 0;\n\n var margin = {};\n margin.left = Math.max(lineWidth / 2, -shadowOffsetX + shadowBlurSize, minMargin);\n margin.right = Math.max(lineWidth / 2, shadowOffsetX + shadowBlurSize, minMargin);\n margin.top = Math.max(lineWidth / 2, -shadowOffsetY + shadowBlurSize, minMargin);\n margin.bottom = Math.max(lineWidth / 2, shadowOffsetY + shadowBlurSize, minMargin);\n\n return margin;\n },\n\n // TODO Not consider shadowOffsetX, shadowOffsetY.\n /**\n * @param {string} symbol\n * @param {number | Array.} symbolSize\n * @param {Object} style\n */\n createSymbolSprite: function (symbol, symbolSize, style, canvas) {\n var path = makePath(symbol, symbolSize, style);\n\n var margin = spriteUtil.getMarginByStyle(style);\n\n return {\n image: makeSprite(path.__size, canvas, function (ctx) {\n echarts.innerDrawElementOnCanvas(ctx, path);\n }),\n margin: margin\n };\n },\n\n createSDFFromCanvas: function (canvas, size, range, outCanvas) {\n // TODO Create a low resolution SDF from high resolution image.\n return makeSprite(size, outCanvas, function (outCtx) {\n var ctx = canvas.getContext('2d');\n var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);\n\n outCtx.putImageData(generateSDF(outCtx, imgData, range), 0, 0);\n });\n },\n\n createSimpleSprite: function (size, canvas) {\n return makeSprite(size, canvas, function (ctx) {\n var halfSize = size / 2;\n ctx.beginPath();\n ctx.arc(halfSize, halfSize, 60, 0, Math.PI * 2, false) ;\n ctx.closePath();\n\n var gradient = ctx.createRadialGradient(\n halfSize, halfSize, 0, halfSize, halfSize, halfSize\n );\n gradient.addColorStop(0, 'rgba(255, 255, 255, 1)');\n gradient.addColorStop(0.5, 'rgba(255, 255, 255, 0.5)');\n gradient.addColorStop(1, 'rgba(255, 255, 255, 0)');\n ctx.fillStyle = gradient;\n ctx.fill();\n });\n }\n};\n\nexport default spriteUtil;","import ProgressiveQuickSort from '../ProgressiveQuickSort';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\nexport default {\n\n needsSortVertices: function () {\n return this.sortVertices;\n },\n\n needsSortVerticesProgressively: function () {\n return this.needsSortVertices() && this.vertexCount >= 2e4;\n },\n\n doSortVertices: function (cameraPos, frame) {\n var indices = this.indices;\n var p = vec3.create();\n\n if (!indices) {\n indices = this.indices = this.vertexCount > 0xffff ? new Uint32Array(this.vertexCount) : new Uint16Array(this.vertexCount);\n for (var i = 0; i < indices.length; i++) {\n indices[i] = i;\n }\n }\n // Do progressive quick sort.\n if (frame === 0) {\n var posAttr = this.attributes.position;\n var cameraPos = cameraPos.array;\n var noneCount = 0;\n if (!this._zList || this._zList.length !== this.vertexCount) {\n this._zList = new Float32Array(this.vertexCount);\n }\n\n var firstZ;\n for (var i = 0; i < this.vertexCount; i++) {\n posAttr.get(i, p);\n // Camera position is in object space\n var z = vec3.sqrDist(p, cameraPos);\n if (isNaN(z)) {\n // Put far away, NaN value may cause sort slow\n z = 1e7;\n noneCount++;\n }\n if (i === 0) {\n firstZ = z;\n z = 0;\n }\n else {\n // Only store the difference to avoid the precision issue.\n z = z - firstZ;\n }\n this._zList[i] = z;\n }\n\n this._noneCount = noneCount;\n }\n\n if (this.vertexCount < 2e4) {\n // Use simple native sort for simple geometries.\n if (frame === 0) {\n this._simpleSort(this._noneCount / this.vertexCount > 0.05);\n }\n }\n else {\n for (var i = 0; i < 3; i++) {\n this._progressiveQuickSort(frame * 3 + i);\n }\n }\n\n this.dirtyIndices();\n },\n\n _simpleSort: function (useNativeQuickSort) {\n var zList = this._zList;\n var indices = this.indices;\n function compare(a, b) {\n // Sort from far to near. which is descending order\n return zList[b] - zList[a];\n }\n\n // When too much value are equal, using native quick sort with three partition..\n // or the simple quick sort will be nearly O(n*n)\n // http://stackoverflow.com/questions/5126586/quicksort-complexity-when-all-the-elements-are-same\n\n // Otherwise simple quicksort is more effecient than v8 native quick sort when data all different.\n if (useNativeQuickSort) {\n Array.prototype.sort.call(indices, compare);\n }\n else {\n ProgressiveQuickSort.sort(indices, compare, 0, indices.length - 1);\n }\n },\n\n _progressiveQuickSort: function (frame) {\n var zList = this._zList;\n var indices = this.indices;\n\n this._quickSort = this._quickSort || new ProgressiveQuickSort();\n\n this._quickSort.step(indices, function (a, b) {\n return zList[b] - zList[a];\n }, frame);\n }\n};","export default \"@export ecgl.sdfSprite.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform float elapsedTime : 0;\\n\\nattribute vec3 position : POSITION;\\n\\n#ifdef VERTEX_SIZE\\nattribute float size;\\n#else\\nuniform float u_Size;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_FillColor: COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nattribute float prevSize;\\nuniform float percent : 1.0;\\n#endif\\n\\n\\n#ifdef POSITIONTEXTURE_ENABLED\\nuniform sampler2D positionTexture;\\n#endif\\n\\nvarying float v_Size;\\n\\nvoid main()\\n{\\n\\n#ifdef POSITIONTEXTURE_ENABLED\\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\\n#else\\n\\n #ifdef VERTEX_ANIMATION\\n vec3 pos = mix(prevPosition, position, percent);\\n #else\\n vec3 pos = position;\\n #endif\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n#endif\\n\\n#ifdef VERTEX_SIZE\\n#ifdef VERTEX_ANIMATION\\n v_Size = mix(prevSize, size, percent);\\n#else\\n v_Size = size;\\n#endif\\n#else\\n v_Size = u_Size;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\n v_Color = a_FillColor;\\n #endif\\n\\n gl_PointSize = v_Size;\\n}\\n\\n@end\\n\\n@export ecgl.sdfSprite.fragment\\n\\nuniform vec4 color: [1, 1, 1, 1];\\nuniform vec4 strokeColor: [1, 1, 1, 1];\\nuniform float smoothing: 0.07;\\n\\nuniform float lineWidth: 0.0;\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\nvarying float v_Size;\\n\\nuniform sampler2D sprite;\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n gl_FragColor = color;\\n\\n vec4 _strokeColor = strokeColor;\\n\\n#ifdef VERTEX_COLOR\\n gl_FragColor *= v_Color;\\n #endif\\n\\n#ifdef SPRITE_ENABLED\\n float d = texture2D(sprite, gl_PointCoord).r;\\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\\n\\n if (lineWidth > 0.0) {\\n float sLineWidth = lineWidth / 2.0;\\n\\n float outlineMaxValue0 = 0.5 + sLineWidth;\\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\\n float outlineMinValue1 = 0.5 - sLineWidth;\\n\\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\\n float a = _strokeColor.a;\\n if (d <= outlineMinValue1) {\\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\\n }\\n else {\\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\\n }\\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\\n }\\n }\\n#endif\\n\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(gl_FragColor);\\n#endif\\n}\\n@end\";\n","import graphicGL from '../../util/graphicGL';\nimport verticesSortMixin from '../../util/geometry/verticesSortMixin';\nimport * as echarts from 'echarts/lib/echarts';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec4 = glmatrix.vec4;\n\nimport sdfSpriteGLSL from './sdfSprite.glsl.js';\ngraphicGL.Shader.import(sdfSpriteGLSL);\n\nvar PointsMesh = graphicGL.Mesh.extend(function () {\n var geometry = new graphicGL.Geometry({\n dynamic: true,\n attributes: {\n color: new graphicGL.Geometry.Attribute('color', 'float', 4, 'COLOR'),\n position: new graphicGL.Geometry.Attribute('position', 'float', 3, 'POSITION'),\n size: new graphicGL.Geometry.Attribute('size', 'float', 1),\n prevPosition: new graphicGL.Geometry.Attribute('prevPosition', 'float', 3),\n prevSize: new graphicGL.Geometry.Attribute('prevSize', 'float', 1)\n }\n });\n Object.assign(geometry, verticesSortMixin);\n\n var material = new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.sdfSprite'),\n transparent: true,\n depthMask: false\n });\n material.enableTexture('sprite');\n material.define('both', 'VERTEX_COLOR');\n material.define('both', 'VERTEX_SIZE');\n\n var sdfTexture = new graphicGL.Texture2D({\n image: document.createElement('canvas'),\n flipY: false\n });\n\n material.set('sprite', sdfTexture);\n\n // Custom pick methods.\n geometry.pick = this._pick.bind(this);\n\n return {\n geometry: geometry,\n material: material,\n mode: graphicGL.Mesh.POINTS,\n\n sizeScale: 1\n };\n}, {\n\n _pick: function (x, y, renderer, camera, renderable, out) {\n var positionNDC = this._positionNDC;\n if (!positionNDC) {\n return;\n }\n\n var viewport = renderer.viewport;\n var ndcScaleX = 2 / viewport.width;\n var ndcScaleY = 2 / viewport.height;\n // From near to far. indices have been sorted.\n for (var i = this.geometry.vertexCount - 1; i >= 0; i--) {\n var idx;\n if (!this.geometry.indices) {\n idx = i;\n }\n else {\n idx = this.geometry.indices[i];\n }\n\n var cx = positionNDC[idx * 2];\n var cy = positionNDC[idx * 2 + 1];\n\n var size = this.geometry.attributes.size.get(idx) / this.sizeScale;\n var halfSize = size / 2;\n\n if (\n x > (cx - halfSize * ndcScaleX) && x < (cx + halfSize * ndcScaleX)\n && y > (cy - halfSize * ndcScaleY) && y < (cy + halfSize * ndcScaleY)\n ) {\n var point = new graphicGL.Vector3();\n var pointWorld = new graphicGL.Vector3();\n this.geometry.attributes.position.get(idx, point.array);\n graphicGL.Vector3.transformMat4(pointWorld, point, this.worldTransform);\n out.push({\n vertexIndex: idx,\n point: point,\n pointWorld: pointWorld,\n target: this,\n distance: pointWorld.distance(camera.getWorldPosition())\n });\n }\n }\n },\n\n updateNDCPosition: function (worldViewProjection, is2D, api) {\n var positionNDC = this._positionNDC;\n var geometry = this.geometry;\n if (!positionNDC || positionNDC.length / 2 !== geometry.vertexCount) {\n positionNDC = this._positionNDC = new Float32Array(geometry.vertexCount * 2);\n }\n\n var pos = vec4.create();\n for (var i = 0; i < geometry.vertexCount; i++) {\n geometry.attributes.position.get(i, pos);\n pos[3] = 1;\n vec4.transformMat4(pos, pos, worldViewProjection.array);\n vec4.scale(pos, pos, 1 / pos[3]);\n\n positionNDC[i * 2] = pos[0];\n positionNDC[i * 2 + 1] = pos[1];\n }\n }\n});\n\nexport default PointsMesh;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport spriteUtil from '../../util/sprite';\nimport PointsMesh from './PointsMesh';\nimport LabelsBuilder from '../../component/common/LabelsBuilder';\nimport Matrix4 from 'claygl/src/math/Matrix4';\nimport retrieve from '../../util/retrieve';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\nimport { getVisualColor, getVisualOpacity } from '../../util/visual';\n\nvar SDF_RANGE = 20;\n\nvar Z_2D = -10;\n\nfunction isSymbolSizeSame(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1];\n}\n// TODO gl_PointSize has max value.\nfunction PointsBuilder(is2D, api) {\n this.rootNode = new graphicGL.Node();\n\n /**\n * @type {boolean}\n */\n this.is2D = is2D;\n\n this._labelsBuilder = new LabelsBuilder(256, 256, api);\n\n // Give a large render order.\n this._labelsBuilder.getMesh().renderOrder = 100;\n this.rootNode.add(this._labelsBuilder.getMesh());\n\n this._api = api;\n\n this._spriteImageCanvas = document.createElement('canvas');\n\n this._startDataIndex = 0;\n this._endDataIndex = 0;\n\n this._sizeScale = 1;\n}\n\nPointsBuilder.prototype = {\n\n constructor: PointsBuilder,\n\n /**\n * If highlight on over\n */\n highlightOnMouseover: true,\n\n update: function (seriesModel, ecModel, api, start, end) {\n // Swap barMesh\n var tmp = this._prevMesh;\n this._prevMesh = this._mesh;\n this._mesh = tmp;\n\n var data = seriesModel.getData();\n\n if (start == null) {\n start = 0;\n }\n if (end == null) {\n end = data.count();\n }\n this._startDataIndex = start;\n this._endDataIndex = end - 1;\n\n if (!this._mesh) {\n var material = this._prevMesh && this._prevMesh.material;\n this._mesh = new PointsMesh({\n // Render after axes\n renderOrder: 10,\n // FIXME\n frustumCulling: false\n });\n if (material) {\n this._mesh.material = material;\n }\n }\n var material = this._mesh.material;\n var geometry = this._mesh.geometry;\n var attributes = geometry.attributes;\n\n this.rootNode.remove(this._prevMesh);\n this.rootNode.add(this._mesh);\n\n this._setPositionTextureToMesh(this._mesh, this._positionTexture);\n\n var symbolInfo = this._getSymbolInfo(seriesModel, start, end);\n var dpr = api.getDevicePixelRatio();\n\n // TODO image symbol\n var itemStyle = seriesModel.getModel('itemStyle').getItemStyle();\n var largeMode = seriesModel.get('large');\n\n var pointSizeScale = 1;\n if (symbolInfo.maxSize > 2) {\n pointSizeScale = this._updateSymbolSprite(seriesModel, itemStyle, symbolInfo, dpr);\n material.enableTexture('sprite');\n }\n else {\n material.disableTexture('sprite');\n }\n\n attributes.position.init(end - start);\n var rgbaArr = [];\n if (largeMode) {\n material.undefine('VERTEX_SIZE');\n material.undefine('VERTEX_COLOR');\n\n var color = getVisualColor(data);\n var opacity = getVisualOpacity(data);\n graphicGL.parseColor(color, rgbaArr);\n rgbaArr[3] *= opacity;\n\n material.set({\n color: rgbaArr,\n 'u_Size': symbolInfo.maxSize * this._sizeScale\n });\n }\n else {\n material.set({\n color: [1, 1, 1, 1]\n });\n material.define('VERTEX_SIZE');\n material.define('VERTEX_COLOR');\n attributes.size.init(end - start);\n attributes.color.init(end - start);\n this._originalOpacity = new Float32Array(end - start);\n }\n\n var points = data.getLayout('points');\n\n var positionArr = attributes.position.value;\n\n var hasTransparentPoint = false;\n\n for (var i = 0; i < end - start; i++) {\n var i3 = i * 3;\n var i2 = i * 2;\n if (this.is2D) {\n positionArr[i3] = points[i2];\n positionArr[i3 + 1] = points[i2 + 1];\n positionArr[i3 + 2] = Z_2D;\n }\n else {\n positionArr[i3] = points[i3];\n positionArr[i3 + 1] = points[i3 + 1];\n positionArr[i3 + 2] = points[i3 + 2];\n }\n\n if (!largeMode) {\n var color = getItemVisualColor(data, i);\n var opacity = getItemVisualOpacity(data, i);\n graphicGL.parseColor(color, rgbaArr);\n rgbaArr[3] *= opacity;\n attributes.color.set(i, rgbaArr);\n if (rgbaArr[3] < 0.99) {\n hasTransparentPoint = true;\n }\n var symbolSize = data.getItemVisual(i, 'symbolSize');\n symbolSize = (symbolSize instanceof Array\n ? Math.max(symbolSize[0], symbolSize[1]) : symbolSize);\n\n // NaN pointSize may have strange result.\n if (isNaN(symbolSize)) {\n symbolSize = 0;\n }\n // Scale point size because canvas has margin.\n attributes.size.value[i] = symbolSize * pointSizeScale * this._sizeScale;\n\n // Save the original opacity for recover from fadeIn.\n this._originalOpacity[i] = rgbaArr[3];\n }\n\n }\n\n this._mesh.sizeScale = pointSizeScale;\n\n geometry.updateBoundingBox();\n geometry.dirty();\n\n // Update material.\n this._updateMaterial(seriesModel, itemStyle);\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n material[methodName]('fragment', 'SRGB_DECODE');\n }\n\n if (!largeMode) {\n this._updateLabelBuilder(seriesModel, start, end);\n }\n\n this._updateHandler(seriesModel, ecModel, api);\n\n this._updateAnimation(seriesModel);\n\n this._api = api;\n },\n\n getPointsMesh: function () {\n return this._mesh;\n },\n\n updateLabels: function (highlightDataIndices) {\n this._labelsBuilder.updateLabels(highlightDataIndices);\n },\n\n hideLabels: function () {\n this.rootNode.remove(this._labelsBuilder.getMesh());\n },\n\n showLabels: function () {\n this.rootNode.add(this._labelsBuilder.getMesh());\n },\n\n dispose: function () {\n this._labelsBuilder.dispose();\n },\n\n _updateSymbolSprite: function (seriesModel, itemStyle, symbolInfo, dpr) {\n symbolInfo.maxSize = Math.min(symbolInfo.maxSize * 2, 200);\n var symbolSize = [];\n if (symbolInfo.aspect > 1) {\n symbolSize[0] = symbolInfo.maxSize;\n symbolSize[1] = symbolInfo.maxSize / symbolInfo.aspect;\n }\n else {\n symbolSize[1] = symbolInfo.maxSize;\n symbolSize[0] = symbolInfo.maxSize * symbolInfo.aspect;\n }\n\n // In case invalid data.\n symbolSize[0] = symbolSize[0] || 1;\n symbolSize[1] = symbolSize[1] || 1;\n\n if (this._symbolType !== symbolInfo.type\n || !isSymbolSizeSame(this._symbolSize, symbolSize)\n || this._lineWidth !== itemStyle.lineWidth\n ) {\n spriteUtil.createSymbolSprite(symbolInfo.type, symbolSize, {\n fill: '#fff',\n lineWidth: itemStyle.lineWidth,\n stroke: 'transparent',\n shadowColor: 'transparent',\n minMargin: Math.min(symbolSize[0] / 2, 10)\n }, this._spriteImageCanvas);\n\n spriteUtil.createSDFFromCanvas(\n this._spriteImageCanvas, Math.min(this._spriteImageCanvas.width, 32), SDF_RANGE,\n this._mesh.material.get('sprite').image\n );\n\n this._symbolType = symbolInfo.type;\n this._symbolSize = symbolSize;\n this._lineWidth = itemStyle.lineWidth;\n }\n return this._spriteImageCanvas.width / symbolInfo.maxSize * dpr;\n\n },\n\n _updateMaterial: function (seriesModel, itemStyle) {\n var blendFunc = seriesModel.get('blendMode') === 'lighter'\n ? graphicGL.additiveBlend : null;\n var material = this._mesh.material;\n material.blend = blendFunc;\n\n material.set('lineWidth', itemStyle.lineWidth / SDF_RANGE);\n\n var strokeColor = graphicGL.parseColor(itemStyle.stroke);\n material.set('strokeColor', strokeColor);\n\n // Because of symbol texture, we always needs it be transparent.\n material.transparent = true;\n material.depthMask = false;\n material.depthTest = !this.is2D;\n material.sortVertices = !this.is2D;\n },\n\n _updateLabelBuilder: function (seriesModel, start, end) {\n var data =seriesModel.getData();\n var geometry = this._mesh.geometry;\n var positionArr = geometry.attributes.position.value;\n var start = this._startDataIndex;\n var pointSizeScale = this._mesh.sizeScale;\n this._labelsBuilder.updateData(data, start, end);\n\n this._labelsBuilder.getLabelPosition = function (dataIndex, positionDesc, distance) {\n var idx3 = (dataIndex - start) * 3;\n return [positionArr[idx3], positionArr[idx3 + 1], positionArr[idx3 + 2]];\n };\n\n this._labelsBuilder.getLabelDistance = function (dataIndex, positionDesc, distance) {\n var size = geometry.attributes.size.get(dataIndex - start) / pointSizeScale;\n return size / 2 + distance;\n };\n this._labelsBuilder.updateLabels();\n\n },\n\n _updateAnimation: function (seriesModel) {\n graphicGL.updateVertexAnimation(\n [['prevPosition', 'position'],\n ['prevSize', 'size']],\n this._prevMesh,\n this._mesh,\n seriesModel\n );\n },\n\n _updateHandler: function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n var pointsMesh = this._mesh;\n var self = this;\n\n var lastDataIndex = -1;\n var isCartesian3D = seriesModel.coordinateSystem\n && seriesModel.coordinateSystem.type === 'cartesian3D';\n\n var grid3DModel;\n if (isCartesian3D) {\n grid3DModel = seriesModel.coordinateSystem.model;\n }\n\n pointsMesh.seriesIndex = seriesModel.seriesIndex;\n\n pointsMesh.off('mousemove');\n pointsMesh.off('mouseout');\n\n pointsMesh.on('mousemove', function (e) {\n var dataIndex = e.vertexIndex + self._startDataIndex;\n if (dataIndex !== lastDataIndex) {\n if (this.highlightOnMouseover) {\n this.downplay(data, lastDataIndex);\n this.highlight(data, dataIndex);\n this._labelsBuilder.updateLabels([dataIndex]);\n }\n\n if (isCartesian3D) {\n api.dispatchAction({\n type: 'grid3DShowAxisPointer',\n value: [\n data.get(seriesModel.coordDimToDataDim('x')[0], dataIndex),\n data.get(seriesModel.coordDimToDataDim('y')[0], dataIndex),\n data.get(seriesModel.coordDimToDataDim('z')[0], dataIndex)\n ],\n grid3DIndex: grid3DModel.componentIndex\n });\n }\n }\n\n pointsMesh.dataIndex = dataIndex;\n lastDataIndex = dataIndex;\n }, this);\n pointsMesh.on('mouseout', function (e) {\n var dataIndex = e.vertexIndex + self._startDataIndex;\n if (this.highlightOnMouseover) {\n this.downplay(data, dataIndex);\n this._labelsBuilder.updateLabels();\n }\n lastDataIndex = -1;\n pointsMesh.dataIndex = -1;\n\n if (isCartesian3D) {\n api.dispatchAction({\n type: 'grid3DHideAxisPointer',\n grid3DIndex: grid3DModel.componentIndex\n });\n }\n }, this);\n },\n\n updateLayout: function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n if (!this._mesh) {\n return;\n }\n\n var positionArr = this._mesh.geometry.attributes.position.value;\n var points = data.getLayout('points');\n if (this.is2D) {\n for (var i = 0; i < points.length / 2; i++) {\n var i3 = i * 3;\n var i2 = i * 2;\n positionArr[i3] = points[i2];\n positionArr[i3 + 1] = points[i2 + 1];\n positionArr[i3 + 2] = Z_2D;\n }\n }\n else {\n for (var i = 0; i < points.length; i++) {\n positionArr[i] = points[i];\n }\n }\n this._mesh.geometry.dirty();\n\n api.getZr().refresh();\n },\n\n updateView: function (camera) {\n if (!this._mesh) {\n return;\n }\n\n var worldViewProjection = new Matrix4();\n Matrix4.mul(worldViewProjection, camera.viewMatrix, this._mesh.worldTransform);\n Matrix4.mul(worldViewProjection, camera.projectionMatrix, worldViewProjection);\n\n this._mesh.updateNDCPosition(worldViewProjection, this.is2D, this._api);\n },\n\n highlight: function (data, dataIndex) {\n if (dataIndex > this._endDataIndex || dataIndex < this._startDataIndex) {\n return;\n }\n var itemModel = data.getItemModel(dataIndex);\n var emphasisItemStyleModel = itemModel.getModel('emphasis.itemStyle');\n var emphasisColor = emphasisItemStyleModel.get('color');\n var emphasisOpacity = emphasisItemStyleModel.get('opacity');\n if (emphasisColor == null) {\n var color = getItemVisualColor(data, dataIndex);\n emphasisColor = echarts.color.lift(color, -0.4);\n }\n if (emphasisOpacity == null) {\n emphasisOpacity = getItemVisualOpacity(data, dataIndex);\n }\n var colorArr = graphicGL.parseColor(emphasisColor);\n colorArr[3] *= emphasisOpacity;\n\n this._mesh.geometry.attributes.color.set(dataIndex - this._startDataIndex, colorArr);\n this._mesh.geometry.dirtyAttribute('color');\n\n this._api.getZr().refresh();\n },\n\n downplay: function (data, dataIndex) {\n if (dataIndex > this._endDataIndex || dataIndex < this._startDataIndex) {\n return;\n }\n var color = getItemVisualColor(data, dataIndex);\n var opacity = getItemVisualOpacity(data, dataIndex);\n\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= opacity;\n\n this._mesh.geometry.attributes.color.set(dataIndex - this._startDataIndex, colorArr);\n this._mesh.geometry.dirtyAttribute('color');\n\n this._api.getZr().refresh();\n },\n\n fadeOutAll: function (fadeOutPercent) {\n if (this._originalOpacity) {\n var geo = this._mesh.geometry;\n for (var i = 0; i < geo.vertexCount; i++) {\n var fadeOutOpacity = this._originalOpacity[i] * fadeOutPercent;\n geo.attributes.color.value[i * 4 + 3] = fadeOutOpacity;\n }\n geo.dirtyAttribute('color');\n\n this._api.getZr().refresh();\n }\n },\n\n fadeInAll: function () {\n this.fadeOutAll(1);\n },\n\n setPositionTexture: function (texture) {\n if (this._mesh) {\n this._setPositionTextureToMesh(this._mesh, texture);\n }\n\n this._positionTexture = texture;\n },\n\n removePositionTexture: function () {\n this._positionTexture = null;\n if (this._mesh) {\n this._setPositionTextureToMesh(this._mesh, null);\n }\n },\n\n setSizeScale: function (sizeScale) {\n if (sizeScale !== this._sizeScale) {\n if (this._mesh) {\n var originalSize = this._mesh.material.get('u_Size');\n this._mesh.material.set('u_Size', originalSize / this._sizeScale * sizeScale);\n\n var attributes = this._mesh.geometry.attributes;\n if (attributes.size.value) {\n for (var i = 0; i < attributes.size.value.length; i++) {\n attributes.size.value[i] = attributes.size.value[i] / this._sizeScale * sizeScale;\n }\n }\n }\n this._sizeScale = sizeScale;\n }\n },\n\n _setPositionTextureToMesh: function (mesh, texture) {\n if (texture) {\n mesh.material.set('positionTexture', texture);\n }\n mesh.material[\n texture ? 'enableTexture' : 'disableTexture'\n ]('positionTexture');\n },\n\n _getSymbolInfo: function (seriesModel, start, end) {\n if (seriesModel.get('large')) {\n var symbolSize = retrieve.firstNotNull(seriesModel.get('symbolSize'), 1);\n var maxSymbolSize;\n var symbolAspect;\n if (symbolSize instanceof Array) {\n maxSymbolSize = Math.max(symbolSize[0], symbolSize[1]);\n symbolAspect = symbolSize[0] / symbolSize[1];\n }\n else {\n maxSymbolSize = symbolSize;\n symbolAspect = 1;\n }\n return {\n maxSize: symbolSize,\n type: seriesModel.get('symbol'),\n aspect: symbolAspect\n }\n }\n var data = seriesModel.getData();\n var symbolAspect;\n var differentSymbolAspect = false;\n var symbolType = data.getItemVisual(0, 'symbol') || 'circle';\n var differentSymbolType = false;\n var maxSymbolSize = 0;\n\n for (var idx = start; idx < end; idx++) {\n var symbolSize = data.getItemVisual(idx, 'symbolSize');\n var currentSymbolType = data.getItemVisual(idx, 'symbol');\n var currentSymbolAspect;\n if (!(symbolSize instanceof Array)) {\n // Ignore NaN value.\n if (isNaN(symbolSize)) {\n continue;\n }\n\n currentSymbolAspect = 1;\n maxSymbolSize = Math.max(symbolSize, maxSymbolSize);\n }\n else {\n currentSymbolAspect = symbolSize[0] / symbolSize[1];\n maxSymbolSize = Math.max(Math.max(symbolSize[0], symbolSize[1]), maxSymbolSize);\n }\n if (process.env.NODE_ENV !== 'production') {\n if (symbolAspect != null && Math.abs(currentSymbolAspect - symbolAspect) > 0.05) {\n differentSymbolAspect = true;\n }\n if (currentSymbolType !== symbolType) {\n differentSymbolType = true;\n }\n }\n symbolType = currentSymbolType;\n symbolAspect = currentSymbolAspect;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (differentSymbolAspect) {\n console.warn('Different symbol width / height ratio will be ignored.');\n }\n if (differentSymbolType) {\n console.warn('Different symbol type will be ignored.');\n }\n }\n\n return {\n maxSize: maxSymbolSize,\n type: symbolType,\n aspect: symbolAspect\n };\n }\n};\n\nexport default PointsBuilder;\n","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport format from '../../util/format';\n\nimport PointsBuilder from '../common/PointsBuilder';\n\nexport default echarts.ChartView.extend({\n\n type: 'scatter3D',\n\n hasSymbolVisual: true,\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n\n this._pointsBuilderList = [];\n this._currentStep = 0;\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n if (!seriesModel.getData().count()) {\n return;\n }\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n this._camera = coordSys.viewGL.camera;\n\n var pointsBuilder = this._pointsBuilderList[0];\n if (!pointsBuilder) {\n pointsBuilder = this._pointsBuilderList[0] = new PointsBuilder(false, api);\n }\n this._pointsBuilderList.length = 1;\n\n this.groupGL.add(pointsBuilder.rootNode);\n pointsBuilder.update(seriesModel, ecModel, api);\n pointsBuilder.updateView(coordSys.viewGL.camera);\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invalid coordinate system');\n }\n }\n },\n\n incrementalPrepareRender: function (seriesModel, ecModel, api) {\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n this._camera = coordSys.viewGL.camera;\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invalid coordinate system');\n }\n }\n\n this.groupGL.removeAll();\n this._currentStep = 0;\n },\n\n incrementalRender: function (params, seriesModel, ecModel, api) {\n // TODO Sort transparency.\n if (params.end <= params.start) {\n return;\n }\n var pointsBuilder = this._pointsBuilderList[this._currentStep];\n if (!pointsBuilder) {\n pointsBuilder = new PointsBuilder(false, api);\n this._pointsBuilderList[this._currentStep] = pointsBuilder;\n }\n this.groupGL.add(pointsBuilder.rootNode);\n\n pointsBuilder.update(seriesModel, ecModel, api, params.start, params.end);\n pointsBuilder.updateView(seriesModel.coordinateSystem.viewGL.camera);\n\n this._currentStep++;\n },\n\n updateCamera: function () {\n this._pointsBuilderList.forEach(function (pointsBuilder) {\n pointsBuilder.updateView(this._camera);\n }, this);\n },\n\n highlight: function (seriesModel, ecModel, api, payload) {\n this._toggleStatus('highlight', seriesModel, ecModel, api, payload);\n },\n\n downplay: function (seriesModel, ecModel, api, payload) {\n this._toggleStatus('downplay', seriesModel, ecModel, api, payload);\n },\n\n _toggleStatus: function (status, seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData();\n var dataIndex = retrieve.queryDataIndex(data, payload);\n\n var isHighlight = status === 'highlight';\n if (dataIndex != null) {\n echarts.util.each(format.normalizeToArray(dataIndex), function (dataIdx) {\n for (var i = 0; i < this._pointsBuilderList.length; i++) {\n var pointsBuilder = this._pointsBuilderList[i];\n isHighlight ? pointsBuilder.highlight(data, dataIdx) : pointsBuilder.downplay(data, dataIdx);\n }\n }, this);\n }\n else {\n // PENDING, OPTIMIZE\n data.each(function (dataIdx) {\n for (var i = 0; i < this._pointsBuilderList.length; i++) {\n var pointsBuilder = this._pointsBuilderList[i];\n isHighlight ? pointsBuilder.highlight(data, dataIdx) : pointsBuilder.downplay(data, dataIdx);\n }\n });\n }\n },\n\n dispose: function () {\n this._pointsBuilderList.forEach(function (pointsBuilder) {\n pointsBuilder.dispose();\n });\n this.groupGL.removeAll();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Scatter3DSeries from './Scatter3DSeries';\nimport Scatter3DView from './Scatter3DView';\n\nexport function install(registers) {\n registers.registerChartView(Scatter3DView);\n registers.registerSeriesModel(Scatter3DSeries);\n\n registers.registerLayout({\n seriesType: 'scatter3D',\n reset: function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n\n if (coordSys) {\n var coordDims = coordSys.dimensions;\n if (coordDims.length < 3) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('scatter3D needs 3D coordinateSystem');\n }\n return;\n }\n var dims = coordDims.map(function (coordDim) {\n return seriesModel.coordDimToDataDim(coordDim)[0];\n });\n\n var item = [];\n var out = [];\n\n return {\n progress: function (params, data) {\n var points = new Float32Array((params.end - params.start) * 3);\n for (var idx = params.start; idx < params.end; idx++) {\n var idx3 = (idx - params.start) * 3;\n item[0] = data.get(dims[0], idx);\n item[1] = data.get(dims[1], idx);\n item[2] = data.get(dims[2], idx);\n coordSys.dataToPoint(item, out);\n points[idx3] = out[0];\n points[idx3 + 1] = out[1];\n points[idx3 + 2] = out[2];\n }\n data.setLayout('points', points);\n }\n };\n }\n }\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './scatter3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\nvar vec2 = glmatrix.vec2;\nvar normalize = vec3.normalize;\nvar cross = vec3.cross;\nvar sub = vec3.sub;\nvar add = vec3.add;\nvar create = vec3.create;\n\nvar normal = create();\nvar tangent = create();\nvar bitangent = create();\nvar halfVector = create();\n\nvar coord0 = [];\nvar coord1 = [];\n\nfunction getCubicPointsOnGlobe(coords, coordSys) {\n vec2.copy(coord0, coords[0]);\n vec2.copy(coord1, coords[1]);\n\n var pts = [];\n var p0 = pts[0] = create();\n var p1 = pts[1] = create();\n var p2 = pts[2] = create();\n var p3 = pts[3] = create();\n coordSys.dataToPoint(coord0, p0);\n coordSys.dataToPoint(coord1, p3);\n // Get p1\n normalize(normal, p0);\n // TODO p0-p3 is parallel with normal\n sub(tangent, p3, p0);\n normalize(tangent, tangent);\n cross(bitangent, tangent, normal);\n normalize(bitangent, bitangent);\n cross(tangent, normal, bitangent);\n // p1 is half vector of p0 and tangent on p0\n add(p1, normal, tangent);\n normalize(p1, p1);\n\n // Get p2\n normalize(normal, p3);\n sub(tangent, p0, p3);\n normalize(tangent, tangent);\n cross(bitangent, tangent, normal);\n normalize(bitangent, bitangent);\n cross(tangent, normal, bitangent);\n // p2 is half vector of p3 and tangent on p3\n add(p2, normal, tangent);\n normalize(p2, p2);\n\n // Project distance of p0 on halfVector\n add(halfVector, p0, p3);\n normalize(halfVector, halfVector);\n var projDist = vec3.dot(p0, halfVector);\n // Angle of halfVector and p1\n var cosTheta = vec3.dot(halfVector, p1);\n\n var len = (Math.max(vec3.len(p0), vec3.len(p3)) - projDist) / cosTheta * 2;\n\n vec3.scaleAndAdd(p1, p0, p1, len);\n vec3.scaleAndAdd(p2, p3, p2, len);\n\n return pts;\n}\n\nfunction getCubicPointsOnPlane(coords, coordSys, up) {\n var pts = [];\n var p0 = pts[0] = vec3.create();\n var p1 = pts[1] = vec3.create();\n var p2 = pts[2] = vec3.create();\n var p3 = pts[3] = vec3.create();\n\n coordSys.dataToPoint(coords[0], p0);\n coordSys.dataToPoint(coords[1], p3);\n\n var len = vec3.dist(p0, p3);\n vec3.lerp(p1, p0, p3, 0.3);\n vec3.lerp(p2, p0, p3, 0.3);\n\n vec3.scaleAndAdd(p1, p1, up, Math.min(len * 0.1, 10));\n vec3.scaleAndAdd(p2, p2, up, Math.min(len * 0.1, 10));\n\n return pts;\n}\n\nfunction getPolylinePoints(coords, coordSys) {\n var pts = new Float32Array(coords.length * 3);\n var off = 0;\n var pt = [];\n for (var i = 0; i < coords.length; i++) {\n coordSys.dataToPoint(coords[i], pt);\n pts[off++] = pt[0];\n pts[off++] = pt[1];\n pts[off++] = pt[2];\n }\n return pts;\n}\n\nfunction prepareCoords(data) {\n var coordsList = [];\n\n data.each(function (idx) {\n var itemModel = data.getItemModel(idx);\n var coords = (itemModel.option instanceof Array) ?\n itemModel.option : itemModel.getShallow('coords', true);\n\n if (process.env.NODE_ENV !== 'production') {\n if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) {\n throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.');\n }\n }\n coordsList.push(coords);\n });\n\n return {\n coordsList: coordsList\n };\n}\n\nfunction layoutGlobe(seriesModel, coordSys) {\n var data = seriesModel.getData();\n var isPolyline = seriesModel.get('polyline');\n\n data.setLayout('lineType', isPolyline ? 'polyline' : 'cubicBezier');\n\n var res = prepareCoords(data);\n\n data.each(function (idx) {\n var coords = res.coordsList[idx];\n var getPointsMethod = isPolyline ? getPolylinePoints : getCubicPointsOnGlobe;\n data.setItemLayout(idx, getPointsMethod(coords, coordSys));\n });\n}\n\nfunction layoutOnPlane(seriesModel, coordSys, normal) {\n var data = seriesModel.getData();\n var isPolyline = seriesModel.get('polyline');\n\n var res = prepareCoords(data);\n\n data.setLayout('lineType', isPolyline ? 'polyline' : 'cubicBezier');\n\n data.each(function (idx) {\n var coords = res.coordsList[idx];\n var pts = isPolyline ? getPolylinePoints(coords, coordSys)\n : getCubicPointsOnPlane(coords, coordSys, normal);\n data.setItemLayout(idx, pts);\n });\n}\n\nexport default function lines3DLayout(ecModel, api) {\n ecModel.eachSeriesByType('lines3D', function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys.type === 'globe') {\n layoutGlobe(seriesModel, coordSys);\n }\n else if (coordSys.type === 'geo3D') {\n layoutOnPlane(seriesModel, coordSys, [0, 1, 0]);\n }\n else if (coordSys.type === 'mapbox3D' || coordSys.type === 'maptalks3D') {\n layoutOnPlane(seriesModel, coordSys, [0, 0, 1]);\n }\n });\n};","import * as echarts from 'echarts/lib/echarts';\n\nexport default echarts.SeriesModel.extend({\n\n type: 'series.lines3D',\n\n dependencies: ['globe'],\n\n visualStyleAccessPath: 'lineStyle',\n visualDrawType: 'stroke',\n\n getInitialData: function (option, ecModel) {\n var lineData = new echarts.List(['value'], this);\n lineData.hasItemOption = false;\n lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {\n // dataItem is simply coords\n if (dataItem instanceof Array) {\n return NaN;\n }\n else {\n lineData.hasItemOption = true;\n var value = dataItem.value;\n if (value != null) {\n return value instanceof Array ? value[dimIndex] : value;\n }\n }\n });\n\n return lineData;\n },\n\n defaultOption: {\n\n coordinateSystem: 'globe',\n\n globeIndex: 0,\n\n geo3DIndex: 0,\n\n zlevel: -10,\n\n polyline: false,\n\n effect: {\n show: false,\n period: 4,\n // Trail width\n trailWidth: 4,\n trailLength: 0.2,\n\n spotIntensity: 6\n },\n\n silent: true,\n\n // Support source-over, lighter\n blendMode: 'source-over',\n\n lineStyle: {\n width: 1,\n opacity: 0.5\n // color\n }\n }\n});","export default \"@export ecgl.trail2.vertex\\nattribute vec3 position: POSITION;\\nattribute vec3 positionPrev;\\nattribute vec3 positionNext;\\nattribute float offset;\\nattribute float dist;\\nattribute float distAll;\\nattribute float start;\\n\\nattribute vec4 a_Color : COLOR;\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform vec4 viewport : VIEWPORT;\\nuniform float near : NEAR;\\n\\nuniform float speed : 0;\\nuniform float trailLength: 0.3;\\nuniform float time;\\nuniform float period: 1000;\\n\\nuniform float spotSize: 1;\\n\\nvarying vec4 v_Color;\\nvarying float v_Percent;\\nvarying float v_SpotPercent;\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n@import ecgl.lines3D.clipNear\\n\\nvoid main()\\n{\\n @import ecgl.lines3D.expandLine\\n\\n gl_Position = currProj;\\n\\n v_Color = a_Color;\\n\\n @import ecgl.common.wireframe.vertexMain\\n\\n#ifdef CONSTANT_SPEED\\n float t = mod((speed * time + start) / distAll, 1. + trailLength) - trailLength;\\n#else\\n float t = mod((time + start) / period, 1. + trailLength) - trailLength;\\n#endif\\n\\n float trailLen = distAll * trailLength;\\n\\n v_Percent = (dist - t * distAll) / trailLen;\\n\\n v_SpotPercent = spotSize / distAll;\\n\\n }\\n@end\\n\\n\\n@export ecgl.trail2.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\nuniform float spotIntensity: 5;\\n\\nvarying vec4 v_Color;\\nvarying float v_Percent;\\nvarying float v_SpotPercent;\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n if (v_Percent > 1.0 || v_Percent < 0.0) {\\n discard;\\n }\\n\\n float fade = v_Percent;\\n\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color * v_Color);\\n#else\\n gl_FragColor = color * v_Color;\\n#endif\\n\\n @import ecgl.common.wireframe.fragmentMain\\n\\n if (v_Percent > (1.0 - v_SpotPercent)) {\\n gl_FragColor.rgb *= spotIntensity;\\n }\\n\\n gl_FragColor.a *= fade;\\n}\\n\\n@end\";\n","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport glmatrix from 'claygl/src/dep/glmatrix';\n\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport trail2GLSL from './shader/trail2.glsl.js';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nvar vec3 = glmatrix.vec3;\n\nfunction sign(a) {\n return a > 0 ? 1 : -1;\n}\n\ngraphicGL.Shader.import(trail2GLSL);\n\nexport default graphicGL.Mesh.extend(function () {\n\n var material = new graphicGL.Material({\n shader: new graphicGL.Shader(\n graphicGL.Shader.source('ecgl.trail2.vertex'),\n graphicGL.Shader.source('ecgl.trail2.fragment')\n ),\n transparent: true,\n depthMask: false\n });\n\n var geometry = new Lines3DGeometry({\n dynamic: true\n });\n geometry.createAttribute('dist', 'float', 1);\n geometry.createAttribute('distAll', 'float', 1);\n geometry.createAttribute('start', 'float', 1);\n\n return {\n geometry: geometry,\n material: material,\n culling: false,\n $ignorePicking: true\n };\n}, {\n\n updateData: function (data, api, lines3DGeometry) {\n var seriesModel = data.hostModel;\n var geometry = this.geometry;\n\n var effectModel = seriesModel.getModel('effect');\n var size = effectModel.get('trailWidth') * api.getDevicePixelRatio();\n var trailLength = effectModel.get('trailLength');\n\n var speed = seriesModel.get('effect.constantSpeed');\n var period = seriesModel.get('effect.period') * 1000;\n var useConstantSpeed = speed != null;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!this.getScene()) {\n console.error('TrailMesh must been add to scene before updateData');\n }\n }\n\n useConstantSpeed\n ? this.material.set('speed', speed / 1000)\n : this.material.set('period', period);\n\n this.material[useConstantSpeed ? 'define' : 'undefine']('vertex', 'CONSTANT_SPEED');\n\n var isPolyline = seriesModel.get('polyline');\n\n geometry.trailLength = trailLength;\n this.material.set('trailLength', trailLength);\n\n geometry.resetOffset();\n\n ['position', 'positionPrev', 'positionNext'].forEach(function (attrName) {\n geometry.attributes[attrName].value = lines3DGeometry.attributes[attrName].value;\n });\n\n var extraAttrs = ['dist', 'distAll', 'start', 'offset', 'color'];\n\n extraAttrs.forEach(function (attrName) {\n geometry.attributes[attrName].init(geometry.vertexCount);\n });\n geometry.indices = lines3DGeometry.indices;\n\n var colorArr = [];\n var effectColor = effectModel.get('trailColor');\n var effectOpacity = effectModel.get('trailOpacity');\n var hasEffectColor = effectColor != null;\n var hasEffectOpacity = effectOpacity != null;\n\n this.updateWorldTransform();\n var xScale = this.worldTransform.x.len();\n var yScale = this.worldTransform.y.len();\n var zScale = this.worldTransform.z.len();\n\n var vertexOffset = 0;\n\n var maxDistance = 0;\n\n data.each(function (idx) {\n var pts = data.getItemLayout(idx);\n var opacity = hasEffectOpacity ? effectOpacity : getItemVisualOpacity(data, idx);\n var color = getItemVisualColor(data, idx);\n\n if (opacity == null) {\n opacity = 1;\n }\n colorArr = graphicGL.parseColor(hasEffectColor ? effectColor : color, colorArr);\n colorArr[3] *= opacity;\n\n var vertexCount = isPolyline\n ? lines3DGeometry.getPolylineVertexCount(pts)\n : lines3DGeometry.getCubicCurveVertexCount(pts[0], pts[1], pts[2], pts[3])\n\n var dist = 0;\n var pos = [];\n var posPrev = [];\n for (var i = vertexOffset; i < vertexOffset + vertexCount; i++) {\n geometry.attributes.position.get(i, pos);\n pos[0] *= xScale;\n pos[1] *= yScale;\n pos[2] *= zScale;\n if (i > vertexOffset) {\n dist += vec3.dist(pos, posPrev);\n }\n geometry.attributes.dist.set(i, dist);\n vec3.copy(posPrev, pos);\n }\n\n maxDistance = Math.max(maxDistance, dist);\n\n var randomStart = Math.random() * (useConstantSpeed ? dist : period);\n for (var i = vertexOffset; i < vertexOffset + vertexCount; i++) {\n geometry.attributes.distAll.set(i, dist);\n geometry.attributes.start.set(i, randomStart);\n\n geometry.attributes.offset.set(\n i, sign(lines3DGeometry.attributes.offset.get(i)) * size / 2\n );\n geometry.attributes.color.set(i, colorArr);\n }\n\n vertexOffset += vertexCount;\n });\n\n this.material.set('spotSize', maxDistance * 0.1 * trailLength);\n this.material.set('spotIntensity', effectModel.get('spotIntensity'));\n\n geometry.dirty();\n },\n\n setAnimationTime: function (time) {\n this.material.set('time', time);\n }\n});","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport LinesGeometry from '../../util/geometry/Lines3D';\n// import TrailMesh from './TrailMesh';\nimport TrailMesh2 from './TrailMesh2';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nimport lines3DGLSL from '../../util/shader/lines3D.glsl.js';\ngraphicGL.Shader.import(lines3DGLSL);\n\nfunction getCoordSysSize(coordSys) {\n if (coordSys.radius != null) {\n return coordSys.radius;\n }\n if (coordSys.size != null) {\n return Math.max(coordSys.size[0], coordSys.size[1], coordSys.size[2]);\n }\n else {\n return 100;\n }\n}\n\nexport default echarts.ChartView.extend({\n\n type: 'lines3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this.groupGL = new graphicGL.Node();\n\n this._meshLinesMaterial = new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.meshLines3D'),\n transparent: true,\n depthMask: false\n });\n this._linesMesh = new graphicGL.Mesh({\n geometry: new LinesGeometry(),\n material: this._meshLinesMaterial,\n $ignorePicking: true\n });\n\n // this._trailMesh = new TrailMesh();\n this._trailMesh = new TrailMesh2();\n },\n\n render: function (seriesModel, ecModel, api) {\n\n this.groupGL.add(this._linesMesh);\n\n var coordSys = seriesModel.coordinateSystem;\n var data = seriesModel.getData();\n\n if (coordSys && coordSys.viewGL) {\n var viewGL = coordSys.viewGL;\n viewGL.add(this.groupGL);\n\n this._updateLines(seriesModel, ecModel, api);\n\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._linesMesh.material[methodName]('fragment', 'SRGB_DECODE');\n this._trailMesh.material[methodName]('fragment', 'SRGB_DECODE');\n }\n\n var trailMesh = this._trailMesh;\n trailMesh.stopAnimation();\n\n if (seriesModel.get('effect.show')) {\n this.groupGL.add(trailMesh);\n\n trailMesh.updateData(data, api, this._linesMesh.geometry);\n\n trailMesh.__time = trailMesh.__time || 0;\n var time = 3600 * 1000; // 1hour\n this._curveEffectsAnimator = trailMesh.animate('', { loop: true })\n .when(time, {\n __time: time\n })\n .during(function () {\n trailMesh.setAnimationTime(trailMesh.__time);\n })\n .start();\n }\n else {\n this.groupGL.remove(trailMesh);\n this._curveEffectsAnimator = null;\n }\n\n this._linesMesh.material.blend = this._trailMesh.material.blend\n = seriesModel.get('blendMode') === 'lighter'\n ? graphicGL.additiveBlend : null;\n },\n\n pauseEffect: function () {\n if (this._curveEffectsAnimator) {\n this._curveEffectsAnimator.pause();\n }\n },\n\n resumeEffect: function () {\n if (this._curveEffectsAnimator) {\n this._curveEffectsAnimator.resume();\n }\n },\n\n toggleEffect: function () {\n var animator = this._curveEffectsAnimator;\n if (animator) {\n animator.isPaused() ? animator.resume() : animator.pause();\n }\n },\n\n _updateLines: function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n var coordSys = seriesModel.coordinateSystem;\n var geometry = this._linesMesh.geometry;\n var isPolyline = seriesModel.get('polyline');\n\n geometry.expandLine = true;\n\n var size = getCoordSysSize(coordSys);\n geometry.segmentScale = size / 20;\n\n var lineWidthQueryPath = 'lineStyle.width'.split('.');\n var dpr = api.getDevicePixelRatio();\n var maxLineWidth = 0;\n data.each(function (idx) {\n var itemModel = data.getItemModel(idx);\n var lineWidth = itemModel.get(lineWidthQueryPath);\n if (lineWidth == null) {\n lineWidth = 1;\n }\n data.setItemVisual(idx, 'lineWidth', lineWidth);\n maxLineWidth = Math.max(lineWidth, maxLineWidth);\n });\n\n // Must set useNativeLine before calling any other methods\n geometry.useNativeLine = false;\n\n var nVertex = 0;\n var nTriangle = 0;\n data.each(function (idx) {\n var pts = data.getItemLayout(idx);\n if (isPolyline) {\n nVertex += geometry.getPolylineVertexCount(pts);\n nTriangle += geometry.getPolylineTriangleCount(pts);\n }\n else {\n nVertex += geometry.getCubicCurveVertexCount(pts[0], pts[1], pts[2], pts[3]);\n nTriangle += geometry.getCubicCurveTriangleCount(pts[0], pts[1], pts[2], pts[3]);\n }\n });\n\n geometry.setVertexCount(nVertex);\n geometry.setTriangleCount(nTriangle);\n geometry.resetOffset();\n\n var colorArr = [];\n data.each(function (idx) {\n var pts = data.getItemLayout(idx);\n var color = getItemVisualColor(data, idx);\n var opacity = getItemVisualOpacity(data, idx);\n var lineWidth = data.getItemVisual(idx, 'lineWidth') * dpr;\n if (opacity == null) {\n opacity = 1;\n }\n\n colorArr = graphicGL.parseColor(color, colorArr);\n colorArr[3] *= opacity;\n if (isPolyline) {\n geometry.addPolyline(pts, colorArr, lineWidth);\n }\n else {\n geometry.addCubicCurve(pts[0], pts[1], pts[2], pts[3], colorArr, lineWidth);\n }\n });\n\n geometry.dirty();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport lines3DLayout from './lines3DLayout';\nimport Lines3DSeries from './Lines3DSeries';\nimport Lines3DView from './Lines3DView';\n\nexport function install(registers) {\n registers.registerChartView(Lines3DView);\n registers.registerSeriesModel(Lines3DSeries);\n\n registers.registerLayout(lines3DLayout);\n\n registers.registerAction({\n type: 'lines3DPauseEffect',\n event: 'lines3deffectpaused',\n update: 'series.lines3D:pauseEffect'\n }, function () {});\n\n registers.registerAction({\n type: 'lines3DResumeEffect',\n event: 'lines3deffectresumed',\n update: 'series.lines3D:resumeEffect'\n }, function () {});\n\n registers.registerAction({\n type: 'lines3DToggleEffect',\n event: 'lines3deffectchanged',\n update: 'series.lines3D:toggleEffect'\n }, function () {});\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './lines3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport componentShadingMixin from '../../component/common/componentShadingMixin';\n\nfunction transformPolygon(coordSys, poly) {\n var ret = [];\n for (var i = 0; i < poly.length; i++) {\n ret.push(coordSys.dataToPoint(poly[i]));\n }\n return ret;\n}\n\nvar Polygons3DSeries = echarts.SeriesModel.extend({\n\n type: 'series.polygons3D',\n\n getRegionModel: function (idx) {\n return this.getData().getItemModel(idx);\n },\n\n getRegionPolygonCoords: function (idx) {\n var coordSys = this.coordinateSystem;\n var itemModel = this.getData().getItemModel(idx);\n var coords = itemModel.option instanceof Array\n ? itemModel.option : itemModel.getShallow('coords');\n if (!itemModel.get('multiPolygon')) {\n coords = [coords];\n }\n // TODO Validate\n var out = [];\n for (var i = 0; i < coords.length; i++) {\n // TODO Convert here ?\n var interiors = [];\n for (var k = 1; k < coords[i].length; k++) {\n interiors.push(transformPolygon(coordSys, coords[i][k]));\n }\n out.push({\n exterior: transformPolygon(coordSys, coords[i][0]),\n interiors: interiors\n });\n }\n return out;\n },\n\n getInitialData: function (option) {\n var polygonsData = new echarts.List(['value'], this);\n polygonsData.hasItemOption = false;\n polygonsData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {\n // dataItem is simply coords\n if (dataItem instanceof Array) {\n return NaN;\n }\n else {\n polygonsData.hasItemOption = true;\n var value = dataItem.value;\n if (value != null) {\n return value instanceof Array ? value[dimIndex] : value;\n }\n }\n });\n\n return polygonsData;\n },\n\n defaultOption: {\n\n show: true,\n\n data: null,\n\n multiPolygon: false,\n\n progressiveThreshold: 1e3,\n progressive: 1e3,\n\n zlevel: -10,\n\n label: {\n show: false,\n // Distance in 3d space.\n distance: 2,\n\n textStyle: {\n fontSize: 20,\n color: '#000',\n backgroundColor: 'rgba(255,255,255,0.7)',\n padding: 3,\n borderRadius: 4\n }\n },\n\n itemStyle: {\n color: '#fff',\n borderWidth: 0,\n borderColor: '#333'\n },\n\n emphasis: {\n itemStyle: {\n color: '#639fc0'\n },\n label: {\n show: true\n }\n }\n }\n});\n\necharts.util.merge(Polygons3DSeries.prototype, componentShadingMixin);\n\nexport default Polygons3DSeries;","import * as echarts from 'echarts/lib/echarts';\nimport Geo3DBuilder from '../../component/common/Geo3DBuilder';\nimport graphicGL from '../../util/graphicGL';\n\nexport default echarts.ChartView.extend({\n\n type: 'polygons3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this.groupGL = new graphicGL.Node();\n\n this._geo3DBuilderList = [];\n\n this._currentStep = 0;\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n }\n\n var geo3DBuilder = this._geo3DBuilderList[0];\n if (!geo3DBuilder) {\n geo3DBuilder = new Geo3DBuilder(api);\n geo3DBuilder.extrudeY = coordSys.type !== 'mapbox3D'\n && coordSys.type !== 'maptalks3D';\n this._geo3DBuilderList[0] = geo3DBuilder;\n }\n this._updateShaderDefines(coordSys, geo3DBuilder);\n\n geo3DBuilder.update(seriesModel, ecModel, api);\n this._geo3DBuilderList.length = 1;\n\n this.groupGL.add(geo3DBuilder.rootNode);\n },\n\n incrementalPrepareRender: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n }\n\n this._currentStep = 0;\n },\n\n incrementalRender: function (params, seriesModel, ecModel, api) {\n var geo3DBuilder = this._geo3DBuilderList[this._currentStep];\n var coordSys = seriesModel.coordinateSystem;\n if (!geo3DBuilder) {\n geo3DBuilder = new Geo3DBuilder(api);\n geo3DBuilder.extrudeY = coordSys.type !== 'mapbox3D'\n && coordSys.type !== 'maptalks3D';\n this._geo3DBuilderList[this._currentStep] = geo3DBuilder;\n }\n geo3DBuilder.update(seriesModel, ecModel, api, params.start, params.end);\n this.groupGL.add(geo3DBuilder.rootNode);\n\n this._updateShaderDefines(coordSys, geo3DBuilder);\n\n this._currentStep++;\n },\n\n _updateShaderDefines: function (coordSys, geo3DBuilder) {\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n geo3DBuilder.rootNode.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material[methodName]('fragment', 'SRGB_DECODE');\n\n // FIXME\n if (coordSys.type === 'mapbox3D' || coordSys.type === 'maptalks3D') {\n mesh.material.define('fragment', 'NORMAL_UP_AXIS', 2);\n mesh.material.define('fragment', 'NORMAL_FRONT_AXIS', 1);\n }\n }\n });\n },\n\n remove: function () {\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n this._geo3DBuilderList.forEach(function (geo3DBuilder) {\n geo3DBuilder.dispose();\n })\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Polygons3DSeries from './Polygons3DSeries';\nimport Polygons3DView from './Polygons3DView';\n\nexport function install(registers) {\n registers.registerChartView(Polygons3DView);\n registers.registerSeriesModel(Polygons3DSeries);\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './polygons3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport componentShadingMixin from '../../component/common/componentShadingMixin';\nimport formatTooltip from '../common/formatTooltip';\nimport createList from '../common/createList';\n\nvar SurfaceSeries = echarts.SeriesModel.extend({\n\n type: 'series.surface',\n\n dependencies: ['globe', 'grid3D', 'geo3D'],\n\n visualStyleAccessPath: 'itemStyle',\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n getInitialData: function (option, ecModel) {\n var data = option.data;\n\n function validateDimension(dimOpts) {\n return !(isNaN(dimOpts.min) || isNaN(dimOpts.max) || isNaN(dimOpts.step));\n }\n\n function getPrecision(dimOpts) {\n var getPrecision = echarts.number.getPrecisionSafe;\n return Math.max(\n getPrecision(dimOpts.min), getPrecision(dimOpts.max), getPrecision(dimOpts.step)\n ) + 1;\n }\n\n if (!data) {\n if (!option.parametric) {\n // From surface equation\n var equation = option.equation || {};\n var xOpts = equation.x || {};\n var yOpts = equation.y || {};\n\n ['x', 'y'].forEach(function (dim) {\n if (!validateDimension(equation[dim])) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Invalid equation.%s', dim);\n }\n return;\n }\n });\n if (typeof equation.z !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('equation.z needs to be function');\n }\n return;\n }\n var xCount = Math.floor((xOpts.max + xOpts.step - xOpts.min) / xOpts.step);\n var yCount = Math.floor((yOpts.max + yOpts.step - yOpts.min) / yOpts.step);\n data = new Float32Array(xCount * yCount * 3);\n\n var xPrecision = getPrecision(xOpts);\n var yPrecision = getPrecision(yOpts);\n\n var off = 0;\n for (var j = 0; j < yCount; j++) {\n for (var i = 0; i < xCount; i++) {\n var x = i * xOpts.step + xOpts.min;\n var y = j * yOpts.step + yOpts.min;\n var x2 = echarts.number.round(Math.min(x, xOpts.max), xPrecision);\n var y2 = echarts.number.round(Math.min(y, yOpts.max), yPrecision);\n var z = equation.z(x2, y2);\n data[off++] = x2;\n data[off++] = y2;\n data[off++] = z;\n }\n }\n }\n else {\n var parametricEquation = option.parametricEquation || {};\n var uOpts = parametricEquation.u || {};\n var vOpts = parametricEquation.v || {};\n\n ['u', 'v'].forEach(function (dim) {\n if (!validateDimension(parametricEquation[dim])) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Invalid parametricEquation.%s', dim);\n }\n return;\n }\n });\n ['x', 'y', 'z'].forEach(function (dim) {\n if (typeof parametricEquation[dim] !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('parametricEquation.%s needs to be function', dim);\n }\n return;\n }\n });\n\n var uCount = Math.floor((uOpts.max + uOpts.step - uOpts.min) / uOpts.step);\n var vCount = Math.floor((vOpts.max + vOpts.step - vOpts.min) / vOpts.step);\n data = new Float32Array(uCount * vCount * 5);\n\n\n var uPrecision = getPrecision(uOpts);\n var vPrecision = getPrecision(vOpts);\n var off = 0;\n for (var j = 0; j < vCount; j++) {\n for (var i = 0; i < uCount; i++) {\n var u = i * uOpts.step + uOpts.min;\n var v = j * vOpts.step + vOpts.min;\n var u2 = echarts.number.round(Math.min(u, uOpts.max), uPrecision);\n var v2 = echarts.number.round(Math.min(v, vOpts.max), vPrecision);\n var x = parametricEquation.x(u2, v2);\n var y = parametricEquation.y(u2, v2);\n var z = parametricEquation.z(u2, v2);\n data[off++] = x;\n data[off++] = y;\n data[off++] = z;\n data[off++] = u2;\n data[off++] = v2;\n }\n }\n }\n }\n\n var dims = ['x', 'y', 'z'];\n if (option.parametric) {\n dims.push('u', 'v');\n }\n // PENDING getSource?\n var list = createList(this, dims, data);\n return list;\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian3D',\n zlevel: -10,\n\n // Cartesian coordinate system\n grid3DIndex: 0,\n\n // Surface needs lambert shading to show the difference\n shading: 'lambert',\n\n // If parametric surface\n parametric: false,\n\n wireframe: {\n show: true,\n\n lineStyle: {\n color: 'rgba(0,0,0,0.5)',\n width: 1\n }\n },\n /**\n * Generate surface data from z = f(x, y) equation\n */\n equation: {\n // [min, max, step]\n x: {\n min: -1,\n max: 1,\n step: 0.1\n },\n y: {\n min: -1,\n max: 1,\n step: 0.1\n },\n z: null\n },\n\n parametricEquation: {\n // [min, max, step]\n u: {\n min: -1,\n max: 1,\n step: 0.1\n },\n v: {\n min: -1,\n max: 1,\n step: 0.1\n },\n // [x, y, z] = f(x, y)\n x: null,\n y: null,\n z: null\n },\n\n // Shape of give data\n // It is an array to specify rows and columns.\n // For example [30, 30]\n dataShape: null,\n\n itemStyle: {\n // Color\n },\n\n animationDurationUpdate: 500\n }\n});\n\necharts.util.merge(SurfaceSeries.prototype, componentShadingMixin);\n\nexport default SurfaceSeries;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport trianglesSortMixin from '../../util/geometry/trianglesSortMixin';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nvar vec3 = glmatrix.vec3;\n\nfunction isPointsNaN(pt) {\n return isNaN(pt[0]) || isNaN(pt[1]) || isNaN(pt[2]);\n}\n\nexport default echarts.ChartView.extend({\n\n type: 'surface',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n },\n\n render: function (seriesModel, ecModel, api) {\n // Swap surfaceMesh\n var tmp = this._prevSurfaceMesh;\n this._prevSurfaceMesh = this._surfaceMesh;\n this._surfaceMesh = tmp;\n\n if (!this._surfaceMesh) {\n this._surfaceMesh = this._createSurfaceMesh();\n }\n\n this.groupGL.remove(this._prevSurfaceMesh);\n this.groupGL.add(this._surfaceMesh);\n\n var coordSys = seriesModel.coordinateSystem;\n var shading = seriesModel.get('shading');\n var data = seriesModel.getData();\n\n var shadingPrefix = 'ecgl.' + shading;\n if (!this._surfaceMesh.material || this._surfaceMesh.material.shader.name !== shadingPrefix) {\n this._surfaceMesh.material = graphicGL.createMaterial(shadingPrefix, ['VERTEX_COLOR', 'DOUBLE_SIDED']);\n }\n\n graphicGL.setMaterialFromModel(\n shading, this._surfaceMesh.material, seriesModel, api\n );\n\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._surfaceMesh.material[methodName]('fragment', 'SRGB_DECODE');\n }\n\n var isParametric = seriesModel.get('parametric');\n\n var dataShape = seriesModel.get('dataShape');\n if (!dataShape) {\n dataShape = this._getDataShape(data, isParametric);\n if (process.env.NODE_ENV !== 'production') {\n if (seriesModel.get('data')) {\n console.warn('dataShape is not provided. Guess it is ', dataShape);\n }\n }\n }\n\n var wireframeModel = seriesModel.getModel('wireframe');\n var wireframeLineWidth = wireframeModel.get('lineStyle.width');\n var showWireframe = wireframeModel.get('show') && wireframeLineWidth > 0;\n this._updateSurfaceMesh(this._surfaceMesh, seriesModel, dataShape, showWireframe);\n\n var material = this._surfaceMesh.material;\n if (showWireframe) {\n material.define('WIREFRAME_QUAD');\n material.set('wireframeLineWidth', wireframeLineWidth);\n material.set('wireframeLineColor', graphicGL.parseColor(wireframeModel.get('lineStyle.color')));\n }\n else {\n material.undefine('WIREFRAME_QUAD');\n }\n\n this._initHandler(seriesModel, api);\n\n this._updateAnimation(seriesModel);\n },\n\n _updateAnimation: function (seriesModel) {\n graphicGL.updateVertexAnimation(\n [\n ['prevPosition', 'position'],\n ['prevNormal', 'normal']\n ],\n this._prevSurfaceMesh,\n this._surfaceMesh,\n seriesModel\n );\n },\n\n _createSurfaceMesh: function () {\n var mesh = new graphicGL.Mesh({\n geometry: new graphicGL.Geometry({\n dynamic: true,\n sortTriangles: true\n }),\n shadowDepthMaterial: new graphicGL.Material({\n shader: new graphicGL.Shader(graphicGL.Shader.source('ecgl.sm.depth.vertex'), graphicGL.Shader.source('ecgl.sm.depth.fragment'))\n }),\n culling: false,\n // Render after axes\n renderOrder: 10,\n // Render normal in normal pass\n renderNormal: true\n });\n mesh.geometry.createAttribute('barycentric', 'float', 4);\n mesh.geometry.createAttribute('prevPosition', 'float', 3);\n mesh.geometry.createAttribute('prevNormal', 'float', 3);\n\n Object.assign(mesh.geometry, trianglesSortMixin);\n\n return mesh;\n },\n\n _initHandler: function (seriesModel, api) {\n var data = seriesModel.getData();\n var surfaceMesh = this._surfaceMesh;\n\n var coordSys = seriesModel.coordinateSystem;\n\n function getNearestPointIdx(triangle, point) {\n var nearestDist = Infinity;\n var nearestIdx = -1;\n var pos = [];\n for (var i = 0; i < triangle.length; i++) {\n surfaceMesh.geometry.attributes.position.get(triangle[i], pos);\n var dist = vec3.dist(point.array, pos);\n if (dist < nearestDist) {\n nearestDist = dist;\n nearestIdx = triangle[i];\n }\n }\n return nearestIdx;\n }\n\n surfaceMesh.seriesIndex = seriesModel.seriesIndex;\n\n var lastDataIndex = -1;\n\n surfaceMesh.off('mousemove');\n surfaceMesh.off('mouseout');\n surfaceMesh.on('mousemove', function (e) {\n var idx = getNearestPointIdx(e.triangle, e.point);\n if (idx >= 0) {\n var point = [];\n surfaceMesh.geometry.attributes.position.get(idx, point);\n var value = coordSys.pointToData(point);\n\n var minDist = Infinity;\n var dataIndex = -1;\n var item = [];\n for (var i = 0; i < data.count(); i++) {\n item[0] = data.get('x', i);\n item[1] = data.get('y', i);\n item[2] = data.get('z', i);\n var dist = vec3.squaredDistance(item, value);\n if (dist < minDist) {\n dataIndex = i;\n minDist = dist;\n }\n }\n\n if (dataIndex !== lastDataIndex) {\n api.dispatchAction({\n type: 'grid3DShowAxisPointer',\n value: value\n });\n }\n\n lastDataIndex = dataIndex;\n surfaceMesh.dataIndex = dataIndex;\n }\n else {\n surfaceMesh.dataIndex = -1;\n }\n }, this);\n surfaceMesh.on('mouseout', function (e) {\n lastDataIndex = -1;\n surfaceMesh.dataIndex = -1;\n\n api.dispatchAction({\n type: 'grid3DHideAxisPointer'\n });\n }, this);\n },\n\n _updateSurfaceMesh: function (surfaceMesh, seriesModel, dataShape, showWireframe) {\n\n var geometry = surfaceMesh.geometry;\n var data = seriesModel.getData();\n var pointsArr = data.getLayout('points');\n\n var invalidDataCount = 0;\n data.each(function (idx) {\n if (!data.hasValue(idx)) {\n invalidDataCount++;\n }\n });\n var needsSplitQuad = invalidDataCount || showWireframe;\n\n var positionAttr = geometry.attributes.position;\n var normalAttr = geometry.attributes.normal;\n var texcoordAttr = geometry.attributes.texcoord0;\n var barycentricAttr = geometry.attributes.barycentric;\n var colorAttr = geometry.attributes.color;\n var row = dataShape[0];\n var column = dataShape[1];\n var shading = seriesModel.get('shading');\n var needsNormal = shading !== 'color';\n\n if (needsSplitQuad) {\n // TODO, If needs remove the invalid points, or set color transparent.\n var vertexCount = (row - 1) * (column - 1) * 4;\n positionAttr.init(vertexCount);\n if (showWireframe) {\n barycentricAttr.init(vertexCount);\n }\n }\n else {\n positionAttr.value = new Float32Array(pointsArr);\n }\n colorAttr.init(geometry.vertexCount);\n texcoordAttr.init(geometry.vertexCount);\n\n var quadToTriangle = [0, 3, 1, 1, 3, 2];\n // 3----2\n // 0----1\n // Make sure pixels on 1---3 edge will not have channel 0.\n // And pixels on four edges have at least one channel 0.\n var quadBarycentric = [\n [1, 1, 0, 0],\n [0, 1, 0, 1],\n [1, 0, 0, 1],\n [1, 0, 1, 0]\n ];\n\n var indices = geometry.indices = new (geometry.vertexCount > 0xffff ? Uint32Array : Uint16Array)((row - 1) * (column - 1) * 6);\n var getQuadIndices = function (i, j, out) {\n out[1] = i * column + j;\n out[0] = i * column + j + 1;\n out[3] = (i + 1) * column + j + 1;\n out[2] = (i + 1) * column + j;\n };\n\n var isTransparent = false;\n\n if (needsSplitQuad) {\n var quadIndices = [];\n var pos = [];\n var faceOffset = 0;\n\n if (needsNormal) {\n normalAttr.init(geometry.vertexCount);\n }\n else {\n normalAttr.value = null;\n }\n\n var pts = [[], [], []];\n var v21 = [], v32 = [];\n var normal = vec3.create();\n\n var getFromArray = function (arr, idx, out) {\n var idx3 = idx * 3;\n out[0] = arr[idx3];\n out[1] = arr[idx3 + 1];\n out[2] = arr[idx3 + 2];\n return out;\n };\n var vertexNormals = new Float32Array(pointsArr.length);\n var vertexColors = new Float32Array(pointsArr.length / 3 * 4);\n\n for (var i = 0; i < data.count(); i++) {\n if (data.hasValue(i)) {\n var rgbaArr = graphicGL.parseColor(getItemVisualColor(data, i));\n var opacity = getItemVisualOpacity(data, i);\n opacity != null && (rgbaArr[3] *= opacity);\n if (rgbaArr[3] < 0.99) {\n isTransparent = true;\n }\n for (var k = 0; k < 4; k++) {\n vertexColors[i * 4 + k] = rgbaArr[k];\n }\n }\n }\n var farPoints = [1e7, 1e7, 1e7];\n for (var i = 0; i < row - 1; i++) {\n for (var j = 0; j < column - 1; j++) {\n var dataIndex = i * (column - 1) + j;\n var vertexOffset = dataIndex * 4;\n\n getQuadIndices(i, j, quadIndices);\n\n var invisibleQuad = false;\n for (var k = 0; k < 4; k++) {\n getFromArray(pointsArr, quadIndices[k], pos);\n if (isPointsNaN(pos)) {\n // Quad is invisible if any point is NaN\n invisibleQuad = true;\n }\n }\n\n for (var k = 0; k < 4; k++) {\n if (invisibleQuad) {\n // Move point far away\n positionAttr.set(vertexOffset + k, farPoints);\n }\n else {\n getFromArray(pointsArr, quadIndices[k], pos);\n positionAttr.set(vertexOffset + k, pos);\n }\n if (showWireframe) {\n barycentricAttr.set(vertexOffset + k, quadBarycentric[k]);\n }\n }\n for (var k = 0; k < 6; k++) {\n indices[faceOffset++] = quadToTriangle[k] + vertexOffset;\n }\n // Vertex normals\n if (needsNormal && !invisibleQuad) {\n for (var k = 0; k < 2; k++) {\n var k3 = k * 3;\n\n for (var m = 0; m < 3; m++) {\n var idx = quadIndices[quadToTriangle[k3] + m];\n getFromArray(pointsArr, idx, pts[m]);\n }\n\n vec3.sub(v21, pts[0], pts[1]);\n vec3.sub(v32, pts[1], pts[2]);\n vec3.cross(normal, v21, v32);\n // Weighted by the triangle area\n for (var m = 0; m < 3; m++) {\n var idx3 = quadIndices[quadToTriangle[k3] + m] * 3;\n vertexNormals[idx3] = vertexNormals[idx3] + normal[0];\n vertexNormals[idx3 + 1] = vertexNormals[idx3 + 1] + normal[1];\n vertexNormals[idx3 + 2] = vertexNormals[idx3 + 2] + normal[2];\n }\n }\n }\n\n }\n }\n if (needsNormal) {\n for (var i = 0; i < vertexNormals.length / 3; i++) {\n getFromArray(vertexNormals, i, normal);\n vec3.normalize(normal, normal);\n vertexNormals[i * 3] = normal[0];\n vertexNormals[i * 3 + 1] = normal[1];\n vertexNormals[i * 3 + 2] = normal[2];\n }\n }\n // Split normal and colors, write to the attributes.\n var rgbaArr = [];\n var uvArr = [];\n for (var i = 0; i < row - 1; i++) {\n for (var j = 0; j < column - 1; j++) {\n var dataIndex = i * (column - 1) + j;\n var vertexOffset = dataIndex * 4;\n\n getQuadIndices(i, j, quadIndices);\n for (var k = 0; k < 4; k++) {\n for (var m = 0; m < 4; m++) {\n rgbaArr[m] = vertexColors[quadIndices[k] * 4 + m];\n }\n colorAttr.set(vertexOffset + k, rgbaArr);\n\n if (needsNormal) {\n getFromArray(vertexNormals, quadIndices[k], normal);\n normalAttr.set(vertexOffset + k, normal);\n }\n\n var idx = quadIndices[k];\n uvArr[0] = (idx % column) / (column - 1);\n uvArr[1] = Math.floor(idx / column) / (row - 1);\n texcoordAttr.set(vertexOffset + k, uvArr);\n }\n dataIndex++;\n }\n }\n }\n else {\n var uvArr = [];\n for (var i = 0; i < data.count(); i++) {\n uvArr[0] = (i % column) / (column - 1);\n uvArr[1] = Math.floor(i / column) / (row - 1);\n var rgbaArr = graphicGL.parseColor(getItemVisualColor(data, i));\n var opacity = getItemVisualOpacity(data, i);\n opacity != null && (rgbaArr[3] *= opacity);\n if (rgbaArr[3] < 0.99) {\n isTransparent = true;\n }\n colorAttr.set(i, rgbaArr);\n texcoordAttr.set(i, uvArr);\n }\n var quadIndices = [];\n // Triangles\n var cursor = 0;\n for (var i = 0; i < row - 1; i++) {\n for (var j = 0; j < column - 1; j++) {\n\n getQuadIndices(i, j, quadIndices);\n\n for (var k = 0; k < 6; k++) {\n indices[cursor++] = quadIndices[quadToTriangle[k]];\n }\n }\n }\n if (needsNormal) {\n geometry.generateVertexNormals();\n }\n else {\n normalAttr.value = null;\n }\n }\n if (surfaceMesh.material.get('normalMap')) {\n geometry.generateTangents();\n }\n\n\n geometry.updateBoundingBox();\n geometry.dirty();\n\n surfaceMesh.material.transparent = isTransparent;\n surfaceMesh.material.depthMask = !isTransparent;\n },\n\n _getDataShape: function (data, isParametric) {\n\n var prevX = -Infinity;\n var rowCount = 0;\n var columnCount = 0;\n var prevColumnCount = 0;\n\n var mayInvalid = false;\n\n var rowDim = isParametric ? 'u' : 'x';\n var dataCount = data.count();\n // Check data format\n for (var i = 0; i < dataCount; i++) {\n var x = data.get(rowDim, i);\n if (x < prevX) {\n if (prevColumnCount && prevColumnCount !== columnCount) {\n if (process.env.NODE_ENV !== 'production') {\n mayInvalid = true;\n }\n }\n // A new row.\n prevColumnCount = columnCount;\n columnCount = 0;\n rowCount++;\n }\n prevX = x;\n columnCount++;\n }\n if (!rowCount || columnCount === 1) {\n mayInvalid = true;\n }\n if (!mayInvalid) {\n return [rowCount + 1, columnCount];\n }\n\n var rows = Math.floor(Math.sqrt(dataCount));\n while (rows > 0) {\n if (Math.floor(dataCount / rows) === dataCount / rows) { // Can be divided\n return [rows, dataCount / rows];\n }\n rows--;\n }\n\n // Bailout\n rows = Math.floor(Math.sqrt(dataCount));\n return [rows, rows];\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport SurfaceSeries from './SurfaceSeries';\nimport SurfaceView from './SurfaceView';\n\nexport function install(registers) {\n registers.registerChartView(SurfaceView);\n registers.registerSeriesModel(SurfaceSeries);\n\n registers.registerLayout(function (ecModel, api) {\n ecModel.eachSeriesByType('surface', function (surfaceModel) {\n var cartesian = surfaceModel.coordinateSystem;\n if (!cartesian || cartesian.type !== 'cartesian3D') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Surface chart only support cartesian3D coordinateSystem');\n }\n }\n var data = surfaceModel.getData();\n var points = new Float32Array(3 * data.count());\n var nanPoint = [NaN, NaN, NaN];\n\n if (cartesian && cartesian.type === 'cartesian3D') {\n var coordDims = cartesian.dimensions;\n var dims = coordDims.map(function (coordDim) {\n return surfaceModel.coordDimToDataDim(coordDim)[0];\n });\n data.each(dims, function (x, y, z, idx) {\n var pt;\n if (!data.hasValue(idx)) {\n pt = nanPoint;\n }\n else {\n pt = cartesian.dataToPoint([x, y, z]);\n }\n points[idx * 3] = pt[0];\n points[idx * 3 + 1] = pt[1];\n points[idx * 3 + 2] = pt[2];\n });\n }\n data.setLayout('points', points);\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './surface/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport componentViewControlMixin from '../../component/common/componentViewControlMixin';\nimport componentPostEffectMixin from '../../component/common/componentPostEffectMixin';\nimport componentLightMixin from '../../component/common/componentLightMixin';\nimport componentShadingMixin from '../../component/common/componentShadingMixin';\nimport geo3DModelMixin from '../../coord/geo3D/geo3DModelMixin';\nimport formatUtil from '../../util/format';\nimport formatTooltip from '../common/formatTooltip';\nimport geo3DCreator from '../../coord/geo3DCreator';\n\nfunction transformPolygon(mapbox3DCoordSys, poly) {\n var newPoly = [];\n for (var k = 0; k < poly.length; k++) {\n newPoly.push(mapbox3DCoordSys.dataToPoint(poly[k]));\n }\n return newPoly;\n}\n\nvar Map3DSeries = echarts.SeriesModel.extend({\n\n type: 'series.map3D',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n visualStyleAccessPath: 'itemStyle',\n\n optionUpdated: function (newOpt) {\n newOpt = newOpt || {};\n var coordSysType = this.get('coordinateSystem');\n if (coordSysType == null || coordSysType === 'geo3D') {\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var propsNeedToCheck = [\n 'left', 'top', 'width', 'height',\n 'boxWidth', 'boxDepth', 'boxHeight',\n 'light', 'viewControl', 'postEffect', 'temporalSuperSampling',\n 'environment', 'groundPlane'\n ];\n var ignoredProperties = [];\n propsNeedToCheck.forEach(function (propName) {\n if (newOpt[propName] != null) {\n ignoredProperties.push(propName);\n }\n });\n if (ignoredProperties.length) {\n console.warn(\n 'Property %s in map3D series will be ignored if coordinate system is %s',\n ignoredProperties.join(', '), coordSysType\n );\n }\n }\n\n if (this.get('groundPlane.show')) {\n // Force disable groundPlane if map3D has other coordinate systems.\n this.option.groundPlane.show = false;\n }\n\n // Reset geo.\n this._geo = null;\n },\n\n getInitialData: function (option) {\n option.data = this.getFilledRegions(option.data, option.map);\n\n var dimensions = echarts.helper.createDimensions(option.data, {\n coordDimensions: ['value']\n });\n var list = new echarts.List(dimensions, this);\n list.initData(option.data);\n\n var regionModelMap = {};\n list.each(function (idx) {\n var name = list.getName(idx);\n var itemModel = list.getItemModel(idx);\n regionModelMap[name] = itemModel;\n });\n\n this._regionModelMap = regionModelMap;\n\n return list;\n },\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n getRegionModel: function (idx) {\n var name = this.getData().getName(idx);\n return this._regionModelMap[name] || new echarts.Model(null, this);\n },\n\n getRegionPolygonCoords: function (idx) {\n var coordSys = this.coordinateSystem;\n var name = this.getData().getName(idx);\n if (coordSys.transform) {\n var region = coordSys.getRegion(name);\n return region ? region.geometries : [];\n }\n else {\n if (!this._geo) {\n this._geo = geo3DCreator.createGeo3D(this);\n }\n var region = this._geo.getRegion(name);\n var ret = [];\n for (var k = 0; k < region.geometries.length; k++) {\n var geo = region.geometries[k];\n var interiors = [];\n var exterior = transformPolygon(coordSys, geo.exterior);\n if (interiors && interiors.length) {\n for (var m = 0; m < geo.interiors.length; m++) {\n interiors.push(transformPolygon(coordSys, interiors[m]));\n }\n }\n ret.push({\n interiors: interiors,\n exterior: exterior\n });\n }\n return ret;\n }\n },\n\n /**\n * Format label\n * @param {string} name Region name\n * @param {string} [status='normal'] 'normal' or 'emphasis'\n * @return {string}\n */\n getFormattedLabel: function (dataIndex, status) {\n var text = formatUtil.getFormattedLabel(this, dataIndex, status);\n if (text == null) {\n text = this.getData().getName(dataIndex);\n }\n return text;\n },\n\n defaultOption: {\n // Support geo3D, mapbox, maptalks3D\n coordinateSystem: 'geo3D',\n // itemStyle: {},\n // height,\n // label: {}\n data: null\n }\n});\n\necharts.util.merge(Map3DSeries.prototype, geo3DModelMixin);\n\necharts.util.merge(Map3DSeries.prototype, componentViewControlMixin);\necharts.util.merge(Map3DSeries.prototype, componentPostEffectMixin);\necharts.util.merge(Map3DSeries.prototype, componentLightMixin);\necharts.util.merge(Map3DSeries.prototype, componentShadingMixin);\n\nexport default Map3DSeries;","import * as echarts from 'echarts/lib/echarts';\n\nimport graphicGL from '../../util/graphicGL';\nimport OrbitControl from '../../util/OrbitControl';\nimport SceneHelper from '../../component/common/SceneHelper';\nimport Geo3DBuilder from '../../component/common/Geo3DBuilder';\n\nexport default echarts.ChartView.extend({\n\n type: 'map3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this._geo3DBuilder = new Geo3DBuilder(api);\n this.groupGL = new graphicGL.Node();\n },\n\n render: function (map3DModel, ecModel, api) {\n\n var coordSys = map3DModel.coordinateSystem;\n\n if (!coordSys || !coordSys.viewGL) {\n return;\n }\n\n this.groupGL.add(this._geo3DBuilder.rootNode);\n coordSys.viewGL.add(this.groupGL);\n\n var geo3D;\n if (coordSys.type === 'geo3D') {\n geo3D = coordSys;\n\n if (!this._sceneHelper) {\n this._sceneHelper = new SceneHelper();\n this._sceneHelper.initLight(this.groupGL);\n }\n\n this._sceneHelper.setScene(coordSys.viewGL.scene);\n this._sceneHelper.updateLight(map3DModel);\n\n // Set post effect\n coordSys.viewGL.setPostEffect(map3DModel.getModel('postEffect'), api);\n coordSys.viewGL.setTemporalSuperSampling(map3DModel.getModel('temporalSuperSampling'));\n\n var control = this._control;\n if (!control) {\n control = this._control = new OrbitControl({\n zr: api.getZr()\n });\n this._control.init();\n }\n var viewControlModel = map3DModel.getModel('viewControl');\n control.setViewGL(coordSys.viewGL);\n control.setFromViewControlModel(viewControlModel, 0);\n\n control.off('update');\n control.on('update', function () {\n api.dispatchAction({\n type: 'map3DChangeCamera',\n alpha: control.getAlpha(),\n beta: control.getBeta(),\n distance: control.getDistance(),\n from: this.uid,\n map3DId: map3DModel.id\n });\n });\n\n this._geo3DBuilder.extrudeY = true;\n }\n else {\n if (this._control) {\n this._control.dispose();\n this._control = null;\n }\n if (this._sceneHelper) {\n this._sceneHelper.dispose();\n this._sceneHelper = null;\n }\n geo3D = map3DModel.getData().getLayout('geo3D');\n\n this._geo3DBuilder.extrudeY = false;\n }\n\n this._geo3DBuilder.update(map3DModel, ecModel, api, 0, map3DModel.getData().count());\n\n\n // Must update after geo3D.viewGL.setPostEffect to determine linear space\n var srgbDefineMethod = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._geo3DBuilder.rootNode.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material[srgbDefineMethod]('fragment', 'SRGB_DECODE');\n }\n });\n },\n\n afterRender: function (map3DModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n var coordSys = map3DModel.coordinateSystem;\n if (coordSys && coordSys.type === 'geo3D') {\n this._sceneHelper.updateAmbientCubemap(renderer, map3DModel, api);\n this._sceneHelper.updateSkybox(renderer, map3DModel, api);\n }\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n this._control.dispose();\n this._geo3DBuilder.dispose();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Map3DSeries from './Map3DSeries';\nimport Map3DView from './Map3DView';\n\nimport {install as installGeo3D} from '../../component/geo3D/install';\n\nexport function install(registers) {\n // Depends on geo3d\n installGeo3D(registers);\n\n registers.registerChartView(Map3DView);\n registers.registerSeriesModel(Map3DSeries);\n registers.registerAction({\n type: 'map3DChangeCamera',\n event: 'map3dcamerachanged',\n update: 'series:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series', subType: 'map3D', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './map3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\n\nexport default echarts.SeriesModel.extend({\n\n type: 'series.scatterGL',\n\n dependencies: ['grid', 'polar', 'geo', 'singleAxis'],\n\n visualStyleAccessPath: 'itemStyle',\n\n hasSymbolVisual: true,\n\n getInitialData: function () {\n return echarts.helper.createList(this);\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian2d',\n zlevel: 10,\n\n progressive: 1e5,\n progressiveThreshold: 1e5,\n\n // Cartesian coordinate system\n // xAxisIndex: 0,\n // yAxisIndex: 0,\n\n // Polar coordinate system\n // polarIndex: 0,\n\n // Geo coordinate system\n // geoIndex: 0,\n\n large: false,\n\n symbol: 'circle',\n symbolSize: 10,\n\n // symbolSize scale when zooming.\n zoomScale: 0,\n\n // Support source-over, lighter\n blendMode: 'source-over',\n\n itemStyle: {\n opacity: 0.8\n },\n\n\n postEffect: {\n enable: false,\n colorCorrection: {\n exposure: 0,\n brightness: 0,\n contrast: 1,\n saturation: 1,\n enable: true\n }\n }\n\n }\n});","\nimport * as matrix from 'zrender/lib/core/matrix';\nimport * as vector from 'zrender/lib/core/vector';\n\nfunction GLViewHelper(viewGL) {\n this.viewGL = viewGL;\n}\n\nGLViewHelper.prototype.reset = function (seriesModel, api) {\n this._updateCamera(api.getWidth(), api.getHeight(), api.getDevicePixelRatio());\n this._viewTransform = matrix.create();\n this.updateTransform(seriesModel, api);\n};\n\nGLViewHelper.prototype.updateTransform = function (seriesModel, api) {\n var coordinateSystem = seriesModel.coordinateSystem;\n\n if (coordinateSystem.getRoamTransform) {\n\n matrix.invert(this._viewTransform, coordinateSystem.getRoamTransform());\n\n this._setCameraTransform(this._viewTransform);\n\n api.getZr().refresh();\n }\n};\n\n// Reimplement the dataToPoint of coordinate system.\n// Remove the effect of pan/zoom transform\nGLViewHelper.prototype.dataToPoint = function (coordSys, data, pt) {\n pt = coordSys.dataToPoint(data, null, pt);\n var viewTransform = this._viewTransform;\n if (viewTransform) {\n vector.applyTransform(pt, pt, viewTransform);\n }\n};\n\n/**\n * Remove transform info in point.\n */\nGLViewHelper.prototype.removeTransformInPoint = function (pt) {\n if (this._viewTransform) {\n vector.applyTransform(pt, pt, this._viewTransform);\n }\n return pt;\n};\n\n/**\n * Return number\n */\nGLViewHelper.prototype.getZoom = function () {\n if (this._viewTransform) {\n var m = this._viewTransform;\n return 1 / Math.max(\n Math.sqrt(m[0] * m[0] + m[1] * m[1]),\n Math.sqrt(m[2] * m[2] + m[3] * m[3])\n );\n }\n return 1;\n};\n\nGLViewHelper.prototype._setCameraTransform = function (m) {\n var camera = this.viewGL.camera;\n camera.position.set(m[4], m[5], 0);\n camera.scale.set(\n Math.sqrt(m[0] * m[0] + m[1] * m[1]),\n Math.sqrt(m[2] * m[2] + m[3] * m[3]),\n 1\n );\n};\n\nGLViewHelper.prototype._updateCamera = function (width, height, dpr) {\n // TODO, left, top, right, bottom\n this.viewGL.setViewport(0, 0, width, height, dpr);\n var camera = this.viewGL.camera;\n camera.left = camera.top = 0;\n camera.bottom = height;\n camera.right = width;\n camera.near = 0;\n camera.far = 100;\n};\n\nexport default GLViewHelper;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport ViewGL from '../../core/ViewGL';\nimport PointsBuilder from '../common/PointsBuilder';\n\nimport GLViewHelper from '../common/GLViewHelper';\n\nexport default echarts.ChartView.extend({\n\n type: 'scatterGL',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n this.viewGL = new ViewGL('orthographic');\n\n this.viewGL.add(this.groupGL);\n\n this._pointsBuilderList = [];\n this._currentStep = 0;\n\n this._sizeScale = 1;\n\n this._glViewHelper = new GLViewHelper(this.viewGL);\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n this._glViewHelper.reset(seriesModel, api);\n\n if (!seriesModel.getData().count()) {\n return;\n }\n\n var pointsBuilder = this._pointsBuilderList[0];\n if (!pointsBuilder) {\n pointsBuilder = this._pointsBuilderList[0] = new PointsBuilder(true, api);\n }\n this._pointsBuilderList.length = 1;\n\n this.groupGL.add(pointsBuilder.rootNode);\n\n this._removeTransformInPoints(seriesModel.getData().getLayout('points'));\n pointsBuilder.update(seriesModel, ecModel, api);\n\n this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api);\n },\n\n incrementalPrepareRender: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n this._glViewHelper.reset(seriesModel, api);\n\n this._currentStep = 0;\n\n this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api);\n },\n\n incrementalRender: function (params, seriesModel, ecModel, api) {\n if (params.end <= params.start) {\n return;\n }\n\n var pointsBuilder = this._pointsBuilderList[this._currentStep];\n if (!pointsBuilder) {\n pointsBuilder = new PointsBuilder(true, api);\n this._pointsBuilderList[this._currentStep] = pointsBuilder;\n }\n this.groupGL.add(pointsBuilder.rootNode);\n\n this._removeTransformInPoints(seriesModel.getData().getLayout('points'));\n\n pointsBuilder.setSizeScale(this._sizeScale);\n pointsBuilder.update(seriesModel, ecModel, api, params.start, params.end);\n\n api.getZr().refresh();\n\n this._currentStep++;\n },\n\n updateTransform: function (seriesModel, ecModel, api) {\n if (seriesModel.coordinateSystem.getRoamTransform) {\n this._glViewHelper.updateTransform(seriesModel, api);\n\n var zoom = this._glViewHelper.getZoom();\n var sizeScale = Math.max((seriesModel.get('zoomScale') || 0) * (zoom - 1) + 1, 0);\n this._sizeScale = sizeScale;\n\n this._pointsBuilderList.forEach(function (pointsBuilder) {\n pointsBuilder.setSizeScale(sizeScale);\n });\n }\n },\n\n _removeTransformInPoints: function (points) {\n if (!points) {\n return;\n }\n var pt = [];\n for (var i = 0; i < points.length; i += 2) {\n pt[0] = points[i];\n pt[1] = points[i + 1];\n this._glViewHelper.removeTransformInPoint(pt);\n points[i] = pt[0];\n points[i + 1] = pt[1];\n }\n },\n\n\n dispose: function () {\n this.groupGL.removeAll();\n this._pointsBuilderList.forEach(function (pointsBuilder) {\n pointsBuilder.dispose();\n });\n },\n\n remove: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport ScatterGLSeries from './ScatterGLSeries';\nimport ScatterGLView from './ScatterGLView';\n\nexport function install(registers) {\n registers.registerChartView(ScatterGLView);\n registers.registerSeriesModel(ScatterGLSeries);\n\n registers.registerLayout({\n seriesType: 'scatterGL',\n reset: function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n var data = seriesModel.getData();\n\n var progress;\n if (coordSys) {\n var dims = coordSys.dimensions.map(function (dim) {\n return data.mapDimension(dim);\n }).slice(0, 2);\n var pt = [];\n if (dims.length === 1) {\n progress = function (params) {\n var points = new Float32Array((params.end - params.start) * 2);\n for (var idx = params.start; idx < params.end; idx++) {\n var offset = (idx - params.start) * 2;\n var x = data.get(dims[0], idx);\n var pt = coordSys.dataToPoint(x);\n points[offset] = pt[0];\n points[offset + 1] = pt[1];\n }\n data.setLayout('points', points);\n };\n }\n else if (dims.length === 2) {\n progress = function (params) {\n var points = new Float32Array((params.end - params.start) * 2);\n for (var idx = params.start; idx < params.end; idx++) {\n var offset = (idx - params.start) * 2;\n var x = data.get(dims[0], idx);\n var y = data.get(dims[1], idx);\n pt[0] = x;\n pt[1] = y;\n\n pt = coordSys.dataToPoint(pt);\n points[offset] = pt[0];\n points[offset + 1] = pt[1];\n }\n data.setLayout('points', points);\n };\n }\n }\n\n return { progress: progress };\n }\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './scatterGL/install';\nuse(install);","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util'; // id may be function name of Object, add a prefix to avoid this problem.\n\nfunction generateNodeKey(id) {\n return '_EC_' + id;\n}\n\nvar Graph =\n/** @class */\nfunction () {\n function Graph(directed) {\n this.type = 'graph';\n this.nodes = [];\n this.edges = [];\n this._nodesMap = {};\n /**\n * @type {Object.}\n * @private\n */\n\n this._edgesMap = {};\n this._directed = directed || false;\n }\n /**\n * If is directed graph\n */\n\n\n Graph.prototype.isDirected = function () {\n return this._directed;\n };\n\n ;\n /**\n * Add a new node\n */\n\n Graph.prototype.addNode = function (id, dataIndex) {\n id = id == null ? '' + dataIndex : '' + id;\n var nodesMap = this._nodesMap;\n\n if (nodesMap[generateNodeKey(id)]) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Graph nodes have duplicate name or id');\n }\n\n return;\n }\n\n var node = new GraphNode(id, dataIndex);\n node.hostGraph = this;\n this.nodes.push(node);\n nodesMap[generateNodeKey(id)] = node;\n return node;\n };\n\n ;\n /**\n * Get node by data index\n */\n\n Graph.prototype.getNodeByIndex = function (dataIndex) {\n var rawIdx = this.data.getRawIndex(dataIndex);\n return this.nodes[rawIdx];\n };\n\n ;\n /**\n * Get node by id\n */\n\n Graph.prototype.getNodeById = function (id) {\n return this._nodesMap[generateNodeKey(id)];\n };\n\n ;\n /**\n * Add a new edge\n */\n\n Graph.prototype.addEdge = function (n1, n2, dataIndex) {\n var nodesMap = this._nodesMap;\n var edgesMap = this._edgesMap; // PNEDING\n\n if (typeof n1 === 'number') {\n n1 = this.nodes[n1];\n }\n\n if (typeof n2 === 'number') {\n n2 = this.nodes[n2];\n }\n\n if (!(n1 instanceof GraphNode)) {\n n1 = nodesMap[generateNodeKey(n1)];\n }\n\n if (!(n2 instanceof GraphNode)) {\n n2 = nodesMap[generateNodeKey(n2)];\n }\n\n if (!n1 || !n2) {\n return;\n }\n\n var key = n1.id + '-' + n2.id;\n var edge = new GraphEdge(n1, n2, dataIndex);\n edge.hostGraph = this;\n\n if (this._directed) {\n n1.outEdges.push(edge);\n n2.inEdges.push(edge);\n }\n\n n1.edges.push(edge);\n\n if (n1 !== n2) {\n n2.edges.push(edge);\n }\n\n this.edges.push(edge);\n edgesMap[key] = edge;\n return edge;\n };\n\n ;\n /**\n * Get edge by data index\n */\n\n Graph.prototype.getEdgeByIndex = function (dataIndex) {\n var rawIdx = this.edgeData.getRawIndex(dataIndex);\n return this.edges[rawIdx];\n };\n\n ;\n /**\n * Get edge by two linked nodes\n */\n\n Graph.prototype.getEdge = function (n1, n2) {\n if (n1 instanceof GraphNode) {\n n1 = n1.id;\n }\n\n if (n2 instanceof GraphNode) {\n n2 = n2.id;\n }\n\n var edgesMap = this._edgesMap;\n\n if (this._directed) {\n return edgesMap[n1 + '-' + n2];\n } else {\n return edgesMap[n1 + '-' + n2] || edgesMap[n2 + '-' + n1];\n }\n };\n\n ;\n /**\n * Iterate all nodes\n */\n\n Graph.prototype.eachNode = function (cb, context) {\n var nodes = this.nodes;\n var len = nodes.length;\n\n for (var i = 0; i < len; i++) {\n if (nodes[i].dataIndex >= 0) {\n cb.call(context, nodes[i], i);\n }\n }\n };\n\n ;\n /**\n * Iterate all edges\n */\n\n Graph.prototype.eachEdge = function (cb, context) {\n var edges = this.edges;\n var len = edges.length;\n\n for (var i = 0; i < len; i++) {\n if (edges[i].dataIndex >= 0 && edges[i].node1.dataIndex >= 0 && edges[i].node2.dataIndex >= 0) {\n cb.call(context, edges[i], i);\n }\n }\n };\n\n ;\n /**\n * Breadth first traverse\n * Return true to stop traversing\n */\n\n Graph.prototype.breadthFirstTraverse = function (cb, startNode, direction, context) {\n if (!(startNode instanceof GraphNode)) {\n startNode = this._nodesMap[generateNodeKey(startNode)];\n }\n\n if (!startNode) {\n return;\n }\n\n var edgeType = direction === 'out' ? 'outEdges' : direction === 'in' ? 'inEdges' : 'edges';\n\n for (var i = 0; i < this.nodes.length; i++) {\n this.nodes[i].__visited = false;\n }\n\n if (cb.call(context, startNode, null)) {\n return;\n }\n\n var queue = [startNode];\n\n while (queue.length) {\n var currentNode = queue.shift();\n var edges = currentNode[edgeType];\n\n for (var i = 0; i < edges.length; i++) {\n var e = edges[i];\n var otherNode = e.node1 === currentNode ? e.node2 : e.node1;\n\n if (!otherNode.__visited) {\n if (cb.call(context, otherNode, currentNode)) {\n // Stop traversing\n return;\n }\n\n queue.push(otherNode);\n otherNode.__visited = true;\n }\n }\n }\n };\n\n ; // TODO\n // depthFirstTraverse(\n // cb, startNode, direction, context\n // ) {\n // };\n // Filter update\n\n Graph.prototype.update = function () {\n var data = this.data;\n var edgeData = this.edgeData;\n var nodes = this.nodes;\n var edges = this.edges;\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n nodes[i].dataIndex = -1;\n }\n\n for (var i = 0, len = data.count(); i < len; i++) {\n nodes[data.getRawIndex(i)].dataIndex = i;\n }\n\n edgeData.filterSelf(function (idx) {\n var edge = edges[edgeData.getRawIndex(idx)];\n return edge.node1.dataIndex >= 0 && edge.node2.dataIndex >= 0;\n }); // Update edge\n\n for (var i = 0, len = edges.length; i < len; i++) {\n edges[i].dataIndex = -1;\n }\n\n for (var i = 0, len = edgeData.count(); i < len; i++) {\n edges[edgeData.getRawIndex(i)].dataIndex = i;\n }\n };\n\n ;\n /**\n * @return {module:echarts/data/Graph}\n */\n\n Graph.prototype.clone = function () {\n var graph = new Graph(this._directed);\n var nodes = this.nodes;\n var edges = this.edges;\n\n for (var i = 0; i < nodes.length; i++) {\n graph.addNode(nodes[i].id, nodes[i].dataIndex);\n }\n\n for (var i = 0; i < edges.length; i++) {\n var e = edges[i];\n graph.addEdge(e.node1.id, e.node2.id, e.dataIndex);\n }\n\n return graph;\n };\n\n ;\n return Graph;\n}();\n\nvar GraphNode =\n/** @class */\nfunction () {\n function GraphNode(id, dataIndex) {\n this.inEdges = [];\n this.outEdges = [];\n this.edges = [];\n this.dataIndex = -1;\n this.id = id == null ? '' : id;\n this.dataIndex = dataIndex == null ? -1 : dataIndex;\n }\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.degree = function () {\n return this.edges.length;\n };\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.inDegree = function () {\n return this.inEdges.length;\n };\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.outDegree = function () {\n return this.outEdges.length;\n };\n\n GraphNode.prototype.getModel = function (path) {\n if (this.dataIndex < 0) {\n return;\n }\n\n var graph = this.hostGraph;\n var itemModel = graph.data.getItemModel(this.dataIndex);\n return itemModel.getModel(path);\n };\n\n GraphNode.prototype.getAdjacentDataIndices = function () {\n var dataIndices = {\n edge: [],\n node: []\n };\n\n for (var i = 0; i < this.edges.length; i++) {\n var adjacentEdge = this.edges[i];\n\n if (adjacentEdge.dataIndex < 0) {\n continue;\n }\n\n dataIndices.edge.push(adjacentEdge.dataIndex);\n dataIndices.node.push(adjacentEdge.node1.dataIndex, adjacentEdge.node2.dataIndex);\n }\n\n return dataIndices;\n };\n\n return GraphNode;\n}();\n\nvar GraphEdge =\n/** @class */\nfunction () {\n function GraphEdge(n1, n2, dataIndex) {\n this.dataIndex = -1;\n this.node1 = n1;\n this.node2 = n2;\n this.dataIndex = dataIndex == null ? -1 : dataIndex;\n }\n\n GraphEdge.prototype.getModel = function (path) {\n if (this.dataIndex < 0) {\n return;\n }\n\n var graph = this.hostGraph;\n var itemModel = graph.edgeData.getItemModel(this.dataIndex);\n return itemModel.getModel(path);\n };\n\n GraphEdge.prototype.getAdjacentDataIndices = function () {\n return {\n edge: [this.dataIndex],\n node: [this.node1.dataIndex, this.node2.dataIndex]\n };\n };\n\n return GraphEdge;\n}();\n\nfunction createGraphDataProxyMixin(hostName, dataName) {\n return {\n /**\n * @param Default 'value'. can be 'a', 'b', 'c', 'd', 'e'.\n */\n getValue: function (dimension) {\n var data = this[hostName][dataName];\n return data.get(data.getDimension(dimension || 'value'), this.dataIndex);\n },\n // TODO: TYPE stricter type.\n setVisual: function (key, value) {\n this.dataIndex >= 0 && this[hostName][dataName].setItemVisual(this.dataIndex, key, value);\n },\n getVisual: function (key) {\n return this[hostName][dataName].getItemVisual(this.dataIndex, key);\n },\n setLayout: function (layout, merge) {\n this.dataIndex >= 0 && this[hostName][dataName].setItemLayout(this.dataIndex, layout, merge);\n },\n getLayout: function () {\n return this[hostName][dataName].getItemLayout(this.dataIndex);\n },\n getGraphicEl: function () {\n return this[hostName][dataName].getItemGraphicEl(this.dataIndex);\n },\n getRawIndex: function () {\n return this[hostName][dataName].getRawIndex(this.dataIndex);\n }\n };\n}\n\n;\n;\n;\nzrUtil.mixin(GraphNode, createGraphDataProxyMixin('hostGraph', 'data'));\nzrUtil.mixin(GraphEdge, createGraphDataProxyMixin('hostGraph', 'edgeData'));\nexport default Graph;\nexport { GraphNode, GraphEdge };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * Link lists and struct (graph or tree)\n */\nimport { curry, each, assert, extend, map, keys } from 'zrender/lib/core/util';\nimport { makeInner } from '../../util/model';\nvar inner = makeInner();\n\nfunction linkList(opt) {\n var mainData = opt.mainData;\n var datas = opt.datas;\n\n if (!datas) {\n datas = {\n main: mainData\n };\n opt.datasAttr = {\n main: 'data'\n };\n }\n\n opt.datas = opt.mainData = null;\n linkAll(mainData, datas, opt); // Porxy data original methods.\n\n each(datas, function (data) {\n each(mainData.TRANSFERABLE_METHODS, function (methodName) {\n data.wrapMethod(methodName, curry(transferInjection, opt));\n });\n }); // Beyond transfer, additional features should be added to `cloneShallow`.\n\n mainData.wrapMethod('cloneShallow', curry(cloneShallowInjection, opt)); // Only mainData trigger change, because struct.update may trigger\n // another changable methods, which may bring about dead lock.\n\n each(mainData.CHANGABLE_METHODS, function (methodName) {\n mainData.wrapMethod(methodName, curry(changeInjection, opt));\n }); // Make sure datas contains mainData.\n\n assert(datas[mainData.dataType] === mainData);\n}\n\nfunction transferInjection(opt, res) {\n if (isMainData(this)) {\n // Transfer datas to new main data.\n var datas = extend({}, inner(this).datas);\n datas[this.dataType] = res;\n linkAll(res, datas, opt);\n } else {\n // Modify the reference in main data to point newData.\n linkSingle(res, this.dataType, inner(this).mainData, opt);\n }\n\n return res;\n}\n\nfunction changeInjection(opt, res) {\n opt.struct && opt.struct.update();\n return res;\n}\n\nfunction cloneShallowInjection(opt, res) {\n // cloneShallow, which brings about some fragilities, may be inappropriate\n // to be exposed as an API. So for implementation simplicity we can make\n // the restriction that cloneShallow of not-mainData should not be invoked\n // outside, but only be invoked here.\n each(inner(res).datas, function (data, dataType) {\n data !== res && linkSingle(data.cloneShallow(), dataType, res, opt);\n });\n return res;\n}\n/**\n * Supplement method to List.\n *\n * @public\n * @param [dataType] If not specified, return mainData.\n */\n\n\nfunction getLinkedData(dataType) {\n var mainData = inner(this).mainData;\n return dataType == null || mainData == null ? mainData : inner(mainData).datas[dataType];\n}\n/**\n * Get list of all linked data\n */\n\n\nfunction getLinkedDataAll() {\n var mainData = inner(this).mainData;\n return mainData == null ? [{\n data: mainData\n }] : map(keys(inner(mainData).datas), function (type) {\n return {\n type: type,\n data: inner(mainData).datas[type]\n };\n });\n}\n\nfunction isMainData(data) {\n return inner(data).mainData === data;\n}\n\nfunction linkAll(mainData, datas, opt) {\n inner(mainData).datas = {};\n each(datas, function (data, dataType) {\n linkSingle(data, dataType, mainData, opt);\n });\n}\n\nfunction linkSingle(data, dataType, mainData, opt) {\n inner(mainData).datas[dataType] = data;\n inner(data).mainData = mainData;\n data.dataType = dataType;\n\n if (opt.struct) {\n data[opt.structAttr] = opt.struct;\n opt.struct[opt.datasAttr[dataType]] = data;\n } // Supplement method.\n\n\n data.getLinkedData = getLinkedData;\n data.getLinkedDataAll = getLinkedDataAll;\n}\n\nexport default linkList;","import * as echarts from 'echarts/lib/echarts';\nimport Graph from 'echarts/lib/data/Graph';\nimport linkList from 'echarts/lib/data/helper/linkList';\nimport retrieve from '../../util/retrieve';\n\nexport default function (nodes, edges, hostModel, directed, beforeLink) {\n var graph = new Graph(directed);\n for (var i = 0; i < nodes.length; i++) {\n graph.addNode(retrieve.firstNotNull(\n // Id, name, dataIndex\n nodes[i].id, nodes[i].name, i\n ), i);\n }\n\n var linkNameList = [];\n var validEdges = [];\n var linkCount = 0;\n for (var i = 0; i < edges.length; i++) {\n var link = edges[i];\n var source = link.source;\n var target = link.target;\n // addEdge may fail when source or target not exists\n if (graph.addEdge(source, target, linkCount)) {\n validEdges.push(link);\n linkNameList.push(retrieve.firstNotNull(link.id, source + ' > ' + target));\n linkCount++;\n }\n }\n\n var nodeData;\n\n // FIXME, support more coordinate systems.\n var dimensionNames = echarts.helper.createDimensions(\n nodes, {\n coordDimensions: ['value']\n }\n );\n nodeData = new echarts.List(dimensionNames, hostModel);\n nodeData.initData(nodes);\n\n var edgeData = new echarts.List(['value'], hostModel);\n edgeData.initData(validEdges, linkNameList);\n\n beforeLink && beforeLink(nodeData, edgeData);\n\n linkList({\n mainData: nodeData,\n struct: graph,\n structAttr: 'graph',\n datas: {node: nodeData, edge: edgeData},\n datasAttr: {node: 'data', edge: 'edgeData'}\n });\n\n // Update dataIndex of nodes and edges because invalid edge may be removed\n graph.update();\n\n return graph;\n};","import * as echarts from 'echarts/lib/echarts';\nimport createGraphFromNodeEdge from './createGraphFromNodeEdge';\nimport formatUtil from '../../util/format';\n\nvar GraphSeries = echarts.SeriesModel.extend({\n\n type: 'series.graphGL',\n\n visualStyleAccessPath: 'itemStyle',\n\n hasSymbolVisual: true,\n\n init: function (option) {\n GraphSeries.superApply(this, 'init', arguments);\n\n // Provide data for legend select\n this.legendDataProvider = function () {\n return this._categoriesData;\n };\n\n this._updateCategoriesData();\n },\n\n mergeOption: function (option) {\n GraphSeries.superApply(this, 'mergeOption', arguments);\n\n this._updateCategoriesData();\n },\n\n getFormattedLabel: function (dataIndex, status, dataType, dimIndex) {\n var text = formatUtil.getFormattedLabel(this, dataIndex, status, dataType, dimIndex);\n if (text == null) {\n var data = this.getData();\n var lastDim = data.dimensions[data.dimensions.length - 1];\n text = data.get(lastDim, dataIndex);\n }\n return text;\n },\n\n getInitialData: function (option, ecModel) {\n var edges = option.edges || option.links || [];\n var nodes = option.data || option.nodes || [];\n var self = this;\n\n if (nodes && edges) {\n return createGraphFromNodeEdge(nodes, edges, this, true, beforeLink).data;\n }\n\n function beforeLink(nodeData, edgeData) {\n // Overwrite nodeData.getItemModel to\n nodeData.wrapMethod('getItemModel', function (model) {\n const categoriesModels = self._categoriesModels;\n const categoryIdx = model.getShallow('category');\n const categoryModel = categoriesModels[categoryIdx];\n if (categoryModel) {\n categoryModel.parentModel = model.parentModel;\n model.parentModel = categoryModel;\n }\n return model;\n });\n\n // TODO Inherit resolveParentPath by default in Model#getModel?\n const oldGetModel = ecModel.getModel([]).getModel;\n function newGetModel(path, parentModel) {\n const model = oldGetModel.call(this, path, parentModel);\n model.resolveParentPath = resolveParentPath;\n return model;\n }\n\n edgeData.wrapMethod('getItemModel', function (model) {\n model.resolveParentPath = resolveParentPath;\n model.getModel = newGetModel;\n return model;\n });\n\n function resolveParentPath(pathArr) {\n if (pathArr && (pathArr[0] === 'label' || pathArr[1] === 'label')) {\n const newPathArr = pathArr.slice();\n if (pathArr[0] === 'label') {\n newPathArr[0] = 'edgeLabel';\n }\n else if (pathArr[1] === 'label') {\n newPathArr[1] = 'edgeLabel';\n }\n return newPathArr;\n }\n return pathArr;\n }\n }\n },\n\n /**\n * @return {module:echarts/data/Graph}\n */\n getGraph: function () {\n return this.getData().graph;\n },\n\n /**\n * @return {module:echarts/data/List}\n */\n getEdgeData: function () {\n return this.getGraph().edgeData;\n },\n\n /**\n * @return {module:echarts/data/List}\n */\n getCategoriesData: function () {\n return this._categoriesData;\n },\n\n /**\n * @override\n */\n formatTooltip: function (dataIndex, multipleSeries, dataType) {\n if (dataType === 'edge') {\n var nodeData = this.getData();\n var params = this.getDataParams(dataIndex, dataType);\n var edge = nodeData.graph.getEdgeByIndex(dataIndex);\n var sourceName = nodeData.getName(edge.node1.dataIndex);\n var targetName = nodeData.getName(edge.node2.dataIndex);\n\n var html = [];\n sourceName != null && html.push(sourceName);\n targetName != null && html.push(targetName);\n html = echarts.format.encodeHTML(html.join(' > '));\n\n if (params.value) {\n html += ' : ' + echarts.format.encodeHTML(params.value);\n }\n return html;\n }\n else { // dataType === 'node' or empty\n return GraphSeries.superApply(this, 'formatTooltip', arguments);\n }\n },\n\n _updateCategoriesData: function () {\n var categories = (this.option.categories || []).map(function (category) {\n // Data must has value\n return category.value != null ? category : Object.assign({\n value: 0\n }, category);\n });\n var categoriesData = new echarts.List(['value'], this);\n categoriesData.initData(categories);\n\n this._categoriesData = categoriesData;\n\n this._categoriesModels = categoriesData.mapArray(function (idx) {\n return categoriesData.getItemModel(idx, true);\n });\n },\n\n setView: function (payload) {\n if (payload.zoom != null) {\n this.option.zoom = payload.zoom;\n }\n if (payload.offset != null) {\n this.option.offset = payload.offset;\n }\n },\n\n setNodePosition: function (points) {\n for (var i = 0; i < points.length / 2; i++) {\n var x = points[i * 2];\n var y = points[i * 2 + 1];\n\n var opt = this.getData().getRawDataItem(i);\n opt.x = x;\n opt.y = y;\n }\n },\n\n isAnimationEnabled: function () {\n return GraphSeries.superCall(this, 'isAnimationEnabled')\n // Not enable animation when do force layout\n && !(this.get('layout') === 'force' && this.get('force.layoutAnimation'));\n },\n\n defaultOption: {\n zlevel: 10,\n z: 2,\n\n legendHoverLink: true,\n\n // Only support forceAtlas2\n layout: 'forceAtlas2',\n\n // Configuration of force directed layout\n forceAtlas2: {\n initLayout: null,\n\n GPU: true,\n\n steps: 1,\n\n // barnesHutOptimize\n\n // Maxp layout steps.\n maxSteps: 1000,\n\n repulsionByDegree: true,\n linLogMode: false,\n strongGravityMode: false,\n gravity: 1.0,\n // scaling: 1.0,\n\n edgeWeightInfluence: 1.0,\n\n // Edge weight range.\n edgeWeight: [1, 4],\n // Node weight range.\n nodeWeight: [1, 4],\n\n // jitterTolerence: 0.1,\n preventOverlap: false,\n gravityCenter: null\n },\n\n focusNodeAdjacency: true,\n\n focusNodeAdjacencyOn: 'mouseover',\n\n left: 'center',\n top: 'center',\n // right: null,\n // bottom: null,\n // width: '80%',\n // height: '80%',\n\n symbol: 'circle',\n symbolSize: 5,\n\n roam: false,\n\n // Default on center of graph\n center: null,\n\n zoom: 1,\n\n // categories: [],\n\n // data: []\n // Or\n // nodes: []\n //\n // links: []\n // Or\n // edges: []\n\n label: {\n show: false,\n formatter: '{b}',\n position: 'right',\n distance: 5,\n textStyle: {\n fontSize: 14\n }\n },\n\n itemStyle: {},\n\n lineStyle: {\n color: '#aaa',\n width: 1,\n opacity: 0.5\n },\n\n emphasis: {\n label: {\n show: true\n }\n },\n\n animation: false\n }\n});\n\nexport default GraphSeries;","/**\n * Lines geometry\n * Use screen space projected lines lineWidth > MAX_LINE_WIDTH\n * https://mattdesl.svbtle.com/drawing-lines-is-hard\n * @module echarts-gl/util/geometry/LinesGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\nimport dynamicConvertMixin from './dynamicConvertMixin';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec2 = glmatrix.vec2;\n\n// var CURVE_RECURSION_LIMIT = 8;\n// var CURVE_COLLINEAR_EPSILON = 40;\n\nvar sampleLinePoints = [[0, 0], [1, 1]];\n/**\n * @constructor\n * @alias module:echarts-gl/util/geometry/LinesGeometry\n * @extends clay.Geometry\n */\n\nvar LinesGeometry = Geometry.extend(function () {\n return {\n\n segmentScale: 4,\n\n dynamic: true,\n /**\n * Need to use mesh to expand lines if lineWidth > MAX_LINE_WIDTH\n */\n useNativeLine: true,\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 2, 'POSITION'),\n normal: new Geometry.Attribute('normal', 'float', 2),\n offset: new Geometry.Attribute('offset', 'float', 1),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR')\n }\n };\n},\n/** @lends module: echarts-gl/util/geometry/LinesGeometry.prototype */\n{\n\n /**\n * Reset offset\n */\n resetOffset: function () {\n this._vertexOffset = 0;\n this._faceOffset = 0;\n\n this._itemVertexOffsets = [];\n },\n\n /**\n * @param {number} nVertex\n */\n setVertexCount: function (nVertex) {\n var attributes = this.attributes;\n if (this.vertexCount !== nVertex) {\n attributes.position.init(nVertex);\n attributes.color.init(nVertex);\n\n if (!this.useNativeLine) {\n attributes.offset.init(nVertex);\n attributes.normal.init(nVertex);\n }\n\n if (nVertex > 0xffff) {\n if (this.indices instanceof Uint16Array) {\n this.indices = new Uint32Array(this.indices);\n }\n }\n else {\n if (this.indices instanceof Uint32Array) {\n this.indices = new Uint16Array(this.indices);\n }\n }\n }\n },\n\n /**\n * @param {number} nTriangle\n */\n setTriangleCount: function (nTriangle) {\n if (this.triangleCount !== nTriangle) {\n if (nTriangle === 0) {\n this.indices = null;\n }\n else {\n this.indices = this.vertexCount > 0xffff ? new Uint32Array(nTriangle * 3) : new Uint16Array(nTriangle * 3);\n }\n }\n },\n\n _getCubicCurveApproxStep: function (p0, p1, p2, p3) {\n var len = vec2.dist(p0, p1) + vec2.dist(p2, p1) + vec2.dist(p3, p2);\n var step = 1 / (len + 1) * this.segmentScale;\n return step;\n },\n\n /**\n * Get vertex count of cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @return number\n */\n getCubicCurveVertexCount: function (p0, p1, p2, p3) {\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n var segCount = Math.ceil(1 / step);\n if (!this.useNativeLine) {\n return segCount * 2 + 2;\n }\n else {\n return segCount * 2;\n }\n },\n\n /**\n * Get face count of cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @return number\n */\n getCubicCurveTriangleCount: function (p0, p1, p2, p3) {\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n var segCount = Math.ceil(1 / step);\n if (!this.useNativeLine) {\n return segCount * 2;\n }\n else {\n return 0;\n }\n },\n\n /**\n * Get vertex count of line\n * @return {number}\n */\n getLineVertexCount: function () {\n return this.getPolylineVertexCount(sampleLinePoints);\n },\n\n /**\n * Get face count of line\n * @return {number}\n */\n getLineTriangleCount: function () {\n return this.getPolylineTriangleCount(sampleLinePoints);\n },\n\n /**\n * Get how many vertices will polyline take.\n * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount.\n * @return {number}\n */\n getPolylineVertexCount: function (points) {\n var pointsLen;\n if (typeof points === 'number') {\n pointsLen = points;\n }\n else {\n var is2DArray = typeof points[0] !== 'number';\n pointsLen = is2DArray ? points.length : (points.length / 2);\n }\n return !this.useNativeLine ? ((pointsLen - 1) * 2 + 2) : (pointsLen - 1) * 2;\n },\n\n /**\n * Get how many triangles will polyline take.\n * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount.\n * @return {number}\n */\n getPolylineTriangleCount: function (points) {\n var pointsLen;\n if (typeof points === 'number') {\n pointsLen = points;\n }\n else {\n var is2DArray = typeof points[0] !== 'number';\n pointsLen = is2DArray ? points.length : (points.length / 2);\n }\n return !this.useNativeLine ? (pointsLen - 1) * 2 : 0;\n },\n\n /**\n * Add a cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @param {Array.} color\n * @param {number} [lineWidth=1]\n */\n addCubicCurve: function (p0, p1, p2, p3, color, lineWidth) {\n if (lineWidth == null) {\n lineWidth = 1;\n }\n // incremental interpolation\n // http://antigrain.com/research/bezier_interpolation/index.html#PAGE_BEZIER_INTERPOLATION\n var x0 = p0[0], y0 = p0[1];\n var x1 = p1[0], y1 = p1[1];\n var x2 = p2[0], y2 = p2[1];\n var x3 = p3[0], y3 = p3[1];\n\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n\n var step2 = step * step;\n var step3 = step2 * step;\n\n var pre1 = 3.0 * step;\n var pre2 = 3.0 * step2;\n var pre4 = 6.0 * step2;\n var pre5 = 6.0 * step3;\n\n var tmp1x = x0 - x1 * 2.0 + x2;\n var tmp1y = y0 - y1 * 2.0 + y2;\n\n var tmp2x = (x1 - x2) * 3.0 - x0 + x3;\n var tmp2y = (y1 - y2) * 3.0 - y0 + y3;\n\n var fx = x0;\n var fy = y0;\n\n var dfx = (x1 - x0) * pre1 + tmp1x * pre2 + tmp2x * step3;\n var dfy = (y1 - y0) * pre1 + tmp1y * pre2 + tmp2y * step3;\n\n var ddfx = tmp1x * pre4 + tmp2x * pre5;\n var ddfy = tmp1y * pre4 + tmp2y * pre5;\n\n var dddfx = tmp2x * pre5;\n var dddfy = tmp2y * pre5;\n\n var t = 0;\n\n var k = 0;\n var segCount = Math.ceil(1 / step);\n\n var points = new Float32Array((segCount + 1) * 3);\n var points = [];\n var offset = 0;\n for (var k = 0; k < segCount + 1; k++) {\n points[offset++] = fx;\n points[offset++] = fy;\n\n fx += dfx; fy += dfy;\n dfx += ddfx; dfy += ddfy;\n ddfx += dddfx; ddfy += dddfy;\n t += step;\n\n if (t > 1) {\n fx = dfx > 0 ? Math.min(fx, x3) : Math.max(fx, x3);\n fy = dfy > 0 ? Math.min(fy, y3) : Math.max(fy, y3);\n }\n }\n\n this.addPolyline(points, color, lineWidth);\n },\n\n /**\n * Add a straight line\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} color\n * @param {number} [lineWidth=1]\n */\n addLine: function (p0, p1, color, lineWidth) {\n this.addPolyline([p0, p1], color, lineWidth);\n },\n\n /**\n * Add a straight line\n * @param {Array. | Array.} points\n * @param {Array. | Array.} color\n * @param {number} [lineWidth=1]\n * @param {number} [arrayOffset=0]\n * @param {number} [pointsCount] Default to be amount of points in the first argument\n */\n addPolyline: (function () {\n var dirA = vec2.create();\n var dirB = vec2.create();\n var normal = vec2.create();\n var tangent = vec2.create();\n var point = [], nextPoint = [], prevPoint = [];\n return function (points, color, lineWidth, arrayOffset, pointsCount) {\n if (!points.length) {\n return;\n }\n var is2DArray = typeof points[0] !== 'number';\n if (pointsCount == null) {\n pointsCount = is2DArray ? points.length : points.length / 2;\n }\n if (pointsCount < 2) {\n return;\n }\n if (arrayOffset == null) {\n arrayOffset = 0;\n }\n if (lineWidth == null) {\n lineWidth = 1;\n }\n\n this._itemVertexOffsets.push(this._vertexOffset);\n\n var notSharingColor = is2DArray\n ? typeof color[0] !== 'number'\n : color.length / 4 === pointsCount;\n\n var positionAttr = this.attributes.position;\n var colorAttr = this.attributes.color;\n var offsetAttr = this.attributes.offset;\n var normalAttr = this.attributes.normal;\n var indices = this.indices;\n\n var vertexOffset = this._vertexOffset;\n var pointColor;\n for (var k = 0; k < pointsCount; k++) {\n if (is2DArray) {\n point = points[k + arrayOffset];\n if (notSharingColor) {\n pointColor = color[k + arrayOffset];\n }\n else {\n pointColor = color;\n }\n }\n else {\n var k2 = k * 2 + arrayOffset;\n point = point || [];\n point[0] = points[k2];\n point[1] = points[k2 + 1];\n\n if (notSharingColor) {\n var k4 = k * 4 + arrayOffset;\n pointColor = pointColor || [];\n pointColor[0] = color[k4];\n pointColor[1] = color[k4 + 1];\n pointColor[2] = color[k4 + 2];\n pointColor[3] = color[k4 + 3];\n }\n else {\n pointColor = color;\n }\n }\n if (!this.useNativeLine) {\n var offset;\n if (k < pointsCount - 1) {\n if (is2DArray) {\n vec2.copy(nextPoint, points[k + 1]);\n }\n else {\n var k2 = (k + 1) * 2 + arrayOffset;\n nextPoint = nextPoint || [];\n nextPoint[0] = points[k2];\n nextPoint[1] = points[k2 + 1];\n }\n // TODO In case dir is (0, 0)\n // TODO miterLimit\n if (k > 0) {\n vec2.sub(dirA, point, prevPoint);\n vec2.sub(dirB, nextPoint, point);\n vec2.normalize(dirA, dirA);\n vec2.normalize(dirB, dirB);\n vec2.add(tangent, dirA, dirB);\n vec2.normalize(tangent, tangent);\n var miter = lineWidth / 2 * Math.min(1 / vec2.dot(dirA, tangent), 2);\n normal[0] = -tangent[1];\n normal[1] = tangent[0];\n\n offset = miter;\n }\n else {\n vec2.sub(dirA, nextPoint, point);\n vec2.normalize(dirA, dirA);\n\n normal[0] = -dirA[1];\n normal[1] = dirA[0];\n\n offset = lineWidth / 2;\n }\n\n }\n else {\n vec2.sub(dirA, point, prevPoint);\n vec2.normalize(dirA, dirA);\n\n normal[0] = -dirA[1];\n normal[1] = dirA[0];\n\n offset = lineWidth / 2;\n }\n normalAttr.set(vertexOffset, normal);\n normalAttr.set(vertexOffset + 1, normal);\n offsetAttr.set(vertexOffset, offset);\n offsetAttr.set(vertexOffset + 1, -offset);\n\n vec2.copy(prevPoint, point);\n\n positionAttr.set(vertexOffset, point);\n positionAttr.set(vertexOffset + 1, point);\n\n colorAttr.set(vertexOffset, pointColor);\n colorAttr.set(vertexOffset + 1, pointColor);\n\n vertexOffset += 2;\n }\n else {\n if (k > 1) {\n positionAttr.copy(vertexOffset, vertexOffset - 1);\n colorAttr.copy(vertexOffset, vertexOffset - 1);\n vertexOffset++;\n }\n }\n\n if (!this.useNativeLine) {\n if (k > 0) {\n var idx3 = this._faceOffset * 3;\n var indices = this.indices;\n // 0-----2\n // 1-----3\n // 0->1->2, 1->3->2\n indices[idx3] = vertexOffset - 4;\n indices[idx3 + 1] = vertexOffset - 3;\n indices[idx3 + 2] = vertexOffset - 2;\n\n indices[idx3 + 3] = vertexOffset - 3;\n indices[idx3 + 4] = vertexOffset - 1;\n indices[idx3 + 5] = vertexOffset - 2;\n\n this._faceOffset += 2;\n }\n }\n else {\n colorAttr.set(vertexOffset, pointColor);\n positionAttr.set(vertexOffset, point);\n vertexOffset++;\n }\n }\n\n this._vertexOffset = vertexOffset;\n };\n })(),\n\n /**\n * Set color of single line.\n */\n setItemColor: function (idx, color) {\n var startOffset = this._itemVertexOffsets[idx];\n var endOffset = idx < this._itemVertexOffsets.length - 1 ? this._itemVertexOffsets[idx + 1] : this._vertexOffset;\n\n for (var i = startOffset; i < endOffset; i++) {\n this.attributes.color.set(i, color);\n }\n this.dirty('color');\n }\n});\n\necharts.util.defaults(LinesGeometry.prototype, dynamicConvertMixin);\n\nexport default LinesGeometry;","export default \"@export ecgl.forceAtlas2.updateNodeRepulsion\\n\\n#define NODE_COUNT 0\\n\\nuniform sampler2D positionTex;\\n\\nuniform vec2 textureSize;\\nuniform float gravity;\\nuniform float scaling;\\nuniform vec2 gravityCenter;\\n\\nuniform bool strongGravityMode;\\nuniform bool preventOverlap;\\n\\nvarying vec2 v_Texcoord;\\n\\nvoid main() {\\n\\n vec4 n0 = texture2D(positionTex, v_Texcoord);\\n\\n vec2 force = vec2(0.0);\\n for (int i = 0; i < NODE_COUNT; i++) {\\n vec2 uv = vec2(\\n mod(float(i), textureSize.x) / (textureSize.x - 1.0),\\n floor(float(i) / textureSize.x) / (textureSize.y - 1.0)\\n );\\n vec4 n1 = texture2D(positionTex, uv);\\n\\n vec2 dir = n0.xy - n1.xy;\\n float d2 = dot(dir, dir);\\n\\n if (d2 > 0.0) {\\n float factor = 0.0;\\n if (preventOverlap) {\\n float d = sqrt(d2);\\n d = d - n0.w - n1.w;\\n if (d > 0.0) {\\n factor = scaling * n0.z * n1.z / (d * d);\\n }\\n else if (d < 0.0) {\\n factor = scaling * 100.0 * n0.z * n1.z;\\n }\\n }\\n else {\\n factor = scaling * n0.z * n1.z / d2;\\n }\\n force += dir * factor;\\n }\\n }\\n\\n vec2 dir = gravityCenter - n0.xy;\\n float d = 1.0;\\n if (!strongGravityMode) {\\n d = length(dir);\\n }\\n\\n force += dir * n0.z * gravity / (d + 1.0);\\n\\n gl_FragColor = vec4(force, 0.0, 1.0);\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\\n\\nattribute vec2 node1;\\nattribute vec2 node2;\\nattribute float weight;\\n\\nuniform sampler2D positionTex;\\nuniform float edgeWeightInfluence;\\nuniform bool preventOverlap;\\nuniform bool linLogMode;\\n\\nuniform vec2 windowSize: WINDOW_SIZE;\\n\\nvarying vec2 v_Force;\\n\\nvoid main() {\\n\\n vec4 n0 = texture2D(positionTex, node1);\\n vec4 n1 = texture2D(positionTex, node2);\\n\\n vec2 dir = n1.xy - n0.xy;\\n float d = length(dir);\\n float w;\\n if (edgeWeightInfluence == 0.0) {\\n w = 1.0;\\n }\\n else if (edgeWeightInfluence == 1.0) {\\n w = weight;\\n }\\n else {\\n w = pow(weight, edgeWeightInfluence);\\n }\\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\\n vec2 pos = node1 * scale * 2.0 - 1.0;\\n gl_Position = vec4(pos + offset, 0.0, 1.0);\\n gl_PointSize = 1.0;\\n\\n float factor;\\n if (preventOverlap) {\\n d = d - n1.w - n0.w;\\n }\\n if (d <= 0.0) {\\n v_Force = vec2(0.0);\\n return;\\n }\\n\\n if (linLogMode) {\\n factor = w * log(d) / d;\\n }\\n else {\\n factor = w;\\n }\\n v_Force = dir * factor;\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\\n\\nvarying vec2 v_Force;\\n\\nvoid main() {\\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\\n\\nattribute vec2 node;\\n\\nvarying vec2 v_NodeUv;\\n\\nvoid main() {\\n\\n v_NodeUv = node;\\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\\n gl_PointSize = 1.0;\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\\n\\nvarying vec2 v_NodeUv;\\n\\nuniform sampler2D positionTex;\\nuniform sampler2D forceTex;\\nuniform sampler2D forcePrevTex;\\n\\nvoid main() {\\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\\n\\n float mass = texture2D(positionTex, v_NodeUv).z;\\n float swing = length(force - forcePrev) * mass;\\n float traction = length(force + forcePrev) * 0.5 * mass;\\n\\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.calcGlobalSpeed\\n\\nuniform sampler2D globalSpeedPrevTex;\\nuniform sampler2D weightedSumTex;\\nuniform float jitterTolerence;\\n\\nvoid main() {\\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\\n float globalSpeed = jitterTolerence * jitterTolerence\\n * weightedSum.y / weightedSum.x;\\n if (prevGlobalSpeed > 0.0) {\\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\\n }\\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.updatePosition\\n\\nuniform sampler2D forceTex;\\nuniform sampler2D forcePrevTex;\\nuniform sampler2D positionTex;\\nuniform sampler2D globalSpeedTex;\\n\\nvarying vec2 v_Texcoord;\\n\\nvoid main() {\\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\\n vec4 node = texture2D(positionTex, v_Texcoord);\\n\\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\\n float swing = length(force - forcePrev);\\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\\n\\n float df = length(force);\\n if (df > 0.0) {\\n speed = min(df * speed, 10.0) / df;\\n\\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\\n }\\n else {\\n gl_FragColor = node;\\n }\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.edges.vertex\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nattribute vec2 node;\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n\\nuniform sampler2D positionTex;\\n\\nvoid main()\\n{\\n gl_Position = worldViewProjection * vec4(\\n texture2D(positionTex, node).xy, -10.0, 1.0\\n );\\n v_Color = a_Color;\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.edges.fragment\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\nvarying vec4 v_Color;\\nvoid main() {\\n gl_FragColor = color * v_Color;\\n}\\n@end\";\n","import graphicGL from '../../util/graphicGL';\nimport Pass from 'claygl/src/compositor/Pass';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\n\nimport forceAtlas2Code from './forceAtlas2.glsl.js';\ngraphicGL.Shader.import(forceAtlas2Code);\n\nvar defaultConfigs = {\n repulsionByDegree: true,\n linLogMode: false,\n\n strongGravityMode: false,\n gravity: 1.0,\n\n scaling: 1.0,\n\n edgeWeightInfluence: 1.0,\n\n jitterTolerence: 0.1,\n\n preventOverlap: false,\n\n dissuadeHubs: false,\n\n gravityCenter: null\n};\n\nfunction ForceAtlas2GPU(options) {\n\n var textureOpt = {\n type: graphicGL.Texture.FLOAT,\n minFilter: graphicGL.Texture.NEAREST,\n magFilter: graphicGL.Texture.NEAREST\n };\n\n this._positionSourceTex = new graphicGL.Texture2D(textureOpt);\n this._positionSourceTex.flipY = false;\n\n this._positionTex = new graphicGL.Texture2D(textureOpt);\n this._positionPrevTex = new graphicGL.Texture2D(textureOpt);\n this._forceTex = new graphicGL.Texture2D(textureOpt);\n this._forcePrevTex = new graphicGL.Texture2D(textureOpt);\n\n this._weightedSumTex = new graphicGL.Texture2D(textureOpt);\n this._weightedSumTex.width = this._weightedSumTex.height = 1;\n\n this._globalSpeedTex = new graphicGL.Texture2D(textureOpt);\n this._globalSpeedPrevTex = new graphicGL.Texture2D(textureOpt);\n this._globalSpeedTex.width = this._globalSpeedTex.height = 1;\n this._globalSpeedPrevTex.width = this._globalSpeedPrevTex.height = 1;\n\n this._nodeRepulsionPass = new Pass({\n fragment: graphicGL.Shader.source('ecgl.forceAtlas2.updateNodeRepulsion')\n });\n this._positionPass = new Pass({\n fragment: graphicGL.Shader.source('ecgl.forceAtlas2.updatePosition')\n });\n this._globalSpeedPass = new Pass({\n fragment: graphicGL.Shader.source('ecgl.forceAtlas2.calcGlobalSpeed')\n });\n this._copyPass = new Pass({\n fragment: graphicGL.Shader.source('clay.compositor.output')\n });\n\n var additiveBlend = function (gl) {\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFunc(gl.ONE, gl.ONE);\n };\n this._edgeForceMesh = new graphicGL.Mesh({\n geometry: new graphicGL.Geometry({\n attributes: {\n node1: new graphicGL.Geometry.Attribute('node1', 'float', 2),\n node2: new graphicGL.Geometry.Attribute('node2', 'float', 2),\n weight: new graphicGL.Geometry.Attribute('weight', 'float', 1)\n },\n dynamic: true,\n mainAttribute: 'node1'\n }),\n material: new graphicGL.Material({\n transparent: true,\n shader: graphicGL.createShader('ecgl.forceAtlas2.updateEdgeAttraction'),\n blend: additiveBlend,\n depthMask: false,\n depthText: false\n }),\n mode: graphicGL.Mesh.POINTS\n });\n this._weightedSumMesh = new graphicGL.Mesh({\n geometry: new graphicGL.Geometry({\n attributes: {\n node: new graphicGL.Geometry.Attribute('node', 'float', 2)\n },\n dynamic: true,\n mainAttribute: 'node'\n }),\n material: new graphicGL.Material({\n transparent: true,\n shader: graphicGL.createShader('ecgl.forceAtlas2.calcWeightedSum'),\n blend: additiveBlend,\n depthMask: false,\n depthText: false\n }),\n mode: graphicGL.Mesh.POINTS\n });\n\n this._framebuffer = new FrameBuffer({\n depthBuffer: false\n });\n\n this._dummyCamera = new graphicGL.OrthographicCamera({\n left: -1, right: 1,\n top: 1, bottom: -1,\n near: 0, far: 100\n });\n\n this._globalSpeed = 0;\n}\n\nForceAtlas2GPU.prototype.updateOption = function (options) {\n\n // Default config\n for (var name in defaultConfigs) {\n this[name] = defaultConfigs[name];\n }\n\n // Config according to data scale\n var nNodes = this._nodes.length;\n if (nNodes > 50000) {\n this.jitterTolerence = 10;\n }\n else if (nNodes > 5000) {\n this.jitterTolerence = 1;\n }\n else {\n this.jitterTolerence = 0.1;\n }\n\n if (nNodes > 100) {\n this.scaling = 2.0;\n }\n else {\n this.scaling = 10.0;\n }\n\n // this.edgeWeightInfluence = 1;\n // this.gravity = 1;\n // this.strongGravityMode = false;\n if (options) {\n for (var name in defaultConfigs) {\n if (options[name] != null) {\n this[name] = options[name];\n }\n }\n }\n\n if (this.repulsionByDegree) {\n var positionBuffer = this._positionSourceTex.pixels;\n\n for (var i = 0; i < this._nodes.length; i++) {\n positionBuffer[i * 4 + 2] = (this._nodes[i].degree || 0) + 1;\n }\n }\n};\n\nForceAtlas2GPU.prototype._updateGravityCenter = function (options) {\n var nodes = this._nodes;\n var edges = this._edges;\n\n if (!this.gravityCenter) {\n var min = [Infinity, Infinity];\n var max = [-Infinity, -Infinity];\n for (var i = 0; i < nodes.length; i++) {\n min[0] = Math.min(nodes[i].x, min[0]);\n min[1] = Math.min(nodes[i].y, min[1]);\n max[0] = Math.max(nodes[i].x, max[0]);\n max[1] = Math.max(nodes[i].y, max[1]);\n }\n\n this._gravityCenter = [(min[0] + max[0]) * 0.5, (min[1] + max[1]) * 0.5];\n }\n else {\n this._gravityCenter = this.gravityCenter;\n }\n // Update inDegree, outDegree\n for (var i = 0; i < edges.length; i++) {\n var node1 = edges[i].node1;\n var node2 = edges[i].node2;\n\n nodes[node1].degree = (nodes[node1].degree || 0) + 1;\n nodes[node2].degree = (nodes[node2].degree || 0) + 1;\n }\n};\n/**\n * @param {Array.} [{ x, y, mass }] nodes\n * @param {Array.} [{ node1, node2, weight }] edges\n */\nForceAtlas2GPU.prototype.initData = function (nodes, edges) {\n\n this._nodes = nodes;\n this._edges = edges;\n\n this._updateGravityCenter();\n\n var textureWidth = Math.ceil(Math.sqrt(nodes.length));\n var textureHeight = textureWidth;\n var positionBuffer = new Float32Array(textureWidth * textureHeight * 4);\n\n this._resize(textureWidth, textureHeight);\n\n var offset = 0;\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n positionBuffer[offset++] = node.x || 0;\n positionBuffer[offset++] = node.y || 0;\n positionBuffer[offset++] = node.mass || 1;\n positionBuffer[offset++] = node.size || 1;\n }\n this._positionSourceTex.pixels = positionBuffer;\n\n var edgeGeometry = this._edgeForceMesh.geometry;\n var edgeLen = edges.length;\n edgeGeometry.attributes.node1.init(edgeLen * 2);\n edgeGeometry.attributes.node2.init(edgeLen * 2);\n edgeGeometry.attributes.weight.init(edgeLen * 2);\n\n var uv = [];\n\n for (var i = 0; i < edges.length; i++) {\n var attributes = edgeGeometry.attributes;\n var weight = edges[i].weight;\n if (weight == null) {\n weight = 1;\n }\n // Two way.\n attributes.node1.set(i, this.getNodeUV(edges[i].node1, uv));\n attributes.node2.set(i, this.getNodeUV(edges[i].node2, uv));\n attributes.weight.set(i, weight);\n\n attributes.node1.set(i + edgeLen, this.getNodeUV(edges[i].node2, uv));\n attributes.node2.set(i + edgeLen, this.getNodeUV(edges[i].node1, uv));\n attributes.weight.set(i + edgeLen, weight);\n }\n\n var weigtedSumGeo = this._weightedSumMesh.geometry;\n weigtedSumGeo.attributes.node.init(nodes.length);\n for (var i = 0; i < nodes.length; i++) {\n weigtedSumGeo.attributes.node.set(i, this.getNodeUV(i, uv));\n }\n\n edgeGeometry.dirty();\n weigtedSumGeo.dirty();\n\n this._nodeRepulsionPass.material.define('fragment', 'NODE_COUNT', nodes.length);\n this._nodeRepulsionPass.material.setUniform('textureSize', [textureWidth, textureHeight]);\n\n this._inited = false;\n\n this._frame = 0;\n};\n\nForceAtlas2GPU.prototype.getNodes = function () {\n return this._nodes;\n};\nForceAtlas2GPU.prototype.getEdges = function () {\n return this._edges;\n};\n\nForceAtlas2GPU.prototype.step = function (renderer) {\n if (!this._inited) {\n this._initFromSource(renderer);\n this._inited = true;\n }\n\n this._frame++;\n\n this._framebuffer.attach(this._forceTex);\n this._framebuffer.bind(renderer);\n var nodeRepulsionPass = this._nodeRepulsionPass;\n // Calc node repulsion, gravity\n nodeRepulsionPass.setUniform('strongGravityMode', this.strongGravityMode);\n nodeRepulsionPass.setUniform('gravity', this.gravity);\n nodeRepulsionPass.setUniform('gravityCenter', this._gravityCenter);\n nodeRepulsionPass.setUniform('scaling', this.scaling);\n nodeRepulsionPass.setUniform('preventOverlap', this.preventOverlap);\n nodeRepulsionPass.setUniform('positionTex', this._positionPrevTex);\n nodeRepulsionPass.render(renderer);\n\n // Calc edge attraction force\n var edgeForceMesh = this._edgeForceMesh;\n edgeForceMesh.material.set('linLogMode', this.linLogMode);\n edgeForceMesh.material.set('edgeWeightInfluence', this.edgeWeightInfluence);\n edgeForceMesh.material.set('preventOverlap', this.preventOverlap);\n edgeForceMesh.material.set('positionTex', this._positionPrevTex);\n renderer.gl.enable(renderer.gl.BLEND);\n renderer.renderPass([edgeForceMesh], this._dummyCamera);\n\n // Calc weighted sum.\n this._framebuffer.attach(this._weightedSumTex);\n renderer.gl.clearColor(0, 0, 0, 0);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT);\n renderer.gl.enable(renderer.gl.BLEND);\n var weightedSumMesh = this._weightedSumMesh;\n weightedSumMesh.material.set('positionTex', this._positionPrevTex);\n weightedSumMesh.material.set('forceTex', this._forceTex);\n weightedSumMesh.material.set('forcePrevTex', this._forcePrevTex);\n renderer.renderPass([weightedSumMesh], this._dummyCamera);\n\n // Calc global speed.\n this._framebuffer.attach(this._globalSpeedTex);\n var globalSpeedPass = this._globalSpeedPass;\n globalSpeedPass.setUniform('globalSpeedPrevTex', this._globalSpeedPrevTex);\n globalSpeedPass.setUniform('weightedSumTex', this._weightedSumTex);\n globalSpeedPass.setUniform('jitterTolerence', this.jitterTolerence);\n renderer.gl.disable(renderer.gl.BLEND);\n globalSpeedPass.render(renderer);\n\n // Update position.\n var positionPass = this._positionPass;\n this._framebuffer.attach(this._positionTex);\n positionPass.setUniform('globalSpeedTex', this._globalSpeedTex);\n positionPass.setUniform('positionTex', this._positionPrevTex);\n positionPass.setUniform('forceTex', this._forceTex);\n positionPass.setUniform('forcePrevTex', this._forcePrevTex);\n positionPass.render(renderer);\n\n this._framebuffer.unbind(renderer);\n\n this._swapTexture();\n};\n\nForceAtlas2GPU.prototype.update = function (renderer, steps, cb) {\n if (steps == null) {\n steps = 1;\n }\n steps = Math.max(steps, 1);\n\n for (var i = 0; i < steps; i++) {\n this.step(renderer);\n }\n\n cb && cb();\n};\n\nForceAtlas2GPU.prototype.getNodePositionTexture = function () {\n return this._inited\n // Texture already been swapped.\n ? this._positionPrevTex\n : this._positionSourceTex;\n};\n\nForceAtlas2GPU.prototype.getNodeUV = function (nodeIndex, uv) {\n uv = uv || [];\n var textureWidth = this._positionTex.width;\n var textureHeight = this._positionTex.height;\n uv[0] = (nodeIndex % textureWidth) / (textureWidth - 1);\n uv[1] = Math.floor(nodeIndex / textureWidth) / (textureHeight - 1) || 0;\n return uv;\n};\n\nForceAtlas2GPU.prototype.getNodePosition = function (renderer, out) {\n var positionArr = this._positionArr;\n var width = this._positionTex.width;\n var height = this._positionTex.height;\n var size = width * height;\n if (!positionArr || positionArr.length !== size * 4) {\n positionArr = this._positionArr = new Float32Array(size * 4);\n }\n this._framebuffer.bind(renderer);\n this._framebuffer.attach(this._positionPrevTex);\n renderer.gl.readPixels(\n 0, 0, width, height,\n renderer.gl.RGBA, renderer.gl.FLOAT,\n positionArr\n );\n this._framebuffer.unbind(renderer);\n if (!out) {\n out = new Float32Array(this._nodes.length * 2);\n }\n for (var i = 0; i < this._nodes.length; i++) {\n out[i * 2] = positionArr[i * 4];\n out[i * 2 + 1] = positionArr[i * 4 + 1];\n }\n return out;\n};\n\nForceAtlas2GPU.prototype.getTextureData = function (renderer, textureName) {\n var tex = this['_' + textureName + 'Tex'];\n var width = tex.width;\n var height = tex.height;\n this._framebuffer.bind(renderer);\n this._framebuffer.attach(tex);\n var arr = new Float32Array(width * height * 4);\n renderer.gl.readPixels(0, 0, width, height, renderer.gl.RGBA, renderer.gl.FLOAT, arr);\n this._framebuffer.unbind(renderer);\n return arr;\n};\n\nForceAtlas2GPU.prototype.getTextureSize = function () {\n return {\n width: this._positionTex.width,\n height: this._positionTex.height\n };\n};\n\nForceAtlas2GPU.prototype.isFinished = function (maxSteps) {\n return this._frame > maxSteps;\n};\n\nForceAtlas2GPU.prototype._swapTexture = function () {\n var tmp = this._positionPrevTex;\n this._positionPrevTex = this._positionTex;\n this._positionTex = tmp;\n\n var tmp = this._forcePrevTex;\n this._forcePrevTex = this._forceTex;\n this._forceTex = tmp;\n\n var tmp = this._globalSpeedPrevTex;\n this._globalSpeedPrevTex = this._globalSpeedTex;\n this._globalSpeedTex = tmp;\n};\n\nForceAtlas2GPU.prototype._initFromSource = function (renderer) {\n this._framebuffer.attach(this._positionPrevTex);\n this._framebuffer.bind(renderer);\n this._copyPass.setUniform('texture', this._positionSourceTex);\n this._copyPass.render(renderer);\n\n renderer.gl.clearColor(0, 0, 0, 0);\n this._framebuffer.attach(this._forcePrevTex);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT);\n this._framebuffer.attach(this._globalSpeedPrevTex);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT);\n\n this._framebuffer.unbind(renderer);\n};\n\nForceAtlas2GPU.prototype._resize = function (width, height) {\n ['_positionSourceTex', '_positionTex', '_positionPrevTex', '_forceTex', '_forcePrevTex'].forEach(function (texName) {\n this[texName].width = width;\n this[texName].height = height;\n this[texName].dirty();\n }, this);\n};\n\nForceAtlas2GPU.prototype.dispose = function (renderer) {\n this._framebuffer.dispose(renderer);\n\n this._copyPass.dispose(renderer);\n this._nodeRepulsionPass.dispose(renderer);\n this._positionPass.dispose(renderer);\n this._globalSpeedPass.dispose(renderer);\n\n this._edgeForceMesh.geometry.dispose(renderer);\n this._weightedSumMesh.geometry.dispose(renderer);\n\n this._positionSourceTex.dispose(renderer);\n this._positionTex.dispose(renderer);\n this._positionPrevTex.dispose(renderer);\n this._forceTex.dispose(renderer);\n this._forcePrevTex.dispose(renderer);\n this._weightedSumTex.dispose(renderer);\n this._globalSpeedTex.dispose(renderer);\n this._globalSpeedPrevTex.dispose(renderer);\n};\n\nexport default ForceAtlas2GPU;","/****************************\n * Vector2 math functions\n ***************************/\n\nfunction forceAtlas2Worker() {\n var vec2 = {\n create: function() {\n return new Float32Array(2);\n },\n dist: function(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n return Math.sqrt(x*x + y*y);\n },\n len: function(a) {\n var x = a[0];\n var y = a[1];\n return Math.sqrt(x*x + y*y);\n },\n scaleAndAdd: function(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n },\n scale: function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n },\n add: function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n },\n sub: function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n },\n normalize: function(out, a) {\n var x = a[0];\n var y = a[1];\n var len = x*x + y*y;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n }\n return out;\n },\n negate: function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n },\n copy: function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n },\n set: function(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n }\n }\n\n /****************************\n * Class: Region\n ***************************/\n\n function Region() {\n\n this.subRegions = [];\n\n this.nSubRegions = 0;\n\n this.node = null;\n\n this.mass = 0;\n\n this.centerOfMass = null;\n\n this.bbox = new Float32Array(4);\n\n this.size = 0;\n }\n\n var regionProto = Region.prototype;\n\n // Reset before update\n regionProto.beforeUpdate = function() {\n for (var i = 0; i < this.nSubRegions; i++) {\n this.subRegions[i].beforeUpdate();\n }\n this.mass = 0;\n if (this.centerOfMass) {\n this.centerOfMass[0] = 0;\n this.centerOfMass[1] = 0;\n }\n this.nSubRegions = 0;\n this.node = null;\n };\n // Clear after update\n regionProto.afterUpdate = function() {\n this.subRegions.length = this.nSubRegions;\n for (var i = 0; i < this.nSubRegions; i++) {\n this.subRegions[i].afterUpdate();\n }\n };\n\n regionProto.addNode = function(node) {\n if (this.nSubRegions === 0) {\n if (this.node == null) {\n this.node = node;\n return;\n }\n // Already have node, subdivide self.\n else {\n this._addNodeToSubRegion(this.node);\n this.node = null;\n }\n }\n this._addNodeToSubRegion(node);\n\n this._updateCenterOfMass(node);\n };\n\n regionProto.findSubRegion = function(x, y) {\n for (var i = 0; i < this.nSubRegions; i++) {\n var region = this.subRegions[i];\n if (region.contain(x, y)) {\n return region;\n }\n }\n };\n\n regionProto.contain = function(x, y) {\n return this.bbox[0] <= x\n && this.bbox[2] >= x\n && this.bbox[1] <= y\n && this.bbox[3] >= y;\n };\n\n regionProto.setBBox = function(minX, minY, maxX, maxY) {\n // Min\n this.bbox[0] = minX;\n this.bbox[1] = minY;\n // Max\n this.bbox[2] = maxX;\n this.bbox[3] = maxY;\n\n this.size = (maxX - minX + maxY - minY) / 2;\n };\n\n regionProto._newSubRegion = function() {\n var subRegion = this.subRegions[this.nSubRegions];\n if (!subRegion) {\n subRegion = new Region();\n this.subRegions[this.nSubRegions] = subRegion;\n }\n this.nSubRegions++;\n return subRegion;\n };\n\n regionProto._addNodeToSubRegion = function(node) {\n var subRegion = this.findSubRegion(node.position[0], node.position[1]);\n var bbox = this.bbox;\n if (!subRegion) {\n var cx = (bbox[0] + bbox[2]) / 2;\n var cy = (bbox[1] + bbox[3]) / 2;\n var w = (bbox[2] - bbox[0]) / 2;\n var h = (bbox[3] - bbox[1]) / 2;\n\n var xi = node.position[0] >= cx ? 1 : 0;\n var yi = node.position[1] >= cy ? 1 : 0;\n\n var subRegion = this._newSubRegion();\n // Min\n subRegion.setBBox(\n // Min\n xi * w + bbox[0],\n yi * h + bbox[1],\n // Max\n (xi + 1) * w + bbox[0],\n (yi + 1) * h + bbox[1]\n );\n }\n\n subRegion.addNode(node);\n };\n\n regionProto._updateCenterOfMass = function(node) {\n // Incrementally update\n if (this.centerOfMass == null) {\n this.centerOfMass = new Float32Array(2);\n }\n var x = this.centerOfMass[0] * this.mass;\n var y = this.centerOfMass[1] * this.mass;\n x += node.position[0] * node.mass;\n y += node.position[1] * node.mass;\n this.mass += node.mass;\n this.centerOfMass[0] = x / this.mass;\n this.centerOfMass[1] = y / this.mass;\n };\n\n /****************************\n * Class: Graph Node\n ***************************/\n function GraphNode() {\n this.position = new Float32Array(2);\n\n this.force = vec2.create();\n this.forcePrev = vec2.create();\n\n // If repulsionByDegree is true\n // mass = inDegree + outDegree + 1\n // Else\n // mass is manually set\n this.mass = 1;\n\n this.inDegree = 0;\n this.outDegree = 0;\n\n // Optional\n // this.size = 1;\n }\n\n /****************************\n * Class: Graph Edge\n ***************************/\n function GraphEdge(source, target) {\n this.source = source;\n this.target = target;\n\n this.weight = 1;\n }\n\n /****************************\n * Class: ForceStlas2\n ***************************/\n function ForceAtlas2() {\n //-------------\n // Configs\n\n // If auto settings is true\n // barnesHutOptimize,\n // barnesHutTheta,\n // scaling,\n // jitterTolerence\n // Will be set by the system automatically\n // preventOverlap will be set false\n // if node size is not given\n this.autoSettings = true;\n\n // Barnes Hut\n // http://arborjs.org/docs/barnes-hut\n this.barnesHutOptimize = true;\n this.barnesHutTheta = 1.5;\n\n // Force Atlas2 Configs\n this.repulsionByDegree = true;\n\n this.linLogMode = false;\n\n this.strongGravityMode = false;\n this.gravity = 1.0;\n\n this.scaling = 1.0;\n\n this.edgeWeightInfluence = 1.0;\n this.jitterTolerence = 0.1;\n\n // TODO\n this.preventOverlap = false;\n this.dissuadeHubs = false;\n\n //\n this.rootRegion = new Region();\n this.rootRegion.centerOfMass = vec2.create();\n\n this.nodes = [];\n\n this.edges = [];\n\n this.bbox = new Float32Array(4);\n\n this.gravityCenter = null;\n\n this._massArr = null;\n\n this._swingingArr = null;\n\n this._sizeArr = null;\n\n this._globalSpeed = 0;\n }\n\n var forceAtlas2Proto = ForceAtlas2.prototype;\n\n forceAtlas2Proto.initNodes = function(positionArr, massArr, sizeArr) {\n var nNodes = massArr.length;\n this.nodes.length = 0;\n var haveSize = typeof(sizeArr) != 'undefined';\n for (var i = 0; i < nNodes; i++) {\n var node = new GraphNode();\n node.position[0] = positionArr[i * 2];\n node.position[1] = positionArr[i * 2 + 1];\n node.mass = massArr[i];\n if (haveSize) {\n node.size = sizeArr[i];\n }\n this.nodes.push(node);\n }\n\n this._massArr = massArr;\n this._swingingArr = new Float32Array(nNodes);\n\n if (haveSize) {\n this._sizeArr = sizeArr;\n }\n };\n\n forceAtlas2Proto.initEdges = function(edgeArr, edgeWeightArr) {\n var nEdges = edgeArr.length / 2;\n this.edges.length = 0;\n for (var i = 0; i < nEdges; i++) {\n var sIdx = edgeArr[i * 2];\n var tIdx = edgeArr[i * 2 + 1];\n var sNode = this.nodes[sIdx];\n var tNode = this.nodes[tIdx];\n\n if (!sNode || !tNode) {\n console.error('Node not exists, try initNodes before initEdges');\n return;\n }\n sNode.outDegree++;\n tNode.inDegree++;\n var edge = new GraphEdge(sNode, tNode);\n\n if (edgeWeightArr) {\n edge.weight = edgeWeightArr[i];\n }\n\n this.edges.push(edge);\n }\n }\n\n forceAtlas2Proto.updateSettings = function() {\n if (this.repulsionByDegree) {\n for (var i = 0; i < this.nodes.length; i++) {\n var node = this.nodes[i];\n node.mass = node.inDegree + node.outDegree + 1;\n }\n }\n else {\n for (var i = 0; i < this.nodes.length; i++) {\n var node = this.nodes[i];\n node.mass = this._massArr[i];\n }\n }\n };\n\n forceAtlas2Proto.update = function() {\n var nNodes = this.nodes.length;\n\n this.updateSettings();\n\n this.updateBBox();\n\n // Update region\n if (this.barnesHutOptimize) {\n this.rootRegion.setBBox(\n this.bbox[0], this.bbox[1],\n this.bbox[2], this.bbox[3]\n );\n\n this.rootRegion.beforeUpdate();\n for (var i = 0; i < nNodes; i++) {\n this.rootRegion.addNode(this.nodes[i]);\n }\n this.rootRegion.afterUpdate();\n }\n\n // Reset forces\n for (var i = 0; i < nNodes; i++) {\n var node = this.nodes[i];\n vec2.copy(node.forcePrev, node.force);\n vec2.set(node.force, 0, 0);\n }\n\n // Compute forces\n // Repulsion\n for (var i = 0; i < nNodes; i++) {\n var na = this.nodes[i];\n if (this.barnesHutOptimize) {\n this.applyRegionToNodeRepulsion(this.rootRegion, na);\n }\n else {\n for (var j = i + 1; j < nNodes; j++) {\n var nb = this.nodes[j];\n this.applyNodeToNodeRepulsion(na, nb, false);\n }\n }\n\n // Gravity\n if (this.gravity > 0) {\n if (this.strongGravityMode) {\n this.applyNodeStrongGravity(na);\n }\n else {\n this.applyNodeGravity(na);\n }\n }\n }\n\n // Attraction\n for (var i = 0; i < this.edges.length; i++) {\n this.applyEdgeAttraction(this.edges[i]);\n }\n\n // Handle swinging\n var swingWeightedSum = 0;\n var tractionWeightedSum = 0;\n var tmp = vec2.create();\n for (var i = 0; i < nNodes; i++) {\n var node = this.nodes[i];\n var swing = vec2.dist(node.force, node.forcePrev);\n swingWeightedSum += swing * node.mass;\n\n vec2.add(tmp, node.force, node.forcePrev);\n var traction = vec2.len(tmp) * 0.5;\n tractionWeightedSum += traction * node.mass;\n\n // Save the value for using later\n this._swingingArr[i] = swing;\n }\n var globalSpeed = this.jitterTolerence * this.jitterTolerence\n * tractionWeightedSum / swingWeightedSum;\n // NB: During our tests we observed that an excessive rise of the global speed could have a negative impact.\n // That’s why we limited the increase of global speed s(t)(G) to 50% of the previous step s(t−1)(G).\n if (this._globalSpeed > 0) {\n globalSpeed = Math.min(globalSpeed / this._globalSpeed, 1.5) * this._globalSpeed;\n }\n this._globalSpeed = globalSpeed;\n\n // Apply forces\n for (var i = 0; i < nNodes; i++) {\n var node = this.nodes[i];\n var swing = this._swingingArr[i];\n\n var speed = 0.1 * globalSpeed / (1 + globalSpeed * Math.sqrt(swing));\n\n // Additional constraint to prevent local speed gets too high\n var df = vec2.len(node.force);\n if (df > 0) {\n speed = Math.min(df * speed, 10) / df;\n vec2.scaleAndAdd(node.position, node.position, node.force, speed);\n }\n }\n };\n\n forceAtlas2Proto.applyRegionToNodeRepulsion = (function() {\n var v = vec2.create();\n return function applyRegionToNodeRepulsion(region, node) {\n if (region.node) { // Region is a leaf\n this.applyNodeToNodeRepulsion(region.node, node, true);\n }\n else {\n vec2.sub(v, node.position, region.centerOfMass);\n var d2 = v[0] * v[0] + v[1] * v[1];\n if (d2 > this.barnesHutTheta * region.size * region.size) {\n var factor = this.scaling * node.mass * region.mass / d2;\n vec2.scaleAndAdd(node.force, node.force, v, factor);\n }\n else {\n for (var i = 0; i < region.nSubRegions; i++) {\n this.applyRegionToNodeRepulsion(region.subRegions[i], node);\n }\n }\n }\n }\n })();\n\n forceAtlas2Proto.applyNodeToNodeRepulsion = (function() {\n var v = vec2.create();\n return function applyNodeToNodeRepulsion(na, nb, oneWay) {\n if (na == nb) {\n return;\n }\n vec2.sub(v, na.position, nb.position);\n var d2 = v[0] * v[0] + v[1] * v[1];\n\n // PENDING\n if (d2 === 0) {\n return;\n }\n\n var factor;\n if (this.preventOverlap) {\n var d = Math.sqrt(d2);\n d = d - na.size - nb.size;\n if (d > 0) {\n factor = this.scaling * na.mass * nb.mass / (d * d);\n }\n else if (d < 0) {\n // A stronger repulsion if overlap\n factor = this.scaling * 100 * na.mass * nb.mass;\n }\n else {\n // No repulsion\n return;\n }\n }\n else {\n // Divide factor by an extra `d` to normalize the `v`\n factor = this.scaling * na.mass * nb.mass / d2;\n }\n\n vec2.scaleAndAdd(na.force, na.force, v, factor);\n vec2.scaleAndAdd(nb.force, nb.force, v, -factor);\n }\n })();\n\n forceAtlas2Proto.applyEdgeAttraction = (function() {\n var v = vec2.create();\n return function applyEdgeAttraction(edge) {\n var na = edge.source;\n var nb = edge.target;\n\n vec2.sub(v, na.position, nb.position);\n var d = vec2.len(v);\n\n var w;\n if (this.edgeWeightInfluence === 0) {\n w = 1;\n }\n else if (this.edgeWeightInfluence === 1) {\n w = edge.weight;\n }\n else {\n w = Math.pow(edge.weight, this.edgeWeightInfluence);\n }\n\n var factor;\n\n if (this.preventOverlap) {\n d = d - na.size - nb.size;\n if (d <= 0) {\n // No attraction\n return;\n }\n }\n\n if (this.linLogMode) {\n // Divide factor by an extra `d` to normalize the `v`\n factor = - w * Math.log(d + 1) / (d + 1);\n }\n else {\n factor = - w;\n }\n vec2.scaleAndAdd(na.force, na.force, v, factor);\n vec2.scaleAndAdd(nb.force, nb.force, v, -factor);\n }\n })();\n\n forceAtlas2Proto.applyNodeGravity = (function() {\n var v = vec2.create();\n return function(node) {\n vec2.sub(v, this.gravityCenter, node.position);\n var d = vec2.len(v);\n vec2.scaleAndAdd(node.force, node.force, v, this.gravity * node.mass / (d + 1));\n }\n })();\n\n forceAtlas2Proto.applyNodeStrongGravity = (function() {\n var v = vec2.create();\n return function(node) {\n vec2.sub(v, this.gravityCenter, node.position);\n vec2.scaleAndAdd(node.force, node.force, v, this.gravity * node.mass);\n }\n })();\n\n forceAtlas2Proto.updateBBox = function() {\n var minX = Infinity;\n var minY = Infinity;\n var maxX = -Infinity;\n var maxY = -Infinity;\n for (var i = 0; i < this.nodes.length; i++) {\n var pos = this.nodes[i].position;\n minX = Math.min(minX, pos[0]);\n minY = Math.min(minY, pos[1]);\n maxX = Math.max(maxX, pos[0]);\n maxY = Math.max(maxY, pos[1]);\n }\n this.bbox[0] = minX;\n this.bbox[1] = minY;\n this.bbox[2] = maxX;\n this.bbox[3] = maxY;\n };\n\n forceAtlas2Proto.getGlobalSpeed = function () {\n return this._globalSpeed;\n }\n\n /****************************\n * Main process\n ***************************/\n\n var forceAtlas2 = null;\n\n self.onmessage = function(e) {\n switch(e.data.cmd) {\n case 'init':\n forceAtlas2 = new ForceAtlas2();\n forceAtlas2.initNodes(e.data.nodesPosition, e.data.nodesMass, e.data.nodesSize);\n forceAtlas2.initEdges(e.data.edges, e.data.edgesWeight);\n break;\n case 'updateConfig':\n if (forceAtlas2) {\n for (var name in e.data.config) {\n forceAtlas2[name] = e.data.config[name];\n }\n }\n break;\n case 'update':\n var steps = e.data.steps;\n if (forceAtlas2) {\n for (var i = 0; i < steps; i++) {\n forceAtlas2.update();\n }\n\n var nNodes = forceAtlas2.nodes.length;\n var positionArr = new Float32Array(nNodes * 2);\n // Callback\n for (var i = 0; i < nNodes; i++) {\n var node = forceAtlas2.nodes[i];\n positionArr[i * 2] = node.position[0];\n positionArr[i * 2 + 1] = node.position[1];\n }\n self.postMessage({\n buffer: positionArr.buffer,\n globalSpeed: forceAtlas2.getGlobalSpeed()\n }, [positionArr.buffer]);\n }\n else {\n // Not initialzied yet\n var emptyArr = new Float32Array();\n // Post transfer object\n self.postMessage({\n buffer: emptyArr.buffer,\n globalSpeed: forceAtlas2.getGlobalSpeed()\n }, [emptyArr.buffer]);\n }\n break;\n }\n }\n}\n\nexport default forceAtlas2Worker;","import Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport workerFunc from './forceAtlas2Worker.js';\nvar workerUrl = workerFunc.toString();\nworkerUrl = workerUrl.slice(workerUrl.indexOf('{') + 1, workerUrl.lastIndexOf('}'));\n\nvar defaultConfigs = {\n\n barnesHutOptimize: true,\n barnesHutTheta: 1.5,\n\n repulsionByDegree: true,\n linLogMode: false,\n\n strongGravityMode: false,\n gravity: 1.0,\n\n scaling: 1.0,\n\n edgeWeightInfluence: 1.0,\n\n jitterTolerence: 0.1,\n\n preventOverlap: false,\n\n dissuadeHubs: false,\n\n gravityCenter: null\n};\n\nvar ForceAtlas2 = function (options) {\n\n for (var name in defaultConfigs) {\n this[name] = defaultConfigs[name];\n }\n\n if (options) {\n for (var name in options) {\n this[name] = options[name];\n }\n }\n\n this._nodes = [];\n this._edges = [];\n\n this._disposed = false;\n\n this._positionTex = new Texture2D({\n type: Texture.FLOAT,\n flipY: false,\n minFilter: Texture.NEAREST,\n magFilter: Texture.NEAREST\n });\n};\n\nForceAtlas2.prototype.initData = function (nodes, edges) {\n\n var bb = new Blob([workerUrl]);\n var blobURL = window.URL.createObjectURL(bb);\n\n this._worker = new Worker(blobURL);\n\n this._worker.onmessage = this._$onupdate.bind(this);\n\n this._nodes = nodes;\n this._edges = edges;\n this._frame = 0;\n\n var nNodes = nodes.length;\n var nEdges = edges.length;\n\n var positionArr = new Float32Array(nNodes * 2);\n var massArr = new Float32Array(nNodes);\n var sizeArr = new Float32Array(nNodes);\n\n var edgeArr = new Float32Array(nEdges * 2);\n var edgeWeightArr = new Float32Array(nEdges);\n\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n\n positionArr[i * 2] = node.x;\n positionArr[i * 2 + 1] = node.y;\n\n massArr[i] = node.mass == null ? 1 : node.mass;\n sizeArr[i] = node.size == null ? 1 : node.size;\n }\n\n for (var i = 0; i < edges.length; i++) {\n var edge = edges[i];\n\n var source = edge.node1;\n var target = edge.node2;\n\n edgeArr[i * 2] = source;\n edgeArr[i * 2 + 1] = target;\n\n edgeWeightArr[i] = edge.weight == null ? 1 : edge.weight;\n }\n\n\n var textureWidth = Math.ceil(Math.sqrt(nodes.length));\n var textureHeight = textureWidth;\n var pixels = new Float32Array(textureWidth * textureHeight * 4);\n var positionTex = this._positionTex;\n positionTex.width = textureWidth;\n positionTex.height = textureHeight;\n positionTex.pixels = pixels;\n\n this._worker.postMessage({\n cmd: 'init',\n nodesPosition: positionArr,\n nodesMass: massArr,\n nodesSize: sizeArr,\n edges: edgeArr,\n edgesWeight: edgeWeightArr\n });\n\n this._globalSpeed = Infinity;\n};\n\nForceAtlas2.prototype.updateOption = function (options) {\n var config = {};\n // Default config\n for (var name in defaultConfigs) {\n config[name] = defaultConfigs[name];\n }\n\n var nodes = this._nodes;\n var edges = this._edges;\n\n // Config according to data scale\n var nNodes = nodes.length;\n if (nNodes > 50000) {\n config.jitterTolerence = 10;\n }\n else if (nNodes > 5000) {\n config.jitterTolerence = 1;\n }\n else {\n config.jitterTolerence = 0.1;\n }\n\n if (nNodes > 100) {\n config.scaling = 2.0;\n }\n else {\n config.scaling = 10.0;\n }\n if (nNodes > 1000) {\n config.barnesHutOptimize = true;\n }\n else {\n config.barnesHutOptimize = false;\n }\n\n if (options) {\n for (var name in defaultConfigs) {\n if (options[name] != null) {\n config[name] = options[name];\n }\n }\n }\n\n if (!config.gravityCenter) {\n var min = [Infinity, Infinity];\n var max = [-Infinity, -Infinity];\n for (var i = 0; i < nodes.length; i++) {\n min[0] = Math.min(nodes[i].x, min[0]);\n min[1] = Math.min(nodes[i].y, min[1]);\n max[0] = Math.max(nodes[i].x, max[0]);\n max[1] = Math.max(nodes[i].y, max[1]);\n }\n\n config.gravityCenter = [(min[0] + max[0]) * 0.5, (min[1] + max[1]) * 0.5];\n }\n\n // Update inDegree, outDegree\n for (var i = 0; i < edges.length; i++) {\n var node1 = edges[i].node1;\n var node2 = edges[i].node2;\n\n nodes[node1].degree = (nodes[node1].degree || 0) + 1;\n nodes[node2].degree = (nodes[node2].degree || 0) + 1;\n }\n\n if (this._worker) {\n this._worker.postMessage({\n cmd: 'updateConfig',\n config: config\n });\n }\n};\n\n// Steps per call, to keep sync with rendering\nForceAtlas2.prototype.update = function (renderer, steps, cb) {\n if (steps == null) {\n steps = 1;\n }\n steps = Math.max(steps, 1);\n\n this._frame += steps;\n this._onupdate = cb;\n\n if (this._worker) {\n this._worker.postMessage({\n cmd: 'update',\n steps: Math.round(steps)\n });\n }\n};\n\nForceAtlas2.prototype._$onupdate = function (e) {\n // Incase the worker keep postMessage of last frame after it is disposed\n if (this._disposed) {\n return;\n }\n\n var positionArr = new Float32Array(e.data.buffer);\n this._globalSpeed = e.data.globalSpeed;\n\n this._positionArr = positionArr;\n\n this._updateTexture(positionArr);\n\n this._onupdate && this._onupdate();\n};\n\nForceAtlas2.prototype.getNodePositionTexture = function () {\n return this._positionTex;\n};\n\nForceAtlas2.prototype.getNodeUV = function (nodeIndex, uv) {\n uv = uv || [];\n var textureWidth = this._positionTex.width;\n var textureHeight = this._positionTex.height;\n uv[0] = (nodeIndex % textureWidth) / (textureWidth - 1);\n uv[1] = Math.floor(nodeIndex / textureWidth) / (textureHeight - 1);\n return uv;\n};\n\nForceAtlas2.prototype.getNodes = function () {\n return this._nodes;\n};\nForceAtlas2.prototype.getEdges = function () {\n return this._edges;\n};\nForceAtlas2.prototype.isFinished = function (maxSteps) {\n return this._frame > maxSteps;\n};\n\nForceAtlas2.prototype.getNodePosition = function (renderer, out) {\n if (!out) {\n out = new Float32Array(this._nodes.length * 2);\n }\n if (this._positionArr) {\n for (var i = 0; i < this._positionArr.length; i++) {\n out[i] = this._positionArr[i];\n }\n }\n return out;\n};\n\nForceAtlas2.prototype._updateTexture = function (positionArr) {\n var pixels = this._positionTex.pixels;\n var offset = 0;\n for (var i = 0; i < positionArr.length;){\n pixels[offset++] = positionArr[i++];\n pixels[offset++] = positionArr[i++];\n pixels[offset++] = 1;\n pixels[offset++] = 1;\n }\n this._positionTex.dirty();\n};\n\nForceAtlas2.prototype.dispose = function (renderer) {\n this._disposed = true;\n this._worker = null;\n};\n\nexport default ForceAtlas2;","\nimport Base from 'claygl/src/core/Base';\nimport retrieve from './retrieve';\n\n/**\n * @alias module:echarts-gl/util/Roam2DControl\n */\nvar Roam2DControl = Base.extend(function () {\n\n return {\n /**\n * @type {module:zrender~ZRender}\n */\n zr: null,\n\n /**\n * @type {module:echarts-gl/core/ViewGL}\n */\n viewGL: null,\n\n minZoom: 0.2,\n\n maxZoom: 5,\n\n _needsUpdate: false,\n\n _dx: 0,\n _dy: 0,\n\n _zoom: 1\n };\n}, function () {\n // Each Roam2DControl has it's own handler\n this._mouseDownHandler = this._mouseDownHandler.bind(this);\n this._mouseWheelHandler = this._mouseWheelHandler.bind(this);\n this._mouseMoveHandler = this._mouseMoveHandler.bind(this);\n this._mouseUpHandler = this._mouseUpHandler.bind(this);\n this._update = this._update.bind(this);\n}, {\n\n init: function () {\n var zr = this.zr;\n\n zr.on('mousedown', this._mouseDownHandler);\n zr.on('mousewheel', this._mouseWheelHandler);\n zr.on('globalout', this._mouseUpHandler);\n\n zr.animation.on('frame', this._update);\n },\n\n setTarget: function (target) {\n this._target = target;\n },\n\n setZoom: function (zoom) {\n this._zoom = Math.max(Math.min(\n zoom, this.maxZoom\n ), this.minZoom);\n this._needsUpdate = true;\n },\n\n setOffset: function (offset) {\n this._dx = offset[0];\n this._dy = offset[1];\n\n this._needsUpdate = true;\n },\n\n getZoom: function () {\n return this._zoom;\n },\n\n getOffset: function () {\n return [this._dx, this._dy];\n },\n\n _update: function () {\n if (!this._target) {\n return;\n }\n if (!this._needsUpdate) {\n return;\n }\n\n var target = this._target;\n\n var scale = this._zoom;\n\n target.position.x = this._dx;\n target.position.y = this._dy;\n\n target.scale.set(scale, scale, scale);\n\n this.zr.refresh();\n\n this._needsUpdate = false;\n\n this.trigger('update');\n },\n\n _mouseDownHandler: function (e) {\n if (e.target) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY;\n if (this.viewGL && !this.viewGL.containPoint(x, y)) {\n return;\n }\n\n this.zr.on('mousemove', this._mouseMoveHandler);\n this.zr.on('mouseup', this._mouseUpHandler);\n\n var pos = this._convertPos(x, y);\n\n this._x = pos.x;\n this._y = pos.y;\n },\n\n // Convert pos from screen space to viewspace.\n _convertPos: function (x, y) {\n\n var camera = this.viewGL.camera;\n var viewport = this.viewGL.viewport;\n // PENDING\n return {\n x: (x - viewport.x) / viewport.width * (camera.right - camera.left) + camera.left,\n y: (y - viewport.y) / viewport.height * (camera.bottom - camera.top) + camera.top\n };\n },\n\n _mouseMoveHandler: function (e) {\n\n var pos = this._convertPos(e.offsetX, e.offsetY);\n\n this._dx += pos.x - this._x;\n this._dy += pos.y - this._y;\n\n this._x = pos.x;\n this._y = pos.y;\n\n this._needsUpdate = true;\n },\n\n _mouseUpHandler: function (e) {\n this.zr.off('mousemove', this._mouseMoveHandler);\n this.zr.off('mouseup', this._mouseUpHandler);\n },\n\n _mouseWheelHandler: function (e) {\n e = e.event;\n var delta = e.wheelDelta // Webkit\n || -e.detail; // Firefox\n if (delta === 0) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY;\n if (this.viewGL && !this.viewGL.containPoint(x, y)) {\n return;\n }\n\n var zoomScale = delta > 0 ? 1.1 : 0.9;\n var newZoom = Math.max(Math.min(\n this._zoom * zoomScale, this.maxZoom\n ), this.minZoom);\n zoomScale = newZoom / this._zoom;\n\n var pos = this._convertPos(x, y);\n\n var fixX = (pos.x - this._dx) * (zoomScale - 1);\n var fixY = (pos.y - this._dy) * (zoomScale - 1);\n\n this._dx -= fixX;\n this._dy -= fixY;\n\n this._zoom = newZoom;\n\n this._needsUpdate = true;\n },\n\n dispose: function () {\n\n var zr = this.zr;\n zr.off('mousedown', this._mouseDownHandler);\n zr.off('mousemove', this._mouseMoveHandler);\n zr.off('mouseup', this._mouseUpHandler);\n zr.off('mousewheel', this._mouseWheelHandler);\n zr.off('globalout', this._mouseUpHandler);\n\n zr.animation.off('frame', this._update);\n }\n});\n\nexport default Roam2DControl;","export default \"@export ecgl.lines2D.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nattribute vec2 position: POSITION;\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n\\n#ifdef POSITIONTEXTURE_ENABLED\\nuniform sampler2D positionTexture;\\n#endif\\n\\nvoid main()\\n{\\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\\n\\n v_Color = a_Color;\\n}\\n\\n@end\\n\\n@export ecgl.lines2D.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nvarying vec4 v_Color;\\n\\nvoid main()\\n{\\n gl_FragColor = color * v_Color;\\n}\\n@end\\n\\n\\n@export ecgl.meshLines2D.vertex\\n\\nattribute vec2 position: POSITION;\\nattribute vec2 normal;\\nattribute float offset;\\nattribute vec4 a_Color : COLOR;\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform vec4 viewport : VIEWPORT;\\n\\nvarying vec4 v_Color;\\nvarying float v_Miter;\\n\\nvoid main()\\n{\\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\\n\\n p2.xy /= p2.w;\\n gl_Position.xy /= gl_Position.w;\\n\\n vec2 N = normalize(p2.xy - gl_Position.xy);\\n gl_Position.xy += N * offset / viewport.zw * 2.0;\\n\\n gl_Position.xy *= gl_Position.w;\\n\\n v_Color = a_Color;\\n}\\n@end\\n\\n\\n@export ecgl.meshLines2D.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nvarying vec4 v_Color;\\nvarying float v_Miter;\\n\\nvoid main()\\n{\\n gl_FragColor = color * v_Color;\\n}\\n\\n@end\";\n","import * as echarts from 'echarts/lib/echarts';\nimport {getLayoutRect} from 'echarts/lib/util/layout';\nimport graphicGL from '../../util/graphicGL';\nimport ViewGL from '../../core/ViewGL';\nimport Lines2DGeometry from '../../util/geometry/Lines2D';\nimport retrieve from '../../util/retrieve';\nimport ForceAtlas2GPU from './ForceAtlas2GPU';\nimport ForceAtlas2 from './ForceAtlas2';\nimport requestAnimationFrame from 'zrender/lib/animation/requestAnimationFrame';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nvar vec2 = glmatrix.vec2;\n\nimport Roam2DControl from '../../util/Roam2DControl';\n\nimport PointsBuilder from '../common/PointsBuilder';\n\nimport lines2DGLSL from '../../util/shader/lines2D.glsl.js';\ngraphicGL.Shader.import(lines2DGLSL);\n\nvar globalLayoutId = 1;\n\nexport default echarts.ChartView.extend({\n\n type: 'graphGL',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n this.viewGL = new ViewGL('orthographic');\n this.viewGL.camera.left = this.viewGL.camera.right = 0;\n\n this.viewGL.add(this.groupGL);\n\n this._pointsBuilder = new PointsBuilder(true, api);\n\n // Mesh used during force directed layout.\n this._forceEdgesMesh = new graphicGL.Mesh({\n material: new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.forceAtlas2.edges'),\n transparent: true,\n depthMask: false,\n depthTest: false\n }),\n $ignorePicking: true,\n geometry: new graphicGL.Geometry({\n attributes: {\n node: new graphicGL.Geometry.Attribute('node', 'float', 2),\n color: new graphicGL.Geometry.Attribute('color', 'float', 4, 'COLOR')\n },\n dynamic: true,\n mainAttribute: 'node'\n }),\n renderOrder: -1,\n mode: graphicGL.Mesh.LINES\n });\n\n // Mesh used after force directed layout.\n this._edgesMesh = new graphicGL.Mesh({\n material: new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.meshLines2D'),\n transparent: true,\n depthMask: false,\n depthTest: false\n }),\n $ignorePicking: true,\n geometry: new Lines2DGeometry({\n useNativeLine: false,\n dynamic: true\n }),\n renderOrder: -1,\n culling: false\n });\n\n this._layoutId = 0;\n\n this._control = new Roam2DControl({\n zr: api.getZr(),\n viewGL: this.viewGL\n });\n this._control.setTarget(this.groupGL);\n this._control.init();\n\n\n this._clickHandler = this._clickHandler.bind(this);\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.add(this._pointsBuilder.rootNode);\n\n this._model = seriesModel;\n this._api = api;\n\n this._initLayout(seriesModel, ecModel, api);\n\n this._pointsBuilder.update(seriesModel, ecModel, api);\n\n if (!(this._forceLayoutInstance instanceof ForceAtlas2GPU)) {\n this.groupGL.remove(this._forceEdgesMesh);\n }\n\n this._updateCamera(seriesModel, api);\n\n this._control.off('update');\n this._control.on('update', function () {\n api.dispatchAction({\n type: 'graphGLRoam',\n seriesId: seriesModel.id,\n zoom: this._control.getZoom(),\n offset: this._control.getOffset()\n });\n\n this._pointsBuilder.updateView(this.viewGL.camera);\n }, this);\n\n this._control.setZoom(retrieve.firstNotNull(seriesModel.get('zoom'), 1));\n this._control.setOffset(seriesModel.get('offset') || [0, 0]);\n\n var mesh = this._pointsBuilder.getPointsMesh();\n mesh.off('mousemove', this._mousemoveHandler);\n mesh.off('mouseout', this._mouseOutHandler, this);\n api.getZr().off('click', this._clickHandler);\n\n this._pointsBuilder.highlightOnMouseover = true;\n if (seriesModel.get('focusNodeAdjacency')) {\n var focusNodeAdjacencyOn = seriesModel.get('focusNodeAdjacencyOn');\n if (focusNodeAdjacencyOn === 'click') {\n // Remove default emphasis effect\n api.getZr().on('click', this._clickHandler);\n }\n else if (focusNodeAdjacencyOn === 'mouseover') {\n mesh.on('mousemove', this._mousemoveHandler, this);\n mesh.on('mouseout', this._mouseOutHandler, this);\n\n this._pointsBuilder.highlightOnMouseover = false;\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown focusNodeAdjacencyOn value \\s' + focusNodeAdjacencyOn);\n }\n }\n }\n\n // Reset\n this._lastMouseOverDataIndex = -1;\n },\n\n _clickHandler: function (e) {\n if (this._layouting) {\n return;\n }\n var dataIndex = this._pointsBuilder.getPointsMesh().dataIndex;\n if (dataIndex >= 0) {\n this._api.dispatchAction({\n type: 'graphGLFocusNodeAdjacency',\n seriesId: this._model.id,\n dataIndex: dataIndex\n });\n }\n else {\n this._api.dispatchAction({\n type: 'graphGLUnfocusNodeAdjacency',\n seriesId: this._model.id\n });\n }\n },\n\n _mousemoveHandler: function (e) {\n if (this._layouting) {\n return;\n }\n var dataIndex = this._pointsBuilder.getPointsMesh().dataIndex;\n if (dataIndex >= 0) {\n if (dataIndex !== this._lastMouseOverDataIndex) {\n this._api.dispatchAction({\n type: 'graphGLFocusNodeAdjacency',\n seriesId: this._model.id,\n dataIndex: dataIndex\n });\n }\n }\n else {\n this._mouseOutHandler(e);\n }\n\n this._lastMouseOverDataIndex = dataIndex;\n },\n\n _mouseOutHandler: function (e) {\n if (this._layouting) {\n return;\n }\n\n this._api.dispatchAction({\n type: 'graphGLUnfocusNodeAdjacency',\n seriesId: this._model.id\n });\n\n this._lastMouseOverDataIndex = -1;\n },\n\n _updateForceEdgesGeometry: function (edges, seriesModel) {\n var geometry = this._forceEdgesMesh.geometry;\n\n var edgeData = seriesModel.getEdgeData();\n var offset = 0;\n var layoutInstance = this._forceLayoutInstance;\n var vertexCount = edgeData.count() * 2;\n geometry.attributes.node.init(vertexCount);\n geometry.attributes.color.init(vertexCount);\n edgeData.each(function (idx) {\n var edge = edges[idx];\n geometry.attributes.node.set(offset, layoutInstance.getNodeUV(edge.node1));\n geometry.attributes.node.set(offset + 1, layoutInstance.getNodeUV(edge.node2));\n\n var color = getItemVisualColor(edgeData, edge.dataIndex);\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= retrieve.firstNotNull(\n getItemVisualOpacity(edgeData, edge.dataIndex), 1\n );\n geometry.attributes.color.set(offset, colorArr);\n geometry.attributes.color.set(offset + 1, colorArr);\n\n offset += 2;\n });\n geometry.dirty();\n },\n\n _updateMeshLinesGeometry: function () {\n var edgeData = this._model.getEdgeData();\n var geometry = this._edgesMesh.geometry;\n var edgeData = this._model.getEdgeData();\n var points = this._model.getData().getLayout('points');\n\n geometry.resetOffset();\n geometry.setVertexCount(edgeData.count() * geometry.getLineVertexCount());\n geometry.setTriangleCount(edgeData.count() * geometry.getLineTriangleCount());\n\n var p0 = [];\n var p1 = [];\n\n var lineWidthQuery = ['lineStyle', 'width'];\n\n this._originalEdgeColors = new Float32Array(edgeData.count() * 4);\n this._edgeIndicesMap = new Float32Array(edgeData.count());\n edgeData.each(function (idx) {\n var edge = edgeData.graph.getEdgeByIndex(idx);\n var idx1 = edge.node1.dataIndex * 2;\n var idx2 = edge.node2.dataIndex * 2;\n p0[0] = points[idx1];\n p0[1] = points[idx1 + 1];\n p1[0] = points[idx2];\n p1[1] = points[idx2 + 1];\n\n var color = getItemVisualColor(edgeData, edge.dataIndex);\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= retrieve.firstNotNull(getItemVisualOpacity(edgeData, edge.dataIndex), 1);\n var itemModel = edgeData.getItemModel(edge.dataIndex);\n var lineWidth = retrieve.firstNotNull(itemModel.get(lineWidthQuery), 1) * this._api.getDevicePixelRatio();\n\n geometry.addLine(p0, p1, colorArr, lineWidth);\n\n for (var k = 0; k < 4; k++) {\n this._originalEdgeColors[edge.dataIndex * 4 + k] = colorArr[k];\n }\n this._edgeIndicesMap[edge.dataIndex] = idx;\n }, this);\n\n geometry.dirty();\n },\n\n _updateForceNodesGeometry: function (nodeData) {\n var pointsMesh = this._pointsBuilder.getPointsMesh();\n var pos = [];\n for (var i = 0; i < nodeData.count(); i++) {\n this._forceLayoutInstance.getNodeUV(i, pos);\n pointsMesh.geometry.attributes.position.set(i, pos);\n }\n pointsMesh.geometry.dirty('position');\n },\n\n _initLayout: function (seriesModel, ecModel, api) {\n var layout = seriesModel.get('layout');\n var graph = seriesModel.getGraph();\n\n var boxLayoutOption = seriesModel.getBoxLayoutParams();\n var viewport = getLayoutRect(boxLayoutOption, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n\n if (layout === 'force') {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Currently only forceAtlas2 layout supported.');\n }\n layout = 'forceAtlas2';\n }\n // Stop previous layout\n this.stopLayout(seriesModel, ecModel, api, {\n beforeLayout: true\n });\n\n var nodeData = seriesModel.getData();\n var edgeData = seriesModel.getData();\n if (layout === 'forceAtlas2') {\n var layoutModel = seriesModel.getModel('forceAtlas2');\n var layoutInstance = this._forceLayoutInstance;\n var nodes = [];\n var edges = [];\n\n var nodeDataExtent = nodeData.getDataExtent('value');\n var edgeDataExtent = edgeData.getDataExtent('value');\n\n var edgeWeightRange = retrieve.firstNotNull(layoutModel.get('edgeWeight'), 1.0);\n var nodeWeightRange = retrieve.firstNotNull(layoutModel.get('nodeWeight'), 1.0);\n if (typeof edgeWeightRange === 'number') {\n edgeWeightRange = [edgeWeightRange, edgeWeightRange];\n }\n if (typeof nodeWeightRange === 'number') {\n nodeWeightRange = [nodeWeightRange, nodeWeightRange];\n }\n\n var offset = 0;\n var nodesIndicesMap = {};\n\n var layoutPoints = new Float32Array(nodeData.count() * 2);\n graph.eachNode(function (node) {\n var dataIndex = node.dataIndex;\n var value = nodeData.get('value', dataIndex);\n var x;\n var y;\n if (nodeData.hasItemOption) {\n var itemModel = nodeData.getItemModel(dataIndex);\n x = itemModel.get('x');\n y = itemModel.get('y');\n }\n if (x == null) {\n // Random in rectangle\n x = viewport.x + Math.random() * viewport.width;\n y = viewport.y + Math.random() * viewport.height;\n }\n layoutPoints[offset * 2] = x;\n layoutPoints[offset * 2 + 1] = y;\n\n nodesIndicesMap[node.id] = offset++;\n var mass = echarts.number.linearMap(value, nodeDataExtent, nodeWeightRange);\n if (isNaN(mass)) {\n if (!isNaN(nodeWeightRange[0])) {\n mass = nodeWeightRange[0];\n }\n else {\n mass = 1;\n }\n }\n nodes.push({\n x: x, y: y, mass: mass, size: nodeData.getItemVisual(dataIndex, 'symbolSize')\n });\n });\n nodeData.setLayout('points', layoutPoints);\n\n graph.eachEdge(function (edge) {\n var dataIndex = edge.dataIndex;\n var value = nodeData.get('value', dataIndex);\n var weight = echarts.number.linearMap(value, edgeDataExtent, edgeWeightRange);\n if (isNaN(weight)) {\n if (!isNaN(edgeWeightRange[0])) {\n weight = edgeWeightRange[0];\n }\n else {\n weight = 1;\n }\n }\n edges.push({\n node1: nodesIndicesMap[edge.node1.id],\n node2: nodesIndicesMap[edge.node2.id],\n weight: weight,\n dataIndex: dataIndex\n });\n });\n if (!layoutInstance) {\n var isGPU = layoutModel.get('GPU');\n if (this._forceLayoutInstance) {\n if ((isGPU && !(this._forceLayoutInstance instanceof ForceAtlas2GPU))\n || (!isGPU && !(this._forceLayoutInstance instanceof ForceAtlas2))\n ) {\n // Mark to dispose\n this._forceLayoutInstanceToDispose = this._forceLayoutInstance;\n }\n }\n layoutInstance = this._forceLayoutInstance = isGPU\n ? new ForceAtlas2GPU()\n : new ForceAtlas2();\n }\n layoutInstance.initData(nodes, edges);\n layoutInstance.updateOption(layoutModel.option);\n\n // Update lines geometry after first layout;\n this._updateForceEdgesGeometry(layoutInstance.getEdges(), seriesModel);\n this._updatePositionTexture();\n\n api.dispatchAction({\n type: 'graphGLStartLayout',\n from: this.uid\n });\n }\n else {\n var layoutPoints = new Float32Array(nodeData.count() * 2);\n var offset = 0;\n graph.eachNode(function (node) {\n var dataIndex = node.dataIndex;\n var x;\n var y;\n if (nodeData.hasItemOption) {\n var itemModel = nodeData.getItemModel(dataIndex);\n x = itemModel.get('x');\n y = itemModel.get('y');\n }\n layoutPoints[offset++] = x;\n layoutPoints[offset++] = y;\n });\n nodeData.setLayout('points', layoutPoints);\n\n this._updateAfterLayout(seriesModel, ecModel, api);\n }\n },\n\n _updatePositionTexture: function () {\n var positionTex = this._forceLayoutInstance.getNodePositionTexture();\n this._pointsBuilder.setPositionTexture(positionTex);\n this._forceEdgesMesh.material.set('positionTex', positionTex);\n },\n\n startLayout: function (seriesModel, ecModel, api, payload) {\n if (payload && payload.from != null && payload.from !== this.uid) {\n return;\n }\n\n var viewGL = this.viewGL;\n var api = this._api;\n var layoutInstance = this._forceLayoutInstance;\n var data = this._model.getData();\n var layoutModel = this._model.getModel('forceAtlas2');\n\n if (!layoutInstance) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('None layout don\\'t have startLayout action');\n }\n return;\n }\n\n this.groupGL.remove(this._edgesMesh);\n this.groupGL.add(this._forceEdgesMesh);\n\n if (!this._forceLayoutInstance) {\n return;\n }\n\n this._updateForceNodesGeometry(seriesModel.getData());\n this._pointsBuilder.hideLabels();\n\n var self = this;\n var layoutId = this._layoutId = globalLayoutId++;\n var maxSteps = layoutModel.getShallow('maxSteps');\n var steps = layoutModel.getShallow('steps');\n var stepsCount = 0;\n var syncStepCount = Math.max(steps * 2, 20);\n var doLayout = function (layoutId) {\n if (layoutId !== self._layoutId) {\n return;\n }\n if (layoutInstance.isFinished(maxSteps)) {\n api.dispatchAction({\n type: 'graphGLStopLayout',\n from: self.uid\n });\n api.dispatchAction({\n type: 'graphGLFinishLayout',\n points: data.getLayout('points'),\n from: self.uid\n });\n return;\n }\n\n layoutInstance.update(viewGL.layer.renderer, steps, function () {\n self._updatePositionTexture();\n // PENDING Performance.\n stepsCount += steps;\n // Sync posiiton every 20 steps.\n if (stepsCount >= syncStepCount) {\n self._syncNodePosition(seriesModel);\n stepsCount = 0;\n }\n // Position texture will been swapped. set every time.\n api.getZr().refresh();\n\n requestAnimationFrame(function () {\n doLayout(layoutId);\n });\n });\n };\n\n requestAnimationFrame(function () {\n if (self._forceLayoutInstanceToDispose) {\n self._forceLayoutInstanceToDispose.dispose(viewGL.layer.renderer);\n self._forceLayoutInstanceToDispose = null;\n }\n doLayout(layoutId);\n });\n\n this._layouting = true;\n },\n\n stopLayout: function (seriesModel, ecModel, api, payload) {\n if (payload && payload.from != null && payload.from !== this.uid) {\n return;\n }\n\n this._layoutId = 0;\n this.groupGL.remove(this._forceEdgesMesh);\n this.groupGL.add(this._edgesMesh);\n\n if (!this._forceLayoutInstance) {\n return;\n }\n\n if (!this.viewGL.layer) {\n return;\n }\n\n if (!(payload && payload.beforeLayout)) {\n this._syncNodePosition(seriesModel);\n this._updateAfterLayout(seriesModel, ecModel, api);\n }\n\n this._api.getZr().refresh();\n\n this._layouting = false;\n },\n\n _syncNodePosition: function (seriesModel) {\n var points = this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);\n seriesModel.getData().setLayout('points', points);\n\n seriesModel.setNodePosition(points);\n },\n\n _updateAfterLayout: function (seriesModel, ecModel, api) {\n this._updateMeshLinesGeometry();\n\n this._pointsBuilder.removePositionTexture();\n\n this._pointsBuilder.updateLayout(seriesModel, ecModel, api);\n\n this._pointsBuilder.updateView(this.viewGL.camera);\n\n this._pointsBuilder.updateLabels();\n\n this._pointsBuilder.showLabels();\n\n },\n\n focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {\n\n var data = this._model.getData();\n\n this._downplayAll();\n\n var dataIndex = payload.dataIndex;\n\n var graph = data.graph;\n\n var focusNodes = [];\n var node = graph.getNodeByIndex(dataIndex);\n focusNodes.push(node);\n node.edges.forEach(function (edge) {\n if (edge.dataIndex < 0) {\n return;\n }\n edge.node1 !== node && focusNodes.push(edge.node1);\n edge.node2 !== node && focusNodes.push(edge.node2);\n }, this);\n\n this._pointsBuilder.fadeOutAll(0.05);\n this._fadeOutEdgesAll(0.05);\n\n focusNodes.forEach(function (node) {\n this._pointsBuilder.highlight(data, node.dataIndex);\n }, this);\n\n this._pointsBuilder.updateLabels(focusNodes.map(function (node) {\n return node.dataIndex;\n }));\n\n var focusEdges = [];\n node.edges.forEach(function (edge) {\n if (edge.dataIndex >= 0) {\n this._highlightEdge(edge.dataIndex);\n focusEdges.push(edge);\n }\n }, this);\n\n this._focusNodes = focusNodes;\n this._focusEdges = focusEdges;\n },\n\n unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {\n\n this._downplayAll();\n\n this._pointsBuilder.fadeInAll();\n this._fadeInEdgesAll();\n\n this._pointsBuilder.updateLabels();\n },\n\n _highlightEdge: function (dataIndex) {\n var itemModel = this._model.getEdgeData().getItemModel(dataIndex);\n var emphasisColor = graphicGL.parseColor(itemModel.get('emphasis.lineStyle.color') || itemModel.get('lineStyle.color'));\n var emphasisOpacity = retrieve.firstNotNull(itemModel.get('emphasis.lineStyle.opacity'), itemModel.get('lineStyle.opacity'), 1);\n emphasisColor[3] *= emphasisOpacity;\n\n this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[dataIndex], emphasisColor);\n },\n\n _downplayAll: function () {\n if (this._focusNodes) {\n this._focusNodes.forEach(function (node) {\n this._pointsBuilder.downplay(this._model.getData(), node.dataIndex);\n }, this);\n }\n if (this._focusEdges) {\n this._focusEdges.forEach(function (edge) {\n this._downplayEdge(edge.dataIndex);\n }, this);\n }\n },\n\n _downplayEdge: function (dataIndex) {\n var color = this._getColor(dataIndex, []);\n this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[dataIndex], color);\n },\n\n _setEdgeFade: (function () {\n var color = [];\n return function (dataIndex, percent) {\n this._getColor(dataIndex, color);\n color[3] *= percent;\n this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[dataIndex], color);\n };\n })(),\n\n _getColor: function (dataIndex, out) {\n for (var i = 0; i < 4; i++) {\n out[i] = this._originalEdgeColors[dataIndex * 4 + i];\n }\n return out;\n },\n\n _fadeOutEdgesAll: function (percent) {\n var graph = this._model.getData().graph;\n\n graph.eachEdge(function (edge) {\n this._setEdgeFade(edge.dataIndex, percent);\n }, this);\n },\n\n _fadeInEdgesAll: function () {\n this._fadeOutEdgesAll(1);\n },\n\n _updateCamera: function (seriesModel, api) {\n this.viewGL.setViewport(0, 0, api.getWidth(), api.getHeight(), api.getDevicePixelRatio());\n var camera = this.viewGL.camera;\n var nodeData = seriesModel.getData();\n var points = nodeData.getLayout('points');\n var min = vec2.create(Infinity, Infinity);\n var max = vec2.create(-Infinity, -Infinity);\n var pt = [];\n for (var i = 0; i < points.length;) {\n pt[0] = points[i++];\n pt[1] = points[i++];\n vec2.min(min, min, pt);\n vec2.max(max, max, pt);\n }\n var cy = (max[1] + min[1]) / 2;\n var cx = (max[0] + min[0]) / 2;\n // Only fit the camera when graph is not in the center.\n // PENDING\n if (cx > camera.left && cx < camera.right\n && cy < camera.bottom && cy > camera.top\n ) {\n return;\n }\n\n // Scale a bit\n var width = Math.max(max[0] - min[0], 10);\n // Keep aspect\n var height = width / api.getWidth() * api.getHeight();\n width *= 1.4;\n height *= 1.4;\n min[0] -= width * 0.2;\n\n camera.left = min[0];\n camera.top = cy - height / 2;\n camera.bottom = cy + height / 2;\n camera.right = width + min[0];\n camera.near = 0;\n camera.far = 100;\n },\n\n dispose: function () {\n var renderer = this.viewGL.layer.renderer;\n if (this._forceLayoutInstance) {\n this._forceLayoutInstance.dispose(renderer);\n }\n this.groupGL.removeAll();\n\n // Stop layout.\n this._layoutId = -1;\n\n this._pointsBuilder.dispose();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n this._control.dispose();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport * as echarts from 'echarts/lib/echarts';\n\nimport GraphGLSeries from './GraphGLSeries';\nimport GraphGLView from './GraphGLView';\n\nfunction normalize(a) {\n if (!(a instanceof Array)) {\n a = [a, a];\n }\n return a;\n}\nexport function install(registers) {\n\n registers.registerChartView(GraphGLView);\n registers.registerSeriesModel(GraphGLSeries);\n\n registers.registerVisual(function (ecModel) {\n const paletteScope = {};\n ecModel.eachSeriesByType('graphGL', function (seriesModel) {\n var categoriesData = seriesModel.getCategoriesData();\n var data = seriesModel.getData();\n\n var categoryNameIdxMap = {};\n\n categoriesData.each(function (idx) {\n var name = categoriesData.getName(idx);\n // Add prefix to avoid conflict with Object.prototype.\n categoryNameIdxMap['ec-' + name] = idx;\n var itemModel = categoriesData.getItemModel(idx);\n\n var style = itemModel.getModel('itemStyle').getItemStyle();\n if (!style.fill) {\n // Get color from palette.\n style.fill = seriesModel.getColorFromPalette(name, paletteScope);\n }\n categoriesData.setItemVisual(idx, 'style', style);\n\n var symbolVisualList = ['symbol', 'symbolSize', 'symbolKeepAspect'];\n\n for (let i = 0; i < symbolVisualList.length; i++) {\n var symbolVisual = itemModel.getShallow(symbolVisualList[i], true);\n if (symbolVisual != null) {\n categoriesData.setItemVisual(idx, symbolVisualList[i], symbolVisual);\n }\n }\n });\n\n // Assign category color to visual\n if (categoriesData.count()) {\n data.each(function (idx) {\n var model = data.getItemModel(idx);\n let categoryIdx = model.getShallow('category');\n if (categoryIdx != null) {\n if (typeof categoryIdx === 'string') {\n categoryIdx = categoryNameIdxMap['ec-' + categoryIdx];\n }\n\n var categoryStyle = categoriesData.getItemVisual(categoryIdx, 'style');\n var style = data.ensureUniqueItemVisual(idx, 'style');\n echarts.util.extend(style, categoryStyle);\n\n var visualList = ['symbol', 'symbolSize', 'symbolKeepAspect'];\n\n for (let i = 0; i < visualList.length; i++) {\n data.setItemVisual(\n idx, visualList[i],\n categoriesData.getItemVisual(categoryIdx, visualList[i])\n );\n }\n }\n });\n }\n });\n });\n\n registers.registerVisual(function (ecModel) {\n\n ecModel.eachSeriesByType('graphGL', function (seriesModel) {\n var graph = seriesModel.getGraph();\n var edgeData = seriesModel.getEdgeData();\n var symbolType = normalize(seriesModel.get('edgeSymbol'));\n var symbolSize = normalize(seriesModel.get('edgeSymbolSize'));\n\n edgeData.setVisual('drawType', 'stroke');\n\n // var colorQuery = ['lineStyle', 'color'];\n // var opacityQuery = ['lineStyle', 'opacity'];\n\n edgeData.setVisual('fromSymbol', symbolType && symbolType[0]);\n edgeData.setVisual('toSymbol', symbolType && symbolType[1]);\n edgeData.setVisual('fromSymbolSize', symbolSize && symbolSize[0]);\n edgeData.setVisual('toSymbolSize', symbolSize && symbolSize[1]);\n\n edgeData.setVisual('style', seriesModel.getModel('lineStyle').getLineStyle());\n\n edgeData.each(function (idx) {\n var itemModel = edgeData.getItemModel(idx);\n var edge = graph.getEdgeByIndex(idx);\n var symbolType = normalize(itemModel.getShallow('symbol', true));\n var symbolSize = normalize(itemModel.getShallow('symbolSize', true));\n // Edge visual must after node visual\n var style = itemModel.getModel('lineStyle').getLineStyle();\n\n var existsStyle = edgeData.ensureUniqueItemVisual(idx, 'style');\n echarts.util.extend(existsStyle, style);\n\n switch (existsStyle.stroke) {\n case 'source': {\n var nodeStyle = edge.node1.getVisual('style');\n existsStyle.stroke = nodeStyle && nodeStyle.fill;\n break;\n }\n case 'target': {\n var nodeStyle = edge.node2.getVisual('style');\n existsStyle.stroke = nodeStyle && nodeStyle.fill;\n break;\n }\n }\n\n symbolType[0] && edge.setVisual('fromSymbol', symbolType[0]);\n symbolType[1] && edge.setVisual('toSymbol', symbolType[1]);\n symbolSize[0] && edge.setVisual('fromSymbolSize', symbolSize[0]);\n symbolSize[1] && edge.setVisual('toSymbolSize', symbolSize[1]);\n });\n });\n });\n\n registers.registerAction({\n type: 'graphGLRoam',\n event: 'graphglroam',\n update: 'series.graphGL:roam'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n\n function noop() {}\n\n registers.registerAction({\n type: 'graphGLStartLayout',\n event: 'graphgllayoutstarted',\n update: 'series.graphGL:startLayout'\n }, noop);\n\n registers.registerAction({\n type: 'graphGLStopLayout',\n event: 'graphgllayoutstopped',\n update: 'series.graphGL:stopLayout'\n }, noop);\n\n registers.registerAction({\n type: 'graphGLFocusNodeAdjacency',\n event: 'graphGLFocusNodeAdjacency',\n update: 'series.graphGL:focusNodeAdjacency'\n }, noop);\n\n\n registers.registerAction({\n type: 'graphGLUnfocusNodeAdjacency',\n event: 'graphGLUnfocusNodeAdjacency',\n update: 'series.graphGL:unfocusNodeAdjacency'\n }, noop);\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './graphGL/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\n\nexport default echarts.SeriesModel.extend({\n\n type: 'series.flowGL',\n\n dependencies: ['geo', 'grid', 'bmap'],\n\n visualStyleAccessPath: 'itemStyle',\n\n getInitialData: function (option, ecModel) {\n var coordType = this.get('coordinateSystem');\n // TODO hotfix for the bug in echarts that get coord dimensions is undefined.\n var coordSysDimensions = coordType === 'geo' ? ['lng', 'lat']\n : (echarts.getCoordinateSystemDimensions(coordType) || ['x', 'y']);\n if (process.env.NODE_ENV !== 'production') {\n if (coordSysDimensions.length > 2) {\n throw new Error('flowGL can only be used on 2d coordinate systems.');\n }\n }\n coordSysDimensions.push('vx', 'vy');\n var dimensions = echarts.helper.createDimensions(this.getSource(), {\n coordDimensions: coordSysDimensions,\n encodeDefine: this.get('encode'),\n dimensionsDefine: this.get('dimensions')\n });\n var data = new echarts.List(dimensions, this);\n data.initData(this.getSource());\n return data;\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian2d',\n zlevel: 10,\n\n supersampling: 1,\n // 128x128 particles\n particleType: 'point',\n\n particleDensity: 128,\n particleSize: 1,\n particleSpeed: 1,\n\n particleTrail: 2,\n\n colorTexture: null,\n\n gridWidth: 'auto',\n gridHeight: 'auto',\n\n itemStyle: {\n color: '#fff',\n opacity: 0.8\n }\n }\n});","/**\n * Lines geometry\n * Use screen space projected lines lineWidth > MAX_LINE_WIDTH\n * https://mattdesl.svbtle.com/drawing-lines-is-hard\n * @module echarts-gl/util/geometry/LinesGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\n\n/**\n * @constructor\n * @alias module:echarts-gl/chart/flowGL/Line2D\n * @extends clay.Geometry\n */\n\nvar LinesGeometry = Geometry.extend(function () {\n return {\n\n dynamic: true,\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION')\n }\n };\n},\n/** @lends module: echarts-gl/util/geometry/LinesGeometry.prototype */\n{\n\n /**\n * Reset offset\n */\n resetOffset: function () {\n this._vertexOffset = 0;\n this._faceOffset = 0;\n },\n\n /**\n * @param {number} nVertex\n */\n setLineCount: function (nLine) {\n var attributes = this.attributes;\n var nVertex = 4 * nLine;\n var nTriangle = 2 * nLine;\n if (this.vertexCount !== nVertex) {\n attributes.position.init(nVertex);\n }\n if (this.triangleCount !== nTriangle) {\n if (nTriangle === 0) {\n this.indices = null;\n }\n else {\n this.indices = this.vertexCount > 0xffff ? new Uint32Array(nTriangle * 3) : new Uint16Array(nTriangle * 3);\n }\n }\n },\n\n addLine: function (p) {\n var vertexOffset = this._vertexOffset;\n this.attributes.position.set(vertexOffset, [p[0], p[1], 1]);\n this.attributes.position.set(vertexOffset + 1, [p[0], p[1], -1]);\n this.attributes.position.set(vertexOffset + 2, [p[0], p[1], 2]);\n this.attributes.position.set(vertexOffset + 3, [p[0], p[1], -2]);\n\n this.setTriangleIndices(\n this._faceOffset++, [\n vertexOffset, vertexOffset + 1, vertexOffset + 2\n ]\n );\n this.setTriangleIndices(\n this._faceOffset++, [\n vertexOffset + 1, vertexOffset + 2, vertexOffset + 3\n ]\n );\n\n this._vertexOffset += 4;\n }\n});\n\nexport default LinesGeometry;","export default \"@export ecgl.vfParticle.particle.fragment\\n\\nuniform sampler2D particleTexture;\\nuniform sampler2D spawnTexture;\\nuniform sampler2D velocityTexture;\\n\\nuniform float deltaTime;\\nuniform float elapsedTime;\\n\\nuniform float speedScaling : 1.0;\\n\\nuniform vec2 textureSize;\\nuniform vec4 region : [0, 0, 1, 1];\\nuniform float firstFrameTime;\\n\\nvarying vec2 v_Texcoord;\\n\\n\\nvoid main()\\n{\\n vec4 p = texture2D(particleTexture, v_Texcoord);\\n bool spawn = false;\\n if (p.w <= 0.0) {\\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\\n p.w -= firstFrameTime;\\n spawn = true;\\n }\\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\\n v = (v - 0.5) * 2.0;\\n p.z = length(v);\\n p.xy += v * deltaTime / 10.0 * speedScaling;\\n p.w -= deltaTime;\\n\\n if (spawn || p.xy != fract(p.xy)) {\\n p.z = 0.0;\\n }\\n p.xy = fract(p.xy);\\n\\n gl_FragColor = p;\\n}\\n@end\\n\\n@export ecgl.vfParticle.renderPoints.vertex\\n\\n#define PI 3.1415926\\n\\nattribute vec2 texcoord : TEXCOORD_0;\\n\\nuniform sampler2D particleTexture;\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nuniform float size : 1.0;\\n\\nvarying float v_Mag;\\nvarying vec2 v_Uv;\\n\\nvoid main()\\n{\\n vec4 p = texture2D(particleTexture, texcoord);\\n\\n if (p.w > 0.0 && p.z > 1e-5) {\\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\\n }\\n else {\\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\\n }\\n\\n v_Mag = p.z;\\n v_Uv = p.xy;\\n\\n gl_PointSize = size;\\n}\\n\\n@end\\n\\n@export ecgl.vfParticle.renderPoints.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\nuniform sampler2D gradientTexture;\\nuniform sampler2D colorTexture;\\nuniform sampler2D spriteTexture;\\n\\nvarying float v_Mag;\\nvarying vec2 v_Uv;\\n\\nvoid main()\\n{\\n gl_FragColor = color;\\n#ifdef SPRITETEXTURE_ENABLED\\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\\n if (color.a == 0.0) {\\n discard;\\n }\\n#endif\\n#ifdef GRADIENTTEXTURE_ENABLED\\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\\n#endif\\n#ifdef COLORTEXTURE_ENABLED\\n gl_FragColor *= texture2D(colorTexture, v_Uv);\\n#endif\\n}\\n\\n@end\\n\\n@export ecgl.vfParticle.renderLines.vertex\\n\\n#define PI 3.1415926\\n\\nattribute vec3 position : POSITION;\\n\\nuniform sampler2D particleTexture;\\nuniform sampler2D prevParticleTexture;\\n\\nuniform float size : 1.0;\\nuniform vec4 vp: VIEWPORT;\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nvarying float v_Mag;\\nvarying vec2 v_Uv;\\n\\n@import clay.util.rand\\n\\nvoid main()\\n{\\n vec4 p = texture2D(particleTexture, position.xy);\\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\\n\\n p.xy = p.xy * 2.0 - 1.0;\\n p2.xy = p2.xy * 2.0 - 1.0;\\n\\n if (p.w > 0.0 && p.z > 1e-5) {\\n vec2 dir = normalize(p.xy - p2.xy);\\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\\n if (abs(position.z) == 2.0) {\\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\\n v_Uv = p.xy;\\n v_Mag = p.z;\\n }\\n else {\\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\\n v_Mag = p2.z;\\n v_Uv = p2.xy;\\n }\\n gl_Position = worldViewProjection * gl_Position;\\n }\\n else {\\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\\n }\\n}\\n\\n@end\\n\\n@export ecgl.vfParticle.renderLines.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\nuniform sampler2D gradientTexture;\\nuniform sampler2D colorTexture;\\n\\nvarying float v_Mag;\\nvarying vec2 v_Uv;\\n\\nvoid main()\\n{\\n gl_FragColor = color;\\n #ifdef GRADIENTTEXTURE_ENABLED\\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\\n#endif\\n#ifdef COLORTEXTURE_ENABLED\\n gl_FragColor *= texture2D(colorTexture, v_Uv);\\n#endif\\n}\\n\\n@end\\n\";\n","import Pass from 'claygl/src/compositor/Pass';\nimport Geometry from 'claygl/src/Geometry';\nimport Mesh from 'claygl/src/Mesh';\nimport Material from 'claygl/src/Material';\nimport Shader from 'claygl/src/Shader';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport OrthoCamera from 'claygl/src/camera/Orthographic';\nimport PlaneGeometry from 'claygl/src/geometry/Plane';\n\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport Line2DGeometry from './Line2D';\n// import TemporalSS from '../../effect/TemporalSuperSampling';\n\nimport vectorFieldParticleGLSL from './vectorFieldParticle.glsl.js';\n\nShader['import'](vectorFieldParticleGLSL);\n\nfunction createSpriteCanvas(size) {\n var canvas = document.createElement('canvas');\n canvas.width = canvas.height = size;\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = '#fff';\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);\n ctx.fill();\n return canvas;\n}\n\n// import spriteUtil from '../../util/sprite';\n\nvar VectorFieldParticleSurface = function () {\n\n /**\n * @type {number}\n */\n this.motionBlurFactor = 0.99;\n /**\n * Vector field lookup image\n * @type {clay.Texture2D}\n */\n this.vectorFieldTexture = new Texture2D({\n type: Texture.FLOAT,\n // minFilter: Texture.NEAREST,\n // magFilter: Texture.NEAREST,\n flipY: false\n });\n\n /**\n * Particle life range\n * @type {Array.}\n */\n this.particleLife = [5, 20];\n\n this._particleType = 'point';\n\n /**\n * @type {number}\n */\n this._particleSize = 1;\n\n /**\n * @type {Array.}\n */\n this.particleColor = [1, 1, 1, 1];\n\n /**\n * @type {number}\n */\n this.particleSpeedScaling = 1.0;\n\n /**\n * @type {clay.Texture2D}\n */\n this._thisFrameTexture = null;\n\n this._particlePass = null;\n this._spawnTexture = null;\n this._particleTexture0 = null;\n this._particleTexture1 = null;\n\n this._particlePointsMesh = null;\n\n this._surfaceFrameBuffer = null;\n\n this._elapsedTime = 0.0;\n\n this._scene = null;\n this._camera = null;\n\n this._lastFrameTexture = null;\n\n // this._temporalSS = new TemporalSS(50);\n\n // this._antialising = false;\n\n this._supersampling = 1;\n\n this._downsampleTextures = [];\n\n this._width = 512;\n this._height = 512;\n\n this.init();\n};\n\nVectorFieldParticleSurface.prototype = {\n\n constructor: VectorFieldParticleSurface,\n\n init: function () {\n var parameters = {\n type: Texture.FLOAT,\n minFilter: Texture.NEAREST,\n magFilter: Texture.NEAREST,\n useMipmap: false\n };\n this._spawnTexture = new Texture2D(parameters);\n\n this._particleTexture0 = new Texture2D(parameters);\n this._particleTexture1 = new Texture2D(parameters);\n\n this._frameBuffer = new FrameBuffer({\n depthBuffer: false\n });\n this._particlePass = new Pass({\n fragment: Shader.source('ecgl.vfParticle.particle.fragment')\n });\n this._particlePass.setUniform('velocityTexture', this.vectorFieldTexture);\n this._particlePass.setUniform('spawnTexture', this._spawnTexture);\n\n this._downsamplePass = new Pass({\n fragment: Shader.source('clay.compositor.downsample')\n });\n\n var particlePointsMesh = new Mesh({\n // Render after last frame full quad\n renderOrder: 10,\n material: new Material({\n shader: new Shader(\n Shader.source('ecgl.vfParticle.renderPoints.vertex'),\n Shader.source('ecgl.vfParticle.renderPoints.fragment')\n )\n }),\n mode: Mesh.POINTS,\n geometry: new Geometry({\n dynamic: true,\n mainAttribute: 'texcoord0'\n })\n });\n var particleLinesMesh = new Mesh({\n // Render after last frame full quad\n renderOrder: 10,\n material: new Material({\n shader: new Shader(\n Shader.source('ecgl.vfParticle.renderLines.vertex'),\n Shader.source('ecgl.vfParticle.renderLines.fragment')\n )\n }),\n geometry: new Line2DGeometry(),\n culling: false\n });\n var lastFrameFullQuad = new Mesh({\n material: new Material({\n shader: new Shader(\n Shader.source('ecgl.color.vertex'),\n Shader.source('ecgl.color.fragment')\n )\n // DO NOT BLEND Blend will multiply alpha\n // transparent: true\n }),\n geometry: new PlaneGeometry()\n });\n lastFrameFullQuad.material.enableTexture('diffuseMap');\n\n this._particlePointsMesh = particlePointsMesh;\n this._particleLinesMesh = particleLinesMesh;\n this._lastFrameFullQuadMesh = lastFrameFullQuad;\n\n this._camera = new OrthoCamera();\n this._thisFrameTexture = new Texture2D();\n this._lastFrameTexture = new Texture2D();\n },\n\n setParticleDensity: function (width, height) {\n var nVertex = width * height;\n\n var spawnTextureData = new Float32Array(nVertex * 4);\n var off = 0;\n var lifeRange = this.particleLife;\n for (var i = 0; i < width; i++) {\n for (var j = 0; j < height; j++, off++) {\n // x position, range [0 - 1]\n spawnTextureData[off * 4] = Math.random();\n // y position, range [0 - 1]\n spawnTextureData[off * 4 + 1] = Math.random();\n // Some property\n spawnTextureData[off * 4 + 2] = Math.random();\n var life = (lifeRange[1] - lifeRange[0]) * Math.random() + lifeRange[0];\n // Particle life\n spawnTextureData[off * 4 + 3] = life;\n }\n }\n\n if (this._particleType === 'line') {\n this._setLineGeometry(width, height);\n }\n else {\n this._setPointsGeometry(width, height);\n }\n\n this._spawnTexture.width = width;\n this._spawnTexture.height = height;\n this._spawnTexture.pixels = spawnTextureData;\n\n this._particleTexture0.width = this._particleTexture1.width = width;\n this._particleTexture0.height = this._particleTexture1.height = height;\n\n this._particlePass.setUniform('textureSize', [width, height]);\n },\n\n _setPointsGeometry: function (width, height) {\n var nVertex = width * height;\n var geometry = this._particlePointsMesh.geometry;\n var attributes = geometry.attributes;\n attributes.texcoord0.init(nVertex);\n\n var off = 0;\n for (var i = 0; i < width; i++) {\n for (var j = 0; j < height; j++, off++) {\n attributes.texcoord0.value[off * 2] = i / width;\n attributes.texcoord0.value[off * 2 + 1] = j / height;\n }\n }\n geometry.dirty();\n },\n\n _setLineGeometry: function (width, height) {\n var nLine = width * height;\n var geometry = this._getParticleMesh().geometry;\n geometry.setLineCount(nLine);\n geometry.resetOffset();\n for (var i = 0; i < width; i++) {\n for (var j = 0; j < height; j++) {\n geometry.addLine([i / width, j / height]);\n }\n }\n geometry.dirty();\n },\n\n _getParticleMesh: function () {\n return this._particleType === 'line' ? this._particleLinesMesh : this._particlePointsMesh;\n },\n\n update: function (renderer, api, deltaTime, firstFrame) {\n var particleMesh = this._getParticleMesh();\n var frameBuffer = this._frameBuffer;\n var particlePass = this._particlePass;\n\n if (firstFrame) {\n this._updateDownsampleTextures(renderer, api);\n }\n\n particleMesh.material.set('size', this._particleSize * this._supersampling);\n particleMesh.material.set('color', this.particleColor);\n particlePass.setUniform('speedScaling', this.particleSpeedScaling);\n\n frameBuffer.attach(this._particleTexture1);\n particlePass.setUniform('firstFrameTime', firstFrame ? (this.particleLife[1] + this.particleLife[0]) / 2 : 0);\n particlePass.setUniform('particleTexture', this._particleTexture0);\n particlePass.setUniform('deltaTime', deltaTime);\n particlePass.setUniform('elapsedTime', this._elapsedTime);\n particlePass.render(renderer, frameBuffer);\n\n particleMesh.material.set('particleTexture', this._particleTexture1);\n particleMesh.material.set('prevParticleTexture', this._particleTexture0);\n\n frameBuffer.attach(this._thisFrameTexture);\n frameBuffer.bind(renderer);\n renderer.gl.clear(renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT);\n var lastFrameFullQuad = this._lastFrameFullQuadMesh;\n lastFrameFullQuad.material.set('diffuseMap', this._lastFrameTexture);\n lastFrameFullQuad.material.set('color', [1, 1, 1, this.motionBlurFactor]);\n\n this._camera.update(true);\n renderer.renderPass([lastFrameFullQuad, particleMesh], this._camera);\n frameBuffer.unbind(renderer);\n\n this._downsample(renderer);\n\n this._swapTexture();\n\n this._elapsedTime += deltaTime;\n },\n\n _downsample: function (renderer) {\n var downsampleTextures = this._downsampleTextures;\n if (downsampleTextures.length === 0) {\n return;\n }\n var current = 0;\n var sourceTexture = this._thisFrameTexture;\n var targetTexture = downsampleTextures[current];\n\n while (targetTexture) {\n this._frameBuffer.attach(targetTexture);\n this._downsamplePass.setUniform('texture', sourceTexture);\n this._downsamplePass.setUniform('textureSize', [sourceTexture.width, sourceTexture.height]);\n this._downsamplePass.render(renderer, this._frameBuffer);\n\n sourceTexture = targetTexture;\n targetTexture = downsampleTextures[++current];\n }\n },\n\n getSurfaceTexture: function () {\n var downsampleTextures = this._downsampleTextures;\n return downsampleTextures.length > 0\n ? downsampleTextures[downsampleTextures.length - 1]\n : this._lastFrameTexture;\n },\n\n setRegion: function (region) {\n this._particlePass.setUniform('region', region);\n },\n\n resize: function (width, height) {\n this._lastFrameTexture.width = width * this._supersampling;\n this._lastFrameTexture.height = height * this._supersampling;\n this._thisFrameTexture.width = width * this._supersampling;\n this._thisFrameTexture.height = height * this._supersampling;\n\n this._width = width;\n this._height = height;\n },\n\n setParticleSize: function (size) {\n var particleMesh = this._getParticleMesh();\n if (size <= 2) {\n particleMesh.material.disableTexture('spriteTexture');\n particleMesh.material.transparent = false;\n return;\n }\n if (!this._spriteTexture) {\n this._spriteTexture = new Texture2D();\n }\n if (!this._spriteTexture.image || this._spriteTexture.image.width !== size) {\n this._spriteTexture.image = createSpriteCanvas(size);\n this._spriteTexture.dirty();\n }\n particleMesh.material.transparent = true;\n particleMesh.material.enableTexture('spriteTexture');\n particleMesh.material.set('spriteTexture', this._spriteTexture);\n\n this._particleSize = size;\n },\n\n setGradientTexture: function (gradientTexture) {\n var material = this._getParticleMesh().material;\n material[gradientTexture ? 'enableTexture' : 'disableTexture']('gradientTexture');\n material.setUniform('gradientTexture', gradientTexture);\n },\n\n setColorTextureImage: function (colorTextureImg, api) {\n var material = this._getParticleMesh().material;\n material.setTextureImage('colorTexture', colorTextureImg, api, {\n flipY: true\n });\n },\n\n setParticleType: function (type) {\n this._particleType = type;\n },\n\n clearFrame: function (renderer) {\n var frameBuffer = this._frameBuffer;\n frameBuffer.attach(this._lastFrameTexture);\n frameBuffer.bind(renderer);\n renderer.gl.clear(renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT);\n frameBuffer.unbind(renderer);\n },\n\n setSupersampling: function (supersampling) {\n this._supersampling = supersampling;\n this.resize(this._width, this._height);\n },\n\n _updateDownsampleTextures: function (renderer, api) {\n var downsampleTextures = this._downsampleTextures;\n var upScale = Math.max(Math.floor(Math.log(this._supersampling / api.getDevicePixelRatio()) / Math.log(2)), 0);\n var scale = 2;\n var width = this._width * this._supersampling;\n var height = this._height * this._supersampling;\n for (var i = 0; i < upScale; i++) {\n downsampleTextures[i] = downsampleTextures[i] || new Texture2D();\n downsampleTextures[i].width = width / scale;\n downsampleTextures[i].height = height / scale;\n scale *= 2;\n }\n for (;i < downsampleTextures.length; i++) {\n downsampleTextures[i].dispose(renderer);\n }\n downsampleTextures.length = upScale;\n },\n\n _swapTexture: function () {\n var tmp = this._particleTexture0;\n this._particleTexture0 = this._particleTexture1;\n this._particleTexture1 = tmp;\n\n var tmp = this._thisFrameTexture;\n this._thisFrameTexture = this._lastFrameTexture;\n this._lastFrameTexture = tmp;\n },\n\n dispose: function (renderer) {\n renderer.disposeFrameBuffer(this._frameBuffer);\n // Dispose textures\n renderer.disposeTexture(this.vectorFieldTexture);\n renderer.disposeTexture(this._spawnTexture);\n renderer.disposeTexture(this._particleTexture0);\n renderer.disposeTexture(this._particleTexture1);\n renderer.disposeTexture(this._thisFrameTexture);\n renderer.disposeTexture(this._lastFrameTexture);\n\n renderer.disposeGeometry(this._particleLinesMesh.geometry);\n renderer.disposeGeometry(this._particlePointsMesh.geometry);\n renderer.disposeGeometry(this._lastFrameFullQuadMesh.geometry);\n\n if (this._spriteTexture) {\n renderer.disposeTexture(this._spriteTexture);\n }\n\n this._particlePass.dispose(renderer);\n this._downsamplePass.dispose(renderer);\n\n this._downsampleTextures.forEach(function (texture) {\n texture.dispose(renderer);\n });\n }\n};\n\nexport default VectorFieldParticleSurface;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport ViewGL from '../../core/ViewGL';\n\nimport VectorFieldParticleSurface from './VectorFieldParticleSurface';\n\n\n// TODO 百度地图不是 linear 的\nexport default echarts.ChartView.extend({\n\n type: 'flowGL',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this.viewGL = new ViewGL('orthographic');\n this.groupGL = new graphicGL.Node();\n this.viewGL.add(this.groupGL);\n\n this._particleSurface = new VectorFieldParticleSurface();\n\n var planeMesh = new graphicGL.Mesh({\n geometry: new graphicGL.PlaneGeometry(),\n material: new graphicGL.Material({\n shader: new graphicGL.Shader({\n vertex: graphicGL.Shader.source('ecgl.color.vertex'),\n fragment: graphicGL.Shader.source('ecgl.color.fragment')\n }),\n // Must enable blending and multiply alpha.\n // Or premultipliedAlpha will let the alpha useless.\n transparent: true\n })\n });\n planeMesh.material.enableTexture('diffuseMap');\n\n this.groupGL.add(planeMesh);\n\n this._planeMesh = planeMesh;\n\n },\n\n render: function (seriesModel, ecModel, api) {\n var particleSurface = this._particleSurface;\n // Set particleType before set others.\n particleSurface.setParticleType(seriesModel.get('particleType'));\n particleSurface.setSupersampling(seriesModel.get('supersampling'));\n\n this._updateData(seriesModel, api);\n this._updateCamera(api.getWidth(), api.getHeight(), api.getDevicePixelRatio());\n\n var particleDensity = retrieve.firstNotNull(seriesModel.get('particleDensity'), 128);\n particleSurface.setParticleDensity(particleDensity, particleDensity);\n\n var planeMesh = this._planeMesh;\n\n var time = +(new Date());\n var self = this;\n var firstFrame = true;\n planeMesh.__percent = 0;\n planeMesh.stopAnimation();\n planeMesh.animate('', { loop: true })\n .when(100000, {\n __percent: 1\n })\n .during(function () {\n var timeNow = + (new Date());\n var dTime = Math.min(timeNow - time, 20);\n time = time + dTime;\n if (self._renderer) {\n particleSurface.update(self._renderer, api, dTime / 1000, firstFrame);\n planeMesh.material.set('diffuseMap', particleSurface.getSurfaceTexture());\n // planeMesh.material.set('diffuseMap', self._particleSurface.vectorFieldTexture);\n }\n firstFrame = false;\n })\n .start();\n\n var itemStyleModel = seriesModel.getModel('itemStyle');\n var color = graphicGL.parseColor(itemStyleModel.get('color'));\n color[3] *= retrieve.firstNotNull(itemStyleModel.get('opacity'), 1);\n planeMesh.material.set('color', color);\n\n particleSurface.setColorTextureImage(seriesModel.get('colorTexture'), api);\n particleSurface.setParticleSize(seriesModel.get('particleSize'));\n particleSurface.particleSpeedScaling = seriesModel.get('particleSpeed');\n particleSurface.motionBlurFactor = 1.0 - Math.pow(0.1, seriesModel.get('particleTrail'));\n },\n\n updateTransform: function (seriesModel, ecModel, api) {\n this._updateData(seriesModel, api);\n },\n\n afterRender: function (globeModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n this._renderer = renderer;\n },\n\n _updateData: function (seriesModel, api) {\n var coordSys = seriesModel.coordinateSystem;\n var dims = coordSys.dimensions.map(function (coordDim) {\n return seriesModel.coordDimToDataDim(coordDim)[0];\n });\n\n var data = seriesModel.getData();\n var xExtent = data.getDataExtent(dims[0]);\n var yExtent = data.getDataExtent(dims[1]);\n\n var gridWidth = seriesModel.get('gridWidth');\n var gridHeight = seriesModel.get('gridHeight');\n\n if (gridWidth == null || gridWidth === 'auto') {\n // TODO not accurate.\n var aspect = (xExtent[1] - xExtent[0]) / (yExtent[1] - yExtent[0]);\n gridWidth = Math.round(Math.sqrt(aspect * data.count()));\n }\n if (gridHeight == null || gridHeight === 'auto') {\n gridHeight = Math.ceil(data.count() / gridWidth);\n }\n\n var vectorFieldTexture = this._particleSurface.vectorFieldTexture;\n\n // Half Float needs Uint16Array\n var pixels = vectorFieldTexture.pixels;\n if (!pixels || pixels.length !== gridHeight * gridWidth * 4) {\n pixels = vectorFieldTexture.pixels = new Float32Array(gridWidth * gridHeight * 4);\n }\n else {\n for (var i = 0; i < pixels.length; i++) {\n pixels[i] = 0;\n }\n }\n\n var maxMag = 0;\n var minMag = Infinity;\n\n var points = new Float32Array(data.count() * 2);\n var offset = 0;\n var bbox = [[Infinity, Infinity], [-Infinity, -Infinity]];\n\n data.each([dims[0], dims[1], 'vx', 'vy'], function (x, y, vx, vy) {\n var pt = coordSys.dataToPoint([x, y]);\n points[offset++] = pt[0];\n points[offset++] = pt[1];\n bbox[0][0] = Math.min(pt[0], bbox[0][0]);\n bbox[0][1] = Math.min(pt[1], bbox[0][1]);\n bbox[1][0] = Math.max(pt[0], bbox[1][0]);\n bbox[1][1] = Math.max(pt[1], bbox[1][1]);\n\n var mag = Math.sqrt(vx * vx + vy * vy);\n maxMag = Math.max(maxMag, mag);\n minMag = Math.min(minMag, mag);\n });\n\n data.each(['vx', 'vy'], function (vx, vy, i) {\n var xPix = Math.round((points[i * 2] - bbox[0][0]) / (bbox[1][0] - bbox[0][0]) * (gridWidth - 1));\n var yPix = gridHeight - 1 - Math.round((points[i * 2 + 1] - bbox[0][1]) / (bbox[1][1] - bbox[0][1]) * (gridHeight - 1));\n\n var idx = (yPix * gridWidth + xPix) * 4;\n\n pixels[idx] = (vx / maxMag * 0.5 + 0.5);\n pixels[idx + 1] = (vy / maxMag * 0.5 + 0.5);\n pixels[idx + 3] = 1;\n });\n\n vectorFieldTexture.width = gridWidth;\n vectorFieldTexture.height = gridHeight;\n\n if (seriesModel.get('coordinateSystem') === 'bmap') {\n this._fillEmptyPixels(vectorFieldTexture);\n }\n\n vectorFieldTexture.dirty();\n\n this._updatePlanePosition(bbox[0], bbox[1], seriesModel,api);\n this._updateGradientTexture(data.getVisual('visualMeta'), [minMag, maxMag]);\n\n },\n // PENDING Use grid mesh ? or delaunay triangulation?\n _fillEmptyPixels: function (texture) {\n var pixels = texture.pixels;\n var width = texture.width;\n var height = texture.height;\n\n function fetchPixel(x, y, rg) {\n x = Math.max(Math.min(x, width - 1), 0);\n y = Math.max(Math.min(y, height - 1), 0);\n var idx = (y * (width - 1) + x) * 4;\n if (pixels[idx + 3] === 0) {\n return false;\n }\n rg[0] = pixels[idx];\n rg[1] = pixels[idx + 1];\n return true;\n }\n\n function addPixel(a, b, out) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n }\n\n var center = [], left = [], right = [], top = [], bottom = [];\n var weight = 0;\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width; x++) {\n var idx = (y * (width - 1) + x) * 4;\n if (pixels[idx + 3] === 0) {\n weight = center[0] = center[1] = 0;\n if (fetchPixel(x - 1, y, left)) {\n weight++; addPixel(left, center, center);\n }\n if (fetchPixel(x + 1, y, right)) {\n weight++; addPixel(right, center, center);\n }\n if (fetchPixel(x, y - 1, top)) {\n weight++; addPixel(top, center, center);\n }\n if (fetchPixel(x, y + 1, bottom)) {\n weight++; addPixel(bottom, center, center);\n }\n center[0] /= weight;\n center[1] /= weight;\n // PENDING If overwrite. bilinear interpolation.\n pixels[idx] = center[0];\n pixels[idx + 1] = center[1];\n }\n pixels[idx + 3] = 1;\n }\n }\n },\n\n _updateGradientTexture: function (visualMeta, magExtent) {\n if (!visualMeta || !visualMeta.length) {\n this._particleSurface.setGradientTexture(null);\n return;\n }\n // TODO Different dimensions\n this._gradientTexture = this._gradientTexture || new graphicGL.Texture2D({\n image: document.createElement('canvas')\n });\n var gradientTexture = this._gradientTexture;\n var canvas = gradientTexture.image;\n canvas.width = 200;\n canvas.height = 1;\n var ctx = canvas.getContext('2d');\n var gradient = ctx.createLinearGradient(0, 0.5, canvas.width, 0.5);\n visualMeta[0].stops.forEach(function (stop) {\n var offset;\n if (magExtent[1] === magExtent[0]) {\n offset = 0;\n }\n else {\n offset = stop.value / magExtent[1];\n offset = Math.min(Math.max(offset, 0), 1);\n }\n\n gradient.addColorStop(offset, stop.color);\n });\n ctx.fillStyle = gradient;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n gradientTexture.dirty();\n\n this._particleSurface.setGradientTexture(this._gradientTexture);\n },\n\n _updatePlanePosition: function (leftTop, rightBottom, seriesModel, api) {\n var limitedResult = this._limitInViewportAndFullFill(leftTop, rightBottom, seriesModel, api);\n leftTop = limitedResult.leftTop;\n rightBottom = limitedResult.rightBottom;\n this._particleSurface.setRegion(limitedResult.region);\n\n this._planeMesh.position.set(\n (leftTop[0] + rightBottom[0]) / 2,\n api.getHeight() - (leftTop[1] + rightBottom[1]) / 2,\n 0\n );\n\n var width = rightBottom[0] - leftTop[0];\n var height = rightBottom[1] - leftTop[1];\n this._planeMesh.scale.set(width / 2, height / 2, 1);\n\n this._particleSurface.resize(\n Math.max(Math.min(width, 2048), 1),\n Math.max(Math.min(height, 2048), 1)\n );\n\n if (this._renderer) {\n this._particleSurface.clearFrame(this._renderer);\n }\n },\n\n _limitInViewportAndFullFill: function (leftTop, rightBottom, seriesModel, api) {\n var newLeftTop = [\n Math.max(leftTop[0], 0),\n Math.max(leftTop[1], 0)\n ];\n var newRightBottom = [\n Math.min(rightBottom[0], api.getWidth()),\n Math.min(rightBottom[1], api.getHeight())\n ];\n // Tiliing in lng orientation.\n if (seriesModel.get('coordinateSystem') === 'bmap') {\n var lngRange = seriesModel.getData().getDataExtent(seriesModel.coordDimToDataDim('lng')[0]);\n // PENDING, consider grid density\n var isContinuous = Math.floor(lngRange[1] - lngRange[0]) >= 359;\n if (isContinuous) {\n if (newLeftTop[0] > 0) {\n newLeftTop[0] = 0;\n }\n if (newRightBottom[0] < api.getWidth()) {\n newRightBottom[0] = api.getWidth();\n }\n }\n }\n\n var width = rightBottom[0] - leftTop[0];\n var height = rightBottom[1] - leftTop[1];\n var newWidth = newRightBottom[0] - newLeftTop[0];\n var newHeight = newRightBottom[1] - newLeftTop[1];\n\n var region = [\n (newLeftTop[0] - leftTop[0]) / width,\n 1.0 - newHeight / height - (newLeftTop[1] - leftTop[1]) / height,\n newWidth / width,\n newHeight / height\n ];\n\n return {\n leftTop: newLeftTop,\n rightBottom: newRightBottom,\n region: region\n };\n },\n\n _updateCamera: function (width, height, dpr) {\n this.viewGL.setViewport(0, 0, width, height, dpr);\n var camera = this.viewGL.camera;\n // FIXME bottom can't be larger than top\n camera.left = camera.bottom = 0;\n camera.top = height;\n camera.right = width;\n camera.near = 0;\n camera.far = 100;\n camera.position.z = 10;\n },\n\n remove: function () {\n this._planeMesh.stopAnimation();\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n if (this._renderer) {\n this._particleSurface.dispose(this._renderer);\n }\n this.groupGL.removeAll();\n }\n});\n","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport FlowGLSeries from './FlowGLSeries';\nimport FlowGLView from './FlowGLView';\n\nexport function install(registers) {\n registers.registerChartView(FlowGLView);\n registers.registerSeriesModel(FlowGLSeries);\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './flowGL/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport { concatArray } from 'zrender/lib/core/util';\n\nvar LinesGLSeries = echarts.SeriesModel.extend({\n\n type: 'series.linesGL',\n\n dependencies: ['grid', 'geo'],\n\n visualStyleAccessPath: 'lineStyle',\n visualDrawType: 'stroke',\n\n streamEnabled: true,\n\n init: function (option) {\n var result = this._processFlatCoordsArray(option.data);\n this._flatCoords = result.flatCoords;\n this._flatCoordsOffset = result.flatCoordsOffset;\n if (result.flatCoords) {\n option.data = new Float32Array(result.count);\n }\n\n LinesGLSeries.superApply(this, 'init', arguments);\n },\n\n mergeOption: function (option) {\n var result = this._processFlatCoordsArray(option.data);\n this._flatCoords = result.flatCoords;\n this._flatCoordsOffset = result.flatCoordsOffset;\n if (result.flatCoords) {\n option.data = new Float32Array(result.count);\n }\n\n LinesGLSeries.superApply(this, 'mergeOption', arguments);\n },\n\n appendData: function (params) {\n var result = this._processFlatCoordsArray(params.data);\n if (result.flatCoords) {\n if (!this._flatCoords) {\n this._flatCoords = result.flatCoords;\n this._flatCoordsOffset = result.flatCoordsOffset;\n }\n else {\n this._flatCoords = concatArray(this._flatCoords, result.flatCoords);\n this._flatCoordsOffset = concatArray(this._flatCoordsOffset, result.flatCoordsOffset);\n }\n params.data = new Float32Array(result.count);\n }\n\n this.getRawData().appendData(params.data);\n },\n\n _getCoordsFromItemModel: function (idx) {\n var itemModel = this.getData().getItemModel(idx);\n var coords = (itemModel.option instanceof Array)\n ? itemModel.option : itemModel.getShallow('coords');\n\n if (process.env.NODE_ENV !== 'production') {\n if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) {\n throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.');\n }\n }\n return coords;\n },\n\n getLineCoordsCount: function (idx) {\n if (this._flatCoordsOffset) {\n return this._flatCoordsOffset[idx * 2 + 1];\n }\n else {\n return this._getCoordsFromItemModel(idx).length;\n }\n },\n\n getLineCoords: function (idx, out) {\n if (this._flatCoordsOffset) {\n var offset = this._flatCoordsOffset[idx * 2];\n var len = this._flatCoordsOffset[idx * 2 + 1];\n for (var i = 0; i < len; i++) {\n out[i] = out[i] || [];\n out[i][0] = this._flatCoords[offset + i * 2];\n out[i][1] = this._flatCoords[offset + i * 2 + 1];\n }\n return len;\n }\n else {\n var coords = this._getCoordsFromItemModel(idx);\n for (var i = 0; i < coords.length; i++) {\n out[i] = out[i] || [];\n out[i][0] = coords[i][0];\n out[i][1] = coords[i][1];\n }\n return coords.length;\n }\n },\n\n _processFlatCoordsArray: function (data) {\n var startOffset = 0;\n if (this._flatCoords) {\n startOffset = this._flatCoords.length;\n }\n // Stored as a typed array. In format\n // Points Count(2) | x | y | x | y | Points Count(3) | x | y | x | y | x | y |\n if (typeof data[0] === 'number') {\n var len = data.length;\n // Store offset and len of each segment\n var coordsOffsetAndLenStorage = new Uint32Array(len);\n var coordsStorage = new Float64Array(len);\n var coordsCursor = 0;\n var offsetCursor = 0;\n var dataCount = 0;\n for (var i = 0; i < len;) {\n dataCount++;\n var count = data[i++];\n // Offset\n coordsOffsetAndLenStorage[offsetCursor++] = coordsCursor + startOffset;\n // Len\n coordsOffsetAndLenStorage[offsetCursor++] = count;\n for (var k = 0; k < count; k++) {\n var x = data[i++];\n var y = data[i++];\n coordsStorage[coordsCursor++] = x;\n coordsStorage[coordsCursor++] = y;\n\n if (i > len) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invalid data format.');\n }\n }\n }\n }\n\n return {\n flatCoordsOffset: new Uint32Array(coordsOffsetAndLenStorage.buffer, 0, offsetCursor),\n flatCoords: coordsStorage,\n count: dataCount\n };\n }\n\n return {\n flatCoordsOffset: null,\n flatCoords: null,\n count: data.length\n };\n },\n\n getInitialData: function (option, ecModel) {\n var lineData = new echarts.List(['value'], this);\n lineData.hasItemOption = false;\n\n lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {\n // dataItem is simply coords\n if (dataItem instanceof Array) {\n return NaN;\n }\n else {\n lineData.hasItemOption = true;\n var value = dataItem.value;\n if (value != null) {\n return value instanceof Array ? value[dimIndex] : value;\n }\n }\n });\n\n return lineData;\n },\n\n defaultOption: {\n coordinateSystem: 'geo',\n zlevel: 10,\n\n progressive: 1e4,\n progressiveThreshold: 5e4,\n\n // Cartesian coordinate system\n // xAxisIndex: 0,\n // yAxisIndex: 0,\n\n // Geo coordinate system\n // geoIndex: 0,\n\n // Support source-over, lighter\n blendMode: 'source-over',\n\n lineStyle: {\n opacity: 0.8\n },\n\n postEffect: {\n enable: false,\n colorCorrection: {\n exposure: 0,\n brightness: 0,\n contrast: 1,\n saturation: 1,\n enable: true\n }\n }\n }\n});\n\nexport default LinesGLSeries;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport ViewGL from '../../core/ViewGL';\nimport Lines2DGeometry from '../../util/geometry/Lines2D';\nimport GLViewHelper from '../common/GLViewHelper';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nimport retrieve from '../../util/retrieve';\n\nexport default echarts.ChartView.extend({\n\n type: 'linesGL',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this.groupGL = new graphicGL.Node();\n this.viewGL = new ViewGL('orthographic');\n this.viewGL.add(this.groupGL);\n\n this._glViewHelper = new GLViewHelper(this.viewGL);\n\n this._nativeLinesShader = graphicGL.createShader('ecgl.lines3D');\n this._meshLinesShader = graphicGL.createShader('ecgl.meshLines3D');\n\n this._linesMeshes = [];\n this._currentStep = 0;\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n this._glViewHelper.reset(seriesModel, api);\n\n var linesMesh = this._linesMeshes[0];\n if (!linesMesh) {\n linesMesh = this._linesMeshes[0] = this._createLinesMesh(seriesModel);\n }\n this._linesMeshes.length = 1;\n\n this.groupGL.add(linesMesh);\n this._updateLinesMesh(seriesModel, linesMesh, 0, seriesModel.getData().count());\n\n this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api);\n },\n\n incrementalPrepareRender: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n this._glViewHelper.reset(seriesModel, api);\n\n this._currentStep = 0;\n\n this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api);\n },\n\n incrementalRender: function (params, seriesModel, ecModel, api) {\n var linesMesh = this._linesMeshes[this._currentStep];\n if (!linesMesh) {\n linesMesh = this._createLinesMesh(seriesModel);\n this._linesMeshes[this._currentStep] = linesMesh;\n }\n this._updateLinesMesh(seriesModel, linesMesh, params.start, params.end);\n this.groupGL.add(linesMesh);\n api.getZr().refresh();\n\n this._currentStep++;\n },\n\n updateTransform: function (seriesModel, ecModel, api) {\n if (seriesModel.coordinateSystem.getRoamTransform) {\n this._glViewHelper.updateTransform(seriesModel, api);\n }\n },\n\n _createLinesMesh: function (seriesModel) {\n var linesMesh = new graphicGL.Mesh({\n $ignorePicking: true,\n material: new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.lines3D'),\n transparent: true,\n depthMask: false,\n depthTest: false\n }),\n geometry: new Lines2DGeometry({\n segmentScale: 10,\n useNativeLine: true,\n dynamic: false\n }),\n mode: graphicGL.Mesh.LINES,\n culling: false\n });\n\n return linesMesh;\n },\n\n _updateLinesMesh: function (seriesModel, linesMesh, start, end) {\n var data = seriesModel.getData();\n linesMesh.material.blend = seriesModel.get('blendMode') === 'lighter'\n ? graphicGL.additiveBlend : null;\n var curveness = seriesModel.get('lineStyle.curveness') || 0;\n var isPolyline = seriesModel.get('polyline');\n var geometry = linesMesh.geometry;\n var coordSys = seriesModel.coordinateSystem;\n\n var lineWidth = retrieve.firstNotNull(seriesModel.get('lineStyle.width'), 1);\n\n if (lineWidth > 1) {\n if (linesMesh.material.shader !== this._meshLinesShader) {\n linesMesh.material.attachShader(this._meshLinesShader);\n }\n linesMesh.mode = graphicGL.Mesh.TRIANGLES;\n }\n else {\n if (linesMesh.material.shader !== this._nativeLinesShader) {\n linesMesh.material.attachShader(this._nativeLinesShader);\n }\n linesMesh.mode = graphicGL.Mesh.LINES;\n }\n\n start = start || 0;\n end = end || data.count();\n\n geometry.resetOffset();\n var vertexCount = 0;\n var triangleCount = 0;\n var p0 = [];\n var p1 = [];\n var p2 = [];\n var p3 = [];\n\n var lineCoords = [];\n\n var t = 0.3;\n var t2 = 0.7;\n\n function updateBezierControlPoints() {\n p1[0] = (p0[0] * t2 + p3[0] * t) - (p0[1] - p3[1]) * curveness;\n p1[1] = (p0[1] * t2 + p3[1] * t) - (p3[0] - p0[0]) * curveness;\n p2[0] = (p0[0] * t + p3[0] * t2) - (p0[1] - p3[1]) * curveness;\n p2[1] = (p0[1] * t + p3[1] * t2) - (p3[0] - p0[0]) * curveness;\n }\n if (isPolyline || curveness !== 0) {\n for (var idx = start; idx < end; idx++) {\n if (isPolyline) {\n var count = seriesModel.getLineCoordsCount(idx);\n vertexCount += geometry.getPolylineVertexCount(count);\n triangleCount += geometry.getPolylineTriangleCount(count);\n }\n else {\n seriesModel.getLineCoords(idx, lineCoords);\n this._glViewHelper.dataToPoint(coordSys, lineCoords[0], p0);\n this._glViewHelper.dataToPoint(coordSys, lineCoords[1], p3);\n updateBezierControlPoints();\n\n vertexCount += geometry.getCubicCurveVertexCount(p0, p1, p2, p3);\n triangleCount += geometry.getCubicCurveTriangleCount(p0, p1, p2, p3);\n }\n }\n }\n else {\n var lineCount = end - start;\n vertexCount += lineCount * geometry.getLineVertexCount();\n triangleCount += lineCount * geometry.getLineVertexCount();\n }\n geometry.setVertexCount(vertexCount);\n geometry.setTriangleCount(triangleCount);\n\n var dataIndex = start;\n var colorArr = [];\n for (var idx = start; idx < end; idx++) {\n graphicGL.parseColor(getItemVisualColor(data, dataIndex), colorArr);\n var opacity = retrieve.firstNotNull(getItemVisualOpacity(data, dataIndex), 1);\n colorArr[3] *= opacity;\n\n var count = seriesModel.getLineCoords(idx, lineCoords);\n for (var k = 0; k < count; k++) {\n this._glViewHelper.dataToPoint(coordSys, lineCoords[k], lineCoords[k]);\n }\n\n if (isPolyline) {\n geometry.addPolyline(lineCoords, colorArr, lineWidth, 0, count);\n }\n else if (curveness !== 0) {\n p0 = lineCoords[0];\n p3 = lineCoords[1];\n updateBezierControlPoints();\n geometry.addCubicCurve(p0, p1, p2, p3, colorArr, lineWidth);\n }\n else {\n geometry.addPolyline(lineCoords, colorArr, lineWidth, 0, 2);\n }\n dataIndex++;\n }\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport LinesGLSeries from './LinesGLSeries';\nimport LinesGLView from './LinesGLView';\n\nexport function install(registers) {\n registers.registerChartView(LinesGLView);\n registers.registerSeriesModel(LinesGLSeries);\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './linesGL/install';\nuse(install);","import '../echarts-gl';\n\nimport '../component/grid3D';\nimport '../component/geo3D';\nimport '../component/globe';\nimport '../component/mapbox3D';\nimport '../component/maptalks3D';\n\nimport '../chart/bar3D';\nimport '../chart/line3D';\nimport '../chart/scatter3D';\nimport '../chart/lines3D';\nimport '../chart/polygons3D';\nimport '../chart/surface';\nimport '../chart/map3D';\n\nimport '../chart/scatterGL';\nimport '../chart/graphGL';\nimport '../chart/flowGL';\nimport '../chart/linesGL';","module.exports = __WEBPACK_EXTERNAL_MODULE_echarts_lib_echarts__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/export/all.js\");\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://echarts-gl/webpack/universalModuleDefinition","webpack://echarts-gl/./node_modules/claygl/src/core/mixin/extend.js","webpack://echarts-gl/./node_modules/claygl/src/core/mixin/notifier.js","webpack://echarts-gl/./node_modules/claygl/src/core/util.js","webpack://echarts-gl/./node_modules/claygl/src/core/Base.js","webpack://echarts-gl/./node_modules/claygl/src/core/GLInfo.js","webpack://echarts-gl/./node_modules/claygl/src/core/glenum.js","webpack://echarts-gl/./node_modules/claygl/src/core/request.js","webpack://echarts-gl/./node_modules/claygl/src/core/vendor.js","webpack://echarts-gl/./node_modules/claygl/src/core/LinkedList.js","webpack://echarts-gl/./node_modules/claygl/src/core/LRU.js","webpack://echarts-gl/./node_modules/claygl/src/core/color.js","webpack://echarts-gl/./node_modules/claygl/src/Material.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/common.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/vec2.js","webpack://echarts-gl/./node_modules/claygl/src/math/Vector2.js","webpack://echarts-gl/./node_modules/claygl/src/gpu/GLProgram.js","webpack://echarts-gl/./node_modules/claygl/src/gpu/ProgramManager.js","webpack://echarts-gl/./node_modules/claygl/src/Shader.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/prez.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/mat4.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/vec3.js","webpack://echarts-gl/./node_modules/claygl/src/Renderer.js","webpack://echarts-gl/./node_modules/claygl/src/math/Vector3.js","webpack://echarts-gl/./node_modules/claygl/src/math/Ray.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/vec4.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/mat3.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/quat.js","webpack://echarts-gl/./node_modules/claygl/src/math/Matrix4.js","webpack://echarts-gl/./node_modules/claygl/src/math/Quaternion.js","webpack://echarts-gl/./node_modules/claygl/src/math/BoundingBox.js","webpack://echarts-gl/./node_modules/claygl/src/Node.js","webpack://echarts-gl/./node_modules/claygl/src/Renderable.js","webpack://echarts-gl/./node_modules/claygl/src/picking/RayPicking.js","webpack://echarts-gl/./node_modules/claygl/src/core/Cache.js","webpack://echarts-gl/./node_modules/claygl/src/Texture.js","webpack://echarts-gl/./node_modules/claygl/src/Mesh.js","webpack://echarts-gl/./node_modules/claygl/src/math/util.js","webpack://echarts-gl/./node_modules/claygl/src/Texture2D.js","webpack://echarts-gl/./node_modules/claygl/src/GeometryBase.js","webpack://echarts-gl/./node_modules/claygl/src/Geometry.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/header/calcAmbientSHLight.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/header/light.js","webpack://echarts-gl/./node_modules/claygl/src/Light.js","webpack://echarts-gl/./node_modules/claygl/src/math/Plane.js","webpack://echarts-gl/./node_modules/claygl/src/math/Frustum.js","webpack://echarts-gl/./node_modules/claygl/src/Camera.js","webpack://echarts-gl/./node_modules/claygl/src/Scene.js","webpack://echarts-gl/./node_modules/zrender/lib/core/LRU.js","webpack://echarts-gl/./node_modules/claygl/src/TextureCube.js","webpack://echarts-gl/./node_modules/claygl/src/camera/Perspective.js","webpack://echarts-gl/./node_modules/claygl/src/FrameBuffer.js","webpack://echarts-gl/./node_modules/claygl/src/prePass/EnvironmentMap.js","webpack://echarts-gl/./node_modules/claygl/src/geometry/Plane.js","webpack://echarts-gl/./node_modules/claygl/src/geometry/Cube.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/skybox.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/plugin/Skybox.js","webpack://echarts-gl/./node_modules/claygl/src/plugin/Skydome.js","webpack://echarts-gl/./node_modules/claygl/src/util/dds.js","webpack://echarts-gl/./node_modules/claygl/src/util/hdr.js","webpack://echarts-gl/./node_modules/claygl/src/util/texture.js","webpack://echarts-gl/./src/util/EChartsSurface.js","webpack://echarts-gl/./node_modules/claygl/src/camera/Orthographic.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/vertex.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/Pass.js","webpack://echarts-gl/./node_modules/claygl/src/util/shader/integrateBRDF.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/util/shader/prefilter.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/util/cubemap.js","webpack://echarts-gl/./node_modules/claygl/src/light/AmbientCubemap.js","webpack://echarts-gl/./node_modules/claygl/src/light/AmbientSH.js","webpack://echarts-gl/./node_modules/claygl/src/util/shader/projectEnvMap.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/util/sh.js","webpack://echarts-gl/./src/util/retrieve.js","webpack://echarts-gl/./node_modules/claygl/src/geometry/Sphere.js","webpack://echarts-gl/./node_modules/claygl/src/light/Ambient.js","webpack://echarts-gl/./node_modules/claygl/src/light/Directional.js","webpack://echarts-gl/./node_modules/claygl/src/light/Point.js","webpack://echarts-gl/./node_modules/claygl/src/light/Spot.js","webpack://echarts-gl/./node_modules/claygl/src/math/Vector4.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/mat2.js","webpack://echarts-gl/./node_modules/claygl/src/math/Matrix2.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/mat2d.js","webpack://echarts-gl/./node_modules/claygl/src/math/Matrix2d.js","webpack://echarts-gl/./node_modules/claygl/src/math/Matrix3.js","webpack://echarts-gl/./node_modules/zrender/lib/animation/easing.js","webpack://echarts-gl/./node_modules/zrender/lib/animation/Clip.js","webpack://echarts-gl/./node_modules/zrender/lib/tool/color.js","webpack://echarts-gl/./node_modules/zrender/lib/core/util.js","webpack://echarts-gl/./node_modules/zrender/lib/animation/Animator.js","webpack://echarts-gl/./src/util/animatableMixin.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/util.glsl.js","webpack://echarts-gl/./src/util/shader/common.glsl.js","webpack://echarts-gl/./src/util/shader/color.glsl.js","webpack://echarts-gl/./src/util/shader/lambert.glsl.js","webpack://echarts-gl/./src/util/shader/realistic.glsl.js","webpack://echarts-gl/./src/util/shader/hatching.glsl.js","webpack://echarts-gl/./src/util/shader/shadow.glsl.js","webpack://echarts-gl/./src/util/graphicGL.js","webpack://echarts-gl/./node_modules/zrender/lib/animation/requestAnimationFrame.js","webpack://echarts-gl/./src/core/LayerGL.js","webpack://echarts-gl/./src/preprocessor/backwardCompat.js","webpack://echarts-gl/./src/echarts-gl.js","webpack://echarts-gl/./src/component/common/componentViewControlMixin.js","webpack://echarts-gl/./src/component/common/componentPostEffectMixin.js","webpack://echarts-gl/./src/component/common/componentLightMixin.js","webpack://echarts-gl/./src/component/grid3D/Grid3DModel.js","webpack://echarts-gl/./node_modules/zrender/node_modules/tslib/tslib.es6.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/image.js","webpack://echarts-gl/./node_modules/zrender/lib/core/matrix.js","webpack://echarts-gl/./node_modules/zrender/lib/core/Point.js","webpack://echarts-gl/./node_modules/zrender/lib/core/BoundingRect.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/text.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/parseText.js","webpack://echarts-gl/./node_modules/zrender/lib/core/vector.js","webpack://echarts-gl/./node_modules/zrender/lib/core/Transformable.js","webpack://echarts-gl/./node_modules/zrender/lib/core/Eventful.js","webpack://echarts-gl/./node_modules/zrender/lib/config.js","webpack://echarts-gl/./node_modules/zrender/lib/core/env.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/constants.js","webpack://echarts-gl/./node_modules/zrender/lib/Element.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Displayable.js","webpack://echarts-gl/./node_modules/zrender/lib/core/curve.js","webpack://echarts-gl/./node_modules/zrender/lib/core/bbox.js","webpack://echarts-gl/./node_modules/zrender/lib/core/PathProxy.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/line.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/cubic.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/quadratic.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/util.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/arc.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/windingLine.js","webpack://echarts-gl/./node_modules/zrender/lib/contain/path.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Path.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/TSpan.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Image.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/roundRect.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/subPixelOptimize.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Rect.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Text.js","webpack://echarts-gl/./node_modules/echarts/lib/util/number.js","webpack://echarts-gl/./node_modules/echarts/lib/util/log.js","webpack://echarts-gl/./node_modules/echarts/lib/util/model.js","webpack://echarts-gl/./node_modules/echarts/lib/util/innerStore.js","webpack://echarts-gl/./node_modules/echarts/lib/util/states.js","webpack://echarts-gl/./node_modules/zrender/lib/tool/transformPath.js","webpack://echarts-gl/./node_modules/zrender/lib/tool/path.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Group.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Circle.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Ellipse.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/roundSector.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Sector.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Ring.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/smoothSpline.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/smoothBezier.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/helper/poly.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Polygon.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Polyline.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Line.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/BezierCurve.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/shape/Arc.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/CompoundPath.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/Gradient.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/LinearGradient.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/RadialGradient.js","webpack://echarts-gl/./node_modules/zrender/lib/core/OrientedBoundingRect.js","webpack://echarts-gl/./node_modules/zrender/lib/graphic/IncrementalDisplayable.js","webpack://echarts-gl/./node_modules/echarts/lib/util/graphic.js","webpack://echarts-gl/./node_modules/echarts/lib/label/labelStyle.js","webpack://echarts-gl/./src/util/OrbitControl.js","webpack://echarts-gl/./src/util/geometry/dynamicConvertMixin.js","webpack://echarts-gl/./node_modules/claygl/src/glmatrix/index.js","webpack://echarts-gl/./node_modules/claygl/src/dep/glmatrix.js","webpack://echarts-gl/./src/util/geometry/Lines3D.js","webpack://echarts-gl/./src/util/ZRTextureAtlasSurface.js","webpack://echarts-gl/./src/component/common/SceneHelper.js","webpack://echarts-gl/./src/util/geometry/Quads.js","webpack://echarts-gl/./src/component/grid3D/Grid3DFace.js","webpack://echarts-gl/./src/util/geometry/Sprites.js","webpack://echarts-gl/./src/util/shader/labels.glsl.js","webpack://echarts-gl/./src/util/mesh/LabelsMesh.js","webpack://echarts-gl/./src/component/grid3D/Grid3DAxis.js","webpack://echarts-gl/./src/util/shader/lines3D.glsl.js","webpack://echarts-gl/./src/component/grid3D/Grid3DView.js","webpack://echarts-gl/./node_modules/echarts/lib/coord/cartesian/Cartesian.js","webpack://echarts-gl/./src/coord/grid3D/Cartesian3D.js","webpack://echarts-gl/./src/coord/grid3D/Axis3D.js","webpack://echarts-gl/./node_modules/echarts/node_modules/tslib/tslib.es6.js","webpack://echarts-gl/./node_modules/echarts/lib/util/clazz.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/makeStyleMapper.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/areaStyle.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/textStyle.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/lineStyle.js","webpack://echarts-gl/./node_modules/echarts/lib/model/mixin/itemStyle.js","webpack://echarts-gl/./node_modules/echarts/lib/model/Model.js","webpack://echarts-gl/./node_modules/echarts/lib/i18n/langEN.js","webpack://echarts-gl/./node_modules/echarts/lib/i18n/langZH.js","webpack://echarts-gl/./node_modules/echarts/lib/core/locale.js","webpack://echarts-gl/./node_modules/echarts/lib/util/time.js","webpack://echarts-gl/./node_modules/echarts/lib/legacy/getTextRect.js","webpack://echarts-gl/./node_modules/echarts/lib/util/format.js","webpack://echarts-gl/./node_modules/echarts/lib/util/layout.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/TexturePool.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/shadowmap.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/prePass/ShadowMap.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/CompositorNode.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/Graph.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/Compositor.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/SceneNode.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/TextureNode.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/FilterNode.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/coloradjust.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/blur.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/lum.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/lut.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/vignette.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/output.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/bright.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/downsample.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/upsample.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/hdr.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/lensflare.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/blend.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/source/compositor/fxaa.glsl.js","webpack://echarts-gl/./node_modules/claygl/src/shader/registerBuiltinCompositor.js","webpack://echarts-gl/./node_modules/claygl/src/createCompositor.js","webpack://echarts-gl/./node_modules/claygl/src/compositor/createCompositor.js","webpack://echarts-gl/./src/effect/halton.js","webpack://echarts-gl/./src/effect/SSAO.glsl.js","webpack://echarts-gl/./src/effect/SSAOPass.js","webpack://echarts-gl/./src/effect/SSR.glsl.js","webpack://echarts-gl/./src/effect/SSRPass.js","webpack://echarts-gl/./src/effect/poissonKernel.js","webpack://echarts-gl/./src/util/shader/normal.glsl.js","webpack://echarts-gl/./src/effect/NormalPass.js","webpack://echarts-gl/./src/effect/EdgePass.js","webpack://echarts-gl/./src/effect/composite.js","webpack://echarts-gl/./src/effect/DOF.glsl.js","webpack://echarts-gl/./src/effect/edge.glsl.js","webpack://echarts-gl/./src/effect/EffectCompositor.js","webpack://echarts-gl/./src/effect/TemporalSuperSampling.js","webpack://echarts-gl/./src/core/ViewGL.js","webpack://echarts-gl/./src/coord/grid3DCreator.js","webpack://echarts-gl/./src/component/grid3D/Axis3DModel.js","webpack://echarts-gl/./src/component/grid3D/axis3DDefault.js","webpack://echarts-gl/./node_modules/echarts/lib/data/OrdinalMeta.js","webpack://echarts-gl/./src/component/grid3D/createAxis3DModel.js","webpack://echarts-gl/./src/component/grid3D/install.js","webpack://echarts-gl/./src/component/grid3D.js","webpack://echarts-gl/./src/component/common/componentShadingMixin.js","webpack://echarts-gl/./src/coord/geo3D/geo3DModelMixin.js","webpack://echarts-gl/./src/component/geo3D/Geo3DModel.js","webpack://echarts-gl/./src/util/earcut.js","webpack://echarts-gl/./src/util/ProgressiveQuickSort.js","webpack://echarts-gl/./src/util/geometry/trianglesSortMixin.js","webpack://echarts-gl/./src/util/visual.js","webpack://echarts-gl/./src/component/common/LabelsBuilder.js","webpack://echarts-gl/./src/component/common/Geo3DBuilder.js","webpack://echarts-gl/./src/component/geo3D/Geo3DView.js","webpack://echarts-gl/./node_modules/echarts/lib/coord/geo/fix/textCoord.js","webpack://echarts-gl/./node_modules/echarts/lib/coord/geo/fix/geoCoord.js","webpack://echarts-gl/./src/coord/geo3D/Geo3D.js","webpack://echarts-gl/./src/coord/geo3DCreator.js","webpack://echarts-gl/./src/component/geo3D/install.js","webpack://echarts-gl/./src/component/geo3D.js","webpack://echarts-gl/./src/component/globe/GlobeModel.js","webpack://echarts-gl/./src/util/sunCalc.js","webpack://echarts-gl/./src/component/globe/atmosphere.glsl.js","webpack://echarts-gl/./src/component/globe/GlobeView.js","webpack://echarts-gl/./src/coord/globe/Globe.js","webpack://echarts-gl/./src/coord/globeCreator.js","webpack://echarts-gl/./src/component/globe/install.js","webpack://echarts-gl/./src/component/globe.js","webpack://echarts-gl/./src/component/mapbox3D/Mapbox3DModel.js","webpack://echarts-gl/./src/component/mapbox3D/Mapbox3DLayer.js","webpack://echarts-gl/./src/util/shader/displayShadow.glsl.js","webpack://echarts-gl/./src/component/mapbox3D/Mapbox3DView.js","webpack://echarts-gl/./src/coord/mapServiceCommon/MapService3D.js","webpack://echarts-gl/./src/coord/mapbox3D/Mapbox3D.js","webpack://echarts-gl/./src/coord/mapServiceCommon/createMapService3DCreator.js","webpack://echarts-gl/./src/coord/mapbox3DCreator.js","webpack://echarts-gl/./src/component/mapbox3D/install.js","webpack://echarts-gl/./src/component/mapbox3D.js","webpack://echarts-gl/./src/component/maptalks3D/Maptalks3DModel.js","webpack://echarts-gl/./src/component/maptalks3D/Maptalks3DLayer.js","webpack://echarts-gl/./src/component/maptalks3D/Maptalks3DView.js","webpack://echarts-gl/./src/coord/maptalks3D/Maptalks3D.js","webpack://echarts-gl/./src/coord/maptalks3DCreator.js","webpack://echarts-gl/./src/component/maptalks3D/install.js","webpack://echarts-gl/./src/component/maptalks3D.js","webpack://echarts-gl/./src/chart/bar3D/cartesian3DLayout.js","webpack://echarts-gl/./src/chart/bar3D/evaluateBarSparseness.js","webpack://echarts-gl/./src/chart/bar3D/bar3DLayout.js","webpack://echarts-gl/./src/util/format.js","webpack://echarts-gl/./src/chart/common/formatTooltip.js","webpack://echarts-gl/./src/chart/common/createList.js","webpack://echarts-gl/./src/chart/bar3D/Bar3DSeries.js","webpack://echarts-gl/./src/util/geometry/Bars3DGeometry.js","webpack://echarts-gl/./src/chart/bar3D/Bar3DView.js","webpack://echarts-gl/./src/chart/bar3D/install.js","webpack://echarts-gl/./src/chart/bar3D.js","webpack://echarts-gl/./src/chart/line3D/Line3DSeries.js","webpack://echarts-gl/./src/chart/line3D/Line3DView.js","webpack://echarts-gl/./src/chart/line3D/install.js","webpack://echarts-gl/./src/chart/line3D.js","webpack://echarts-gl/./src/chart/scatter3D/Scatter3DSeries.js","webpack://echarts-gl/./src/util/sprite.js","webpack://echarts-gl/./src/util/geometry/verticesSortMixin.js","webpack://echarts-gl/./src/chart/common/sdfSprite.glsl.js","webpack://echarts-gl/./src/chart/common/PointsMesh.js","webpack://echarts-gl/./src/chart/common/PointsBuilder.js","webpack://echarts-gl/./src/chart/scatter3D/Scatter3DView.js","webpack://echarts-gl/./src/chart/scatter3D/install.js","webpack://echarts-gl/./src/chart/scatter3D.js","webpack://echarts-gl/./src/chart/lines3D/lines3DLayout.js","webpack://echarts-gl/./src/chart/lines3D/Lines3DSeries.js","webpack://echarts-gl/./src/chart/lines3D/shader/trail2.glsl.js","webpack://echarts-gl/./src/chart/lines3D/TrailMesh2.js","webpack://echarts-gl/./src/chart/lines3D/Lines3DView.js","webpack://echarts-gl/./src/chart/lines3D/install.js","webpack://echarts-gl/./src/chart/lines3D.js","webpack://echarts-gl/./src/chart/polygons3D/Polygons3DSeries.js","webpack://echarts-gl/./src/chart/polygons3D/Polygons3DView.js","webpack://echarts-gl/./src/chart/polygons3D/install.js","webpack://echarts-gl/./src/chart/polygons3D.js","webpack://echarts-gl/./src/chart/surface/SurfaceSeries.js","webpack://echarts-gl/./src/chart/surface/SurfaceView.js","webpack://echarts-gl/./src/chart/surface/install.js","webpack://echarts-gl/./src/chart/surface.js","webpack://echarts-gl/./src/chart/map3D/Map3DSeries.js","webpack://echarts-gl/./src/chart/map3D/Map3DView.js","webpack://echarts-gl/./src/chart/map3D/install.js","webpack://echarts-gl/./src/chart/map3D.js","webpack://echarts-gl/./src/chart/scatterGL/ScatterGLSeries.js","webpack://echarts-gl/./src/chart/common/GLViewHelper.js","webpack://echarts-gl/./src/chart/scatterGL/ScatterGLView.js","webpack://echarts-gl/./src/chart/scatterGL/install.js","webpack://echarts-gl/./src/chart/scatterGL.js","webpack://echarts-gl/./node_modules/echarts/lib/data/Graph.js","webpack://echarts-gl/./node_modules/echarts/lib/data/helper/linkList.js","webpack://echarts-gl/./src/chart/graphGL/createGraphFromNodeEdge.js","webpack://echarts-gl/./src/chart/graphGL/GraphGLSeries.js","webpack://echarts-gl/./src/util/geometry/Lines2D.js","webpack://echarts-gl/./src/chart/graphGL/forceAtlas2.glsl.js","webpack://echarts-gl/./src/chart/graphGL/ForceAtlas2GPU.js","webpack://echarts-gl/./src/chart/graphGL/forceAtlas2Worker.js","webpack://echarts-gl/./src/chart/graphGL/ForceAtlas2.js","webpack://echarts-gl/./src/util/Roam2DControl.js","webpack://echarts-gl/./src/util/shader/lines2D.glsl.js","webpack://echarts-gl/./src/chart/graphGL/GraphGLView.js","webpack://echarts-gl/./src/chart/graphGL/install.js","webpack://echarts-gl/./src/chart/graphGL.js","webpack://echarts-gl/./src/chart/flowGL/FlowGLSeries.js","webpack://echarts-gl/./src/chart/flowGL/Line2D.js","webpack://echarts-gl/./src/chart/flowGL/vectorFieldParticle.glsl.js","webpack://echarts-gl/./src/chart/flowGL/VectorFieldParticleSurface.js","webpack://echarts-gl/./src/chart/flowGL/FlowGLView.js","webpack://echarts-gl/./src/chart/flowGL/install.js","webpack://echarts-gl/./src/chart/flowGL.js","webpack://echarts-gl/./src/chart/linesGL/LinesGLSeries.js","webpack://echarts-gl/./src/chart/linesGL/LinesGLView.js","webpack://echarts-gl/./src/chart/linesGL/install.js","webpack://echarts-gl/./src/chart/linesGL.js","webpack://echarts-gl/./src/export/all.js","webpack://echarts-gl/external \"echarts\"","webpack://echarts-gl/webpack/bootstrap","webpack://echarts-gl/webpack/runtime/global","webpack://echarts-gl/webpack/runtime/make namespace object","webpack://echarts-gl/webpack/startup"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;;;;;;;;;;;ACVA;AACA;AACA,WAAW,gBAAgB;AAC3B,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,yBAAyB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mDAAe;;AAEf;;AAEA;AACA;AACA,CAAC,EAAC;;;ACzGF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;;AAEA,iEAAiE;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;;AAEA,qDAAe,QAAQ,E;;AC1MvB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,eAAe;AAC/B,gBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,eAAe;AAC/B,gBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,SAAS;AACzB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,SAAS;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,iBAAiB;AACjB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;;AAEA,gDAAe,IAAI,EAAC;;;AC1MqB;AACI;AACnB;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,mBAAmB,iBAAY;AAC/B;;AAEA;AACA;AACA,QAAQ,gBAAW;AACnB;AACA;;AAEA,gBAAW,OAAO,YAAW;AAC7B,gBAAW,iBAAiB,cAAa;;AAEzC,gDAAe,IAAI,EAAC;;;AC1BpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kDAAe,MAAM,EAAC;;;AC/DtB;AACA;AACA;AACA;AACA,6CAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAC;;;ACnaF;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8CAAe;AACf;AACA,CAAC,EAAC;;;ACvC8B;;AAEhC;;AAEA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,qBAAM;AACtB,QAAQ,qBAAM;AACd;;;AAGA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;;AAE7C;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS,WAAW;AACpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kDAAe,MAAM,EAAC;;;AC5EtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa;AACb,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,aAAa;AACb,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,2BAA2B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,SAAS;AACrB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA,sDAAe,UAAU,EAAC;;;ACjQY;;AAEtC;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,eAAU;;AAE/B;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA,YAAY,OAAO;AACnB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+CAAe,GAAG,EAAC;;;AChFnB;AACA;AACA;AAC8B;;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;AAC1B,sBAAsB;AACtB;AACA;;AAEA,2BAA2B;AAC3B,sBAAsB;AACtB;AACA;;AAEA,2BAA2B;AAC3B;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;;AAEA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,eAAe,YAAY,YAAY;AACvC;AACA;AACA;AACA,kBAAkB,eAAe,eAAe;AAChD;AACA;;AAEA,qBAAqB,QAAG;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,eAAe;AAC1B,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD;AACjD;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,eAAe;AAC1B,WAAW,eAAe;AAC1B,YAAY,eAAe;AAC3B;AACA;AACA,8DAA8D;AAC9D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,eAAe;AAC1B,YAAY,eAAe;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iCAAiC;AACjC,iCAAiC;AACjC,4BAA4B;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,uBAAuB;AAClC,WAAW,eAAe;AAC1B,YAAY,eAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,WAAW,OAAO;AAClB,WAAW,eAAe;AAC1B,WAAW,SAAS;AACpB,YAAY,gBAAgB;AAC5B,qCAAqC,wDAAwD;AAC7F;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB,YAAY,OAAO;AACnB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,eAAe;AAC1B,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA,4CAAe,SAAS,E;;ACjiBO;AACA;AACM;AACrC,iBAAiB,kBAAsB;;AAEvC;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,aAAa,iBAAY;AACzB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,kBAAkB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,eAAe,gBAAW;AAC1B;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB,yBAAyB;AACzB,2BAA2B;AAC3B,0BAA0B;;AAE1B;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,0CAA0C;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,0CAA0C;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,YAAY;AAC5B,gBAAgB,QAAQ;AACxB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA,6BAA6B,eAAU;AACvC,+BAA+B,eAAU;;AAEzC;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,kBAAa;AACzB,YAAY,kBAAa;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,eAAU;AAC3C,mCAAmC,eAAU;AAC7C;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,mDAAe,QAAQ,EAAC;;;;ACjfjB;;AAEP;AACO;AACP;AACA;AACA;;AAEO,IAAI,mBAAY;;;;ACRvB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,MAAM;AACjB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA,uBAAuB,OAAO;AAC9B,0BAA0B;AAC1B;AACA,0BAA0B;AAC1B;;AAEA;AACA;AACA,CAAC;;AAED,oDAAe,IAAI,E;;ACpgBiB;;AAEpC;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,wBAAe;;AAEhC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAsB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,kBAAS;AACxB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,sBAAa;AAC5B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,qBAAY;AAC3B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,6BAAoB;AACnC,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,2BAAkB;AACjC,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,4BAAmB;AAC3B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,sBAAa;AACxB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,iBAAQ;AACnB;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,yBAAgB;AACpB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,qBAAY;AACvB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,4BAAmB;AACvB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;ACxtBa;AACJ;;AAEhC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,wBAAmB;;AAE/C,gBAAgB,gBAAW;;AAE3B,wBAAwB;AACxB;;AAEA,CAAC;AACD;;AAEA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mCAAmC,kBAAkB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,wBAAmB;AACvD;AACA,mCAAmC,kBAAkB;AACrD;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,0CAA0C;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;;AAEA;AACA,CAAC;;AAED,oDAAe,SAAS,E;;ACjVY;;AAEpC,wDAAwD,wBAAwB,yBAAyB,EAAE,eAAe,EAAE,GAAG,EAAE;;AAEjI;AACA;AACA;;AAEA;AACA,aAAa,GAAG;AAChB;AACA,0BAA0B,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uCAAuC,qBAAqB;AAC5D;AACA,wBAAwB;AACxB;AACA;AACA;AACA,gBAAgB;AAChB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,4BAAa;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA;AACA,2DAA2D;AAC3D,wDAAwD;AACxD;AACA,8DAA8D;AAC9D;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,4BAAa;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,4BAAa;AACzD;AACA,8CAA8C,4BAAa;;AAE3D;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,aAAS;AAC/B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,yDAAe,cAAc,E;;AC1L7B;AACA;AACA;AACA;AACA;AACA;AACA;AAC+B;AACI;;AAEnC,kIAAkI;AAClI,0EAA0E;AAC1E;AACA,oDAAoD;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,aAAa,EAAE;AACxC,wBAAwB,UAAU,EAAE;AACpC,0BAA0B,UAAU,EAAE;AACtC,8BAA8B,aAAa,EAAE;AAC7C,gCAAgC,aAAa,EAAE;;AAE/C,yBAAyB,2BAA2B,EAAE;AACtD,yBAAyB,2BAA2B,EAAE;AACtD,yBAAyB,2BAA2B,EAAE;;AAEtD,0BAA0B,2BAA2B,EAAE;AACvD,0BAA0B,2BAA2B,EAAE;AACvD,0BAA0B,2BAA2B,EAAE;;AAEvD,yBAAyB,2BAA2B,EAAE;AACtD,yBAAyB,2BAA2B,EAAE;AACtD,yBAAyB,4BAA4B,EAAE;;AAEvD,0BAA0B,WAAW;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,iBAAY;AACzB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iDAAiD;AACjD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,mBAAmB;AACtC;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yDAAyD,wBAAmB;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,gDAAgD,cAAc,EAAE;AAChE;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,8EAA8E;AAC9E;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAe,MAAM,EAAC;;;ACvqBtB,gDAAe,kEAAkE,gCAAgC,iCAAiC,qCAAqC,qCAAqC,oGAAoG,gBAAgB,2BAA2B,0EAA0E,yFAAyF,iCAAiC,yCAAyC,GAAG,+DAA+D,iCAAiC,0BAA0B,gBAAgB,2BAA2B,0DAA0D,WAAW,IAAI,IAAI,wCAAwC,GAAG,OAAO,EAAC;;;;ACCh4B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE0D;;AAE1D;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,WAAW,WAAW;AACpC;AACA;AACA;AACA;;AAEA,cAAc,WAAW,YAAY;AACrC;AACA;AACA;AACA;;AAEA,eAAe,YAAY,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAc,WAAW;AACzB;AACA;AACA;AACA;;AAEA,cAAc,WAAW;AACzB;AACA;AACA;AACA;;AAEA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,mBAAmB,YAAY,YAAY;AAC3C,mBAAmB,YAAY,YAAY;AAC3C,mBAAmB,YAAY,aAAa;;AAE5C,qBAAqB,cAAc,cAAc;AACjD,qBAAqB,cAAc,cAAc;AACjD,qBAAqB,cAAc,eAAe;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,aAAa,GAAG,aAAa;;AAErD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,eAAe,YAAY,YAAY;AACvC,eAAe,YAAY,YAAY;AACvC,eAAe,YAAY,aAAa;;AAExC;AACA,wBAAwB,yBAAyB;AACjD,4BAA4B,qBAAqB;AACjD,4BAA4B,yBAAyB;;AAErD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,MAAM;AACjB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,aAAa;AAChD,mCAAmC,aAAa;AAChD,mCAAmC,aAAa;AAChD;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA,oDAAe,IAAI,E;;;AC96BnB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE0D;;AAE1D;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA,YAAY,mBAAY;AACxB,aAAa,mBAAY;AACzB;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA,uBAAuB,OAAO;AAC9B,0BAA0B,iBAAiB;AAC3C;AACA,0BAA0B,iBAAiB;AAC3C;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,oDAAe,IAAI,E;;AC1oBnB;AACA;AAC+B;AACI;AACA;AACA;;AAED;AACG;AACa;;AAElD;AAC8B;;AAEsB;AACpD,iBAAgB,CAAC,SAAQ;;AAEU;AACA;;AAEnC,iBAAiB,oBAAW;;AAE5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,WAAW,YAAY;AACvB,UAAU,WAAW;AACrB,WAAW,oBAAoB;AAC/B,WAAW,YAAY;AACvB,YAAY,qBAAqB;AACjC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,wBAAmB;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAW;AAC1B;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,oBAAoB;;AAEpB;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA,sBAAsB,wBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B,WAAM;;AAEjC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,kBAAc;;AAEzC;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,WAAW;AAC3B,gBAAgB,YAAY;AAC5B,gBAAgB,QAAQ;AACxB,gBAAgB,QAAQ;AACxB,gBAAgB;AAChB;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,oBAAW;AACtC,uBAAuB,4BAA4B;AACnD;AACA,YAAY,4BAAmB;AAC/B,YAAY,2BAAkB;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,kBAAkB;AACjC,eAAe,YAAY;AAC3B,eAAe,OAAO;AACtB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,kBAAS;AACrB,YAAY,kBAAS;AACrB,YAAY,kBAAS;AACrB;AACA;AACA,YAAY,sBAAa;AACzB,YAAY,sBAAa;AACzB,YAAY,sBAAa;AACzB;AACA,QAAQ,sBAAa;AACrB,QAAQ,oBAAW;AACnB,QAAQ,oBAAW;;AAEnB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB,iBAAiB;AACxC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAS;AACzB,gBAAgB,sBAAa;AAC7B,gBAAgB,4BAAmB;AACnC;AACA;AACA,oBAAoB,oBAAW;AAC/B;AACA;AACA;AACA,oBAAoB,oBAAW;AAC/B;AACA;AACA;AACA,oBAAoB,oBAAW;AAC/B;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,+BAA+B,+BAA+B;AAC9D;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAc;AACtC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,mCAAmC;AAC9D;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,uBAAuB,6BAA6B;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA,kDAAkD;AAClD;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,yBAAyB;AACxD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,yBAAyB;AAChE;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,yBAAyB;AAC5D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,gCAAgC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,yDAAyD,YAAQ;AACjE,wBAAwB,UAAM,CAAC,iBAAa,sBAAsB,iBAAa;AAC/E,SAAS;AACT;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,WAAW;AAC1B;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB,eAAe,QAAQ;AACvB,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,4BAA4B;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,gBAAgB;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,2BAA2B;;AAE3B;AACA;AACA;AACA;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA,sBAAsB,YAAO;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA,4BAA4B,uBAAuB;AACnD;AACA;AACA,UAAU;AACV;AACA,4BAA4B,uBAAuB;AACnD;AACA;AACA,UAAU;AACV;AACA,8BAA8B,yBAAyB;;AAEvD,mDAAe,QAAQ,EAAC;;;AC/3CY;;AAEpC;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,wBAAe;;AAEhC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAsB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,kBAAS;AACxB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,sBAAa;AAC5B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;AACL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,qBAAY;AAC3B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,6BAAoB;AACnC,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,2BAAkB;AACjC,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,QAAQ,aAAK;AACb;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,mBAAmB,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,mBAAmB,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,mBAAmB,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;;AAGA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,sBAAa;AACxB;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,iBAAQ;AACnB;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,yBAAgB;AACpB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,qBAAY;AACvB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,mDAAe,OAAO,EAAC;;;ACv+BS;AACI;;AAEpC;;AAEA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB;AACA;AACA;AACA,cAAc;AACd;AACA,gCAAgC,YAAO;AACvC;AACA,cAAc;AACd;AACA,sCAAsC,YAAO;AAC7C;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,iBAAQ;AAC9B;AACA;AACA;AACA;AACA;AACA,sBAAsB,YAAO;AAC7B;AACA,iBAAiB,iBAAQ;AACzB,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA,gBAAgB,iBAAQ;AACxB,QAAQ,yBAAgB;AACxB;AACA,KAAK;;AAEL;AACA,gBAAgB,oBAAW;AAC3B;AACA,YAAY,iBAAQ;AACpB;AACA,oBAAoB,iBAAQ;AAC5B;AACA,uBAAuB,sBAAa;AACpC;AACA;AACA,qBAAqB,wBAAe;AACpC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,gBAAgB,oBAAW;AAC3B;AACA;AACA;AACA;AACA,YAAY,iBAAQ;AACpB;AACA,oBAAoB,iBAAQ;AAC5B;AACA,qBAAqB,2BAAkB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,YAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,yBAAgB;AACpC;AACA;AACA;AACA;AACA,gBAAgB,yBAAgB;AAChC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,iBAAiB;AAChC,eAAe;AACf,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB,YAAO;AAC7B;AACA,QAAQ,yBAAgB;AACxB;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,QAAQ;AACvB,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,gBAAgB;AAChB;AACA;;AAEA,kBAAkB,oBAAW;AAC7B,kBAAkB,oBAAW;AAC7B,iBAAiB,oBAAW;AAC5B,qBAAqB,oBAAW;;AAEhC;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;;AAEpB,YAAY,mBAAU;;AAEtB,sBAAsB,iBAAQ;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,iBAAQ;AACpB,oBAAoB,iBAAQ;AAC5B;AACA;AACA;;AAEA,YAAY,mBAAU;AACtB,oBAAoB,iBAAQ;;AAE5B;AACA;AACA;;AAEA,YAAY,mBAAU;AACtB,qBAAqB,iBAAQ;;AAE7B;AACA;AACA;;AAEA;AACA,0BAA0B,YAAO;AACjC;AACA;AACA,gBAAgB,gBAAW;AAC3B;AACA,YAAY,yBAAgB;;AAE5B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA,QAAQ,gBAAW;AACnB,QAAQ,0BAAqB;AAC7B,QAAQ,0BAAqB;;AAE7B,QAAQ,gBAAW;AACnB,QAAQ,sBAAiB;AACzB,KAAK;;AAEL;AACA;AACA,eAAe,SAAS;AACxB;AACA;AACA,QAAQ,iBAAY;AACpB,QAAQ,iBAAY;AACpB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+CAAe,GAAG,EAAC;;;;AC7TnB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE0D;;AAE1D;AACA;AACA;AACA;;AAEO;;AAEP;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA,aAAa,mBAAY;AACzB,aAAa,mBAAY;AACzB,aAAa,mBAAY;AACzB,aAAa,mBAAY;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA,uBAAuB,OAAO;AAC9B,0BAA0B,iBAAiB,iBAAiB;AAC5D;AACA,0BAA0B,iBAAiB,iBAAiB;AAC5D;;AAEA;AACA;AACA,CAAC;;AAED,oDAAe,IAAI,E;;;AChhBnB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,MAAM;AACjB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,KAAK;AACf,UAAU,KAAK;AACf;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,UAAU,KAAK;AACf,UAAU,KAAK;AACf;AACA,YAAY,KAAK;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;;AAGA,oDAAe,IAAI,E;;;;AC5dnB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;AAClB;AACA;AACA;;;AAG1B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,oBAAW;AAC7B,oBAAoB,wBAAe;AACnC,oBAAoB,wBAAe;;AAEnC;AACA,kBAAkB,iBAAQ;AAC1B;AACA,YAAY,mBAAU;AACtB,gBAAgB,oBAAW;AAC3B,gBAAgB,mBAAU;AAC1B,YAAY,uBAAc;AAC1B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,YAAY,mBAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,eAAe,oBAAW;;AAE1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,aAAa,mBAAU;;AAEvB;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,wBAAe;;AAEjC;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,YAAY,kBAAS;;AAErB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,WAAW,iBAAQ;;AAEnB;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,WAAW,iBAAQ;;AAEnB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,aAAa,mBAAU;;AAEvB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA,WAAW,iBAAQ;;AAEnB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA,YAAY,kBAAS;;AAErB;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA,cAAc,oBAAW;;AAEzB;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA,qBAAqB,2BAAkB;;AAEvC;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,iBAAiB,uBAAc;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC;AACxC;AACA,0BAA0B;AAC1B;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,oDAAe,IAAI,E;;AC5gBiB;AACA;AACA;AACA;AACJ;;AAEhC;AACA;AACA;AACA;AACA;;AAEA,sBAAsB,YAAO;AAC7B,sBAAsB,YAAO;AAC7B,sBAAsB,YAAO;;AAE7B;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,oBAAW;;AAE5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,yBAAgB;AAC/B,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,qCAA4B;AACpC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,gBAAgB;AAC/B,eAAe,YAAY;AAC3B;AACA;AACA;;AAEA,gBAAgB,oBAAW;AAC3B,gBAAgB,oBAAW;AAC3B,gBAAgB,oBAAW;;AAE3B,iBAAiB,oBAAW;;AAE5B;;AAEA;AACA,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;;AAEpB,qBAAqB,oBAAW;AAChC,qBAAqB,oBAAW;AAChC,qBAAqB,oBAAW;;AAEhC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,YAAY,sBAAa;AACzB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,YAAY,sBAAa;AACzB,YAAY,uBAAc;;AAE1B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,IAAI,sBAAc;;AAElB,IAAI,sBAAc;AAClB,QAAQ,aAAK;AACb;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,yBAAgB;AAC3B;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,yBAAgB;AACpB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,qCAA4B;AAChC;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;AC9sBa;AACA;;AAEpC;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,wBAAe;;AAEhC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,wBAAe;AACvB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAsB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,iBAAiB,oBAAW;AAC5B;AACA,YAAY,sBAAa;AACzB;AACA,YAAY,uBAAc;AAC1B,YAAY,sBAAa;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,wBAAe;AACvB;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,QAAQ,0BAAiB;AACzB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,2BAAkB;AACjC,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,IAAI,yBAAc;AAClB;AACA,IAAI,yBAAc;;AAElB,QAAQ,gBAAK;AACb;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,yBAAc,CAAC,gBAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,yBAAc,CAAC,gBAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,yBAAc,CAAC,gBAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,yBAAc,CAAC,gBAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,wBAAe;AACnB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,WAAW,iBAAQ;AACnB;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,0BAAiB;AACrB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;AACA;AACA,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,gBAAgB;AAC5B,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,wBAAe;AACnB;AACA;AACA;;AAEA;AACA;AACA,WAAW,gBAAgB;AAC3B,WAAW,aAAa;AACxB,WAAW,OAAO;AAClB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,sDAAe,UAAU,EAAC;;;ACrwBM;AACI;;AAEpC,cAAc,iBAAQ;AACtB,eAAe,kBAAS;;AAExB;AACA;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA,0BAA0B,YAAO;;AAEjC;AACA;AACA,cAAc;AACd;AACA,0BAA0B,YAAO;;AAEjC;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gBAAgB,MAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;;AAEA,4CAA4C,uBAAuB;AACnE,4CAA4C,uBAAuB;AACnE,4CAA4C,uBAAuB;;AAEnE,4CAA4C,uBAAuB;AACnE,4CAA4C,uBAAuB;AACnE,4CAA4C,uBAAuB;AACnE;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,QAAQ,iBAAQ;AAChB,QAAQ,iBAAQ;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA,QAAQ,iBAAQ;AAChB,QAAQ,iBAAQ;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,iBAAiB;AACjC,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,iBAAiB;AACjC,gBAAgB;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,iBAAiB;AAChC,eAAe,aAAa;AAC5B;AACA;AACA;AACA,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;AAC5B,iBAAiB,oBAAW;;AAE5B;AACA;AACA;;AAEA;;AAEA,kCAAkC,uBAAuB;AACzD,kCAAkC,uBAAuB;;AAEzD,kCAAkC,uBAAuB;AACzD,kCAAkC,uBAAuB;;AAEzD,kCAAkC,uBAAuB;AACzD,kCAAkC,uBAAuB;;AAEzD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B;AAC1B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC,8BAA8B,wBAAe;AAC7C;;AAEA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,iBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uDAAe,WAAW,EAAC;;;ACrTI;AACM;AACM;AACN;AACF;AACU;;AAE7C;;AAEA;AACA;AACA;AACA;AACA,WAAW,gBAAW;AACtB;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;;AAEA;AACA,4BAA4B,YAAO;AACnC;AACA;AACA,4BAA4B,eAAU;AACtC;AACA;AACA,yBAAyB,YAAO;AAChC;;AAEA,8BAA8B,YAAO;AACrC,8BAA8B,YAAO;;AAErC;;AAEA,CAAC;AACD;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,uBAAuB;AAChD;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,KAAK;AACpB;AACA;AACA;AACA;AACA,8CAA8C,SAAS;AACvD;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,eAAe,SAAS;AACxB,eAAe,KAAK;AACpB;AACA;AACA;AACA,8CAA8C,SAAS;AACvD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA,QAAQ,kBAAS;AACjB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA,QAAQ,kBAAS;AACjB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,oBAAW;;AAE7B;AACA;AACA;AACA;AACA;AACA,gBAAgB,oBAAW;AAC3B,gBAAgB,sBAAa;AAC7B,aAAa;AACb,gBAAgB,kBAAS;AACzB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,YAAY,qCAA4B;;AAExC,YAAY,mBAAU;;AAEtB;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,4BAAmB;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,kBAAS;AACrB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,QAAQ;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,6CAA6C,SAAS;AACtD;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,SAAS;AACzB,gBAAgB,iBAAiB;AACjC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,gBAAW;AACrC,0BAA0B,YAAO;AACjC,oCAAoC,YAAO;AAC3C;AACA,6BAA6B,gBAAW;AACxC;;AAEA;AACA,gBAAgB,mBAAc;AAC9B;AACA;AACA,gBAAgB,qBAAgB;AAChC;;AAEA;AACA;AACA;AACA,oBAAoB,qBAAgB;AACpC;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAO;AAC9B;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,oBAAoB,YAAO;AAC3B,2BAA2B,YAAO;;AAElC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA,oBAAoB,YAAO;AAC3B;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,CAAC;;AAED,+CAAe,IAAI,EAAC;;;ACzpBM;AACS;;AAEnC;AACA;AACA;AACA;AACA;AACA,iBAAiB,eAAW;AAC5B;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA,UAAU,gBAAgB;;AAE1B;AACA,CAAC;AACD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX;AACA,cAAc;AACd;AACA,cAAc,WAAW;AACzB;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX;AACA,cAAc;AACd;AACA,eAAe,UAAU;;AAEzB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA,mCAAmC;;AAEnC;AACA;AACA,cAAc;AACd;AACA,8CAA8C;;AAE9C;AACA,cAAc,sCAAkC;AAChD;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,6BAAyB;;AAEtD;AACA;;AAEA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,CAAC;;AAED;AACA,UAAU;AACV;AACA,oBAAoB,aAAa;AACjC;AACA,UAAU;AACV;AACA,mBAAmB,YAAY;AAC/B;AACA,UAAU;AACV;AACA,uBAAuB,gBAAgB;AACvC;AACA,UAAU;AACV;AACA,wBAAwB,iBAAiB;AACzC;AACA,UAAU;AACV;AACA,uBAAuB,gBAAgB;AACvC;AACA,UAAU;AACV;AACA,4BAA4B,qBAAqB;AACjD;AACA,UAAU;AACV;AACA,0BAA0B,mBAAmB;AAC7C;AACA,UAAU;AACV;AACA,kBAAkB,WAAW;AAC7B;AACA,UAAU;AACV;AACA,mBAAmB,YAAY;AAC/B;AACA,UAAU;AACV;AACA,4BAA4B,qBAAqB;AACjD;AACA,UAAU;AACV;AACA,gBAAgB,SAAS;AACzB;AACA,UAAU;AACV;AACA,iBAAiB,UAAU;;AAE3B,qDAAe,UAAU,EAAC;;;AClNM;AACF;AACQ;AACA;AACA;AACC;AACH;AACA;;AAEpC;AACA;AACA;AACA;AACA,iBAAiB,gBAAW;AAC5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD,oBAAoB,QAAG;AACvB,oBAAoB,YAAO;AAC3B,CAAC;AACD;AACA;;AAEA;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,QAAQ;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,MAAM;AACtB,gBAAgB,QAAQ;AACxB,gBAAgB;AAChB;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,6BAA6B,cAAU;AACvC;AACA;AACA;AACA,mCAAmC,gBAAgB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA,KAAK;;AAEL;;AAEA,qBAAqB,YAAO;AAC5B,qBAAqB,YAAO;AAC5B,qBAAqB,YAAO;AAC5B,sBAAsB,QAAG;AACzB,+BAA+B,YAAO;;AAEtC;;AAEA;AACA;AACA,YAAY,mBAAc;;AAE1B;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oDAAoD,WAAW,6BAA6B,UAAU;AACtG,oDAAoD,YAAY,6BAA6B,SAAS;;AAEtG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,8BAA8B;AAC7D;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,0BAA0B;AACzD;AACA;AACA;AACA;AACA,oBAAoB,iBAAQ;AAC5B,mCAAmC,OAAO;AAC1C;AACA,4BAA4B,2BAAkB;AAC9C,4BAA4B,yBAAgB;AAC5C;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,YAAO;AAC5C;AACA,wBAAwB,0BAAqB;AAC7C;AACA;AACA;AACA,wBAAwB,iBAAY;AACpC;AACA;AACA;AACA,wBAAwB,iBAAY;AACpC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB,WAAW,UAAU;AACrB,WAAW,eAAe;AAC1B,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA,yDAAe,UAAU,EAAC;;;ACpQ1B;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA,iDAAe,KAAK,EAAC;;;AC5GrB;AACA;AACA;AACA;AAC+B;AACI;AACF;;AAEjC;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAW;AACzB;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,UAAU,oBAAoB;AAC9B;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,YAAY,WAAW;AACvB;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,WAAW,aAAa;AACxB;AACA;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,WAAW,aAAa;AACxB;AACA;AACA,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,eAAe,2BAA2B;AAC1C;AACA;AACA,WAAW;AACX,WAAW;AACX,cAAc;AACd;AACA,eAAe,aAAa;AAC5B;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,CAAC;AACD,sBAAsB,UAAK;AAC3B,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL,wBAAwB;AACxB,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,kCAAkC;;AAElC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,sBAAsB;AAClD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA,KAAK;AACL;AACA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,8BAA8B,6BAA6B;AAC3D,8BAA8B,4BAA4B;AAC1D;AACA,uBAAuB,cAAc;AACrC;AACA,mCAAmC,2BAA2B;AAC9D,8BAA8B,4BAA4B;AAC1D;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;AACA;AACA,uBAAuB,QAAQ;AAC/B;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,cAAc;AAC9B;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA,gCAAgC;;AAEhC;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA,UAAU;AACV;AACA,eAAe,WAAW;AAC1B;AACA,UAAU;AACV;AACA,wBAAwB,oBAAoB;AAC5C;AACA,UAAU;AACV;AACA,gBAAgB,YAAY;AAC5B;AACA,UAAU;AACV;AACA,yBAAyB,qBAAqB;AAC9C;AACA,UAAU;AACV;AACA,cAAc,UAAU;AACxB;AACA,UAAU;AACV;AACA,uBAAuB,mBAAmB;AAC1C;AACA,UAAU;AACV;AACA,gBAAgB,YAAY;AAC5B;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA,0BAA0B,sBAAsB;AAChD;AACA,UAAU;AACV;AACA,wBAAwB,oBAAoB;AAC5C;AACA,UAAU;AACV;AACA,gBAAgB,YAAY;AAC5B;AACA,UAAU;AACV;AACA,cAAc,UAAU;AACxB;AACA,UAAU;AACV;AACA,eAAe,WAAW;AAC1B;AACA,UAAU;AACV;AACA,oBAAoB,gBAAgB;AACpC;AACA,UAAU;AACV;AACA,0BAA0B,sBAAsB;;AAEhD;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA,kBAAkB,cAAc;AAChC;AACA,UAAU;AACV;AACA,iBAAiB,aAAa;;AAE9B;AACA;AACA,UAAU;AACV;AACA,iCAAiC,6BAA6B;AAC9D;AACA,UAAU;AACV;AACA,gCAAgC,4BAA4B;AAC5D;AACA,UAAU;AACV;AACA,gCAAgC,4BAA4B;AAC5D;AACA,UAAU;AACV;AACA,+BAA+B,2BAA2B;;AAE1D;AACA;AACA,UAAU;AACV;AACA,iBAAiB,aAAa;AAC9B;AACA,UAAU;AACV;AACA,wBAAwB,oBAAoB;AAC5C;AACA,UAAU;AACV;AACA,0BAA0B,sBAAsB;;;AAGhD,kDAAe,OAAO,EAAC;;;AC9Ze;AACH;;AAEnC;AACA;AACA;AACA;AACA,WAAW,qBAAiB;AAC5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA,CAAC;AACD;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,cAAc;AACd;AACA;;AAEA,kCAAkC,cAAc,EAAE;;AAElD;AACA;AACA,KAAK;;AAEL;AACA,mBAAmB,mCAA+B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,cAAc,aAAa;AAC3B,aAAa,YAAY;AACzB,iBAAiB,gBAAgB;AACjC,kBAAkB,iBAAiB;AACnC,iBAAiB,gBAAgB;AACjC,sBAAsB,qBAAqB;AAC3C,oBAAoB,mBAAmB;;AAEvC,YAAY,WAAW;AACvB,aAAa,YAAY;AACzB,sBAAsB,qBAAqB;AAC3C,UAAU,SAAS;AACnB,WAAW,UAAU;;AAErB,+CAAe,IAAI,EAAC;;;AC9DpB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,gDAAe,QAAQ,EAAC;;;ACtBQ;AACG;AACA;AACA;AACnC,mBAAmB,sBAAqB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ,QAAQ;AACR;AACA,gBAAgB,kBAAc;AAC9B;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,kBAAc,mBAAmB,kBAAc;AAC9E;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB,YAAY;AACrC;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,yBAAyB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,yCAAqC;AACjE,+BAA+B,wCAAoC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA,oBAAoB,uBAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,oDAAe,SAAS,EAAC;;;AC3PM;AACI;AACF;AACE;;AAEnC;AACA;AACA,gBAAgB,qBAAgB;AAChC,iBAAiB,sBAAiB;AAClC,iBAAiB,sBAAiB;AAClC,kBAAkB,uBAAkB;AACpC,KAAK,WAAW,wBAAmB;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,gBAAgB;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,MAAM;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC,2BAA2B,UAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA,mBAAmB,gBAAW;AAC9B;AACA;AACA;AACA,kBAAkB;AAClB;AACA,sBAAsB;;AAEtB;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA,sBAAsB,UAAK;;AAE3B;;AAEA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,eAAe;AAC9B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,MAAM;AACrB;AACA;AACA;AACA;AACA,cAAc,uBAAkB,GAAG,uBAAkB;AACrD;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,kBAAkB;AAC7C,+BAA+B,UAAU;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,0BAA0B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;;AAEA;;AAEA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;;AAEA,+BAA+B,mCAAmC;AAClE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,2BAA2B,kBAAkB;AAC7C,4BAA4B,mBAAmB;AAC/C,2BAA2B,kBAAkB;;AAE7C;AACA;;AAEA;;AAEA,uDAAe,YAAY,EAAC;;;AC3pBO;AACA;AACA;AACU;AACH;;AAE1C,iBAAiB,oBAAW;AAC5B,cAAc,iBAAQ;AACtB,IAAI,gBAAO,GAAG,iBAAQ;;AAEtB,IAAI,kBAAS,GAAG,0BAAsB;;AAEtC;AACA,mHAAmH,kBAAkB;AACrI,cAAc,kBAAkB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,0DAA0D,uBAAuB,gCAAgC,2BAA2B;AAC5I;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,uBAAmB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,0BAA0B,kBAAS;AACnC,2BAA2B,kBAAS;AACpC,2BAA2B,kBAAS;AACpC,wBAAwB,kBAAS;AACjC,yBAAyB,kBAAS;AAClC,uBAAuB,kBAAS;AAChC;AACA;AACA;AACA;AACA,wBAAwB,kBAAS;AACjC,uBAAuB,kBAAS;AAChC;AACA;AACA,6BAA6B,kBAAS;AACtC,SAAS;AACT;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,gBAAW;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;AACpB,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA,oCAAoC,eAAe;AACnD,oCAAoC,eAAe;AACnD,oCAAoC,eAAe;;AAEnD,oCAAoC,eAAe;AACnD,oCAAoC,eAAe;AACnD,oCAAoC,eAAe;AACnD;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,oDAAoD,wBAAmB;AACvE;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,gBAAO;AACnB,YAAY,gBAAO;AACnB,YAAY,gBAAO;;AAEnB,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;AACpB,YAAY,mBAAU;AACtB;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,oBAAoB;AAC3C,YAAY,gBAAO;AACnB,YAAY,uBAAc;AAC1B;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,gBAAO;AACnB,YAAY,gBAAO;AACnB,YAAY,gBAAO;;AAEnB,YAAY,iBAAQ;AACpB,YAAY,iBAAQ;AACpB,YAAY,mBAAU;;AAEtB,YAAY,uBAAc;;AAE1B,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;AACA;;AAEA;AACA,YAAY,mBAAU,SAAS,iBAAQ;AACvC,YAAY,iBAAQ;AACpB,YAAY,uBAAc;AAC1B;AACA,YAAY,mBAAU;AACtB;AACA;AACA;AACA;AACA,kCAAkC,iBAAQ;AAC1C;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,uBAAkB;AACjD;;AAEA;AACA;;AAEA;;AAEA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,oBAAoB;AAC3C;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA;;AAEA,+BAA+B,UAAU;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,uDAAuD;AAC9E,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,qCAAqC,oBAAW;AAChD,QAAQ,oBAAW;AACnB,QAAQ,uBAAc;;AAEtB,gCAAgC,2BAAkB;AAClD,0BAA0B,qBAAY;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;;AAEA;;AAEA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;;AAEA,+BAA+B,mCAAmC;AAClE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED,uBAAuB,4BAAwB;AAC/C,wBAAwB,6BAAyB;AACjD,uBAAuB,4BAAwB;;AAE/C,2BAA2B,gCAA4B;AACvD,yBAAyB,8BAA0B;;AAEnD,qBAAqB,kBAAS;;AAE9B,mDAAe,QAAQ,EAAC;;;AC3jBxB,8DAAe,2CAA2C,wBAAwB,kaAAka,GAAG,CAAC,EAAC;;;ACAvb;;AAElE;AACA;AACA;AACA;AACA,sCAAsC;AACtC,4CAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAI,uBAAsB;AAC1B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,EAAC;;;AC5Ca;AACI;;AAEyB;AACvD,iBAAgB,CAAC,KAAW;;AAE5B;AACA;AACA;AACA;AACA,YAAY,eAAW;AACvB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB,6BAAyB;AAC7C;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,gDAAe,KAAK,EAAC;;;ACtEW;AACI;AACA;AACA;;AAEpC;AACA;AACA;AACA,WAAW,aAAa;AACxB,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,gCAAgC,YAAO;;AAEvC;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA,sBAAsB,YAAO;AAC7B;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,yBAAyB,iBAAQ;AACjC,QAAQ,mBAAU;AAClB;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,sBAAsB,iBAAQ;AAC9B,uBAAuB,OAAO;AAC9B,iBAAiB,iBAAQ;AACzB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,eAAe,aAAa;AAC5B,gBAAgB;AAChB;AACA;AACA,iBAAiB,oBAAW;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAQ;AACpB,YAAY,uBAAc;;AAE1B,0BAA0B,iBAAQ;AAClC;AACA;AACA;AACA;AACA;AACA,0BAA0B,YAAO;AACjC;AACA,qBAAqB,iBAAQ;AAC7B,YAAY,yBAAgB;AAC5B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,+BAA+B,oBAAW;AAC1C,uBAAuB,oBAAW;AAClC,sBAAsB,oBAAW;AACjC;AACA;AACA;AACA;AACA,YAAY,mBAAU;AACtB,YAAY,2BAAkB;AAC9B,4BAA4B,iBAAQ;AACpC;AACA,YAAY,oBAAW;AACvB,YAAY,uBAAc;AAC1B;AACA,YAAY,kBAAS;AACrB,YAAY,2BAAkB;AAC9B,YAAY,kBAAS;AACrB;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAe,KAAK,EAAC;;;ACtKmB;AACZ;;AAEQ;;AAEpC,IAAI,eAAO,GAAG,iBAAQ;AACtB,IAAI,gBAAQ,GAAG,kBAAS;AACxB,uBAAuB,2BAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA,mBAAmB,OAAO;AAC1B,6BAA6B,UAAK;AAClC;;AAEA;AACA;AACA,cAAc;AACd;AACA,2BAA2B,gBAAW;;AAEtC;AACA;AACA,cAAc;AACd;AACA;AACA,mBAAmB,OAAO;AAC1B,2BAA2B,wBAAe;AAC1C;AACA;;AAEA;;AAEA;AACA;AACA;AACA,eAAe,aAAa;AAC5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA,QAAQ,eAAO;AACf;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB,YAAY,eAAO;AACnB;AACA,KAAK;;AAEL;AACA;AACA;AACA,eAAe;AACf,eAAe;AACf,gBAAgB;AAChB;AACA;;AAEA,sBAAsB,oBAAW;;AAEjC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,gBAAQ;AACpB,YAAY,gBAAQ;;AAEpB,2BAA2B,OAAO;AAClC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,mDAAe,OAAO,EAAC;;;ACtLG;AACW;AACA;AACR;;AAEM;AACA;;;AAGnC;AACA;AACA;AACA;AACA,aAAa,eAAW;AACxB;AACA;AACA;AACA,kBAAkB;AAClB;AACA,8BAA8B,YAAO;;AAErC;AACA;AACA,kBAAkB;AAClB;AACA,iCAAiC,YAAO;;AAExC;AACA;AACA,kBAAkB;AAClB;AACA,wBAAwB,YAAO;;AAE/B;AACA;AACA,kBAAkB;AAClB;AACA,qBAAqB,YAAO;AAC5B;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;;AAEA;AACA,QAAQ,8BAA0B;AAClC,QAAQ,mBAAc;;AAEtB;AACA,QAAQ,mBAAc;;AAEtB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,QAAQ,iBAAY;AACpB,QAAQ,mBAAc;AACtB;AACA,KAAK;;AAEL;AACA;AACA;AACA,6CAA6C;;AAE7C;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA,QAAQ,iBAAY;AACpB,QAAQ,mBAAc;AACtB;AACA,KAAK;AACL;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA,eAAe,aAAa;AAC5B,eAAe,SAAS;AACxB,gBAAgB;AAChB;AACA;AACA,iBAAiB,oBAAW;AAC5B;AACA,oDAAoD,QAAG;AACvD;AACA;AACA,YAAY,iBAAQ;AACpB,YAAY,2BAAkB;AAC9B,YAAY,2BAAkB;AAC9B,YAAY,mBAAU;;AAEtB,YAAY,iBAAQ;AACpB,YAAY,2BAAkB;AAC9B,YAAY,2BAAkB;AAC9B,YAAY,mBAAU;AACtB,YAAY,iBAAQ;;AAEpB,YAAY,uBAAc;AAC1B;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED,iDAAe,MAAM,EAAC;;;AC3HI;AACE;AACE;AACe;AACd;AACI;AACD;AACG;;AAErC,eAAe,oBAAW;AAC1B,gBAAgB,oBAAW;;AAE3B,IAAI,qBAAe;;AAEnB,SAAS,mBAAa;AACtB;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;;AAEA,QAAQ,qBAAe;AACvB,eAAe,qBAAe;AAC9B;;AAEA,aAAa,iBAAY;AACzB,IAAI,qBAAe;AACnB;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,aAAa,OAAO;AACpB,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC;;AAEA;AACA;AACA;AACA;AACA,YAAY,eAAW;AACvB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,sCAAsC,gBAAW;;AAEjD;AACA,0BAA0B;;AAE1B;;AAEA;AACA;AACA,0BAA0B;;AAE1B,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,6BAA6B;;AAE7B,2BAA2B;;AAE3B,0BAA0B,QAAQ;;AAElC;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA,4BAA4B,UAAM;AAClC;AACA;AACA;AACA;AACA;AACA,iCAAiC,SAAK;AACtC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,4BAA4B,UAAM;AAClC;AACA;AACA;AACA;AACA;AACA,iCAAiC,SAAK;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8CAA8C,mBAAa;AAC3D;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,oCAAoC;AACpC,eAAe,YAAY;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,uBAAuB,6BAA6B;AACpD;;AAEA;AACA;AACA;AACA;;AAEA,gBAAgB,4BAAmB;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,eAAe,UAAU;AACzB,eAAe,YAAY;AAC3B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA,qCAAqC,gBAAW;AAChD,gCAAgC,YAAO;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;;AAE1C;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kBAAkB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,qBAAqB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA,gDAAe,KAAK,EAAC;;;AC5iBrB;AACA;AACA;AACA;AACA;AACA,CAAC;AACgB;AACjB,IAAI,cAAU;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACqB;AACtB,IAAI,OAAG;AACP;AACA,yBAAyB,cAAU;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,mDAAe,OAAG,EAAC;;;AC7Ga;AACG;AACJ;AACI;AACA;AACnC,IAAI,wBAAY,GAAG,sBAAqB;;AAExC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ,QAAQ;AACR;AACA,kBAAkB,kBAAc;AAChC;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;AAEA;AACA,kBAAkB;AAClB,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D,sBAAsB,oCAAoC;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,kBAAkB;AAClB,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC,sBAAsB,YAAY;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,yBAAyB,YAAY;AACrC;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,yBAAyB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,mBAAmB,wBAAY;AAC/B,mBAAmB,wBAAY;AAC/B;AACA;AACA,mBAAmB,wBAAY;AAC/B,mBAAmB,wBAAY;AAC/B;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,QAAQ,cAAS;AACjB,wBAAwB,uBAAkB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA,sDAAe,WAAW,EAAC;;;AC7QI;;AAE/B;AACA;AACA;AACA;AACA,kBAAkB,iBAAa;AAC/B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA,qBAAqB,+BAA2B;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,yDAAe,WAAW,EAAC;;;ACzDI;AACC;AACQ;AACL;AACF;;AAEjC;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,kBAAkB;AACvC,sBAAsB,mBAAmB;AACzC,0BAA0B,uBAAuB;AACjD,2BAA2B,wBAAwB;AACnD;AACA;AACA;AACA;AACA,kBAAkB,gBAAW;AAC7B;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,CAAC;AACD;AACA,sBAAsB,UAAK;;AAE3B;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,gCAA4B;AACzE,yEAAyE,uBAAuB,GAAG,iBAAiB;AACpH;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;;AAE5C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iEAAiE,+BAA+B;AAChG;;AAEA;AACA;AACA;AACA;AACA,mCAAmC,sBAAsB;AACzD,sCAAsC,oBAAoB;AAC1D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iEAAiE,+BAA+B;AAChG;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA,iCAAiC,yBAAyB;AAC1D,uCAAuC,+BAA+B;;AAEtE,sDAAe,WAAW,EAAC;;;ACvYK;AACM;AACgB;AACb;;AAEzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,yBAAyB,gBAAW;AACpC;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,sBAAsB,YAAO;AAC7B;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C,gBAAgB,kBAAiB,EAAE,UAAU;AAC7C;AACA,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;AAC5D,sBAAsB,uBAAkB,EAAE,uBAAkB;;AAE5D;AACA,2BAA2B,eAAW;;AAEtC;AACA,CAAC;AACD;AACA,gBAAgB,OAAO;AACvB,iBAAiB;AACjB;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,WAAW;AAC3B,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,OAAO;AAC9B;AACA;AACA,YAAY,iBAAY;;AAExB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA,CAAC;;AAED,qDAAe,kBAAkB,EAAC;;;AC9IC;AACW;;AAE9C;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,IAAI,WAAK,GAAG,mBAAe;AAC3B;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA,2BAA2B,oBAAoB;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,+BAA+B,gBAAW;AAC1C;AACA;AACA;AACA,CAAC;;AAED,qDAAe,WAAK,EAAC;;;ACvEc;AACP;AACU;AACA;AACQ;AACV;;AAEpC,sBAAsB,YAAO;;AAE7B;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA,WAAW,mBAAe;AAC1B;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA,2BAA2B,uBAAkB;AAC7C;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,gBAAW;AAC1C;AACA;AACA;AACA,CAAC;;AAED;;AAEA;;AAEA,oBAAoB,cAAK;AACzB;AACA;AACA,KAAK;;AAEL;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E;AACA;AACA,YAAY,sBAAiB,2BAA2B,uBAAkB;AAC1E,YAAY,oBAAe;AAC3B;AACA;AACA;AACA;AACA;;AAEA,oDAAe,IAAI,EAAC;;;ACzIpB,kDAAe,oFAAoF,yDAAyD,qCAAqC,+BAA+B,gBAAgB,uDAAuD,2DAA2D,GAAG,mGAAmG,2DAA2D,4CAA4C,iCAAiC,+BAA+B,wFAAwF,oCAAoC,gDAAgD,iDAAiD,4CAA4C,8CAA8C,gEAAgE,+HAA+H,kEAAkE,oEAAoE,sEAAsE,2DAA2D,0DAA0D,GAAG,OAAO,EAAC;;;ACAj7C;AAC2B;AACiB;AACb;AACI;AACF;AACqB;AAChB;;AAEmB;AACzD,iBAAa,CAAC,WAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA,aAAa,eAAW;;AAExB,2BAA2B,UAAM;AACjC,gBAAgB,iBAAa;AAC7B,kBAAkB,iBAAa;AAC/B,KAAK;AACL,uBAAuB,YAAQ;AAC/B;AACA;AACA,KAAK;;AAEL;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA,sBAAsB,aAAY;;AAElC;;AAEA;;AAEA;;AAEA,0BAA0B,kBAAiB;AAC3C;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA,+BAA+B,kBAAc;AAC7C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,QAAQ,mBAAc;AACtB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,oDAAe,MAAM,EAAC;;;ACrJQ;;AAE9B,8CAAe,aAAM,E;;ACFY;AACI;AACI;;AAEzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB;;AAEzB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,wCAAoC;AACrE;AACA;AACA;AACA,iCAAiC,yCAAqC;AACtE;AACA;AACA;AACA,iCAAiC,yCAAqC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,gBAAgB;AACvC;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA,aAAa;AACb;AACA,2BAA2B,iBAAiB;AAC5C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0CAAe,GAAG,EAAC;;;AC3Jc;AACI;AACrC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,UAAU;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,OAAO;AAC7D;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,IAAI,OAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA,cAAc,UAAU;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,WAAW;AAClC;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,aAAS;AACnC;AACA;AACA;AACA;AACA;AACA,uBAAuB,iBAAa;AACpC;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA,0CAAe,OAAG,EAAC;;;AChLkB;AACI;AACL;AACuB;AACnB;AACX;;AAEL;AACA;;AAExB;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,SAAS;AACzB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,wBAAwB,aAAa;AACrC;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,wBAAwB,SAAS;AACjC;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,eAAW;AACrC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,OAAO;AACvB,gBAAgB,iBAAiB;AACjC,gBAAgB,OAAO;AACvB,gBAAgB,QAAQ;AACxB,gBAAgB,OAAO;AACvB,gBAAgB,SAAS;AACzB,gBAAgB,SAAS;AACzB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,eAAe;AAC/B,gBAAgB,iBAAiB;AACjC,gBAAgB,OAAO;AACvB,gBAAgB,QAAQ;AACxB;AACA;AACA,qCAAqC,cAAkB;AACvD,0BAA0B,OAAO;AACjC,uBAAuB,SAAK;AAC5B,SAAS;AACT;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,mCAAmC;AAClD,eAAe,QAAQ;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,mCAAmC;AAClD,eAAe,QAAQ;AACvB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,QAAQ,uBAAkB;AAC1B;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,YAAY;AACnC,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,aAAS;AACnC;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAA0B,aAAS;AACnC;AACA,SAAS;;AAET;AACA;AACA;;AAEA,mDAAe,WAAW,EAAC;;;ACvT3B;AACA;AACA;AACA;AACA;AACA;AACA;;AAE6C;AACC;AACA;;AAE9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,uBAAuB;AAClC;AACA;AACA;AACA,wBAAwB,aAAS;AACjC;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,oCAAgC;AAC5C;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,UAAU;AACzB,eAAe,eAAe;AAC9B,eAAe,kBAAkB;AACjC;AACA;;AAEA,qBAAqB,YAAO;AAC5B,qBAAqB,YAAO;AAC5B,qBAAqB,YAAO;AAC5B,sBAAsB,YAAO;AAC7B,sBAAsB,YAAO;AAC7B,sBAAsB,YAAO;AAC7B,qBAAqB,YAAO;;AAE5B,yBAAyB,YAAO;;AAEhC;AACA;AACA;AACA;AACA,sBAAsB,gBAAW;AACjC,wBAAwB,kBAAa;;AAErC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,kBAAa;AACzB,YAAY,wBAAmB;AAC/B,YAAY,wBAAmB;;AAE/B;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,0DAAe,cAAc,E;;AChLE;AAC/B;AACA;AACA;AACA;AACA,mBAAmB,iBAAa;AAChC;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA,qBAAqB,+BAA2B;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,0DAAe,YAAY,EAAC;;;ACjE5B,kDAAe,0FAA0F,qCAAqC,uCAAuC,0BAA0B,gBAAgB,yBAAyB,2DAA2D,GAAG,OAAO,EAAC;;;ACA9R;AACiB;AACX;AACP;AACI;AACR;AACS;AACgC;;AAEpE,iBAAgB,CAAC,WAAU;;AAE3B,mBAAmB,cAAK;AACxB,eAAe,QAAI;AACnB;AACA;AACA,CAAC;AACD,iBAAiB,mBAAW;;AAE5B;AACA;AACA;AACA;AACA,WAAW,gBAAW;AACtB;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;;AAED,qBAAqB,UAAM,CAAC,iBAAa;AACzC,uBAAuB,YAAQ;AAC/B;AACA,KAAK;AACL;;AAEA;;AAEA,CAAC;AACD;AACA;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA,mCAAmC,wBAAwB;AAC3D;AACA,KAAK;AACL;AACA,gBAAgB,aAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,iBAAiB;AACjC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA,CAAC;;AAED,sDAAe,IAAI,EAAC;;;AC3MpB,yDAAe,+FAA+F,yCAAyC,qCAAqC,mDAAmD,iEAAiE,kEAAkE,gFAAgF,iDAAiD,sCAAsC,+DAA+D,GAAG,wDAAwD,yCAAyC,2CAA2C,2CAA2C,oBAAoB,GAAG,eAAe,4CAA4C,oBAAoB,0BAA0B,UAAU,+BAA+B,aAAa,aAAa,iBAAiB,iBAAiB,kBAAkB,mBAAmB,OAAO,2EAA2E,2BAA2B,oCAAoC,oCAAoC,0CAA0C,mBAAmB,0CAA0C,uCAAuC,kCAAkC,2BAA2B,mBAAmB,IAAI,IAAI,6DAA6D,GAAG,GAAG,EAAC;;;ACA3/C,qDAAe,gIAAgI,qCAAqC,uCAAuC,gCAAgC,0BAA0B,+BAA+B,yFAAyF,kEAAkE,gFAAgF,iDAAiD,sCAAsC,+DAA+D,GAAG,eAAe,oCAAoC,gDAAgD,cAAc,qCAAqC,2BAA2B,iDAAiD,kBAAkB,mBAAmB,OAAO,8EAA8E,2BAA2B,0CAA0C,mBAAmB,2EAA2E,sBAAsB,IAAI,IAAI,uEAAuE,GAAG,GAAG,EAAC;;;ACAnyC;AACA;AACA;AACqC;AACI;AACR;AACQ;AACH;AACH;AACJ;AACO;AACT;AAC8B;AACvB;AACA;;AAEiC;AACV;;AAE3D;;AAEA,IAAI,eAAO;;AAEX;AACA;AACA;AACA,YAAY,cAAc;AAC1B,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY,eAAe;AAC3B,YAAY,eAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,iCAAiC,eAAW;AAC5C;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA,gCAAgC,YAAQ;AACxC,oBAAoB,UAAM;AAC1B,oBAAoB,iBAAa;AACjC,sBAAsB,cAAiB;AACvC,SAAS;AACT,KAAK;AACL;;AAEA;AACA;;AAEA,yBAAyB,SAAK;AAC9B;;AAEA;AACA;AACA,6BAA6B,eAAW;AACxC;AACA;AACA;AACA,kCAAkC,iBAAa;AAC/C,gBAAgB,sBAAkB;AAClC,SAAS;AACT,QAAQ,8BAA6B;AACrC;AACA;AACA,SAAS;AACT;AACA;AACA,iBAAiB,aAAM;AACvB;AACA;AACA,KAAK;AACL;;AAEA,yBAAyB,cAAkB;AAC3C;AACA,KAAK;;AAEL;AACA;AACA,gDAAgD,yBAAqB;AACrE;;AAEA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA,KAAK;AACL,0BAA0B,eAAW;AACrC;AACA,KAAK;AACL,oBAAoB,WAAM,iBAAiB,yBAAqB;AAChE,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,KAAK,eAAO,QAAQ;AAC3C;AACA;AACA;;AAEA,8CAA8C,eAAO;AACrD;AACA;AACA;AACA;AACA,gBAAgB,gBAAY;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,mBAAmB;AACjD;AACA;AACA;AACA;;AAEA;AACA,iDAAiD,eAAO;AACxD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,eAAW;AACrC;AACA,KAAK;AACL,mBAAmB,eAAI;AACvB,kBAAkB,kBAAuB;AACzC,KAAK;;AAEL,sBAAsB,aAAS;AAC/B;AACA;AACA,cAAc,sBAAkB;AAChC,eAAe,yBAAqB;AACpC,eAAe,yBAAqB;AACpC,mBAAmB,mBAAe;AAClC,mBAAmB,mBAAe;AAClC;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,aAAS;AAC1C;AACA;AACA,cAAc,iBAAa;AAC3B,mBAAmB,mBAAe;AAClC,mBAAmB,mBAAe;AAClC,eAAe,yBAAqB;AACpC,eAAe,yBAAqB;AACpC;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;AACA;;AAEA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,gBAAgB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,mDAAe,WAAW,EAAC;;;AC9R3B;AAC6B;AACa;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,gBAAY;;AAEtC;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA,CAAC;;AAED;;AAEA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,uCAAsC;AAC7E,+BAA+B,0BAAyB;AACxD;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,oCAAmC;AACxD;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED,qDAAe,mBAAmB,EAAC;;;AClGN;AACO;;AAEpC;AACA;AACA;AACA;AACA;AACA,qBAAqB,gBAAY;;AAEjC;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA,CAAC;AACD,mCAAmC,wBAAmB;AACtD,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,+BAA+B,kCAAkC;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED,gDAAe,cAAc,EAAC;;;ACtD9B,yDAAe,oCAAoC,0BAA0B,mGAAmG,2EAA2E,0EAA0E,2EAA2E,wEAAwE,0EAA0E,+BAA+B,mCAAmC,sBAAsB,sBAAsB,sBAAsB,gBAAgB,cAAc,IAAI,qBAAqB,YAAY,IAAI,qBAAqB,YAAY,IAAI,qBAAqB,YAAY,IAAI,qBAAqB,cAAc,IAAI,qBAAqB,cAAc,IAAI,qBAAqB,cAAc,IAAI,qBAAqB,wBAAwB,IAAI,QAAQ,oBAAoB,IAAI,GAAG,8BAA8B,2BAA2B,uBAAuB,kBAAkB,iCAAiC,OAAO,gDAAgD,qCAAqC,qFAAqF,kDAAkD,mCAAmC,6DAA6D,wDAAwD,wBAAwB,IAAI,2BAA2B,GAAG,gBAAgB,yJAAyJ,oCAAoC,GAAG,CAAC,EAAC;;;ACA1wD;AACiC;AACQ;AACJ;AACC;AACF;AACE;AACE;AACmB;AAC9B;AACO;AACpC;;AAEqE;;AAErE,IAAI,UAAO;;AAEX;AACA;AACA,wBAAwB,aAAS;AACjC;AACA;AACA,cAAc,iBAAa;AAC3B,KAAK;AACL,mBAAmB,eAAI;AACvB,kBAAkB,kBAAuB;AACzC,KAAK;AACL;AACA;;AAEA,0BAA0B,eAAW;AACrC;AACA;;AAEA;AACA;AACA,qBAAqB,wBAAmB;AACxC,uCAAuC,gBAAY,EAAE,iBAAa;;AAElE,oBAAoB,wBAAmB;AACvC,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,wBAAmB;AACvC,iBAAiB,oBAAW;AAC5B,gBAAgB,oBAAW;AAC3B,sBAAsB,oBAAW;AACjC,mBAAmB,OAAO;AAC1B,qBAAqB,oBAAW;AAChC,uBAAuB,KAAK,UAAO,QAAQ;AAC3C,oCAAoC,UAAO;;AAE3C,6BAA6B,oBAAW;AACxC;AACA;AACA,4CAA4C,UAAO;AACnD,2BAA2B,YAAY;AACvC,+BAA+B,WAAW;;AAE1C;AACA;AACA;AACA;AACA,oBAAoB,uBAAc;;AAElC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,yBAAgB;AACpC;AACA;AACA;AACA;AACA,YAAY,yBAAgB;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,QAAQ;AACpB;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,yBAAyB,SAAK;AAC9B;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,qBAAqB,aAAM;AAC3B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,0BAA0B,aAAS;AACnC;AACA;AACA,KAAK;AACL,0BAA0B,eAAW;AACrC;AACA;AACA;AACA;AACA;AACA,yBAAyB,cAAkB;AAC3C;AACA,KAAK;AACL;AACA,mBAAmB,KAAK,UAAO,QAAQ;AACvC,mBAAmB,UAAO;AAC1B,0CAA0C,UAAO;AACjD;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,gBAAY,EAAE,yBAAqB,aAAa,UAAO;AACnE;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,8CAAe,EAAE,EAAC;;;ACvN6B;;AAE/C;;AAEA;AACA,+CAA+C,SAAS;AACxD;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,yBAAyB;AACxC,eAAe,OAAO;AACtB;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,8BAAoB;AACvC,kBAAkB,0BAAgB;AAClC;AACA,iBAAiB;AACjB;AACA;AACA;AACA,mBAAmB,8BAAoB;AACvC,kBAAkB,0BAAgB;AAClC;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA,oDAAe,QAAQ,E;;ACvCY;AACW;;AAE9C;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA,aAAa,mBAAe;AAC5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA,CAAC;AACD;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC,uBAAuB,oBAAoB;AAC3C;AACA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA2B,YAAY;AACvC,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,mBAAmB,oBAAoB;AACvC,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,gBAAW;AAC1C;AACA;AACA;AACA,CAAC;;AAED,sDAAe,MAAM,EAAC;;;AC1IO;;AAE7B;AACA;AACA;AACA;AACA,mBAAmB,gBAAY;;AAE/B;;AAEA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;;AAED,8CAAe,YAAY,EAAC;;;AChCC;AACS;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,uBAAuB,gBAAY;AACnC;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA,uDAAuD,YAAO;AAC9D;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB,8BAA0B;AAC9C;AACA;AACA;AACA;AACA,CAAC;;AAED,kDAAe,gBAAgB,EAAC;;;ACvEH;;AAE7B;AACA;AACA;AACA;AACA,iBAAiB,gBAAY;AAC7B;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB,8BAA0B;AAC9C;AACA;AACA;AACA,CAAC;;AAED,4CAAe,UAAU,EAAC;;;ACrDG;AACS;;AAEtC;AACA;AACA;AACA;AACA,gBAAgB,gBAAY;AAC5B;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,CAAC;;AAED;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,uDAAuD,YAAO;AAC9D;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,oBAAoB,8BAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,2CAAe,SAAS,EAAC;;;ACpGW;;AAEpC;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,wBAAe;;AAEhC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAsB;AACtC,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,kBAAS;AACxB,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,sBAAa;AAC5B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,iBAAQ;AACvB,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;AACL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,yBAAgB;AACxB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,qBAAY;AAC3B,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,eAAe,6BAAoB;AACnC,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,oBAAW;AAC1B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,2BAAkB;AACjC,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,2BAAkB;AAC1B;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,IAAI,sBAAc;AAClB;AACA,IAAI,sBAAc;;AAElB,QAAQ,aAAK;AACb;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,IAAI,sBAAc,CAAC,aAAK;AACxB;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,sBAAa;AACxB;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,iBAAQ;AACnB;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;;AAEA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,yBAAgB;AACpB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,qBAAY;AACvB;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,oBAAW;AACtB;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,2BAAkB;AACtB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;;;AC5sBvB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,OAAO;AAClB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,aAAa,KAAK;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,KAAK;AAChB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB,WAAW,KAAK;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,oDAAe,IAAI,E;;AChQiB;;AAEpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,oBAAW;;AAE5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,yBAAgB;AAC/B,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,yBAAgB;AAC3B;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB,YAAY,QAAQ;AACpB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;;AC7RvB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE4C;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,aAAa,MAAM;AACnB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA,kBAAkB,gBAAgB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;;AAGA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,OAAO;AAClB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,KAAK;AAChB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,WAAW,MAAM;AACjB,WAAW,KAAK;AAChB,aAAa,MAAM;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,MAAM;AACjB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;;AAGA,qDAAe,KAAK,E;;ACvPkB;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,qBAAY;;AAE7B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,0BAAiB;AAChC,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,wBAAe;AACvB;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,WAAW,0BAAiB;AAC5B;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,cAAc;AAC1B,YAAY,cAAc;AAC1B,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,wBAAe;AACnB;AACA;AACA;;AAEA,oDAAe,QAAQ,EAAC;;;AC5QY;;AAEpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,iBAAiB,oBAAW;;AAE5B;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,gBAAgB,sBAAsB;AACtC;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,qBAAY;AACpB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,kBAAS;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,eAAe,yBAAgB;AAC/B,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,gBAAgB;AAChC,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,iBAAQ;AAChB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,sBAAa;AACrB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA,QAAQ,oBAAW;AACnB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,mBAAU;AAClB;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,aAAa;AAC7B,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,aAAa;AAC5B;AACA;AACA,QAAQ,4BAAmB;AAC3B;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,QAAQ,uBAAc;AACtB;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,qBAAY;AAChB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,kBAAS;AACb;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,WAAW,yBAAgB;AAC3B;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,iBAAQ;AACZ;AACA;AACA;;AAEA;AACA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,cAAc;AAC1B,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,gBAAgB;AAC5B,YAAY;AACZ;AACA;AACA,IAAI,sBAAa;AACjB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,4BAAmB;AACvB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,OAAO;AACnB,YAAY;AACZ;AACA;AACA,IAAI,oBAAW;AACf;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,mBAAU;AACd;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA;AACA,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY;AACZ;AACA;AACA,IAAI,uBAAc;AAClB;AACA;AACA;;AAEA,mDAAe,OAAO,EAAC;;;AC3YvB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAe,MAAM,EAAC;;;AClMa;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,gBAAW;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,qDAAe,IAAI,EAAC;;;AC7DU;AAC9B,IAAI,oBAAc;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAY;AACrB;AACA;AACA;AACA,SAAS,mBAAa;AACtB;AACA;AACA;AACA,SAAS,mBAAa;AACtB;AACA;AACA,SAAS,iBAAW;AACpB;AACA;AACA,eAAe,kBAAY;AAC3B;AACA,WAAW,kBAAY;AACvB;AACA,SAAS,mBAAa;AACtB;AACA;AACA,eAAe,mBAAa;AAC5B;AACA,WAAW,mBAAa;AACxB;AACA,SAAS,iBAAW;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gBAAU;AACnB;AACA;AACA,SAAS,aAAO;AAChB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAQ;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,gBAAU,OAAO,YAAG;AACxB,IAAI,oBAAc;AAClB,SAAS,gBAAU;AACnB,QAAQ,oBAAc;AACtB,QAAQ,cAAQ,CAAC,oBAAc;AAC/B;AACA,IAAI,oBAAc,GAAG,gBAAU,eAAe,oBAAc;AAC5D;AACO;AACP;AACA;AACA;AACA;AACA,iBAAiB,gBAAU;AAC3B;AACA,eAAe,cAAQ;AACvB;AACA;AACA;AACA,eAAe,oBAAc;AAC7B,QAAQ,cAAQ,UAAU,oBAAc;AACxC,QAAQ,gBAAU;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAO;AACvB;AACA;AACA,YAAY,aAAO;AACnB,YAAY,gBAAU;AACtB;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAO;AACvB;AACA;AACA,YAAY,aAAO;AACnB,YAAY,gBAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,aAAO;AACjC,0BAA0B,aAAO;AACjC;AACA,wBAAwB,mBAAa;AACrC;AACA;AACA,oBAAoB,aAAO;AAC3B;AACA;AACA,gBAAgB,aAAO,UAAU,iBAAW,aAAa,iBAAW,aAAa,iBAAW;AAC5F,gBAAgB,gBAAU;AAC1B;AACA;AACA;AACA,oBAAoB,aAAO;AAC3B;AACA;AACA,4BAA4B,mBAAa;AACzC,gBAAgB,eAAS;AACzB,gBAAgB,gBAAU;AAC1B;AACA;AACA;AACA,oBAAoB,aAAO;AAC3B;AACA;AACA,gBAAgB,eAAS;AACzB,gBAAgB,gBAAU;AAC1B;AACA;AACA;AACA;AACA;AACA,IAAI,aAAO;AACX;AACA;AACA,SAAS,eAAS;AAClB;AACA,YAAY,mBAAa;AACzB,YAAY,mBAAa;AACzB;AACA;AACA;AACA,IAAI,aAAO,OAAO,kBAAY,CAAC,iBAAW,4BAA4B,kBAAY,CAAC,iBAAW,oBAAoB,kBAAY,CAAC,iBAAW;AAC1I;AACA;AACA;AACA;AACA;AACA,SAAS,eAAS;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,kBAAY,CAAC,gBAAU;AACpC,aAAa,kBAAY,CAAC,gBAAU;AACpC,aAAa,kBAAY,CAAC,gBAAU;AACpC,aAAa,mBAAa,CAAC,gBAAU;AACrC;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kBAAY,CAAC,gBAAU;AAC/B,QAAQ,kBAAY,CAAC,gBAAU;AAC/B,QAAQ,kBAAY,CAAC,gBAAU;AAC/B,QAAQ,mBAAa,CAAC,gBAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACP;AACA;AACA,mBAAmB,eAAS;AAC5B,oCAAoC,mBAAa;AACjD,oCAAoC,mBAAa;AACjD,oCAAoC,mBAAa;AACjD,yBAAyB,eAAS;AAClC;AACA;AACO;AACP;AACA;AACA,sBAAsB,mBAAa;AACnC;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;;;ACpZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,kBAAa;AACjB;AACA;AACA;AACA,gCAAgC,EAAE;AAClC;AACA;AACO;AACP;AACA;AACA;AACO,SAAS,SAAI;AACpB;AACA;AACO;AACP;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,SAAS;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,SAAS;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,kDAAkD,SAAS;AAC3D;AACA;AACA;AACA;AACO,SAAS,WAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAQ;AACxB;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,2CAA2C,SAAS;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,aAAQ;AAChB;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,uCAAuC,kBAAa;AACpD;AACA;AACA;AACA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA,qCAAqC,SAAS;AAC9C;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACiB;AACV;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO,SAAS,kBAAQ;AACxB;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACkB;AACZ;AACP;AACA;AACO;AACP;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA,QAAQ,WAAM;AACd;AACA;AACA;AACO;AACP;AACA;AACO,SAAS,SAAI,IAAI;;;AC5eE;AACa;AACoB;AAC3D;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACO;AACP;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,aAAa;AAC9C;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,UAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACO;AACP,QAAQ,WAAW;AACnB;AACA,YAAY,WAAW;AACvB;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,WAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,KAAW;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,eAAe;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,mBAAmB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,KAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,IAAI;AAClD;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,wBAAwB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,cAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,8BAA8B;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,mBAAmB;AACtD;AACA;AACA;AACA;AACA,uCAAuC,wBAAwB;AAC/D;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,IAAI;AACrC,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,yDAAe,QAAQ,EAAC;;;ACvuB8B;;AAEtD;;AAEA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,oDAAoD,OAAO;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,2BAA2B,kBAAQ;AACnC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;;AAEA,2DAAe,eAAe,E;;AC5F9B,gDAAe,sDAAsD,6DAA6D,2EAA2E,6BAA6B,GAAG,uFAAuF,oDAAoD,2BAA2B,6CAA6C,mCAAmC,6CAA6C,2BAA2B,qCAAqC,8BAA8B,uCAAuC,GAAG,4GAA4G,kCAAkC,6DAA6D,qCAAqC,GAAG,yCAAyC,cAAc,GAAG,yFAAyF,2EAA2E,oEAAoE,uCAAuC,8BAA8B,cAAc,GAAG,iFAAiF,2FAA2F,gCAAgC,GAAG,+KAA+K,oCAAoC,GAAG,iFAAiF,kCAAkC,oBAAoB,IAAI,aAAa,kBAAkB,4EAA4E,yCAAyC,6BAA6B,eAAe,GAAG,2HAA2H,wFAAwF,uBAAuB,WAAW,+BAA+B,iFAAiF,uBAAuB,WAAW,kEAAkE,qKAAqK,GAAG,oCAAoC,sJAAsJ,GAAG,4FAA4F,+BAA+B,mFAAmF,gDAAgD,gDAAgD,uBAAuB,6CAA6C,sDAAsD,8CAA8C,mMAAmM,GAAG,iCAAiC,kDAAkD,GAAG,4DAA4D,iCAAiC,+BAA+B,GAAG,8GAA8G,yBAAyB,qDAAqD,GAAG,yBAAyB,qDAAqD,GAAG,iDAAiD,wBAAwB,oDAAoD,GAAG,6FAA6F,8BAA8B,8BAA8B,2OAA2O,4HAA4H,qCAAqC,sCAAsC,qCAAqC,0DAA0D,oCAAoC,4CAA4C,0CAA0C,GAAG,4GAA4G,uDAAuD,0EAA0E,iEAAiE,mDAAmD,GAAG,mEAAmE,wBAAwB,wBAAwB,wBAAwB,wBAAwB,wBAAwB,oEAAoE,GAAG,OAAO,EAAC;;;ACA17K,kDAAe,iGAAiG,6DAA6D,6BAA6B,6EAA6E,uCAAuC,iCAAiC,4EAA4E,qCAAqC,2CAA2C,2CAA2C,4BAA4B,gCAAgC,mFAAmF,gEAAgE,yEAAyE,gCAAgC,6EAA6E,8EAA8E,gEAAgE,0GAA0G,gEAAgE,mFAAmF,yEAAyE,oHAAoH,6BAA6B,gEAAgE,6BAA6B,yJAAyJ,2GAA2G,kDAAkD,sDAAsD,uBAAuB,kCAAkC,0EAA0E,gDAAgD,GAAG,gEAAgE,uBAAuB,kCAAkC,0EAA0E,qCAAqC,GAAG,+JAA+J,uCAAuC,2DAA2D,yGAAyG,IAAI,gHAAgH,gCAAgC,wEAAwE,iCAAiC,iCAAiC,8DAA8D,0EAA0E,0EAA0E,kCAAkC,gCAAgC,wBAAwB,kCAAkC,gCAAgC,mCAAmC,qDAAqD,oDAAoD,KAAK,6HAA6H,yBAAyB,2BAA2B,6HAA6H,+EAA+E,mEAAmE,IAAI,4HAA4H,yBAAyB,2BAA2B,iIAAiI,iEAAiE,6CAA6C,6BAA6B,qDAAqD,0BAA0B,IAAI,IAAI,yHAAyH,4BAA4B,wBAAwB,0IAA0I,gDAAgD,8BAA8B,sBAAsB,4GAA4G,mCAAmC,oEAAoE,oGAAoG,iKAAiK,4DAA4D,iKAAiK,8DAA8D,iPAAiP,gCAAgC,YAAY,kDAAkD,+DAA+D,sDAAsD,qFAAqF,+DAA+D,KAAK,qHAAqH,iCAAiC,cAAc,gGAAgG,sDAAsD,4DAA4D,yDAAyD,KAAK,mBAAmB,EAAC;;;ACA3oN,iDAAe,qFAAqF,0EAA0E,oCAAoC,sGAAsG,uBAAuB,iEAAiE,8BAA8B,qEAAqE,6DAA6D,wBAAwB,0BAA0B,4EAA4E,8BAA8B,gEAAgE,4EAA4E,8GAA8G,0DAA0D,+IAA+I,8BAA8B,8CAA8C,yEAAyE,yBAAyB,0BAA0B,wBAAwB,sDAAsD,kLAAkL,0DAA0D,+BAA+B,0DAA0D,uHAAuH,0IAA0I,iDAAiD,uGAAuG,OAAO,EAAC;;;ACA3oE,mDAAe,oQAAoQ,uBAAuB,oFAAoF,+BAA+B,kBAAkB,qIAAqI,yEAAyE,kDAAkD,4CAA4C,wDAAwD,8OAA8O,+BAA+B,iCAAiC,8BAA8B,8EAA8E,8CAA8C,2CAA2C,yEAAyE,yBAAyB,0BAA0B,6RAA6R,4NAA4N,0DAA0D,+BAA+B,6FAA6F,mCAAmC,gIAAgI,uBAAuB,yDAAyD,gDAAgD,2BAA2B,UAAU,IAAI,uCAAuC,0EAA0E,oCAAoC,0EAA0E,6CAA6C,oFAAoF,yBAAyB,SAAS,6DAA6D,IAAI,4DAA4D,gCAAgC,cAAc,mFAAmF,KAAK,4IAA4I,wBAAwB,wEAAwE,IAAI,yBAAyB,6BAA6B,SAAS,uDAAuD,8CAA8C,+BAA+B,yEAAyE,wCAAwC,IAAI,2EAA2E,uDAAuD,IAAI,8CAA8C,0IAA0I,iDAAiD,qGAAqG,SAAS,EAAC;;;ACAxgI,qDAAe,kPAAkP,uBAAuB,uEAAuE,yBAAyB,2BAA2B,gFAAgF,+BAA+B,kBAAkB,qIAAqI,yEAAyE,kDAAkD,4CAA4C,mHAAmH,mEAAmE,0DAA0D,kTAAkT,2EAA2E,+BAA+B,iCAAiC,gCAAgC,iCAAiC,iCAAiC,8EAA8E,8CAA8C,kCAAkC,gCAAgC,2CAA2C,yEAAyE,yBAAyB,0BAA0B,8nBAA8nB,oDAAoD,GAAG,uCAAuC,4BAA4B,wCAAwC,GAAG,kBAAkB,4BAA4B,sCAAsC,gDAAgD,kFAAkF,kCAAkC,+HAA+H,yBAAyB,yGAAyG,6CAA6C,8CAA8C,2CAA2C,mDAAmD,+BAA+B,+GAA+G,6CAA6C,+BAA+B,gDAAgD,UAAU,IAAI,uCAAuC,0EAA0E,oCAAoC,wHAAwH,kCAAkC,iCAAiC,4CAA4C,iDAAiD,wFAAwF,6BAA6B,cAAc,gEAAgE,KAAK,8DAA8D,gCAAgC,cAAc,kFAAkF,KAAK,8IAA8I,wBAAwB,wEAAwE,IAAI,6BAA6B,iCAAiC,cAAc,8CAA8C,0CAA0C,+BAA+B,qDAAqD,0CAA0C,+BAA+B,yEAAyE,4CAA4C,IAAI,gDAAgD,uBAAuB,sDAAsD,KAAK,2EAA2E,0DAA0D,2CAA2C,8BAA8B,uFAAuF,8DAA8D,kBAAkB,qBAAqB,qCAAqC,cAAc,gGAAgG,iFAAiF,KAAK,6EAA6E,kCAAkC,0IAA0I,iDAAiD,2EAA2E,qGAAqG,SAAS,EAAC;;;ACA91M,oDAAe,sOAAsO,+BAA+B,8CAA8C,iDAAiD,2CAA2C,qRAAqR,uOAAuO,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,gCAAgC,iCAAiC,wBAAwB,8BAA8B,4BAA4B,wDAAwD,IAAI,2BAA2B,oEAAoE,IAAI,wCAAwC,8EAA8E,IAAI,6CAA6C,kFAAkF,IAAI,6CAA6C,kFAAkF,IAAI,6CAA6C,kFAAkF,IAAI,wBAAwB,qEAAqE,IAAI,gBAAgB,GAAG,gDAAgD,kBAAkB,2DAA2D,gCAAgC,yFAAyF,+BAA+B,wCAAwC,yDAAyD,gDAAgD,2BAA2B,UAAU,IAAI,8BAA8B,+BAA+B,0EAA0E,oCAAoC,0EAA0E,oFAAoF,yBAAyB,SAAS,6DAA6D,IAAI,4DAA4D,gCAAgC,cAAc,mFAAmF,KAAK,4IAA4I,wBAAwB,wEAAwE,IAAI,yBAAyB,6BAA6B,SAAS,uDAAuD,sDAAsD,+BAA+B,yEAAyE,wCAAwC,IAAI,2EAA2E,8CAA8C,IAAI,oFAAoF,IAAI,SAAS,EAAC;;;ACAtxH,kDAAe,wFAAwF,uCAAuC,uCAAuC,yDAAyD,8BAA8B,wCAAwC,0BAA0B,gBAAgB,8EAA8E,8BAA8B,mEAAmE,gCAAgC,2BAA2B,KAAK,uFAAuF,EAAC;;;ACAloB;AACQ;AACE;AACJ;AACF;AACI;AACN;AACM;AACI;AACV;AACO;AACM;AACJ;AACoB;AACV;AAChB;AACN;;AAEsB;AACF;AACF;;AAEA;AACQ;AACZ;AACF;;AAEgB;AACE;;AAEhE;AAC8C;AACA;AACA;;AAEM;;AAEN;AACE;AACF;AACA;;AAEJ;AACJ;AACgB;AACR;;AAEE;AAChD;;AAE6D;AACA;AACZ;AACF;AACI;AACI;AACF;AACJ;;AAEjD,cAAc,kBAAgB,EAAE,oBAAe;;AAE/C,iBAAa,CAAC,SAAQ;AACtB,iBAAa,CAAC,SAAQ;AACtB,iBAAa,CAAC,WAAU;AACxB,iBAAa,CAAC,UAAS;AACvB,iBAAa,CAAC,YAAW;AACzB,iBAAa,CAAC,cAAa;AAC3B,iBAAa,CAAC,aAAY;AAC1B,iBAAa,CAAC,WAAU;;AAExB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,oBAAoB,8BAA0B;AAC9C,yBAAyB,mCAA+B;;AAExD,8BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,mCAA+B;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,WAAW,OAAO;AAClB,WAAW,0CAA0C;AACrD,WAAW,4BAA4B;AACvC,WAAW,OAAO;AAClB;AACA,sCAAkC;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,qBAAqB,YAAQ;;AAE7B,iBAAiB,QAAM;;AAEvB,iBAAiB,QAAI;;AAErB,mBAAmB,UAAM;;AAEzB,qBAAqB,YAAQ;;AAE7B,oBAAoB,WAAO;;AAE3B,sBAAsB,aAAS;;AAE/B;AACA,qBAAqB,YAAQ;AAC7B,2BAA2B,eAAc;AACzC,0BAA0B,cAAa;AACvC,yBAAyB,aAAY;;AAErC;AACA,yBAAyB,OAAY;AACrC,6BAA6B,WAAgB;AAC7C,uBAAuB,KAAU;AACjC,sBAAsB,IAAS;;AAE/B;AACA,8BAA8B,kBAAiB;AAC/C,+BAA+B,mBAAkB;;AAEjD;AACA,oBAAoB,YAAO;AAC3B,oBAAoB,YAAO;AAC3B,oBAAoB,YAAO;;AAE3B,uBAAuB,eAAU;;AAEjC,oBAAoB,YAAO;AAC3B,qBAAqB,aAAQ;AAC7B,oBAAoB,YAAO;AAC3B,oBAAoB,YAAO;;AAE3B,kBAAkB,UAAK;AACvB,gBAAgB,QAAG;AACnB,wBAAwB,gBAAW;AACnC,oBAAoB,YAAO;;AAE3B;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB,wBAAuB;AACxC;AACA;;;AAGA,SAAS,2BAAiB;AAC1B;AACA;AACA,SAAS,oCAA0B;AACnC,2BAA2B,kBAAc,sBAAsB,kBAAc;AAC7E;AACA,oBAAoB,2BAAiB;AACrC,qBAAqB,2BAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0CAA0C;AACrD,WAAW,4BAA4B;AACvC,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;;AAEA,sEAAsE,YAAQ;;AAE9E;AACA;AACA;AACA;AACA,8BAA8B,mBAAc;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;;AAEA,YAAY,oCAA0B;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,wBAAuB;AACrD;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,+BAA+B,iBAAiB;AAChD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,oCAA0B;;AAE9C;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO,EAAE;AACrB;AACA;AACA;AACA;AACA,mBAAmB,0BAAqB;;AAExC,6BAA6B,cAAmB;AAChD,mBAAmB,0BAAqB;AACxC,KAAK;AACL,wBAAwB,SAAc;AACtC,mBAAmB,0BAAqB;AACxC;AACA,KAAK;;;AAGL;AACA;AACA,KAAK;AACL;AACA;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA,iCAAiC,6BAA4B;AAC7D;AACA,SAAS;;AAET;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,wBAAuB;;AAEtD;AACA;AACA,WAAW;AACX,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,WAAW,sBAAsB;AACjC,WAAW,eAAe;AAC1B,YAAY,eAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,WAAW,6BAAmB;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA,0BAA0B,iBAAa;AACvC,4BAA4B,iBAAa;AACzC;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,UAAM;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAQ;AAC/B;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,WAAW,cAAc;AACzB,WAAW,2BAA2B;AACtC,WAAW,4BAA4B;AACvC;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,0BAAqB;AACxC,mBAAmB,0BAAqB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,0BAAqB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,0BAAqB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qDAAe,SAAS,EAAC;;;AC5qBzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAe,qBAAqB,EAAC;;;ACRrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAE+C;AACJ;AACY;AACd;AACC;;AAE1C;AACsD;AAC0B;;AAEhF;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,uBAAuB;AAClC;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA,4BAA4B,YAAQ;AACpC;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,oDAAoD,SAAS,QAAQ,UAAU,WAAW;AAC1F;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA,wBAAwB,kBAAU;AAClC;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA,6BAA6B,8BAAoB;AACjD,gBAAgB,kCAAkC;AAClD;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;;AAEA;AACA,WAAW,8BAA8B;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,8BAA8B;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sCAAsC,yBAAoB;AAC1D;;AAEA,mBAAmB,uBAAuB;AAC1C;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,mBAAmB,iCAAiC;AACpD;AACA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,+BAAqB;AACrC;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,uBAAuB;AAC1C;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,4BAA4B;AAC3D;AACA;AACA;AACA;AACA;AACA,uCAAuC,WAAO;AAC9C;AACA;AACA;AACA,uCAAuC,gBAAgB;AACvD,kDAAkD,WAAO;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL,mBAAmB,yBAAyB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,kCAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,cAAQ;;AAEzC,mDAAe,OAAO,E;;ACrqByB;;AAE/C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,2BAAiB;AACrB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA,6BAAe,SAAS,eAAC;AACzB,IAAI,2BAAiB;AACrB,YAAY,8BAAoB;AAChC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,E;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,+BAA+B;AAC3C;AACA;AACA;AACA;;AAE+C;AACV;AACsB;;AAE3D;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2CAA2C,YAAO;;AAElD;AACA;AACA;AACA;AACA,8BAA8B,+BAAqB;AACnD;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA,kCAAwB;AACxB;AACA;;AAEA;AACA;AACA,iCAAiC,YAAO;AACxC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,CAAC;;AAED,oCAA0B;AAC1B;;AAEA;;AAEA;AACA,CAAC;;AAED,sCAA4B,CAAC,cAAc;;;AAG3C,iDAAe,SAAS,E;;ACjQxB,gEAAe;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;AC7ED,+DAAe;AACf;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,aAAa;;AAEb;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;AC9DD,0DAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;ACjC8C;AAC6B;AACF;AACV;;AAEhE,kBAAkB,uCAA6B;;AAE/C;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,wBAAwB,yBAAyB;AACnE,4BAAkB,wBAAwB,wBAAwB;AAClE,4BAAkB,wBAAwB,mBAAmB;;AAE7D,yDAAe,WAAW,EAAC;;;;AC/I3B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,8EAA8E;AACvG;AACA;;AAEO;AACP;AACA,mBAAmB,sBAAsB;AACzC;AACA;;AAEO;AACP;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;;AAEO;AACP,mCAAmC,oCAAoC;AACvE;;AAEO;AACP;AACA;;AAEO;AACP,2BAA2B,+DAA+D,gBAAgB,EAAE,EAAE;AAC9G;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,qFAAqF;AACpH;AACA,KAAK;AACL;;AAEO;AACP,aAAa,6BAA6B,0BAA0B,aAAa,EAAE,qBAAqB;AACxG,gBAAgB,qDAAqD,oEAAoE,aAAa,EAAE;AACxJ,sBAAsB,sBAAsB,qBAAqB,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,kCAAkC,SAAS;AAC3C,kCAAkC,WAAW,UAAU;AACvD,yCAAyC,cAAc;AACvD;AACA,6GAA6G,OAAO,UAAU;AAC9H,gFAAgF,iBAAiB,OAAO;AACxG,wDAAwD,gBAAgB,QAAQ,OAAO;AACvF,8CAA8C,gBAAgB,gBAAgB,OAAO;AACrF;AACA,iCAAiC;AACjC;AACA;AACA,SAAS,YAAY,aAAa,OAAO,EAAE,UAAU,WAAW;AAChE,mCAAmC,SAAS;AAC5C;AACA;;AAEO;AACP;AACA,kCAAkC,oCAAoC,aAAa,EAAE,EAAE;AACvF,CAAC;AACD;AACA;AACA,CAAC;;AAEM;AACP;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM,gBAAgB;AACzC;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;;AAEO;AACP,4BAA4B,sBAAsB;AAClD;AACA;AACA;;AAEO;AACP,iDAAiD,QAAQ;AACzD,wCAAwC,QAAQ;AAChD,wDAAwD,QAAQ;AAChE;AACA;AACA;;AAEO;AACP;AACA;;AAEO;AACP;AACA;AACA,iBAAiB,sFAAsF,aAAa,EAAE;AACtH,sBAAsB,gCAAgC,qCAAqC,0CAA0C,EAAE,EAAE,GAAG;AAC5I,2BAA2B,MAAM,eAAe,EAAE,YAAY,oBAAoB,EAAE;AACpF,sBAAsB,oGAAoG;AAC1H,6BAA6B,uBAAuB;AACpD,4BAA4B,wBAAwB;AACpD,2BAA2B,yDAAyD;AACpF;;AAEO;AACP;AACA,iBAAiB,4CAA4C,SAAS,EAAE,qDAAqD,aAAa,EAAE;AAC5I,yBAAyB,6BAA6B,oBAAoB,gDAAgD,gBAAgB,EAAE,KAAK;AACjJ;;AAEO;AACP;AACA;AACA,2GAA2G,sFAAsF,aAAa,EAAE;AAChN,sBAAsB,8BAA8B,gDAAgD,uDAAuD,EAAE,EAAE,GAAG;AAClK,4CAA4C,sCAAsC,UAAU,oBAAoB,EAAE,EAAE,UAAU;AAC9H;;AAEO;AACP,gCAAgC,uCAAuC,aAAa,EAAE,EAAE,OAAO,kBAAkB;AACjH;AACA;;AAEA;AACA,yCAAyC,6BAA6B;AACtE,CAAC;AACD;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,4CAA4C;AAC5C;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;;;AClOiC;AACjC,2BAA2B,YAAG;AACvB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iCAAiC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;;;ACrDO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAK;AACrB;AACA;AACA;AACA;;;ACjGA,IAAI,WAAK;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,iDAAe,WAAK,EAAC;;;AChIc;AACP;AAC5B,IAAI,oBAAO;AACX,IAAI,oBAAO;AACX,aAAa,UAAK;AAClB,aAAa,UAAK;AAClB,aAAa,UAAK;AAClB,aAAa,UAAK;AAClB,gBAAgB,UAAK;AACrB,gBAAgB,UAAK;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,oBAAO;AACvB,gBAAgB,oBAAO;AACvB;AACA,yBAAyB,oBAAO;AAChC;AACA;AACA;AACA;AACA;AACA,0BAA0B,oBAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,MAAa;AAC7B,QAAQ,SAAgB;AACxB,QAAQ,KAAY;AACpB,QAAQ,SAAgB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA,YAAY,eAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,oBAAO;AAC1B,mBAAmB,oBAAO;AAC1B,mBAAmB,oBAAO;AAC1B,mBAAmB,oBAAO;AAC1B;AACA;AACA;AACA;AACA,CAAC;AACD,wDAAe,YAAY,EAAC;;;ACtNoB;AACJ;AACd;AAC9B;AACO;AACP;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,YAAO;AACX;AACA;AACO,SAAS,cAAS;AACzB,IAAI,YAAO;AACX;AACO;AACP;AACA;AACA;AACA,iDAAiD,YAAG;AACpD;AACA;AACA;AACA,gBAAgB,YAAO;AACvB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,mBAAmB,iBAAY;AAC/B;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAY;AACzC,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP,WAAW,YAAO;AAClB;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3L+C;AACwB;AACI;AAC3E,mBAAmB,qBAAqB,KAAK;AACtC;AACP;AACA;AACA;AACA;AACA;AACA,2CAA2C,SAAS;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,WAAM,GAAG;AAChC;AACA,eAAe,SAAS;AACxB,iCAAiC,SAAS;AAC1C,yCAAyC,SAAS;AAClD,+BAA+B,QAAQ;AACvC,mDAAmD,QAAQ;AAC3D,+BAA+B,SAAS;AACxC;AACA,mBAAmB,6CAA6C;AAChE;AACA;AACA,wBAAwB,QAAQ;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iCAAiC;AAChE;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,+BAA+B,aAAa;AAC5C,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC,gCAAgC,QAAQ;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAC+B;AACzB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,+BAA+B;AACzD;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA,kCAAkC,aAAa;AAC/C,8BAA8B,SAAS;AACvC;AACA;AACA;AACA,+BAA+B,SAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,cAA0B;AAC1D,4BAA4B,YAAwB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kHAAkH,iCAAiC;AACnJ,2DAA2D,QAAQ;AACnE;AACA;AACA;AACA,yCAAyC,QAAQ;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,SAAS;AAC5D,qDAAqD,SAAS;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,YAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM,OAAO;AAChC;AACA;AACA,CAAC,IAAI;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC7cO,SAAS,aAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,WAAI;AACpB;AACA;AACA;AACA;AACO,SAAS,YAAK;AACrB;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO,IAAI,aAAM;AACV;AACP;AACA;AACO;AACA,SAAS,UAAG;AACnB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACO,SAAS,YAAK;AACrB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,eAAQ;AACxB;AACA;AACA;AACO,WAAW,eAAQ;AACnB;AACP;AACA;AACA;AACO;AACA;AACP;AACA;AACA;AACA;AACO,SAAS,WAAI;AACpB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,UAAG;AACnB;AACA;AACA;AACA;AACO,SAAS,UAAG;AACnB;AACA;AACA;AACA;;;AC/GmC;AACA;AACnC,gBAAgB,QAAe;AAC/B,IAAI,qBAAO;AACX;AACA,iBAAiB,qBAAO,WAAW,qBAAO;AAC1C;AACA;AACA;AACA,sBAAsB,MAAa;AACnC,IAAI,iBAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,MAAa;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,GAAU;AAC1B;AACA;AACA,gBAAgB,IAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,MAAa;AAC9D,QAAQ,aAAa;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,GAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,GAAU;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,cAAqB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,cAAqB;AACjC;AACA;AACA;AACA;AACA;AACA,oBAAoB,iBAAG,sBAAsB,iBAAG;AAChD,wBAAwB,iBAAG;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,MAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA,yDAAe,aAAa,EAAC;;;AC5N7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,OAAO;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,oDAAe,QAAQ,EAAC;;;AC9JxB;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACA;AACA;AACA;AACA;;;ACXP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAAe,GAAG,EAAC;;;AClFZ;AACA;AACA;;;ACF0C;AACW;AACb;AACR;AAC8B;AAC2C;AACjD;AACf;AACnB;AACqB;AAC3C;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,iBAAY;AACtC;AACA;AACA,kBAAkB,SAAI;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD;AAClD,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,qBAAqB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,YAAY;AACjD,qCAAqC,YAAY;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wGAAwG;AACxG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,WAAW;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,iBAAiB,GAAG,gBAAgB;AACzF;AACA;AACA;AACA,8DAA8D,KAAK;AACnE;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA,eAAe,SAAS;AACxB;AACA,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAQ;AACzB;AACA,0BAA0B,IAAI;AAC9B,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,WAAW;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,SAAS;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,WAAW;AAC5C;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAO;AACzB,6BAA6B,OAAO;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA,YAAY,WAAM;AAClB;AACA;AACA,gBAAgB,WAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,WAAM,GAAG;AACvC,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,gCAAgC;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,kBAAa;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,WAAM;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,WAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAQ;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,sBAAsB,OAAO;AAC7B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,WAAW;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,uCAAuC,mBAAc,IAAI,wBAAmB;AAC5E;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD,KAAK,UAAU,aAAQ;AACvB,KAAK,UAAU,kBAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,mBAAmB,sBAAsB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA,WAAW,WAAW;AACtB;AACA;AACA,QAAQ,WAAW;AACnB,aAAa,WAAW;AACxB;AACA;AACA,YAAY,YAAY;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,UAAU;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,IAAI;AACzB;AACA;AACA;AACA;AACA,sBAAsB,QAAQ;AAC9B,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA,gBAAgB,QAAQ,uBAAuB,WAAW;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA,2BAA2B,wCAAwC;AACnE;AACA;AACA,8BAA8B,OAAO;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,YAAY;AACvC;AACA,wCAAwC,UAAU;AAClD;AACA;AACA;AACA,2BAA2B,kBAAQ;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAe,OAAO,EAAC;;;ACp/BW;AACD;AACe;AACU;AACG;AAC7D;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,+BAAmB;AACvB;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA,sBAAsB,IAAI;AAC1B,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA,qDAAqD;AACrD,oDAAoD;AACpD,0DAA0D;AAC1D,yDAAyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,6BAA6B;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,iBAAY;AACzE;AACA,gBAAgB,gCAA2B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,iBAAY;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,iBAAiB;AAClD;AACA;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,+BAAmB;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uEAAuE;AACvE;AACA,sCAAsC,IAAI;AAC1C,mCAAmC,wBAAwB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,IAAI;AACrC,+BAA+B,uBAAuB;AACtD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,+EAA+E,+BAAmB;AAClG,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,WAAM;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,WAAW,GAAG,iBAAiB;AAC3D,KAAK;AACL;AACA,CAAC,CAAC,WAAO;AACT,kBAAkB,iBAAY;AAC9B,mBAAmB,iBAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAAe,WAAW,EAAC;;;ACnU+C;AAC1E;AACA;AACA,IAAI,aAAO;AACX;AACA;AACA;AACA,UAAU,aAAQ;AAClB,UAAU,aAAQ;AAClB,UAAU,aAAQ;AAClB;AACA,kBAAkB,aAAO,UAAU,aAAO;AAC1C;AACA,SAAS,qBAAe;AACxB,iBAAiB,aAAO,WAAW,aAAO;AAC1C;AACO,SAAS,aAAO;AACvB;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAY;AAC5B;AACA;AACA;AACA;AACA;AACA,YAAY,qBAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B,iBAAiB,aAAO;AACxB,iBAAiB,aAAO;AACxB,aAAa,UAAY;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA,iBAAiB,aAAO;AACxB,iBAAiB,aAAO;AACxB,aAAa,UAAY;AACzB;AACA;AACA;AACA;AACA;AACA,qBAAqB,aAAO;AAC5B,qBAAqB,aAAO;AAC5B,iBAAiB,UAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,aAAO;AACxB,iBAAiB,aAAO;AACxB;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA,gBAAgB,aAAO;AACvB,gBAAgB,aAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAW;AAC3B;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,YAAY,qBAAe;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B,iBAAiB,iBAAW;AAC5B,iBAAiB,iBAAW;AAC5B,iBAAiB,UAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAW;AAC5B,iBAAiB,iBAAW;AAC5B,iBAAiB,UAAY;AAC7B;AACA;AACA;AACA;AACA;AACA,qBAAqB,iBAAW;AAChC,qBAAqB,iBAAW;AAChC,qBAAqB,UAAY;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAW;AAC5B,iBAAiB,iBAAW;AAC5B;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA,gBAAgB,iBAAW;AAC3B,gBAAgB,iBAAW;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACxViC;AACA;AACjC,IAAI,YAAO;AACX,IAAI,YAAO;AACX;AACA;AACA;AACA,YAAY,aAAW;AACvB,UAAU,aAAW;AACrB,gBAAgB,aAAW;AACpB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA,eAAe,YAAO;AACtB,gBAAgB,YAAO;AACvB,cAAc,YAAO;AACrB,iBAAiB,YAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACO;AACP,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB;AACA;AACA;AACO;AACP,uBAAuB,kBAAkB;AACzC,kBAAkB,aAAa;AAC/B;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA,iBAAiB,YAAO;AACxB,iBAAiB,YAAO;AACxB;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA,iBAAiB,YAAO;AACxB,iBAAiB,YAAO;AACxB;AACA,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB;AACO;AACP,4BAA4B,uBAAuB;AACnD,sBAAsB,iBAAiB;AACvC,aAAa,YAAO,CAAC,YAAO;AAC5B,aAAa,YAAO,CAAC,YAAO;AAC5B;AACA;AACA,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB,aAAa,YAAO;AACpB;AACO;AACP,kBAAkB,UAAQ;AAC1B,kBAAkB,UAAQ;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3HiC;AACS;AACU;AACiB;AAC+B;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,iBAAO;AACX,IAAI,iBAAO;AACX,IAAI,iBAAO;AACX,IAAI,iBAAO;AACX,IAAI,kBAAQ;AACZ;AACA;AACA,IAAI,aAAG;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,yBAAyB,aAAG;AAC5B;AACA;AACA;AACA;AACA,yDAAyD,aAAG;AAC5D,sCAAsC,aAAG;AACzC;AACA,6DAA6D,aAAG;AAChE,sCAAsC,aAAG;AACzC;AACA;AACA,uCAAuC,aAAG;AAC1C;AACA;AACA,uCAAuC,aAAG;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,gBAAG;AAC3D,wDAAwD,gBAAG;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,iBAAO;AAC1B,mBAAmB,iBAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,eAAe;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,iBAAO,UAAU,iBAAO,mBAAmB,iBAAO,UAAU,iBAAO;AAC5H;AACA;AACA;AACA,4BAA4B,kBAAQ;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,iBAAiB,aAAO;AACxB,kBAAkB,aAAO;AACzB,iBAAiB,aAAO;AACxB,kBAAkB,aAAO;AACzB,yBAAyB,kBAAQ;AACjC;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,aAAO;AACvB,gBAAgB,aAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,kBAAQ;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA,oBAAoB,SAAS;AAC7B;AACA;AACA;AACA;AACA,oBAAoB,aAAa;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAO;AACpC,6BAA6B,iBAAO;AACpC;AACA,oBAAoB,OAAO;AAC3B,yBAAyB,iBAAO;AAChC,yBAAyB,iBAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,UAAQ;AACpB,YAAY,UAAQ;AACpB;AACA;AACA;AACA;AACA,mBAAmB,iBAAY;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,SAAS;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,WAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAO;AACpC,6BAA6B,iBAAO;AACpC;AACA,wBAAwB,iBAAO,WAAW,iBAAO,CAAC,aAAG;AACrD,yBAAyB,iBAAO;AAChC,yBAAyB,iBAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,cAAc;AAC1C,4BAA4B,cAAc;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,kBAAkB;AAC9C,4BAA4B,kBAAkB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAO;AACpC,6BAA6B,iBAAO;AACpC;AACA,yBAAyB,iBAAO;AAChC,yBAAyB,iBAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,iBAAO;AAClD;AACA;AACA,0DAA0D,iBAAO;AACjE;AACA;AACA;AACA,+CAA+C,iBAAO;AACtD;AACA;AACA;AACA,kDAAkD,iBAAO;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD,qDAAe,SAAS,EAAC;;;ACnzBlB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACvBuC;AAChC,SAAS,mBAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAuB;AACnC;AACA;;;ACdsD;AAC/C,SAAS,uBAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,qBAAqB;AACjC;AACA;;;ACdA,IAAI,QAAG;AACA;AACP,aAAa,QAAG;AAChB;AACA,iBAAiB,QAAG;AACpB;AACA;AACA;;;ACPyC;AACzC,IAAI,OAAG;AACA,SAAS,iBAAa;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAG;AAC7C;AACA;AACA;AACA;AACA,qBAAqB,eAAe;AACpC,mBAAmB,eAAe;AAClC;AACA;AACA,qBAAqB,eAAe;AACpC,mBAAmB,eAAe;AAClC;AACA;AACA,oBAAoB,OAAG;AACvB;AACA;AACA;AACA,iBAAiB,OAAG;AACpB;AACA;AACA,oBAAoB,OAAG,0BAA0B,OAAG;AACpD;;;AClCe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACd0C;AACX;AACE;AACQ;AACZ;AACU;AACC;AACxC,IAAI,QAAG,GAAG,kBAAa;AACvB,IAAI,QAAG;AACP,IAAI,YAAO;AACX;AACA,6BAA6B,YAAO;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,WAAiB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA,qBAAqB,aAAa;AAClC;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA;AACA,sBAAsB,aAAa;AACnC;AACA,0BAA0B,aAAa;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,eAAqB;AACtC;AACA;AACA;AACA;AACA,gBAAgB,uBAAuB;AACvC;AACA;AACA,qBAAqB,iBAAiB;AACtC,2BAA2B,YAAY;AACvC;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,QAAG;AACrB;AACA,mBAAmB,QAAG;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,QAAG;AACzB,oBAAoB,QAAG;AACvB;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA,wBAAwB,QAAG;AAC3B;AACA;AACA,4BAA4B,QAAG,0BAA0B,QAAG;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,oBAAoB,QAAG;AACvB;AACA,qBAAqB,WAAW;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA,wBAAwB,aAAkB;AAC1C;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA,wBAAwB,mBAAmB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,QAAG;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,aAAkB;AAC1C,2BAA2B,aAAkB;AAC7C,2BAA2B,aAAkB;AAC7C,2BAA2B,aAAkB;AAC7C;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC,yBAAyB,WAAW;AACpC;AACA;AACA,iBAAiB,QAAG;AACpB;AACA,wBAAwB,aAAkB;AAC1C;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,WAAW;AACxB;AACA;AACA;AACO;AACP;AACA;AACO,SAAS,kBAAa;AAC7B;AACA;;;AClTkC;AACgE;AACxD;AACK;AACsC;AACjD;AACsE;AAC1B;AACzE,yBAAyB,aAAQ;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,oBAAoB;AAChB;AACP,WAAW,aAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,EAAE,oCAAoC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAA2B;AACtD;AACA;AACA,+BAA+B,WAAW;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,IAAI;AAC1B;AACA;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,WAAM;AAC1B;AACA;AACA;AACA,gBAAgB,WAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,QAAQ;AACxB,8BAA8B,GAAG;AACjC;AACA,2BAA2B,gBAAgB;AAC3C;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA,uBAAuB,iBAAiB;AACxC;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA,YAAY,QAAQ;AACpB;AACA;AACA,8BAA8B,GAAG,gBAAgB,mBAAmB;AACpE;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA,yBAAyB,iBAAiB;AAC1C;AACA;AACA,wBAAwB,cAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,iBAAiB;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAyB;AACjD;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA,wBAAwB,iBAAiB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA,iCAAiC,iBAAiB;AAClD;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA,gCAAgC,WAAM,GAAG;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,WAAM,GAAG;AAC3C,oBAAoB,WAAM;AAC1B;AACA;AACA;AACA,8BAA8B,WAAM,GAAG;AACvC,gBAAgB,WAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,WAAM,GAAG;AACtC;AACA,gCAAgC,IAAI;AACpC,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,SAAS;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,KAAK;AAC5B;AACA;AACA,uBAAuB,KAAK;AAC5B;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,WAAW,GAAG,iBAAiB,GAAG,iBAAiB;AAC/E,KAAK;AACL;AACA,CAAC,CAAC,mBAAW;AACb,mDAAe,IAAI,EAAC;;;ACvYc;AACM;AACwB;AACpB;AACU;AAC/C,0BAA0B,aAAQ;AACzC;AACA,UAAU,YAAY;AACtB;AACA;AACA;AACA;AACA;AACA,CAAC,EAAE,kBAAkB;AACrB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,CAAC,CAAC,mBAAW;AACb;AACA,oDAAe,KAAK,EAAC;;;AC7Da;AACgE;AAClD;AACM;AAC/C,0BAA0B,aAAQ;AACzC;AACA;AACA,CAAC,EAAE,oBAAoB;AAChB;AACP,WAAW,aAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,EAAE,oCAAoC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,iBAAY;AACzC;AACA;AACA;AACA;AACA,CAAC,CAAC,mBAAW;AACb;AACA,oDAAe,OAAO,EAAC;;;ACxEhB;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC1EA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACvDkC;AACP;AAC4B;AACW;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACoB;AACrB;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,oBAAoB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,SAAyB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,iDAAe,IAAI,EAAC;;;ACxDc;AACiC;AACvC;AAC+E;AAClC;AAC3C;AACE;AACgB;AACV;AACsC;AAC5E;AACA;AACA;AACA;AACO;AACP,WAAW,aAAQ;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,EAAE,oCAAoC;AAC3C;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAI;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,iBAAY;AAC1C;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;AAC9D,QAAQ,WAAM;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,IAAI;AAC5B,uBAAuB,sBAAsB;AAC7C;AACA;AACA,YAAY,WAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,YAAY;AACjD;AACA;AACA,2BAA2B,cAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,WAAW;AAC/B;AACA;AACA;AACA,uBAAuB,WAAW;AAClC,uBAAuB,WAAW;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C,4CAA4C,aAAK;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,iBAAY,CAAC,WAAW,mDAAmD,WAAW;AAC7H;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,WAAW;AAC9B,mBAAmB,WAAW;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,+BAA+B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,aAAK;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,YAAY;AACpD,6BAA6B,SAAS;AACtC;AACA,mCAAmC,SAAS;AAC5C,kCAAkC,SAAS;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iBAAY,CAAC,WAAW,iDAAiD,WAAW;AACnH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,UAAI;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,SAAS;AAC7C;AACA;AACA,2CAA2C,aAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,SAAS;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,IAAI;AAC3B;AACA;AACA,CAAC,CAAC,mBAAW;AACb,wBAAwB;AACxB,iCAAiC;AAC1B;AACP;AACA,IAAI,IAAI;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,iBAAiB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAAe,MAAM,EAAC;;;;AC/gBtB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AAChD,0BAA0B;AAC1B;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAAS,mBAAY;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACO,SAAS,YAAK;AACrB;AACA;AACA,GAAG;;;AAGH,8EAA8E;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEO;AACP;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,yCAAyC;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA,uFAAuF;;AAEvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA,YAAY,MAAa;AACzB;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA,sBAAsB,GAAU;AAChC;AACA,GAAG;AACH;AACA,cAAc,GAAU;AACxB;AACA;AACA,GAAG;AACH,mBAAmB,MAAa;AAChC;AACA,GAAG;AACH,kBAAkB,GAAU;AAC5B;AACA,GAAG,EAAE;;AAEL;AACA;AACA;AACA;;AAEA,2CAA2C,SAAS;AACpD;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,sEAAsE;AACtE;;AAEA,wBAAwB;;AAExB,8DAA8D,YAAK;AACnE,CAAC;;AAEM;AACP;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,WAAW,KAAK;AAChB,YAAY;AACZ;;AAEO;AACP;AACA,CAAC;;AAED,wBAAwB,EAAE,aAAa,IAAI,aAAa,IAAI,YAAY,IAAI,SAAS,IAAI,SAAS,IAAI,mDAAmD;;AAEzJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,oDAAoD;AACpD,oDAAoD;AACpD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,sBAAsB;;AAEtB;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA,mBAAmB;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kCAAkC;AAC1C,QAAQ,0CAA0C;AAClD,QAAQ,oCAAoC;AAC5C,QAAQ,mCAAmC;AAC3C,QAAQ,mCAAmC;AAC3C,QAAQ,oCAAoC;AAC5C,QAAQ;AACR;AACA,QAAQ,0CAA0C;AAClD,QAAQ,oCAAoC;AAC5C,QAAQ,mCAAmC;AAC3C,QAAQ,kCAAkC;AAC1C,QAAQ,mCAAmC;AAC3C,QAAQ;AACR;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,GAAG;AACH;AACA;;AAEA,iBAAiB,iBAAiB;AAClC;AACA;;AAEA,oBAAoB,QAAQ;AAC5B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,C;;;ACjmBA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACmF;AACnF;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP,MAAM,IAAqC;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO;AACP,MAAM,IAAqC;AAC3C;AACA;AACA;AACO;AACP;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA,MAAM,IAAqC;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;;AAEA,MAAM,IAAqC;AAC3C;AACA;AACA;AACA,8GAA8G,KAAK,0EAA0E,UAAU,sBAAsB,MAAM,IAAI,QAAQ;AAC/O;;AAEA,UAAU,GAAG;AACb,UAAU,QAAQ;AAClB;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa,EAAE;AACf,WAAW;AACX;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,C;;;AC5JA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC6H;AACtF;AACoC;AACR;AACtC;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,EAAE;AACd,YAAY,MAAM;AAClB;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,oBAAoB;AACpB;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,gDAAgD;;AAEhD,yCAAyC,SAAS;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,8aAA8a;AACrb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,WAAW,eAAe,eAAe;AACtE;AACA;;AAEO;AACP,SAAS,QAAQ,eAAe,OAAO;AACvC;AACA;AACA,6BAA6B,WAAW,eAAe,eAAe;AACtE;AACA;;AAEO;AACP,SAAS,QAAQ,2CAA2C;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,yBAAyB,aAAa,GAAG;;AAEzC,EAAE,IAAI;AACN,SAAS,QAAQ;AACjB;AACA;AACA;;AAEA,QAAQ,IAAqC;AAC7C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;;AAEA,wBAAwB;AACxB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,GAAG;AACH;;;AAGA,qBAAqB,0BAA0B;AAC/C,oCAAoC;;AAEpC;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA,EAAE,IAAI;AACN;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,MAAM,MAAM;AACZ,wCAAwC;AACxC;;AAEA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,EAAE,IAAI;AACN;AACA;AACA;;AAEA,mBAAmB,mBAAmB;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA,EAAE,IAAI;AACN;AACA;AACA,KAAK;;;AAGL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA,GAAG;AACH;;AAEA;AACA,EAAE,IAAI;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,aAAa;AAC3B,EAAE,IAAI;AACN;AACA;AACA,GAAG;AACH,EAAE,IAAI;AACN,6BAA6B;;AAE7B,IAAI,MAAM;AACV;AACA,uCAAuC;AACvC,GAAG,EAAE;;AAEL,EAAE,IAAI;AACN;AACA;AACA;;AAEA,SAAS,QAAQ;AACjB;AACA,KAAK;AACL;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA,qBAAqB,UAAU,GAAG,UAAU,GAAG,GAAG;AAClD,oBAAoB,GAAG,GAAG,UAAU,GAAG,UAAU;AACjD;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;;AAEA;AACA,GAAG;AACH;;AAEA;AACA;AACA,mDAAmD;;AAEnD;AACA;AACA;AACA;AACA;;;AAGA;AACA,MAAM,IAAqC;AAC3C;AACA;AACA;AACA;;AAEA;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA,6DAA6D,YAAY;AACzE;;AAEA;AACA,MAAM,IAAqC;AAC3C,IAAI,IAAI;AACR;AACA;;AAEA;AACA,SAAS,YAAY,cAAc,SAAS;AAC5C;;AAEO;AACP,iCAAiC;;AAEjC;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;;AAEO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA,EAAE,IAAI;AACN;;AAEA,QAAQ,QAAQ;AAChB;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA,iEAAiE;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,mCAAmC;AAC5D,yBAAyB,mCAAmC;AAC5D;AACA;;;AAGO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA,6CAA6C,SAAS;AACtD;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,gDAAgD,UAAU;AAC1D;;AAEA;AACA;AACA,SAAS;AACT,+CAA+C;AAC/C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,WAAW;AACX;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,GAAG;AACH,WAAW,OAAO,sBAAsB,GAAG;AAC3C;AACA,KAAK;AACL,GAAG;AACH,WAAW,OAAO,iBAAiB,GAAG;AACtC;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;;AAEO;AACP;AACA;AACA,6CAA6C;AAC7C;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,0CAA0C;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA;AACO;AACP;;AAEA,MAAM,QAAQ;AACd;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA,uBAAuB,aAAa;AACpC;AACA;AACA,EAAE,IAAI;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kEAAkE,OAAO;AACzE;AACA;;AAEA;AACA,qFAAqF;AACrF;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI,MAAM;AACV;AACA;AACA,GAAG;AACH;;;AAGA;AACA,IAAI,MAAM;AACV;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA,WAAW,qBAAgB;AAC3B,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,gBAAgB,aAAa;AAC7B;AACA,EAAE,IAAI;AACN;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;;AAEA;AACA;AACA;;AAEA;AACA,gBAAgB,iBAAiB;AACjC,WAAW,YAAK,mCAAmC,YAAY,oBAAoB,YAAY;AAC/F,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA,mBAAmB,cAAc;AACjC,0CAA0C;;AAE1C;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,oBAAoB,iBAAiB;AACrC,0BAA0B,YAAK,mCAAmC,YAAY,WAAW,YAAY;AACrG;AACA;;AAEA;AACA;AACA,C;;;AC9vBA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACoC;AAC7B,gBAAgB,SAAS,G;;;AC3ChC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACuC;AAC6D;AAC3D;AACW;AACA;AACR;AACd;;AAE9B;AACA;AACA,qBAAqB,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEP;AACA;AACA,CAAC;;;AAGD,2BAA2B,YAAG;;AAE9B;AACA;AACA;AACA;;AAEA;;AAEA;AACA,kBAAkB,IAAc;AAChC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA,iBAAiB,yBAAyB;AAC1C;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,kCAAkC,OAAO;AACzC;;AAEA,oBAAoB,YAAI;AACxB;AACA;AACA;;AAEA;AACA,0BAA0B;;AAE1B;;AAEA;AACA,sBAAsB;;AAEtB,gBAAgB,WAAM,GAAG;AACzB,wBAAwB,WAAM,GAAG,iBAAiB;;AAElD;AACA,OAAO;AACP;AACA;AACA,oBAAoB,WAAM,GAAG;AAC7B,4BAA4B,WAAM,GAAG;AACrC;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,WAAM,GAAG;AACzB;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAc,WAAM,GAAG;AACvB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA,YAAY,WAAM,GAAG;AACrB,gBAAgB,WAAM;AACtB;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;;AAEA;AACA;AACA;;AAEO;AACP;AACA;AACA,mIAAmI;;AAEnI;AACA;AACA,KAAK;AACL,GAAG;AACH;AACO;AACP;AACA;;AAEA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,6FAA6F;;AAE7F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;AAEP,UAAU,WAAW;AACrB;AACA,OAAO,UAAU,QAAQ;AACzB,wBAAwB,IAAI;;AAE5B,uBAAuB,sBAAsB;AAC7C;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACO;AACP;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACO;AACP;AACA;AACA,kBAAkB,cAAc,gBAAgB;;AAEhD,eAAe,OAAO;AACtB;;AAEA;AACA;AACA,oBAAoB;;AAEpB;AACA;AACA;AACA;;AAEA;AACA,iBAAiB,SAAS;AAC1B;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,uDAAuD;AACvD;;AAEA;;AAEA,iBAAiB,wBAAwB;AACzC,QAAQ,KAAqC;AAC7C,MAAM,KAAK;AACX;;AAEA,QAAQ,SAAS;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP,MAAM,KAAqC;AAC3C,IAAI,KAAK;AACT;;AAEA,eAAe,SAAS;;AAExB;AACA;AACA,+BAA+B;AAC/B;;;AAGA;AACA;AACA;AACA;;AAEA,IAAI,IAAI;AACR;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;;AAGA;AACA;AACA;AACO;AACP,MAAM,KAAqC;AAC3C,IAAI,KAAK;AACT;;AAEA;AACA,eAAe,SAAS;AACxB;;AAEA;AACA,IAAI,IAAI;AACR;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACO;AACP;AACA;AACA;;AAEA;AACA;AACA,kBAAkB,cAAc;;AAEhC,OAAO,OAAO;AACd;AACA;;AAEA;AACA;AACO;AACP;AACA,EAAE,IAAI;AACN;AACA;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACO;AACP;AACA;AACA;AACA,IAAI,IAAI;AACR;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACO;AACP,eAAe,SAAS;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;;AAEA,iBAAiB,yBAAyB;AAC1C;AACA;AACA,0CAA0C;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,sBAAsB;AACtB;;AAEA;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;;AAEO;AACP;;AAEA;AACA;AACA;;AAEA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,C;;AC3vB0C;AAC0B;AACpE,IAAI,iBAAG,GAAG,kBAAa;AACvB;AACA,IAAI,sBAAQ;AACZ;AACe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,YAAY,iBAAG;AACf,sBAAsB,SAAS;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,sBAAQ;AACjC,yBAAyB,sBAAQ;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAgB;AAChC;AACA;AACA;AACA;AACA,gBAAgB,cAAgB;AAChC;AACA;AACA;AACA,mBAAmB,YAAY;AAC/B;AACA;AACA;AACA,YAAY,cAAgB;AAC5B;AACA;AACA;AACA;AACA;AACA;;;AC7EkC;AACC;AACO;AACE;AACN;AACtC,IAAI,aAAQ;AACZ,IAAI,YAAO;AACX,IAAI,YAAO;AACX,IAAI,OAAE;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAE;AAC1B,aAAa,YAAO;AACpB,UAAU,YAAO;AACjB,kBAAkB,YAAO;AACzB,UAAU,YAAO;AACjB;AACA;AACA,cAAc,aAAQ;AACtB,cAAc,aAAQ;AACtB;AACA;AACA,UAAU,aAAQ;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,YAAO;AACjB,UAAU,YAAO;AACjB;AACA,UAAU,YAAO;AACjB,UAAU,YAAO;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB,OAAE;AACnB;AACA;AACA;AACA;AACA;AACA,oCAAoC,OAAE;AACtC,iBAAiB,OAAE,iBAAiB,OAAE;AACtC;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,cAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,kBAAa;AAC3B;AACA;AACA;AACA;AACA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA;AACA;AACA,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA,qDAAqD;AACrD;AACA,CAAC,CAAC,YAAI;AACN;AACA;AACA;AACA;AACA;AACA,oBAAoB,WAAM,GAAG;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,aAAa;AACrB;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA,QAAQ,SAAS;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACO;AACP;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,YAAI;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AChWkC;AACK;AACN;AACe;AAChD;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,OAAc;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,2BAA2B;AAClD;AACA;AACA;AACA;AACA;AACA,0BAA0B,iBAAY;AACtC;AACA;AACA;AACA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,gCAA2B;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,WAAO;AACT;AACA,oDAAe,KAAK,EAAC;;;ACzKa;AACP;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACsB;AACvB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA;AACA,mDAAe,MAAM,EAAC;;;AC7BY;AACP;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACuB;AACxB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,oDAAe,OAAO,EAAC;;;ACtCmC;AAC1D,IAAI,cAAE;AACN,IAAI,eAAG,GAAG,cAAE;AACZ,IAAI,mBAAO;AACX,IAAI,mBAAO;AACX;AACA;AACA,IAAI,mBAAO;AACX,IAAI,oBAAQ;AACZ,IAAI,mBAAO;AACX,IAAI,mBAAO;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,oBAAQ;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,oBAAQ,CAAC,mBAAO;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,qBAAS;AACzB,iBAAiB,mBAAO;AACxB,sBAAsB,mBAAO;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,kBAAkB;AAC1B,cAAc,mBAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,eAAG;AACtB,gCAAgC,mBAAO,2BAA2B,mBAAO;AACzE;AACA;AACA,yCAAyC,mBAAO,8BAA8B,mBAAO;AACrF;AACA;AACA;AACA;AACA,qBAAqB,mBAAO;AAC5B,iBAAiB,mBAAO;AACxB,kBAAkB,mBAAO;AACzB;AACA;AACA,2BAA2B,mBAAO;AAClC,2BAA2B,mBAAO;AAClC,iCAAiC,mBAAO;AACxC,iCAAiC,mBAAO;AACxC;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAO;AAClC,2BAA2B,mBAAO;AAClC,iCAAiC,mBAAO;AACxC,iCAAiC,mBAAO;AACxC,sBAAsB,cAAE;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,mBAAO,iCAAiC,oBAAQ,sBAAsB,oBAAQ;AAC9G,4BAA4B,oBAAQ;AACpC,0BAA0B,mBAAO;AACjC,0BAA0B,mBAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACtLkC;AACP;AACgC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACsB;AACvB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,qBAA2B;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,mDAAe,MAAM,EAAC;;;ACpCY;AACP;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACoB;AACrB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,iDAAe,IAAI,EAAC;;;AChCuC;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;AACA;AACA,mBAAmB,SAAS;AAC5B,oBAAoB,eAAU;AAC9B;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3CuJ;AACxI;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,SAAS;AACrD,YAAY,UAAK;AACjB,YAAY,UAAK;AACjB;AACA,QAAQ,UAAK;AACb,QAAQ,UAAK;AACb;AACA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,YAAO;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,GAAK;AACb,QAAQ,YAAO;AACf,iBAAiB,eAAU;AAC3B,iBAAiB,eAAU;AAC3B;AACA;AACA;AACA;AACA;AACA,QAAQ,YAAO;AACf,QAAQ,YAAO;AACf,kBAAkB,GAAK;AACvB,kBAAkB,GAAK;AACvB;AACA,YAAY,UAAK;AACjB,YAAY,UAAK;AACjB,YAAY,UAAK;AACjB,YAAY,UAAK;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC9D0C;AACA;AACnC,SAAS,cAAS;AACzB;AACA;AACA;AACA;AACA,gCAAgC,YAAY;AAC5C;AACA;AACA,2BAA2B,iCAAiC;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,YAAY;AACrC;AACA;AACA,8CAA8C,OAAO;AACrD;AACA;AACA;AACA;AACA;AACA;;;AC5BkC;AACP;AACkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACuB;AACxB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,cAAoB;AAC5B;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA;AACA,oDAAe,OAAO,EAAC;;;AC3BW;AACP;AACkB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACwB;AACzB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,cAAoB;AAC5B;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,qDAAe,QAAQ,EAAC;;;ACjCU;AACP;AACuC;AAClE,IAAI,gCAA2B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACoB;AACrB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,oBAAoB,CAAC,gCAA2B;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,iDAAe,IAAI,EAAC;;;ACpEc;AACP;AACe;AAC4F;AACtI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAC2B;AAC5B;AACA;AACA;AACA;AACA;AACA,yBAAyB,iBAAiB,GAAG,aAAO;AACpD,yBAAyB,iBAAiB,GAAG,aAAO;AACpD;AACA;AACA;AACA;AACA,yBAAyB,qBAAqB,GAAG,iBAAW;AAC5D,yBAAyB,qBAAqB,GAAG,iBAAW;AAC5D;AACA;AACA;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAAc;AAC7B;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA;AACA,wDAAe,WAAW,EAAC;;;AClGO;AACP;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACmB;AACpB;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,YAAI;AACN;AACA,gDAAe,GAAG,EAAC;;;AC3Ce;AACR;AAC1B;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA,eAAe,2CAAmC;AAClD;AACA;AACA,CAAC,CAAC,YAAI;AACN,2DAAe,YAAY,EAAC;;;AChD5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;AACD,uDAAe,QAAQ,EAAC;;;ACZU;AACA;AAClC;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,gBAAQ;AACV,6DAAe,cAAc,EAAC;AAC9B;;;ACjBkC;AACA;AAClC;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,gBAAQ;AACV,6DAAe,cAAc,EAAC;;;ACfF;AAC5B;AACA;AACA,IAAI,0BAAK,OAAO,UAAK;AACrB,IAAI,0BAAK,OAAO,UAAK;AACrB;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B,mCAAmC,UAAK;AACxC;AACA,uBAAuB,OAAO;AAC9B,gCAAgC,UAAK;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA,QAAQ,cAAS;AACjB,QAAQ,cAAS;AACjB;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,0BAAK;AACb,QAAQ,0BAAK;AACb,sDAAsD,0BAAK,EAAE,0BAAK;AAClE;AACA;AACA;AACA;AACA;AACA,sDAAsD,0BAAK,EAAE,0BAAK;AAClE;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,eAAU,mBAAmB,0BAAK,GAAG,0BAAK;AACtD;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAW;AACnC;AACA;AACA,wBAAwB,gBAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,gBAAW;AACnC;AACA;AACA,wBAAwB,gBAAW;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,gEAAe,oBAAoB,EAAC;;;ACvHF;AACK;AACS;AAChD;AACA;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,+BAA+B;AACjE;AACA;AACA,uBAAuB,wCAAwC;AAC/D;AACA;AACA;AACA;AACA;AACA,kCAAkC,+BAA+B;AACjE;AACA;AACA;AACA;AACA;AACA,uBAAuB,wCAAwC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,iBAAY;AACvC,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,mBAAU;AACZ,qEAAe,sBAAsB,EAAC;;;;AC9GtC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACkD;AACA;AACA;AACN;AACe;AACX;AACF;AACA;AACQ;AACE;AACF;AACJ;AACM;AACE;AACR;AACA;AACc;AAChB;AACY;AACI;AACA;AACP;AACgB;AAC9B;AACqC;AACI;AAC0C;AACrF;AACzC,IAAI,eAAO;AACX,IAAI,eAAO;AACX;AACA;AACA;AACA;;AAEO;AACP,SAAS,mBAAW;AACpB;AACA,2BAA2B,gBAAyB;AACpD;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,WAAW;AACjD;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,YAAY;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,aAAa,gBAAyB;;AAEtC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,kBAAkB,aAAO;AACzB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAI,iBAAS,GAAG,SAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAAS,4BAAoB;AACpC,EAAE,oBAAyC;AAC3C;AACA;AACA;AACA;AACA;;AAEO,SAAS,4BAAoB;AACpC,EAAE,oBAAyC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,IAAI,wBAAgB,GAAG,gBAAqC;;AAEnE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG,UAAU,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB;AACvB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,iBAAiB,SAAS;AAC1B,wBAAwB,SAAS;AACjC;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,8BAA8B;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,uCAAuC,gCAAgC,EAAE;AACjF;AACA;AACA;AACA,QAAQ,4BAA4B,gCAAgC,EAAE;AACtE;;;AAGA;AACA;AACA;AACA;;AAEuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEO;AACP;AACA;AACA,GAAG;AACH;;;AAGA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA,iBAAiB,yBAAyB;AAC1C;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,YAAY,QAAe;;AAE3B;AACA,IAAI,GAAU;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0BAA0B;AACrC;AACA;AACA;;AAEO,SAAS,sBAAc;AAC9B,oBAAoB,WAAW;AAC/B,gBAAgB,oCAA+B;AAC/C;;AAEA;AACA,gBAAgB,aAAa;AAC7B;;AAEA,SAAS,cAAqB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,WAAW,sBAAc;AACzB;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,WAAM,GAAG;AAC3B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,kDAAkD,SAAS;AAC3D;AACA;AACA,GAAG;AACH;AACO;AACP;AACA;AACA,SAAS,GAAG;AACZ;AACA,QAAQ,eAAO;AACf,QAAQ,eAAO;AACf;AACA,QAAQ,eAAO;AACf,QAAQ,eAAO;AACf;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEO;AACP,UAAU,eAAO;AACjB,WAAW,eAAO;AAClB,UAAU,eAAO;AACjB,WAAW,eAAO,yDAAyD;AAC3E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA,kBAAkB,WAAM;AACxB;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gFAAgF,aAAQ,mBAAmB,aAAO;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,iDAAiD,mBAAmB;AACpE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA,GAAG;AACH;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA,6BAA6B,QAAQ;AACrC;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI,IAAI,CAAC,IAAI;AACb,WAAW,MAAM;AACjB;AACA;AACA;AACA,KAAK;AACL;;AAEA,eAAe,SAAS;AACxB;AACA;AACA;AACA;AACA,YAAY,aAAQ;AACpB;AACA;AACA,KAAK;AACL;AACA,CAAC;AACD;;AAEA,wBAAwB,YAAM;AAC9B,yBAAyB,aAAO;AAChC,wBAAwB,YAAM;AAC9B,sBAAsB,UAAI;AAC1B,yBAAyB,aAAO;AAChC,0BAA0B,cAAQ;AAClC,sBAAsB,UAAI;AAC1B,sBAAsB,UAAI;AAC1B,6BAA6B,iBAAW;AACxC,qBAAqB,SAAG;;;;AC5tBxB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC8C;AACoC;AAClB;AACd;AACc;AACP;AACzD;AACO;AACP,iBAAiB,KAAK,qBAAqB,CAAC;AAC5C,oBAAoB,cAAc;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,eAAe,UAAU;AACzB;;AAEA;AACA;AACA;;AAEA,iBAAiB,KAAK,qBAAqB,CAAC;AAC5C,oBAAoB,cAAc;AAClC;AACA,4BAA4B,SAAS;AACrC;;AAEA;AACA;;AAEA;AACA;AACA;AACA,wCAAwC,IAAM;AAC9C;;AAEA,iBAAiB,KAAK,qBAAqB,CAAC;AAC5C,uCAAuC,cAAc;;AAErD;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,IAAM;AAChC;AACA,OAAO;;;AAGP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,KAAK,qBAAqB,CAAC;AAC9C,sBAAsB,cAAc;AACpC;;AAEA;AACA;AACA,0BAA0B,SAAS;;AAEnC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;;AAGA,4DAA4D;;AAE5D;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qCAAqC;;AAErC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEyB;AAClB;AACP;AACA;AACA;AACA;;AAEA,iBAAiB,KAAK,qBAAqB,CAAC;AAC5C,oBAAoB,cAAc;AAClC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA,wBAAwB,WAAM,gCAAgC;;AAE9D;AACA;AACO;AACP;AACA;AACA;AACA;AACA,sBAAsB,SAAS;AAC/B;AACA,2FAA2F;AAC3F;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,4DAA4D;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,sEAAsE;AACtE,oCAAoC,aAAa,KAAK,yBAAyB,OAAO;AACtF;AACA;AACA;;AAEA,iDAAiD;AACjD;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,eAAe;AACf;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,IAAI;;AAEzB,qBAAqB,qBAAqB;AAC1C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,SAAS;;AAEzB;AACA,QAAQ,IAAqC;AAC7C;AACA,QAAQ,mBAAmB;AAC3B;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,QAAQ,IAAqC;AAC7C;AACA,QAAQ,mBAAmB;AAC3B;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wBAAwB,SAAS;;AAEjC;AACA;AACA;;AAEA,uBAAuB,SAAS;;AAEhC;AACA;AACA;;AAEA,6BAA6B,SAAS;;AAEtC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;;AAGA,iBAAiB,mCAAmC;AACpD;AACA,cAAc,SAAS;;AAEvB;AACA;AACA;AACA;;AAEA,iBAAiB,4BAA4B;AAC7C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,2BAA2B;AAC9C;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,UAAU,IAAqC;AAC/C;AACA,UAAU,mBAAmB;AAC7B;AACA;;AAEA;AACA;;AAEA;AACA,UAAU,IAAqC;AAC/C;AACA,UAAU,mBAAmB;AAC7B;AACA;;AAEA;AACA;AACA;AACA;;AAEO;AACP;AACA,SAAS,IAAI;AACb;AACA;AACO,iBAAiB,SAAS;AAC1B;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;;AAEA;AACA;AACA;;AAEA,wEAAwE;AACxE;;AAEA,kBAAkB,SAAS;AAC3B;;AAEA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,uBAAuB,SAAS,GAAG,WAAW,YAAY;AAC1D,C;;ACnjBA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACwC;AACM;AACA;AACM;AAClB;AAClC,mBAAmB,0BAAqB;;;AAGxC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,gBAAW;;AAE9B;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA,qBAAqB,YAAO;;AAE5B;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA,mBAAmB;AACnB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,6BAA6B,YAAO;;AAEpC,0BAA0B,YAAO;;AAEjC;;AAEA;;AAEA;;AAEA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,8BAA8B;AAC7C;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;;AAGL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA,sBAAsB,YAAO;AAC7B;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,mCAAmC;AACnC;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,CAAC;;AAED;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,CAAC;;;AAGD,wDAAe,YAAY,E;;ACl0B3B,0DAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC,E;;ACtCD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;;AAE0B;AACA;AACA;AACA;AACE;AACF;AACA;AACA;;AAE1B,+CAAe;AACf,UAAU,aAAI;AACd,UAAU,aAAI;AACd,UAAU,aAAI;AACd,UAAU,aAAI;AACd,WAAW,cAAK;AAChB,UAAU,aAAI;AACd,UAAU,aAAI;AACd,UAAU,aAAI;AACd,CAAC,EAAC;;;AC/CF;AACmC;;AAEnC,mDAAe,QAAQ,EAAC;;;ACHxB;AACA;AACA;AACA;AACA;AACA;AACA;;AAE2C;AACI;AACS;AACT;AAC/C,IAAI,YAAI,GAAG,iBAAa;;AAExB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,mBAAe;AACnC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C,8BAA8B,sBAAkB;AAChD,8BAA8B,sBAAkB;AAChD,kCAAkC,sBAAkB;AACpD,8BAA8B,sBAAkB;AAChD,kCAAkC,sBAAkB;AACpD,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;AACzC;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kBAAkB,YAAI,gBAAgB,YAAI,gBAAgB,YAAI;AAC9D;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc,aAAa;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc,aAAa;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;;AAEA,sBAAsB,WAAW;AACjC,wBAAwB,aAAa;AACrC,0BAA0B,eAAe;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,+BAA+B;AAC9C,eAAe,+BAA+B;AAC9C,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,iCAAiC,iBAAiB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,eAAe;AAChD;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,CAAC;;AAED,+BAAqB,0BAA0B,mBAAmB;;AAElE,8CAAe,aAAa,E;;AC/c5B;AACA;AACA;AACA;AACA;;AAEA;AAC+C;AACF;;AAE7C;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,mCAAmC;AAClD,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,mCAAmC;AAClD,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,wBAAwB,aAAS;AACjC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc;AACd;AACA,eAAe,8BAAoB;AACnC;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,oCAAoC;AAC3D;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,iEAAe,qBAAqB,E;;AC7WS;AACC;AACC;;AAE/C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,kBAAkB;AAClB;AACA,6BAA6B,+BAA0B;AACvD;AACA,SAAS;;AAET;AACA,kBAAkB;AAClB;AACA,gCAAgC,2BAAsB;;AAEtD;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,yBAAoB;AAC9C,6BAA6B,yBAAoB;;AAEjD;AACA;AACA,oCAAoC,qCAAgC;AACpE,yBAAyB,2BAAsB;;AAE/C;AACA,qCAAqC,kCAA6B;AAClE,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,mCAA8B;AACpD;AACA;AACA;AACA;;AAEA;AACA,qBAAqB;AACrB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,+CAA+C,aAAM;AACrD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,6BAAmB;AAC7E;AACA;AACA,kCAAkC,wBAAmB;AACrD;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,+BAA+B,8BAAoB;AACnD,4BAA4B,oCAAoC;AAChE,4BAA4B;AAC5B,iBAAiB;AACjB,gBAAgB,0CAAgC;;AAEhD;AACA;AACA;AACA;AACA;AACA,8BAA8B,0BAAqB;AACnD;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,yDAAe,WAAW,E;;ACtL1B;AACA;AACA;AACA;;AAE2C;AACI;AACS;AACT;AAC/C,IAAI,UAAI,GAAG,iBAAa;;AAExB;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,mBAAe;AACnC;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;AACzC;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,UAAI;AACpB,gBAAgB,UAAI;AACpB,qBAAqB,UAAI;AACzB;AACA;AACA;AACA;AACA;;AAEA,YAAY,UAAI;AAChB,YAAY,UAAI;AAChB,YAAY,UAAI;AAChB,YAAY,UAAI;;AAEhB,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,CAAC;;AAED,+BAAqB,0BAA0B,mBAAmB;;AAElE,4CAAe,aAAa,E;;AC3GmB;AACF;AACF;AACe;AACJ;AACtD,IAAI,uBAAY,GAAG,0BAAqB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,wBAAwB,mBAAc;;AAEtC,wBAAwB,mBAAc;AACtC,sBAAsB,OAAe,EAAE,uBAAuB;AAC9D;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,wBAAwB,mBAAc;AACtC,sBAAsB,KAAa;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,oBAAoB,oBAAe;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uBAAY;AACtC,4BAA4B,uBAAY;;AAExC,yBAAyB,8BAAoB;;AAE7C;AACA;AACA,aAAa;;AAEb;AACA,2BAA2B,wBAAwB;AACnD;AACA,gCAAgC,yBAAoB;AACpD;;AAEA,mCAAmC;AACnC;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,uBAAY;;AAEtC,qBAAqB,8BAAoB;;AAEzC;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,2BAA2B,wBAAwB;AACnD;;AAEA,mCAAmC;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,yBAAoB;AAChD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA,wDAAe,UAAU,E;;ACjMzB;AACA;AACA;AACA;AACA;AACA;AAC+C;AACJ;AACa;;AAExD;AACA;AACA;;AAEA,sBAAsB,mBAAe;AACrC;AACA;AACA,0BAA0B,sBAAkB;AAC5C,0BAA0B,sBAAkB;AAC5C,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;AACzC;AACA;AACA,CAAC;AACD;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,cAAc;AAC7B,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,+BAAqB,4BAA4B,mBAAmB;;AAEpE,8CAAe,eAAe,E;;ACzI9B,kDAAe,iEAAiE,sCAAsC,wBAAwB,sDAAsD,uBAAuB,mEAAmE,mCAAmC,4BAA4B,kBAAkB,yDAAyD,qEAAqE,sBAAsB,gEAAgE,sBAAsB,0CAA0C,iCAAiC,GAAG,iFAAiF,4BAA4B,iCAAiC,mCAAmC,8CAA8C,gCAAgC,4BAA4B,kBAAkB,qFAAqF,gDAAgD,WAAW,SAAS,EAAC;;;ACAzkC;AACa;;AAEA;AAClD,4BAAuB,CAAC,WAAU;;AAElC,iDAAe,0BAAqB;AACpC,uBAAuB,OAAe;AACtC;AACA,KAAK;AACL,uBAAuB,uBAAkB;AACzC,gBAAgB,2BAAsB;AACtC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;ACvB6C;AACc;;AAEhB;AACa;AACf;AACS;;AAEpD,IAAI,uBAAY,GAAG,0BAAqB;;AAExC,IAAI,wBAAa;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,mBAAc;AACtC,sBAAsB,OAAe,EAAE,uBAAuB;AAC9D;AACA;AACA;AACA,KAAK;AACL,6BAA6B,UAAU;AACvC;;AAEA,uBAAuB,mBAAc;AACrC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B;AAC3B,kBAAkB,wBAAa;AAC/B;AACA;;AAEA;AACA;;AAEA,oBAAoB,yBAAoB;AACxC,wBAAwB,uBAAY;AACpC,sBAAsB,uBAAY;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,yBAAoB;AAC5C,YAAY,uBAAY;AACxB;AACA,wBAAwB,uBAAY;AACpC,wBAAwB,uBAAY;AACpC;AACA;;AAEA,uBAAuB,wBAAwB;AAC/C;;AAEA,+BAA+B;AAC/B,sBAAsB,wBAAa;AACnC,2BAA2B,wBAAa;AACxC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;;AAEA;;AAEA;AACA,sBAAsB,wBAAa;AACnC,2BAA2B,wBAAa;AACxC;AACA;AACA;;AAEA;AACA;AACA,yCAAyC,uBAAa;AACtD;AACA;AACA;AACA,4BAA4B,uBAAY;;AAExC,6BAA6B,8BAAoB;AACjD,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,kBAAkB,wBAAa;AAC/B,uBAAuB,wBAAa;AACpC,yBAAyB,uBAAY;AACrC;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,8BAAoB;AAC7C,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,+BAA+B;AAClD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,wDAAe,UAAU,E;;AC9NzB,mDAAe,uFAAuF,sCAAsC,iCAAiC,uBAAuB,kBAAkB,2DAA2D,qBAAqB,GAAG,uFAAuF,yBAAyB,4CAA4C,oEAAoE,yCAAyC,WAAW,gFAAgF,2CAA2C,kDAAkD,GAAG,qKAAqK,yFAAyF,iGAAiG,wEAAwE,6DAA6D,iEAAiE,oCAAoC,0BAA0B,2CAA2C,IAAI,+BAA+B,2CAA2C,IAAI,IAAI,iFAAiF,+EAA+E,+EAA+E,cAAc,sBAAsB,kCAAkC,4CAA4C,IAAI,uCAAuC,4CAA4C,IAAI,SAAS,kDAAkD,kDAAkD,0CAA0C,qDAAqD,gBAAgB,gBAAgB,IAAI,qCAAqC,qBAAqB,4EAA4E,iFAAiF,8BAA8B,8BAA8B,yBAAyB,iCAAiC,yDAAyD,kCAAkC,kCAAkC,8BAA8B,mEAAmE,mCAAmC,4BAA4B,yBAAyB,iGAAiG,8DAA8D,uBAAuB,gDAAgD,2FAA2F,yBAAyB,4FAA4F,oEAAoE,yCAAyC,0DAA0D,SAAS,EAAC;;;ACAv2G;;AAE+C;AACc;AAChB;AACM;AACO;AACf;AAC3C,IAAI,uBAAY,GAAG,0BAAqB;AAC6B;AACrB;AACV;AACA;AACc;;AAEQ;AAC5D,4BAAuB,CAAC,YAAW;;AAEnC,IAAI,wBAAa;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,gCAAgC,uBAAkB;AAClD;AACA,oBAAoB,2BAAsB;AAC1C;AACA;AACA,SAAS;AACT,gCAAgC,uBAAkB;AAClD;AACA,oBAAoB,2BAAsB;AAC1C;AACA;AACA,SAAS;AACT;AACA;;AAEA,2BAA2B,mBAAc;;AAEzC,4BAA4B,iBAAY;AACxC;AACA,SAAS;AACT;;AAEA;AACA;AACA,2BAA2B,iBAAU;AACrC;AACA;AACA,SAAS;;AAET;AACA;AACA,2BAA2B,iBAAU;AACrC;AACA;AACA,SAAS;;AAET;AACA;AACA,qCAAqC,0BAAqB;AAC1D;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,wCAAwC,mBAAc;AACtD,0BAA0B,OAAe,EAAE,uBAAuB;AAClE;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,6CAA6C,0BAAqB;AAClE;AACA;AACA,SAAS;AACT,0CAA0C,UAAU;AACpD;AACA;AACA,SAAS;AACT;AACA;;AAEA,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2DAA2D,kBAAa;;AAExE;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAa;AACpC,uBAAuB,wBAAa;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAiB;AAChD;AACA,yBAAyB,8BAA8B;AACvD;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8DAA8D;AAC9D,8DAA8D;;AAE9D;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,sBAAiB,QAAQ,sBAAiB;AACpE,yBAAyB,sBAAiB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA,mBAAmB,0BAAqB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,yBAAoB;AAC5C,4BAA4B,uBAAY;AACxC,0BAA0B,uBAAY;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B,wBAAa;;AAE3C;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mCAAmC;AACnC,6BAA6B,wBAAa;AAC1C,sCAAsC,wBAAa;AACnD;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,aAAa;AACzD;AACA;AACA;AACA;AACA;AACA,oCAAoC,yCAA+B;AACnE;AACA;AACA;;AAEA;AACA,6BAA6B,8BAAoB;AACjD,uBAAuB,eAAe;AACtC;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;AACA;AACA;AACA,2BAA2B,wBAAa;AACxC;AACA,gBAAgB,wBAAa;;AAE7B;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;;ACzkBF;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,WAAW,GAAU;AACrB;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,MAAa;AACxB;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,CAAC;;AAED;AACA,0DAAe,SAAS,E;;ACnFuB;AACe;;AAE9D;;AAEA,IAAI,wBAAc;;AAElB;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,+BAAqB,cAAc,mBAAS;;AAE5C,yDAAe,WAAW,E;;ACpDqB;;AAE/C;;AAEA,IAAI,2BAAiB;AACrB;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,+BAAqB,SAAS,sBAAY;;AAE1C,oDAAe,MAAM,E;;AC5BrB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAI,uBAAa;AACjB,IAAI,uBAAa;AACjB,UAAU,gBAAgB,sCAAsC,iBAAiB,EAAE;AACnF,yBAAyB,8EAA8E;AACvG,WAAW,uBAAa;AACxB;;AAEO,SAAS,iBAAS;AACzB,IAAI,uBAAa;AACjB,mBAAmB,sBAAsB;AACzC;AACA;;AAEO,IAAI,gBAAQ;AACnB,IAAI,gBAAQ;AACZ,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA,WAAW,gBAAQ;AACnB;;AAEO,SAAS,cAAM;AACtB;AACA;AACA;AACA;AACA,4DAA4D,cAAc;AAC1E;AACA;AACA;AACA;AACA;;AAEO,SAAS,kBAAU;AAC1B;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;;AAEO,SAAS,eAAO;AACvB,mCAAmC,oCAAoC;AACvE;;AAEO,SAAS,kBAAU;AAC1B;AACA;;AAEO,SAAS,iBAAS;AACzB,2BAA2B,+DAA+D,gBAAgB,EAAE,EAAE;AAC9G;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,qFAAqF;AACpH;AACA,KAAK;AACL;;AAEO,SAAS,mBAAW;AAC3B,aAAa,6BAA6B,0BAA0B,aAAa,EAAE,qBAAqB;AACxG,gBAAgB,qDAAqD,oEAAoE,aAAa,EAAE;AACxJ,sBAAsB,sBAAsB,qBAAqB,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,kCAAkC,SAAS;AAC3C,kCAAkC,WAAW,UAAU;AACvD,yCAAyC,cAAc;AACvD;AACA,6GAA6G,OAAO,UAAU;AAC9H,gFAAgF,iBAAiB,OAAO;AACxG,wDAAwD,gBAAgB,QAAQ,OAAO;AACvF,8CAA8C,gBAAgB,gBAAgB,OAAO;AACrF;AACA,iCAAiC;AACjC;AACA;AACA,SAAS,YAAY,aAAa,OAAO,EAAE,UAAU,WAAW;AAChE,mCAAmC,SAAS;AAC5C;AACA;;AAEO,IAAI,uBAAe;AAC1B;AACA,kCAAkC,oCAAoC,aAAa,EAAE,EAAE;AACvF,CAAC;AACD;AACA;AACA,CAAC;;AAEM,SAAS,oBAAY;AAC5B,yFAAyF,uBAAe;AACxG;;AAEO,SAAS,gBAAQ;AACxB;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;;AAEO,SAAS,cAAM;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,MAAM,gBAAgB;AACzC;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;;AAEO,SAAS,gBAAQ;AACxB,4BAA4B,sBAAsB;AAClD,uBAAuB,cAAM;AAC7B;AACA;;AAEO,SAAS,sBAAc;AAC9B,iDAAiD,QAAQ;AACzD,wCAAwC,QAAQ;AAChD,wDAAwD,QAAQ;AAChE;AACA;AACA;;AAEO,SAAS,eAAO;AACvB,2BAA2B,eAAO,4BAA4B,eAAO;AACrE;;AAEO,SAAS,wBAAgB;AAChC;AACA;AACA,iBAAiB,sFAAsF,aAAa,EAAE;AACtH,sBAAsB,gCAAgC,qCAAqC,0CAA0C,EAAE,EAAE,GAAG;AAC5I,2BAA2B,MAAM,eAAe,EAAE,YAAY,oBAAoB,EAAE;AACpF,sBAAsB,oBAAoB,eAAO,yEAAyE;AAC1H,6BAA6B,uBAAuB;AACpD,4BAA4B,wBAAwB;AACpD,2BAA2B,yDAAyD;AACpF;;AAEO,SAAS,wBAAgB;AAChC;AACA,iBAAiB,4CAA4C,SAAS,EAAE,qDAAqD,aAAa,EAAE;AAC5I,yBAAyB,6BAA6B,oBAAoB,QAAQ,eAAO,iCAAiC,gBAAgB,EAAE,KAAK;AACjJ;;AAEO,SAAS,qBAAa;AAC7B;AACA;AACA,uCAAuC,gBAAQ,kBAAkB,gBAAQ,kCAAkC,sFAAsF,aAAa,EAAE;AAChN,sBAAsB,8BAA8B,gDAAgD,uDAAuD,EAAE,EAAE,GAAG;AAClK,4CAA4C,sCAAsC,UAAU,oBAAoB,EAAE,EAAE,UAAU;AAC9H;;AAEO,SAAS,4BAAoB;AACpC,gCAAgC,uCAAuC,aAAa,EAAE,EAAE,OAAO,kBAAkB;AACjH;AACA;;AAEA,IAAI,0BAAkB;AACtB,yCAAyC,6BAA6B;AACtE,CAAC;AACD;AACA;;AAEO,SAAS,oBAAY;AAC5B;AACA;AACA,6GAA6G,uBAAe;AAC5H,IAAI,0BAAkB;AACtB;AACA;;AAEO,SAAS,uBAAe;AAC/B,4CAA4C;AAC5C;;AAEO,SAAS,8BAAsB;AACtC;AACA;AACA;AACA;AACA;;AAEO,SAAS,8BAAsB;AACtC;AACA;AACA;AACA;AACA;AACA;;;;ACjOA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACuC;AACS;AAChD;AACA;AACA;AACA;AACA,8CAA8C;AAC9C;AACA;;AAEO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAE,MAAa;AACf;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,iCAAiC;;AAEjC;AACA,QAAQ,IAAqC;AAC7C,MAAM,IAAW;AACjB;AACA;AACA;AACA,OAAO;AACP;;AAEA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,sBAAsB,uBAAuB;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT,oBAAoB,YAAmB;AACvC,0EAA0E,sBAAc;AACxF;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA,IAAI,WAAa;AACjB;AACA;AACA;AACA,IAAI,QAAe;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA,+CAA+C,yBAAyB;AACxE;AACA,mCAAmC;AACnC;AACA;AACA;AACA;;;AAGO;AACP;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;;AAEA,MAAM,IAAqC;AAC3C,IAAI,MAAa;AACjB;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kBAAkB,uBAAuB;AACzC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,wCAAwC;;AAExC;AACA;;AAEA;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;;AAEA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,MAAM,IAAW;AACjB;AACA,OAAO;AACP,KAAK;AACL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,IAAI,IAAW;AACf;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD,cAAc,sBAAsB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,IAAI;AACJ,I;;;AC5VA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACjC;AACf;AACA,iBAAiB,uBAAuB;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,uBAAuB;AAC1C;;AAEA,sBAAsB,OAAc,yCAAyC,OAAc;AAC3F;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA,C;;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACzC;AACP;AACA;AACA,mBAAmB,eAAe;;AAElC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;;;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACiD;AACH;AAC9C,wCAAwC;;AAExC,sBAAsB,IAAM;;AAE5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;;;AAGA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA,gDAAe,cAAc,E;;;ACjG7B;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACzC;AACP;AACA;AACA,mBAAmB,eAAe;;AAElC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;;;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACzC;AACP;AACA;AACA,mBAAmB,eAAe;;AAElC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,CAAC;;;;;AC1DD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACuC;AAC6B;AACjB;AACJ;AACI;AACA;AACS;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,IAAI,KAAK;AACT,IAAI;AACJ;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,6CAA6C;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA,+CAA+C;;;AAG/C;AACA;AACA,oBAAoB,KAAK;AACzB,IAAI;AACJ;AACA;AACA;;;AAGA;AACA;AACA;AACA;;AAEA;AACA,IAAI;AACJ;AACA;;;AAGA;AACA;AACA,IAAI;;;AAGJ;AACA,SAAS,aAAQ;AACjB;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,oBAAoB;AACvC;AACA;AACA;AACA,OAAO;;;AAGP;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,CAAC;;AAED,CAAC;;AAED,iBAAiB;AACjB,gBAAgB;AAChB,KAAK,QAAQ,cAAc;AAC3B,KAAK,QAAQ,cAAc;AAC3B,KAAK,QAAQ,cAAc;AAC3B,KAAK,QAAQ,SAAc;AAC3B,kDAAe,KAAK,E;;;ACrPpB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6CAAe;AACf;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,0CAA0C,MAAM;AAChD;AACA,KAAK;AACL;AACA;AACA;AACA,+BAA+B,WAAW,QAAQ,WAAW;AAC7D,kCAAkC,WAAW;AAC7C,OAAO;AACP;AACA,mCAAmC,YAAY;AAC/C,yBAAyB,SAAS,cAAc,WAAW,eAAe,WAAW;AACrF,4BAA4B,SAAS,cAAc,WAAW;AAC9D;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,+BAA+B,WAAW;AAC1C,+BAA+B,KAAK,KAAK,MAAM;AAC/C,qBAAqB,MAAM;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;;AC1JD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAAe;AACf;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,0BAA0B,MAAM;AAChC;AACA,KAAK;AACL;AACA;AACA;AACA,yBAAyB,WAAW,IAAI,WAAW;AACnD,4BAA4B,WAAW;AACvC,OAAO;AACP;AACA,oBAAoB,YAAY;AAChC,qBAAqB,SAAS,SAAS,WAAW,EAAE,WAAW;AAC/D,wBAAwB,SAAS,OAAO,WAAW;AACnD;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,yBAAyB,WAAW;AACpC,kBAAkB,KAAK,KAAK,MAAM;AAClC,qBAAqB,MAAM;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;;ACtJD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACmC;AACI;;AAEH;AACA;AAC2B;AAC/D;AACA;AACA;AACA;AACA;AACO,mBAAmB,qBAAgB;AAC1C;AACA;AACA;AACA;AACA,CAAC;AACM;AACP;AACA,6BAA6B,WAAK;AAClC;AACA,CAAC;AACD;AACA;;AAEO;AACP,MAAM,QAAQ;AACd;;AAEA;AACA,aAAa,KAAK;AAClB,KAAK;AACL,aAAa,KAAK,CAAC,KAAK,aAAa,KAAK;AAC1C;AACA,GAAG;AACH,WAAW,KAAK,CAAC,KAAK,UAAU,KAAK;AACrC;AACA;AACO;AACP;AACA;AACO;AACP;AACA,CAAC;;AAED,0BAA0B,MAAM;AAChC,0BAA0B,MAAM,E;;;ACxFhC;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACT;AAC6C;AACjD;AAC5B;AACA;AACA;AACA;AACA;AACA;AACP,UAAU,KAAK;AACf,WAAW,IAAI;AACf,SAAS,EAAE;AACX,UAAU,GAAG,EAAE,GAAG;AAClB,YAAY,GAAG,EAAE,GAAG;AACpB,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG;AACzB,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI;AACpC,UAAU,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI;AAC9C;AACA,yBAAyB,KAAK,EAAE,GAAG,EAAE,GAAG;AACjC;AACP,UAAU,KAAK;AACf,WAAW,KAAK,EAAE,GAAG;AACrB;AACA;AACA;AACA;AACA;AACA;AACO;AACA;AACA;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,aAAa,SAAoB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,WAAK,UAAU,cAAc,SAAS,WAAW,KAAK,qBAAqB;AAC/G;AACA;AACA;AACA;AACA;AACA,oCAAoC,KAAK,sBAAsB,GAAG,4BAA4B,EAAE,sBAAsB,KAAK,4BAA4B,IAAI,gCAAgC,GAAG,yBAAyB,EAAE,sBAAsB,GAAG,yBAAyB,EAAE,sBAAsB,KAAK,4BAA4B,GAAG,gCAAgC,EAAE,sBAAsB,GAAG,yBAAyB,EAAE,sBAAsB,GAAG,8BAA8B,EAAE,sBAAsB,GAAG,yBAAyB,EAAE,sBAAsB,GAAG,yBAAyB,EAAE,sBAAsB,IAAI,yBAAyB,EAAE;AACnnB;AACO;AACP;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,KAAK;AACL,GAAG;AACH,mBAAmB,WAAa,GAAG;;AAEnC;AACA,qBAAqB,6BAA6B;AAClD,0CAA0C,8CAA8C;AACxF;AACA;;AAEA;AACA,MAAM,aAAe;AACrB;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA,gCAAgC,QAAQ;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,QAAQ,OAAc;AACtB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACO;AACP,aAAa,SAAoB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACO;AACP,yCAAyC,SAAoB;AAC7D;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA,C;;;ACpSA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACuC;AACI;AACpC;AACP,EAAE,YAAY;AACd,mBAAmB,IAAI;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,C;;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACiB;AACd;AACP;AAC5C;AACA;AACA;;AAEO;AACP,OAAO,SAAS;AAChB,WAAW,QAAe;AAC1B;;AAEA;AACA,+BAA+B,IAAI,UAAU,EAAE;AAC/C;AACO;AACP;AACA;AACA,GAAG;;AAEH;AACA;AACA;;AAEA;AACA;AACO,IAAI,wBAAiB,GAAG,iBAAwB;AACvD;AACA;AACA,aAAa;AACb,YAAY;AACZ,YAAY;AACZ,cAAc;AACd,cAAc;AACd;AACO;AACP;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,6CAA6C,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;;AAE3E;AACA,kBAAkB,IAAW;AAC7B;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,4BAA4B,SAAS;;AAErC;AACA,aAAa,MAAU;AACvB,KAAK;AACL;AACA,KAAK;;AAEL;;AAEA;AACA,WAAW,YAAmB,wCAAwC,QAAe;AACrF,GAAG;;;AAGH,sBAAsB,eAAe;AACrC,0EAA0E,YAAmB;AAC7F;AACA;;AAEA;AACA,WAAW,uDAAuD;AAClE;AACA;AACA;AACA,WAAW,sBAAsB;AACjC;;;AAGO;AACP,OAAO,OAAc;AACrB;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA,iBAAiB,kBAAkB;AACnC;AACA;AACA;;AAEA,yBAAyB,uBAAuB;AAChD,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEO;AACP,EAAE,IAAW;AACb,wBAAwB,YAAY;AACpC,GAAG;AACH;AACA;AACO;AACP,YAAY,QAAe;AAC3B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,mEAAmE,sBAAsB,iBAAiB,gBAAgB,uBAAuB,UAAU,WAAW;AACtK,4BAA4B,4EAA4E,iBAAiB,wBAAwB,WAAW,YAAY,2CAA2C;AACnN,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,QAAQ;AACnB;AACA;AACA;AACA;;AAEO;AACP,MAAM,IAAqC;AAC3C,IAAI,mBAAmB;AACvB;;AAEA;AACA;AACA;;AAEA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,GAAG,qFAAqF,GAAG,sCAAsC,GAAG,sCAAsC,GAAG,sCAAsC,GAAG,uCAAuC,GAAG;AAC1R;AACA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;;AAEO;AACP;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,SAAS,QAAe,kBAAkB,QAAe,wDAAwD;AACjH;AACoE;AACpE;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;;;ACrRA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;AACS;AACjB;AACD;AACvC,IAAI,WAAI,GAAG,IAAW;AACtB;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEO;;AAEP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;AACL;AACA,wBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,6BAA6B;AACxC,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;;AAGO;AACP;AACA;AACA,WAAW,6BAA6B;AACxC,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;AAEO,WAAW,KAAY;AAC9B;AACA;AACA,WAAW,6BAA6B;AACxC,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;;AAEO,WAAW,KAAY;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA,UAAU,mBAAY;AACtB,UAAU,mBAAY;AACtB,WAAW,mBAAY;AACvB,WAAW,mBAAY;AACvB;AACA;AACA;AACA;AACA,WAAW,wBAA4B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP,WAAW,wBAA4B;AACvC;AACA;AACA,aAAa,mBAAY;AACzB,YAAY,mBAAY;AACxB,cAAc,mBAAY;AAC1B,eAAe,mBAAY;AAC3B,cAAc,mBAAY;AAC1B,eAAe,mBAAY;AAC3B;AACA;AACA,mCAAmC;;AAEnC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;;;AAGL;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;;AAEA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iBAAiB,iBAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,UAAU,GAAG;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,qCAAqC,iBAAY;AACjD,GAAG;AACH;;AAEA;AACA,6CAA6C;AAC7C;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH,iCAAiC,aAAe;AAChD;AACA;AACA,GAAG,wCAAwC;AAC3C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;AAEO;AACP;AACA;AACO;AACP;AACA,SAAS,QAAe;AACxB;AACA,GAAG;AACH;AACA;AACA;AACA,4BAA4B,oBAAoB,cAAc;AAC9D;AACA,IAAI,SAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEO;AACP;AACA,GAAG,OAAc;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,WAAI;AACR;AACA,KAAK;AACL,IAAI,WAAI;AACR;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,KAAK,sBAAsB,uBAAuB;AAClD,yBAAyB,WAAW,iBAAiB,WAAW;AAChE;AACA;;;AAGA;AACA;AACA,KAAK,sBAAsB,uBAAuB;AAClD;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,uBAAuB,kBAAkB;AACzC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,IAAI,WAAI;AACR;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEO;AACP,4BAA4B;AAC5B;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY,OAAO;AACnB;;AAEO;AACP,sBAAsB,WAAI;AAC1B;AACA,GAAG;AACH;AACA,C;;ACzeqC;AACD;AACJ;;AAEhC;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,uBAAuB,oCAAoC;AAC3D;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,oBAAoB;AAC9B,YAAY,WAAW;AACvB,WAAW,oBAAoB;AAC/B,WAAW,oBAAoB;AAC/B,eAAe,2BAA2B;AAC1C,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,IAAI,8BAAyB;AAC7B;;AAEA;AACA,mBAAmB,iCAAiC;AACpD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,eAAe,wBAAY;;AAE3B,0BAA0B,sBAAsB;AAChD;AACA;;AAEA;AACA,gCAAgC,6BAA6B;AAC7D,gCAAgC,4BAA4B;AAC5D,+BAA+B,cAAc;AAC7C,SAAS;AACT,gCAAgC,2BAA2B;AAC3D,gCAAgC,4BAA4B;AAC5D;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C,uBAAuB,oBAAoB;AAC3C;AACA;;AAEA,SAAS,wBAAY;AACrB;AACA;AACA;;AAEA,6DAAe,WAAW,EAAC;;;AC5G3B,qDAAe,sFAAsF,qCAAqC,uCAAuC,yCAAyC,yCAAyC,wGAAwG,0BAA0B,cAAc,gCAAgC,0EAA0E,yFAAyF,oDAAoD,gCAAgC,+CAA+C,GAAG,oEAAoE,0BAA0B,6BAA6B,iCAAiC,6BAA6B,iCAAiC,8CAA8C,qDAAqD,2BAA2B,0DAA0D,WAAW,IAAI,IAAI,6CAA6C,yBAAyB,iCAAiC,gEAAgE,0BAA0B,iCAAiC,4DAA4D,uEAAuE,0BAA0B,oDAAoD,yBAAyB,0DAA0D,WAAW,gEAAgE,0BAA0B,+CAA+C,8CAA8C,qDAAqD,yCAAyC,iDAAiD,WAAW,gGAAgG,6BAA6B,qCAAqC,mEAAmE,eAAe,gCAAgC,0EAA0E,yFAAyF,iDAAiD,qCAAqC,GAAG,sEAAsE,4BAA4B,+BAA+B,8CAA8C,yDAAyD,oEAAoE,8BAA8B,oCAAoC,WAAW,mIAAmI,iCAAiC,gDAAgD,GAAG,6EAA6E,kDAAkD,iDAAiD,8CAA8C,yBAAyB,YAAY,yEAAyE,KAAK,qDAAqD,wEAAwE,sEAAsE,uEAAuE,iEAAiE,kEAAkE,wEAAwE,uEAAuE,kEAAkE,8BAA8B,WAAW,iEAAiE,kDAAkD,GAAG,mDAAmD,iBAAiB,qBAAqB,wBAAwB,WAAW,IAAI,sDAAsD,uCAAuC,4BAA4B,gDAAgD,gDAAgD,uBAAuB,GAAG,4HAA4H,yDAAyD,4CAA4C,+BAA+B,sIAAsI,4CAA4C,0EAA0E,0CAA0C,uEAAuE,aAAa,cAAc,GAAG,8FAA8F,2FAA2F,GAAG,iFAAiF,kCAAkC,gDAAgD,+CAA+C,sDAAsD,+BAA+B,6CAA6C,gCAAgC,6BAA6B,IAAI,KAAK,cAAc,IAAI,uEAAuE,WAAW,mSAAmS,4EAA4E,mFAAmF,gJAAgJ,uEAAuE,iEAAiE,sEAAsE,qEAAqE,wGAAwG,0FAA0F,iGAAiG,2IAA2I,4CAA4C,kEAAkE,wLAAwL,uBAAuB,qBAAqB,oCAAoC,YAAY,gJAAgJ,yCAAyC,KAAK,8CAA8C,0BAA0B,WAAW,+BAA+B,KAAK,GAAG,2LAA2L,8HAA8H,uBAAuB,2BAA2B,sBAAsB,wBAAwB,YAAY,iGAAiG,0PAA0P,qCAAqC,IAAI,KAAK,qDAAqD,iCAAiC,YAAY,+BAA+B,KAAK,GAAG,mHAAmH,uBAAuB,qBAAqB,2CAA2C,YAAY,qKAAqK,yCAAyC,KAAK,qDAAqD,iCAAiC,YAAY,+BAA+B,KAAK,GAAG,2JAA2J,sBAAsB,kBAAkB,qBAAqB,qCAAqC,YAAY,6CAA6C,wCAAwC,oHAAoH,KAAK,+CAA+C,2BAA2B,YAAY,+BAA+B,KAAK,GAAG,uBAAuB,EAAC;;;ACA30T;AACI;AACE;AACQ;AACR;AACA;AACH;AACJ;AACI;AACM;AACR;AACI;AACI;AACa;AACL;;AAEX;AACc;;AAEhB;;AAEpC,IAAI,iBAAO;;AAEoD;AAC/D,iBAAgB,CAAC,cAAa;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA,oBAAoB,gBAAW;AAC/B;AACA;AACA;AACA,mBAAmB,iCAAiC,KAAK;AACzD,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA,0BAA0B,eAAW;;AAErC,qBAAqB;AACrB;AACA;AACA;AACA;AACA,SAAS;;AAET,2BAA2B;AAC3B,8BAA8B;;AAE9B;AACA;;AAEA,yBAAyB;AACzB,2BAA2B;;AAE3B,0BAA0B,sBAAW;AACrC;AACA,CAAC;AACD;AACA,8BAA8B,eAAI;AAClC,kBAAkB,iBAAa;AAC/B,KAAK;AACL,8BAA8B,eAAI;AAClC,kBAAkB,iBAAa;AAC/B,KAAK;AACL;AACA;AACA;AACA;;AAEA,gCAAgC,eAAI;AACpC,kBAAkB,iBAAa;AAC/B,KAAK;AACL,CAAC;AACD;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,WAAW;AAC3B,gBAAgB,YAAY;AAC5B,gBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,cAAc;AAC9B,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,uBAAuB,yBAAyB;AAChD;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,mCAAmC;AAC1D;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,4BAA4B;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD,uDAAuD;AACvD,6DAA6D;AAC7D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD,wDAAwD;AACxD;AACA;;AAEA;AACA;AACA;AACA,kDAAkD;AAClD,gDAAgD;AAChD,sDAAsD;AACtD;;AAEA;AACA,mDAAmD;AACnD;AACA,KAAK;;AAEL;;AAEA,+BAA+B,YAAO;AACtC,kCAAkC,YAAO;AACzC,2BAA2B,gBAAW;AACtC,6BAA6B,YAAO;AACpC,kCAAkC,YAAO;AACzC,sCAAsC,YAAO;AAC7C,kCAAkC,YAAO;;AAEzC;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB,6BAA6B,8BAA0B;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,YAAY,oBAAW;AACvB,YAAY,sBAAa;AACzB,YAAY,sBAAa;;AAEzB;AACA,uDAAuD,kBAAiB;;AAExE;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,2BAA2B,yBAAyB;AACpD;AACA;AACA;AACA;AACA,oBAAoB,yBAAgB;AACpC;AACA;AACA,oBAAoB,mBAAU;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,iCAAiC,YAAO;AACxC;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb,yBAAyB,8BAA0B;AACnD;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,yBAAyB,YAAO;AAChC;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,yBAAyB,8BAA0B;AACnD;;AAEA;AACA;AACA;AACA,uBAAuB,gBAAW;AAClC;AACA,4BAA4B,gBAAW;AACvC;AACA;AACA;AACA,yBAAyB,YAAO;AAChC;AACA;;AAEA,iCAAiC;AACjC;AACA;AACA;AACA;AACA,mCAAmC,KAAK,iBAAO,QAAQ;AACvD,2CAA2C,iBAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,+BAA+B,KAAK,iBAAO,QAAQ;AACnD,sCAAsC,iBAAO;AAC7C;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,KAAK,iBAAO,QAAQ;AACnD,0CAA0C,iBAAO;AACjD,2CAA2C,iBAAO;AAClD;AACA;AACA;AACA,SAAS;;AAET,uBAAuB,OAAO;AAC9B,yBAAyB,iBAAO;AAChC;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,iCAAiC,YAAQ;AACzC;AACA,4BAA4B,UAAM,CAAC,iBAAa,2BAA2B,iBAAa;AACxF,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,kBAAkB,iBAAa;AAC/B;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,eAAW;AACzC;AACA;AACA,8BAA8B,aAAS;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iBAAa;AAC5C;AACA;AACA;AACA,oCAAoC,cAAc;AAClD,oCAAoC,cAAc;AAClD;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC,wBAAwB,kBAAiB;AACzC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA,8BAA8B,uBAAkB,EAAE,uBAAkB;AACpE;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,kCAAkC,YAAO;AACzC,uCAAuC,gBAAW;AAClD,gCAAgC,gBAAW;AAC3C;AACA;AACA;AACA;AACA,qDAAqD,mBAAW;AAChE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,mBAAc;AAC1B,YAAY,qBAAgB;;AAE5B;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,0CAA0C,kBAAiB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,oBAAW;;AAEnB;AACA,KAAK;;AAEL;AACA,gBAAgB,oCAAoC;AACpD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;;AAEA,gDAAe,aAAa,EAAC;;;ACt4BG;;AAEhC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,gBAAW;AAChC;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,uBAAuB;;AAEvB;AACA;AACA,+BAA+B;AAC/B,2BAA2B;;AAE3B,qBAAqB;AACrB,6BAA6B;;AAE7B;AACA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA,2CAA2C;AAC3C;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA,oCAAoC;AACpC;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL,0BAA0B;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6GAA6G;AAC7G;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,gEAAe,cAAc,EAAC;;;ACrPE;AACS;;AAEzC;AACA;AACA;AACA;AACA,YAAY,gBAAW;AACvB;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,eAAe,+BAA+B;AAC9C;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;AACL;AACA,gBAAgB,sCAAsC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,0DAA0D,yBAAS;AACnE;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,uDAAe,KAAK,EAAC;;;AC3IO;AACY;AACC;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,uBAAY;AAC7B;AACA;AACA;;AAEA,0BAA0B,sBAAW;;AAErC,0BAA0B,eAAW;AACrC;AACA,SAAS;AACT;AACA,CAAC;AACD;AACA;AACA;AACA,QAAQ,uCAA4B;AACpC;AACA,KAAK;AACL;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;;AAEA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;;AAEA,uBAAuB,0BAA0B;AACjD;AACA;;AAEA,uBAAuB,0BAA0B;AACjD;AACA;;AAEA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,cAAc;AAC7B;AACA;AACA;AACA;AACA,CAAC;;AAED,4DAAe,UAAU,EAAC;;;ACrFoB;AACV;AACK;;AAEzC;AACA;AACA;AACA;AACA,gBAAgB,gCAAqB;AACrC;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA,CAAC;AACD,2BAA2B,eAAW;AACtC,CAAC;AACD;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gCAAgC,uBAAuB,GAAG,uBAAuB;AACjF;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,CAAC;;AAED,2DAAe,SAAS,EAAC;;;AC9FqB;;AAE9C;AACA;AACA;AACA;AACA,kBAAkB,gCAAqB;AACvC;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC;;AAED;AACA;AACA,KAAK;;AAEL;AACA,+BAA+B;AAC/B;AACA,CAAC;;AAED,6DAAe,WAAW,EAAC;;;AC9B3B;AAC0B;AACoB;;AAE9C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,iBAAiB,gCAAqB;AACtC;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA,kBAAkB;;AAElB;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA,uBAAuB;;AAEvB;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA,+BAA+B;AAC/B,2BAA2B;;AAE3B,qBAAqB;AACrB,6BAA6B;;AAE7B;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,mBAAmB,eAAI;AACvB;AACA,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA,gBAAgB,cAAc;AAC9B;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,kBAAkB,OAAO;AACzB;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,gBAAgB,OAAO;AACvB,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,OAAO;AACvB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,QAAQ,8CAAmC;;AAE3C;AACA;AACA;AACA,CAAC;;AAED,4DAAe,UAAU,EAAC;;;AChT1B,uDAAe,8DAA8D,4BAA4B,iCAAiC,+BAA+B,+BAA+B,4BAA4B,iCAAiC,8CAA8C,gBAAgB,8CAA8C,4DAA4D,kEAAkE,wDAAwD,qDAAqD,qCAAqC,mDAAmD,qCAAqC,GAAG,oEAAoE,4BAA4B,iCAAiC,gBAAgB,8CAA8C,2CAA2C,qCAAqC,GAAG,kEAAkE,4BAA4B,+BAA+B,gBAAgB,8CAA8C,uDAAuD,qCAAqC,GAAG,kEAAkE,4BAA4B,+BAA+B,gBAAgB,6CAA6C,6CAA6C,qCAAqC,GAAG,+DAA+D,4BAA4B,4BAA4B,gBAAgB,6CAA6C,0CAA0C,qCAAqC,GAAG,oEAAoE,4BAA4B,iCAAiC,8CAA8C,gBAAgB,6CAA6C,wBAAwB,mCAAmC,mDAAmD,qCAAqC,GAAG,OAAO,EAAC;;;ACAvqE,gDAAe,oEAAoE,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,6EAA6E,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,2BAA2B,4BAA4B,4BAA4B,4BAA4B,4GAA4G,wBAAwB,+BAA+B,4CAA4C,8BAA8B,6EAA6E,iFAAiF,uCAAuC,wBAAwB,yBAAyB,kBAAkB,OAAO,OAAO,+BAA+B,iFAAiF,oBAAoB,kBAAkB,IAAI,wDAAwD,GAAG,SAAS,EAAC;;;ACAv9C,+CAAe,8DAA8D,4BAA4B,8CAA8C,wCAAwC,wDAAwD,qCAAqC,sCAAsC,wDAAwD,GAAG,0EAA0E,+BAA+B,+BAA+B,iCAAiC,wCAAwC,0EAA0E,+EAA+E,oFAAoF,0DAA0D,GAAG,6DAA6D,4BAA4B,8CAA8C,gBAAgB,+CAA+C,qCAAqC,6CAA6C,GAAG,OAAO,EAAC;;;ACA3pC,+CAAe,wDAAwD,4BAA4B,2BAA2B,gBAAgB,6CAA6C,kCAAkC,cAAc,2CAA2C,gDAAgD,cAAc,0CAA0C,+CAA+C,gBAAgB,6EAA6E,6EAA6E,gBAAgB,6EAA6E,6EAA6E,+CAA+C,+CAA+C,+DAA+D,4CAA4C,GAAG,OAAO,EAAC;;;ACAr9B,oDAAe,iFAAiF,4BAA4B,4BAA4B,0BAA0B,wCAAwC,0DAA0D,gCAAgC,qDAAqD,8FAA8F,GAAG,OAAO,EAAC;;;ACAld,kDAAe,+EAA+E,4BAA4B,wCAAwC,wDAAwD,8BAA8B,+CAA+C,+BAA+B,kDAAkD,gEAAgE,WAAW,OAAO,EAAC;;;ACA3c,kDAAe,2DAA2D,8BAA8B,4BAA4B,uCAAuC,0BAA0B,sDAAsD,gEAAgE,4DAA4D,GAAG,gBAAgB,0DAA0D,6EAA6E,8DAA8D,8DAA8D,8DAA8D,8DAA8D,iDAAiD,kDAAkD,cAAc,4CAA4C,oDAAoD,IAAI,WAAW,qBAAqB,IAAI,mCAAmC,GAAG,SAAS,EAAC;;;ACAljC,sDAAe,+DAA+D,wCAAwC,0BAA0B,qDAAqD,kCAAkC,GAAG,gDAAgD,0DAA0D,yFAAyF,oEAAoE,oEAAoE,oEAAoE,4CAA4C,4CAA4C,4CAA4C,4CAA4C,sDAAsD,8FAA8F,0EAA0E,+DAA+D,+DAA+D,+DAA+D,iBAAiB,2CAA2C,GAAG,OAAO,EAAC;;;ACA3wC,oDAAe,qFAAqF,wCAAwC,iCAAiC,0BAA0B,wEAAwE,4FAA4F,UAAU,0DAA0D,iEAAiE,2DAA2D,iEAAiE,2DAA2D,iEAAiE,2DAA2D,iEAAiE,2DAA2D,sCAAsC,mEAAmE,UAAU,0DAA0D,2DAA2D,2DAA2D,2DAA2D,qCAAqC,WAAW,OAAO,EAAC;;;ACArzC,+CAAe,uFAAuF,gDAAgD,gEAAgE,6BAA6B,oDAAoD,oDAAoD,kEAAkE,+BAA+B,iCAAiC,+DAA+D,oCAAoC,uCAAuC,sCAAsC,uCAAuC,0BAA0B,6DAA6D,wBAAwB,wBAAwB,wBAAwB,wBAAwB,wBAAwB,oEAAoE,GAAG,kCAAkC,8BAA8B,GAAG,qDAAqD,oCAAoC,cAAc,2CAA2C,gDAAgD,cAAc,0CAA0C,+CAA+C,gBAAgB,+EAA+E,+EAA+E,gBAAgB,+EAA+E,+EAA+E,4CAA4C,4CAA4C,+DAA+D,uBAAuB,GAAG,gDAAgD,0BAA0B,kCAAkC,6EAA6E,yBAAyB,2FAA2F,gDAAgD,4CAA4C,iJAAiJ,uCAAuC,qEAAqE,yEAAyE,kDAAkD,wCAAwC,yDAAyD,0CAA0C,uCAAuC,sFAAsF,8FAA8F,2EAA2E,4DAA4D,qDAAqD,sFAAsF,yEAAyE,2CAA2C,sGAAsG,yGAAyG,iHAAiH,2EAA2E,wEAAwE,IAAI,gEAAgE,WAAW,OAAO,EAAC;;;ACA11H,qDAAe,uFAAuF,8BAA8B,wCAAwC,gCAAgC,gCAAgC,iCAAiC,0BAA0B,mHAAmH,kPAAkP,GAAG,gBAAgB,2CAA2C,wCAAwC,sDAAsD,kDAAkD,4FAA4F,2BAA2B,kBAAkB,mBAAmB,SAAS,uDAAuD,iEAAiE,oCAAoC,gFAAgF,IAAI,0FAA0F,oFAAoF,oCAAoC,2CAA2C,gFAAgF,yBAAyB,GAAG,OAAO,EAAC;;;ACAhmD,iDAAe,+GAA+G,8BAA8B,8DAA8D,8BAA8B,8DAA8D,8BAA8B,8DAA8D,8BAA8B,8DAA8D,8BAA8B,8DAA8D,8BAA8B,kCAAkC,wCAAwC,wBAAwB,wFAAwF,gGAAgG,gGAAgG,gGAAgG,gGAAgG,gGAAgG,yCAAyC,GAAG,OAAO,EAAC;;;ACAtzC,gDAAe,yDAAyD,mCAAmC,0BAA0B,2IAA2I,uCAAuC,6GAA6G,4GAA4G,4GAA4G,2GAA2G,gFAAgF,yBAAyB,2BAA2B,2CAA2C,qCAAqC,qCAAqC,qCAAqC,qCAAqC,mCAAmC,qFAAqF,qFAAqF,YAAY,oDAAoD,mDAAmD,gHAAgH,6EAA6E,iIAAiI,+GAA+G,2GAA2G,eAAe,gGAAgG,2FAA2F,gBAAgB,sBAAsB,mCAAmC,wDAAwD,wCAAwC,IAAI,SAAS,wCAAwC,IAAI,GAAG,OAAO,EAAC;;;ACAnvE;AACd;AACF;AACA;AACU;AACJ;AACA;AACQ;AACJ;AACV;AACY;AACR;AACF;AACxD;;AAEA;AACe;AACf;AACA,qBAAqB,gBAAe;AACpC,qBAAqB,SAAQ;AAC7B,qBAAqB,QAAO;AAC5B,qBAAqB,QAAO;AAC5B,qBAAqB,aAAY;AACjC,qBAAqB,WAAU;AAC/B,qBAAqB,WAAU;AAC/B,qBAAqB,eAAc;AACnC,qBAAqB,aAAY;AACjC,qBAAqB,QAAO;AAC5B,qBAAqB,cAAa;AAClC,qBAAqB,UAAS;;AAE9B,qBAAqB,SAAQ;;AAE7B,C;;ACjC+B;AACkB;AACG;AACI;AACF;AACxB;AACE;AACI;AACI;;AAEmC;;AAE3E,QAAyB,CAAC,UAAM;;AAEhC;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA,yBAAyB,qBAAU;AACnC;;AAEA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,iBAAa;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,oBAAc;AACjC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,mBAAmB,sBAAgB;AACnC;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,mBAAmB,qBAAe;AAClC;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,WAAO;AACjC;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB;AACnB;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAI,cAAS;AACb;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,2BAAsB;AACjD,iBAAiB;AACjB;AACA,0BAA0B,eAAW;AACrC;AACA;AACA;AACA,uBAAuB,2BAAsB;AAC7C;AACA,0BAA0B,aAAS;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2DAAe,gBAAgB,EAAC;;;ACpThC;AACmD;AACnD,kEAAe,oBAAgB,E;;;ACD/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA,oDAAe,MAAM,E;;ACjBrB,gDAAe,0DAA0D,gCAAgC,+BAA+B,8BAA8B,8BAA8B,4BAA4B,+BAA+B,sCAAsC,qCAAqC,6BAA6B,4BAA4B,6BAA6B,iCAAiC,4BAA4B,iEAAiE,yBAAyB,oBAAoB,iBAAiB,OAAO,8BAA8B,iEAAiE,sDAAsD,uDAAuD,6BAA6B,oEAAoE,kDAAkD,iCAAiC,wFAAwF,IAAI,SAAS,qEAAqE,IAAI,uFAAuF,mEAAmE,IAAI,8EAA8E,0FAA0F,wCAAwC,GAAG,kBAAkB,uDAAuD,2EAA2E,sCAAsC,4BAA4B,UAAU,IAAI,gCAAgC,iDAAiD,yEAAyE,kEAAkE,+CAA+C,oCAAoC,qCAAqC,uCAAuC,4BAA4B,UAAU,IAAI,oBAAoB,gDAAgD,8DAA8D,0CAA0C,mCAAmC,qDAAqD,sDAAsD,sCAAsC,GAAG,qGAAqG,0DAA0D,oCAAoC,6BAA6B,+BAA+B,+BAA+B,wDAAwD,0BAA0B,iCAAiC,uCAAuC,0DAA0D,2EAA2E,GAAG,0BAA0B,mBAAmB,wBAAwB,wBAAwB,wBAAwB,wBAAwB,wBAAwB,0BAA0B,wBAAwB,qCAAqC,IAAI,SAAS,qCAAqC,IAAI,6BAA6B,qBAAqB,yBAAyB,oGAAoG,yFAAyF,4BAA4B,OAAO,OAAO,qFAAqF,yBAAyB,uFAAuF,mDAAmD,oEAAoE,wEAAwE,4BAA4B,8CAA8C,IAAI,qDAAqD,GAAG,WAAW,EAAC;;;ACA1nI;AACA;AACD;AACJ;AACK;AACP;AACU;AACnB;;AAEQ;AACtC,iBAAa,CAAC,SAAQ;;AAEtB;AACA;AACA;AACA,iBAAiB,YAAO;;AAExB,mBAAmB,UAAU;AAC7B,uBAAuB,UAAU;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,aAAS;AACxB;AACA,eAAe,kBAAc;AAC7B,eAAe,kBAAc;AAC7B;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B,kBAAkB,aAAM;AACxB,oBAAoB,aAAM;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,UAAU;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,yBAAyB,eAAI;AAC7B,kBAAkB,iBAAa;AAC/B,KAAK;AACL,yBAAyB,eAAI;AAC7B,kBAAkB,iBAAa;AAC/B,KAAK;AACL,4BAA4B,eAAW;AACvC;AACA,KAAK;;AAEL,4BAA4B,aAAS;AACrC,4BAA4B,aAAS;AACrC,6BAA6B,aAAS;;AAEtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,YAAO;AAC1C,IAAI,sBAAiB;;AAErB;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,sDAAe,QAAQ,E;;ACnOvB,+CAAe,4EAA4E,6BAA6B,4BAA4B,oCAAoC,oCAAoC,oCAAoC,oCAAoC,sCAAsC,qCAAqC,4BAA4B,6BAA6B,2BAA2B,4BAA4B,sCAAsC,kCAAkC,uCAAuC,0CAA0C,oCAAoC,+BAA+B,oCAAoC,sCAAsC,wBAAwB,4CAA4C,kCAAkC,4BAA4B,mIAAmI,gCAAgC,sCAAsC,0CAA0C,2EAA2E,iDAAiD,sCAAsC,+DAA+D,GAAG,oEAAoE,8DAA8D,iEAAiE,gCAAgC,GAAG,gDAAgD,6BAA6B,yCAAyC,2CAA2C,2CAA2C,oBAAoB,GAAG,wCAAwC,oDAAoD,GAAG,gEAAgE,iDAAiD,mCAAmC,GAAG,qCAAqC,iCAAiC,2EAA2E,IAAI,SAAS,wDAAwD,IAAI,GAAG,2EAA2E,8BAA8B,qBAAqB,oBAAoB,cAAc,IAAI,sEAAsE,0EAA0E,GAAG,mJAAmJ,iIAAiI,kDAAkD,iDAAiD,4CAA4C,4CAA4C,gDAAgD,uDAAuD,qDAAqD,uDAAuD,wBAAwB,0BAA0B,qCAAqC,kBAAkB,oBAAoB,cAAc,cAAc,IAAI,iCAAiC,mCAAmC,iCAAiC,gCAAgC,8CAA8C,4EAA4E,sDAAsD,qBAAqB,iBAAiB,iBAAiB,mCAAmC,kCAAkC,0BAA0B,mEAAmE,kBAAkB,4BAA4B,yCAAyC,0BAA0B,oBAAoB,mBAAmB,SAAS,eAAe,wBAAwB,6DAA6D,0CAA0C,yBAAyB,gEAAgE,2BAA2B,iBAAiB,qBAAqB,SAAS,IAAI,IAAI,qCAAqC,gBAAgB,yBAAyB,sBAAsB,GAAG,mIAAmI,+CAA+C,0DAA0D,2CAA2C,8EAA8E,6FAA6F,wCAAwC,kCAAkC,qCAAqC,2BAA2B,+BAA+B,uBAAuB,IAAI,gEAAgE,2EAA2E,2DAA2D,kBAAkB,GAAG,sEAAsE,gEAAgE,qDAAqD,WAAW,IAAI,gCAAgC,8DAA8D,WAAW,IAAI,8EAA8E,wDAAwD,mDAAmD,oGAAoG,2CAA2C,oCAAoC,kCAAkC,4CAA4C,wBAAwB,yDAAyD,kEAAkE,iEAAiE,qCAAqC,+BAA+B,0CAA0C,0CAA0C,oEAAoE,oBAAoB,sBAAsB,OAAO,sEAAsE,2CAA2C,kDAAkD,yBAAyB,iBAAiB,yGAAyG,gDAAgD,2EAA2E,mEAAmE,0EAA0E,0CAA0C,0CAA0C,6BAA6B,mDAAmD,qDAAqD,6DAA6D,MAAM,SAAS,mGAAmG,yGAAyG,YAAY,iHAAiH,IAAI,wCAAwC,sFAAsF,WAAW,IAAI,oBAAoB,WAAW,IAAI,yHAAyH,mDAAmD,sBAAsB,oGAAoG,2CAA2C,+BAA+B,gIAAgI,uDAAuD,GAAG,6DAA6D,oCAAoC,oCAAoC,0BAA0B,kCAAkC,4BAA4B,6BAA6B,+BAA+B,qEAAqE,2CAA2C,+CAA+C,iEAAiE,2EAA2E,GAAG,8CAA8C,4GAA4G,4BAA4B,2DAA2D,sEAAsE,4DAA4D,qCAAqC,0BAA0B,yBAAyB,4CAA4C,yCAAyC,kBAAkB,OAAO,OAAO,iFAAiF,+GAA+G,mCAAmC,+DAA+D,oBAAoB,mDAAmD,IAAI,wCAAwC,wEAAwE,yHAAyH,oDAAoD,WAAW,SAAS,EAAC;;;ACApnU;AACA;AACD;AACJ;AACK;AACP;AACU;AACnB;AACoB;;AAEV;;AAExC,iBAAa,CAAC,QAAW;;AAEzB;AACA;;AAEA,wBAAwB,eAAI;AAC5B,kBAAkB,iBAAa;AAC/B;AACA,KAAK;AACL,0BAA0B,eAAI;AAC9B,kBAAkB,iBAAa;AAC/B;AACA,KAAK;AACL,0BAA0B,eAAI;AAC9B,kBAAkB,iBAAa;AAC/B;AACA,KAAK;AACL,0BAA0B,eAAI;AAC9B,kBAAkB,iBAAa;AAC/B,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,2BAA2B,aAAS;AACpC,cAAc,sBAAkB;AAChC,KAAK;AACL,yBAAyB,aAAS;AAClC,cAAc,sBAAkB;AAChC,KAAK;AACL,yBAAyB,aAAS;AAClC,cAAc,sBAAkB;AAChC,KAAK;AACL,4BAA4B,aAAS;AACrC,cAAc,sBAAkB;AAChC,KAAK;AACL,+BAA+B,aAAS;AACxC,cAAc,sBAAkB;AAChC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,0BAA0B,YAAO;AACjC,2BAA2B,YAAO;AAClC,IAAI,sBAAiB;AACrB,IAAI,sBAAiB;;AAErB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uCAAuC,uCAAsC;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qDAAe,OAAO,E;;AC5NtB;;AAEA,oDAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;ACnCD,kDAAe,iKAAiK,+BAA+B,8GAA8G,wJAAwJ,kDAAkD,qGAAqG,KAAK,sGAAsG,+BAA+B,0BAA0B,0BAA0B,mEAAmE,+BAA+B,2CAA2C,uHAAuH,kBAAkB,qBAAqB,8BAA8B,oBAAoB,oCAAoC,gDAAgD,2BAA2B,qBAAqB,IAAI,IAAI,qEAAqE,gDAAgD,IAAI,+BAA+B,2BAA2B,gFAAgF,6CAA6C,IAAI,sBAAsB,UAAU,IAAI,4CAA4C,sBAAsB,GAAG,OAAO,EAAC;;;ACAxrD;;AAEA;AAC6C;AACJ;AACF;AACU;AACN;AACG;AACI;;AAEK;AACvD,iBAAa,CAAC,WAAU;;AAExB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,yBAAyB,aAAS;AAClC,gBAAgB,2BAAuB;AACvC,cAAc,wBAAoB;AAClC,KAAK;AACL,0BAA0B,aAAS;AACnC,cAAc,sBAAkB;AAChC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA,6CAA6C,gCAA4B;;AAEzE,+BAA+B,YAAQ;AACvC,oBAAoB,UAAM;AAC1B,YAAY,iBAAa;AACzB,YAAY,iBAAa;AACzB;AACA,KAAK;AACL;;AAEA,6BAA6B,wBAAuB;AACpD,2BAA2B,wBAAuB;AAClD,+BAA+B,wBAAuB;;;AAGtD,0BAA0B,eAAI;AAC9B,kBAAkB,iBAAa;AAC/B,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wDAAe,UAAU,E;;AC9MqB;AACA;AACD;AACJ;AACK;AACP;AACU;;AAEjD;AACA;;AAEA,yBAAyB,eAAI;AAC7B,kBAAkB,iBAAa;AAC/B,KAAK;;AAEL;AACA;;AAEA,8BAA8B,aAAS;AACvC,cAAc,sBAAkB;AAChC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,sDAAe,QAAQ,E;;ACxDvB,gDAAe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;;;;AAIT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;;;;;AAMT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;;;AAIT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,E;;ACjkBD,+CAAe,iDAAiD,6BAA6B,2BAA2B,mCAAmC,8BAA8B,gCAAgC,2BAA2B,4BAA4B,oDAAoD,wDAAwD,2EAA2E,0CAA0C,eAAe,+CAA+C,4CAA4C,yCAAyC,aAAa,IAAI,SAAS,wDAAwD,2GAA2G,wCAAwC,wBAAwB,cAAc,IAAI,yBAAyB,IAAI,qCAAqC,GAAG,wFAAwF,4BAA4B,8BAA8B,wBAAwB,4BAA4B,0BAA0B,qEAAqE,sDAAsD,wDAAwD,0DAA0D,kCAAkC,+CAA+C,uFAAuF,gEAAgE,wCAAwC,qIAAqI,6EAA6E,aAAa,4EAA4E,8BAA8B,wBAAwB,0BAA0B,oCAAoC,4CAA4C,oDAAoD,0BAA0B,kCAAkC,mEAAmE,GAAG,uEAAuE,0CAA0C,+DAA+D,yBAAyB,yBAAyB,8CAA8C,4HAA4H,iDAAiD,iCAAiC,qCAAqC,oBAAoB,yBAAyB,OAAO,+BAA+B,wDAAwD,yCAAyC,uCAAuC,mBAAmB,gEAAgE,wCAAwC,wBAAwB,2FAA2F,kBAAkB,iCAAiC,sBAAsB,4BAA4B,IAAI,mGAAmG,6BAA6B,mCAAmC,wBAAwB,WAAW,SAAS,EAAC;;;ACA3jH,gDAAe,gDAAgD,oCAAoC,iCAAiC,+BAA+B,6BAA6B,wCAAwC,4BAA4B,gCAAgC,0DAA0D,iDAAiD,+BAA+B,iFAAiF,GAAG,iBAAiB,wBAAwB,+BAA+B,yEAAyE,mCAAmC,mCAAmC,gBAAgB,+CAA+C,2CAA2C,+CAA+C,4CAA4C,4CAA4C,iDAAiD,6CAA6C,iDAAiD,0EAA0E,wEAAwE,8CAA8C,uCAAuC,sGAAsG,GAAG,OAAO,EAAC;;;ACA14C;AACM;AACJ;AACQ;AACqB;AACpC;AACF;AACY;AACF;AACJ;AACJ;;AAEM;;AAEgC;AACF;AACM;AACA;AACQ;AACJ;AACV;AACI;AACF;AACpC;AACE;;AAEtC,iBAAgB,CAAC,SAAQ;AACzB,iBAAgB,CAAC,QAAO;AACxB,iBAAgB,CAAC,WAAU;AAC3B,iBAAgB,CAAC,WAAU;AAC3B,iBAAgB,CAAC,eAAc;AAC/B,iBAAgB,CAAC,aAAY;AAC7B,iBAAgB,CAAC,QAAO;AACxB,iBAAgB,CAAC,UAAS;AAC1B,iBAAgB,CAAC,SAAQ;AACzB,iBAAgB,CAAC,QAAO;AACxB,iBAAgB,CAAC,SAAQ;;;AAGzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;AAGA,8BAA8B,aAAS;AACvC,cAAc,sBAAkB;AAChC,KAAK;AACL,6BAA6B,aAAS;AACtC,gBAAgB,2BAAuB;AACvC,cAAc,wBAAoB;AAClC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA,iDAAiD,gCAA4B;;AAE7E,2BAA2B,iBAAU;;AAErC,uBAAuB,2BAAgB,CAAC,SAAU;;AAElD;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,yBAAyB,eAAQ;AACjC,wBAAwB,cAAO;AAC/B,yBAAyB,eAAQ;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA,YAAY;AACZ;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,2BAA2B,+BAA+B;AAC1D;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,yBAAoB;AACpC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,8BAAyB;AAC5C,mBAAmB,8BAAyB;AAC5C;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,mBAAmB;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,8BAA8B,oBAAoB;AAClD;;AAEA,mBAAmB,wBAAwB;AAC3C,wBAAwB,aAAa;AACrC;;AAEA,mBAAmB,+BAA+B;AAClD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,8DAAe,gBAAgB,E;;AC3hB/B;AAC8B;AACgB;AACG;AACJ;AACN;AACO;;AAE9C;AACA;;AAEA,mBAAmB,QAAQ;AAC3B,6BAA6B,aAAM,QAAQ,aAAM;AACjD;;AAEA;;AAEA;;AAEA,0BAA0B,aAAS;AACnC,yBAAyB,eAAW;AACpC;;AAEA;AACA,6BAA6B,aAAS;AACtC,0BAA0B,aAAS;;AAEnC,0CAA0C,eAAI;AAC9C,kBAAkB,iBAAa;AAC/B,KAAK;AACL;AACA;;AAEA,wBAAwB,eAAW;AACnC;AACA,KAAK;;AAEL,2BAA2B,eAAI;AAC/B,kBAAkB,iBAAa;AAC/B;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,eAAe,cAAc;AAC7B,eAAe,YAAY;AAC3B;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,iCAAiC,YAAO;AACxC;AACA;;AAEA,QAAQ,gBAAW;;AAEnB,QAAQ,mBAAc;AACtB,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mEAAe,qBAAqB,E;;ACrKpC;AACA;AACA;AACA;;AAE+C;;AAEV;AACoB;AACK;AACE;AAClB;AACA;AACA;;AAEQ;;AAEI;AACU;AAC9B;;AAEtC;AACA;AACA;AACA,WAAW,OAAO;AAClB;AACA;;AAEA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA,cAAc;AACd;AACA,qBAAqB,SAAK;;AAE1B;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,2BAA2B,uBAAgB;;AAE3C,2BAA2B,4BAAqB;;AAEhD,8BAA8B,SAAa;;AAE3C;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA,uBAAuB,OAAO;AAC9B,2BAA2B,aAAM;AACjC,2BAA2B,aAAM;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA,WAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA,qCAAqC,kBAAiB;AACtD,8BAA8B,kBAAiB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,mBAAkB;AACvD,8BAA8B,mBAAkB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB;AACA;AACA,+BAA+B,kBAAiB;AAChD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,OAAO;AAClB,WAAW,cAAc;AACzB,YAAY;AACZ;AACA,cAAc,YAAO;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,mCAAmC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,sBAAsB,mBAAmB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,iBAAiB,YAAO;AACxB,gCAAgC,YAAO;AACvC;AACA;;AAEA;AACA,mBAAmB,4BAA4B;AAC/C;AACA;AACA,QAAQ,mBAAc;AACtB,QAAQ,0BAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,8BAA8B;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,uBAAuB;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,qBAAqB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,qBAAqB;AACxC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gCAAgC,cAAQ;;AAExC,kDAAe,MAAM,E;;ACpc0B;AACV;AACU;AACO;AAClB;AACI;;AAExC;AACA;AACA;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,QAAQ,IAAqC;AAC7C;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA;AACA;AACA;AACA,wBAAwB,oCAA0B;AAClD;AACA;AACA,uBAAuB,aAAM;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;;AAEA,gBAAgB,uCAAgC;;AAEhD;;AAEA;;AAEA;AACA;AACA,+DAA+D,WAAM;;AAErE,kCAAkC,kBAAW;AAC7C;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA,0DAA0D,0BAAqB;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA,6CAA6C,0BAAqB;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA,0DAAe,aAAa,E;;AC5LmB;;AAE/C,kBAAkB,uCAA6B;;AAE/C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,CAAC;;AAED,oDAA0C;;AAE1C,yDAAe,WAAW,E;;ACtBqB;;AAE/C;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;;AAEA,mBAAmB;;AAEnB,gBAAgB;AAChB;AACA,gBAAgB;AAChB,iBAAiB;AACjB;AACA;AACA;;AAEA,mBAAmB,4BAAkB;AACrC;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,gBAAgB,4BAAkB;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA,eAAe,+BAAqB;AACpC;AACA;AACA;AACA,CAAC;AACD,cAAc,+BAAqB;AACnC;AACA,CAAC;AACD;;AAEA,oDAAe;AACf;AACA;AACA;AACA;AACA,CAAC,E;;;ACzFD;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACqE;;AAErE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,6BAA6B,GAAG;AAChC;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA,wCAAwC;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC;;;AAGrC;;AAEA;AACA;AACA;AACA,0CAA0C;;AAE1C;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA,IAAI;;;AAGJ;AACA,qCAAqC,aAAa;AAClD;;AAEA;AACA,CAAC;;AAED;AACA,MAAM,QAAQ;AACd;AACA,GAAG;AACH;AACA;AACA;;AAEA,uDAAe,WAAW,E;;AC1IqB;AACL;;AAEa;;AAEvD;AACA;AACA;AACA,YAAY;AACZ,WAAW,OAAO;AAClB,WAAW,+BAA+B;AAC1C,WAAW,SAAS;AACpB,WAAW,OAAO;AAClB;AACA,6BAAe,SAAS,kBAAC;;AAEzB;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,gBAAgB,4BAAkB;AAClC,gBAAgB,4BAAkB;;AAElC;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;;AAEA;AACA,yCAAyC,kCAA6B;AACtE;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA,aAAa;;AAEb,2BAA2B,4BAAkB;AAC7C,gBAAgB,4BAAkB,CAAC,aAAW;AAC9C,wCAAwC;AACxC;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA,QAAQ,4BAAkB;AAC1B;AACA,E;;ACxEA;AAC0B;;AAEc;AACF;AACgB;AACd;AACY;;;AAGpD;AACA;AACA;AACA;AACO;AACP,qCAAqC,kBAAW;AAChD,oCAAoC,UAAU;;AAE9C,iDAAiD,mBAAa;;;AAG9D;AACA,QAAQ,iBAAiB,iBAAiB,kBAAW;AACrD;AACA,SAAS;AACT;AACA;AACA,SAAS;AACT;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL,KAAK;AACL;;;;ACzD0C;AACC;AAC3C,yBAAG,CAAC,OAAO,E;;ACFX,4DAAe;AACf;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA,CAAC,E;;AChC8C;;AAE/C,sDAAe;;AAEf;AACA;;AAEA;AACA;AACA,sBAAsB,wBAAc;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA,YAAY;;;AAGZ;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,CAAC,E;;ACzI8C;AAC6B;AACF;AACV;AACI;AACJ;;AAEhE,iBAAiB,uCAA6B;;AAE9C;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,yBAAyB,yCAA+B;AACxD;AACA;AACA;AACA,SAAS;AACT,uBAAuB,sBAAY;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,iDAAiD,uBAAa;AAC9D,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,EAAE;AACzC;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,uBAAuB,eAAe;;AAExD,4BAAkB,uBAAuB,yBAAyB;AAClE,4BAAkB,uBAAuB,wBAAwB;AACjE,4BAAkB,uBAAuB,mBAAmB;AAC5D,4BAAkB,uBAAuB,qBAAqB;;AAE9D,uDAAe,UAAU,E;;ACtGzB;;AAEA,6CAAe,aAAM,EAAC;;AAEtB,SAAS,aAAM;;AAEf;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,0EAA0E;AAC1E;AACA;AACA;;AAEA,yBAAyB,cAAc;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,uBAAuB,SAAS;AAChC,KAAK;AACL,2BAA2B,YAAY;AACvC;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,gDAAgD,WAAI;AACpD;AACA;AACA;AACA;;AAEA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa;AACb;AACA;;AAEA;AACA,aAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,WAAI,6BAA6B;;AAEzC;AACA;;AAEA;AACA;AACA,YAAY,WAAI;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,QAAQ,WAAI,6BAA6B;;AAEzC,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,WAAI;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,YAAY,WAAI;AAChB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA,yCAAyC,SAAS;AAClD;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,eAAe,kBAAkB;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA,iCAAiC,+BAA+B;;AAEhE;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,kDAAkD;;AAElD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS,WAAI;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,WAAW,WAAI,qBAAqB,WAAI;AACxC,WAAW,WAAI,qBAAqB,WAAI;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,WAAW,WAAI;AACf,QAAQ,WAAI,uBAAuB,WAAI;AACvC,QAAQ,WAAI,sBAAsB,WAAI;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,2CAA2C;AAC3C;AACA;AACA,iBAAiB,WAAI;AACrB,iBAAiB,WAAI;AACrB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gBAAgB,WAAI;;AAEpB;AACA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,SAAS,WAAI;AACb;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAM;AACN;AACA;;AAEA;AACA;AACA,iDAAiD,SAAS;AAC1D;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,sBAAsB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA;AACA,C;;;ACxmBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,WAAW;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mCAAmC;AAC1D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,gEAAe,oBAAoB,E;;AChIwB;AACZ;AAC/C,IAAI,uBAAI,GAAG,iBAAa;;AAExB,SAAS,uBAAI;AACb,SAAS,uBAAI;AACb,SAAS,uBAAI;AACb;;AAEA,yDAAe;;AAEf;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,uBAAI;AAC7B,yBAAyB,uBAAI;AAC7B,yBAAyB,uBAAI;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA,uBAAuB,kCAAkC;AACzD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,8BAAyB;AACrC;AACA,KAAK;;AAEL;AACA;AACA;;AAEA,iDAAiD,yBAAoB;;AAErE;AACA;AACA,SAAS;AACT;AACA,CAAC,E;;ACtIM;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA,C;;ACrB+C;AACsB;AACjB;AACT;AACkC;;AAEhB;;AAE7D;AACA;;AAEA;;AAEA,2BAA2B,UAAU;;AAErC,oCAAoC,0BAAqB;AACzD;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,iCAAiC;AACpD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC,uBAAuB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,8BAAoB;AAC7C,mBAAmB,eAAe;AAClC;AACA,iDAAiD,kBAAkB;AACnE;AACA;AACA,yBAAyB,0BAAqB,4BAA4B,oBAAoB;AAC9F,aAAa;AACb,SAAS;;AAET;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,iDAAiD;;AAEjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,2DAAe,aAAa,E;;ACnLmB;AACF;AACN;AACY;AACR;AACI;AACyB;AAC5B;AACgB;AACiB;;AAE7E,IAAI,iBAAI,GAAG,iBAAa;;AAExB,4BAAuB,CAAC,YAAW;;AAEnC;;AAEA,wBAAwB,mBAAc;;AAEtC;AACA;;AAEA,uBAAuB,oCAA+B;AACtD;AACA,KAAK;AACL,0BAA0B,2BAAsB;AAChD;AACA,KAAK,IAAI;;AAET,wBAAwB,2BAAsB;;AAE9C;AACA,IAAI,qCAAgC;AACpC,uCAAuC,uBAAkB;AACzD,oBAAoB,2BAAsB;AAC1C,SAAS;AACT,KAAK;AACL;;AAEA,2BAA2B,mBAAc;AACzC,sBAAsB,4BAAuB,EAAE,gBAAgB;AAC/D;AACA;AACA;AACA,KAAK;AACL;;AAEA,8BAA8B,oBAAa;;AAE3C;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,2BAA2B,mBAAc;AACzC;AACA,8BAA8B,uBAAkB;AAChD;AACA,iBAAiB;AACjB,8BAA8B,uBAAkB;AAChD;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,yCAAyC,kBAAkB;AAC3D;AACA;;AAEA;;AAEA,4BAA4B,mBAAc;AAC1C,0BAA0B,uBAAkB;AAC5C;AACA,aAAa;AACb;AACA;AACA;AACA,0BAA0B,OAAQ;AAClC;AACA,aAAa;AACb,SAAS;;AAET;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,WAAW;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA,QAAQ,mCAA8B;;AAEtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,mCAAmC,iBAAiB;AACpD;AACA;AACA;;AAEA,wBAAwB,0BAAqB;AAC7C,gBAAgB,kBAAkB;AAClC;AACA;AACA;AACA,0BAA0B,0BAAqB,CAAC,oBAAoB;;AAEpE,2BAA2B,yBAAoB;AAC/C,iCAAiC,yBAAoB;;AAErD;AACA;;AAEA;;AAEA;AACA;;AAEA,+BAA+B,0BAAqB;;AAEpD;AACA;AACA;AACA;;AAEA,sCAAsC,6BAA6B;AACnE;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;;AAEA,gDAAgD,uBAAkB,GAAG,sBAAiB;;AAEtF;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,wBAAwB,yBAAoB;AAC5C;AACA;AACA,wBAAwB,0BAAqB;AAC7C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA,QAAQ,mCAA8B;AACtC;AACA;AACA;;AAEA;AACA,+CAA+C,yBAAoB;;AAEnE;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;;AAEA,6BAA6B,WAAW;AACxC;AACA;AACA,2BAA2B,0BAA0B;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,qBAAqB;AACpD;AACA;AACA;AACA;;AAEA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA;AACA,mCAAmC,yBAAyB;AAC5D;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC,MAAM;;AAEtC;AACA;AACA;AACA;AACA;AACA,+BAA+B,mBAAmB;AAClD,oBAAoB,iBAAI;AACxB;AACA,wBAAwB,iBAAI;AAC5B;AACA,oBAAoB,iBAAI;AACxB,oBAAoB,iBAAI;AACxB;AACA;AACA;AACA;AACA,gBAAgB,iBAAI;AACpB,gBAAgB,iBAAI;AACpB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uBAAuB,qBAAqB;AAC5C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,iBAAI;AACtB,kBAAkB,iBAAI;AACtB;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,2BAA2B,eAAe;AAC1C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,iBAAI;AAC/B,uBAAuB,qBAAqB;AAC5C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;;AAEA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,iBAAI;AACpB,gBAAgB,iBAAI;AACpB,gBAAgB,iBAAI;AACpB,gBAAgB,iBAAI;;AAEpB,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;;AAEA,+BAA+B,OAAO;AACtC;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sBAAsB;AACrD;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,iBAAI;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,2BAA2B,sBAAsB;AACjD;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,0BAAqB;AACnD;AACA,YAAY,oBAAoB;AAChC;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C,4BAA4B,4BAAkB;AAC9C;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA,oBAAoB,0BAAqB;AACzC,YAAY,kBAAkB;AAC9B;AACA;AACA;AACA,sBAAsB,0BAAqB,CAAC,oBAAoB;;AAEhE,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,iEAAiE,qDAAqD;AACtH;AACA;AACA;AACA;AACA;AACA;;AAEA,0DAAe,YAAY,E;;ACjwBuB;AACH;;AAEF;AACM;AACH;;AAEhD,gDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;;AAEA,iCAAiC,mBAAY;AAC7C,2BAA2B,mBAAc;;AAEzC,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;;AAEA,4BAA4B,iBAAY;AACxC;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;;AC9FF;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe;AACf;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,C;;ACzD+C;AACA;AAC/C,IAAI,UAAI,GAAG,iBAAa;AACxB,IAAI,UAAI,GAAG,iBAAa;;AAEoC;AACF;AAC1D;AACA,mBAAmB,aAAS,EAAE,YAAQ;;AAEtC;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,qBAAqB,UAAI;;AAEzB,wBAAwB,UAAI;;AAE5B;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,gCAAgC;;AAEhC;AACA,2BAA2B,8BAAoB,IAAI,8BAAoB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA,4CAA4C,sCAA4B;AACxE,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,eAAe;AAC9B;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,uBAAuB,oBAAoB;AAC3C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,QAAQ,UAAI;AACZ,QAAQ,UAAI;AACZ,QAAQ,UAAI;;AAEZ,QAAQ,UAAI;AACZ,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,QAAQ,UAAI;;AAEZ;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,kDAAe,KAAK,E;;ACvLc;AACa;AACO;AAClB;AACI;;AAExC;AACA;AACA;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,oBAAoB,oCAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,sBAAY;AAC5C;AACA;AACA;AACA;;;AAGA,IAAI,IAAqC;AACzC;AACA;AACA;AACA;;;AAGA,IAAI,oBAAO;;AAEX;;AAEA,gBAAgB,gCAA0B;;AAE1C;;AAEA;;AAEA,aAAa,wBAAc;AAC3B;AACA;;AAEA;;AAEA;;AAEA;AACA,qEAAqE,WAAM;;AAE3E;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,8CAA8C,0BAAqB;AACnE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA,sBAAsB,wBAAc;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,oBAAO;AAC7C;;AAEA,mBAAmB,WAAK;AACxB,mBAAmB,oBAAO;AAC1B;AACA;AACA;AACA;AACA;;AAEA,yDAAe,YAAY,E;;AChN3B;AAC0B;;AAEY;AACF;AACgB;;AAE7C,SAAS,eAAO;AACvB,qCAAqC,gBAAU;AAC/C,oCAAoC,SAAS;;AAE7C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;;AAEL,gDAAgD,kBAAY;;AAE5D,C;;ACzB0C;AACA;AAC1C,yBAAG,CAAC,eAAO,E;;ACFoC;AAC6B;AACF;AACV;AACI;;;AAGpE;AACA;AACA;AACA,iBAAiB,uCAA6B;;AAE9C;;AAEA;;AAEA;;AAEA;AACA;;AAEA,QAAQ,2BAAiB;AACzB,YAAY,4BAAkB;AAC9B;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,6BAAmB;AACtC;AACA;AACA;AACA,aAAa,IAAI;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,4BAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,2BAAiB;AACzB,YAAY,4BAAkB;AAC9B,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,uBAAuB,yBAAyB;AAClE,4BAAkB,uBAAuB,wBAAwB;AACjE,4BAAkB,uBAAuB,mBAAmB;AAC5D,4BAAkB,uBAAuB,qBAAqB;;AAE9D,uDAAe,UAAU,E;;AC/MzB;AACA;AACA;AACA;AACA;;AAEA;;AAEA,IAAI,UAAE;AACN;AACA;AACA;AACA,IAAI,YAAI;AACR;AACA,WAAW,UAAE;;AAEb;;;AAGA;;AAEA;AACA;AACA;;AAEA,0BAA0B,6CAA6C;AACvE,0BAA0B,+BAA+B;;;AAGzD;;AAEA,IAAI,SAAC,iBAAiB;;AAEtB,+BAA+B,0BAA0B,SAAC,iBAAiB,SAAC,WAAW;AACvF,+BAA+B,QAAQ,YAAI,cAAc,SAAC,iBAAiB,SAAC,YAAY;;AAExF,gCAAgC,8DAA8D;AAC9F,gCAAgC,QAAQ,YAAI,qDAAqD;;AAEjG,8BAA8B,8CAA8C;;;AAG5E;;AAEA,8BAA8B,0CAA0C;;AAExE;;AAEA;AACA,2BAA2B;;AAE3B,uBAAuB,UAAE;AACzB;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,8CAAe,OAAO,E;;ACpFtB,sDAAe,mEAAmE,iCAAiC,yDAAyD,oDAAoD,0BAA0B,iBAAiB,gEAAgE,2DAA2D,GAAG,wFAAwF,0BAA0B,yBAAyB,0BAA0B,iBAAiB,yGAAyG,yDAAyD,GAAG,OAAO,EAAC;;;ACA7rB;;AAEF;AACM;AACH;;AAEP;AACE;;AAEwB;AACX;;AAExD,4BAA0B,CAAC,SAAc;AACzC,4BAA0B,CAAC,eAAoB;;AAE/C,gDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;;AAEA;AACA,2BAA2B,mBAAc;;AAEzC;AACA,kBAAkB;AAClB;AACA;AACA,mCAAmC,6BAAwB;AAC3D;AACA;AACA;AACA,SAAS;AACT,oCAAoC,6BAAwB;AAC5D;AACA;AACA,SAAS;;AAET;AACA,kBAAkB;AAClB;AACA,kCAAkC,4BAAuB;;AAEzD;AACA,kBAAkB;AAClB;AACA,8BAA8B,mBAAc;AAC5C;AACA,SAAS;;AAET;AACA,kBAAkB;AAClB;AACA,mCAAmC,mBAAc;AACjD,uCAAuC,6BAAwB;AAC/D;AACA;AACA,SAAS;AACT,uCAAuC,uBAAkB;AACzD,wBAAwB,qBAAgB;AACxC,gBAAgB,4BAAuB;AACvC,gBAAgB,4BAAuB;AACvC;AACA;AACA,SAAS;AACT;AACA;AACA,yCAAyC,sBAAiB;;AAE1D,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;;AAEA;AACA;;AAEA,4BAA4B,iBAAY;AACxC;AACA,SAAS;;AAET;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,iCAAiC,6BAAwB;AACzD;;AAEA,QAAQ,mCAA8B;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,wCAAwC,yBAAoB;AAC5D;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;;AAGL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,QAAQ,2BAAiB;AACzB,iCAAiC,uBAAa;AAC9C;;AAEA,0BAA0B,0BAAqB;AAC/C;AACA;AACA,aAAa;AACb;AACA;AACA;;AAEA;AACA;AACA,gCAAgC,0BAAqB;AACrD;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA,8DAA8D,mBAAc;AAC5E;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA,gFAAgF,uBAAkB;AAClG;AACA,gCAAgC,2BAAsB;AACtD;AACA;AACA,qBAAqB;AACrB;AACA;AACA,sBAAsB;AACtB,8EAA8E,uBAAkB;AAChG;AACA,gCAAgC,2BAAsB;AACtD;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,+EAA+E,iCAA4B;AAC3G;;AAEA,gBAAgB,0BAAqB;AACrC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,yBAAoB;AAC5C;AACA;AACA,wBAAwB,0BAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB,0BAA0B;AACjD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,kBAAkB,mBAAmB,CAAC,kCAAwB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;ACxc6C;AAC/C,IAAI,UAAI,GAAG,iBAAa;;;AAGxB;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,gCAAgC;;AAEhC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,kBAAkB,UAAI;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,kDAAe,KAAK,E;;ACrGc;AACa;AACO;AAClB;AACI;AACE;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,oBAAoB,oCAA0B;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,sBAAY;AAC5C;AACA;AACA;AACA;;AAEA;;AAEA,gBAAgB,gCAA0B;;AAE1C;;AAEA;;AAEA;;AAEA;AACA,6DAA6D,WAAM;;AAEnE,4BAA4B,WAAK;AACjC;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,0BAAqB;AACrE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,0BAAqB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA,yDAAe,YAAY,E;;AChL3B;AAC0B;;AAEY;AACF;AACgB;;AAE7C,SAAS,qBAAO;AACvB,qCAAqC,gBAAU;AAC/C,oCAAoC,SAAS;;AAE7C,gDAAgD,kBAAY;;AAE5D;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,KAAK;;AAEL,C;;ACjC0C;AACA;AAC1C,yBAAG,CAAC,qBAAO,E;;ACFoC;;AAE2B;AACV;;AAEhE;;AAEA,oBAAoB,uCAA6B;;AAEjD;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI;AACb,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,0BAA0B,wBAAwB;AACpE,4BAAkB,0BAA0B,mBAAmB;;AAE/D,6DAAe,aAAa,E;;ACzE5B;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,uBAAuB;AAClC;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,OAAO,QAAQ,MAAM,SAAS;;AAE9E;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;;AAEA,6DAAe,aAAa,E;;AC7E5B,yDAAe,iLAAiL,0BAA0B,kBAAkB,uGAAuG,yDAAyD,2DAA2D,GAAG,oHAAoH,+BAA+B,iCAAiC,mLAAmL,sBAAsB,+KAA+K,wBAAwB,wEAAwE,IAAI,kBAAkB,6BAA6B,OAAO,0DAA0D,IAAI,sCAAsC,oCAAoC,kDAAkD,GAAG,SAAS,EAAC;;;ACAxyC;AACH;AACI;AACH;;AAE2B;;AAExE,4BAAuB,CAAC,kBAAiB;;AAEzC;;AAEA,mDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;AACA;AACA,4BAA4B,sBAAa;AACzC;;AAEA,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;;AAEA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET,+BAA+B,mBAAc;AAC7C,0BAA0B,4BAAuB;AACjD,0BAA0B,uBAAkB;AAC5C,4BAA4B,qBAAgB;AAC5C,4BAA4B,4BAAuB;AACnD,8BAA8B,4BAAuB;AACrD,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,oBAAe,KAAK,sBAAiB;AACjE,0DAA0D,sBAAiB;AAC3E,0DAA0D,sBAAiB;AAC3E;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;AClJ6C;AAC/C,IAAI,iBAAI,GAAG,iBAAa;;AAExB,IAAI,sBAAS;AACb;AACA,IAAI,eAAE;;AAEN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,gCAAgC;;AAEhC;AACA;AACA;;AAEA;AACA;;AAEA;AACA,oEAAoE,sBAAS;AAC7E;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,2BAA2B,QAAQ;;AAEnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAQ,iBAAI;AACZ;AACA;;AAEA,gBAAgB,iBAAI;AACpB;AACA;AACA,QAAQ,iBAAI;AACZ;AACA,QAAQ,iBAAI;AACZ,QAAQ,iBAAI;AACZ,QAAQ,iBAAI;AACZ;AACA,QAAQ,iBAAI;;AAEZ;AACA;AACA,QAAQ,iBAAI;AACZ;AACA;;AAEA;AACA;AACA,wBAAwB,sBAAS;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA,mEAAmE,sBAAS;AAC5E,KAAK;;AAEL;AACA;AACA;AACA,4BAA4B,eAAE;AAC9B,yBAAyB,eAAE;AAC3B,mCAAmC,eAAE,SAAS,eAAE;AAChD,yBAAyB,eAAE,qBAAqB,eAAE,4BAA4B,eAAE;AAChF;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,sEAAsE,sBAAS;AAC/E,KAAK;;AAEL;AACA;AACA;AACA,yCAAyC,eAAE,IAAI,eAAE;AACjD,2CAA2C,eAAE,sBAAsB,eAAE,MAAM,eAAE;AAC7E;AACA,iCAAiC,eAAE;AACnC,8BAA8B,eAAE;AAChC;AACA,KAAK;;AAEL;AACA,gDAAgD,sBAAS;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,mDAAe,oBAAoB,E;;AC3LyB;;AAE5D;AACA,IAAI,kBAAkB;AACtB;;AAEA,yBAAyB,YAAY;AACrC;AACA;;AAEA,wDAAe,QAAQ,E;;ACVoB;AACE;AACN;;AAEvC,6BAAe,SAAS,0BAAC;;AAEzB;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;;;AAGA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,8DAA8D,WAAM;AACpE,2CAA2C,mBAAc;AACzD;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,sEAAsE,0BAAqB;AAC3F;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;;AAEb;;AAEA;AACA;AACA;AACA;;;AC3G2C;AAC0C;;AAErF,sBAAsB,yBAAyB,aAAa,iBAAQ;AACpE;AACA;AACA,KAAK;AACL,CAAC;;AAED,4DAAe,eAAe,E;;ACT9B;AAC0B;;AAEkB;AACF;AACgB;;AAEnD,SAAS,wBAAO;AACvB,qCAAqC,sBAAa;AAClD,oCAAoC,YAAY;;AAEhD,mDAAmD,qBAAe;;AAElE;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;AACL,C;;ACxB0C;AACG;AAC7C,yBAAG,CAAC,wBAAO,E;;ACFoC;;AAE2B;AACV;;AAEhE;;AAEA,sBAAsB,uCAA6B;;AAEnD;;AAEA;;AAEA;;AAEA;AACA;;AAEA,8BAA8B,EAAE,kCAAkC,EAAE,EAAE,EAAE,EAAE,EAAE;AAC5E,4BAA4B,gEAAgE;;AAE5F;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,SAAS,IAAI;AACb,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,4BAA4B,wBAAwB;AACtE,4BAAkB,4BAA4B,mBAAmB;;AAEjE,iEAAe,eAAe,E;;AC1E9B;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,uBAAuB;AAClC;AACA;AACA;AACA;;AAEA;AACA,gDAAgD,OAAO,QAAQ,MAAM,SAAS;;AAE9E;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,IAAI,sBAAM;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,sBAAM;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,IAAI,sBAAM;AACV;AACA,KAAK;AACL;AACA;;AAEA,iEAAe,eAAe,EAAC;;;ACxFgB;AACC;AACA;AACH;;AAE2B;;AAExE,4BAAuB,CAAC,kBAAiB;;AAEzC,qDAAe,sCAA4B;;AAE3C;;AAEA;;AAEA;AACA,+BAA+B,mBAAc;AAC7C,0BAA0B,4BAAuB;AACjD,0BAA0B,uBAAkB;AAC5C,4BAA4B,qBAAgB;AAC5C,4BAA4B,4BAAuB;AACnD,8BAA8B,4BAAuB;AACrD,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,4BAA4B,0BAAe;AAC3C;;AAEA,8BAA8B,mBAAc;AAC5C,gCAAgC,kBAAW;AAC3C;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;;AAET,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA,kDAAkD,mBAAmB;AACrE;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,4BAA4B,oBAAe,KAAK,sBAAiB;AACjE,0DAA0D,sBAAiB;AAC3E,0DAA0D,sBAAiB;AAC3E;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,EAAC;;AAEH;AACA;AACA;AACA;;;AC1K4D;;AAE5D;AACA,IAAI,kBAAkB;;AAEtB;AACA;AACA;;AAEA,2BAA2B,YAAY;AACvC;AACA;;AAEA,4DAAe,UAAU,E;;ACbwB;AACoC;;AAErF,wBAAwB,yBAAyB,eAAe,qBAAU;AAC1E;AACA;AACA,KAAK;AACL,CAAC;;AAED,8DAAe,iBAAiB,E;;ACThC;AAC0B;;AAEsB;AACF;AACgB;;AAEvD,SAAS,0BAAO;AACvB,qCAAqC,0BAAe;AACpD,oCAAoC,cAAc;;AAElD,qDAAqD,uBAAiB;;AAEtE;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;AACL,C;;ACxBA;AAC0C;AACK;AAC/C,yBAAG,CAAC,0BAAO,E;;ACHoC;AACA;AAC/C,IAAI,sBAAI,GAAG,iBAAa;AACxB,yBAAyB,qDAA2C;;AAEpE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,8BAAoB;AAClC;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,sBAAI;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,8DAAe,iBAAiB,E;;AC/EhC,6BAAe,SAAS,sBAAC;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;AACA;AACA;AACA;AACA,E;;ACxB+C;AACD;AACC;AACK;AACQ;;AAE5D,IAAI,gBAAI,GAAG,iBAAa;AACxB,IAAI,8BAAkB,GAAG,qDAA2C;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA,cAAc,8BAAoB;AAClC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAI;AACtB,QAAQ,gBAAI;AACZ;AACA;AACA,KAAK;;AAEL,6BAA6B,qBAAgB;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA,cAAc,8BAAoB;AAClC;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,wBAAwB,qBAAqB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,8BAAoB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,oBAAoB,8BAAkB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,uBAAiB;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL,C;;AC/K+C;;AAE/C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,kCAAwB;AACvC;AACA;AACA;;AAEA;AACA;AACA,YAAY,EAAE;AACd,YAAY,MAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kDAAe,UAAU,E;;ACzCsB;AACQ;;AAEvD;AACA;AACA,IAAI,2BAAiB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA,6BAAe,SAAS,cAAC;AACzB;AACA;;AAEA;AACA;;AAEA;AACA,cAAc,2BAAiB;AAC/B;AACA,aAAa;AACb;AACA,cAAc,2BAAiB;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,mCAAyB;AACtE,sBAAsB,kCAAwB;AAC9C;AACA,kCAAkC,mCAAyB;AAC3D;;AAEA;AACA;;AAEA;;AAEA;AACA,yBAAyB,8BAAoB;AAC7C,oCAAoC,mCAAyB,CAAC,kCAAwB;AACtF;;AAEA,gBAAgB,kBAAkB;AAClC,QAAQ,+BAAqB;AAC7B,0CAA0C;AAC1C;AACA;;AAEA,kBAAkB,yCAA+B;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,mCAAyB;AACnC;AACA;AACA;AACA;AACA,kBAAkB,mCAAyB;AAC3C;AACA;AACA;AACA,E;;ACjF+C;;AAE/C,6BAAe,SAAS,WAAC;AACzB;;AAEA,qCAAqC,+CAAqC;;AAE1E,qBAAqB,yCAA+B;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA,+BAA+B,kDAAwC;AACvE;AACA,kCAAkC;AAClC;;AAEA,mBAAmB,sBAAY;;AAE/B;;AAEA;;AAEA;AACA,C;;AC3C+C;AACkC;AACtC;AACS;AACN;;AAE9C,kBAAkB,oCAA0B;;AAE5C;;AAEA;;AAEA;;AAEA;AACA,eAAe,UAAU;AACzB,KAAK;;AAEL;AACA,mBAAmB,6BAA4B;AAC/C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED,4BAAkB,wBAAwB,qBAAqB;;AAE/D,wDAAe,WAAW,E;;ACpF1B;AACA;AACA;AACA;AACA;AACA;;AAE+C;AACS;AACF;AACX;;AAEI;AAC/C,IAAI,mBAAI,GAAG,iBAAa;AACxB,IAAI,mBAAI,GAAG,iBAAa;;AAExB;AACA;AACA;AACA;AACA;AACA,mBAAmB,mBAAe;AAClC;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;;AAEzC,8BAA8B,sBAAkB;AAChD,4BAA4B,sBAAkB;AAC9C,SAAS;;AAET;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA,uBAAuB,mBAAI;AAC3B,4BAA4B,mBAAI;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA,2BAA2B,OAAO;AAClC;AACA,+BAA+B,OAAO;AACtC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;AACpB;AACA,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;AACpB;AACA,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;;AAEpB,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;AACpB,gBAAgB,mBAAI;;AAEpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,uBAAuB;AAC1D;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,uBAAuB;AAC1D;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,uBAAuB;AAC1D;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;;AAEA,mCAAmC,gBAAgB;AACnD;AACA;AACA;AACA;AACA;;AAEA;;AAEA,qCAAqC,cAAc;AACnD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,eAAe;AAC9B;AACA;AACA,iBAAiB,mBAAI;AACrB,iBAAiB,mBAAI;AACrB,iBAAiB,mBAAI;;AAErB,wBAAwB,mBAAI;;AAE5B;;AAEA;AACA;AACA;;AAEA;AACA,YAAY,mBAAI;AAChB,YAAY,mBAAI;AAChB;AACA,YAAY,mBAAI;AAChB,YAAY,mBAAI;AAChB;AACA,YAAY,mBAAI;AAChB,YAAY,mBAAI;;AAEhB,iCAAiC,sBAAsB;AACvD,iCAAiC,sBAAsB;AACvD,iCAAiC,sBAAsB;;AAEvD;;AAEA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,2BAA2B,OAAO;AAClC;;AAEA,+BAA+B,oBAAoB;AACnD,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA,uCAAuC,oBAAoB;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,mBAAI;;AAEhC,4BAA4B,mBAAI;AAChC,4BAA4B,mBAAI;AAChC,4BAA4B,mBAAI;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,2BAA2B,oBAAoB;AAC/C,+BAA+B,oBAAoB;AACnD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL,CAAC;;AAED,+BAAqB,yBAAyB,mBAAmB;AACjE,+BAAqB,yBAAyB,kBAAkB;;AAEhE,qDAAe,YAAY,E;;ACxYoB;AACF;AACF;AACJ;AACuB;AACG;AAClB;AAC4B;;AAE3E,IAAI,cAAI,GAAG,iBAAa;;AAExB,gDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;;AAEzC;;AAEA,kCAAkC,oBAAa;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,cAAI;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC,mBAAc;AAC9C,8BAA8B,cAAY;AAC1C,yCAAyC,uBAAkB;AAC3D,gCAAgC,qBAAgB;AAChD,wBAAwB,4BAAuB;AAC/C,wBAAwB,4BAAuB;AAC/C;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,QAAQ,oCAA+B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,6BAAwB;AACvD;;AAEA,QAAQ,mCAA8B;AACtC;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;;AAE1C,0BAA0B,oBAAoB;AAC9C;AACA;AACA;;AAEA,YAAY,yBAAoB;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C,4BAA4B,4BAAkB;AAC9C;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA,uBAAuB,yBAAoB;AAC3C;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,kBAAkB;AACtC,sBAAsB,oBAAoB;;AAE1C,uBAAuB,yBAAoB;AAC3C;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,wBAAwB,4BAAuB;;AAE/C;AACA;AACA,YAAY,2BAAiB,CAAC,4BAAuB;AACrD;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;ACnUF;AAC0B;;;AAGoB;AACN;AACJ;;AAE7B,SAAS,qBAAO;AACvB,gCAAgC,SAAS;AACzC,kCAAkC,iBAAW;;AAE7C,IAAI,iBAAiB;;AAErB;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL,C;;ACtB0C;AACA;AAC1C,yBAAG,CAAC,qBAAO,E;;ACFoC;AACK;AACN;;AAE9C,mBAAmB,oCAA0B;;AAE7C;;AAEA;;AAEA;AACA;;AAEA;AACA,eAAe,UAAU;AACzB,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED,0DAAe,YAAY,E;;ACpCoB;AACF;AACF;AACe;AACZ;AACA;AACU;AACT;AAC8B;;AAEjB;;AAE5D,IAAI,eAAI,GAAG,iBAAa;;AAExB,4BAAuB,CAAC,YAAW;;AAEnC,iDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;;AAEzC;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,mCAAmC,mBAAc;AACjD,8BAA8B,OAAe;AAC7C;AACA;AACA,iBAAiB;AACjB,8BAA8B,uBAAkB;AAChD,4BAA4B,2BAAsB;AAClD,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,wBAAwB,kBAAkB;AAC1C,0BAA0B,oBAAoB;AAC9C;AACA;AACA;;AAEA,YAAY,yBAAoB;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,YAAY,0BAAqB;AACjC;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,yBAAoB;AAC1D;AACA;AACA;AACA;AACA,sCAAsC,0BAAqB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,QAAQ,oCAA+B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;;;AAGA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA,QAAQ;;AAER;AACA;AACA;AACA;AACA;AACA,QAAQ;;AAER;;AAEA,sCAAsC,YAAO;AAC7C;AACA,QAAQ,qBAAgB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,eAAI;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,uBAAuB,4BAA4B;AACnD;AACA;AACA;AACA;;AAEA,gBAAgB,aAAyB;AACzC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,YAAO;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;ACvSF;AAC0B;;AAEgB;AACJ;;AAE/B,SAAS,sBAAO;AACvB,gCAAgC,UAAU;AAC1C,kCAAkC,mBAAY;;AAE9C;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL,C;;AChD0C;AACC;AAC3C,yBAAG,CAAC,sBAAO,E;;ACFoC;AACJ;AACS;AACN;;AAE9C,sDAAe,oCAA0B;;AAEzC;;AAEA;;AAEA;;AAEA;;AAEA;AACA,eAAe,UAAU;AACzB,KAAK;;AAEL;AACA,mBAAmB,6BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC,CAAC,E;;AC9E6C;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,SAAS,eAAQ;AACjB,SAAS,8BAAoB;AAC7B;AACA;AACA;AACA;AACA;AACA,eAAe,qCAA2B;;AAE1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,wCAAwC;AACrF,iDAAiD,uCAAuC;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,YAAY;AAC/B,uBAAuB,WAAW;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,wBAAwB;AACvC,eAAe,OAAO;AACtB;AACA;AACA,mBAAmB,eAAQ;;AAE3B;;AAEA;AACA;AACA,gBAAgB,0CAAgC;AAChD,aAAa;AACb;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA,6CAAe,UAAU,E;;ACnLkC;AACZ;AAC/C,IAAI,sBAAI,GAAG,iBAAa;;AAExB,wDAAe;;AAEf;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB,sBAAI;;AAEpB;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA,wBAAwB,sBAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAY,8BAAyB;AACrC;AACA,KAAK;;AAEL;AACA;AACA;;AAEA,iDAAiD,yBAAoB;;AAErE;AACA;AACA,SAAS;AACT;AACA,CAAC,E;;ACvGD,qDAAe,yFAAyF,gCAAgC,uCAAuC,6CAA6C,8BAA8B,mEAAmE,uBAAuB,iEAAiE,2BAA2B,8BAA8B,gFAAgF,iCAAiC,kBAAkB,sIAAsI,sFAAsF,+BAA+B,+DAA+D,gGAAgG,wBAAwB,kCAAkC,wDAAwD,oCAAoC,GAAG,gFAAgF,yCAAyC,gCAAgC,iCAAiC,8CAA8C,iCAAiC,6BAA6B,4CAA4C,wBAAwB,qCAAqC,kDAAkD,kFAAkF,qEAAqE,2BAA2B,sCAAsC,+CAA+C,yDAAyD,yDAAyD,6CAA6C,0DAA0D,4BAA4B,+BAA+B,6DAA6D,IAAI,SAAS,6DAA6D,IAAI,kFAAkF,mDAAmD,IAAI,IAAI,2EAA2E,WAAW,OAAO,EAAC;;;ACAz6E;AACyB;AACvB;AACA;AAC/C,IAAI,eAAI,GAAG,iBAAa;;AAEwB;AAChD,4BAAuB,CAAC,cAAa;;AAErC,iBAAiB,0BAAqB;AACtC,uBAAuB,uBAAkB;AACzC;AACA;AACA,uBAAuB,iCAA4B;AACnD,0BAA0B,iCAA4B;AACtD,sBAAsB,iCAA4B;AAClD,8BAA8B,iCAA4B;AAC1D,0BAA0B,iCAA4B;AACtD;AACA,KAAK;AACL,4BAA4B,iBAAiB;;AAE7C,uBAAuB,uBAAkB;AACzC,gBAAgB,2BAAsB;AACtC;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA,yBAAyB,wBAAmB;AAC5C;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;;AAEA;AACA;AACA;AACA,cAAc,0BAAqB;;AAEnC;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mDAAmD,QAAQ;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,gCAAgC,sBAAiB;AACjD,qCAAqC,sBAAiB;AACtD;AACA,gBAAgB,oCAA+B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB,eAAI;AACtB,uBAAuB,0BAA0B;AACjD;AACA;AACA,YAAY,eAAI;AAChB,YAAY,eAAI;;AAEhB;AACA;AACA;AACA;AACA,CAAC;;AAED,wDAAe,UAAU,E;;AClHsB;AACF;AACF;AACL;AAC2B;AACnB;AACH;AACkC;AACR;;AAErE;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,wBAAwB,mBAAc;;AAEtC;AACA,cAAc;AACd;AACA;;AAEA,8BAA8B,oBAAa;;AAE3C;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,iBAAU;AACvC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,cAAc;AACtC,0BAA0B,gBAAgB;AAC1C,YAAY,yBAAoB;AAChC;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA,uBAAuB,iBAAiB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,kBAAkB;AAC9C,8BAA8B,oBAAoB;AAClD,gBAAgB,yBAAoB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,YAAY,yBAA6B;AACzC;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb,YAAY,0BAA8B;AAC1C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA;AACA,cAAc,4BAAuB;AACrC;AACA;;AAEA;;AAEA,0BAA0B,yBAAoB;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,KAAK;;AAEL;AACA,QAAQ,oCAA+B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,sCAAsC,YAAO;AAC7C,QAAQ,gBAAW;AACnB,QAAQ,gBAAW;;AAEnB;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C,4BAA4B,4BAAkB;AAC9C;AACA;AACA,8BAA8B,oBAAoB;AAClD;AACA,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,oBAAoB,kBAAkB;AACtC,sBAAsB,oBAAoB;;AAE1C,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,mCAAmC,kCAAkC;AACrE;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,6BAA6B,0BAAqB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA6B,WAAW;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2DAAe,aAAa,EAAC;;;ACxkBkB;AACF;AACF;AACJ;;AAEa;;AAEpD,oDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;;AAEzC;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,iEAAiE,oBAAa;AAC9E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,oBAAa;AAC7C;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,wBAAwB,4BAAuB;;AAE/C;AACA;AACA,YAAY,2BAAiB,CAAC,4BAAuB;AACrD,+BAA+B,oCAAoC;AACnE;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,+BAA+B,oCAAoC;AACnE;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;ACrIF;AAC0B;;AAEsB;AACJ;;AAErC,SAAS,yBAAO;AACvB,gCAAgC,aAAa;AAC7C,kCAAkC,eAAe;;AAEjD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;;AAEA;AACA;AACA;AACA,oDAAoD,kBAAkB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,C;;ACjD0C;AACI;AAC9C,yBAAG,CAAC,yBAAO,E;;ACFoC;AACA;AAC/C,IAAI,kBAAI,GAAG,iBAAa;AACxB,IAAI,kBAAI,GAAG,iBAAa;AACxB,IAAI,uBAAS,GAAG,kBAAI;AACpB,YAAY,kBAAI;AAChB,IAAI,iBAAG,GAAG,kBAAI;AACd,IAAI,iBAAG,GAAG,kBAAI;AACd,IAAI,oBAAM,GAAG,kBAAI;;AAEjB,aAAa,oBAAM;AACnB,cAAc,oBAAM;AACpB,gBAAgB,oBAAM;AACtB,iBAAiB,oBAAM;;AAEvB;AACA;;AAEA;AACA,IAAI,kBAAI;AACR,IAAI,kBAAI;;AAER;AACA,sBAAsB,oBAAM;AAC5B,sBAAsB,oBAAM;AAC5B,sBAAsB,oBAAM;AAC5B,sBAAsB,oBAAM;AAC5B;AACA;AACA;AACA,IAAI,uBAAS;AACb;AACA,IAAI,iBAAG;AACP,IAAI,uBAAS;AACb;AACA,IAAI,uBAAS;AACb;AACA;AACA,IAAI,iBAAG;AACP,IAAI,uBAAS;;AAEb;AACA,IAAI,uBAAS;AACb,IAAI,iBAAG;AACP,IAAI,uBAAS;AACb;AACA,IAAI,uBAAS;AACb;AACA;AACA,IAAI,iBAAG;AACP,IAAI,uBAAS;;AAEb;AACA,IAAI,iBAAG;AACP,IAAI,uBAAS;AACb,mBAAmB,kBAAI;AACvB;AACA,mBAAmB,kBAAI;;AAEvB,wBAAwB,kBAAI,UAAU,kBAAI;;AAE1C,IAAI,kBAAI;AACR,IAAI,kBAAI;;AAER;AACA;;AAEA;AACA;AACA,sBAAsB,kBAAI;AAC1B,sBAAsB,kBAAI;AAC1B,sBAAsB,kBAAI;AAC1B,sBAAsB,kBAAI;;AAE1B;AACA;;AAEA,cAAc,kBAAI;AAClB,IAAI,kBAAI;AACR,IAAI,kBAAI;;AAER,IAAI,kBAAI;AACR,IAAI,kBAAI;;AAER;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,mBAAmB;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEe;AACf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL,E;;ACrK+C;;AAE/C,oDAAe,oCAA0B;;AAEzC;;AAEA;;AAEA;AACA;;AAEA;AACA,2BAA2B,sBAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;AChEF,kDAAe,+DAA+D,8BAA8B,8BAA8B,yBAAyB,uBAAuB,0BAA0B,wBAAwB,mCAAmC,2DAA2D,mCAAmC,4BAA4B,4BAA4B,iCAAiC,qBAAqB,6BAA6B,8BAA8B,yBAAyB,0BAA0B,8BAA8B,iGAAiG,8DAA8D,uBAAuB,yJAAyJ,iFAAiF,oDAAoD,iDAAiD,wCAAwC,MAAM,sFAAsF,iCAAiC,yBAAyB,0BAA0B,8BAA8B,4FAA4F,4CAA4C,WAAW,IAAI,4BAA4B,sEAAsE,yCAAyC,oGAAoG,qCAAqC,IAAI,4BAA4B,GAAG,SAAS,EAAC;;;ACA3wD;AACF;AACE;;AAEW;AACT;AAC4B;;AAE7E,IAAI,eAAI,GAAG,iBAAa;;AAExB;AACA;AACA;;AAEA,4BAAuB,CAAC,WAAU;;AAElC,iDAAe,0BAAqB;;AAEpC,uBAAuB,uBAAkB;AACzC,oBAAoB,qBAAgB;AACpC,YAAY,4BAAuB;AACnC,YAAY,4BAAuB;AACnC;AACA;AACA;AACA,KAAK;;AAEL,uBAAuB,OAAe;AACtC;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,SAAS;;AAET;;AAEA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,6DAA6D,oBAAoB;AACjF,wBAAwB,kBAAkB;;AAE1C;AACA;AACA;AACA,uBAAuB,yBAAoB;AAC3C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,sCAAsC,gCAAgC;AACtE;AACA;AACA;AACA;AACA;AACA,4BAA4B,eAAI;AAChC;AACA;AACA,gBAAgB,eAAI;AACpB;;AAEA;;AAEA;AACA,sCAAsC,gCAAgC;AACtE;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;;AAET;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;AC1J6C;AACF;AACW;AACxD;AACsC;AACuC;;AAEjB;AAC5D,4BAAuB,CAAC,YAAW;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,2BAA2B,mBAAc;;AAEzC,sCAAsC,uBAAkB;AACxD,oBAAoB,2BAAsB;AAC1C;AACA;AACA,SAAS;AACT,8BAA8B,mBAAc;AAC5C,0BAA0B,OAAa;AACvC;AACA;AACA,SAAS;;AAET;AACA,8BAA8B,UAAU;AACxC,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,mCAAmC;AACnC,gEAAgE,aAAa;AAC7E;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,4BAAuB;AACrC,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,kBAAkB;AAC1C,0BAA0B,oBAAoB;AAC9C;AACA;AACA;AACA;;AAEA,uBAAuB,yBAAoB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;AC3LF;AAC0B;;AAEkB;AACA;AACJ;;AAEjC,SAAS,uBAAO;AACvB,gCAAgC,WAAW;AAC3C,kCAAkC,aAAa;;AAE/C,6BAA6B,aAAa;;AAE1C;AACA;AACA;AACA;AACA,KAAK,gBAAgB;;AAErB;AACA;AACA;AACA;AACA,KAAK,gBAAgB;;AAErB;AACA;AACA;AACA;AACA,KAAK,gBAAgB;AACrB,C;;AC9B0C;AACE;AAC5C,yBAAG,CAAC,uBAAO,E;;ACFoC;AACkC;;AAEjF;AACA;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA,uBAAuB,oCAA0B;;AAEjD;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA,2BAA2B,sBAAsB;AACjD;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;;AAEL;AACA,+BAA+B,sBAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,6BAA6B,qBAAqB;;AAEpE,kEAAe,gBAAgB,E;;AC7GgB;AACgB;AAClB;;AAE7C,qDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,2BAA2B,mBAAc;;AAEzC;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,+BAA+B,mBAAY;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,+BAA+B,mBAAY;AAC3C;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT;AACA,CAAC,CAAC,E;;AC9FF;AAC0B;;AAEwB;AACJ;;AAEvC,SAAS,0BAAO;AACvB,gCAAgC,cAAc;AAC9C,kCAAkC,2BAAgB;AAClD,C;;ACT0C;AACK;AAC/C,yBAAG,CAAC,0BAAO,E;;ACFoC;AACkC;AAC7B;AACN;;AAE9C,oBAAoB,oCAA0B;;AAE9C;;AAEA;;AAEA;;AAEA;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA,+BAA+B,yCAA+B;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,IAAqC;AACjE;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,+BAA+B,YAAY;AAC3C,mCAAmC,YAAY;AAC/C;AACA;AACA,iCAAiC,8BAAoB;AACrD,iCAAiC,8BAAoB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,4BAA4B,IAAqC;AACjE;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,4BAA4B,IAAqC;AACjE;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;;;AAGA;AACA;AACA;AACA,+BAA+B,YAAY;AAC3C,mCAAmC,YAAY;AAC/C;AACA;AACA,iCAAiC,8BAAoB;AACrD,iCAAiC,8BAAoB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED,4BAAkB,0BAA0B,qBAAqB;;AAEjE,4DAAe,aAAa,E;;AC3MmB;AACF;AACE;AACyB;AACK;;AAE7E,IAAI,gBAAI,GAAG,iBAAa;;AAExB;AACA;AACA;;AAEA,kDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;AACzC,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,yCAAyC,6BAAwB;AACjE;;AAEA,QAAQ,mCAA8B;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+CAA+C,yBAAoB;AACnE;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA,QAAQ,oCAA+B;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,uBAAuB,mBAAc;AACrC,0BAA0B,uBAAkB;AAC5C;AACA;AACA,aAAa;AACb,qCAAqC,uBAAkB;AACvD,4BAA4B,qBAAgB,CAAC,4BAAuB,0BAA0B,4BAAuB;AACrH,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA,qCAAqC,kBAAkB;;AAEvD;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA,2BAA2B,gBAAI;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,kBAAkB;AACjD;AACA;AACA;AACA,+BAA+B,gBAAI;AACnC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,gBAAI;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,kBAAkB;AAC7C;AACA,kCAAkC,yBAAoB,CAAC,kBAAkB;AACzE,kCAAkC,oBAAoB;AACtD;AACA;AACA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa;AACxC,+BAA+B,gBAAgB;AAC/C;AACA;;AAEA;;AAEA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA,uCAAuC,OAAO;AAC9C;;AAEA,2CAA2C,OAAO;AAClD;AACA;AACA;;AAEA,4BAA4B,gBAAI;AAChC,4BAA4B,gBAAI;AAChC,4BAA4B,gBAAI;AAChC;AACA,2CAA2C,OAAO;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,8BAA8B;AAC7D;AACA,oBAAoB,gBAAI;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa;AACxC,+BAA+B,gBAAgB;AAC/C;AACA;;AAEA;AACA,mCAAmC,OAAO;AAC1C,uCAAuC,OAAO;AAC9C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,kBAAkB;AAC7C;AACA;AACA,8BAA8B,yBAAoB,CAAC,kBAAkB;AACrE,8BAA8B,oBAAoB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,aAAa;AACxC,+BAA+B,gBAAgB;;AAE/C;;AAEA,mCAAmC,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;AACA,wBAAwB,IAAqC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oEAAoE;AACpE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;AC3eF;AAC0B;;AAEkB;AACJ;;AAEjC,SAAS,uBAAO;AACvB,gCAAgC,WAAW;AAC3C,kCAAkC,qBAAa;;AAE/C;AACA;AACA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,SAAS;AACT,KAAK;AACL,C;;AC3C0C;AACE;AAC5C,yBAAG,CAAC,uBAAO,E;;ACFoC;AAC0C;AACF;AACV;AACI;AACjB;AACrB;AACS;AACA;;AAEpD,SAAS,4BAAgB;AACzB;AACA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA,kBAAkB,oCAA0B;;AAE5C;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA,yBAAyB,yCAA+B;AACxD;AACA,SAAS;AACT,uBAAuB,sBAAY;AACnC;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;AACA,KAAK;;AAEL;AACA,eAAe,aAAa;AAC5B,KAAK;;AAEL;AACA;AACA,iDAAiD,uBAAa;AAC9D,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,8BAAwB;AACpD;AACA;AACA;AACA,2BAA2B,8BAA8B;AACzD;AACA;AACA,+BAA+B,4BAAgB;AAC/C;AACA,mCAAmC,0BAA0B;AAC7D,uCAAuC,4BAAgB;AACvD;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,gBAAgB;AAChB;AACA;AACA,mBAAmB,6BAA4B;AAC/C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA;AACA,CAAC;;AAED,4BAAkB,wBAAwB,eAAe;;AAEzD,4BAAkB,wBAAwB,yBAAyB;AACnE,4BAAkB,wBAAwB,wBAAwB;AAClE,4BAAkB,wBAAwB,mBAAmB;AAC7D,4BAAkB,wBAAwB,qBAAqB;;AAE/D,wDAAe,WAAW,E;;AC7JqB;;AAEF;AACM;AACU;AACE;;AAE/D,gDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,iCAAiC,mBAAY;AAC7C,2BAA2B,mBAAc;AACzC,KAAK;;AAEL;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,wCAAwC,kBAAW;AACnD;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,8CAA8C,iBAAY;AAC1D;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;AC9GF;AAC0B;;AAEc;AACJ;;AAEkC;;AAE/D,SAAS,qBAAO;AACvB;AACA,IAAI,eAAY;;AAEhB,gCAAgC,SAAS;AACzC,kCAAkC,iBAAW;AAC7C;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;AACL,C;;ACzB0C;AACA;AAC1C,yBAAG,CAAC,qBAAO,E;;ACFoC;;AAE/C,sDAAe,oCAA0B;;AAEzC;;AAEA;;AAEA;;AAEA;;AAEA;AACA,eAAe,mCAAyB;AACxC,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;;;AAGT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC,CAAC,E;;;AC5DgD;AACA;;AAElD;AACA;AACA;;AAEA;AACA;AACA,0BAA0B,MAAa;AACvC;AACA;;AAEA;AACA;;AAEA;;AAEA,QAAQ,aAAa;;AAErB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,cAAqB;AAC7B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ,cAAqB;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0DAAe,YAAY,E;;AClFoB;AACF;AACN;AACa;;AAEF;;AAElD,oDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;AACzC,0BAA0B,WAAM;;AAEhC;;AAEA;AACA;;AAEA;;AAEA,iCAAiC,mBAAY;AAC7C,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,6DAA6D,oBAAa;AAC1E;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAAgC,oBAAa;AAC7C;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;ACxHF;AAC0B;;AAEsB;AACJ;;AAErC,SAAS,yBAAO;AACvB,gCAAgC,aAAa;AAC7C,kCAAkC,eAAe;;AAEjD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,oDAAoD,kBAAkB;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,kBAAkB;AACtE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB;AACpB;AACA,KAAK;AACL,C;;ACzD0C;AACI;AAC9C,yBAAG,CAAC,yBAAO,E;;;ACDX;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACgD;;AAEhD;AACA;AACA;;AAEA,IAAI,WAAK;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,UAAU,IAAqC;AAC/C;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,kCAAkC;;AAElC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,SAAS;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,mBAAmB,uBAAuB;AAC1C;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA,qBAAqB,kBAAkB;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;;AAEA;AACA;AACA;AACA,KAAK,EAAE;;AAEP,uCAAuC,SAAS;AAChD;AACA;;AAEA,2CAA2C,SAAS;AACpD;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;;AAEA;AACA;AACA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc;AACd;;;AAGA;AACA;AACA;AACA;AACA,cAAc;AACd;;;AAGA;AACA;AACA;AACA;AACA,aAAa;AACb;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,uBAAuB;AAC1C;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAY;AACZ,KAAY;AACZ,iDAAe,WAAK,EAAC;;;;AC1drB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AAC+E;AAClC;AAC7C,YAAY,SAAS;;AAErB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,gCAAgC;;AAEhC,EAAE,IAAI;AACN,IAAI,IAAI;AACR,kCAAkC,KAAK;AACvC,KAAK;AACL,GAAG,EAAE;;AAEL,sCAAsC,KAAK,8BAA8B;AACzE;;AAEA,EAAE,IAAI;AACN,oCAAoC,KAAK;AACzC,GAAG,EAAE;;AAEL,EAAE,MAAM;AACR;;AAEA;AACA;AACA;AACA,gBAAgB,WAAM,GAAG;AACzB;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAE,IAAI;AACN;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA,GAAG,IAAI,GAAG,CAAC,IAAI;AACf;AACA;AACA;AACA;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA,EAAE,IAAI;AACN;AACA,GAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;;;AAGH;AACA;AACA;;AAEA,sDAAe,QAAQ,E;;ACvKwB;AACJ;AACa;AACb;;AAE3C,6BAAe,SAAS,wBAAC;AACzB,oBAAoB,UAAK;AACzB,mBAAmB,kBAAkB;AACrC,sBAAsB,0BAAqB;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B,0BAAqB;AACnD;AACA;AACA;;AAEA;;AAEA;AACA,yBAAyB,yCAA+B;AACxD;AACA;AACA;AACA;AACA,mBAAmB,sBAAY;AAC/B;;AAEA,uBAAuB,sBAAY;AACnC;;AAEA;;AAEA,IAAI,eAAQ;AACZ;AACA;AACA;AACA,gBAAgB,+BAA+B;AAC/C,oBAAoB;AACpB,KAAK;;AAEL;AACA;;AAEA;AACA,E;;ACzD+C;AACiB;AACrB;;AAE3C,kBAAkB,oCAA0B;;AAE5C;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,mBAAmB,6BAA4B;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,mBAAmB,uBAAuB;AAC1C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA,gBAAgB;AAChB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,mCAAyB;;AAE5C;AACA,gCAAgC,mCAAyB;AACzD;AACA;AACA;AACA,cAAc;AACd;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,iCAAiC,sBAAY;AAC7C;;AAEA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,uBAAuB,uBAAuB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yBAAyB,EAAE;AAC3B;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,qBAAqB;;AAErB;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,CAAC;;AAED,oDAAe,WAAW,E;;ACxR1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAE2C;AACI;AACS;AACT;AAC/C,IAAI,YAAI,GAAG,iBAAa;;AAExB;AACA;;AAEA,IAAI,wBAAgB;AACpB;AACA;AACA;AACA;AACA;;AAEA,IAAI,qBAAa,GAAG,mBAAe;AACnC;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C,wBAAwB,sBAAkB;AAC1C,wBAAwB,sBAAkB;AAC1C,uBAAuB,sBAAkB;AACzC;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,kBAAkB,YAAI,gBAAgB,YAAI,gBAAgB,YAAI;AAC9D;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,2CAA2C,wBAAgB;AAC3D,KAAK;;AAEL;AACA;AACA,gBAAgB;AAChB;AACA;AACA,6CAA6C,wBAAgB;AAC7D,KAAK;;AAEL;AACA;AACA,cAAc,aAAa;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc,aAAa;AAC3B,gBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;;AAEA,sBAAsB;AACtB,wBAAwB;AACxB,0BAA0B;AAC1B;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,eAAe;AAC9B,eAAe,OAAO;AACtB;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,eAAe,+BAA+B;AAC9C,eAAe,+BAA+B;AAC9C,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB,eAAe,OAAO;AACtB;AACA;AACA,mBAAmB,YAAI;AACvB,mBAAmB,YAAI;AACvB,qBAAqB,YAAI;AACzB,sBAAsB,YAAI;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,iBAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,YAAI;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;AAChC,qEAAqE,YAAI;AACzE;AACA;;AAEA;AACA;AACA;AACA,4BAA4B,YAAI;AAChC,4BAA4B,YAAI;;AAEhC;AACA;;AAEA;AACA;;AAEA;AACA;AACA,wBAAwB,YAAI;AAC5B,wBAAwB,YAAI;;AAE5B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,oBAAoB,YAAI;;AAExB;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA,iCAAiC,eAAe;AAChD;AACA;AACA;AACA;AACA,CAAC;;AAED,+BAAqB,CAAC,qBAAa,YAAY,mBAAmB;;AAElE,8CAAe,qBAAa,E;;ACjd5B,uDAAe,uGAAuG,6BAA6B,wBAAwB,wBAAwB,6BAA6B,mCAAmC,8BAA8B,4BAA4B,iBAAiB,kDAAkD,4BAA4B,kBAAkB,gBAAgB,OAAO,yIAAyI,wCAAwC,8BAA8B,4BAA4B,oBAAoB,sBAAsB,wBAAwB,sBAAsB,uBAAuB,iBAAiB,4CAA4C,IAAI,sBAAsB,0CAA0C,IAAI,IAAI,SAAS,uCAAuC,IAAI,yBAAyB,IAAI,IAAI,sCAAsC,iBAAiB,4BAA4B,mBAAmB,IAAI,+CAA+C,0CAA0C,GAAG,uFAAuF,uBAAuB,yBAAyB,kCAAkC,oCAAoC,8BAA8B,0BAA0B,yCAAyC,yBAAyB,iBAAiB,6CAA6C,2CAA2C,8BAA8B,yBAAyB,WAAW,oCAAoC,WAAW,IAAI,yCAAyC,cAAc,IAAI,SAAS,wCAAwC,IAAI,8DAA8D,+FAA+F,wCAAwC,8CAA8C,sBAAsB,kBAAkB,wBAAwB,uBAAuB,IAAI,kBAAkB,uBAAuB,UAAU,IAAI,sBAAsB,2BAA2B,IAAI,SAAS,cAAc,IAAI,0BAA0B,GAAG,yFAAyF,iBAAiB,0CAA0C,GAAG,iFAAiF,0BAA0B,iBAAiB,qBAAqB,0CAA0C,sBAAsB,GAAG,qFAAqF,kCAAkC,6BAA6B,iCAAiC,iBAAiB,iDAAiD,yDAAyD,qDAAqD,kDAAkD,2DAA2D,oDAAoD,GAAG,2FAA2F,mCAAmC,gCAAgC,iBAAiB,8DAA8D,sEAAsE,2FAA2F,+BAA+B,2EAA2E,IAAI,mDAAmD,GAAG,gFAAgF,iCAAiC,gCAAgC,mCAAmC,4BAA4B,iBAAiB,mDAAmD,2DAA2D,kDAAkD,gEAAgE,2CAA2C,uEAAuE,8BAA8B,kBAAkB,sCAAsC,2DAA2D,IAAI,SAAS,uBAAuB,IAAI,GAAG,wGAAwG,wBAAwB,iCAAiC,uBAAuB,kCAAkC,kBAAkB,+FAA+F,qBAAqB,GAAG,6FAA6F,uBAAuB,eAAe,kCAAkC,GAAG,OAAO,EAAC;;;ACAr8J;AACC;AACG;;AAEG;AACpD,4BAAuB,CAAC,gBAAe;;AAEvC;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA,cAAc,4BAAuB;AACrC,mBAAmB,8BAAyB;AAC5C,mBAAmB,8BAAyB;AAC5C;;AAEA,kCAAkC,wBAAmB;AACrD;;AAEA,4BAA4B,wBAAmB;AAC/C,gCAAgC,wBAAmB;AACnD,yBAAyB,wBAAmB;AAC5C,6BAA6B,wBAAmB;;AAEhD,+BAA+B,wBAAmB;AAClD;;AAEA,+BAA+B,wBAAmB;AAClD,mCAAmC,wBAAmB;AACtD;AACA;;AAEA,kCAAkC,eAAI;AACtC,kBAAkB,4BAAuB;AACzC,KAAK;AACL,6BAA6B,eAAI;AACjC,kBAAkB,4BAAuB;AACzC,KAAK;AACL,gCAAgC,eAAI;AACpC,kBAAkB,4BAAuB;AACzC,KAAK;AACL,yBAAyB,eAAI;AAC7B,kBAAkB,4BAAuB;AACzC,KAAK;;AAEL;AACA;AACA;AACA;AACA,8BAA8B,mBAAc;AAC5C,sBAAsB,uBAAkB;AACxC;AACA,2BAA2B,iCAA4B;AACvD,2BAA2B,iCAA4B;AACvD,4BAA4B,iCAA4B;AACxD,aAAa;AACb;AACA;AACA,SAAS;AACT,sBAAsB,uBAAkB;AACxC;AACA,oBAAoB,2BAAsB;AAC1C;AACA;AACA;AACA,SAAS;AACT,cAAc,0BAAqB;AACnC,KAAK;AACL,gCAAgC,mBAAc;AAC9C,sBAAsB,uBAAkB;AACxC;AACA,0BAA0B,iCAA4B;AACtD,aAAa;AACb;AACA;AACA,SAAS;AACT,sBAAsB,uBAAkB;AACxC;AACA,oBAAoB,2BAAsB;AAC1C;AACA;AACA;AACA,SAAS;AACT,cAAc,0BAAqB;AACnC,KAAK;;AAEL,4BAA4B,eAAW;AACvC;AACA,KAAK;;AAEL,4BAA4B,iCAA4B;AACxD;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uBAAuB,wBAAwB;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,WAAW,eAAe,GAAG,aAAa;AAC1C,WAAW,eAAe,GAAG,uBAAuB;AACpD;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,mBAAmB,kBAAkB;AACrC;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,mBAAmB,WAAW;AAC9B;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6DAAe,cAAc,E;;ACld7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;AACA,2BAA2B,uBAAuB;AAClD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA,mCAAmC,YAAY;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,YAAY;AACnC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,wBAAwB;AAC3D;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,uBAAuB,uBAAuB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,WAAW;AAC9C;AACA;;AAEA;AACA;AACA;AACA,mCAAmC,YAAY;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;;AAEA,gEAAe,iBAAiB,E;;ACppBa;AACJ;AACO;AAChD,gBAAgB,kCAAmB;AACnC,gDAAgD,gCAAgC;;AAEhF,IAAI,0BAAc;;AAElB;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA,qBAAqB,0BAAc;AACnC,qBAAqB,0BAAc;AACnC;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA,4BAA4B,aAAS;AACrC,cAAc,iBAAa;AAC3B;AACA,mBAAmB,mBAAe;AAClC,mBAAmB,mBAAe;AAClC,KAAK;AACL;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,kBAAkB;AACrC;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,0BAAc;AACnC,uBAAuB,0BAAc;AACrC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,yBAAyB,0BAAc;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,kBAAkB;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,mBAAmB,kBAAkB;AACrC;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uBAAuB,8BAA8B;AACrD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,mBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,0DAAe,WAAW,E;;;ACvRc;AACN;;AAElC;AACA;AACA;AACA,oBAAoB,gBAAW;;AAE/B;AACA;AACA,kBAAkB;AAClB;AACA;;AAEA;AACA,kBAAkB;AAClB;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;;AAEA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,yDAAe,aAAa,E;;ACpM5B,mDAAe,uFAAuF,sCAAsC,iCAAiC,uBAAuB,sEAAsE,0BAA0B,kEAAkE,uBAAuB,GAAG,uFAAuF,yBAAyB,kBAAkB,kCAAkC,GAAG,iFAAiF,wBAAwB,yBAAyB,iCAAiC,2DAA2D,mCAAmC,yBAAyB,wBAAwB,kBAAkB,uEAAuE,kEAAkE,mBAAmB,mCAAmC,gDAAgD,oDAAoD,qCAAqC,uBAAuB,GAAG,2FAA2F,yBAAyB,wBAAwB,kBAAkB,kCAAkC,GAAG,SAAS,EAAC;;;ACA32C;AACO;AACT;AACN;AACmB;AACf;AACG;AACN;AACwC;AACjC;AAC8B;;AAE7E,IAAI,gBAAI,GAAG,iBAAa;;AAE6B;;AAED;;AAEQ;AAC5D,4BAAuB,CAAC,YAAW;;AAEnC;;AAEA,kDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;;AAEA,2BAA2B,mBAAc;AACzC,0BAA0B,WAAM;AAChC;;AAEA;;AAEA,kCAAkC,oBAAa;;AAE/C;AACA,mCAAmC,mBAAc;AACjD,0BAA0B,uBAAkB;AAC5C,wBAAwB,2BAAsB;AAC9C;AACA;AACA;AACA,aAAa;AACb;AACA,0BAA0B,uBAAkB;AAC5C;AACA,8BAA8B,iCAA4B;AAC1D,+BAA+B,iCAA4B;AAC3D,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA,kBAAkB,yBAAoB;AACtC,SAAS;;AAET;AACA,8BAA8B,mBAAc;AAC5C,0BAA0B,uBAAkB;AAC5C,wBAAwB,2BAAsB;AAC9C;AACA;AACA;AACA,aAAa;AACb;AACA,0BAA0B,OAAe;AACzC;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;;AAET;;AAEA,4BAA4B,kBAAa;AACzC;AACA;AACA,SAAS;AACT;AACA;;;AAGA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA,mDAAmD,sBAAc;AACjE;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA,SAAS;;AAET,8BAA8B,0BAAqB;AACnD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,IAAqC;AACzD;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,kBAAkB;AAC1C,2BAA2B,yBAAoB;AAC/C,2BAA2B,0BAAqB;AAChD,gBAAgB,oBAAoB;AACpC;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wBAAwB,kBAAkB;AAC1C,2BAA2B,yBAAoB;AAC/C,2BAA2B,0BAAqB,CAAC,oBAAoB;AACrE;AACA,4BAA4B,0BAAqB;;AAEjD;;AAEA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,uBAAuB,aAAa;AACpC;AACA;AACA,SAAS;;AAET;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,kCAAkC,0BAAqB;AACvD,kCAAkC,0BAAqB;AACvD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2BAA2B,kCAAwB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;;AAEA;AACA;AACA;AACA,6BAA6B,kCAAwB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA,yEAAyE,sBAAc;AACvF,6EAA6E,mBAAW;AACxF;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,sBAAc;AACxC,0BAA0B,mBAAW;AACrC;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,gBAAgB,IAAqC;AACrD;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,gBAAgB,+BAAqB;AACrC;AACA,iBAAiB;AACjB,aAAa;AACb;;AAEA,QAAQ,+BAAqB;AAC7B;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA,KAAK;;AAEL;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA,KAAK;;AAEL;;AAEA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA,6BAA6B,yBAAoB;AACjD,8BAA8B,0BAAqB;AACnD;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,kBAAkB,gBAAI;AACtB,kBAAkB,gBAAI;AACtB;AACA,uBAAuB,mBAAmB;AAC1C;AACA;AACA,YAAY,gBAAI;AAChB,YAAY,gBAAI;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;AC1tBF;AAC0B;;AAEqB;;AAEH;AACJ;;AAExC,SAAS,iBAAS;AAClB;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAO;;AAEvB,gCAAgC,WAAW;AAC3C,kCAAkC,aAAa;;AAE/C;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,+BAA+B,6BAA6B;AAC5D;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wBAAwB,6BAAmB;;AAE3C;;AAEA,uCAAuC,uBAAuB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT,KAAK;;AAEL;;AAEA;AACA;AACA;AACA,6BAA6B,iBAAS;AACtC,6BAA6B,iBAAS;;AAEtC;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,iCAAiC,iBAAS;AAC1C,iCAAiC,iBAAS;AAC1C;AACA;;AAEA;AACA,gBAAgB,6BAAmB;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT,KAAK;;AAEL;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;;AAGL;AACA;AACA;AACA;AACA,KAAK;AACL,C;;ACxK0C;AACE;AAC5C,yBAAG,CAAC,uBAAO,E;;ACFoC;;AAE/C,mDAAe,oCAA0B;;AAEzC;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,eAAe,+CAAqC;AACpD,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA,yBAAyB,yCAA+B;AACxD;AACA;AACA;AACA,SAAS;AACT,uBAAuB,sBAAY;AACnC;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,E;;ACvDF;AACA;AACA;AACA;AACA;AACA;AACA;;AAE2C;AACI;;AAE/C;AACA;AACA;AACA;AACA;;AAEA,IAAI,oBAAa,GAAG,mBAAe;AACnC;;AAEA;;AAEA;AACA,0BAA0B,sBAAkB;AAC5C;AACA;AACA,CAAC;AACD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,eAAe,OAAO;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,CAAC;;AAED,6CAAe,oBAAa,E;;AChF5B,+DAAe,gFAAgF,iCAAiC,oCAAoC,4BAA4B,4BAA4B,qCAAqC,6BAA6B,qCAAqC,+BAA+B,4BAA4B,oBAAoB,mDAAmD,sBAAsB,oBAAoB,uEAAuE,yBAAyB,gBAAgB,IAAI,+EAA+E,uBAAuB,mBAAmB,+CAA+C,oBAAoB,wCAAwC,aAAa,IAAI,sBAAsB,sBAAsB,GAAG,sHAAsH,sCAAsC,yDAAyD,6BAA6B,wBAAwB,oBAAoB,kBAAkB,iDAAiD,mCAAmC,wEAAwE,IAAI,SAAS,yDAAyD,IAAI,iBAAiB,eAAe,yBAAyB,GAAG,uGAAuG,oCAAoC,iCAAiC,kCAAkC,wBAAwB,oBAAoB,kBAAkB,wBAAwB,yFAAyF,wBAAwB,WAAW,IAAI,wGAAwG,sFAAsF,WAAW,qHAAqH,sCAAsC,wCAAwC,6BAA6B,4BAA4B,yDAAyD,wBAAwB,oBAAoB,4CAA4C,oDAAoD,yDAAyD,6BAA6B,6BAA6B,mCAAmC,sCAAsC,2EAA2E,gCAAgC,6CAA6C,eAAe,eAAe,IAAI,SAAS,8CAA8C,gBAAgB,gBAAgB,IAAI,mDAAmD,IAAI,SAAS,yDAAyD,IAAI,GAAG,sGAAsG,oCAAoC,iCAAiC,wBAAwB,oBAAoB,kBAAkB,wBAAwB,iGAAiG,sFAAsF,WAAW,WAAW,EAAC;;;ACAz/G;AACH;AACR;AACQ;AACJ;AACM;AACJ;AACgB;AACH;;AAEL;AACX;AACtC;;AAEoE;;AAEpE,iBAAgB,CAAC,wBAAuB;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,cAAc;AACd;AACA,kCAAkC,aAAS;AAC3C,cAAc,iBAAa;AAC3B;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,cAAc;AACd;AACA;;AAEA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,kBAAkB,iBAAa;AAC/B,uBAAuB,mBAAe;AACtC,uBAAuB,mBAAe;AACtC;AACA;AACA,iCAAiC,aAAS;;AAE1C,qCAAqC,aAAS;AAC9C,qCAAqC,aAAS;;AAE9C,gCAAgC,eAAW;AAC3C;AACA,SAAS;AACT,iCAAiC,eAAI;AACrC,sBAAsB,iBAAa;AACnC,SAAS;AACT;AACA;;AAEA,mCAAmC,eAAI;AACvC,sBAAsB,iBAAa;AACnC,SAAS;;AAET,qCAAqC,QAAI;AACzC;AACA;AACA,0BAA0B,YAAQ;AAClC,4BAA4B,UAAM;AAClC,oBAAoB,iBAAa;AACjC,oBAAoB,iBAAa;AACjC;AACA,aAAa;AACb,kBAAkB,eAAW;AAC7B,0BAA0B,YAAQ;AAClC;AACA;AACA,aAAa;AACb,SAAS;AACT,oCAAoC,QAAI;AACxC;AACA;AACA,0BAA0B,YAAQ;AAClC,4BAA4B,UAAM;AAClC,oBAAoB,iBAAa;AACjC,oBAAoB,iBAAa;AACjC;AACA,aAAa;AACb,0BAA0B,MAAc;AACxC;AACA,SAAS;AACT,oCAAoC,QAAI;AACxC,0BAA0B,YAAQ;AAClC,4BAA4B,UAAM;AAClC,oBAAoB,iBAAa;AACjC,oBAAoB,iBAAa;AACjC;AACA;AACA;AACA,aAAa;AACb,0BAA0B,cAAa;AACvC,SAAS;AACT;;AAEA;AACA;AACA;;AAEA,2BAA2B,mBAAW;AACtC,qCAAqC,aAAS;AAC9C,qCAAqC,aAAS;AAC9C,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,WAAW;AAClC,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA,uBAAuB,WAAW;AAClC,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,uBAAuB,WAAW;AAClC,2BAA2B,YAAY;AACvC;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,aAAS;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,aAAa;AACpC,iEAAiE,aAAS;AAC1E;AACA;AACA;AACA;AACA,cAAc,8BAA8B;AAC5C;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA,wEAAe,0BAA0B,E;;ACzbM;AACF;AACF;AACJ;;AAE+B;;;AAGtE;AACA,iDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,0BAA0B,WAAM;AAChC,2BAA2B,mBAAc;AACzC;;AAEA,oCAAoC,iCAA0B;;AAE9D,4BAA4B,mBAAc;AAC1C,0BAA0B,4BAAuB;AACjD,0BAA0B,uBAAkB;AAC5C,4BAA4B,qBAAgB;AAC5C,4BAA4B,4BAAuB;AACnD,8BAA8B,4BAAuB;AACrD,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;;AAEA;;AAEA;;AAEA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,8BAA8B,0BAAqB;AACnD;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,+BAA+B,aAAa;AAC5C;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;;AAEA;AACA,oBAAoB,yBAAoB;AACxC,oBAAoB,0BAAqB;AACzC;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,SAAS;;AAET;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,uBAAuB,YAAY;AACnC,2BAA2B,WAAW;AACtC;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA,iCAAiC;AACjC;AACA;AACA,iCAAiC;AACjC;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,6DAA6D,wBAAmB;AAChF;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,CAAC,EAAC;;;ACrWH;AAC0B;;AAEgB;AACJ;;AAE/B,SAAS,sBAAO;AACvB,gCAAgC,UAAU;AAC1C,kCAAkC,YAAY;AAC9C,C;;ACT0C;AACC;AAC3C,yBAAG,CAAC,sBAAO,E;;ACFoC;AACK;;AAEpD,oBAAoB,oCAA0B;;AAE9C;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,WAAW;AAC9C,yCAAyC,WAAW;AACpD;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA,YAAY,IAAqC;AACjD;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,mBAAmB;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,SAAS;AACpC;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,WAAW;AAC1C;AACA;AACA;AACA;;AAEA;AACA,4BAA4B,IAAqC;AACjE;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,2BAA2B,sBAAY;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED,4DAAe,aAAa,E;;AC1MmB;AACF;AACN;AACmB;AACR;AAC2B;;AAElC;;AAE3C,kDAAe,kCAAwB;;AAEvC;;AAEA;;AAEA;AACA,2BAA2B,mBAAc;AACzC,0BAA0B,WAAM;AAChC;;AAEA,iCAAiC,mBAAY;;AAE7C,kCAAkC,2BAAsB;AACxD,gCAAgC,2BAAsB;;AAEtD;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,4BAA4B,mBAAc;AAC1C;AACA,0BAA0B,uBAAkB;AAC5C,wBAAwB,2BAAsB;AAC9C;AACA;AACA;AACA,aAAa;AACb,0BAA0B,OAAe;AACzC;AACA;AACA;AACA,aAAa;AACb,kBAAkB,yBAAoB;AACtC;AACA,SAAS;;AAET;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc,4BAAuB;AACrC;AACA;AACA;AACA;;AAEA,wBAAwB,0BAAqB;;AAE7C;AACA;AACA;AACA;AACA,6BAA6B,6BAAwB;AACrD;AACA;AACA;AACA;AACA;AACA,6BAA6B,yBAAoB;AACjD;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,WAAW;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,6BAA6B,WAAW;AACxC,YAAY,yBAAoB,CAAC,kBAAkB;AACnD,0BAA0B,0BAAqB,CAAC,oBAAoB;AACpE;;AAEA;AACA,2BAA2B,WAAW;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,CAAC,CAAC,E;;ACzMF;AAC0B;;AAEkB;AACJ;;AAEjC,SAAS,uBAAO;AACvB,gCAAgC,WAAW;AAC3C,kCAAkC,qBAAa;AAC/C,C;;ACT0C;AACE;AAC5C,yBAAG,CAAC,uBAAO,E;;ACFY;;AAEM;AACD;AACA;AACG;AACE;;AAET;AACC;AACG;AACF;AACG;AACH;AACF;;AAEI;AACF;AACD;;;;;;;;;;;AClBzB,iE;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCrBA;WACA;WACA;WACA;WACA,EAAE;WACF;WACA;WACA,CAAC,I;;;;;WCPD;WACA;WACA;WACA,sDAAsD,kBAAkB;WACxE;WACA,+CAA+C,cAAc;WAC7D,E;;;;UCNA;UACA;UACA;UACA","file":"echarts-gl.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"echarts\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"echarts\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"echarts-gl\"] = factory(require(\"echarts\"));\n\telse\n\t\troot[\"echarts-gl\"] = factory(root[\"echarts\"]);\n})(self, function(__WEBPACK_EXTERNAL_MODULE_echarts_lib_echarts__) {\nreturn ","/**\n * Extend a sub class from base class\n * @param {object|Function} makeDefaultOpt default option of this sub class, method of the sub can use this.xxx to access this option\n * @param {Function} [initialize] Initialize after the sub class is instantiated\n * @param {Object} [proto] Prototype methods/properties of the sub class\n * @memberOf clay.core.mixin.extend\n * @return {Function}\n */\nfunction derive(makeDefaultOpt, initialize/*optional*/, proto/*optional*/) {\n\n if (typeof initialize == 'object') {\n proto = initialize;\n initialize = null;\n }\n\n var _super = this;\n\n var propList;\n if (!(makeDefaultOpt instanceof Function)) {\n // Optimize the property iterate if it have been fixed\n propList = [];\n for (var propName in makeDefaultOpt) {\n if (makeDefaultOpt.hasOwnProperty(propName)) {\n propList.push(propName);\n }\n }\n }\n\n var sub = function(options) {\n\n // call super constructor\n _super.apply(this, arguments);\n\n if (makeDefaultOpt instanceof Function) {\n // Invoke makeDefaultOpt each time if it is a function, So we can make sure each\n // property in the object will not be shared by mutiple instances\n extend(this, makeDefaultOpt.call(this, options));\n }\n else {\n extendWithPropList(this, makeDefaultOpt, propList);\n }\n\n if (this.constructor === sub) {\n // Initialize function will be called in the order of inherit\n var initializers = sub.__initializers__;\n for (var i = 0; i < initializers.length; i++) {\n initializers[i].apply(this, arguments);\n }\n }\n };\n // save super constructor\n sub.__super__ = _super;\n // Initialize function will be called after all the super constructor is called\n if (!_super.__initializers__) {\n sub.__initializers__ = [];\n } else {\n sub.__initializers__ = _super.__initializers__.slice();\n }\n if (initialize) {\n sub.__initializers__.push(initialize);\n }\n\n var Ctor = function() {};\n Ctor.prototype = _super.prototype;\n sub.prototype = new Ctor();\n sub.prototype.constructor = sub;\n extend(sub.prototype, proto);\n\n // extend the derive method as a static method;\n sub.extend = _super.extend;\n\n // DEPCRATED\n sub.derive = _super.extend;\n\n return sub;\n}\n\nfunction extend(target, source) {\n if (!source) {\n return;\n }\n for (var name in source) {\n if (source.hasOwnProperty(name)) {\n target[name] = source[name];\n }\n }\n}\n\nfunction extendWithPropList(target, source, propList) {\n for (var i = 0; i < propList.length; i++) {\n var propName = propList[i];\n target[propName] = source[propName];\n }\n}\n\n/**\n * @alias clay.core.mixin.extend\n * @mixin\n */\nexport default {\n\n extend: derive,\n\n // DEPCRATED\n derive: derive\n};\n","function Handler(action, context) {\n this.action = action;\n this.context = context;\n}\n/**\n * @mixin\n * @alias clay.core.mixin.notifier\n */\nvar notifier = {\n /**\n * Trigger event\n * @param {string} name\n */\n trigger: function(name) {\n if (!this.hasOwnProperty('__handlers__')) {\n return;\n }\n if (!this.__handlers__.hasOwnProperty(name)) {\n return;\n }\n\n var hdls = this.__handlers__[name];\n var l = hdls.length, i = -1, args = arguments;\n // Optimize advise from backbone\n switch (args.length) {\n case 1:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context);\n }\n return;\n case 2:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context, args[1]);\n }\n return;\n case 3:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context, args[1], args[2]);\n }\n return;\n case 4:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context, args[1], args[2], args[3]);\n }\n return;\n case 5:\n while (++i < l) {\n hdls[i].action.call(hdls[i].context, args[1], args[2], args[3], args[4]);\n }\n return;\n default:\n while (++i < l) {\n hdls[i].action.apply(hdls[i].context, Array.prototype.slice.call(args, 1));\n }\n return;\n }\n },\n /**\n * Register event handler\n * @param {string} name\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n on: function(name, action, context) {\n if (!name || !action) {\n return;\n }\n var handlers = this.__handlers__ || (this.__handlers__={});\n if (!handlers[name]) {\n handlers[name] = [];\n }\n else {\n if (this.has(name, action)) {\n return;\n }\n }\n var handler = new Handler(action, context || this);\n handlers[name].push(handler);\n\n return this;\n },\n\n /**\n * Register event, event will only be triggered once and then removed\n * @param {string} name\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n once: function(name, action, context) {\n if (!name || !action) {\n return;\n }\n var self = this;\n function wrapper() {\n self.off(name, wrapper);\n action.apply(this, arguments);\n }\n return this.on(name, wrapper, context);\n },\n\n /**\n * Alias of once('before' + name)\n * @param {string} name\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n before: function(name, action, context) {\n if (!name || !action) {\n return;\n }\n name = 'before' + name;\n return this.on(name, action, context);\n },\n\n /**\n * Alias of once('after' + name)\n * @param {string} name\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n after: function(name, action, context) {\n if (!name || !action) {\n return;\n }\n name = 'after' + name;\n return this.on(name, action, context);\n },\n\n /**\n * Alias of on('success')\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n success: function(action, context) {\n return this.once('success', action, context);\n },\n\n /**\n * Alias of on('error')\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n error: function(action, context) {\n return this.once('error', action, context);\n },\n\n /**\n * Remove event listener\n * @param {Function} action\n * @param {Object} [context]\n * @chainable\n */\n off: function(name, action) {\n\n var handlers = this.__handlers__ || (this.__handlers__={});\n\n if (!action) {\n handlers[name] = [];\n return;\n }\n if (handlers[name]) {\n var hdls = handlers[name];\n var retains = [];\n for (var i = 0; i < hdls.length; i++) {\n if (action && hdls[i].action !== action) {\n retains.push(hdls[i]);\n }\n }\n handlers[name] = retains;\n }\n\n return this;\n },\n\n /**\n * If registered the event handler\n * @param {string} name\n * @param {Function} action\n * @return {boolean}\n */\n has: function(name, action) {\n var handlers = this.__handlers__;\n\n if (! handlers ||\n ! handlers[name]) {\n return false;\n }\n var hdls = handlers[name];\n for (var i = 0; i < hdls.length; i++) {\n if (hdls[i].action === action) {\n return true;\n }\n }\n }\n};\n\nexport default notifier;","var guid = 0;\n\nvar ArrayProto = Array.prototype;\nvar nativeForEach = ArrayProto.forEach;\n\n/**\n * Util functions\n * @namespace clay.core.util\n */\nvar util = {\n\n /**\n * Generate GUID\n * @return {number}\n * @memberOf clay.core.util\n */\n genGUID: function () {\n return ++guid;\n },\n /**\n * Relative path to absolute path\n * @param {string} path\n * @param {string} basePath\n * @return {string}\n * @memberOf clay.core.util\n */\n relative2absolute: function (path, basePath) {\n if (!basePath || path.match(/^\\//)) {\n return path;\n }\n var pathParts = path.split('/');\n var basePathParts = basePath.split('/');\n\n var item = pathParts[0];\n while(item === '.' || item === '..') {\n if (item === '..') {\n basePathParts.pop();\n }\n pathParts.shift();\n item = pathParts[0];\n }\n return basePathParts.join('/') + '/' + pathParts.join('/');\n },\n\n /**\n * Extend target with source\n * @param {Object} target\n * @param {Object} source\n * @return {Object}\n * @memberOf clay.core.util\n */\n extend: function (target, source) {\n if (source) {\n for (var name in source) {\n if (source.hasOwnProperty(name)) {\n target[name] = source[name];\n }\n }\n }\n return target;\n },\n\n /**\n * Extend properties to target if not exist.\n * @param {Object} target\n * @param {Object} source\n * @return {Object}\n * @memberOf clay.core.util\n */\n defaults: function (target, source) {\n if (source) {\n for (var propName in source) {\n if (target[propName] === undefined) {\n target[propName] = source[propName];\n }\n }\n }\n return target;\n },\n /**\n * Extend properties with a given property list to avoid for..in.. iteration.\n * @param {Object} target\n * @param {Object} source\n * @param {Array.} propList\n * @return {Object}\n * @memberOf clay.core.util\n */\n extendWithPropList: function (target, source, propList) {\n if (source) {\n for (var i = 0; i < propList.length; i++) {\n var propName = propList[i];\n target[propName] = source[propName];\n }\n }\n return target;\n },\n /**\n * Extend properties to target if not exist. With a given property list avoid for..in.. iteration.\n * @param {Object} target\n * @param {Object} source\n * @param {Array.} propList\n * @return {Object}\n * @memberOf clay.core.util\n */\n defaultsWithPropList: function (target, source, propList) {\n if (source) {\n for (var i = 0; i < propList.length; i++) {\n var propName = propList[i];\n if (target[propName] == null) {\n target[propName] = source[propName];\n }\n }\n }\n return target;\n },\n /**\n * @param {Object|Array} obj\n * @param {Function} iterator\n * @param {Object} [context]\n * @memberOf clay.core.util\n */\n each: function (obj, iterator, context) {\n if (!(obj && iterator)) {\n return;\n }\n if (obj.forEach && obj.forEach === nativeForEach) {\n obj.forEach(iterator, context);\n }\n else if (obj.length === + obj.length) {\n for (var i = 0, len = obj.length; i < len; i++) {\n iterator.call(context, obj[i], i, obj);\n }\n }\n else {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n iterator.call(context, obj[key], key, obj);\n }\n }\n }\n },\n\n /**\n * Is object\n * @param {} obj\n * @return {boolean}\n * @memberOf clay.core.util\n */\n isObject: function (obj) {\n return obj === Object(obj);\n },\n\n /**\n * Is array ?\n * @param {} obj\n * @return {boolean}\n * @memberOf clay.core.util\n */\n isArray: function (obj) {\n return Array.isArray(obj);\n },\n\n /**\n * Is array like, which have a length property\n * @param {} obj\n * @return {boolean}\n * @memberOf clay.core.util\n */\n isArrayLike: function (obj) {\n if (!obj) {\n return false;\n }\n else {\n return obj.length === + obj.length;\n }\n },\n\n /**\n * @param {} obj\n * @return {}\n * @memberOf clay.core.util\n */\n clone: function (obj) {\n if (!util.isObject(obj)) {\n return obj;\n }\n else if (util.isArray(obj)) {\n return obj.slice();\n }\n else if (util.isArrayLike(obj)) { // is typed array\n var ret = new obj.constructor(obj.length);\n for (var i = 0; i < obj.length; i++) {\n ret[i] = obj[i];\n }\n return ret;\n }\n else {\n return util.extend({}, obj);\n }\n }\n};\n\nexport default util;\n","import extendMixin from './mixin/extend';\nimport notifierMixin from './mixin/notifier';\nimport util from './util';\n\n/**\n * Base class of all objects\n * @constructor\n * @alias clay.core.Base\n * @mixes clay.core.mixin.notifier\n */\nvar Base = function () {\n /**\n * @type {number}\n */\n this.__uid__ = util.genGUID();\n};\n\nBase.__initializers__ = [\n function (opts) {\n util.extend(this, opts);\n }\n];\n\nutil.extend(Base, extendMixin);\nutil.extend(Base.prototype, notifierMixin);\n\nexport default Base;\n","var EXTENSION_LIST = [\n 'OES_texture_float',\n 'OES_texture_half_float',\n 'OES_texture_float_linear',\n 'OES_texture_half_float_linear',\n 'OES_standard_derivatives',\n 'OES_vertex_array_object',\n 'OES_element_index_uint',\n 'WEBGL_compressed_texture_s3tc',\n 'WEBGL_depth_texture',\n 'EXT_texture_filter_anisotropic',\n 'EXT_shader_texture_lod',\n 'WEBGL_draw_buffers',\n 'EXT_frag_depth',\n 'EXT_sRGB',\n 'ANGLE_instanced_arrays'\n];\n\nvar PARAMETER_NAMES = [\n 'MAX_TEXTURE_SIZE',\n 'MAX_CUBE_MAP_TEXTURE_SIZE'\n];\n\nfunction GLInfo(_gl) {\n var extensions = {};\n var parameters = {};\n\n // Get webgl extension\n for (var i = 0; i < EXTENSION_LIST.length; i++) {\n var extName = EXTENSION_LIST[i];\n createExtension(extName);\n }\n // Get parameters\n for (var i = 0; i < PARAMETER_NAMES.length; i++) {\n var name = PARAMETER_NAMES[i];\n parameters[name] = _gl.getParameter(_gl[name]);\n }\n\n this.getExtension = function (name) {\n if (!(name in extensions)) {\n createExtension(name);\n }\n return extensions[name];\n };\n\n this.getParameter = function (name) {\n return parameters[name];\n };\n\n function createExtension(name) {\n if (_gl.getExtension) {\n var ext = _gl.getExtension(name);\n if (!ext) {\n ext = _gl.getExtension('MOZ_' + name);\n }\n if (!ext) {\n ext = _gl.getExtension('WEBKIT_' + name);\n }\n extensions[name] = ext;\n }\n }\n}\n\nexport default GLInfo;\n","/**\n * @namespace clay.core.glenum\n * @see http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14\n */\nexport default {\n /* ClearBufferMask */\n DEPTH_BUFFER_BIT : 0x00000100,\n STENCIL_BUFFER_BIT : 0x00000400,\n COLOR_BUFFER_BIT : 0x00004000,\n\n /* BeginMode */\n POINTS : 0x0000,\n LINES : 0x0001,\n LINE_LOOP : 0x0002,\n LINE_STRIP : 0x0003,\n TRIANGLES : 0x0004,\n TRIANGLE_STRIP : 0x0005,\n TRIANGLE_FAN : 0x0006,\n\n /* AlphaFunction (not supported in ES20) */\n /* NEVER */\n /* LESS */\n /* EQUAL */\n /* LEQUAL */\n /* GREATER */\n /* NOTEQUAL */\n /* GEQUAL */\n /* ALWAYS */\n\n /* BlendingFactorDest */\n ZERO : 0,\n ONE : 1,\n SRC_COLOR : 0x0300,\n ONE_MINUS_SRC_COLOR : 0x0301,\n SRC_ALPHA : 0x0302,\n ONE_MINUS_SRC_ALPHA : 0x0303,\n DST_ALPHA : 0x0304,\n ONE_MINUS_DST_ALPHA : 0x0305,\n\n /* BlendingFactorSrc */\n /* ZERO */\n /* ONE */\n DST_COLOR : 0x0306,\n ONE_MINUS_DST_COLOR : 0x0307,\n SRC_ALPHA_SATURATE : 0x0308,\n /* SRC_ALPHA */\n /* ONE_MINUS_SRC_ALPHA */\n /* DST_ALPHA */\n /* ONE_MINUS_DST_ALPHA */\n\n /* BlendEquationSeparate */\n FUNC_ADD : 0x8006,\n BLEND_EQUATION : 0x8009,\n BLEND_EQUATION_RGB : 0x8009, /* same as BLEND_EQUATION */\n BLEND_EQUATION_ALPHA : 0x883D,\n\n /* BlendSubtract */\n FUNC_SUBTRACT : 0x800A,\n FUNC_REVERSE_SUBTRACT : 0x800B,\n\n /* Separate Blend Functions */\n BLEND_DST_RGB : 0x80C8,\n BLEND_SRC_RGB : 0x80C9,\n BLEND_DST_ALPHA : 0x80CA,\n BLEND_SRC_ALPHA : 0x80CB,\n CONSTANT_COLOR : 0x8001,\n ONE_MINUS_CONSTANT_COLOR : 0x8002,\n CONSTANT_ALPHA : 0x8003,\n ONE_MINUS_CONSTANT_ALPHA : 0x8004,\n BLEND_COLOR : 0x8005,\n\n /* Buffer Objects */\n ARRAY_BUFFER : 0x8892,\n ELEMENT_ARRAY_BUFFER : 0x8893,\n ARRAY_BUFFER_BINDING : 0x8894,\n ELEMENT_ARRAY_BUFFER_BINDING : 0x8895,\n\n STREAM_DRAW : 0x88E0,\n STATIC_DRAW : 0x88E4,\n DYNAMIC_DRAW : 0x88E8,\n\n BUFFER_SIZE : 0x8764,\n BUFFER_USAGE : 0x8765,\n\n CURRENT_VERTEX_ATTRIB : 0x8626,\n\n /* CullFaceMode */\n FRONT : 0x0404,\n BACK : 0x0405,\n FRONT_AND_BACK : 0x0408,\n\n /* DepthFunction */\n /* NEVER */\n /* LESS */\n /* EQUAL */\n /* LEQUAL */\n /* GREATER */\n /* NOTEQUAL */\n /* GEQUAL */\n /* ALWAYS */\n\n /* EnableCap */\n /* TEXTURE_2D */\n CULL_FACE : 0x0B44,\n BLEND : 0x0BE2,\n DITHER : 0x0BD0,\n STENCIL_TEST : 0x0B90,\n DEPTH_TEST : 0x0B71,\n SCISSOR_TEST : 0x0C11,\n POLYGON_OFFSET_FILL : 0x8037,\n SAMPLE_ALPHA_TO_COVERAGE : 0x809E,\n SAMPLE_COVERAGE : 0x80A0,\n\n /* ErrorCode */\n NO_ERROR : 0,\n INVALID_ENUM : 0x0500,\n INVALID_VALUE : 0x0501,\n INVALID_OPERATION : 0x0502,\n OUT_OF_MEMORY : 0x0505,\n\n /* FrontFaceDirection */\n CW : 0x0900,\n CCW : 0x0901,\n\n /* GetPName */\n LINE_WIDTH : 0x0B21,\n ALIASED_POINT_SIZE_RANGE : 0x846D,\n ALIASED_LINE_WIDTH_RANGE : 0x846E,\n CULL_FACE_MODE : 0x0B45,\n FRONT_FACE : 0x0B46,\n DEPTH_RANGE : 0x0B70,\n DEPTH_WRITEMASK : 0x0B72,\n DEPTH_CLEAR_VALUE : 0x0B73,\n DEPTH_FUNC : 0x0B74,\n STENCIL_CLEAR_VALUE : 0x0B91,\n STENCIL_FUNC : 0x0B92,\n STENCIL_FAIL : 0x0B94,\n STENCIL_PASS_DEPTH_FAIL : 0x0B95,\n STENCIL_PASS_DEPTH_PASS : 0x0B96,\n STENCIL_REF : 0x0B97,\n STENCIL_VALUE_MASK : 0x0B93,\n STENCIL_WRITEMASK : 0x0B98,\n STENCIL_BACK_FUNC : 0x8800,\n STENCIL_BACK_FAIL : 0x8801,\n STENCIL_BACK_PASS_DEPTH_FAIL : 0x8802,\n STENCIL_BACK_PASS_DEPTH_PASS : 0x8803,\n STENCIL_BACK_REF : 0x8CA3,\n STENCIL_BACK_VALUE_MASK : 0x8CA4,\n STENCIL_BACK_WRITEMASK : 0x8CA5,\n VIEWPORT : 0x0BA2,\n SCISSOR_BOX : 0x0C10,\n /* SCISSOR_TEST */\n COLOR_CLEAR_VALUE : 0x0C22,\n COLOR_WRITEMASK : 0x0C23,\n UNPACK_ALIGNMENT : 0x0CF5,\n PACK_ALIGNMENT : 0x0D05,\n MAX_TEXTURE_SIZE : 0x0D33,\n MAX_VIEWPORT_DIMS : 0x0D3A,\n SUBPIXEL_BITS : 0x0D50,\n RED_BITS : 0x0D52,\n GREEN_BITS : 0x0D53,\n BLUE_BITS : 0x0D54,\n ALPHA_BITS : 0x0D55,\n DEPTH_BITS : 0x0D56,\n STENCIL_BITS : 0x0D57,\n POLYGON_OFFSET_UNITS : 0x2A00,\n /* POLYGON_OFFSET_FILL */\n POLYGON_OFFSET_FACTOR : 0x8038,\n TEXTURE_BINDING_2D : 0x8069,\n SAMPLE_BUFFERS : 0x80A8,\n SAMPLES : 0x80A9,\n SAMPLE_COVERAGE_VALUE : 0x80AA,\n SAMPLE_COVERAGE_INVERT : 0x80AB,\n\n /* GetTextureParameter */\n /* TEXTURE_MAG_FILTER */\n /* TEXTURE_MIN_FILTER */\n /* TEXTURE_WRAP_S */\n /* TEXTURE_WRAP_T */\n\n COMPRESSED_TEXTURE_FORMATS : 0x86A3,\n\n /* HintMode */\n DONT_CARE : 0x1100,\n FASTEST : 0x1101,\n NICEST : 0x1102,\n\n /* HintTarget */\n GENERATE_MIPMAP_HINT : 0x8192,\n\n /* DataType */\n BYTE : 0x1400,\n UNSIGNED_BYTE : 0x1401,\n SHORT : 0x1402,\n UNSIGNED_SHORT : 0x1403,\n INT : 0x1404,\n UNSIGNED_INT : 0x1405,\n FLOAT : 0x1406,\n\n /* PixelFormat */\n DEPTH_COMPONENT : 0x1902,\n ALPHA : 0x1906,\n RGB : 0x1907,\n RGBA : 0x1908,\n LUMINANCE : 0x1909,\n LUMINANCE_ALPHA : 0x190A,\n\n /* PixelType */\n /* UNSIGNED_BYTE */\n UNSIGNED_SHORT_4_4_4_4 : 0x8033,\n UNSIGNED_SHORT_5_5_5_1 : 0x8034,\n UNSIGNED_SHORT_5_6_5 : 0x8363,\n\n /* Shaders */\n FRAGMENT_SHADER : 0x8B30,\n VERTEX_SHADER : 0x8B31,\n MAX_VERTEX_ATTRIBS : 0x8869,\n MAX_VERTEX_UNIFORM_VECTORS : 0x8DFB,\n MAX_VARYING_VECTORS : 0x8DFC,\n MAX_COMBINED_TEXTURE_IMAGE_UNITS : 0x8B4D,\n MAX_VERTEX_TEXTURE_IMAGE_UNITS : 0x8B4C,\n MAX_TEXTURE_IMAGE_UNITS : 0x8872,\n MAX_FRAGMENT_UNIFORM_VECTORS : 0x8DFD,\n SHADER_TYPE : 0x8B4F,\n DELETE_STATUS : 0x8B80,\n LINK_STATUS : 0x8B82,\n VALIDATE_STATUS : 0x8B83,\n ATTACHED_SHADERS : 0x8B85,\n ACTIVE_UNIFORMS : 0x8B86,\n ACTIVE_ATTRIBUTES : 0x8B89,\n SHADING_LANGUAGE_VERSION : 0x8B8C,\n CURRENT_PROGRAM : 0x8B8D,\n\n /* StencilFunction */\n NEVER : 0x0200,\n LESS : 0x0201,\n EQUAL : 0x0202,\n LEQUAL : 0x0203,\n GREATER : 0x0204,\n NOTEQUAL : 0x0205,\n GEQUAL : 0x0206,\n ALWAYS : 0x0207,\n\n /* StencilOp */\n /* ZERO */\n KEEP : 0x1E00,\n REPLACE : 0x1E01,\n INCR : 0x1E02,\n DECR : 0x1E03,\n INVERT : 0x150A,\n INCR_WRAP : 0x8507,\n DECR_WRAP : 0x8508,\n\n /* StringName */\n VENDOR : 0x1F00,\n RENDERER : 0x1F01,\n VERSION : 0x1F02,\n\n /* TextureMagFilter */\n NEAREST : 0x2600,\n LINEAR : 0x2601,\n\n /* TextureMinFilter */\n /* NEAREST */\n /* LINEAR */\n NEAREST_MIPMAP_NEAREST : 0x2700,\n LINEAR_MIPMAP_NEAREST : 0x2701,\n NEAREST_MIPMAP_LINEAR : 0x2702,\n LINEAR_MIPMAP_LINEAR : 0x2703,\n\n /* TextureParameterName */\n TEXTURE_MAG_FILTER : 0x2800,\n TEXTURE_MIN_FILTER : 0x2801,\n TEXTURE_WRAP_S : 0x2802,\n TEXTURE_WRAP_T : 0x2803,\n\n /* TextureTarget */\n TEXTURE_2D : 0x0DE1,\n TEXTURE : 0x1702,\n\n TEXTURE_CUBE_MAP : 0x8513,\n TEXTURE_BINDING_CUBE_MAP : 0x8514,\n TEXTURE_CUBE_MAP_POSITIVE_X : 0x8515,\n TEXTURE_CUBE_MAP_NEGATIVE_X : 0x8516,\n TEXTURE_CUBE_MAP_POSITIVE_Y : 0x8517,\n TEXTURE_CUBE_MAP_NEGATIVE_Y : 0x8518,\n TEXTURE_CUBE_MAP_POSITIVE_Z : 0x8519,\n TEXTURE_CUBE_MAP_NEGATIVE_Z : 0x851A,\n MAX_CUBE_MAP_TEXTURE_SIZE : 0x851C,\n\n /* TextureUnit */\n TEXTURE0 : 0x84C0,\n TEXTURE1 : 0x84C1,\n TEXTURE2 : 0x84C2,\n TEXTURE3 : 0x84C3,\n TEXTURE4 : 0x84C4,\n TEXTURE5 : 0x84C5,\n TEXTURE6 : 0x84C6,\n TEXTURE7 : 0x84C7,\n TEXTURE8 : 0x84C8,\n TEXTURE9 : 0x84C9,\n TEXTURE10 : 0x84CA,\n TEXTURE11 : 0x84CB,\n TEXTURE12 : 0x84CC,\n TEXTURE13 : 0x84CD,\n TEXTURE14 : 0x84CE,\n TEXTURE15 : 0x84CF,\n TEXTURE16 : 0x84D0,\n TEXTURE17 : 0x84D1,\n TEXTURE18 : 0x84D2,\n TEXTURE19 : 0x84D3,\n TEXTURE20 : 0x84D4,\n TEXTURE21 : 0x84D5,\n TEXTURE22 : 0x84D6,\n TEXTURE23 : 0x84D7,\n TEXTURE24 : 0x84D8,\n TEXTURE25 : 0x84D9,\n TEXTURE26 : 0x84DA,\n TEXTURE27 : 0x84DB,\n TEXTURE28 : 0x84DC,\n TEXTURE29 : 0x84DD,\n TEXTURE30 : 0x84DE,\n TEXTURE31 : 0x84DF,\n ACTIVE_TEXTURE : 0x84E0,\n\n /* TextureWrapMode */\n REPEAT : 0x2901,\n CLAMP_TO_EDGE : 0x812F,\n MIRRORED_REPEAT : 0x8370,\n\n /* Uniform Types */\n FLOAT_VEC2 : 0x8B50,\n FLOAT_VEC3 : 0x8B51,\n FLOAT_VEC4 : 0x8B52,\n INT_VEC2 : 0x8B53,\n INT_VEC3 : 0x8B54,\n INT_VEC4 : 0x8B55,\n BOOL : 0x8B56,\n BOOL_VEC2 : 0x8B57,\n BOOL_VEC3 : 0x8B58,\n BOOL_VEC4 : 0x8B59,\n FLOAT_MAT2 : 0x8B5A,\n FLOAT_MAT3 : 0x8B5B,\n FLOAT_MAT4 : 0x8B5C,\n SAMPLER_2D : 0x8B5E,\n SAMPLER_CUBE : 0x8B60,\n\n /* Vertex Arrays */\n VERTEX_ATTRIB_ARRAY_ENABLED : 0x8622,\n VERTEX_ATTRIB_ARRAY_SIZE : 0x8623,\n VERTEX_ATTRIB_ARRAY_STRIDE : 0x8624,\n VERTEX_ATTRIB_ARRAY_TYPE : 0x8625,\n VERTEX_ATTRIB_ARRAY_NORMALIZED : 0x886A,\n VERTEX_ATTRIB_ARRAY_POINTER : 0x8645,\n VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F,\n\n /* Shader Source */\n COMPILE_STATUS : 0x8B81,\n\n /* Shader Precision-Specified Types */\n LOW_FLOAT : 0x8DF0,\n MEDIUM_FLOAT : 0x8DF1,\n HIGH_FLOAT : 0x8DF2,\n LOW_INT : 0x8DF3,\n MEDIUM_INT : 0x8DF4,\n HIGH_INT : 0x8DF5,\n\n /* Framebuffer Object. */\n FRAMEBUFFER : 0x8D40,\n RENDERBUFFER : 0x8D41,\n\n RGBA4 : 0x8056,\n RGB5_A1 : 0x8057,\n RGB565 : 0x8D62,\n DEPTH_COMPONENT16 : 0x81A5,\n STENCIL_INDEX : 0x1901,\n STENCIL_INDEX8 : 0x8D48,\n DEPTH_STENCIL : 0x84F9,\n\n RENDERBUFFER_WIDTH : 0x8D42,\n RENDERBUFFER_HEIGHT : 0x8D43,\n RENDERBUFFER_INTERNAL_FORMAT : 0x8D44,\n RENDERBUFFER_RED_SIZE : 0x8D50,\n RENDERBUFFER_GREEN_SIZE : 0x8D51,\n RENDERBUFFER_BLUE_SIZE : 0x8D52,\n RENDERBUFFER_ALPHA_SIZE : 0x8D53,\n RENDERBUFFER_DEPTH_SIZE : 0x8D54,\n RENDERBUFFER_STENCIL_SIZE : 0x8D55,\n\n FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE : 0x8CD0,\n FRAMEBUFFER_ATTACHMENT_OBJECT_NAME : 0x8CD1,\n FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL : 0x8CD2,\n FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE : 0x8CD3,\n\n COLOR_ATTACHMENT0 : 0x8CE0,\n DEPTH_ATTACHMENT : 0x8D00,\n STENCIL_ATTACHMENT : 0x8D20,\n DEPTH_STENCIL_ATTACHMENT : 0x821A,\n\n NONE : 0,\n\n FRAMEBUFFER_COMPLETE : 0x8CD5,\n FRAMEBUFFER_INCOMPLETE_ATTACHMENT : 0x8CD6,\n FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : 0x8CD7,\n FRAMEBUFFER_INCOMPLETE_DIMENSIONS : 0x8CD9,\n FRAMEBUFFER_UNSUPPORTED : 0x8CDD,\n\n FRAMEBUFFER_BINDING : 0x8CA6,\n RENDERBUFFER_BINDING : 0x8CA7,\n MAX_RENDERBUFFER_SIZE : 0x84E8,\n\n INVALID_FRAMEBUFFER_OPERATION : 0x0506,\n\n /* WebGL-specific enums */\n UNPACK_FLIP_Y_WEBGL : 0x9240,\n UNPACK_PREMULTIPLY_ALPHA_WEBGL : 0x9241,\n CONTEXT_LOST_WEBGL : 0x9242,\n UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243,\n BROWSER_DEFAULT_WEBGL : 0x9244,\n};\n","function get(options) {\n\n var xhr = new XMLHttpRequest();\n\n xhr.open('get', options.url);\n // With response type set browser can get and put binary data\n // https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Sending_and_Receiving_Binary_Data\n // Default is text, and it can be set\n // arraybuffer, blob, document, json, text\n xhr.responseType = options.responseType || 'text';\n\n if (options.onprogress) {\n //https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest\n xhr.onprogress = function(e) {\n if (e.lengthComputable) {\n var percent = e.loaded / e.total;\n options.onprogress(percent, e.loaded, e.total);\n }\n else {\n options.onprogress(null);\n }\n };\n }\n xhr.onload = function(e) {\n if (xhr.status >= 400) {\n options.onerror && options.onerror();\n }\n else {\n options.onload && options.onload(xhr.response);\n }\n };\n if (options.onerror) {\n xhr.onerror = options.onerror;\n }\n xhr.send(null);\n}\n\nexport default {\n get: get\n};\n","import request from './request';\n\nvar supportWebGL;\n\nvar vendor = {};\n\n/**\n * If support WebGL\n * @return {boolean}\n */\nvendor.supportWebGL = function () {\n if (supportWebGL == null) {\n try {\n var canvas = document.createElement('canvas');\n var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');\n if (!gl) {\n throw new Error();\n }\n }\n catch (e) {\n supportWebGL = false;\n }\n\n }\n return supportWebGL;\n};\n\nvendor.Int8Array = typeof Int8Array === 'undefined' ? Array : Int8Array;\n\nvendor.Uint8Array = typeof Uint8Array === 'undefined' ? Array : Uint8Array;\n\nvendor.Uint16Array = typeof Uint16Array === 'undefined' ? Array : Uint16Array;\n\nvendor.Uint32Array = typeof Uint32Array === 'undefined' ? Array : Uint32Array;\n\nvendor.Int16Array = typeof Int16Array === 'undefined' ? Array : Int16Array;\n\nvendor.Float32Array = typeof Float32Array === 'undefined' ? Array : Float32Array;\n\nvendor.Float64Array = typeof Float64Array === 'undefined' ? Array : Float64Array;\n\nvar g = {};\nif (typeof window !== 'undefined') {\n g = window;\n}\nelse if (typeof global !== 'undefined') {\n g = global;\n}\n\n\nvendor.requestAnimationFrame = g.requestAnimationFrame\n || g.msRequestAnimationFrame\n || g.mozRequestAnimationFrame\n || g.webkitRequestAnimationFrame\n || function (func){ setTimeout(func, 16); };\n\nvendor.createCanvas = function () {\n return document.createElement('canvas');\n};\n\nvendor.createImage = function () {\n return new g.Image();\n};\n\nvendor.request = {\n get: request.get\n};\n\nvendor.addEventListener = function (dom, type, func, useCapture) {\n dom.addEventListener(type, func, useCapture);\n};\n\nvendor.removeEventListener = function (dom, type, func) {\n dom.removeEventListener(type, func);\n};\n\nexport default vendor;\n","/**\n * Simple double linked list. Compared with array, it has O(1) remove operation.\n * @constructor\n * @alias clay.core.LinkedList\n */\nvar LinkedList = function () {\n\n /**\n * @type {clay.core.LinkedList.Entry}\n */\n this.head = null;\n\n /**\n * @type {clay.core.LinkedList.Entry}\n */\n this.tail = null;\n\n this._length = 0;\n};\n\n/**\n * Insert a new value at the tail\n * @param {} val\n * @return {clay.core.LinkedList.Entry}\n */\nLinkedList.prototype.insert = function (val) {\n var entry = new LinkedList.Entry(val);\n this.insertEntry(entry);\n return entry;\n};\n\n/**\n * Insert a new value at idx\n * @param {number} idx\n * @param {} val\n * @return {clay.core.LinkedList.Entry}\n */\nLinkedList.prototype.insertAt = function (idx, val) {\n if (idx < 0) {\n return;\n }\n var next = this.head;\n var cursor = 0;\n while (next && cursor != idx) {\n next = next.next;\n cursor++;\n }\n if (next) {\n var entry = new LinkedList.Entry(val);\n var prev = next.prev;\n if (!prev) { //next is head\n this.head = entry;\n }\n else {\n prev.next = entry;\n entry.prev = prev;\n }\n entry.next = next;\n next.prev = entry;\n }\n else {\n this.insert(val);\n }\n};\n\nLinkedList.prototype.insertBeforeEntry = function (val, next) {\n var entry = new LinkedList.Entry(val);\n var prev = next.prev;\n if (!prev) { //next is head\n this.head = entry;\n }\n else {\n prev.next = entry;\n entry.prev = prev;\n }\n entry.next = next;\n next.prev = entry;\n\n this._length++;\n};\n\n/**\n * Insert an entry at the tail\n * @param {clay.core.LinkedList.Entry} entry\n */\nLinkedList.prototype.insertEntry = function (entry) {\n if (!this.head) {\n this.head = this.tail = entry;\n }\n else {\n this.tail.next = entry;\n entry.prev = this.tail;\n this.tail = entry;\n }\n this._length++;\n};\n\n/**\n * Remove entry.\n * @param {clay.core.LinkedList.Entry} entry\n */\nLinkedList.prototype.remove = function (entry) {\n var prev = entry.prev;\n var next = entry.next;\n if (prev) {\n prev.next = next;\n }\n else {\n // Is head\n this.head = next;\n }\n if (next) {\n next.prev = prev;\n }\n else {\n // Is tail\n this.tail = prev;\n }\n entry.next = entry.prev = null;\n this._length--;\n};\n\n/**\n * Remove entry at index.\n * @param {number} idx\n * @return {}\n */\nLinkedList.prototype.removeAt = function (idx) {\n if (idx < 0) {\n return;\n }\n var curr = this.head;\n var cursor = 0;\n while (curr && cursor != idx) {\n curr = curr.next;\n cursor++;\n }\n if (curr) {\n this.remove(curr);\n return curr.value;\n }\n};\n/**\n * Get head value\n * @return {}\n */\nLinkedList.prototype.getHead = function () {\n if (this.head) {\n return this.head.value;\n }\n};\n/**\n * Get tail value\n * @return {}\n */\nLinkedList.prototype.getTail = function () {\n if (this.tail) {\n return this.tail.value;\n }\n};\n/**\n * Get value at idx\n * @param {number} idx\n * @return {}\n */\nLinkedList.prototype.getAt = function (idx) {\n if (idx < 0) {\n return;\n }\n var curr = this.head;\n var cursor = 0;\n while (curr && cursor != idx) {\n curr = curr.next;\n cursor++;\n }\n return curr.value;\n};\n\n/**\n * @param {} value\n * @return {number}\n */\nLinkedList.prototype.indexOf = function (value) {\n var curr = this.head;\n var cursor = 0;\n while (curr) {\n if (curr.value === value) {\n return cursor;\n }\n curr = curr.next;\n cursor++;\n }\n};\n\n/**\n * @return {number}\n */\nLinkedList.prototype.length = function () {\n return this._length;\n};\n\n/**\n * If list is empty\n */\nLinkedList.prototype.isEmpty = function () {\n return this._length === 0;\n};\n\n/**\n * @param {Function} cb\n * @param {} context\n */\nLinkedList.prototype.forEach = function (cb, context) {\n var curr = this.head;\n var idx = 0;\n var haveContext = typeof(context) != 'undefined';\n while (curr) {\n if (haveContext) {\n cb.call(context, curr.value, idx);\n }\n else {\n cb(curr.value, idx);\n }\n curr = curr.next;\n idx++;\n }\n};\n\n/**\n * Clear the list\n */\nLinkedList.prototype.clear = function () {\n this.tail = this.head = null;\n this._length = 0;\n};\n\n/**\n * @constructor\n * @param {} val\n */\nLinkedList.Entry = function (val) {\n /**\n * @type {}\n */\n this.value = val;\n\n /**\n * @type {clay.core.LinkedList.Entry}\n */\n this.next = null;\n\n /**\n * @type {clay.core.LinkedList.Entry}\n */\n this.prev = null;\n};\n\nexport default LinkedList;\n","import LinkedList from './LinkedList';\n\n/**\n * LRU Cache\n * @constructor\n * @alias clay.core.LRU\n */\nvar LRU = function (maxSize) {\n\n this._list = new LinkedList();\n\n this._map = {};\n\n this._maxSize = maxSize || 10;\n};\n\n/**\n * Set cache max size\n * @param {number} size\n */\nLRU.prototype.setMaxSize = function (size) {\n this._maxSize = size;\n};\n\n/**\n * @param {string} key\n * @param {} value\n */\nLRU.prototype.put = function (key, value) {\n if (!this._map.hasOwnProperty(key)) {\n var len = this._list.length();\n if (len >= this._maxSize && len > 0) {\n // Remove the least recently used\n var leastUsedEntry = this._list.head;\n this._list.remove(leastUsedEntry);\n delete this._map[leastUsedEntry.key];\n }\n\n var entry = this._list.insert(value);\n entry.key = key;\n this._map[key] = entry;\n }\n};\n\n/**\n * @param {string} key\n * @return {}\n */\nLRU.prototype.get = function (key) {\n var entry = this._map[key];\n if (this._map.hasOwnProperty(key)) {\n // Put the latest used entry in the tail\n if (entry !== this._list.tail) {\n this._list.remove(entry);\n this._list.insertEntry(entry);\n }\n\n return entry.value;\n }\n};\n\n/**\n * @param {string} key\n */\nLRU.prototype.remove = function (key) {\n var entry = this._map[key];\n if (typeof(entry) !== 'undefined') {\n delete this._map[key];\n this._list.remove(entry);\n }\n};\n\n/**\n * Clear the cache\n */\nLRU.prototype.clear = function () {\n this._list.clear();\n this._map = {};\n};\n\nexport default LRU;\n","/**\n * @namespace clay.core.color\n */\nimport LRU from '../core/LRU';\n\nvar colorUtil = {};\n\nvar kCSSColorTable = {\n 'transparent': [0,0,0,0], 'aliceblue': [240,248,255,1],\n 'antiquewhite': [250,235,215,1], 'aqua': [0,255,255,1],\n 'aquamarine': [127,255,212,1], 'azure': [240,255,255,1],\n 'beige': [245,245,220,1], 'bisque': [255,228,196,1],\n 'black': [0,0,0,1], 'blanchedalmond': [255,235,205,1],\n 'blue': [0,0,255,1], 'blueviolet': [138,43,226,1],\n 'brown': [165,42,42,1], 'burlywood': [222,184,135,1],\n 'cadetblue': [95,158,160,1], 'chartreuse': [127,255,0,1],\n 'chocolate': [210,105,30,1], 'coral': [255,127,80,1],\n 'cornflowerblue': [100,149,237,1], 'cornsilk': [255,248,220,1],\n 'crimson': [220,20,60,1], 'cyan': [0,255,255,1],\n 'darkblue': [0,0,139,1], 'darkcyan': [0,139,139,1],\n 'darkgoldenrod': [184,134,11,1], 'darkgray': [169,169,169,1],\n 'darkgreen': [0,100,0,1], 'darkgrey': [169,169,169,1],\n 'darkkhaki': [189,183,107,1], 'darkmagenta': [139,0,139,1],\n 'darkolivegreen': [85,107,47,1], 'darkorange': [255,140,0,1],\n 'darkorchid': [153,50,204,1], 'darkred': [139,0,0,1],\n 'darksalmon': [233,150,122,1], 'darkseagreen': [143,188,143,1],\n 'darkslateblue': [72,61,139,1], 'darkslategray': [47,79,79,1],\n 'darkslategrey': [47,79,79,1], 'darkturquoise': [0,206,209,1],\n 'darkviolet': [148,0,211,1], 'deeppink': [255,20,147,1],\n 'deepskyblue': [0,191,255,1], 'dimgray': [105,105,105,1],\n 'dimgrey': [105,105,105,1], 'dodgerblue': [30,144,255,1],\n 'firebrick': [178,34,34,1], 'floralwhite': [255,250,240,1],\n 'forestgreen': [34,139,34,1], 'fuchsia': [255,0,255,1],\n 'gainsboro': [220,220,220,1], 'ghostwhite': [248,248,255,1],\n 'gold': [255,215,0,1], 'goldenrod': [218,165,32,1],\n 'gray': [128,128,128,1], 'green': [0,128,0,1],\n 'greenyellow': [173,255,47,1], 'grey': [128,128,128,1],\n 'honeydew': [240,255,240,1], 'hotpink': [255,105,180,1],\n 'indianred': [205,92,92,1], 'indigo': [75,0,130,1],\n 'ivory': [255,255,240,1], 'khaki': [240,230,140,1],\n 'lavender': [230,230,250,1], 'lavenderblush': [255,240,245,1],\n 'lawngreen': [124,252,0,1], 'lemonchiffon': [255,250,205,1],\n 'lightblue': [173,216,230,1], 'lightcoral': [240,128,128,1],\n 'lightcyan': [224,255,255,1], 'lightgoldenrodyellow': [250,250,210,1],\n 'lightgray': [211,211,211,1], 'lightgreen': [144,238,144,1],\n 'lightgrey': [211,211,211,1], 'lightpink': [255,182,193,1],\n 'lightsalmon': [255,160,122,1], 'lightseagreen': [32,178,170,1],\n 'lightskyblue': [135,206,250,1], 'lightslategray': [119,136,153,1],\n 'lightslategrey': [119,136,153,1], 'lightsteelblue': [176,196,222,1],\n 'lightyellow': [255,255,224,1], 'lime': [0,255,0,1],\n 'limegreen': [50,205,50,1], 'linen': [250,240,230,1],\n 'magenta': [255,0,255,1], 'maroon': [128,0,0,1],\n 'mediumaquamarine': [102,205,170,1], 'mediumblue': [0,0,205,1],\n 'mediumorchid': [186,85,211,1], 'mediumpurple': [147,112,219,1],\n 'mediumseagreen': [60,179,113,1], 'mediumslateblue': [123,104,238,1],\n 'mediumspringgreen': [0,250,154,1], 'mediumturquoise': [72,209,204,1],\n 'mediumvioletred': [199,21,133,1], 'midnightblue': [25,25,112,1],\n 'mintcream': [245,255,250,1], 'mistyrose': [255,228,225,1],\n 'moccasin': [255,228,181,1], 'navajowhite': [255,222,173,1],\n 'navy': [0,0,128,1], 'oldlace': [253,245,230,1],\n 'olive': [128,128,0,1], 'olivedrab': [107,142,35,1],\n 'orange': [255,165,0,1], 'orangered': [255,69,0,1],\n 'orchid': [218,112,214,1], 'palegoldenrod': [238,232,170,1],\n 'palegreen': [152,251,152,1], 'paleturquoise': [175,238,238,1],\n 'palevioletred': [219,112,147,1], 'papayawhip': [255,239,213,1],\n 'peachpuff': [255,218,185,1], 'peru': [205,133,63,1],\n 'pink': [255,192,203,1], 'plum': [221,160,221,1],\n 'powderblue': [176,224,230,1], 'purple': [128,0,128,1],\n 'red': [255,0,0,1], 'rosybrown': [188,143,143,1],\n 'royalblue': [65,105,225,1], 'saddlebrown': [139,69,19,1],\n 'salmon': [250,128,114,1], 'sandybrown': [244,164,96,1],\n 'seagreen': [46,139,87,1], 'seashell': [255,245,238,1],\n 'sienna': [160,82,45,1], 'silver': [192,192,192,1],\n 'skyblue': [135,206,235,1], 'slateblue': [106,90,205,1],\n 'slategray': [112,128,144,1], 'slategrey': [112,128,144,1],\n 'snow': [255,250,250,1], 'springgreen': [0,255,127,1],\n 'steelblue': [70,130,180,1], 'tan': [210,180,140,1],\n 'teal': [0,128,128,1], 'thistle': [216,191,216,1],\n 'tomato': [255,99,71,1], 'turquoise': [64,224,208,1],\n 'violet': [238,130,238,1], 'wheat': [245,222,179,1],\n 'white': [255,255,255,1], 'whitesmoke': [245,245,245,1],\n 'yellow': [255,255,0,1], 'yellowgreen': [154,205,50,1]\n};\n\nfunction clampCssByte(i) { // Clamp to integer 0 .. 255.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\n\nfunction clampCssAngle(i) { // Clamp to integer 0 .. 360.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 360 ? 360 : i;\n}\n\nfunction clampCssFloat(f) { // Clamp to float 0.0 .. 1.0.\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\n\nfunction parseCssInt(str) { // int or percentage.\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssByte(parseFloat(str) / 100 * 255);\n }\n return clampCssByte(parseInt(str, 10));\n}\n\nfunction parseCssFloat(str) { // float or percentage.\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssFloat(parseFloat(str) / 100);\n }\n return clampCssFloat(parseFloat(str));\n}\n\nfunction cssHueToRgb(m1, m2, h) {\n if (h < 0) {\n h += 1;\n }\n else if (h > 1) {\n h -= 1;\n }\n\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n if (h * 2 < 1) {\n return m2;\n }\n if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2/3 - h) * 6;\n }\n return m1;\n}\n\nfunction lerpNumber(a, b, p) {\n return a + (b - a) * p;\n}\n\nfunction setRgba(out, r, g, b, a) {\n out[0] = r; out[1] = g; out[2] = b; out[3] = a;\n return out;\n}\nfunction copyRgba(out, a) {\n out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3];\n return out;\n}\n\nvar colorCache = new LRU(20);\nvar lastRemovedArr = null;\n\nfunction putToCache(colorStr, rgbaArr) {\n // Reuse removed array\n if (lastRemovedArr) {\n copyRgba(lastRemovedArr, rgbaArr);\n }\n lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice()));\n}\n\n/**\n * @name clay.core.color.parse\n * @param {string} colorStr\n * @param {Array.} out\n * @return {Array.}\n */\ncolorUtil.parse = function (colorStr, rgbaArr) {\n if (!colorStr) {\n return;\n }\n rgbaArr = rgbaArr || [];\n\n var cached = colorCache.get(colorStr);\n if (cached) {\n return copyRgba(rgbaArr, cached);\n }\n\n // colorStr may be not string\n colorStr = colorStr + '';\n // Remove all whitespace, not compliant, but should just be more accepting.\n var str = colorStr.replace(/ /g, '').toLowerCase();\n\n // Color keywords (and transparent) lookup.\n if (str in kCSSColorTable) {\n copyRgba(rgbaArr, kCSSColorTable[str]);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n\n // #abc and #abc123 syntax.\n if (str.charAt(0) === '#') {\n if (str.length === 4) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xfff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return; // Covers NaN.\n }\n setRgba(rgbaArr,\n ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),\n (iv & 0xf0) | ((iv & 0xf0) >> 4),\n (iv & 0xf) | ((iv & 0xf) << 4),\n 1\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n else if (str.length === 7) {\n var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xffffff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return; // Covers NaN.\n }\n setRgba(rgbaArr,\n (iv & 0xff0000) >> 16,\n (iv & 0xff00) >> 8,\n iv & 0xff,\n 1\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n\n return;\n }\n var op = str.indexOf('('), ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === str.length) {\n var fname = str.substr(0, op);\n var params = str.substr(op + 1, ep - (op + 1)).split(',');\n var alpha = 1; // To allow case fallthrough.\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n alpha = parseCssFloat(params.pop()); // jshint ignore:line\n // Fall through.\n case 'rgb':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n setRgba(rgbaArr,\n parseCssInt(params[0]),\n parseCssInt(params[1]),\n parseCssInt(params[2]),\n alpha\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsla':\n if (params.length !== 4) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n params[3] = parseCssFloat(params[3]);\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsl':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n default:\n return;\n }\n }\n\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n};\n\ncolorUtil.parseToFloat = function (colorStr, rgbaArr) {\n rgbaArr = colorUtil.parse(colorStr, rgbaArr);\n if (!rgbaArr) {\n return;\n }\n rgbaArr[0] /= 255;\n rgbaArr[1] /= 255;\n rgbaArr[2] /= 255;\n return rgbaArr;\n}\n\n/**\n * @name clay.core.color.hsla2rgba\n * @param {Array.} hsla\n * @param {Array.} rgba\n * @return {Array.} rgba\n */\nfunction hsla2rgba(hsla, rgba) {\n var h = (((parseFloat(hsla[0]) % 360) + 360) % 360) / 360; // 0 .. 1\n // NOTE(deanm): According to the CSS spec s/l should only be\n // percentages, but we don't bother and let float or percentage.\n var s = parseCssFloat(hsla[1]);\n var l = parseCssFloat(hsla[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n\n rgba = rgba || [];\n setRgba(rgba,\n clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255),\n clampCssByte(cssHueToRgb(m1, m2, h) * 255),\n clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255),\n 1\n );\n\n if (hsla.length === 4) {\n rgba[3] = hsla[3];\n }\n\n return rgba;\n}\n\n/**\n * @name clay.core.color.rgba2hsla\n * @param {Array.} rgba\n * @return {Array.} hsla\n */\nfunction rgba2hsla(rgba) {\n if (!rgba) {\n return;\n }\n\n // RGB from 0 to 255\n var R = rgba[0] / 255;\n var G = rgba[1] / 255;\n var B = rgba[2] / 255;\n\n var vMin = Math.min(R, G, B); // Min. value of RGB\n var vMax = Math.max(R, G, B); // Max. value of RGB\n var delta = vMax - vMin; // Delta RGB value\n\n var L = (vMax + vMin) / 2;\n var H;\n var S;\n // HSL results from 0 to 1\n if (delta === 0) {\n H = 0;\n S = 0;\n }\n else {\n if (L < 0.5) {\n S = delta / (vMax + vMin);\n }\n else {\n S = delta / (2 - vMax - vMin);\n }\n\n var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;\n var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;\n var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;\n\n if (R === vMax) {\n H = deltaB - deltaG;\n }\n else if (G === vMax) {\n H = (1 / 3) + deltaR - deltaB;\n }\n else if (B === vMax) {\n H = (2 / 3) + deltaG - deltaR;\n }\n\n if (H < 0) {\n H += 1;\n }\n\n if (H > 1) {\n H -= 1;\n }\n }\n\n var hsla = [H * 360, S, L];\n\n if (rgba[3] != null) {\n hsla.push(rgba[3]);\n }\n\n return hsla;\n}\n\n/**\n * @name clay.core.color.lift\n * @param {string} color\n * @param {number} level\n * @return {string}\n */\ncolorUtil.lift = function (color, level) {\n var colorArr = colorUtil.parse(color);\n if (colorArr) {\n for (var i = 0; i < 3; i++) {\n if (level < 0) {\n colorArr[i] = colorArr[i] * (1 - level) | 0;\n }\n else {\n colorArr[i] = ((255 - colorArr[i]) * level + colorArr[i]) | 0;\n }\n }\n return colorUtil.stringify(colorArr, colorArr.length === 4 ? 'rgba' : 'rgb');\n }\n}\n\n/**\n * @name clay.core.color.toHex\n * @param {string} color\n * @return {string}\n */\ncolorUtil.toHex = function (color) {\n var colorArr = colorUtil.parse(color);\n if (colorArr) {\n return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + (+colorArr[2])).toString(16).slice(1);\n }\n};\n\n/**\n * Map value to color. Faster than lerp methods because color is represented by rgba array.\n * @name clay.core.color\n * @param {number} normalizedValue A float between 0 and 1.\n * @param {Array.>} colors List of rgba color array\n * @param {Array.} [out] Mapped gba color array\n * @return {Array.} will be null/undefined if input illegal.\n */\ncolorUtil.fastLerp = function (normalizedValue, colors, out) {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)\n ) {\n return;\n }\n\n out = out || [];\n\n var value = normalizedValue * (colors.length - 1);\n var leftIndex = Math.floor(value);\n var rightIndex = Math.ceil(value);\n var leftColor = colors[leftIndex];\n var rightColor = colors[rightIndex];\n var dv = value - leftIndex;\n out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));\n out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));\n out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));\n out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));\n\n return out;\n}\n\ncolorUtil.fastMapToColor = colorUtil.fastLerp;\n\n/**\n * @param {number} normalizedValue A float between 0 and 1.\n * @param {Array.} colors Color list.\n * @param {boolean=} fullOutput Default false.\n * @return {(string|Object)} Result color. If fullOutput,\n * return {color: ..., leftIndex: ..., rightIndex: ..., value: ...},\n */\ncolorUtil.lerp = function (normalizedValue, colors, fullOutput) {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)\n ) {\n return;\n }\n\n var value = normalizedValue * (colors.length - 1);\n var leftIndex = Math.floor(value);\n var rightIndex = Math.ceil(value);\n var leftColor = colorUtil.parse(colors[leftIndex]);\n var rightColor = colorUtil.parse(colors[rightIndex]);\n var dv = value - leftIndex;\n\n var color = colorUtil.stringify(\n [\n clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)),\n clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)),\n clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)),\n clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))\n ],\n 'rgba'\n );\n\n return fullOutput\n ? {\n color: color,\n leftIndex: leftIndex,\n rightIndex: rightIndex,\n value: value\n }\n : color;\n}\n\n/**\n * @deprecated\n */\ncolorUtil.mapToColor = colorUtil.lerp;\n\n/**\n * @name clay.core.color\n * @param {string} color\n * @param {number=} h 0 ~ 360, ignore when null.\n * @param {number=} s 0 ~ 1, ignore when null.\n * @param {number=} l 0 ~ 1, ignore when null.\n * @return {string} Color string in rgba format.\n */\ncolorUtil.modifyHSL = function (color, h, s, l) {\n color = colorUtil.parse(color);\n\n if (color) {\n color = rgba2hsla(color);\n h != null && (color[0] = clampCssAngle(h));\n s != null && (color[1] = parseCssFloat(s));\n l != null && (color[2] = parseCssFloat(l));\n\n return colorUtil.stringify(hsla2rgba(color), 'rgba');\n }\n}\n\n/**\n * @param {string} color\n * @param {number=} alpha 0 ~ 1\n * @return {string} Color string in rgba format.\n */\ncolorUtil.modifyAlpha = function (color, alpha) {\n color = colorUtil.parse(color);\n\n if (color && alpha != null) {\n color[3] = clampCssFloat(alpha);\n return colorUtil.stringify(color, 'rgba');\n }\n}\n\n/**\n * @param {Array.} arrColor like [12,33,44,0.4]\n * @param {string} type 'rgba', 'hsva', ...\n * @return {string} Result color. (If input illegal, return undefined).\n */\ncolorUtil.stringify = function (arrColor, type) {\n if (!arrColor || !arrColor.length) {\n return;\n }\n var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2];\n if (type === 'rgba' || type === 'hsva' || type === 'hsla') {\n colorStr += ',' + arrColor[3];\n }\n return type + '(' + colorStr + ')';\n};\n\n\n\nexport default colorUtil;","import Base from './core/Base';\nimport util from './core/util';\nimport colorUtil from './core/color';\nvar parseColor = colorUtil.parseToFloat;\n\nvar programKeyCache = {};\n\nfunction getDefineCode(defines) {\n var defineKeys = Object.keys(defines);\n defineKeys.sort();\n var defineStr = [];\n // Custom Defines\n for (var i = 0; i < defineKeys.length; i++) {\n var key = defineKeys[i];\n var value = defines[key];\n if (value === null) {\n defineStr.push(key);\n }\n else{\n defineStr.push(key + ' ' + value.toString());\n }\n }\n return defineStr.join('\\n');\n}\n\nfunction getProgramKey(vertexDefines, fragmentDefines, enabledTextures) {\n enabledTextures.sort();\n var defineStr = [];\n for (var i = 0; i < enabledTextures.length; i++) {\n var symbol = enabledTextures[i];\n defineStr.push(symbol);\n }\n var key = getDefineCode(vertexDefines) + '\\n'\n + getDefineCode(fragmentDefines) + '\\n'\n + defineStr.join('\\n');\n\n if (programKeyCache[key]) {\n return programKeyCache[key];\n }\n\n var id = util.genGUID();\n programKeyCache[key] = id;\n return id;\n}\n\n/**\n * Material defines the appearance of mesh surface, like `color`, `roughness`, `metalness`, etc.\n * It contains a {@link clay.Shader} and corresponding uniforms.\n *\n * Here is a basic example to create a standard material\n```js\nvar material = new clay.Material({\n shader: new clay.Shader(\n clay.Shader.source('clay.vertex'),\n clay.Shader.source('clay.fragment')\n )\n});\n```\n * @constructor clay.Material\n * @extends clay.core.Base\n */\nvar Material = Base.extend(function () {\n return /** @lends clay.Material# */ {\n /**\n * @type {string}\n */\n name: '',\n\n /**\n * @type {Object}\n */\n // uniforms: null,\n\n /**\n * @type {clay.Shader}\n */\n // shader: null,\n\n /**\n * @type {boolean}\n */\n depthTest: true,\n\n /**\n * @type {boolean}\n */\n depthMask: true,\n\n /**\n * @type {boolean}\n */\n transparent: false,\n /**\n * Blend func is a callback function when the material\n * have custom blending\n * The gl context will be the only argument passed in tho the\n * blend function\n * Detail of blend function in WebGL:\n * http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf\n *\n * Example :\n * function(_gl) {\n * _gl.blendEquation(_gl.FUNC_ADD);\n * _gl.blendFunc(_gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA);\n * }\n */\n blend: null,\n\n /**\n * If update texture status automatically.\n */\n autoUpdateTextureStatus: true,\n\n uniforms: {},\n vertexDefines: {},\n fragmentDefines: {},\n _textureStatus: {},\n\n // shadowTransparentMap : null\n\n // PENDING enable the uniform that only used in shader.\n _enabledUniforms: null,\n };\n}, function () {\n if (!this.name) {\n this.name = 'MATERIAL_' + this.__uid__;\n }\n\n if (this.shader) {\n // Keep status, mainly preset uniforms, vertexDefines and fragmentDefines\n this.attachShader(this.shader, true);\n }\n},\n/** @lends clay.Material.prototype */\n{\n precision: 'highp',\n\n /**\n * Set material uniform\n * @example\n * mat.setUniform('color', [1, 1, 1, 1]);\n * @param {string} symbol\n * @param {number|array|clay.Texture|ArrayBufferView} value\n */\n setUniform: function (symbol, value) {\n if (value === undefined) {\n console.warn('Uniform value \"' + symbol + '\" is undefined');\n }\n var uniform = this.uniforms[symbol];\n if (uniform) {\n\n if (typeof value === 'string') {\n // Try to parse as a color. Invalid color string will return null.\n value = parseColor(value) || value;\n }\n\n uniform.value = value;\n\n if (this.autoUpdateTextureStatus && uniform.type === 't') {\n if (value) {\n this.enableTexture(symbol);\n }\n else {\n this.disableTexture(symbol);\n }\n }\n }\n },\n\n /**\n * @param {Object} obj\n */\n setUniforms: function(obj) {\n for (var key in obj) {\n var val = obj[key];\n this.setUniform(key, val);\n }\n },\n\n /**\n * @param {string} symbol\n * @return {boolean}\n */\n isUniformEnabled: function (symbol) {\n return this._enabledUniforms.indexOf(symbol) >= 0;\n },\n\n getEnabledUniforms: function () {\n return this._enabledUniforms;\n },\n getTextureUniforms: function () {\n return this._textureUniforms;\n },\n\n /**\n * Alias of setUniform and setUniforms\n * @param {object|string} symbol\n * @param {number|array|clay.Texture|ArrayBufferView} [value]\n */\n set: function (symbol, value) {\n if (typeof(symbol) === 'object') {\n for (var key in symbol) {\n var val = symbol[key];\n this.setUniform(key, val);\n }\n }\n else {\n this.setUniform(symbol, value);\n }\n },\n /**\n * Get uniform value\n * @param {string} symbol\n * @return {number|array|clay.Texture|ArrayBufferView}\n */\n get: function (symbol) {\n var uniform = this.uniforms[symbol];\n if (uniform) {\n return uniform.value;\n }\n },\n /**\n * Attach a shader instance\n * @param {clay.Shader} shader\n * @param {boolean} keepStatus If try to keep uniform and texture\n */\n attachShader: function(shader, keepStatus) {\n var originalUniforms = this.uniforms;\n\n // Ignore if uniform can use in shader.\n this.uniforms = shader.createUniforms();\n this.shader = shader;\n\n var uniforms = this.uniforms;\n this._enabledUniforms = Object.keys(uniforms);\n // Make sure uniforms are set in same order to avoid texture slot wrong\n this._enabledUniforms.sort();\n this._textureUniforms = this._enabledUniforms.filter(function (uniformName) {\n var type = this.uniforms[uniformName].type;\n return type === 't' || type === 'tv';\n }, this);\n\n var originalVertexDefines = this.vertexDefines;\n var originalFragmentDefines = this.fragmentDefines;\n\n this.vertexDefines = util.clone(shader.vertexDefines);\n this.fragmentDefines = util.clone(shader.fragmentDefines);\n\n if (keepStatus) {\n for (var symbol in originalUniforms) {\n if (uniforms[symbol]) {\n uniforms[symbol].value = originalUniforms[symbol].value;\n }\n }\n\n util.defaults(this.vertexDefines, originalVertexDefines);\n util.defaults(this.fragmentDefines, originalFragmentDefines);\n }\n\n var textureStatus = {};\n for (var key in shader.textures) {\n textureStatus[key] = {\n shaderType: shader.textures[key].shaderType,\n type: shader.textures[key].type,\n enabled: (keepStatus && this._textureStatus[key]) ? this._textureStatus[key].enabled : false\n };\n }\n\n this._textureStatus = textureStatus;\n\n this._programKey = '';\n },\n\n /**\n * Clone a new material and keep uniforms, shader will not be cloned\n * @return {clay.Material}\n */\n clone: function () {\n var material = new this.constructor({\n name: this.name,\n shader: this.shader\n });\n for (var symbol in this.uniforms) {\n material.uniforms[symbol].value = this.uniforms[symbol].value;\n }\n material.depthTest = this.depthTest;\n material.depthMask = this.depthMask;\n material.transparent = this.transparent;\n material.blend = this.blend;\n\n material.vertexDefines = util.clone(this.vertexDefines);\n material.fragmentDefines = util.clone(this.fragmentDefines);\n material.enableTexture(this.getEnabledTextures());\n material.precision = this.precision;\n\n return material;\n },\n\n /**\n * Add a #define macro in shader code\n * @param {string} shaderType Can be vertex, fragment or both\n * @param {string} symbol\n * @param {number} [val]\n */\n define: function (shaderType, symbol, val) {\n var vertexDefines = this.vertexDefines;\n var fragmentDefines = this.fragmentDefines;\n if (shaderType !== 'vertex' && shaderType !== 'fragment' && shaderType !== 'both'\n && arguments.length < 3\n ) {\n // shaderType default to be 'both'\n val = symbol;\n symbol = shaderType;\n shaderType = 'both';\n }\n val = val != null ? val : null;\n if (shaderType === 'vertex' || shaderType === 'both') {\n if (vertexDefines[symbol] !== val) {\n vertexDefines[symbol] = val;\n // Mark as dirty\n this._programKey = '';\n }\n }\n if (shaderType === 'fragment' || shaderType === 'both') {\n if (fragmentDefines[symbol] !== val) {\n fragmentDefines[symbol] = val;\n if (shaderType !== 'both') {\n this._programKey = '';\n }\n }\n }\n },\n\n /**\n * Remove a #define macro in shader code\n * @param {string} shaderType Can be vertex, fragment or both\n * @param {string} symbol\n */\n undefine: function (shaderType, symbol) {\n if (shaderType !== 'vertex' && shaderType !== 'fragment' && shaderType !== 'both'\n && arguments.length < 2\n ) {\n // shaderType default to be 'both'\n symbol = shaderType;\n shaderType = 'both';\n }\n if (shaderType === 'vertex' || shaderType === 'both') {\n if (this.isDefined('vertex', symbol)) {\n delete this.vertexDefines[symbol];\n // Mark as dirty\n this._programKey = '';\n }\n }\n if (shaderType === 'fragment' || shaderType === 'both') {\n if (this.isDefined('fragment', symbol)) {\n delete this.fragmentDefines[symbol];\n if (shaderType !== 'both') {\n this._programKey = '';\n }\n }\n }\n },\n\n /**\n * If macro is defined in shader.\n * @param {string} shaderType Can be vertex, fragment or both\n * @param {string} symbol\n */\n isDefined: function (shaderType, symbol) {\n // PENDING hasOwnProperty ?\n switch (shaderType) {\n case 'vertex':\n return this.vertexDefines[symbol] !== undefined;\n case 'fragment':\n return this.fragmentDefines[symbol] !== undefined;\n }\n },\n /**\n * Get macro value defined in shader.\n * @param {string} shaderType Can be vertex, fragment or both\n * @param {string} symbol\n */\n getDefine: function (shaderType, symbol) {\n switch(shaderType) {\n case 'vertex':\n return this.vertexDefines[symbol];\n case 'fragment':\n return this.fragmentDefines[symbol];\n }\n },\n /**\n * Enable a texture, actually it will add a #define macro in the shader code\n * For example, if texture symbol is diffuseMap, it will add a line `#define DIFFUSEMAP_ENABLED` in the shader code\n * @param {string} symbol\n */\n enableTexture: function (symbol) {\n if (Array.isArray(symbol)) {\n for (var i = 0; i < symbol.length; i++) {\n this.enableTexture(symbol[i]);\n }\n return;\n }\n\n var status = this._textureStatus[symbol];\n if (status) {\n var isEnabled = status.enabled;\n if (!isEnabled) {\n status.enabled = true;\n this._programKey = '';\n }\n }\n },\n /**\n * Enable all textures used in the shader\n */\n enableTexturesAll: function () {\n var textureStatus = this._textureStatus;\n for (var symbol in textureStatus) {\n textureStatus[symbol].enabled = true;\n }\n\n this._programKey = '';\n },\n /**\n * Disable a texture, it remove a #define macro in the shader\n * @param {string} symbol\n */\n disableTexture: function (symbol) {\n if (Array.isArray(symbol)) {\n for (var i = 0; i < symbol.length; i++) {\n this.disableTexture(symbol[i]);\n }\n return;\n }\n\n var status = this._textureStatus[symbol];\n if (status) {\n var isDisabled = ! status.enabled;\n if (!isDisabled) {\n status.enabled = false;\n this._programKey = '';\n }\n }\n },\n /**\n * Disable all textures used in the shader\n */\n disableTexturesAll: function () {\n var textureStatus = this._textureStatus;\n for (var symbol in textureStatus) {\n textureStatus[symbol].enabled = false;\n }\n\n this._programKey = '';\n },\n /**\n * If texture of given type is enabled.\n * @param {string} symbol\n * @return {boolean}\n */\n isTextureEnabled: function (symbol) {\n var textureStatus = this._textureStatus;\n return !!textureStatus[symbol]\n && textureStatus[symbol].enabled;\n },\n\n /**\n * Get all enabled textures\n * @return {string[]}\n */\n getEnabledTextures: function () {\n var enabledTextures = [];\n var textureStatus = this._textureStatus;\n for (var symbol in textureStatus) {\n if (textureStatus[symbol].enabled) {\n enabledTextures.push(symbol);\n }\n }\n return enabledTextures;\n },\n\n /**\n * Mark defines are updated.\n */\n dirtyDefines: function () {\n this._programKey = '';\n },\n\n getProgramKey: function () {\n if (!this._programKey) {\n this._programKey = getProgramKey(\n this.vertexDefines, this.fragmentDefines, this.getEnabledTextures()\n );\n }\n return this._programKey;\n }\n});\n\nexport default Material;\n","\nexport var GLMAT_EPSILON = 0.000001;\n\n// Use Array instead of Float32Array. It seems to be much faster and higher precision.\nexport var GLMAT_ARRAY_TYPE = Array;\n// if(!GLMAT_ARRAY_TYPE) {\n// GLMAT_ARRAY_TYPE = (typeof Float32Array !== 'undefined') ? Float32Array : Array;\n// }\n\nexport var GLMAT_RANDOM = Math.random;\n","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 2 Dimensional Vector\n * @name vec2\n */\n\nvar vec2 = {};\n\n/**\n * Creates a new, empty vec2\n *\n * @returns {vec2} a new 2D vector\n */\nvec2.create = function() {\n var out = new GLMAT_ARRAY_TYPE(2);\n out[0] = 0;\n out[1] = 0;\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with values from an existing vector\n *\n * @param {vec2} a vector to clone\n * @returns {vec2} a new 2D vector\n */\nvec2.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(2);\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Creates a new vec2 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} a new 2D vector\n */\nvec2.fromValues = function(x, y) {\n var out = new GLMAT_ARRAY_TYPE(2);\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Copy the values from one vec2 to another\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the source vector\n * @returns {vec2} out\n */\nvec2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n};\n\n/**\n * Set the components of a vec2 to the given values\n *\n * @param {vec2} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @returns {vec2} out\n */\nvec2.set = function(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n};\n\n/**\n * Adds two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.subtract}\n * @function\n */\nvec2.sub = vec2.subtract;\n\n/**\n * Multiplies two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.multiply}\n * @function\n */\nvec2.mul = vec2.multiply;\n\n/**\n * Divides two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n return out;\n};\n\n/**\n * Alias for {@link vec2.divide}\n * @function\n */\nvec2.div = vec2.divide;\n\n/**\n * Returns the minimum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec2} out\n */\nvec2.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n return out;\n};\n\n/**\n * Scales a vec2 by a scalar number\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec2} out\n */\nvec2.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n};\n\n/**\n * Adds two vec2's after scaling the second operand by a scalar value\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec2} out\n */\nvec2.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} distance between a and b\n */\nvec2.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.distance}\n * @function\n */\nvec2.dist = vec2.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec2.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredDistance}\n * @function\n */\nvec2.sqrDist = vec2.squaredDistance;\n\n/**\n * Calculates the length of a vec2\n *\n * @param {vec2} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec2.length = function (a) {\n var x = a[0],\n y = a[1];\n return Math.sqrt(x*x + y*y);\n};\n\n/**\n * Alias for {@link vec2.length}\n * @function\n */\nvec2.len = vec2.length;\n\n/**\n * Calculates the squared length of a vec2\n *\n * @param {vec2} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec2.squaredLength = function (a) {\n var x = a[0],\n y = a[1];\n return x*x + y*y;\n};\n\n/**\n * Alias for {@link vec2.squaredLength}\n * @function\n */\nvec2.sqrLen = vec2.squaredLength;\n\n/**\n * Negates the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to negate\n * @returns {vec2} out\n */\nvec2.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to invert\n * @returns {vec2} out\n */\nvec2.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n return out;\n};\n\n/**\n * Normalize a vec2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a vector to normalize\n * @returns {vec2} out\n */\nvec2.normalize = function(out, a) {\n var x = a[0],\n y = a[1];\n var len = x*x + y*y;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec2's\n *\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec2.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1];\n};\n\n/**\n * Computes the cross product of two vec2's\n * Note that the cross product must by definition produce a 3D vector\n *\n * @param {vec3} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @returns {vec3} out\n */\nvec2.cross = function(out, a, b) {\n var z = a[0] * b[1] - a[1] * b[0];\n out[0] = out[1] = 0;\n out[2] = z;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec2's\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the first operand\n * @param {vec2} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec2} out\n */\nvec2.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec2} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec2} out\n */\nvec2.random = function (out, scale) {\n scale = scale || 1.0;\n var r = GLMAT_RANDOM() * 2.0 * Math.PI;\n out[0] = Math.cos(r) * scale;\n out[1] = Math.sin(r) * scale;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y;\n out[1] = m[1] * x + m[3] * y;\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat2d\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat2d} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat2d = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat3\n * 3rd vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat3} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat3 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[3] * y + m[6];\n out[1] = m[1] * x + m[4] * y + m[7];\n return out;\n};\n\n/**\n * Transforms the vec2 with a mat4\n * 3rd vector component is implicitly '0'\n * 4th vector component is implicitly '1'\n *\n * @param {vec2} out the receiving vector\n * @param {vec2} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec2} out\n */\nvec2.transformMat4 = function(out, a, m) {\n var x = a[0],\n y = a[1];\n out[0] = m[0] * x + m[4] * y + m[12];\n out[1] = m[1] * x + m[5] * y + m[13];\n return out;\n};\n\n/**\n * Perform some operation over an array of vec2s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec2.forEach = (function() {\n var vec = vec2.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 2;\n }\n\n if(!offset) {\n offset = 0;\n }\n\n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1];\n }\n\n return a;\n };\n})();\n\nexport default vec2;","import vec2 from '../glmatrix/vec2';\n\n/**\n * @constructor\n * @alias clay.Vector2\n * @param {number} x\n * @param {number} y\n */\nvar Vector2 = function(x, y) {\n\n x = x || 0;\n y = y || 0;\n\n /**\n * Storage of Vector2, read and write of x, y will change the values in array\n * All methods also operate on the array instead of x, y components\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Vector2#\n */\n this.array = vec2.fromValues(x, y);\n\n /**\n * Dirty flag is used by the Node to determine\n * if the matrix is updated to latest\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Vector2#\n */\n this._dirty = true;\n};\n\nVector2.prototype = {\n\n constructor: Vector2,\n\n /**\n * Add b to self\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n add: function(b) {\n vec2.add(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x and y components\n * @param {number} x\n * @param {number} y\n * @return {clay.Vector2}\n */\n set: function(x, y) {\n this.array[0] = x;\n this.array[1] = y;\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x and y components from array\n * @param {Float32Array|number[]} arr\n * @return {clay.Vector2}\n */\n setArray: function(arr) {\n this.array[0] = arr[0];\n this.array[1] = arr[1];\n\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Vector2\n * @return {clay.Vector2}\n */\n clone: function() {\n return new Vector2(this.x, this.y);\n },\n\n /**\n * Copy x, y from b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n copy: function(b) {\n vec2.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Cross product of self and b, written to a Vector3 out\n * @param {clay.Vector3} out\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n cross: function(out, b) {\n vec2.cross(out.array, this.array, b.array);\n out._dirty = true;\n return this;\n },\n\n /**\n * Alias for distance\n * @param {clay.Vector2} b\n * @return {number}\n */\n dist: function(b) {\n return vec2.dist(this.array, b.array);\n },\n\n /**\n * Distance between self and b\n * @param {clay.Vector2} b\n * @return {number}\n */\n distance: function(b) {\n return vec2.distance(this.array, b.array);\n },\n\n /**\n * Alias for divide\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n div: function(b) {\n vec2.div(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Divide self by b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n divide: function(b) {\n vec2.divide(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Dot product of self and b\n * @param {clay.Vector2} b\n * @return {number}\n */\n dot: function(b) {\n return vec2.dot(this.array, b.array);\n },\n\n /**\n * Alias of length\n * @return {number}\n */\n len: function() {\n return vec2.len(this.array);\n },\n\n /**\n * Calculate the length\n * @return {number}\n */\n length: function() {\n return vec2.length(this.array);\n },\n\n /**\n * Linear interpolation between a and b\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @param {number} t\n * @return {clay.Vector2}\n */\n lerp: function(a, b, t) {\n vec2.lerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Minimum of self and b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n min: function(b) {\n vec2.min(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Maximum of self and b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n max: function(b) {\n vec2.max(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiply\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n mul: function(b) {\n vec2.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply self and b\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n multiply: function(b) {\n vec2.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Negate self\n * @return {clay.Vector2}\n */\n negate: function() {\n vec2.negate(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Normalize self\n * @return {clay.Vector2}\n */\n normalize: function() {\n vec2.normalize(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Generate random x, y components with a given scale\n * @param {number} scale\n * @return {clay.Vector2}\n */\n random: function(scale) {\n vec2.random(this.array, scale);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self\n * @param {number} scale\n * @return {clay.Vector2}\n */\n scale: function(s) {\n vec2.scale(this.array, this.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale b and add to self\n * @param {clay.Vector2} b\n * @param {number} scale\n * @return {clay.Vector2}\n */\n scaleAndAdd: function(b, s) {\n vec2.scaleAndAdd(this.array, this.array, b.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for squaredDistance\n * @param {clay.Vector2} b\n * @return {number}\n */\n sqrDist: function(b) {\n return vec2.sqrDist(this.array, b.array);\n },\n\n /**\n * Squared distance between self and b\n * @param {clay.Vector2} b\n * @return {number}\n */\n squaredDistance: function(b) {\n return vec2.squaredDistance(this.array, b.array);\n },\n\n /**\n * Alias for squaredLength\n * @return {number}\n */\n sqrLen: function() {\n return vec2.sqrLen(this.array);\n },\n\n /**\n * Squared length of self\n * @return {number}\n */\n squaredLength: function() {\n return vec2.squaredLength(this.array);\n },\n\n /**\n * Alias for subtract\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n sub: function(b) {\n vec2.sub(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Subtract b from self\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\n subtract: function(b) {\n vec2.subtract(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix2 m\n * @param {clay.Matrix2} m\n * @return {clay.Vector2}\n */\n transformMat2: function(m) {\n vec2.transformMat2(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix2d m\n * @param {clay.Matrix2d} m\n * @return {clay.Vector2}\n */\n transformMat2d: function(m) {\n vec2.transformMat2d(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix3 m\n * @param {clay.Matrix3} m\n * @return {clay.Vector2}\n */\n transformMat3: function(m) {\n vec2.transformMat3(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix4 m\n * @param {clay.Matrix4} m\n * @return {clay.Vector2}\n */\n transformMat4: function(m) {\n vec2.transformMat4(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\n// Getter and Setter\nif (Object.defineProperty) {\n\n var proto = Vector2.prototype;\n /**\n * @name x\n * @type {number}\n * @memberOf clay.Vector2\n * @instance\n */\n Object.defineProperty(proto, 'x', {\n get: function () {\n return this.array[0];\n },\n set: function (value) {\n this.array[0] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name y\n * @type {number}\n * @memberOf clay.Vector2\n * @instance\n */\n Object.defineProperty(proto, 'y', {\n get: function () {\n return this.array[1];\n },\n set: function (value) {\n this.array[1] = value;\n this._dirty = true;\n }\n });\n}\n\n// Supply methods that are not in place\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.add = function(out, a, b) {\n vec2.add(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector2} out\n * @param {number} x\n * @param {number} y\n * @return {clay.Vector2}\n */\nVector2.set = function(out, x, y) {\n vec2.set(out.array, x, y);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.copy = function(out, b) {\n vec2.copy(out.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.cross = function(out, a, b) {\n vec2.cross(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.dist = function(a, b) {\n return vec2.distance(a.array, b.array);\n};\n/**\n * @function\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.distance = Vector2.dist;\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.div = function(out, a, b) {\n vec2.divide(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.divide = Vector2.div;\n/**\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.dot = function(a, b) {\n return vec2.dot(a.array, b.array);\n};\n\n/**\n * @param {clay.Vector2} a\n * @return {number}\n */\nVector2.len = function(b) {\n return vec2.length(b.array);\n};\n\n// Vector2.length = Vector2.len;\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @param {number} t\n * @return {clay.Vector2}\n */\nVector2.lerp = function(out, a, b, t) {\n vec2.lerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.min = function(out, a, b) {\n vec2.min(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.max = function(out, a, b) {\n vec2.max(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.mul = function(out, a, b) {\n vec2.multiply(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.multiply = Vector2.mul;\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @return {clay.Vector2}\n */\nVector2.negate = function(out, a) {\n vec2.negate(out.array, a.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @return {clay.Vector2}\n */\nVector2.normalize = function(out, a) {\n vec2.normalize(out.array, a.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {number} scale\n * @return {clay.Vector2}\n */\nVector2.random = function(out, scale) {\n vec2.random(out.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {number} scale\n * @return {clay.Vector2}\n */\nVector2.scale = function(out, a, scale) {\n vec2.scale(out.array, a.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @param {number} scale\n * @return {clay.Vector2}\n */\nVector2.scaleAndAdd = function(out, a, b, scale) {\n vec2.scaleAndAdd(out.array, a.array, b.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.sqrDist = function(a, b) {\n return vec2.sqrDist(a.array, b.array);\n};\n/**\n * @function\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {number}\n */\nVector2.squaredDistance = Vector2.sqrDist;\n\n/**\n * @param {clay.Vector2} a\n * @return {number}\n */\nVector2.sqrLen = function(a) {\n return vec2.sqrLen(a.array);\n};\n/**\n * @function\n * @param {clay.Vector2} a\n * @return {number}\n */\nVector2.squaredLength = Vector2.sqrLen;\n\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.sub = function(out, a, b) {\n vec2.subtract(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Vector2} b\n * @return {clay.Vector2}\n */\nVector2.subtract = Vector2.sub;\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Matrix2} m\n * @return {clay.Vector2}\n */\nVector2.transformMat2 = function(out, a, m) {\n vec2.transformMat2(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Matrix2d} m\n * @return {clay.Vector2}\n */\nVector2.transformMat2d = function(out, a, m) {\n vec2.transformMat2d(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {Matrix3} m\n * @return {clay.Vector2}\n */\nVector2.transformMat3 = function(out, a, m) {\n vec2.transformMat3(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector2} out\n * @param {clay.Vector2} a\n * @param {clay.Matrix4} m\n * @return {clay.Vector2}\n */\nVector2.transformMat4 = function(out, a, m) {\n vec2.transformMat4(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n\nexport default Vector2;\n","import vendor from '../core/vendor';\nimport Base from '../core/Base';\n\nvar SHADER_STATE_TO_ENABLE = 1;\nvar SHADER_STATE_KEEP_ENABLE = 2;\nvar SHADER_STATE_PENDING = 3;\n\n// Enable attribute operation is global to all programs\n// Here saved the list of all enabled attribute index\n// http://www.mjbshaw.com/2013/03/webgl-fixing-invalidoperation.html\nvar enabledAttributeList = {};\n\n// some util functions\nfunction addLineNumbers(string) {\n var chunks = string.split('\\n');\n for (var i = 0, il = chunks.length; i < il; i ++) {\n // Chrome reports shader errors on lines\n // starting counting from 1\n chunks[i] = (i + 1) + ': ' + chunks[i];\n }\n return chunks.join('\\n');\n}\n\n// Return true or error msg if error happened\nfunction checkShaderErrorMsg(_gl, shader, shaderString) {\n if (!_gl.getShaderParameter(shader, _gl.COMPILE_STATUS)) {\n return [_gl.getShaderInfoLog(shader), addLineNumbers(shaderString)].join('\\n');\n }\n}\n\nvar tmpFloat32Array16 = new vendor.Float32Array(16);\n\nvar GLProgram = Base.extend({\n\n uniformSemantics: {},\n attributes: {}\n\n}, function () {\n this._locations = {};\n\n this._textureSlot = 0;\n\n this._program = null;\n}, {\n\n bind: function (renderer) {\n this._textureSlot = 0;\n renderer.gl.useProgram(this._program);\n },\n\n hasUniform: function (symbol) {\n var location = this._locations[symbol];\n return location !== null && location !== undefined;\n },\n\n useTextureSlot: function (renderer, texture, slot) {\n if (texture) {\n renderer.gl.activeTexture(renderer.gl.TEXTURE0 + slot);\n // Maybe texture is not loaded yet;\n if (texture.isRenderable()) {\n texture.bind(renderer);\n }\n else {\n // Bind texture to null\n texture.unbind(renderer);\n }\n }\n },\n\n currentTextureSlot: function () {\n return this._textureSlot;\n },\n\n resetTextureSlot: function (slot) {\n this._textureSlot = slot || 0;\n },\n\n takeCurrentTextureSlot: function (renderer, texture) {\n var textureSlot = this._textureSlot;\n\n this.useTextureSlot(renderer, texture, textureSlot);\n\n this._textureSlot++;\n\n return textureSlot;\n },\n\n setUniform: function (_gl, type, symbol, value) {\n var locationMap = this._locations;\n var location = locationMap[symbol];\n // Uniform is not existed in the shader\n if (location === null || location === undefined) {\n return false;\n }\n\n switch (type) {\n case 'm4':\n if (!(value instanceof Float32Array)) {\n // Use Float32Array is much faster than array when uniformMatrix4fv.\n for (var i = 0; i < value.length; i++) {\n tmpFloat32Array16[i] = value[i];\n }\n value = tmpFloat32Array16;\n }\n _gl.uniformMatrix4fv(location, false, value);\n break;\n case '2i':\n _gl.uniform2i(location, value[0], value[1]);\n break;\n case '2f':\n _gl.uniform2f(location, value[0], value[1]);\n break;\n case '3i':\n _gl.uniform3i(location, value[0], value[1], value[2]);\n break;\n case '3f':\n _gl.uniform3f(location, value[0], value[1], value[2]);\n break;\n case '4i':\n _gl.uniform4i(location, value[0], value[1], value[2], value[3]);\n break;\n case '4f':\n _gl.uniform4f(location, value[0], value[1], value[2], value[3]);\n break;\n case '1i':\n _gl.uniform1i(location, value);\n break;\n case '1f':\n _gl.uniform1f(location, value);\n break;\n case '1fv':\n _gl.uniform1fv(location, value);\n break;\n case '1iv':\n _gl.uniform1iv(location, value);\n break;\n case '2iv':\n _gl.uniform2iv(location, value);\n break;\n case '2fv':\n _gl.uniform2fv(location, value);\n break;\n case '3iv':\n _gl.uniform3iv(location, value);\n break;\n case '3fv':\n _gl.uniform3fv(location, value);\n break;\n case '4iv':\n _gl.uniform4iv(location, value);\n break;\n case '4fv':\n _gl.uniform4fv(location, value);\n break;\n case 'm2':\n case 'm2v':\n _gl.uniformMatrix2fv(location, false, value);\n break;\n case 'm3':\n case 'm3v':\n _gl.uniformMatrix3fv(location, false, value);\n break;\n case 'm4v':\n // Raw value\n if (Array.isArray(value) && Array.isArray(value[0])) {\n var array = new vendor.Float32Array(value.length * 16);\n var cursor = 0;\n for (var i = 0; i < value.length; i++) {\n var item = value[i];\n for (var j = 0; j < 16; j++) {\n array[cursor++] = item[j];\n }\n }\n _gl.uniformMatrix4fv(location, false, array);\n }\n else { // ArrayBufferView\n _gl.uniformMatrix4fv(location, false, value);\n }\n break;\n }\n return true;\n },\n\n setUniformOfSemantic: function (_gl, semantic, val) {\n var semanticInfo = this.uniformSemantics[semantic];\n if (semanticInfo) {\n return this.setUniform(_gl, semanticInfo.type, semanticInfo.symbol, val);\n }\n return false;\n },\n\n // Used for creating VAO\n // Enable the attributes passed in and disable the rest\n // Example Usage:\n // enableAttributes(renderer, [\"position\", \"texcoords\"])\n enableAttributes: function (renderer, attribList, vao) {\n var _gl = renderer.gl;\n var program = this._program;\n\n var locationMap = this._locations;\n\n var enabledAttributeListInContext;\n if (vao) {\n enabledAttributeListInContext = vao.__enabledAttributeList;\n }\n else {\n enabledAttributeListInContext = enabledAttributeList[renderer.__uid__];\n }\n if (!enabledAttributeListInContext) {\n // In vertex array object context\n // PENDING Each vao object needs to enable attributes again?\n if (vao) {\n enabledAttributeListInContext\n = vao.__enabledAttributeList\n = [];\n }\n else {\n enabledAttributeListInContext\n = enabledAttributeList[renderer.__uid__]\n = [];\n }\n }\n var locationList = [];\n for (var i = 0; i < attribList.length; i++) {\n var symbol = attribList[i];\n if (!this.attributes[symbol]) {\n locationList[i] = -1;\n continue;\n }\n var location = locationMap[symbol];\n if (location == null) {\n location = _gl.getAttribLocation(program, symbol);\n // Attrib location is a number from 0 to ...\n if (location === -1) {\n locationList[i] = -1;\n continue;\n }\n locationMap[symbol] = location;\n }\n locationList[i] = location;\n\n if (!enabledAttributeListInContext[location]) {\n enabledAttributeListInContext[location] = SHADER_STATE_TO_ENABLE;\n }\n else {\n enabledAttributeListInContext[location] = SHADER_STATE_KEEP_ENABLE;\n }\n }\n\n for (var i = 0; i < enabledAttributeListInContext.length; i++) {\n switch(enabledAttributeListInContext[i]){\n case SHADER_STATE_TO_ENABLE:\n _gl.enableVertexAttribArray(i);\n enabledAttributeListInContext[i] = SHADER_STATE_PENDING;\n break;\n case SHADER_STATE_KEEP_ENABLE:\n enabledAttributeListInContext[i] = SHADER_STATE_PENDING;\n break;\n // Expired\n case SHADER_STATE_PENDING:\n _gl.disableVertexAttribArray(i);\n enabledAttributeListInContext[i] = 0;\n break;\n }\n }\n\n return locationList;\n },\n\n getAttribLocation: function (_gl, symbol) {\n var locationMap = this._locations;\n\n var location = locationMap[symbol];\n if (location == null) {\n location = _gl.getAttribLocation(this._program, symbol);\n locationMap[symbol] = location;\n }\n\n return location;\n },\n\n buildProgram: function (_gl, shader, vertexShaderCode, fragmentShaderCode) {\n var vertexShader = _gl.createShader(_gl.VERTEX_SHADER);\n var program = _gl.createProgram();\n\n _gl.shaderSource(vertexShader, vertexShaderCode);\n _gl.compileShader(vertexShader);\n\n var fragmentShader = _gl.createShader(_gl.FRAGMENT_SHADER);\n _gl.shaderSource(fragmentShader, fragmentShaderCode);\n _gl.compileShader(fragmentShader);\n\n var msg = checkShaderErrorMsg(_gl, vertexShader, vertexShaderCode);\n if (msg) {\n return msg;\n }\n msg = checkShaderErrorMsg(_gl, fragmentShader, fragmentShaderCode);\n if (msg) {\n return msg;\n }\n\n _gl.attachShader(program, vertexShader);\n _gl.attachShader(program, fragmentShader);\n // Force the position bind to location 0;\n if (shader.attributeSemantics['POSITION']) {\n _gl.bindAttribLocation(program, 0, shader.attributeSemantics['POSITION'].symbol);\n }\n else {\n // Else choose an attribute and bind to location 0;\n var keys = Object.keys(this.attributes);\n _gl.bindAttribLocation(program, 0, keys[0]);\n }\n\n _gl.linkProgram(program);\n\n _gl.deleteShader(vertexShader);\n _gl.deleteShader(fragmentShader);\n\n this._program = program;\n\n // Save code.\n this.vertexCode = vertexShaderCode;\n this.fragmentCode = fragmentShaderCode;\n\n if (!_gl.getProgramParameter(program, _gl.LINK_STATUS)) {\n return 'Could not link program\\n' + _gl.getProgramInfoLog(program);\n }\n\n // Cache uniform locations\n for (var i = 0; i < shader.uniforms.length; i++) {\n var uniformSymbol = shader.uniforms[i];\n this._locations[uniformSymbol] = _gl.getUniformLocation(program, uniformSymbol);\n }\n\n }\n});\n\nexport default GLProgram;","import GLProgram from './GLProgram';\n\nvar loopRegex = /for\\s*?\\(int\\s*?_idx_\\s*\\=\\s*([\\w-]+)\\;\\s*_idx_\\s*<\\s*([\\w-]+);\\s*_idx_\\s*\\+\\+\\s*\\)\\s*\\{\\{([\\s\\S]+?)(?=\\}\\})\\}\\}/g;\n\nfunction unrollLoop(shaderStr, defines, lightsNumbers) {\n // Loop unroll from three.js, https://github.com/mrdoob/three.js/blob/master/src/renderers/webgl/WebGLProgram.js#L175\n // In some case like shadowMap in loop use 'i' to index value much slower.\n\n // Loop use _idx_ and increased with _idx_++ will be unrolled\n // Use {{ }} to match the pair so the if statement will not be affected\n // Write like following\n // for (int _idx_ = 0; _idx_ < 4; _idx_++) {{\n // vec3 color = texture2D(textures[_idx_], uv).rgb;\n // }}\n function replace(match, start, end, snippet) {\n var unroll = '';\n // Try to treat as define\n if (isNaN(start)) {\n if (start in defines) {\n start = defines[start];\n }\n else {\n start = lightNumberDefines[start];\n }\n }\n if (isNaN(end)) {\n if (end in defines) {\n end = defines[end];\n }\n else {\n end = lightNumberDefines[end];\n }\n }\n // TODO Error checking\n\n for (var idx = parseInt(start); idx < parseInt(end); idx++) {\n // PENDING Add scope?\n unroll += '{'\n + snippet\n .replace(/float\\s*\\(\\s*_idx_\\s*\\)/g, idx.toFixed(1))\n .replace(/_idx_/g, idx)\n + '}';\n }\n\n return unroll;\n }\n\n var lightNumberDefines = {};\n for (var lightType in lightsNumbers) {\n lightNumberDefines[lightType + '_COUNT'] = lightsNumbers[lightType];\n }\n return shaderStr.replace(loopRegex, replace);\n}\n\nfunction getDefineCode(defines, lightsNumbers, enabledTextures) {\n var defineStr = [];\n if (lightsNumbers) {\n for (var lightType in lightsNumbers) {\n var count = lightsNumbers[lightType];\n if (count > 0) {\n defineStr.push('#define ' + lightType.toUpperCase() + '_COUNT ' + count);\n }\n }\n }\n if (enabledTextures) {\n for (var i = 0; i < enabledTextures.length; i++) {\n var symbol = enabledTextures[i];\n defineStr.push('#define ' + symbol.toUpperCase() + '_ENABLED');\n }\n }\n // Custom Defines\n for (var symbol in defines) {\n var value = defines[symbol];\n if (value === null) {\n defineStr.push('#define ' + symbol);\n }\n else{\n defineStr.push('#define ' + symbol + ' ' + value.toString());\n }\n }\n return defineStr.join('\\n');\n}\n\nfunction getExtensionCode(exts) {\n // Extension declaration must before all non-preprocessor codes\n // TODO vertex ? extension enum ?\n var extensionStr = [];\n for (var i = 0; i < exts.length; i++) {\n extensionStr.push('#extension GL_' + exts[i] + ' : enable');\n }\n return extensionStr.join('\\n');\n}\n\nfunction getPrecisionCode(precision) {\n return ['precision', precision, 'float'].join(' ') + ';\\n'\n + ['precision', precision, 'int'].join(' ') + ';\\n'\n // depth texture may have precision problem on iOS device.\n + ['precision', precision, 'sampler2D'].join(' ') + ';\\n';\n}\n\nfunction ProgramManager(renderer) {\n this._renderer = renderer;\n this._cache = {};\n}\n\nProgramManager.prototype.getProgram = function (renderable, material, scene) {\n var cache = this._cache;\n\n var isSkinnedMesh = renderable.isSkinnedMesh && renderable.isSkinnedMesh();\n var isInstancedMesh = renderable.isInstancedMesh && renderable.isInstancedMesh();\n var key = 's' + material.shader.shaderID + 'm' + material.getProgramKey();\n if (scene) {\n key += 'se' + scene.getProgramKey(renderable.lightGroup);\n }\n if (isSkinnedMesh) {\n key += ',sk' + renderable.joints.length;\n }\n if (isInstancedMesh) {\n key += ',is';\n }\n var program = cache[key];\n\n if (program) {\n return program;\n }\n\n var lightsNumbers = scene ? scene.getLightsNumbers(renderable.lightGroup) : {};\n var renderer = this._renderer;\n var _gl = renderer.gl;\n var enabledTextures = material.getEnabledTextures();\n var extraDefineCode = '';\n if (isSkinnedMesh) {\n var skinDefines = {\n SKINNING: null,\n JOINT_COUNT: renderable.joints.length\n };\n if (renderable.joints.length > renderer.getMaxJointNumber()) {\n skinDefines.USE_SKIN_MATRICES_TEXTURE = null;\n }\n // TODO Add skinning code?\n extraDefineCode += '\\n' + getDefineCode(skinDefines) + '\\n';\n }\n if (isInstancedMesh) {\n extraDefineCode += '\\n#define INSTANCING\\n';\n }\n // TODO Optimize key generation\n // VERTEX\n var vertexDefineStr = extraDefineCode + getDefineCode(material.vertexDefines, lightsNumbers, enabledTextures);\n // FRAGMENT\n var fragmentDefineStr = extraDefineCode + getDefineCode(material.fragmentDefines, lightsNumbers, enabledTextures);\n\n var vertexCode = vertexDefineStr + '\\n' + material.shader.vertex;\n\n var extensions = [\n 'OES_standard_derivatives',\n 'EXT_shader_texture_lod'\n ].filter(function (ext) {\n return renderer.getGLExtension(ext) != null;\n });\n\n if (extensions.indexOf('EXT_shader_texture_lod') >= 0) {\n fragmentDefineStr += '\\n#define SUPPORT_TEXTURE_LOD';\n }\n if (extensions.indexOf('OES_standard_derivatives') >= 0) {\n fragmentDefineStr += '\\n#define SUPPORT_STANDARD_DERIVATIVES';\n }\n\n var fragmentCode = getExtensionCode(extensions) + '\\n'\n + getPrecisionCode(material.precision) + '\\n'\n + fragmentDefineStr + '\\n'\n + material.shader.fragment;\n\n var finalVertexCode = unrollLoop(vertexCode, material.vertexDefines, lightsNumbers);\n var finalFragmentCode = unrollLoop(fragmentCode, material.fragmentDefines, lightsNumbers);\n\n var program = new GLProgram();\n program.uniformSemantics = material.shader.uniformSemantics;\n program.attributes = material.shader.attributes;\n var errorMsg = program.buildProgram(_gl, material.shader, finalVertexCode, finalFragmentCode);\n program.__error = errorMsg;\n\n cache[key] = program;\n\n return program;\n};\n\nexport default ProgramManager;","/**\n * Mainly do the parse and compile of shader string\n * Support shader code chunk import and export\n * Support shader semantics\n * http://www.nvidia.com/object/using_sas.html\n * https://github.com/KhronosGroup/collada2json/issues/45\n */\nimport util from './core/util';\nimport vendor from './core/vendor';\n\nvar uniformRegex = /uniform\\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\\s+([\\s\\S]*?);/g;\nvar attributeRegex = /attribute\\s+(float|int|vec2|vec3|vec4)\\s+([\\s\\S]*?);/g;\n// Only parse number define.\nvar defineRegex = /#define\\s+(\\w+)?(\\s+[\\d-.]+)?\\s*;?\\s*\\n/g;\n\nvar uniformTypeMap = {\n 'bool': '1i',\n 'int': '1i',\n 'sampler2D': 't',\n 'samplerCube': 't',\n 'float': '1f',\n 'vec2': '2f',\n 'vec3': '3f',\n 'vec4': '4f',\n 'ivec2': '2i',\n 'ivec3': '3i',\n 'ivec4': '4i',\n 'mat2': 'm2',\n 'mat3': 'm3',\n 'mat4': 'm4'\n};\n\nfunction createZeroArray(len) {\n var arr = [];\n for (var i = 0; i < len; i++) {\n arr[i] = 0;\n }\n return arr;\n}\n\nvar uniformValueConstructor = {\n 'bool': function () { return true; },\n 'int': function () { return 0; },\n 'float': function () { return 0; },\n 'sampler2D': function () { return null; },\n 'samplerCube': function () { return null; },\n\n 'vec2': function () { return createZeroArray(2); },\n 'vec3': function () { return createZeroArray(3); },\n 'vec4': function () { return createZeroArray(4); },\n\n 'ivec2': function () { return createZeroArray(2); },\n 'ivec3': function () { return createZeroArray(3); },\n 'ivec4': function () { return createZeroArray(4); },\n\n 'mat2': function () { return createZeroArray(4); },\n 'mat3': function () { return createZeroArray(9); },\n 'mat4': function () { return createZeroArray(16); },\n\n 'array': function () { return []; }\n};\n\nvar attributeSemantics = [\n 'POSITION',\n 'NORMAL',\n 'BINORMAL',\n 'TANGENT',\n 'TEXCOORD',\n 'TEXCOORD_0',\n 'TEXCOORD_1',\n 'COLOR',\n // Skinning\n // https://github.com/KhronosGroup/glTF/blob/master/specification/README.md#semantics\n 'JOINT',\n 'WEIGHT'\n];\nvar uniformSemantics = [\n 'SKIN_MATRIX',\n // Information about viewport\n 'VIEWPORT_SIZE',\n 'VIEWPORT',\n 'DEVICEPIXELRATIO',\n // Window size for window relative coordinate\n // https://www.opengl.org/sdk/docs/man/html/gl_FragCoord.xhtml\n 'WINDOW_SIZE',\n // Infomation about camera\n 'NEAR',\n 'FAR',\n // Time\n 'TIME'\n];\nvar matrixSemantics = [\n 'WORLD',\n 'VIEW',\n 'PROJECTION',\n 'WORLDVIEW',\n 'VIEWPROJECTION',\n 'WORLDVIEWPROJECTION',\n 'WORLDINVERSE',\n 'VIEWINVERSE',\n 'PROJECTIONINVERSE',\n 'WORLDVIEWINVERSE',\n 'VIEWPROJECTIONINVERSE',\n 'WORLDVIEWPROJECTIONINVERSE',\n 'WORLDTRANSPOSE',\n 'VIEWTRANSPOSE',\n 'PROJECTIONTRANSPOSE',\n 'WORLDVIEWTRANSPOSE',\n 'VIEWPROJECTIONTRANSPOSE',\n 'WORLDVIEWPROJECTIONTRANSPOSE',\n 'WORLDINVERSETRANSPOSE',\n 'VIEWINVERSETRANSPOSE',\n 'PROJECTIONINVERSETRANSPOSE',\n 'WORLDVIEWINVERSETRANSPOSE',\n 'VIEWPROJECTIONINVERSETRANSPOSE',\n 'WORLDVIEWPROJECTIONINVERSETRANSPOSE'\n];\n\nvar attributeSizeMap = {\n // WebGL does not support integer attributes\n 'vec4': 4,\n 'vec3': 3,\n 'vec2': 2,\n 'float': 1\n};\n\n\nvar shaderIDCache = {};\nvar shaderCodeCache = {};\n\nfunction getShaderID(vertex, fragment) {\n var key = 'vertex:' + vertex + 'fragment:' + fragment;\n if (shaderIDCache[key]) {\n return shaderIDCache[key];\n }\n var id = util.genGUID();\n shaderIDCache[key] = id;\n\n shaderCodeCache[id] = {\n vertex: vertex,\n fragment: fragment\n };\n\n return id;\n}\n\nfunction removeComment(code) {\n return code.replace(/[ \\t]*\\/\\/.*\\n/g, '' ) // remove //\n .replace(/[ \\t]*\\/\\*[\\s\\S]*?\\*\\//g, '' ); // remove /* */\n}\n\nfunction logSyntaxError() {\n console.error('Wrong uniform/attributes syntax');\n}\n\nfunction parseDeclarations(type, line) {\n var speratorsRegexp = /[,=\\(\\):]/;\n var tokens = line\n // Convert `symbol: [1,2,3]` to `symbol: vec3(1,2,3)`\n .replace(/:\\s*\\[\\s*(.*)\\s*\\]/g, '=' + type + '($1)')\n .replace(/\\s+/g, '')\n .split(/(?=[,=\\(\\):])/g);\n\n var newTokens = [];\n for (var i = 0; i < tokens.length; i++) {\n if (tokens[i].match(speratorsRegexp)) {\n newTokens.push(\n tokens[i].charAt(0),\n tokens[i].slice(1)\n );\n }\n else {\n newTokens.push(tokens[i]);\n }\n }\n tokens = newTokens;\n\n var TYPE_SYMBOL = 0;\n var TYPE_ASSIGN = 1;\n var TYPE_VEC = 2;\n var TYPE_ARR = 3;\n var TYPE_SEMANTIC = 4;\n var TYPE_NORMAL = 5;\n\n var opType = TYPE_SYMBOL;\n var declarations = {};\n var declarationValue = null;\n var currentDeclaration;\n\n addSymbol(tokens[0]);\n\n function addSymbol(symbol) {\n if (!symbol) {\n logSyntaxError();\n }\n var arrResult = symbol.match(/\\[(.*?)\\]/);\n currentDeclaration = symbol.replace(/\\[(.*?)\\]/, '');\n declarations[currentDeclaration] = {};\n if (arrResult) {\n declarations[currentDeclaration].isArray = true;\n declarations[currentDeclaration].arraySize = arrResult[1];\n }\n }\n\n for (var i = 1; i < tokens.length; i++) {\n var token = tokens[i];\n if (!token) { // Empty token;\n continue;\n }\n if (token === '=') {\n if (opType !== TYPE_SYMBOL\n && opType !== TYPE_ARR) {\n logSyntaxError();\n break;\n }\n opType = TYPE_ASSIGN;\n\n continue;\n }\n else if (token === ':') {\n opType = TYPE_SEMANTIC;\n\n continue;\n }\n else if (token === ',') {\n if (opType === TYPE_VEC) {\n if (!(declarationValue instanceof Array)) {\n logSyntaxError();\n break;\n }\n declarationValue.push(+tokens[++i]);\n }\n else {\n opType = TYPE_NORMAL;\n }\n\n continue;\n }\n else if (token === ')') {\n declarations[currentDeclaration].value = new vendor.Float32Array(declarationValue);\n declarationValue = null;\n opType = TYPE_NORMAL;\n continue;\n }\n else if (token === '(') {\n if (opType !== TYPE_VEC) {\n logSyntaxError();\n break;\n }\n if (!(declarationValue instanceof Array)) {\n logSyntaxError();\n break;\n }\n declarationValue.push(+tokens[++i]);\n continue;\n }\n else if (token.indexOf('vec') >= 0) {\n if (opType !== TYPE_ASSIGN\n // Compatitable with old syntax `symbol: [1,2,3]`\n && opType !== TYPE_SEMANTIC) {\n logSyntaxError();\n break;\n }\n opType = TYPE_VEC;\n declarationValue = [];\n continue;\n }\n else if (opType === TYPE_ASSIGN) {\n if (type === 'bool') {\n declarations[currentDeclaration].value = token === 'true';\n }\n else {\n declarations[currentDeclaration].value = parseFloat(token);\n }\n declarationValue = null;\n continue;\n }\n else if (opType === TYPE_SEMANTIC) {\n var semantic = token;\n if (attributeSemantics.indexOf(semantic) >= 0\n || uniformSemantics.indexOf(semantic) >= 0\n || matrixSemantics.indexOf(semantic) >= 0\n ) {\n declarations[currentDeclaration].semantic = semantic;\n }\n else if (semantic === 'ignore' || semantic === 'unconfigurable') {\n declarations[currentDeclaration].ignore = true;\n }\n else {\n // Try to parse as a default tvalue.\n if (type === 'bool') {\n declarations[currentDeclaration].value = semantic === 'true';\n }\n else {\n declarations[currentDeclaration].value = parseFloat(semantic);\n }\n }\n continue;\n }\n\n // treat as symbol.\n addSymbol(token);\n opType = TYPE_SYMBOL;\n }\n\n return declarations;\n}\n\n\n/**\n * @constructor\n * @extends clay.core.Base\n * @alias clay.Shader\n * @param {string} vertex\n * @param {string} fragment\n * @example\n * // Create a phong shader\n * var shader = new clay.Shader(\n * clay.Shader.source('clay.standard.vertex'),\n * clay.Shader.source('clay.standard.fragment')\n * );\n */\nfunction Shader(vertex, fragment) {\n // First argument can be { vertex, fragment }\n if (typeof vertex === 'object') {\n fragment = vertex.fragment;\n vertex = vertex.vertex;\n }\n\n vertex = removeComment(vertex);\n fragment = removeComment(fragment);\n\n this._shaderID = getShaderID(vertex, fragment);\n\n this._vertexCode = Shader.parseImport(vertex);\n this._fragmentCode = Shader.parseImport(fragment);\n\n /**\n * @readOnly\n */\n this.attributeSemantics = {};\n /**\n * @readOnly\n */\n this.matrixSemantics = {};\n /**\n * @readOnly\n */\n this.uniformSemantics = {};\n /**\n * @readOnly\n */\n this.matrixSemanticKeys = [];\n /**\n * @readOnly\n */\n this.uniformTemplates = {};\n /**\n * @readOnly\n */\n this.attributes = {};\n /**\n * @readOnly\n */\n this.textures = {};\n /**\n * @readOnly\n */\n this.vertexDefines = {};\n /**\n * @readOnly\n */\n this.fragmentDefines = {};\n\n this._parseAttributes();\n this._parseUniforms();\n this._parseDefines();\n}\n\nShader.prototype = {\n\n constructor: Shader,\n\n // Create a new uniform instance for material\n createUniforms: function () {\n var uniforms = {};\n\n for (var symbol in this.uniformTemplates){\n var uniformTpl = this.uniformTemplates[symbol];\n uniforms[symbol] = {\n type: uniformTpl.type,\n value: uniformTpl.value()\n };\n }\n\n return uniforms;\n },\n\n _parseImport: function () {\n this._vertexCode = Shader.parseImport(this.vertex);\n this._fragmentCode = Shader.parseImport(this.fragment);\n },\n\n _addSemanticUniform: function (symbol, uniformType, semantic) {\n // This case is only for SKIN_MATRIX\n // TODO\n if (attributeSemantics.indexOf(semantic) >= 0) {\n this.attributeSemantics[semantic] = {\n symbol: symbol,\n type: uniformType\n };\n }\n else if (matrixSemantics.indexOf(semantic) >= 0) {\n var isTranspose = false;\n var semanticNoTranspose = semantic;\n if (semantic.match(/TRANSPOSE$/)) {\n isTranspose = true;\n semanticNoTranspose = semantic.slice(0, -9);\n }\n this.matrixSemantics[semantic] = {\n symbol: symbol,\n type: uniformType,\n isTranspose: isTranspose,\n semanticNoTranspose: semanticNoTranspose\n };\n }\n else if (uniformSemantics.indexOf(semantic) >= 0) {\n this.uniformSemantics[semantic] = {\n symbol: symbol,\n type: uniformType\n };\n }\n },\n\n _addMaterialUniform: function (symbol, type, uniformType, defaultValueFunc, isArray, materialUniforms) {\n materialUniforms[symbol] = {\n type: uniformType,\n value: isArray ? uniformValueConstructor['array'] : (defaultValueFunc || uniformValueConstructor[type]),\n semantic: null\n };\n },\n\n _parseUniforms: function () {\n var uniforms = {};\n var self = this;\n var shaderType = 'vertex';\n this._uniformList = [];\n\n this._vertexCode = this._vertexCode.replace(uniformRegex, _uniformParser);\n shaderType = 'fragment';\n this._fragmentCode = this._fragmentCode.replace(uniformRegex, _uniformParser);\n\n self.matrixSemanticKeys = Object.keys(this.matrixSemantics);\n\n function makeDefaultValueFunc(value) {\n return value != null ? function () { return value; } : null;\n }\n\n function _uniformParser(str, type, content) {\n var declaredUniforms = parseDeclarations(type, content);\n var uniformMainStr = [];\n for (var symbol in declaredUniforms) {\n\n var uniformInfo = declaredUniforms[symbol];\n var semantic = uniformInfo.semantic;\n var tmpStr = symbol;\n var uniformType = uniformTypeMap[type];\n var defaultValueFunc = makeDefaultValueFunc(declaredUniforms[symbol].value);\n if (declaredUniforms[symbol].isArray) {\n tmpStr += '[' + declaredUniforms[symbol].arraySize + ']';\n uniformType += 'v';\n }\n\n uniformMainStr.push(tmpStr);\n\n self._uniformList.push(symbol);\n\n if (!uniformInfo.ignore) {\n if (type === 'sampler2D' || type === 'samplerCube') {\n // Texture is default disabled\n self.textures[symbol] = {\n shaderType: shaderType,\n type: type\n };\n }\n\n if (semantic) {\n // TODO Should not declare multiple symbols if have semantic.\n self._addSemanticUniform(symbol, uniformType, semantic);\n }\n else {\n self._addMaterialUniform(\n symbol, type, uniformType, defaultValueFunc,\n declaredUniforms[symbol].isArray, uniforms\n );\n }\n }\n }\n return uniformMainStr.length > 0\n ? 'uniform ' + type + ' ' + uniformMainStr.join(',') + ';\\n' : '';\n }\n\n this.uniformTemplates = uniforms;\n },\n\n _parseAttributes: function () {\n var attributes = {};\n var self = this;\n this._vertexCode = this._vertexCode.replace(attributeRegex, _attributeParser);\n\n function _attributeParser(str, type, content) {\n var declaredAttributes = parseDeclarations(type, content);\n\n var size = attributeSizeMap[type] || 1;\n var attributeMainStr = [];\n for (var symbol in declaredAttributes) {\n var semantic = declaredAttributes[symbol].semantic;\n attributes[symbol] = {\n // TODO Can only be float\n type: 'float',\n size: size,\n semantic: semantic || null\n };\n // TODO Should not declare multiple symbols if have semantic.\n if (semantic) {\n if (attributeSemantics.indexOf(semantic) < 0) {\n throw new Error('Unkown semantic \"' + semantic + '\"');\n }\n else {\n self.attributeSemantics[semantic] = {\n symbol: symbol,\n type: type\n };\n }\n }\n attributeMainStr.push(symbol);\n }\n\n return 'attribute ' + type + ' ' + attributeMainStr.join(',') + ';\\n';\n }\n\n this.attributes = attributes;\n },\n\n _parseDefines: function () {\n var self = this;\n var shaderType = 'vertex';\n this._vertexCode = this._vertexCode.replace(defineRegex, _defineParser);\n shaderType = 'fragment';\n this._fragmentCode = this._fragmentCode.replace(defineRegex, _defineParser);\n\n function _defineParser(str, symbol, value) {\n var defines = shaderType === 'vertex' ? self.vertexDefines : self.fragmentDefines;\n if (!defines[symbol]) { // Haven't been defined by user\n if (value === 'false') {\n defines[symbol] = false;\n }\n else if (value === 'true') {\n defines[symbol] = true;\n }\n else {\n defines[symbol] = value\n // If can parse to float\n ? (isNaN(parseFloat(value)) ? value.trim() : parseFloat(value))\n : null;\n }\n }\n return '';\n }\n },\n\n /**\n * Clone a new shader\n * @return {clay.Shader}\n */\n clone: function () {\n var code = shaderCodeCache[this._shaderID];\n var shader = new Shader(code.vertex, code.fragment);\n return shader;\n }\n};\n\nif (Object.defineProperty) {\n Object.defineProperty(Shader.prototype, 'shaderID', {\n get: function () {\n return this._shaderID;\n }\n });\n Object.defineProperty(Shader.prototype, 'vertex', {\n get: function () {\n return this._vertexCode;\n }\n });\n Object.defineProperty(Shader.prototype, 'fragment', {\n get: function () {\n return this._fragmentCode;\n }\n });\n Object.defineProperty(Shader.prototype, 'uniforms', {\n get: function () {\n return this._uniformList;\n }\n });\n}\n\nvar importRegex = /(@import)\\s*([0-9a-zA-Z_\\-\\.]*)/g;\nShader.parseImport = function (shaderStr) {\n shaderStr = shaderStr.replace(importRegex, function (str, importSymbol, importName) {\n var str = Shader.source(importName);\n if (str) {\n // Recursively parse\n return Shader.parseImport(str);\n }\n else {\n console.error('Shader chunk \"' + importName + '\" not existed in library');\n return '';\n }\n });\n return shaderStr;\n};\n\nvar exportRegex = /(@export)\\s*([0-9a-zA-Z_\\-\\.]*)\\s*\\n([\\s\\S]*?)@end/g;\n\n/**\n * Import shader source\n * @param {string} shaderStr\n * @memberOf clay.Shader\n */\nShader['import'] = function (shaderStr) {\n shaderStr.replace(exportRegex, function (str, exportSymbol, exportName, code) {\n var code = code.replace(/(^[\\s\\t\\xa0\\u3000]+)|([\\u3000\\xa0\\s\\t]+\\x24)/g, '');\n if (code) {\n var parts = exportName.split('.');\n var obj = Shader.codes;\n var i = 0;\n var key;\n while (i < parts.length - 1) {\n key = parts[i++];\n if (!obj[key]) {\n obj[key] = {};\n }\n obj = obj[key];\n }\n key = parts[i];\n obj[key] = code;\n }\n return code;\n });\n};\n\n/**\n * Library to store all the loaded shader codes\n * @type {Object}\n * @readOnly\n * @memberOf clay.Shader\n */\nShader.codes = {};\n\n/**\n * Get shader source\n * @param {string} name\n * @return {string}\n */\nShader.source = function (name) {\n var parts = name.split('.');\n var obj = Shader.codes;\n var i = 0;\n while (obj && i < parts.length) {\n var key = parts[i++];\n obj = obj[key];\n }\n if (typeof obj !== 'string') {\n // FIXME Use default instead\n console.error('Shader \"' + name + '\" not existed in library');\n return '';\n }\n return obj;\n};\n\nexport default Shader;\n","export default \"@export clay.prez.vertex\\nuniform mat4 WVP : WORLDVIEWPROJECTION;\\nattribute vec3 pos : POSITION;\\nattribute vec2 uv : TEXCOORD_0;\\nuniform vec2 uvRepeat : [1.0, 1.0];\\nuniform vec2 uvOffset : [0.0, 0.0];\\n@import clay.chunk.skinning_header\\n@import clay.chunk.instancing_header\\nvarying vec2 v_Texcoord;\\nvoid main()\\n{\\n vec4 P = vec4(pos, 1.0);\\n#ifdef SKINNING\\n @import clay.chunk.skin_matrix\\n P = skinMatrixWS * P;\\n#endif\\n#ifdef INSTANCING\\n @import clay.chunk.instancing_matrix\\n P = instanceMat * P;\\n#endif\\n gl_Position = WVP * P;\\n v_Texcoord = uv * uvRepeat + uvOffset;\\n}\\n@end\\n@export clay.prez.fragment\\nuniform sampler2D alphaMap;\\nuniform float alphaCutoff: 0.0;\\nvarying vec2 v_Texcoord;\\nvoid main()\\n{\\n if (alphaCutoff > 0.0) {\\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\\n discard;\\n }\\n }\\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\\n}\\n@end\";\n","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport {GLMAT_EPSILON, GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 4x4 Matrix\n * @name mat4\n */\n\nvar mat4 = {};\n\n/**\n * Creates a new identity mat4\n *\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.create = function() {\n var out = new GLMAT_ARRAY_TYPE(16);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Creates a new mat4 initialized with values from an existing matrix\n *\n * @param {mat4} a matrix to clone\n * @returns {mat4} a new 4x4 matrix\n */\nmat4.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(16);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Copy the values from one mat4 to another\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Set a mat4 to the identity matrix\n *\n * @param {mat4} out the receiving matrix\n * @returns {mat4} out\n */\nmat4.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = 1;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 1;\n out[11] = 0;\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a03 = a[3],\n a12 = a[6], a13 = a[7],\n a23 = a[11];\n\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a01;\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a02;\n out[9] = a12;\n out[11] = a[14];\n out[12] = a03;\n out[13] = a13;\n out[14] = a23;\n } else {\n out[0] = a[0];\n out[1] = a[4];\n out[2] = a[8];\n out[3] = a[12];\n out[4] = a[1];\n out[5] = a[5];\n out[6] = a[9];\n out[7] = a[13];\n out[8] = a[2];\n out[9] = a[6];\n out[10] = a[10];\n out[11] = a[14];\n out[12] = a[3];\n out[13] = a[7];\n out[14] = a[11];\n out[15] = a[15];\n }\n\n return out;\n};\n\n/**\n * Inverts a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;\n out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;\n out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;\n out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;\n out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;\n out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;\n out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat4\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the source matrix\n * @returns {mat4} out\n */\nmat4.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));\n out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));\n out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));\n out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));\n out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));\n out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));\n out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));\n out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));\n out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));\n out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));\n out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));\n out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));\n out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));\n out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));\n out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));\n out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));\n return out;\n};\n\n/**\n * Calculates the determinant of a mat4\n *\n * @param {mat4} a the source matrix\n * @returns {Number} determinant of a\n */\nmat4.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32;\n\n // Calculate the determinant\n return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n};\n\n/**\n * Multiplies two mat4's\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the first operand\n * @param {mat4} b the second operand\n * @returns {mat4} out\n */\nmat4.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];\n\n // Cache only the current line of the second matrix\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];\n out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];\n out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n\n b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];\n out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;\n out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;\n out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;\n out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;\n return out;\n};\n\n/**\n * Multiplies two affine mat4's\n * Add by https://github.com/pissang\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the first operand\n * @param {mat4} b the second operand\n * @returns {mat4} out\n */\nmat4.multiplyAffine = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[4], a11 = a[5], a12 = a[6],\n a20 = a[8], a21 = a[9], a22 = a[10],\n a30 = a[12], a31 = a[13], a32 = a[14];\n\n // Cache only the current line of the second matrix\n var b0 = b[0], b1 = b[1], b2 = b[2];\n out[0] = b0*a00 + b1*a10 + b2*a20;\n out[1] = b0*a01 + b1*a11 + b2*a21;\n out[2] = b0*a02 + b1*a12 + b2*a22;\n // out[3] = 0;\n\n b0 = b[4]; b1 = b[5]; b2 = b[6];\n out[4] = b0*a00 + b1*a10 + b2*a20;\n out[5] = b0*a01 + b1*a11 + b2*a21;\n out[6] = b0*a02 + b1*a12 + b2*a22;\n // out[7] = 0;\n\n b0 = b[8]; b1 = b[9]; b2 = b[10];\n out[8] = b0*a00 + b1*a10 + b2*a20;\n out[9] = b0*a01 + b1*a11 + b2*a21;\n out[10] = b0*a02 + b1*a12 + b2*a22;\n // out[11] = 0;\n\n b0 = b[12]; b1 = b[13]; b2 = b[14];\n out[12] = b0*a00 + b1*a10 + b2*a20 + a30;\n out[13] = b0*a01 + b1*a11 + b2*a21 + a31;\n out[14] = b0*a02 + b1*a12 + b2*a22 + a32;\n // out[15] = 1;\n return out;\n};\n\n/**\n * Alias for {@link mat4.multiply}\n * @function\n */\nmat4.mul = mat4.multiply;\n\n/**\n * Alias for {@link mat4.multiplyAffine}\n * @function\n */\nmat4.mulAffine = mat4.multiplyAffine;\n/**\n * Translate a mat4 by the given vector\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to translate\n * @param {vec3} v vector to translate by\n * @returns {mat4} out\n */\nmat4.translate = function (out, a, v) {\n var x = v[0], y = v[1], z = v[2],\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23;\n\n if (a === out) {\n out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];\n out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];\n out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];\n out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];\n } else {\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;\n out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;\n out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;\n\n out[12] = a00 * x + a10 * y + a20 * z + a[12];\n out[13] = a01 * x + a11 * y + a21 * z + a[13];\n out[14] = a02 * x + a12 * y + a22 * z + a[14];\n out[15] = a03 * x + a13 * y + a23 * z + a[15];\n }\n\n return out;\n};\n\n/**\n * Scales the mat4 by the dimensions in the given vec3\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to scale\n * @param {vec3} v the vec3 to scale the matrix by\n * @returns {mat4} out\n **/\nmat4.scale = function(out, a, v) {\n var x = v[0], y = v[1], z = v[2];\n\n out[0] = a[0] * x;\n out[1] = a[1] * x;\n out[2] = a[2] * x;\n out[3] = a[3] * x;\n out[4] = a[4] * y;\n out[5] = a[5] * y;\n out[6] = a[6] * y;\n out[7] = a[7] * y;\n out[8] = a[8] * z;\n out[9] = a[9] * z;\n out[10] = a[10] * z;\n out[11] = a[11] * z;\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n return out;\n};\n\n/**\n * Rotates a mat4 by the given angle\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @param {vec3} axis the axis to rotate around\n * @returns {mat4} out\n */\nmat4.rotate = function (out, a, rad, axis) {\n var x = axis[0], y = axis[1], z = axis[2],\n len = Math.sqrt(x * x + y * y + z * z),\n s, c, t,\n a00, a01, a02, a03,\n a10, a11, a12, a13,\n a20, a21, a22, a23,\n b00, b01, b02,\n b10, b11, b12,\n b20, b21, b22;\n\n if (Math.abs(len) < GLMAT_EPSILON) { return null; }\n\n len = 1 / len;\n x *= len;\n y *= len;\n z *= len;\n\n s = Math.sin(rad);\n c = Math.cos(rad);\n t = 1 - c;\n\n a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];\n a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];\n a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];\n\n // Construct the elements of the rotation matrix\n b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;\n b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;\n b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;\n\n // Perform rotation-specific matrix multiplication\n out[0] = a00 * b00 + a10 * b01 + a20 * b02;\n out[1] = a01 * b00 + a11 * b01 + a21 * b02;\n out[2] = a02 * b00 + a12 * b01 + a22 * b02;\n out[3] = a03 * b00 + a13 * b01 + a23 * b02;\n out[4] = a00 * b10 + a10 * b11 + a20 * b12;\n out[5] = a01 * b10 + a11 * b11 + a21 * b12;\n out[6] = a02 * b10 + a12 * b11 + a22 * b12;\n out[7] = a03 * b10 + a13 * b11 + a23 * b12;\n out[8] = a00 * b20 + a10 * b21 + a20 * b22;\n out[9] = a01 * b20 + a11 * b21 + a21 * b22;\n out[10] = a02 * b20 + a12 * b21 + a22 * b22;\n out[11] = a03 * b20 + a13 * b21 + a23 * b22;\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the X axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateX = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[4] = a10 * c + a20 * s;\n out[5] = a11 * c + a21 * s;\n out[6] = a12 * c + a22 * s;\n out[7] = a13 * c + a23 * s;\n out[8] = a20 * c - a10 * s;\n out[9] = a21 * c - a11 * s;\n out[10] = a22 * c - a12 * s;\n out[11] = a23 * c - a13 * s;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Y axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateY = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a20 = a[8],\n a21 = a[9],\n a22 = a[10],\n a23 = a[11];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged rows\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c - a20 * s;\n out[1] = a01 * c - a21 * s;\n out[2] = a02 * c - a22 * s;\n out[3] = a03 * c - a23 * s;\n out[8] = a00 * s + a20 * c;\n out[9] = a01 * s + a21 * c;\n out[10] = a02 * s + a22 * c;\n out[11] = a03 * s + a23 * c;\n return out;\n};\n\n/**\n * Rotates a matrix by the given angle around the Z axis\n *\n * @param {mat4} out the receiving matrix\n * @param {mat4} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat4} out\n */\nmat4.rotateZ = function (out, a, rad) {\n var s = Math.sin(rad),\n c = Math.cos(rad),\n a00 = a[0],\n a01 = a[1],\n a02 = a[2],\n a03 = a[3],\n a10 = a[4],\n a11 = a[5],\n a12 = a[6],\n a13 = a[7];\n\n if (a !== out) { // If the source and destination differ, copy the unchanged last row\n out[8] = a[8];\n out[9] = a[9];\n out[10] = a[10];\n out[11] = a[11];\n out[12] = a[12];\n out[13] = a[13];\n out[14] = a[14];\n out[15] = a[15];\n }\n\n // Perform axis-specific matrix multiplication\n out[0] = a00 * c + a10 * s;\n out[1] = a01 * c + a11 * s;\n out[2] = a02 * c + a12 * s;\n out[3] = a03 * c + a13 * s;\n out[4] = a10 * c - a00 * s;\n out[5] = a11 * c - a01 * s;\n out[6] = a12 * c - a02 * s;\n out[7] = a13 * c - a03 * s;\n return out;\n};\n\n/**\n * Creates a matrix from a quaternion rotation and vector translation\n * This is equivalent to (but much faster than):\n *\n * mat4.identity(dest);\n * mat4.translate(dest, vec);\n * var quatMat = mat4.create();\n * quat4.toMat4(quat, quatMat);\n * mat4.multiply(dest, quatMat);\n *\n * @param {mat4} out mat4 receiving operation result\n * @param {quat4} q Rotation quaternion\n * @param {vec3} v Translation vector\n * @returns {mat4} out\n */\nmat4.fromRotationTranslation = function (out, q, v) {\n // Quaternion math\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n xy = x * y2,\n xz = x * z2,\n yy = y * y2,\n yz = y * z2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - (yy + zz);\n out[1] = xy + wz;\n out[2] = xz - wy;\n out[3] = 0;\n out[4] = xy - wz;\n out[5] = 1 - (xx + zz);\n out[6] = yz + wx;\n out[7] = 0;\n out[8] = xz + wy;\n out[9] = yz - wx;\n out[10] = 1 - (xx + yy);\n out[11] = 0;\n out[12] = v[0];\n out[13] = v[1];\n out[14] = v[2];\n out[15] = 1;\n\n return out;\n};\n\nmat4.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[1] = yx + wz;\n out[2] = zx - wy;\n out[3] = 0;\n\n out[4] = yx - wz;\n out[5] = 1 - xx - zz;\n out[6] = zy + wx;\n out[7] = 0;\n\n out[8] = zx + wy;\n out[9] = zy - wx;\n out[10] = 1 - xx - yy;\n out[11] = 0;\n\n out[12] = 0;\n out[13] = 0;\n out[14] = 0;\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Generates a frustum matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {Number} left Left bound of the frustum\n * @param {Number} right Right bound of the frustum\n * @param {Number} bottom Bottom bound of the frustum\n * @param {Number} top Top bound of the frustum\n * @param {Number} near Near bound of the frustum\n * @param {Number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.frustum = function (out, left, right, bottom, top, near, far) {\n var rl = 1 / (right - left),\n tb = 1 / (top - bottom),\n nf = 1 / (near - far);\n out[0] = (near * 2) * rl;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = (near * 2) * tb;\n out[6] = 0;\n out[7] = 0;\n out[8] = (right + left) * rl;\n out[9] = (top + bottom) * tb;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (far * near * 2) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a perspective projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} fovy Vertical field of view in radians\n * @param {number} aspect Aspect ratio. typically viewport width/height\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.perspective = function (out, fovy, aspect, near, far) {\n var f = 1.0 / Math.tan(fovy / 2),\n nf = 1 / (near - far);\n out[0] = f / aspect;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = f;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = (far + near) * nf;\n out[11] = -1;\n out[12] = 0;\n out[13] = 0;\n out[14] = (2 * far * near) * nf;\n out[15] = 0;\n return out;\n};\n\n/**\n * Generates a orthogonal projection matrix with the given bounds\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {number} left Left bound of the frustum\n * @param {number} right Right bound of the frustum\n * @param {number} bottom Bottom bound of the frustum\n * @param {number} top Top bound of the frustum\n * @param {number} near Near bound of the frustum\n * @param {number} far Far bound of the frustum\n * @returns {mat4} out\n */\nmat4.ortho = function (out, left, right, bottom, top, near, far) {\n var lr = 1 / (left - right),\n bt = 1 / (bottom - top),\n nf = 1 / (near - far);\n out[0] = -2 * lr;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 0;\n out[5] = -2 * bt;\n out[6] = 0;\n out[7] = 0;\n out[8] = 0;\n out[9] = 0;\n out[10] = 2 * nf;\n out[11] = 0;\n out[12] = (left + right) * lr;\n out[13] = (top + bottom) * bt;\n out[14] = (far + near) * nf;\n out[15] = 1;\n return out;\n};\n\n/**\n * Generates a look-at matrix with the given eye position, focal point, and up axis\n *\n * @param {mat4} out mat4 frustum matrix will be written into\n * @param {vec3} eye Position of the viewer\n * @param {vec3} center Point the viewer is looking at\n * @param {vec3} up vec3 pointing up\n * @returns {mat4} out\n */\nmat4.lookAt = function (out, eye, center, up) {\n var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,\n eyex = eye[0],\n eyey = eye[1],\n eyez = eye[2],\n upx = up[0],\n upy = up[1],\n upz = up[2],\n centerx = center[0],\n centery = center[1],\n centerz = center[2];\n\n if (Math.abs(eyex - centerx) < GLMAT_EPSILON &&\n Math.abs(eyey - centery) < GLMAT_EPSILON &&\n Math.abs(eyez - centerz) < GLMAT_EPSILON) {\n return mat4.identity(out);\n }\n\n z0 = eyex - centerx;\n z1 = eyey - centery;\n z2 = eyez - centerz;\n\n len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);\n z0 *= len;\n z1 *= len;\n z2 *= len;\n\n x0 = upy * z2 - upz * z1;\n x1 = upz * z0 - upx * z2;\n x2 = upx * z1 - upy * z0;\n len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);\n if (!len) {\n x0 = 0;\n x1 = 0;\n x2 = 0;\n } else {\n len = 1 / len;\n x0 *= len;\n x1 *= len;\n x2 *= len;\n }\n\n y0 = z1 * x2 - z2 * x1;\n y1 = z2 * x0 - z0 * x2;\n y2 = z0 * x1 - z1 * x0;\n\n len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);\n if (!len) {\n y0 = 0;\n y1 = 0;\n y2 = 0;\n } else {\n len = 1 / len;\n y0 *= len;\n y1 *= len;\n y2 *= len;\n }\n\n out[0] = x0;\n out[1] = y0;\n out[2] = z0;\n out[3] = 0;\n out[4] = x1;\n out[5] = y1;\n out[6] = z1;\n out[7] = 0;\n out[8] = x2;\n out[9] = y2;\n out[10] = z2;\n out[11] = 0;\n out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);\n out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);\n out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);\n out[15] = 1;\n\n return out;\n};\n\n/**\n * Returns Frobenius norm of a mat4\n *\n * @param {mat4} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat4.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))\n};\n\nexport default mat4;","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_RANDOM, GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 3 Dimensional Vector\n * @name vec3\n */\n\nvar vec3 = {};\n\n/**\n * Creates a new, empty vec3\n *\n * @returns {vec3} a new 3D vector\n */\nvec3.create = function() {\n var out = new GLMAT_ARRAY_TYPE(3);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with values from an existing vector\n *\n * @param {vec3} a vector to clone\n * @returns {vec3} a new 3D vector\n */\nvec3.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(3);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Creates a new vec3 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} a new 3D vector\n */\nvec3.fromValues = function(x, y, z) {\n var out = new GLMAT_ARRAY_TYPE(3);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Copy the values from one vec3 to another\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the source vector\n * @returns {vec3} out\n */\nvec3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n return out;\n};\n\n/**\n * Set the components of a vec3 to the given values\n *\n * @param {vec3} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @returns {vec3} out\n */\nvec3.set = function(out, x, y, z) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n return out;\n};\n\n/**\n * Adds two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.subtract}\n * @function\n */\nvec3.sub = vec3.subtract;\n\n/**\n * Multiplies two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.multiply}\n * @function\n */\nvec3.mul = vec3.multiply;\n\n/**\n * Divides two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n return out;\n};\n\n/**\n * Alias for {@link vec3.divide}\n * @function\n */\nvec3.div = vec3.divide;\n\n/**\n * Returns the minimum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n return out;\n};\n\n/**\n * Scales a vec3 by a scalar number\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec3} out\n */\nvec3.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n return out;\n};\n\n/**\n * Adds two vec3's after scaling the second operand by a scalar value\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec3} out\n */\nvec3.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} distance between a and b\n */\nvec3.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.distance}\n * @function\n */\nvec3.dist = vec3.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec3.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredDistance}\n * @function\n */\nvec3.sqrDist = vec3.squaredDistance;\n\n/**\n * Calculates the length of a vec3\n *\n * @param {vec3} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec3.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return Math.sqrt(x*x + y*y + z*z);\n};\n\n/**\n * Alias for {@link vec3.length}\n * @function\n */\nvec3.len = vec3.length;\n\n/**\n * Calculates the squared length of a vec3\n *\n * @param {vec3} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec3.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n return x*x + y*y + z*z;\n};\n\n/**\n * Alias for {@link vec3.squaredLength}\n * @function\n */\nvec3.sqrLen = vec3.squaredLength;\n\n/**\n * Negates the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to negate\n * @returns {vec3} out\n */\nvec3.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to invert\n * @returns {vec3} out\n */\nvec3.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n return out;\n};\n\n/**\n * Normalize a vec3\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a vector to normalize\n * @returns {vec3} out\n */\nvec3.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2];\n var len = x*x + y*y + z*z;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec3's\n *\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec3.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n};\n\n/**\n * Computes the cross product of two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @returns {vec3} out\n */\nvec3.cross = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2],\n bx = b[0], by = b[1], bz = b[2];\n\n out[0] = ay * bz - az * by;\n out[1] = az * bx - ax * bz;\n out[2] = ax * by - ay * bx;\n return out;\n};\n\n/**\n * Performs a linear interpolation between two vec3's\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the first operand\n * @param {vec3} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec3} out\n */\nvec3.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec3} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec3} out\n */\nvec3.random = function (out, scale) {\n scale = scale || 1.0;\n\n var r = GLMAT_RANDOM() * 2.0 * Math.PI;\n var z = (GLMAT_RANDOM() * 2.0) - 1.0;\n var zScale = Math.sqrt(1.0-z*z) * scale;\n\n out[0] = Math.cos(r) * zScale;\n out[1] = Math.sin(r) * zScale;\n out[2] = z * scale;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat4.\n * 4th vector component is implicitly '1'\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2],\n w = m[3] * x + m[7] * y + m[11] * z + m[15];\n w = w || 1.0;\n out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;\n out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;\n out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;\n return out;\n};\n\n/**\n * Transforms the vec3 with a mat3.\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {mat4} m the 3x3 matrix to transform with\n * @returns {vec3} out\n */\nvec3.transformMat3 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2];\n out[0] = x * m[0] + y * m[3] + z * m[6];\n out[1] = x * m[1] + y * m[4] + z * m[7];\n out[2] = x * m[2] + y * m[5] + z * m[8];\n return out;\n};\n\n/**\n * Transforms the vec3 with a quat\n *\n * @param {vec3} out the receiving vector\n * @param {vec3} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec3} out\n */\nvec3.transformQuat = function(out, a, q) {\n // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations\n\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return out;\n};\n\n/**\n * Rotate a 3D vector around the x-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateX = function(out, a, b, c){\n var p = [], r=[];\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0];\n r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);\n r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);\n\n //translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n\n return out;\n};\n\n/**\n * Rotate a 3D vector around the y-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateY = function(out, a, b, c){\n var p = [], r=[];\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);\n r[1] = p[1];\n r[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);\n\n //translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n\n return out;\n};\n\n/**\n * Rotate a 3D vector around the z-axis\n * @param {vec3} out The receiving vec3\n * @param {vec3} a The vec3 point to rotate\n * @param {vec3} b The origin of the rotation\n * @param {Number} c The angle of rotation\n * @returns {vec3} out\n */\nvec3.rotateZ = function(out, a, b, c){\n var p = [], r=[];\n //Translate point to the origin\n p[0] = a[0] - b[0];\n p[1] = a[1] - b[1];\n p[2] = a[2] - b[2];\n\n //perform rotation\n r[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);\n r[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);\n r[2] = p[2];\n\n //translate to correct position\n out[0] = r[0] + b[0];\n out[1] = r[1] + b[1];\n out[2] = r[2] + b[2];\n\n return out;\n};\n\n/**\n * Perform some operation over an array of vec3s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec3.forEach = (function() {\n var vec = vec3.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 3;\n }\n\n if(!offset) {\n offset = 0;\n }\n\n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];\n }\n\n return a;\n };\n})();\n\n/**\n * Get the angle between two 3D vectors\n * @param {vec3} a The first operand\n * @param {vec3} b The second operand\n * @returns {Number} The angle in radians\n */\nvec3.angle = function(a, b) {\n\n var tempA = vec3.fromValues(a[0], a[1], a[2]);\n var tempB = vec3.fromValues(b[0], b[1], b[2]);\n\n vec3.normalize(tempA, tempA);\n vec3.normalize(tempB, tempB);\n\n var cosine = vec3.dot(tempA, tempB);\n\n if(cosine > 1.0){\n return 0;\n } else {\n return Math.acos(cosine);\n }\n};\n\nexport default vec3;","// TODO Resources like shader, texture, geometry reference management\n// Trace and find out which shader, texture, geometry can be destroyed\nimport Base from './core/Base';\nimport GLInfo from './core/GLInfo';\nimport glenum from './core/glenum';\nimport vendor from './core/vendor';\n\nimport Material from './Material';\nimport Vector2 from './math/Vector2';\nimport ProgramManager from './gpu/ProgramManager';\n\n// Light header\nimport Shader from './Shader';\n\nimport prezEssl from './shader/source/prez.glsl.js';\nShader['import'](prezEssl);\n\nimport mat4 from './glmatrix/mat4';\nimport vec3 from './glmatrix/vec3';\n\nvar mat4Create = mat4.create;\n\nvar errorShader = {};\n\nfunction defaultGetMaterial(renderable) {\n return renderable.material;\n}\nfunction defaultGetUniform(renderable, material, symbol) {\n return material.uniforms[symbol].value;\n}\nfunction defaultIsMaterialChanged(renderabled, prevRenderable, material, prevMaterial) {\n return material !== prevMaterial;\n}\nfunction defaultIfRender(renderable) {\n return true;\n}\n\nfunction noop() {}\n\nvar attributeBufferTypeMap = {\n float: glenum.FLOAT,\n byte: glenum.BYTE,\n ubyte: glenum.UNSIGNED_BYTE,\n short: glenum.SHORT,\n ushort: glenum.UNSIGNED_SHORT\n};\n\nfunction VertexArrayObject(availableAttributes, availableAttributeSymbols, indicesBuffer) {\n this.availableAttributes = availableAttributes;\n this.availableAttributeSymbols = availableAttributeSymbols;\n this.indicesBuffer = indicesBuffer;\n\n this.vao = null;\n}\n\nfunction PlaceHolderTexture(renderer) {\n var blankCanvas;\n var webglTexture;\n this.bind = function (renderer) {\n if (!blankCanvas) {\n // TODO Environment not support createCanvas.\n blankCanvas = vendor.createCanvas();\n blankCanvas.width = blankCanvas.height = 1;\n blankCanvas.getContext('2d');\n }\n\n var gl = renderer.gl;\n var firstBind = !webglTexture;\n if (firstBind) {\n webglTexture = gl.createTexture();\n }\n gl.bindTexture(gl.TEXTURE_2D, webglTexture);\n if (firstBind) {\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, blankCanvas);\n }\n };\n this.unbind = function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, null);\n };\n this.isRenderable = function () {\n return true;\n };\n}\n/**\n * @constructor clay.Renderer\n * @extends clay.core.Base\n */\nvar Renderer = Base.extend(function () {\n return /** @lends clay.Renderer# */ {\n\n /**\n * @type {HTMLCanvasElement}\n * @readonly\n */\n canvas: null,\n\n /**\n * Canvas width, set by resize method\n * @type {number}\n * @private\n */\n _width: 100,\n\n /**\n * Canvas width, set by resize method\n * @type {number}\n * @private\n */\n _height: 100,\n\n /**\n * Device pixel ratio, set by setDevicePixelRatio method\n * Specially for high defination display\n * @see http://www.khronos.org/webgl/wiki/HandlingHighDPI\n * @type {number}\n * @private\n */\n devicePixelRatio: (typeof window !== 'undefined' && window.devicePixelRatio) || 1.0,\n\n /**\n * Clear color\n * @type {number[]}\n */\n clearColor: [0.0, 0.0, 0.0, 0.0],\n\n /**\n * Default:\n * _gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT | _gl.STENCIL_BUFFER_BIT\n * @type {number}\n */\n clearBit: 17664,\n\n // Settings when getting context\n // http://www.khronos.org/registry/webgl/specs/latest/#2.4\n\n /**\n * If enable alpha, default true\n * @type {boolean}\n */\n alpha: true,\n /**\n * If enable depth buffer, default true\n * @type {boolean}\n */\n depth: true,\n /**\n * If enable stencil buffer, default false\n * @type {boolean}\n */\n stencil: false,\n /**\n * If enable antialias, default true\n * @type {boolean}\n */\n antialias: true,\n /**\n * If enable premultiplied alpha, default true\n * @type {boolean}\n */\n premultipliedAlpha: true,\n /**\n * If preserve drawing buffer, default false\n * @type {boolean}\n */\n preserveDrawingBuffer: false,\n /**\n * If throw context error, usually turned on in debug mode\n * @type {boolean}\n */\n throwError: true,\n /**\n * WebGL Context created from given canvas\n * @type {WebGLRenderingContext}\n */\n gl: null,\n /**\n * Renderer viewport, read-only, can be set by setViewport method\n * @type {Object}\n */\n viewport: {},\n\n /**\n * Max joint number\n * @type {number}\n */\n maxJointNumber: 20,\n\n // Set by FrameBuffer#bind\n __currentFrameBuffer: null,\n\n _viewportStack: [],\n _clearStack: [],\n\n _sceneRendering: null\n };\n}, function () {\n\n if (!this.canvas) {\n this.canvas = vendor.createCanvas();\n }\n var canvas = this.canvas;\n try {\n var opts = {\n alpha: this.alpha,\n depth: this.depth,\n stencil: this.stencil,\n antialias: this.antialias,\n premultipliedAlpha: this.premultipliedAlpha,\n preserveDrawingBuffer: this.preserveDrawingBuffer\n };\n\n this.gl = canvas.getContext('webgl', opts)\n || canvas.getContext('experimental-webgl', opts);\n\n if (!this.gl) {\n throw new Error();\n }\n\n this._glinfo = new GLInfo(this.gl);\n\n if (this.gl.targetRenderer) {\n console.error('Already created a renderer');\n }\n this.gl.targetRenderer = this;\n\n this.resize();\n }\n catch (e) {\n throw 'Error creating WebGL Context ' + e;\n }\n\n // Init managers\n this._programMgr = new ProgramManager(this);\n\n this._placeholderTexture = new PlaceHolderTexture(this);\n},\n/** @lends clay.Renderer.prototype. **/\n{\n /**\n * Resize the canvas\n * @param {number} width\n * @param {number} height\n */\n resize: function(width, height) {\n var canvas = this.canvas;\n // http://www.khronos.org/webgl/wiki/HandlingHighDPI\n // set the display size of the canvas.\n var dpr = this.devicePixelRatio;\n if (width != null) {\n if (canvas.style) {\n canvas.style.width = width + 'px';\n canvas.style.height = height + 'px';\n }\n // set the size of the drawingBuffer\n canvas.width = width * dpr;\n canvas.height = height * dpr;\n\n this._width = width;\n this._height = height;\n }\n else {\n this._width = canvas.width / dpr;\n this._height = canvas.height / dpr;\n }\n\n this.setViewport(0, 0, this._width, this._height);\n },\n\n /**\n * Get renderer width\n * @return {number}\n */\n getWidth: function () {\n return this._width;\n },\n\n /**\n * Get renderer height\n * @return {number}\n */\n getHeight: function () {\n return this._height;\n },\n\n /**\n * Get viewport aspect,\n * @return {number}\n */\n getViewportAspect: function () {\n var viewport = this.viewport;\n return viewport.width / viewport.height;\n },\n\n /**\n * Set devicePixelRatio\n * @param {number} devicePixelRatio\n */\n setDevicePixelRatio: function(devicePixelRatio) {\n this.devicePixelRatio = devicePixelRatio;\n this.resize(this._width, this._height);\n },\n\n /**\n * Get devicePixelRatio\n * @param {number} devicePixelRatio\n */\n getDevicePixelRatio: function () {\n return this.devicePixelRatio;\n },\n\n /**\n * Get WebGL extension\n * @param {string} name\n * @return {object}\n */\n getGLExtension: function (name) {\n return this._glinfo.getExtension(name);\n },\n\n /**\n * Get WebGL parameter\n * @param {string} name\n * @return {*}\n */\n getGLParameter: function (name) {\n return this._glinfo.getParameter(name);\n },\n\n /**\n * Set rendering viewport\n * @param {number|Object} x\n * @param {number} [y]\n * @param {number} [width]\n * @param {number} [height]\n * @param {number} [devicePixelRatio]\n * Defaultly use the renderere devicePixelRatio\n * It needs to be 1 when setViewport is called by frameBuffer\n *\n * @example\n * setViewport(0,0,width,height,1)\n * setViewport({\n * x: 0,\n * y: 0,\n * width: width,\n * height: height,\n * devicePixelRatio: 1\n * })\n */\n setViewport: function (x, y, width, height, dpr) {\n\n if (typeof x === 'object') {\n var obj = x;\n\n x = obj.x;\n y = obj.y;\n width = obj.width;\n height = obj.height;\n dpr = obj.devicePixelRatio;\n }\n dpr = dpr || this.devicePixelRatio;\n\n this.gl.viewport(\n x * dpr, y * dpr, width * dpr, height * dpr\n );\n // Use a fresh new object, not write property.\n this.viewport = {\n x: x,\n y: y,\n width: width,\n height: height,\n devicePixelRatio: dpr\n };\n },\n\n /**\n * Push current viewport into a stack\n */\n saveViewport: function () {\n this._viewportStack.push(this.viewport);\n },\n\n /**\n * Pop viewport from stack, restore in the renderer\n */\n restoreViewport: function () {\n if (this._viewportStack.length > 0) {\n this.setViewport(this._viewportStack.pop());\n }\n },\n\n /**\n * Push current clear into a stack\n */\n saveClear: function () {\n this._clearStack.push({\n clearBit: this.clearBit,\n clearColor: this.clearColor\n });\n },\n\n /**\n * Pop clear from stack, restore in the renderer\n */\n restoreClear: function () {\n if (this._clearStack.length > 0) {\n var opt = this._clearStack.pop();\n this.clearColor = opt.clearColor;\n this.clearBit = opt.clearBit;\n }\n },\n\n bindSceneRendering: function (scene) {\n this._sceneRendering = scene;\n },\n\n /**\n * Render the scene in camera to the screen or binded offline framebuffer\n * @param {clay.Scene} scene\n * @param {clay.Camera} camera\n * @param {boolean} [notUpdateScene] If not call the scene.update methods in the rendering, default true\n * @param {boolean} [preZ] If use preZ optimization, default false\n * @return {IRenderInfo}\n */\n render: function(scene, camera, notUpdateScene, preZ) {\n var _gl = this.gl;\n\n var clearColor = this.clearColor;\n\n if (this.clearBit) {\n\n // Must set depth and color mask true before clear\n _gl.colorMask(true, true, true, true);\n _gl.depthMask(true);\n var viewport = this.viewport;\n var needsScissor = false;\n var viewportDpr = viewport.devicePixelRatio;\n if (viewport.width !== this._width || viewport.height !== this._height\n || (viewportDpr && viewportDpr !== this.devicePixelRatio)\n || viewport.x || viewport.y\n ) {\n needsScissor = true;\n // http://stackoverflow.com/questions/11544608/how-to-clear-a-rectangle-area-in-webgl\n // Only clear the viewport\n _gl.enable(_gl.SCISSOR_TEST);\n _gl.scissor(viewport.x * viewportDpr, viewport.y * viewportDpr, viewport.width * viewportDpr, viewport.height * viewportDpr);\n }\n _gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);\n _gl.clear(this.clearBit);\n if (needsScissor) {\n _gl.disable(_gl.SCISSOR_TEST);\n }\n }\n\n // If the scene have been updated in the prepass like shadow map\n // There is no need to update it again\n if (!notUpdateScene) {\n scene.update(false);\n }\n scene.updateLights();\n\n camera = camera || scene.getMainCamera();\n if (!camera) {\n console.error('Can\\'t find camera in the scene.');\n return;\n }\n camera.update();\n var renderList = scene.updateRenderList(camera, true);\n\n this._sceneRendering = scene;\n\n var opaqueList = renderList.opaque;\n var transparentList = renderList.transparent;\n var sceneMaterial = scene.material;\n\n scene.trigger('beforerender', this, scene, camera, renderList);\n\n // Render pre z\n if (preZ) {\n this.renderPreZ(opaqueList, scene, camera);\n _gl.depthFunc(_gl.LEQUAL);\n }\n else {\n _gl.depthFunc(_gl.LESS);\n }\n\n // Update the depth of transparent list.\n var worldViewMat = mat4Create();\n var posViewSpace = vec3.create();\n for (var i = 0; i < transparentList.length; i++) {\n var renderable = transparentList[i];\n mat4.multiplyAffine(worldViewMat, camera.viewMatrix.array, renderable.worldTransform.array);\n vec3.transformMat4(posViewSpace, renderable.position.array, worldViewMat);\n renderable.__depth = posViewSpace[2];\n }\n\n // Render opaque list\n this.renderPass(opaqueList, camera, {\n getMaterial: function (renderable) {\n return sceneMaterial || renderable.material;\n },\n sortCompare: this.opaqueSortCompare\n });\n\n this.renderPass(transparentList, camera, {\n getMaterial: function (renderable) {\n return sceneMaterial || renderable.material;\n },\n sortCompare: this.transparentSortCompare\n });\n\n scene.trigger('afterrender', this, scene, camera, renderList);\n\n // Cleanup\n this._sceneRendering = null;\n },\n\n getProgram: function (renderable, renderMaterial, scene) {\n renderMaterial = renderMaterial || renderable.material;\n return this._programMgr.getProgram(renderable, renderMaterial, scene);\n },\n\n validateProgram: function (program) {\n if (program.__error) {\n var errorMsg = program.__error;\n if (errorShader[program.__uid__]) {\n return;\n }\n errorShader[program.__uid__] = true;\n\n if (this.throwError) {\n throw new Error(errorMsg);\n }\n else {\n this.trigger('error', errorMsg);\n }\n\n }\n\n },\n\n updatePrograms: function (list, scene, passConfig) {\n var getMaterial = (passConfig && passConfig.getMaterial) || defaultGetMaterial;\n scene = scene || null;\n for (var i = 0; i < list.length; i++) {\n var renderable = list[i];\n var renderMaterial = getMaterial.call(this, renderable);\n if (i > 0) {\n var prevRenderable = list[i - 1];\n var prevJointsLen = prevRenderable.joints ? prevRenderable.joints.length : 0;\n var jointsLen = renderable.joints ? renderable.joints.length : 0;\n // Keep program not change if joints, material, lightGroup are same of two renderables.\n if (jointsLen === prevJointsLen\n && renderable.material === prevRenderable.material\n && renderable.lightGroup === prevRenderable.lightGroup\n ) {\n renderable.__program = prevRenderable.__program;\n continue;\n }\n }\n\n var program = this._programMgr.getProgram(renderable, renderMaterial, scene);\n\n this.validateProgram(program);\n\n renderable.__program = program;\n }\n },\n\n /**\n * Render a single renderable list in camera in sequence\n * @param {clay.Renderable[]} list List of all renderables.\n * @param {clay.Camera} [camera] Camera provide view matrix and porjection matrix. It can be null.\n * @param {Object} [passConfig]\n * @param {Function} [passConfig.getMaterial] Get renderable material.\n * @param {Function} [passConfig.getUniform] Get material uniform value.\n * @param {Function} [passConfig.isMaterialChanged] If material changed.\n * @param {Function} [passConfig.beforeRender] Before render each renderable.\n * @param {Function} [passConfig.afterRender] After render each renderable\n * @param {Function} [passConfig.ifRender] If render the renderable.\n * @param {Function} [passConfig.sortCompare] Sort compare function.\n * @return {IRenderInfo}\n */\n renderPass: function(list, camera, passConfig) {\n this.trigger('beforerenderpass', this, list, camera, passConfig);\n\n passConfig = passConfig || {};\n passConfig.getMaterial = passConfig.getMaterial || defaultGetMaterial;\n passConfig.getUniform = passConfig.getUniform || defaultGetUniform;\n // PENDING Better solution?\n passConfig.isMaterialChanged = passConfig.isMaterialChanged || defaultIsMaterialChanged;\n passConfig.beforeRender = passConfig.beforeRender || noop;\n passConfig.afterRender = passConfig.afterRender || noop;\n\n var ifRenderObject = passConfig.ifRender || defaultIfRender;\n\n this.updatePrograms(list, this._sceneRendering, passConfig);\n if (passConfig.sortCompare) {\n list.sort(passConfig.sortCompare);\n }\n\n // Some common builtin uniforms\n var viewport = this.viewport;\n var vDpr = viewport.devicePixelRatio;\n var viewportUniform = [\n viewport.x * vDpr, viewport.y * vDpr,\n viewport.width * vDpr, viewport.height * vDpr\n ];\n var windowDpr = this.devicePixelRatio;\n var windowSizeUniform = this.__currentFrameBuffer\n ? [this.__currentFrameBuffer.getTextureWidth(), this.__currentFrameBuffer.getTextureHeight()]\n : [this._width * windowDpr, this._height * windowDpr];\n // DEPRECATED\n var viewportSizeUniform = [\n viewportUniform[2], viewportUniform[3]\n ];\n var time = Date.now();\n\n // Calculate view and projection matrix\n if (camera) {\n mat4.copy(matrices.VIEW, camera.viewMatrix.array);\n mat4.copy(matrices.PROJECTION, camera.projectionMatrix.array);\n mat4.copy(matrices.VIEWINVERSE, camera.worldTransform.array);\n }\n else {\n mat4.identity(matrices.VIEW);\n mat4.identity(matrices.PROJECTION);\n mat4.identity(matrices.VIEWINVERSE);\n }\n mat4.multiply(matrices.VIEWPROJECTION, matrices.PROJECTION, matrices.VIEW);\n mat4.invert(matrices.PROJECTIONINVERSE, matrices.PROJECTION);\n mat4.invert(matrices.VIEWPROJECTIONINVERSE, matrices.VIEWPROJECTION);\n\n var _gl = this.gl;\n var scene = this._sceneRendering;\n\n var prevMaterial;\n var prevProgram;\n var prevRenderable;\n\n // Status\n var depthTest, depthMask;\n var culling, cullFace, frontFace;\n var transparent;\n var drawID;\n var currentVAO;\n var materialTakesTextureSlot;\n\n // var vaoExt = this.getGLExtension('OES_vertex_array_object');\n // not use vaoExt, some platforms may mess it up.\n var vaoExt = null;\n\n for (var i = 0; i < list.length; i++) {\n var renderable = list[i];\n var isSceneNode = renderable.worldTransform != null;\n var worldM;\n\n if (!ifRenderObject(renderable)) {\n continue;\n }\n\n // Skinned mesh will transformed to joint space. Ignore the mesh transform\n if (isSceneNode) {\n worldM = (renderable.isSkinnedMesh && renderable.isSkinnedMesh())\n // TODO\n ? (renderable.offsetMatrix ? renderable.offsetMatrix.array :matrices.IDENTITY)\n : renderable.worldTransform.array;\n }\n var geometry = renderable.geometry;\n var material = passConfig.getMaterial.call(this, renderable);\n\n var program = renderable.__program;\n var shader = material.shader;\n\n var currentDrawID = geometry.__uid__ + '-' + program.__uid__;\n var drawIDChanged = currentDrawID !== drawID;\n drawID = currentDrawID;\n if (drawIDChanged && vaoExt) {\n // TODO Seems need to be bound to null immediately (or before bind another program?) if vao is changed\n vaoExt.bindVertexArrayOES(null);\n }\n if (isSceneNode) {\n mat4.copy(matrices.WORLD, worldM);\n mat4.multiply(matrices.WORLDVIEWPROJECTION, matrices.VIEWPROJECTION, worldM);\n mat4.multiplyAffine(matrices.WORLDVIEW, matrices.VIEW, worldM);\n if (shader.matrixSemantics.WORLDINVERSE ||\n shader.matrixSemantics.WORLDINVERSETRANSPOSE) {\n mat4.invert(matrices.WORLDINVERSE, worldM);\n }\n if (shader.matrixSemantics.WORLDVIEWINVERSE ||\n shader.matrixSemantics.WORLDVIEWINVERSETRANSPOSE) {\n mat4.invert(matrices.WORLDVIEWINVERSE, matrices.WORLDVIEW);\n }\n if (shader.matrixSemantics.WORLDVIEWPROJECTIONINVERSE ||\n shader.matrixSemantics.WORLDVIEWPROJECTIONINVERSETRANSPOSE) {\n mat4.invert(matrices.WORLDVIEWPROJECTIONINVERSE, matrices.WORLDVIEWPROJECTION);\n }\n }\n\n // Before render hook\n renderable.beforeRender && renderable.beforeRender(this);\n passConfig.beforeRender.call(this, renderable, material, prevMaterial);\n\n var programChanged = program !== prevProgram;\n if (programChanged) {\n // Set lights number\n program.bind(this);\n // Set some common uniforms\n program.setUniformOfSemantic(_gl, 'VIEWPORT', viewportUniform);\n program.setUniformOfSemantic(_gl, 'WINDOW_SIZE', windowSizeUniform);\n if (camera) {\n program.setUniformOfSemantic(_gl, 'NEAR', camera.near);\n program.setUniformOfSemantic(_gl, 'FAR', camera.far);\n }\n program.setUniformOfSemantic(_gl, 'DEVICEPIXELRATIO', vDpr);\n program.setUniformOfSemantic(_gl, 'TIME', time);\n // DEPRECATED\n program.setUniformOfSemantic(_gl, 'VIEWPORT_SIZE', viewportSizeUniform);\n\n // Set lights uniforms\n // TODO needs optimized\n if (scene) {\n scene.setLightUniforms(program, renderable.lightGroup, this);\n }\n }\n else {\n program = prevProgram;\n }\n\n // Program changes also needs reset the materials.\n if (programChanged || passConfig.isMaterialChanged(\n renderable, prevRenderable, material, prevMaterial\n )) {\n if (material.depthTest !== depthTest) {\n material.depthTest ? _gl.enable(_gl.DEPTH_TEST) : _gl.disable(_gl.DEPTH_TEST);\n depthTest = material.depthTest;\n }\n if (material.depthMask !== depthMask) {\n _gl.depthMask(material.depthMask);\n depthMask = material.depthMask;\n }\n if (material.transparent !== transparent) {\n material.transparent ? _gl.enable(_gl.BLEND) : _gl.disable(_gl.BLEND);\n transparent = material.transparent;\n }\n // TODO cache blending\n if (material.transparent) {\n if (material.blend) {\n material.blend(_gl);\n }\n else {\n // Default blend function\n _gl.blendEquationSeparate(_gl.FUNC_ADD, _gl.FUNC_ADD);\n _gl.blendFuncSeparate(_gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA);\n }\n }\n\n materialTakesTextureSlot = this._bindMaterial(\n renderable, material, program,\n prevRenderable || null, prevMaterial || null, prevProgram || null,\n passConfig.getUniform\n );\n prevMaterial = material;\n }\n\n var matrixSemanticKeys = shader.matrixSemanticKeys;\n\n if (isSceneNode) {\n for (var k = 0; k < matrixSemanticKeys.length; k++) {\n var semantic = matrixSemanticKeys[k];\n var semanticInfo = shader.matrixSemantics[semantic];\n var matrix = matrices[semantic];\n if (semanticInfo.isTranspose) {\n var matrixNoTranspose = matrices[semanticInfo.semanticNoTranspose];\n mat4.transpose(matrix, matrixNoTranspose);\n }\n program.setUniform(_gl, semanticInfo.type, semanticInfo.symbol, matrix);\n }\n }\n\n if (renderable.cullFace !== cullFace) {\n cullFace = renderable.cullFace;\n _gl.cullFace(cullFace);\n }\n if (renderable.frontFace !== frontFace) {\n frontFace = renderable.frontFace;\n _gl.frontFace(frontFace);\n }\n if (renderable.culling !== culling) {\n culling = renderable.culling;\n culling ? _gl.enable(_gl.CULL_FACE) : _gl.disable(_gl.CULL_FACE);\n }\n // TODO Not update skeleton in each renderable.\n this._updateSkeleton(renderable, program, materialTakesTextureSlot);\n if (drawIDChanged) {\n currentVAO = this._bindVAO(vaoExt, shader, geometry, program);\n }\n this._renderObject(renderable, currentVAO, program);\n\n // After render hook\n passConfig.afterRender(this, renderable);\n renderable.afterRender && renderable.afterRender(this);\n\n prevProgram = program;\n prevRenderable = renderable;\n }\n\n // TODO Seems need to be bound to null immediately if vao is changed?\n if (vaoExt) {\n vaoExt.bindVertexArrayOES(null);\n }\n\n this.trigger('afterrenderpass', this, list, camera, passConfig);\n },\n\n getMaxJointNumber: function () {\n return this.maxJointNumber;\n },\n\n _updateSkeleton: function (object, program, slot) {\n var _gl = this.gl;\n var skeleton = object.skeleton;\n // Set pose matrices of skinned mesh\n if (skeleton) {\n // TODO Update before culling.\n skeleton.update();\n if (object.joints.length > this.getMaxJointNumber()) {\n var skinMatricesTexture = skeleton.getSubSkinMatricesTexture(object.__uid__, object.joints);\n program.useTextureSlot(this, skinMatricesTexture, slot);\n program.setUniform(_gl, '1i', 'skinMatricesTexture', slot);\n program.setUniform(_gl, '1f', 'skinMatricesTextureSize', skinMatricesTexture.width);\n }\n else {\n var skinMatricesArray = skeleton.getSubSkinMatrices(object.__uid__, object.joints);\n program.setUniformOfSemantic(_gl, 'SKIN_MATRIX', skinMatricesArray);\n }\n }\n },\n\n _renderObject: function (renderable, vao, program) {\n var _gl = this.gl;\n var geometry = renderable.geometry;\n\n var glDrawMode = renderable.mode;\n if (glDrawMode == null) {\n glDrawMode = 0x0004;\n }\n\n var ext = null;\n var isInstanced = renderable.isInstancedMesh && renderable.isInstancedMesh();\n if (isInstanced) {\n ext = this.getGLExtension('ANGLE_instanced_arrays');\n if (!ext) {\n console.warn('Device not support ANGLE_instanced_arrays extension');\n return;\n }\n }\n\n var instancedAttrLocations;\n if (isInstanced) {\n instancedAttrLocations = this._bindInstancedAttributes(renderable, program, ext);\n }\n\n if (vao.indicesBuffer) {\n var uintExt = this.getGLExtension('OES_element_index_uint');\n var useUintExt = uintExt && (geometry.indices instanceof Uint32Array);\n var indicesType = useUintExt ? _gl.UNSIGNED_INT : _gl.UNSIGNED_SHORT;\n\n if (isInstanced) {\n ext.drawElementsInstancedANGLE(\n glDrawMode, vao.indicesBuffer.count, indicesType, 0, renderable.getInstanceCount()\n );\n }\n else {\n _gl.drawElements(glDrawMode, vao.indicesBuffer.count, indicesType, 0);\n }\n }\n else {\n if (isInstanced) {\n ext.drawArraysInstancedANGLE(glDrawMode, 0, geometry.vertexCount, renderable.getInstanceCount());\n }\n else {\n // FIXME Use vertex number in buffer\n // vertexCount may get the wrong value when geometry forget to mark dirty after update\n _gl.drawArrays(glDrawMode, 0, geometry.vertexCount);\n }\n }\n\n if (isInstanced) {\n for (var i = 0; i < instancedAttrLocations.length; i++) {\n _gl.disableVertexAttribArray(instancedAttrLocations[i]);\n }\n }\n },\n\n _bindInstancedAttributes: function (renderable, program, ext) {\n var _gl = this.gl;\n var instancedBuffers = renderable.getInstancedAttributesBuffers(this);\n var locations = [];\n\n for (var i = 0; i < instancedBuffers.length; i++) {\n var bufferObj = instancedBuffers[i];\n var location = program.getAttribLocation(_gl, bufferObj.symbol);\n if (location < 0) {\n continue;\n }\n\n var glType = attributeBufferTypeMap[bufferObj.type] || _gl.FLOAT;;\n _gl.enableVertexAttribArray(location); // TODO\n _gl.bindBuffer(_gl.ARRAY_BUFFER, bufferObj.buffer);\n _gl.vertexAttribPointer(location, bufferObj.size, glType, false, 0, 0);\n ext.vertexAttribDivisorANGLE(location, bufferObj.divisor);\n\n locations.push(location);\n }\n\n return locations;\n },\n\n _bindMaterial: function (renderable, material, program, prevRenderable, prevMaterial, prevProgram, getUniformValue) {\n var _gl = this.gl;\n // PENDING Same texture in different material take different slot?\n\n // May use shader of other material if shader code are same\n var sameProgram = prevProgram === program;\n\n var currentTextureSlot = program.currentTextureSlot();\n var enabledUniforms = material.getEnabledUniforms();\n var textureUniforms = material.getTextureUniforms();\n var placeholderTexture = this._placeholderTexture;\n\n for (var u = 0; u < textureUniforms.length; u++) {\n var symbol = textureUniforms[u];\n var uniformValue = getUniformValue(renderable, material, symbol);\n var uniformType = material.uniforms[symbol].type;\n // Not use `instanceof` to determine if a value is texture in Material#bind.\n // Use type instead, in some case texture may be in different namespaces.\n // TODO Duck type validate.\n if (uniformType === 't' && uniformValue) {\n // Reset slot\n uniformValue.__slot = -1;\n }\n else if (uniformType === 'tv') {\n for (var i = 0; i < uniformValue.length; i++) {\n if (uniformValue[i]) {\n uniformValue[i].__slot = -1;\n }\n }\n }\n }\n\n placeholderTexture.__slot = -1;\n\n // Set uniforms\n for (var u = 0; u < enabledUniforms.length; u++) {\n var symbol = enabledUniforms[u];\n var uniform = material.uniforms[symbol];\n var uniformValue = getUniformValue(renderable, material, symbol);\n var uniformType = uniform.type;\n var isTexture = uniformType === 't';\n\n if (isTexture) {\n if (!uniformValue || !uniformValue.isRenderable()) {\n uniformValue = placeholderTexture;\n }\n }\n // PENDING\n // When binding two materials with the same shader\n // Many uniforms will be be set twice even if they have the same value\n // So add a evaluation to see if the uniform is really needed to be set\n if (prevMaterial && sameProgram) {\n var prevUniformValue = getUniformValue(prevRenderable, prevMaterial, symbol);\n if (isTexture) {\n if (!prevUniformValue || !prevUniformValue.isRenderable()) {\n prevUniformValue = placeholderTexture;\n }\n }\n\n if (prevUniformValue === uniformValue) {\n if (isTexture) {\n // Still take the slot to make sure same texture in different materials have same slot.\n program.takeCurrentTextureSlot(this, null);\n }\n else if (uniformType === 'tv' && uniformValue) {\n for (var i = 0; i < uniformValue.length; i++) {\n program.takeCurrentTextureSlot(this, null);\n }\n }\n continue;\n }\n }\n\n if (uniformValue == null) {\n continue;\n }\n else if (isTexture) {\n if (uniformValue.__slot < 0) {\n var slot = program.currentTextureSlot();\n var res = program.setUniform(_gl, '1i', symbol, slot);\n if (res) { // Texture uniform is enabled\n program.takeCurrentTextureSlot(this, uniformValue);\n uniformValue.__slot = slot;\n }\n }\n // Multiple uniform use same texture..\n else {\n program.setUniform(_gl, '1i', symbol, uniformValue.__slot);\n }\n }\n else if (Array.isArray(uniformValue)) {\n if (uniformValue.length === 0) {\n continue;\n }\n // Texture Array\n if (uniformType === 'tv') {\n if (!program.hasUniform(symbol)) {\n continue;\n }\n\n var arr = [];\n for (var i = 0; i < uniformValue.length; i++) {\n var texture = uniformValue[i];\n\n if (texture.__slot < 0) {\n var slot = program.currentTextureSlot();\n arr.push(slot);\n program.takeCurrentTextureSlot(this, texture);\n texture.__slot = slot;\n }\n else {\n arr.push(texture.__slot);\n }\n }\n\n program.setUniform(_gl, '1iv', symbol, arr);\n }\n else {\n program.setUniform(_gl, uniform.type, symbol, uniformValue);\n }\n }\n else{\n program.setUniform(_gl, uniform.type, symbol, uniformValue);\n }\n }\n var newSlot = program.currentTextureSlot();\n // Texture slot maybe used out of material.\n program.resetTextureSlot(currentTextureSlot);\n return newSlot;\n },\n\n _bindVAO: function (vaoExt, shader, geometry, program) {\n var isStatic = !geometry.dynamic;\n var _gl = this.gl;\n\n var vaoId = this.__uid__ + '-' + program.__uid__;\n var vao = geometry.__vaoCache[vaoId];\n if (!vao) {\n var chunks = geometry.getBufferChunks(this);\n if (!chunks || !chunks.length) { // Empty mesh\n return;\n }\n var chunk = chunks[0];\n var attributeBuffers = chunk.attributeBuffers;\n var indicesBuffer = chunk.indicesBuffer;\n\n var availableAttributes = [];\n var availableAttributeSymbols = [];\n for (var a = 0; a < attributeBuffers.length; a++) {\n var attributeBufferInfo = attributeBuffers[a];\n var name = attributeBufferInfo.name;\n var semantic = attributeBufferInfo.semantic;\n var symbol;\n if (semantic) {\n var semanticInfo = shader.attributeSemantics[semantic];\n symbol = semanticInfo && semanticInfo.symbol;\n }\n else {\n symbol = name;\n }\n if (symbol && program.attributes[symbol]) {\n availableAttributes.push(attributeBufferInfo);\n availableAttributeSymbols.push(symbol);\n }\n }\n\n vao = new VertexArrayObject(\n availableAttributes,\n availableAttributeSymbols,\n indicesBuffer\n );\n\n if (isStatic) {\n geometry.__vaoCache[vaoId] = vao;\n }\n }\n\n var needsBindAttributes = true;\n\n // Create vertex object array cost a lot\n // So we don't use it on the dynamic object\n if (vaoExt && isStatic) {\n // Use vertex array object\n // http://blog.tojicode.com/2012/10/oesvertexarrayobject-extension.html\n if (vao.vao == null) {\n vao.vao = vaoExt.createVertexArrayOES();\n }\n else {\n needsBindAttributes = false;\n }\n vaoExt.bindVertexArrayOES(vao.vao);\n }\n\n var availableAttributes = vao.availableAttributes;\n var indicesBuffer = vao.indicesBuffer;\n\n if (needsBindAttributes) {\n var locationList = program.enableAttributes(this, vao.availableAttributeSymbols, (vaoExt && isStatic && vao));\n // Setting attributes;\n for (var a = 0; a < availableAttributes.length; a++) {\n var location = locationList[a];\n if (location === -1) {\n continue;\n }\n var attributeBufferInfo = availableAttributes[a];\n var buffer = attributeBufferInfo.buffer;\n var size = attributeBufferInfo.size;\n var glType = attributeBufferTypeMap[attributeBufferInfo.type] || _gl.FLOAT;\n\n _gl.bindBuffer(_gl.ARRAY_BUFFER, buffer);\n _gl.vertexAttribPointer(location, size, glType, false, 0, 0);\n }\n\n if (geometry.isUseIndices()) {\n _gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER, indicesBuffer.buffer);\n }\n }\n\n return vao;\n },\n\n renderPreZ: function (list, scene, camera) {\n var _gl = this.gl;\n var preZPassMaterial = this._prezMaterial || new Material({\n shader: new Shader(Shader.source('clay.prez.vertex'), Shader.source('clay.prez.fragment'))\n });\n this._prezMaterial = preZPassMaterial;\n\n _gl.colorMask(false, false, false, false);\n _gl.depthMask(true);\n\n // Status\n this.renderPass(list, camera, {\n ifRender: function (renderable) {\n return !renderable.ignorePreZ;\n },\n isMaterialChanged: function (renderable, prevRenderable) {\n var matA = renderable.material;\n var matB = prevRenderable.material;\n return matA.get('diffuseMap') !== matB.get('diffuseMap')\n || (matA.get('alphaCutoff') || 0) !== (matB.get('alphaCutoff') || 0);\n },\n getUniform: function (renderable, depthMaterial, symbol) {\n if (symbol === 'alphaMap') {\n return renderable.material.get('diffuseMap');\n }\n else if (symbol === 'alphaCutoff') {\n if (renderable.material.isDefined('fragment', 'ALPHA_TEST')\n && renderable.material.get('diffuseMap')\n ) {\n var alphaCutoff = renderable.material.get('alphaCutoff');\n return alphaCutoff || 0;\n }\n return 0;\n }\n else if (symbol === 'uvRepeat') {\n return renderable.material.get('uvRepeat');\n }\n else if (symbol === 'uvOffset') {\n return renderable.material.get('uvOffset');\n }\n else {\n return depthMaterial.get(symbol);\n }\n },\n getMaterial: function () {\n return preZPassMaterial;\n },\n sort: this.opaqueSortCompare\n });\n\n _gl.colorMask(true, true, true, true);\n _gl.depthMask(true);\n },\n\n /**\n * Dispose given scene, including all geometris, textures and shaders in the scene\n * @param {clay.Scene} scene\n */\n disposeScene: function(scene) {\n this.disposeNode(scene, true, true);\n scene.dispose();\n },\n\n /**\n * Dispose given node, including all geometries, textures and shaders attached on it or its descendant\n * @param {clay.Node} node\n * @param {boolean} [disposeGeometry=false] If dispose the geometries used in the descendant mesh\n * @param {boolean} [disposeTexture=false] If dispose the textures used in the descendant mesh\n */\n disposeNode: function(root, disposeGeometry, disposeTexture) {\n // Dettached from parent\n if (root.getParent()) {\n root.getParent().remove(root);\n }\n var disposedMap = {};\n root.traverse(function(node) {\n var material = node.material;\n if (node.geometry && disposeGeometry) {\n node.geometry.dispose(this);\n }\n if (disposeTexture && material && !disposedMap[material.__uid__]) {\n var textureUniforms = material.getTextureUniforms();\n for (var u = 0; u < textureUniforms.length; u++) {\n var uniformName = textureUniforms[u];\n var val = material.uniforms[uniformName].value;\n var uniformType = material.uniforms[uniformName].type;\n if (!val) {\n continue;\n }\n if (uniformType === 't') {\n val.dispose && val.dispose(this);\n }\n else if (uniformType === 'tv') {\n for (var k = 0; k < val.length; k++) {\n if (val[k]) {\n val[k].dispose && val[k].dispose(this);\n }\n }\n }\n }\n disposedMap[material.__uid__] = true;\n }\n // Particle system and AmbientCubemap light need to dispose\n if (node.dispose) {\n node.dispose(this);\n }\n }, this);\n },\n\n /**\n * Dispose given geometry\n * @param {clay.Geometry} geometry\n */\n disposeGeometry: function(geometry) {\n geometry.dispose(this);\n },\n\n /**\n * Dispose given texture\n * @param {clay.Texture} texture\n */\n disposeTexture: function(texture) {\n texture.dispose(this);\n },\n\n /**\n * Dispose given frame buffer\n * @param {clay.FrameBuffer} frameBuffer\n */\n disposeFrameBuffer: function(frameBuffer) {\n frameBuffer.dispose(this);\n },\n\n /**\n * Dispose renderer\n */\n dispose: function () {},\n\n /**\n * Convert screen coords to normalized device coordinates(NDC)\n * Screen coords can get from mouse event, it is positioned relative to canvas element\n * NDC can be used in ray casting with Camera.prototype.castRay methods\n *\n * @param {number} x\n * @param {number} y\n * @param {clay.Vector2} [out]\n * @return {clay.Vector2}\n */\n screenToNDC: function(x, y, out) {\n if (!out) {\n out = new Vector2();\n }\n // Invert y;\n y = this._height - y;\n\n var viewport = this.viewport;\n var arr = out.array;\n arr[0] = (x - viewport.x) / viewport.width;\n arr[0] = arr[0] * 2 - 1;\n arr[1] = (y - viewport.y) / viewport.height;\n arr[1] = arr[1] * 2 - 1;\n\n return out;\n }\n});\n\n/**\n * Opaque renderables compare function\n * @param {clay.Renderable} x\n * @param {clay.Renderable} y\n * @return {boolean}\n * @static\n */\nRenderer.opaqueSortCompare = Renderer.prototype.opaqueSortCompare = function(x, y) {\n // Priority renderOrder -> program -> material -> geometry\n if (x.renderOrder === y.renderOrder) {\n if (x.__program === y.__program) {\n if (x.material === y.material) {\n return x.geometry.__uid__ - y.geometry.__uid__;\n }\n return x.material.__uid__ - y.material.__uid__;\n }\n if (x.__program && y.__program) {\n return x.__program.__uid__ - y.__program.__uid__;\n }\n return 0;\n }\n return x.renderOrder - y.renderOrder;\n};\n\n/**\n * Transparent renderables compare function\n * @param {clay.Renderable} a\n * @param {clay.Renderable} b\n * @return {boolean}\n * @static\n */\nRenderer.transparentSortCompare = Renderer.prototype.transparentSortCompare = function(x, y) {\n // Priority renderOrder -> depth -> program -> material -> geometry\n\n if (x.renderOrder === y.renderOrder) {\n if (x.__depth === y.__depth) {\n if (x.__program === y.__program) {\n if (x.material === y.material) {\n return x.geometry.__uid__ - y.geometry.__uid__;\n }\n return x.material.__uid__ - y.material.__uid__;\n }\n if (x.__program && y.__program) {\n return x.__program.__uid__ - y.__program.__uid__;\n }\n return 0;\n }\n // Depth is negative\n // So farther object has smaller depth value\n return x.__depth - y.__depth;\n }\n return x.renderOrder - y.renderOrder;\n};\n\n// Temporary variables\nvar matrices = {\n IDENTITY: mat4Create(),\n\n WORLD: mat4Create(),\n VIEW: mat4Create(),\n PROJECTION: mat4Create(),\n WORLDVIEW: mat4Create(),\n VIEWPROJECTION: mat4Create(),\n WORLDVIEWPROJECTION: mat4Create(),\n\n WORLDINVERSE: mat4Create(),\n VIEWINVERSE: mat4Create(),\n PROJECTIONINVERSE: mat4Create(),\n WORLDVIEWINVERSE: mat4Create(),\n VIEWPROJECTIONINVERSE: mat4Create(),\n WORLDVIEWPROJECTIONINVERSE: mat4Create(),\n\n WORLDTRANSPOSE: mat4Create(),\n VIEWTRANSPOSE: mat4Create(),\n PROJECTIONTRANSPOSE: mat4Create(),\n WORLDVIEWTRANSPOSE: mat4Create(),\n VIEWPROJECTIONTRANSPOSE: mat4Create(),\n WORLDVIEWPROJECTIONTRANSPOSE: mat4Create(),\n WORLDINVERSETRANSPOSE: mat4Create(),\n VIEWINVERSETRANSPOSE: mat4Create(),\n PROJECTIONINVERSETRANSPOSE: mat4Create(),\n WORLDVIEWINVERSETRANSPOSE: mat4Create(),\n VIEWPROJECTIONINVERSETRANSPOSE: mat4Create(),\n WORLDVIEWPROJECTIONINVERSETRANSPOSE: mat4Create()\n};\n\n/**\n * @name clay.Renderer.COLOR_BUFFER_BIT\n * @type {number}\n */\nRenderer.COLOR_BUFFER_BIT = glenum.COLOR_BUFFER_BIT;\n/**\n * @name clay.Renderer.DEPTH_BUFFER_BIT\n * @type {number}\n */\nRenderer.DEPTH_BUFFER_BIT = glenum.DEPTH_BUFFER_BIT;\n/**\n * @name clay.Renderer.STENCIL_BUFFER_BIT\n * @type {number}\n */\nRenderer.STENCIL_BUFFER_BIT = glenum.STENCIL_BUFFER_BIT;\n\nexport default Renderer;\n","import vec3 from '../glmatrix/vec3';\n\n/**\n * @constructor\n * @alias clay.Vector3\n * @param {number} x\n * @param {number} y\n * @param {number} z\n */\nvar Vector3 = function(x, y, z) {\n\n x = x || 0;\n y = y || 0;\n z = z || 0;\n\n /**\n * Storage of Vector3, read and write of x, y, z will change the values in array\n * All methods also operate on the array instead of x, y, z components\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Vector3#\n */\n this.array = vec3.fromValues(x, y, z);\n\n /**\n * Dirty flag is used by the Node to determine\n * if the matrix is updated to latest\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Vector3#\n */\n this._dirty = true;\n};\n\nVector3.prototype = {\n\n constructor: Vector3,\n\n /**\n * Add b to self\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n add: function (b) {\n vec3.add(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y and z components\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @return {clay.Vector3}\n */\n set: function (x, y, z) {\n this.array[0] = x;\n this.array[1] = y;\n this.array[2] = z;\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y and z components from array\n * @param {Float32Array|number[]} arr\n * @return {clay.Vector3}\n */\n setArray: function (arr) {\n this.array[0] = arr[0];\n this.array[1] = arr[1];\n this.array[2] = arr[2];\n\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Vector3\n * @return {clay.Vector3}\n */\n clone: function () {\n return new Vector3(this.x, this.y, this.z);\n },\n\n /**\n * Copy from b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n copy: function (b) {\n vec3.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Cross product of self and b, written to a Vector3 out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n cross: function (a, b) {\n vec3.cross(this.array, a.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for distance\n * @param {clay.Vector3} b\n * @return {number}\n */\n dist: function (b) {\n return vec3.dist(this.array, b.array);\n },\n\n /**\n * Distance between self and b\n * @param {clay.Vector3} b\n * @return {number}\n */\n distance: function (b) {\n return vec3.distance(this.array, b.array);\n },\n\n /**\n * Alias for divide\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n div: function (b) {\n vec3.div(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Divide self by b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n divide: function (b) {\n vec3.divide(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Dot product of self and b\n * @param {clay.Vector3} b\n * @return {number}\n */\n dot: function (b) {\n return vec3.dot(this.array, b.array);\n },\n\n /**\n * Alias of length\n * @return {number}\n */\n len: function () {\n return vec3.len(this.array);\n },\n\n /**\n * Calculate the length\n * @return {number}\n */\n length: function () {\n return vec3.length(this.array);\n },\n /**\n * Linear interpolation between a and b\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @param {number} t\n * @return {clay.Vector3}\n */\n lerp: function (a, b, t) {\n vec3.lerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Minimum of self and b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n min: function (b) {\n vec3.min(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Maximum of self and b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n max: function (b) {\n vec3.max(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiply\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n mul: function (b) {\n vec3.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply self and b\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n multiply: function (b) {\n vec3.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Negate self\n * @return {clay.Vector3}\n */\n negate: function () {\n vec3.negate(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Normalize self\n * @return {clay.Vector3}\n */\n normalize: function () {\n vec3.normalize(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Generate random x, y, z components with a given scale\n * @param {number} scale\n * @return {clay.Vector3}\n */\n random: function (scale) {\n vec3.random(this.array, scale);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self\n * @param {number} scale\n * @return {clay.Vector3}\n */\n scale: function (s) {\n vec3.scale(this.array, this.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale b and add to self\n * @param {clay.Vector3} b\n * @param {number} scale\n * @return {clay.Vector3}\n */\n scaleAndAdd: function (b, s) {\n vec3.scaleAndAdd(this.array, this.array, b.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for squaredDistance\n * @param {clay.Vector3} b\n * @return {number}\n */\n sqrDist: function (b) {\n return vec3.sqrDist(this.array, b.array);\n },\n\n /**\n * Squared distance between self and b\n * @param {clay.Vector3} b\n * @return {number}\n */\n squaredDistance: function (b) {\n return vec3.squaredDistance(this.array, b.array);\n },\n\n /**\n * Alias for squaredLength\n * @return {number}\n */\n sqrLen: function () {\n return vec3.sqrLen(this.array);\n },\n\n /**\n * Squared length of self\n * @return {number}\n */\n squaredLength: function () {\n return vec3.squaredLength(this.array);\n },\n\n /**\n * Alias for subtract\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n sub: function (b) {\n vec3.sub(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Subtract b from self\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\n subtract: function (b) {\n vec3.subtract(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix3 m\n * @param {clay.Matrix3} m\n * @return {clay.Vector3}\n */\n transformMat3: function (m) {\n vec3.transformMat3(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix4 m\n * @param {clay.Matrix4} m\n * @return {clay.Vector3}\n */\n transformMat4: function (m) {\n vec3.transformMat4(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n /**\n * Transform self with a Quaternion q\n * @param {clay.Quaternion} q\n * @return {clay.Vector3}\n */\n transformQuat: function (q) {\n vec3.transformQuat(this.array, this.array, q.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Trasnform self into projection space with m\n * @param {clay.Matrix4} m\n * @return {clay.Vector3}\n */\n applyProjection: function (m) {\n var v = this.array;\n m = m.array;\n\n // Perspective projection\n if (m[15] === 0) {\n var w = -1 / v[2];\n v[0] = m[0] * v[0] * w;\n v[1] = m[5] * v[1] * w;\n v[2] = (m[10] * v[2] + m[14]) * w;\n }\n else {\n v[0] = m[0] * v[0] + m[12];\n v[1] = m[5] * v[1] + m[13];\n v[2] = m[10] * v[2] + m[14];\n }\n this._dirty = true;\n\n return this;\n },\n\n eulerFromQuat: function(q, order) {\n Vector3.eulerFromQuat(this, q, order);\n },\n\n eulerFromMat3: function (m, order) {\n Vector3.eulerFromMat3(this, m, order);\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\nvar defineProperty = Object.defineProperty;\n// Getter and Setter\nif (defineProperty) {\n\n var proto = Vector3.prototype;\n /**\n * @name x\n * @type {number}\n * @memberOf clay.Vector3\n * @instance\n */\n defineProperty(proto, 'x', {\n get: function () {\n return this.array[0];\n },\n set: function (value) {\n this.array[0] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name y\n * @type {number}\n * @memberOf clay.Vector3\n * @instance\n */\n defineProperty(proto, 'y', {\n get: function () {\n return this.array[1];\n },\n set: function (value) {\n this.array[1] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name z\n * @type {number}\n * @memberOf clay.Vector3\n * @instance\n */\n defineProperty(proto, 'z', {\n get: function () {\n return this.array[2];\n },\n set: function (value) {\n this.array[2] = value;\n this._dirty = true;\n }\n });\n}\n\n\n// Supply methods that are not in place\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.add = function(out, a, b) {\n vec3.add(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @return {clay.Vector3}\n */\nVector3.set = function(out, x, y, z) {\n vec3.set(out.array, x, y, z);\n out._dirty = true;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.copy = function(out, b) {\n vec3.copy(out.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.cross = function(out, a, b) {\n vec3.cross(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.dist = function(a, b) {\n return vec3.distance(a.array, b.array);\n};\n\n/**\n * @function\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.distance = Vector3.dist;\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.div = function(out, a, b) {\n vec3.divide(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.divide = Vector3.div;\n\n/**\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.dot = function(a, b) {\n return vec3.dot(a.array, b.array);\n};\n\n/**\n * @param {clay.Vector3} a\n * @return {number}\n */\nVector3.len = function(b) {\n return vec3.length(b.array);\n};\n\n// Vector3.length = Vector3.len;\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @param {number} t\n * @return {clay.Vector3}\n */\nVector3.lerp = function(out, a, b, t) {\n vec3.lerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.min = function(out, a, b) {\n vec3.min(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.max = function(out, a, b) {\n vec3.max(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.mul = function(out, a, b) {\n vec3.multiply(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.multiply = Vector3.mul;\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @return {clay.Vector3}\n */\nVector3.negate = function(out, a) {\n vec3.negate(out.array, a.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @return {clay.Vector3}\n */\nVector3.normalize = function(out, a) {\n vec3.normalize(out.array, a.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {number} scale\n * @return {clay.Vector3}\n */\nVector3.random = function(out, scale) {\n vec3.random(out.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {number} scale\n * @return {clay.Vector3}\n */\nVector3.scale = function(out, a, scale) {\n vec3.scale(out.array, a.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @param {number} scale\n * @return {clay.Vector3}\n */\nVector3.scaleAndAdd = function(out, a, b, scale) {\n vec3.scaleAndAdd(out.array, a.array, b.array, scale);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.sqrDist = function(a, b) {\n return vec3.sqrDist(a.array, b.array);\n};\n/**\n * @function\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {number}\n */\nVector3.squaredDistance = Vector3.sqrDist;\n/**\n * @param {clay.Vector3} a\n * @return {number}\n */\nVector3.sqrLen = function(a) {\n return vec3.sqrLen(a.array);\n};\n/**\n * @function\n * @param {clay.Vector3} a\n * @return {number}\n */\nVector3.squaredLength = Vector3.sqrLen;\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.sub = function(out, a, b) {\n vec3.subtract(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Vector3}\n */\nVector3.subtract = Vector3.sub;\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {Matrix3} m\n * @return {clay.Vector3}\n */\nVector3.transformMat3 = function(out, a, m) {\n vec3.transformMat3(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Matrix4} m\n * @return {clay.Vector3}\n */\nVector3.transformMat4 = function(out, a, m) {\n vec3.transformMat4(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {clay.Vector3} out\n * @param {clay.Vector3} a\n * @param {clay.Quaternion} q\n * @return {clay.Vector3}\n */\nVector3.transformQuat = function(out, a, q) {\n vec3.transformQuat(out.array, a.array, q.array);\n out._dirty = true;\n return out;\n};\n\nfunction clamp(val, min, max) {\n return val < min ? min : (val > max ? max : val);\n}\nvar atan2 = Math.atan2;\nvar asin = Math.asin;\nvar abs = Math.abs;\n/**\n * Convert quaternion to euler angle\n * Quaternion must be normalized\n * From three.js\n */\nVector3.eulerFromQuat = function (out, q, order) {\n out._dirty = true;\n q = q.array;\n\n var target = out.array;\n var x = q[0], y = q[1], z = q[2], w = q[3];\n var x2 = x * x;\n var y2 = y * y;\n var z2 = z * z;\n var w2 = w * w;\n\n var order = (order || 'XYZ').toUpperCase();\n\n switch (order) {\n case 'XYZ':\n target[0] = atan2(2 * (x * w - y * z), (w2 - x2 - y2 + z2));\n target[1] = asin(clamp(2 * (x * z + y * w), - 1, 1));\n target[2] = atan2(2 * (z * w - x * y), (w2 + x2 - y2 - z2));\n break;\n case 'YXZ':\n target[0] = asin(clamp(2 * (x * w - y * z), - 1, 1));\n target[1] = atan2(2 * (x * z + y * w), (w2 - x2 - y2 + z2));\n target[2] = atan2(2 * (x * y + z * w), (w2 - x2 + y2 - z2));\n break;\n case 'ZXY':\n target[0] = asin(clamp(2 * (x * w + y * z), - 1, 1));\n target[1] = atan2(2 * (y * w - z * x), (w2 - x2 - y2 + z2));\n target[2] = atan2(2 * (z * w - x * y), (w2 - x2 + y2 - z2));\n break;\n case 'ZYX':\n target[0] = atan2(2 * (x * w + z * y), (w2 - x2 - y2 + z2));\n target[1] = asin(clamp(2 * (y * w - x * z), - 1, 1));\n target[2] = atan2(2 * (x * y + z * w), (w2 + x2 - y2 - z2));\n break;\n case 'YZX':\n target[0] = atan2(2 * (x * w - z * y), (w2 - x2 + y2 - z2));\n target[1] = atan2(2 * (y * w - x * z), (w2 + x2 - y2 - z2));\n target[2] = asin(clamp(2 * (x * y + z * w), - 1, 1));\n break;\n case 'XZY':\n target[0] = atan2(2 * (x * w + y * z), (w2 - x2 + y2 - z2));\n target[1] = atan2(2 * (x * z + y * w), (w2 + x2 - y2 - z2));\n target[2] = asin(clamp(2 * (z * w - x * y), - 1, 1));\n break;\n default:\n console.warn('Unkown order: ' + order);\n }\n return out;\n};\n\n/**\n * Convert rotation matrix to euler angle\n * from three.js\n */\nVector3.eulerFromMat3 = function (out, m, order) {\n // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)\n var te = m.array;\n var m11 = te[0], m12 = te[3], m13 = te[6];\n var m21 = te[1], m22 = te[4], m23 = te[7];\n var m31 = te[2], m32 = te[5], m33 = te[8];\n var target = out.array;\n\n var order = (order || 'XYZ').toUpperCase();\n\n switch (order) {\n case 'XYZ':\n target[1] = asin(clamp(m13, -1, 1));\n if (abs(m13) < 0.99999) {\n target[0] = atan2(-m23, m33);\n target[2] = atan2(-m12, m11);\n }\n else {\n target[0] = atan2(m32, m22);\n target[2] = 0;\n }\n break;\n case 'YXZ':\n target[0] = asin(-clamp(m23, -1, 1));\n if (abs(m23) < 0.99999) {\n target[1] = atan2(m13, m33);\n target[2] = atan2(m21, m22);\n }\n else {\n target[1] = atan2(-m31, m11);\n target[2] = 0;\n }\n break;\n case 'ZXY':\n target[0] = asin(clamp(m32, -1, 1));\n if (abs(m32) < 0.99999) {\n target[1] = atan2(-m31, m33);\n target[2] = atan2(-m12, m22);\n }\n else {\n target[1] = 0;\n target[2] = atan2(m21, m11);\n }\n break;\n case 'ZYX':\n target[1] = asin(-clamp(m31, -1, 1));\n if (abs(m31) < 0.99999) {\n target[0] = atan2(m32, m33);\n target[2] = atan2(m21, m11);\n }\n else {\n target[0] = 0;\n target[2] = atan2(-m12, m22);\n }\n break;\n case 'YZX':\n target[2] = asin(clamp(m21, -1, 1));\n if (abs(m21) < 0.99999) {\n target[0] = atan2(-m23, m22);\n target[1] = atan2(-m31, m11);\n }\n else {\n target[0] = 0;\n target[1] = atan2(m13, m33);\n }\n break;\n case 'XZY':\n target[2] = asin(-clamp(m12, -1, 1));\n if (abs(m12) < 0.99999) {\n target[0] = atan2(m32, m22);\n target[1] = atan2(m13, m11);\n }\n else {\n target[0] = atan2(-m23, m33);\n target[1] = 0;\n }\n break;\n default:\n console.warn('Unkown order: ' + order);\n }\n out._dirty = true;\n\n return out;\n};\n\nObject.defineProperties(Vector3, {\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n POSITIVE_X: {\n get: function () {\n return new Vector3(1, 0, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n NEGATIVE_X: {\n get: function () {\n return new Vector3(-1, 0, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n POSITIVE_Y: {\n get: function () {\n return new Vector3(0, 1, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n NEGATIVE_Y: {\n get: function () {\n return new Vector3(0, -1, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n POSITIVE_Z: {\n get: function () {\n return new Vector3(0, 0, 1);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n */\n NEGATIVE_Z: {\n get: function () {\n return new Vector3(0, 0, -1);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n UP: {\n get: function () {\n return new Vector3(0, 1, 0);\n }\n },\n /**\n * @type {clay.Vector3}\n * @readOnly\n * @memberOf clay.Vector3\n */\n ZERO: {\n get: function () {\n return new Vector3();\n }\n }\n});\n\nexport default Vector3;\n","import Vector3 from './Vector3';\nimport vec3 from '../glmatrix/vec3';\n\nvar EPSILON = 1e-5;\n\n/**\n * @constructor\n * @alias clay.Ray\n * @param {clay.Vector3} [origin]\n * @param {clay.Vector3} [direction]\n */\nvar Ray = function (origin, direction) {\n /**\n * @type {clay.Vector3}\n */\n this.origin = origin || new Vector3();\n /**\n * @type {clay.Vector3}\n */\n this.direction = direction || new Vector3();\n};\n\nRay.prototype = {\n\n constructor: Ray,\n\n // http://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm\n /**\n * Calculate intersection point between ray and a give plane\n * @param {clay.Plane} plane\n * @param {clay.Vector3} [out]\n * @return {clay.Vector3}\n */\n intersectPlane: function (plane, out) {\n var pn = plane.normal.array;\n var d = plane.distance;\n var ro = this.origin.array;\n var rd = this.direction.array;\n\n var divider = vec3.dot(pn, rd);\n // ray is parallel to the plane\n if (divider === 0) {\n return null;\n }\n if (!out) {\n out = new Vector3();\n }\n var t = (vec3.dot(pn, ro) - d) / divider;\n vec3.scaleAndAdd(out.array, ro, rd, -t);\n out._dirty = true;\n return out;\n },\n\n /**\n * Mirror the ray against plane\n * @param {clay.Plane} plane\n */\n mirrorAgainstPlane: function (plane) {\n // Distance to plane\n var d = vec3.dot(plane.normal.array, this.direction.array);\n vec3.scaleAndAdd(this.direction.array, this.direction.array, plane.normal.array, -d * 2);\n this.direction._dirty = true;\n },\n\n distanceToPoint: (function () {\n var v = vec3.create();\n return function (point) {\n vec3.sub(v, point, this.origin.array);\n // Distance from projection point to origin\n var b = vec3.dot(v, this.direction.array);\n if (b < 0) {\n return vec3.distance(this.origin.array, point);\n }\n // Squared distance from center to origin\n var c2 = vec3.lenSquared(v);\n // Squared distance from center to projection point\n return Math.sqrt(c2 - b * b);\n };\n })(),\n\n /**\n * Calculate intersection point between ray and sphere\n * @param {clay.Vector3} center\n * @param {number} radius\n * @param {clay.Vector3} out\n * @return {clay.Vector3}\n */\n intersectSphere: (function () {\n var v = vec3.create();\n return function (center, radius, out) {\n var origin = this.origin.array;\n var direction = this.direction.array;\n center = center.array;\n vec3.sub(v, center, origin);\n // Distance from projection point to origin\n var b = vec3.dot(v, direction);\n // Squared distance from center to origin\n var c2 = vec3.squaredLength(v);\n // Squared distance from center to projection point\n var d2 = c2 - b * b;\n\n var r2 = radius * radius;\n // No intersection\n if (d2 > r2) {\n return;\n }\n\n var a = Math.sqrt(r2 - d2);\n // First intersect point\n var t0 = b - a;\n // Second intersect point\n var t1 = b + a;\n\n if (!out) {\n out = new Vector3();\n }\n if (t0 < 0) {\n if (t1 < 0) {\n return null;\n }\n else {\n vec3.scaleAndAdd(out.array, origin, direction, t1);\n return out;\n }\n }\n else {\n vec3.scaleAndAdd(out.array, origin, direction, t0);\n return out;\n }\n };\n })(),\n\n // http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/\n /**\n * Calculate intersection point between ray and bounding box\n * @param {clay.BoundingBox} bbox\n * @param {clay.Vector3}\n * @return {clay.Vector3}\n */\n intersectBoundingBox: function (bbox, out) {\n var dir = this.direction.array;\n var origin = this.origin.array;\n var min = bbox.min.array;\n var max = bbox.max.array;\n\n var invdirx = 1 / dir[0];\n var invdiry = 1 / dir[1];\n var invdirz = 1 / dir[2];\n\n var tmin, tmax, tymin, tymax, tzmin, tzmax;\n if (invdirx >= 0) {\n tmin = (min[0] - origin[0]) * invdirx;\n tmax = (max[0] - origin[0]) * invdirx;\n }\n else {\n tmax = (min[0] - origin[0]) * invdirx;\n tmin = (max[0] - origin[0]) * invdirx;\n }\n if (invdiry >= 0) {\n tymin = (min[1] - origin[1]) * invdiry;\n tymax = (max[1] - origin[1]) * invdiry;\n }\n else {\n tymax = (min[1] - origin[1]) * invdiry;\n tymin = (max[1] - origin[1]) * invdiry;\n }\n\n if ((tmin > tymax) || (tymin > tmax)) {\n return null;\n }\n\n if (tymin > tmin || tmin !== tmin) {\n tmin = tymin;\n }\n if (tymax < tmax || tmax !== tmax) {\n tmax = tymax;\n }\n\n if (invdirz >= 0) {\n tzmin = (min[2] - origin[2]) * invdirz;\n tzmax = (max[2] - origin[2]) * invdirz;\n }\n else {\n tzmax = (min[2] - origin[2]) * invdirz;\n tzmin = (max[2] - origin[2]) * invdirz;\n }\n\n if ((tmin > tzmax) || (tzmin > tmax)) {\n return null;\n }\n\n if (tzmin > tmin || tmin !== tmin) {\n tmin = tzmin;\n }\n if (tzmax < tmax || tmax !== tmax) {\n tmax = tzmax;\n }\n if (tmax < 0) {\n return null;\n }\n\n var t = tmin >= 0 ? tmin : tmax;\n\n if (!out) {\n out = new Vector3();\n }\n vec3.scaleAndAdd(out.array, origin, dir, t);\n return out;\n },\n\n // http://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm\n /**\n * Calculate intersection point between ray and three triangle vertices\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @param {clay.Vector3} c\n * @param {boolean} singleSided, CW triangle will be ignored\n * @param {clay.Vector3} [out]\n * @param {clay.Vector3} [barycenteric] barycentric coords\n * @return {clay.Vector3}\n */\n intersectTriangle: (function () {\n\n var eBA = vec3.create();\n var eCA = vec3.create();\n var AO = vec3.create();\n var vCross = vec3.create();\n\n return function (a, b, c, singleSided, out, barycenteric) {\n var dir = this.direction.array;\n var origin = this.origin.array;\n a = a.array;\n b = b.array;\n c = c.array;\n\n vec3.sub(eBA, b, a);\n vec3.sub(eCA, c, a);\n\n vec3.cross(vCross, eCA, dir);\n\n var det = vec3.dot(eBA, vCross);\n\n if (singleSided) {\n if (det > -EPSILON) {\n return null;\n }\n }\n else {\n if (det > -EPSILON && det < EPSILON) {\n return null;\n }\n }\n\n vec3.sub(AO, origin, a);\n var u = vec3.dot(vCross, AO) / det;\n if (u < 0 || u > 1) {\n return null;\n }\n\n vec3.cross(vCross, eBA, AO);\n var v = vec3.dot(dir, vCross) / det;\n\n if (v < 0 || v > 1 || (u + v > 1)) {\n return null;\n }\n\n vec3.cross(vCross, eBA, eCA);\n var t = -vec3.dot(AO, vCross) / det;\n\n if (t < 0) {\n return null;\n }\n\n if (!out) {\n out = new Vector3();\n }\n if (barycenteric) {\n Vector3.set(barycenteric, (1 - u - v), u, v);\n }\n vec3.scaleAndAdd(out.array, origin, dir, t);\n\n return out;\n };\n })(),\n\n /**\n * Apply an affine transform matrix to the ray\n * @return {clay.Matrix4} matrix\n */\n applyTransform: function (matrix) {\n Vector3.add(this.direction, this.direction, this.origin);\n Vector3.transformMat4(this.origin, this.origin, matrix);\n Vector3.transformMat4(this.direction, this.direction, matrix);\n\n Vector3.sub(this.direction, this.direction, this.origin);\n Vector3.normalize(this.direction, this.direction);\n },\n\n /**\n * Copy values from another ray\n * @param {clay.Ray} ray\n */\n copy: function (ray) {\n Vector3.copy(this.origin, ray.origin);\n Vector3.copy(this.direction, ray.direction);\n },\n\n /**\n * Clone a new ray\n * @return {clay.Ray}\n */\n clone: function () {\n var ray = new Ray();\n ray.copy(this);\n return ray;\n }\n};\n\nexport default Ray;\n","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_RANDOM, GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 4 Dimensional Vector\n * @name vec4\n */\n\nexport var vec4 = {};\n\n/**\n * Creates a new, empty vec4\n *\n * @returns {vec4} a new 4D vector\n */\nvec4.create = function() {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with values from an existing vector\n *\n * @param {vec4} a vector to clone\n * @returns {vec4} a new 4D vector\n */\nvec4.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Creates a new vec4 initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} a new 4D vector\n */\nvec4.fromValues = function(x, y, z, w) {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Copy the values from one vec4 to another\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the source vector\n * @returns {vec4} out\n */\nvec4.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set the components of a vec4 to the given values\n *\n * @param {vec4} out the receiving vector\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {vec4} out\n */\nvec4.set = function(out, x, y, z, w) {\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = w;\n return out;\n};\n\n/**\n * Adds two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.add = function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n out[2] = a[2] + b[2];\n out[3] = a[3] + b[3];\n return out;\n};\n\n/**\n * Subtracts vector b from vector a\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.subtract = function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n out[2] = a[2] - b[2];\n out[3] = a[3] - b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.subtract}\n * @function\n */\nvec4.sub = vec4.subtract;\n\n/**\n * Multiplies two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.multiply = function(out, a, b) {\n out[0] = a[0] * b[0];\n out[1] = a[1] * b[1];\n out[2] = a[2] * b[2];\n out[3] = a[3] * b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.multiply}\n * @function\n */\nvec4.mul = vec4.multiply;\n\n/**\n * Divides two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.divide = function(out, a, b) {\n out[0] = a[0] / b[0];\n out[1] = a[1] / b[1];\n out[2] = a[2] / b[2];\n out[3] = a[3] / b[3];\n return out;\n};\n\n/**\n * Alias for {@link vec4.divide}\n * @function\n */\nvec4.div = vec4.divide;\n\n/**\n * Returns the minimum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.min = function(out, a, b) {\n out[0] = Math.min(a[0], b[0]);\n out[1] = Math.min(a[1], b[1]);\n out[2] = Math.min(a[2], b[2]);\n out[3] = Math.min(a[3], b[3]);\n return out;\n};\n\n/**\n * Returns the maximum of two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {vec4} out\n */\nvec4.max = function(out, a, b) {\n out[0] = Math.max(a[0], b[0]);\n out[1] = Math.max(a[1], b[1]);\n out[2] = Math.max(a[2], b[2]);\n out[3] = Math.max(a[3], b[3]);\n return out;\n};\n\n/**\n * Scales a vec4 by a scalar number\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {vec4} out\n */\nvec4.scale = function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n out[2] = a[2] * b;\n out[3] = a[3] * b;\n return out;\n};\n\n/**\n * Adds two vec4's after scaling the second operand by a scalar value\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} scale the amount to scale b by before adding\n * @returns {vec4} out\n */\nvec4.scaleAndAdd = function(out, a, b, scale) {\n out[0] = a[0] + (b[0] * scale);\n out[1] = a[1] + (b[1] * scale);\n out[2] = a[2] + (b[2] * scale);\n out[3] = a[3] + (b[3] * scale);\n return out;\n};\n\n/**\n * Calculates the euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} distance between a and b\n */\nvec4.distance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.distance}\n * @function\n */\nvec4.dist = vec4.distance;\n\n/**\n * Calculates the squared euclidian distance between two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} squared distance between a and b\n */\nvec4.squaredDistance = function(a, b) {\n var x = b[0] - a[0],\n y = b[1] - a[1],\n z = b[2] - a[2],\n w = b[3] - a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredDistance}\n * @function\n */\nvec4.sqrDist = vec4.squaredDistance;\n\n/**\n * Calculates the length of a vec4\n *\n * @param {vec4} a vector to calculate length of\n * @returns {Number} length of a\n */\nvec4.length = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return Math.sqrt(x*x + y*y + z*z + w*w);\n};\n\n/**\n * Alias for {@link vec4.length}\n * @function\n */\nvec4.len = vec4.length;\n\n/**\n * Calculates the squared length of a vec4\n *\n * @param {vec4} a vector to calculate squared length of\n * @returns {Number} squared length of a\n */\nvec4.squaredLength = function (a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n return x*x + y*y + z*z + w*w;\n};\n\n/**\n * Alias for {@link vec4.squaredLength}\n * @function\n */\nvec4.sqrLen = vec4.squaredLength;\n\n/**\n * Negates the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to negate\n * @returns {vec4} out\n */\nvec4.negate = function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = -a[3];\n return out;\n};\n\n/**\n * Returns the inverse of the components of a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to invert\n * @returns {vec4} out\n */\nvec4.inverse = function(out, a) {\n out[0] = 1.0 / a[0];\n out[1] = 1.0 / a[1];\n out[2] = 1.0 / a[2];\n out[3] = 1.0 / a[3];\n return out;\n};\n\n/**\n * Normalize a vec4\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a vector to normalize\n * @returns {vec4} out\n */\nvec4.normalize = function(out, a) {\n var x = a[0],\n y = a[1],\n z = a[2],\n w = a[3];\n var len = x*x + y*y + z*z + w*w;\n if (len > 0) {\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n out[2] = a[2] * len;\n out[3] = a[3] * len;\n }\n return out;\n};\n\n/**\n * Calculates the dot product of two vec4's\n *\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @returns {Number} dot product of a and b\n */\nvec4.dot = function (a, b) {\n return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n};\n\n/**\n * Performs a linear interpolation between two vec4's\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the first operand\n * @param {vec4} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {vec4} out\n */\nvec4.lerp = function (out, a, b, t) {\n var ax = a[0],\n ay = a[1],\n az = a[2],\n aw = a[3];\n out[0] = ax + t * (b[0] - ax);\n out[1] = ay + t * (b[1] - ay);\n out[2] = az + t * (b[2] - az);\n out[3] = aw + t * (b[3] - aw);\n return out;\n};\n\n/**\n * Generates a random vector with the given scale\n *\n * @param {vec4} out the receiving vector\n * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned\n * @returns {vec4} out\n */\nvec4.random = function (out, scale) {\n scale = scale || 1.0;\n\n //TODO: This is a pretty awful way of doing this. Find something better.\n out[0] = GLMAT_RANDOM();\n out[1] = GLMAT_RANDOM();\n out[2] = GLMAT_RANDOM();\n out[3] = GLMAT_RANDOM();\n vec4.normalize(out, out);\n vec4.scale(out, out, scale);\n return out;\n};\n\n/**\n * Transforms the vec4 with a mat4.\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {mat4} m matrix to transform with\n * @returns {vec4} out\n */\nvec4.transformMat4 = function(out, a, m) {\n var x = a[0], y = a[1], z = a[2], w = a[3];\n out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;\n out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;\n out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;\n out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;\n return out;\n};\n\n/**\n * Transforms the vec4 with a quat\n *\n * @param {vec4} out the receiving vector\n * @param {vec4} a the vector to transform\n * @param {quat} q quaternion to transform with\n * @returns {vec4} out\n */\nvec4.transformQuat = function(out, a, q) {\n var x = a[0], y = a[1], z = a[2],\n qx = q[0], qy = q[1], qz = q[2], qw = q[3],\n\n // calculate quat * vec\n ix = qw * x + qy * z - qz * y,\n iy = qw * y + qz * x - qx * z,\n iz = qw * z + qx * y - qy * x,\n iw = -qx * x - qy * y - qz * z;\n\n // calculate result * inverse quat\n out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;\n out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;\n out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;\n return out;\n};\n\n/**\n * Perform some operation over an array of vec4s.\n *\n * @param {Array} a the array of vectors to iterate over\n * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed\n * @param {Number} offset Number of elements to skip at the beginning of the array\n * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array\n * @param {Function} fn Function to call for each vector in the array\n * @param {Object} [arg] additional argument to pass to fn\n * @returns {Array} a\n * @function\n */\nvec4.forEach = (function() {\n var vec = vec4.create();\n\n return function(a, stride, offset, count, fn, arg) {\n var i, l;\n if(!stride) {\n stride = 4;\n }\n\n if(!offset) {\n offset = 0;\n }\n\n if(count) {\n l = Math.min((count * stride) + offset, a.length);\n } else {\n l = a.length;\n }\n\n for(i = offset; i < l; i += stride) {\n vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];\n fn(vec, vec, arg);\n a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];\n }\n\n return a;\n };\n})();\n\nexport default vec4;","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 3x3 Matrix\n * @name mat3\n */\n\nvar mat3 = {};\n\n/**\n * Creates a new identity mat3\n *\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.create = function() {\n var out = new GLMAT_ARRAY_TYPE(9);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Copies the upper-left 3x3 values into the given mat3.\n *\n * @param {mat3} out the receiving 3x3 matrix\n * @param {mat4} a the source 4x4 matrix\n * @returns {mat3} out\n */\nmat3.fromMat4 = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[4];\n out[4] = a[5];\n out[5] = a[6];\n out[6] = a[8];\n out[7] = a[9];\n out[8] = a[10];\n return out;\n};\n\n/**\n * Creates a new mat3 initialized with values from an existing matrix\n *\n * @param {mat3} a matrix to clone\n * @returns {mat3} a new 3x3 matrix\n */\nmat3.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(9);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Copy the values from one mat3 to another\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Set a mat3 to the identity matrix\n *\n * @param {mat3} out the receiving matrix\n * @returns {mat3} out\n */\nmat3.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 0;\n out[4] = 1;\n out[5] = 0;\n out[6] = 0;\n out[7] = 0;\n out[8] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a01 = a[1], a02 = a[2], a12 = a[5];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a01;\n out[5] = a[7];\n out[6] = a02;\n out[7] = a12;\n } else {\n out[0] = a[0];\n out[1] = a[3];\n out[2] = a[6];\n out[3] = a[1];\n out[4] = a[4];\n out[5] = a[7];\n out[6] = a[2];\n out[7] = a[5];\n out[8] = a[8];\n }\n\n return out;\n};\n\n/**\n * Inverts a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.invert = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b01 = a22 * a11 - a12 * a21,\n b11 = -a22 * a10 + a12 * a20,\n b21 = a21 * a10 - a11 * a20,\n\n // Calculate the determinant\n det = a00 * b01 + a01 * b11 + a02 * b21;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = b01 * det;\n out[1] = (-a22 * a01 + a02 * a21) * det;\n out[2] = (a12 * a01 - a02 * a11) * det;\n out[3] = b11 * det;\n out[4] = (a22 * a00 - a02 * a20) * det;\n out[5] = (-a12 * a00 + a02 * a10) * det;\n out[6] = b21 * det;\n out[7] = (-a21 * a00 + a01 * a20) * det;\n out[8] = (a11 * a00 - a01 * a10) * det;\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the source matrix\n * @returns {mat3} out\n */\nmat3.adjoint = function(out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n out[0] = (a11 * a22 - a12 * a21);\n out[1] = (a02 * a21 - a01 * a22);\n out[2] = (a01 * a12 - a02 * a11);\n out[3] = (a12 * a20 - a10 * a22);\n out[4] = (a00 * a22 - a02 * a20);\n out[5] = (a02 * a10 - a00 * a12);\n out[6] = (a10 * a21 - a11 * a20);\n out[7] = (a01 * a20 - a00 * a21);\n out[8] = (a00 * a11 - a01 * a10);\n return out;\n};\n\n/**\n * Calculates the determinant of a mat3\n *\n * @param {mat3} a the source matrix\n * @returns {Number} determinant of a\n */\nmat3.determinant = function (a) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8];\n\n return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);\n};\n\n/**\n * Multiplies two mat3's\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the first operand\n * @param {mat3} b the second operand\n * @returns {mat3} out\n */\nmat3.multiply = function (out, a, b) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n b00 = b[0], b01 = b[1], b02 = b[2],\n b10 = b[3], b11 = b[4], b12 = b[5],\n b20 = b[6], b21 = b[7], b22 = b[8];\n\n out[0] = b00 * a00 + b01 * a10 + b02 * a20;\n out[1] = b00 * a01 + b01 * a11 + b02 * a21;\n out[2] = b00 * a02 + b01 * a12 + b02 * a22;\n\n out[3] = b10 * a00 + b11 * a10 + b12 * a20;\n out[4] = b10 * a01 + b11 * a11 + b12 * a21;\n out[5] = b10 * a02 + b11 * a12 + b12 * a22;\n\n out[6] = b20 * a00 + b21 * a10 + b22 * a20;\n out[7] = b20 * a01 + b21 * a11 + b22 * a21;\n out[8] = b20 * a02 + b21 * a12 + b22 * a22;\n return out;\n};\n\n/**\n * Alias for {@link mat3.multiply}\n * @function\n */\nmat3.mul = mat3.multiply;\n\n/**\n * Translate a mat3 by the given vector\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to translate\n * @param {vec2} v vector to translate by\n * @returns {mat3} out\n */\nmat3.translate = function(out, a, v) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n x = v[0], y = v[1];\n\n out[0] = a00;\n out[1] = a01;\n out[2] = a02;\n\n out[3] = a10;\n out[4] = a11;\n out[5] = a12;\n\n out[6] = x * a00 + y * a10 + a20;\n out[7] = x * a01 + y * a11 + a21;\n out[8] = x * a02 + y * a12 + a22;\n return out;\n};\n\n/**\n * Rotates a mat3 by the given angle\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat3} out\n */\nmat3.rotate = function (out, a, rad) {\n var a00 = a[0], a01 = a[1], a02 = a[2],\n a10 = a[3], a11 = a[4], a12 = a[5],\n a20 = a[6], a21 = a[7], a22 = a[8],\n\n s = Math.sin(rad),\n c = Math.cos(rad);\n\n out[0] = c * a00 + s * a10;\n out[1] = c * a01 + s * a11;\n out[2] = c * a02 + s * a12;\n\n out[3] = c * a10 - s * a00;\n out[4] = c * a11 - s * a01;\n out[5] = c * a12 - s * a02;\n\n out[6] = a20;\n out[7] = a21;\n out[8] = a22;\n return out;\n};\n\n/**\n * Scales the mat3 by the dimensions in the given vec2\n *\n * @param {mat3} out the receiving matrix\n * @param {mat3} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat3} out\n **/\nmat3.scale = function(out, a, v) {\n var x = v[0], y = v[1];\n\n out[0] = x * a[0];\n out[1] = x * a[1];\n out[2] = x * a[2];\n\n out[3] = y * a[3];\n out[4] = y * a[4];\n out[5] = y * a[5];\n\n out[6] = a[6];\n out[7] = a[7];\n out[8] = a[8];\n return out;\n};\n\n/**\n * Copies the values from a mat2d into a mat3\n *\n * @param {mat3} out the receiving matrix\n * @param {mat2d} a the matrix to copy\n * @returns {mat3} out\n **/\nmat3.fromMat2d = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = 0;\n\n out[3] = a[2];\n out[4] = a[3];\n out[5] = 0;\n\n out[6] = a[4];\n out[7] = a[5];\n out[8] = 1;\n return out;\n};\n\n/**\n* Calculates a 3x3 matrix from the given quaternion\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {quat} q Quaternion to create matrix from\n*\n* @returns {mat3} out\n*/\nmat3.fromQuat = function (out, q) {\n var x = q[0], y = q[1], z = q[2], w = q[3],\n x2 = x + x,\n y2 = y + y,\n z2 = z + z,\n\n xx = x * x2,\n yx = y * x2,\n yy = y * y2,\n zx = z * x2,\n zy = z * y2,\n zz = z * z2,\n wx = w * x2,\n wy = w * y2,\n wz = w * z2;\n\n out[0] = 1 - yy - zz;\n out[3] = yx - wz;\n out[6] = zx + wy;\n\n out[1] = yx + wz;\n out[4] = 1 - xx - zz;\n out[7] = zy - wx;\n\n out[2] = zx - wy;\n out[5] = zy + wx;\n out[8] = 1 - xx - yy;\n\n return out;\n};\n\n/**\n* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n*\n* @param {mat3} out mat3 receiving operation result\n* @param {mat4} a Mat4 to derive the normal matrix from\n*\n* @returns {mat3} out\n*/\nmat3.normalFromMat4 = function (out, a) {\n var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],\n a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],\n a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],\n a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n // Calculate the determinant\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;\n out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;\n out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;\n\n out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;\n out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;\n out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;\n\n out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;\n out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;\n out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;\n\n return out;\n};\n\n/**\n * Returns Frobenius norm of a mat3\n *\n * @param {mat3} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat3.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))\n};\n\n\nexport default mat3;","\n\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\nimport vec3 from './vec3';\nimport vec4 from './vec4';\nimport mat3 from './mat3';\n\n\n/**\n * @class Quaternion\n * @name quat\n */\n\nvar quat = {};\n\n/**\n * Creates a new identity quat\n *\n * @returns {quat} a new quaternion\n */\nquat.create = function() {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quaternion to represent the shortest rotation from one\n * vector to another.\n *\n * Both vectors are assumed to be unit length.\n *\n * @param {quat} out the receiving quaternion.\n * @param {vec3} a the initial vector\n * @param {vec3} b the destination vector\n * @returns {quat} out\n */\nquat.rotationTo = (function() {\n var tmpvec3 = vec3.create();\n var xUnitVec3 = vec3.fromValues(1,0,0);\n var yUnitVec3 = vec3.fromValues(0,1,0);\n\n return function(out, a, b) {\n var dot = vec3.dot(a, b);\n if (dot < -0.999999) {\n vec3.cross(tmpvec3, xUnitVec3, a);\n if (vec3.length(tmpvec3) < 0.000001)\n vec3.cross(tmpvec3, yUnitVec3, a);\n vec3.normalize(tmpvec3, tmpvec3);\n quat.setAxisAngle(out, tmpvec3, Math.PI);\n return out;\n } else if (dot > 0.999999) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n } else {\n vec3.cross(tmpvec3, a, b);\n out[0] = tmpvec3[0];\n out[1] = tmpvec3[1];\n out[2] = tmpvec3[2];\n out[3] = 1 + dot;\n return quat.normalize(out, out);\n }\n };\n})();\n\n/**\n * Sets the specified quaternion with values corresponding to the given\n * axes. Each axis is a vec3 and is expected to be unit length and\n * perpendicular to all other specified axes.\n *\n * @param {vec3} view the vector representing the viewing direction\n * @param {vec3} right the vector representing the local \"right\" direction\n * @param {vec3} up the vector representing the local \"up\" direction\n * @returns {quat} out\n */\nquat.setAxes = (function() {\n var matr = mat3.create();\n\n return function(out, view, right, up) {\n matr[0] = right[0];\n matr[3] = right[1];\n matr[6] = right[2];\n\n matr[1] = up[0];\n matr[4] = up[1];\n matr[7] = up[2];\n\n matr[2] = -view[0];\n matr[5] = -view[1];\n matr[8] = -view[2];\n\n return quat.normalize(out, quat.fromMat3(out, matr));\n };\n})();\n\n/**\n * Creates a new quat initialized with values from an existing quaternion\n *\n * @param {quat} a quaternion to clone\n * @returns {quat} a new quaternion\n * @function\n */\nquat.clone = vec4.clone;\n\n/**\n * Creates a new quat initialized with the given values\n *\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} a new quaternion\n * @function\n */\nquat.fromValues = vec4.fromValues;\n\n/**\n * Copy the values from one quat to another\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the source quaternion\n * @returns {quat} out\n * @function\n */\nquat.copy = vec4.copy;\n\n/**\n * Set the components of a quat to the given values\n *\n * @param {quat} out the receiving quaternion\n * @param {Number} x X component\n * @param {Number} y Y component\n * @param {Number} z Z component\n * @param {Number} w W component\n * @returns {quat} out\n * @function\n */\nquat.set = vec4.set;\n\n/**\n * Set a quat to the identity quaternion\n *\n * @param {quat} out the receiving quaternion\n * @returns {quat} out\n */\nquat.identity = function(out) {\n out[0] = 0;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Sets a quat from the given angle and rotation axis,\n * then returns it.\n *\n * @param {quat} out the receiving quaternion\n * @param {vec3} axis the axis around which to rotate\n * @param {Number} rad the angle in radians\n * @returns {quat} out\n **/\nquat.setAxisAngle = function(out, axis, rad) {\n rad = rad * 0.5;\n var s = Math.sin(rad);\n out[0] = s * axis[0];\n out[1] = s * axis[1];\n out[2] = s * axis[2];\n out[3] = Math.cos(rad);\n return out;\n};\n\n/**\n * Adds two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n * @function\n */\nquat.add = vec4.add;\n\n/**\n * Multiplies two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {quat} out\n */\nquat.multiply = function(out, a, b) {\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n out[0] = ax * bw + aw * bx + ay * bz - az * by;\n out[1] = ay * bw + aw * by + az * bx - ax * bz;\n out[2] = az * bw + aw * bz + ax * by - ay * bx;\n out[3] = aw * bw - ax * bx - ay * by - az * bz;\n return out;\n};\n\n/**\n * Alias for {@link quat.multiply}\n * @function\n */\nquat.mul = quat.multiply;\n\n/**\n * Scales a quat by a scalar number\n *\n * @param {quat} out the receiving vector\n * @param {quat} a the vector to scale\n * @param {Number} b amount to scale the vector by\n * @returns {quat} out\n * @function\n */\nquat.scale = vec4.scale;\n\n/**\n * Rotates a quaternion by the given angle about the X axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateX = function (out, a, rad) {\n rad *= 0.5;\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + aw * bx;\n out[1] = ay * bw + az * bx;\n out[2] = az * bw - ay * bx;\n out[3] = aw * bw - ax * bx;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Y axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateY = function (out, a, rad) {\n rad *= 0.5;\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n by = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw - az * by;\n out[1] = ay * bw + aw * by;\n out[2] = az * bw + ax * by;\n out[3] = aw * bw - ay * by;\n return out;\n};\n\n/**\n * Rotates a quaternion by the given angle about the Z axis\n *\n * @param {quat} out quat receiving operation result\n * @param {quat} a quat to rotate\n * @param {number} rad angle (in radians) to rotate\n * @returns {quat} out\n */\nquat.rotateZ = function (out, a, rad) {\n rad *= 0.5;\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bz = Math.sin(rad), bw = Math.cos(rad);\n\n out[0] = ax * bw + ay * bz;\n out[1] = ay * bw - ax * bz;\n out[2] = az * bw + aw * bz;\n out[3] = aw * bw - az * bz;\n return out;\n};\n\n/**\n * Calculates the W component of a quat from the X, Y, and Z components.\n * Assumes that quaternion is 1 unit in length.\n * Any existing W component will be ignored.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate W component of\n * @returns {quat} out\n */\nquat.calculateW = function (out, a) {\n var x = a[0], y = a[1], z = a[2];\n\n out[0] = x;\n out[1] = y;\n out[2] = z;\n out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));\n return out;\n};\n\n/**\n * Calculates the dot product of two quat's\n *\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @returns {Number} dot product of a and b\n * @function\n */\nquat.dot = vec4.dot;\n\n/**\n * Performs a linear interpolation between two quat's\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n * @function\n */\nquat.lerp = vec4.lerp;\n\n/**\n * Performs a spherical linear interpolation between two quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a the first operand\n * @param {quat} b the second operand\n * @param {Number} t interpolation amount between the two inputs\n * @returns {quat} out\n */\nquat.slerp = function (out, a, b, t) {\n // benchmarks:\n // http://jsperf.com/quaternion-slerp-implementations\n\n var ax = a[0], ay = a[1], az = a[2], aw = a[3],\n bx = b[0], by = b[1], bz = b[2], bw = b[3];\n\n var omega, cosom, sinom, scale0, scale1;\n\n // calc cosine\n cosom = ax * bx + ay * by + az * bz + aw * bw;\n // adjust signs (if necessary)\n if ( cosom < 0.0 ) {\n cosom = -cosom;\n bx = - bx;\n by = - by;\n bz = - bz;\n bw = - bw;\n }\n // calculate coefficients\n if ( (1.0 - cosom) > 0.000001 ) {\n // standard case (slerp)\n omega = Math.acos(cosom);\n sinom = Math.sin(omega);\n scale0 = Math.sin((1.0 - t) * omega) / sinom;\n scale1 = Math.sin(t * omega) / sinom;\n } else {\n // \"from\" and \"to\" quaternions are very close\n // ... so we can do a linear interpolation\n scale0 = 1.0 - t;\n scale1 = t;\n }\n // calculate final values\n out[0] = scale0 * ax + scale1 * bx;\n out[1] = scale0 * ay + scale1 * by;\n out[2] = scale0 * az + scale1 * bz;\n out[3] = scale0 * aw + scale1 * bw;\n\n return out;\n};\n\n/**\n * Calculates the inverse of a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate inverse of\n * @returns {quat} out\n */\nquat.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,\n invDot = dot ? 1.0/dot : 0;\n\n // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0\n\n out[0] = -a0*invDot;\n out[1] = -a1*invDot;\n out[2] = -a2*invDot;\n out[3] = a3*invDot;\n return out;\n};\n\n/**\n * Calculates the conjugate of a quat\n * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quat to calculate conjugate of\n * @returns {quat} out\n */\nquat.conjugate = function (out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Calculates the length of a quat\n *\n * @param {quat} a vector to calculate length of\n * @returns {Number} length of a\n * @function\n */\nquat.length = vec4.length;\n\n/**\n * Alias for {@link quat.length}\n * @function\n */\nquat.len = quat.length;\n\n/**\n * Calculates the squared length of a quat\n *\n * @param {quat} a vector to calculate squared length of\n * @returns {Number} squared length of a\n * @function\n */\nquat.squaredLength = vec4.squaredLength;\n\n/**\n * Alias for {@link quat.squaredLength}\n * @function\n */\nquat.sqrLen = quat.squaredLength;\n\n/**\n * Normalize a quat\n *\n * @param {quat} out the receiving quaternion\n * @param {quat} a quaternion to normalize\n * @returns {quat} out\n * @function\n */\nquat.normalize = vec4.normalize;\n\n/**\n * Creates a quaternion from the given 3x3 rotation matrix.\n *\n * NOTE: The resultant quaternion is not normalized, so you should be sure\n * to renormalize the quaternion yourself where necessary.\n *\n * @param {quat} out the receiving quaternion\n * @param {mat3} m rotation matrix\n * @returns {quat} out\n * @function\n */\nquat.fromMat3 = function(out, m) {\n // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes\n // article \"Quaternion Calculus and Fast Animation\".\n var fTrace = m[0] + m[4] + m[8];\n var fRoot;\n\n if ( fTrace > 0.0 ) {\n // |w| > 1/2, may as well choose w > 1/2\n fRoot = Math.sqrt(fTrace + 1.0); // 2w\n out[3] = 0.5 * fRoot;\n fRoot = 0.5/fRoot; // 1/(4w)\n out[0] = (m[5]-m[7])*fRoot;\n out[1] = (m[6]-m[2])*fRoot;\n out[2] = (m[1]-m[3])*fRoot;\n } else {\n // |w| <= 1/2\n var i = 0;\n if ( m[4] > m[0] )\n i = 1;\n if ( m[8] > m[i*3+i] )\n i = 2;\n var j = (i+1)%3;\n var k = (i+2)%3;\n\n fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);\n out[i] = 0.5 * fRoot;\n fRoot = 0.5 / fRoot;\n out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;\n out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;\n out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;\n }\n\n return out;\n};\n\nexport default quat;","import mat4 from '../glmatrix/mat4';\nimport vec3 from '../glmatrix/vec3';\nimport quat from '../glmatrix/quat';\nimport mat3 from '../glmatrix/mat3';\nimport Vector3 from './Vector3';\n\n/**\n * @constructor\n * @alias clay.Matrix4\n */\nvar Matrix4 = function() {\n\n this._axisX = new Vector3();\n this._axisY = new Vector3();\n this._axisZ = new Vector3();\n\n /**\n * Storage of Matrix4\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Matrix4#\n */\n this.array = mat4.create();\n\n /**\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Matrix4#\n */\n this._dirty = true;\n};\n\nMatrix4.prototype = {\n\n constructor: Matrix4,\n\n /**\n * Set components from array\n * @param {Float32Array|number[]} arr\n */\n setArray: function (arr) {\n for (var i = 0; i < this.array.length; i++) {\n this.array[i] = arr[i];\n }\n this._dirty = true;\n return this;\n },\n /**\n * Calculate the adjugate of self, in-place\n * @return {clay.Matrix4}\n */\n adjoint: function() {\n mat4.adjoint(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Matrix4\n * @return {clay.Matrix4}\n */\n clone: function() {\n return (new Matrix4()).copy(this);\n },\n\n /**\n * Copy from b\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\n copy: function(a) {\n mat4.copy(this.array, a.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate matrix determinant\n * @return {number}\n */\n determinant: function() {\n return mat4.determinant(this.array);\n },\n\n /**\n * Set upper 3x3 part from quaternion\n * @param {clay.Quaternion} q\n * @return {clay.Matrix4}\n */\n fromQuat: function(q) {\n mat4.fromQuat(this.array, q.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set from a quaternion rotation and a vector translation\n * @param {clay.Quaternion} q\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\n fromRotationTranslation: function(q, v) {\n mat4.fromRotationTranslation(this.array, q.array, v.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set from Matrix2d, it is used when converting a 2d shape to 3d space.\n * In 3d space it is equivalent to ranslate on xy plane and rotate about z axis\n * @param {clay.Matrix2d} m2d\n * @return {clay.Matrix4}\n */\n fromMat2d: function(m2d) {\n Matrix4.fromMat2d(this, m2d);\n return this;\n },\n\n /**\n * Set from frustum bounds\n * @param {number} left\n * @param {number} right\n * @param {number} bottom\n * @param {number} top\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\n frustum: function (left, right, bottom, top, near, far) {\n mat4.frustum(this.array, left, right, bottom, top, near, far);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set to a identity matrix\n * @return {clay.Matrix4}\n */\n identity: function() {\n mat4.identity(this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Invert self\n * @return {clay.Matrix4}\n */\n invert: function() {\n mat4.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set as a matrix with the given eye position, focal point, and up axis\n * @param {clay.Vector3} eye\n * @param {clay.Vector3} center\n * @param {clay.Vector3} up\n * @return {clay.Matrix4}\n */\n lookAt: function(eye, center, up) {\n mat4.lookAt(this.array, eye.array, center.array, up.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for mutiply\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\n mul: function(b) {\n mat4.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\n mulLeft: function(a) {\n mat4.mul(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply self and b\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\n multiply: function(b) {\n mat4.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply a and self, a is on the left\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\n multiplyLeft: function(a) {\n mat4.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set as a orthographic projection matrix\n * @param {number} left\n * @param {number} right\n * @param {number} bottom\n * @param {number} top\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\n ortho: function(left, right, bottom, top, near, far) {\n mat4.ortho(this.array, left, right, bottom, top, near, far);\n this._dirty = true;\n return this;\n },\n /**\n * Set as a perspective projection matrix\n * @param {number} fovy\n * @param {number} aspect\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\n perspective: function(fovy, aspect, near, far) {\n mat4.perspective(this.array, fovy, aspect, near, far);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by rad about axis.\n * Equal to right-multiply a rotaion matrix\n * @param {number} rad\n * @param {clay.Vector3} axis\n * @return {clay.Matrix4}\n */\n rotate: function(rad, axis) {\n mat4.rotate(this.array, this.array, rad, axis.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about X axis.\n * Equal to right-multiply a rotaion matrix\n * @param {number} rad\n * @return {clay.Matrix4}\n */\n rotateX: function(rad) {\n mat4.rotateX(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about Y axis.\n * Equal to right-multiply a rotaion matrix\n * @param {number} rad\n * @return {clay.Matrix4}\n */\n rotateY: function(rad) {\n mat4.rotateY(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about Z axis.\n * Equal to right-multiply a rotaion matrix\n * @param {number} rad\n * @return {clay.Matrix4}\n */\n rotateZ: function(rad) {\n mat4.rotateZ(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self by s\n * Equal to right-multiply a scale matrix\n * @param {clay.Vector3} s\n * @return {clay.Matrix4}\n */\n scale: function(v) {\n mat4.scale(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Translate self by v.\n * Equal to right-multiply a translate matrix\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\n translate: function(v) {\n mat4.translate(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transpose self, in-place.\n * @return {clay.Matrix2}\n */\n transpose: function() {\n mat4.transpose(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Decompose a matrix to SRT\n * @param {clay.Vector3} [scale]\n * @param {clay.Quaternion} rotation\n * @param {clay.Vector} position\n * @see http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.matrix.decompose.aspx\n */\n decomposeMatrix: (function() {\n\n var x = vec3.create();\n var y = vec3.create();\n var z = vec3.create();\n\n var m3 = mat3.create();\n\n return function(scale, rotation, position) {\n\n var el = this.array;\n vec3.set(x, el[0], el[1], el[2]);\n vec3.set(y, el[4], el[5], el[6]);\n vec3.set(z, el[8], el[9], el[10]);\n\n var sx = vec3.length(x);\n var sy = vec3.length(y);\n var sz = vec3.length(z);\n\n // if determine is negative, we need to invert one scale\n var det = this.determinant();\n if (det < 0) {\n sx = -sx;\n }\n\n if (scale) {\n scale.set(sx, sy, sz);\n }\n\n position.set(el[12], el[13], el[14]);\n\n mat3.fromMat4(m3, el);\n // Not like mat4, mat3 in glmatrix seems to be row-based\n // Seems fixed in gl-matrix 2.2.2\n // https://github.com/toji/gl-matrix/issues/114\n // mat3.transpose(m3, m3);\n\n m3[0] /= sx;\n m3[1] /= sx;\n m3[2] /= sx;\n\n m3[3] /= sy;\n m3[4] /= sy;\n m3[5] /= sy;\n\n m3[6] /= sz;\n m3[7] /= sz;\n m3[8] /= sz;\n\n quat.fromMat3(rotation.array, m3);\n quat.normalize(rotation.array, rotation.array);\n\n rotation._dirty = true;\n position._dirty = true;\n };\n })(),\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\nvar defineProperty = Object.defineProperty;\n\nif (defineProperty) {\n var proto = Matrix4.prototype;\n /**\n * Z Axis of local transform\n * @name z\n * @type {clay.Vector3}\n * @memberOf clay.Matrix4\n * @instance\n */\n defineProperty(proto, 'z', {\n get: function () {\n var el = this.array;\n this._axisZ.set(el[8], el[9], el[10]);\n return this._axisZ;\n },\n set: function (v) {\n // TODO Here has a problem\n // If only set an item of vector will not work\n var el = this.array;\n v = v.array;\n el[8] = v[0];\n el[9] = v[1];\n el[10] = v[2];\n\n this._dirty = true;\n }\n });\n\n /**\n * Y Axis of local transform\n * @name y\n * @type {clay.Vector3}\n * @memberOf clay.Matrix4\n * @instance\n */\n defineProperty(proto, 'y', {\n get: function () {\n var el = this.array;\n this._axisY.set(el[4], el[5], el[6]);\n return this._axisY;\n },\n set: function (v) {\n var el = this.array;\n v = v.array;\n el[4] = v[0];\n el[5] = v[1];\n el[6] = v[2];\n\n this._dirty = true;\n }\n });\n\n /**\n * X Axis of local transform\n * @name x\n * @type {clay.Vector3}\n * @memberOf clay.Matrix4\n * @instance\n */\n defineProperty(proto, 'x', {\n get: function () {\n var el = this.array;\n this._axisX.set(el[0], el[1], el[2]);\n return this._axisX;\n },\n set: function (v) {\n var el = this.array;\n v = v.array;\n el[0] = v[0];\n el[1] = v[1];\n el[2] = v[2];\n\n this._dirty = true;\n }\n })\n}\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\nMatrix4.adjoint = function(out, a) {\n mat4.adjoint(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\nMatrix4.copy = function(out, a) {\n mat4.copy(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} a\n * @return {number}\n */\nMatrix4.determinant = function(a) {\n return mat4.determinant(a.array);\n};\n\n/**\n * @param {clay.Matrix4} out\n * @return {clay.Matrix4}\n */\nMatrix4.identity = function(out) {\n mat4.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {number} left\n * @param {number} right\n * @param {number} bottom\n * @param {number} top\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\nMatrix4.ortho = function(out, left, right, bottom, top, near, far) {\n mat4.ortho(out.array, left, right, bottom, top, near, far);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {number} fovy\n * @param {number} aspect\n * @param {number} near\n * @param {number} far\n * @return {clay.Matrix4}\n */\nMatrix4.perspective = function(out, fovy, aspect, near, far) {\n mat4.perspective(out.array, fovy, aspect, near, far);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Vector3} eye\n * @param {clay.Vector3} center\n * @param {clay.Vector3} up\n * @return {clay.Matrix4}\n */\nMatrix4.lookAt = function(out, eye, center, up) {\n mat4.lookAt(out.array, eye.array, center.array, up.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\nMatrix4.invert = function(out, a) {\n mat4.invert(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\nMatrix4.mul = function(out, a, b) {\n mat4.mul(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {clay.Matrix4} b\n * @return {clay.Matrix4}\n */\nMatrix4.multiply = Matrix4.mul;\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Quaternion} q\n * @return {clay.Matrix4}\n */\nMatrix4.fromQuat = function(out, q) {\n mat4.fromQuat(out.array, q.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Quaternion} q\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\nMatrix4.fromRotationTranslation = function(out, q, v) {\n mat4.fromRotationTranslation(out.array, q.array, v.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} m4\n * @param {clay.Matrix2d} m2d\n * @return {clay.Matrix4}\n */\nMatrix4.fromMat2d = function(m4, m2d) {\n m4._dirty = true;\n var m2d = m2d.array;\n var m4 = m4.array;\n\n m4[0] = m2d[0];\n m4[4] = m2d[2];\n m4[12] = m2d[4];\n\n m4[1] = m2d[1];\n m4[5] = m2d[3];\n m4[13] = m2d[5];\n\n return m4;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {number} rad\n * @param {clay.Vector3} axis\n * @return {clay.Matrix4}\n */\nMatrix4.rotate = function(out, a, rad, axis) {\n mat4.rotate(out.array, a.array, rad, axis.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {number} rad\n * @return {clay.Matrix4}\n */\nMatrix4.rotateX = function(out, a, rad) {\n mat4.rotateX(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {number} rad\n * @return {clay.Matrix4}\n */\nMatrix4.rotateY = function(out, a, rad) {\n mat4.rotateY(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {number} rad\n * @return {clay.Matrix4}\n */\nMatrix4.rotateZ = function(out, a, rad) {\n mat4.rotateZ(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\nMatrix4.scale = function(out, a, v) {\n mat4.scale(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix4}\n */\nMatrix4.transpose = function(out, a) {\n mat4.transpose(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix4} out\n * @param {clay.Matrix4} a\n * @param {clay.Vector3} v\n * @return {clay.Matrix4}\n */\nMatrix4.translate = function(out, a, v) {\n mat4.translate(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\nexport default Matrix4;\n","import quat from '../glmatrix/quat';\nimport mat3 from '../glmatrix/mat3';\n\n/**\n * @constructor\n * @alias clay.Quaternion\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n */\nvar Quaternion = function (x, y, z, w) {\n\n x = x || 0;\n y = y || 0;\n z = z || 0;\n w = w === undefined ? 1 : w;\n\n /**\n * Storage of Quaternion, read and write of x, y, z, w will change the values in array\n * All methods also operate on the array instead of x, y, z, w components\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Quaternion#\n */\n this.array = quat.fromValues(x, y, z, w);\n\n /**\n * Dirty flag is used by the Node to determine\n * if the matrix is updated to latest\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Quaternion#\n */\n this._dirty = true;\n};\n\nQuaternion.prototype = {\n\n constructor: Quaternion,\n\n /**\n * Add b to self\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\n add: function (b) {\n quat.add(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate the w component from x, y, z component\n * @return {clay.Quaternion}\n */\n calculateW: function () {\n quat.calculateW(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y and z components\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n * @return {clay.Quaternion}\n */\n set: function (x, y, z, w) {\n this.array[0] = x;\n this.array[1] = y;\n this.array[2] = z;\n this.array[3] = w;\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y, z and w components from array\n * @param {Float32Array|number[]} arr\n * @return {clay.Quaternion}\n */\n setArray: function (arr) {\n this.array[0] = arr[0];\n this.array[1] = arr[1];\n this.array[2] = arr[2];\n this.array[3] = arr[3];\n\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Quaternion\n * @return {clay.Quaternion}\n */\n clone: function () {\n return new Quaternion(this.x, this.y, this.z, this.w);\n },\n\n /**\n * Calculates the conjugate of self If the quaternion is normalized,\n * this function is faster than invert and produces the same result.\n *\n * @return {clay.Quaternion}\n */\n conjugate: function () {\n quat.conjugate(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Copy from b\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\n copy: function (b) {\n quat.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Dot product of self and b\n * @param {clay.Quaternion} b\n * @return {number}\n */\n dot: function (b) {\n return quat.dot(this.array, b.array);\n },\n\n /**\n * Set from the given 3x3 rotation matrix\n * @param {clay.Matrix3} m\n * @return {clay.Quaternion}\n */\n fromMat3: function (m) {\n quat.fromMat3(this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set from the given 4x4 rotation matrix\n * The 4th column and 4th row will be droped\n * @param {clay.Matrix4} m\n * @return {clay.Quaternion}\n */\n fromMat4: (function () {\n var m3 = mat3.create();\n return function (m) {\n mat3.fromMat4(m3, m.array);\n // TODO Not like mat4, mat3 in glmatrix seems to be row-based\n mat3.transpose(m3, m3);\n quat.fromMat3(this.array, m3);\n this._dirty = true;\n return this;\n };\n })(),\n\n /**\n * Set to identity quaternion\n * @return {clay.Quaternion}\n */\n identity: function () {\n quat.identity(this.array);\n this._dirty = true;\n return this;\n },\n /**\n * Invert self\n * @return {clay.Quaternion}\n */\n invert: function () {\n quat.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n /**\n * Alias of length\n * @return {number}\n */\n len: function () {\n return quat.len(this.array);\n },\n\n /**\n * Calculate the length\n * @return {number}\n */\n length: function () {\n return quat.length(this.array);\n },\n\n /**\n * Linear interpolation between a and b\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @param {number} t\n * @return {clay.Quaternion}\n */\n lerp: function (a, b, t) {\n quat.lerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiply\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\n mul: function (b) {\n quat.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\n mulLeft: function (a) {\n quat.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply self and b\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\n multiply: function (b) {\n quat.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply a and self\n * Quaternion mutiply is not commutative, so the result of mutiplyLeft is different with multiply.\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\n multiplyLeft: function (a) {\n quat.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Normalize self\n * @return {clay.Quaternion}\n */\n normalize: function () {\n quat.normalize(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about X axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\n rotateX: function (rad) {\n quat.rotateX(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about Y axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\n rotateY: function (rad) {\n quat.rotateY(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian about Z axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\n rotateZ: function (rad) {\n quat.rotateZ(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Sets self to represent the shortest rotation from Vector3 a to Vector3 b.\n * a and b needs to be normalized\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Quaternion}\n */\n rotationTo: function (a, b) {\n quat.rotationTo(this.array, a.array, b.array);\n this._dirty = true;\n return this;\n },\n /**\n * Sets self with values corresponding to the given axes\n * @param {clay.Vector3} view\n * @param {clay.Vector3} right\n * @param {clay.Vector3} up\n * @return {clay.Quaternion}\n */\n setAxes: function (view, right, up) {\n quat.setAxes(this.array, view.array, right.array, up.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Sets self with a rotation axis and rotation angle\n * @param {clay.Vector3} axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\n setAxisAngle: function (axis, rad) {\n quat.setAxisAngle(this.array, axis.array, rad);\n this._dirty = true;\n return this;\n },\n /**\n * Perform spherical linear interpolation between a and b\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @param {number} t\n * @return {clay.Quaternion}\n */\n slerp: function (a, b, t) {\n quat.slerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for squaredLength\n * @return {number}\n */\n sqrLen: function () {\n return quat.sqrLen(this.array);\n },\n\n /**\n * Squared length of self\n * @return {number}\n */\n squaredLength: function () {\n return quat.squaredLength(this.array);\n },\n\n /**\n * Set from euler\n * @param {clay.Vector3} v\n * @param {String} order\n */\n fromEuler: function (v, order) {\n return Quaternion.fromEuler(this, v, order);\n },\n\n toString: function () {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\nvar defineProperty = Object.defineProperty;\n// Getter and Setter\nif (defineProperty) {\n\n var proto = Quaternion.prototype;\n /**\n * @name x\n * @type {number}\n * @memberOf clay.Quaternion\n * @instance\n */\n defineProperty(proto, 'x', {\n get: function () {\n return this.array[0];\n },\n set: function (value) {\n this.array[0] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name y\n * @type {number}\n * @memberOf clay.Quaternion\n * @instance\n */\n defineProperty(proto, 'y', {\n get: function () {\n return this.array[1];\n },\n set: function (value) {\n this.array[1] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name z\n * @type {number}\n * @memberOf clay.Quaternion\n * @instance\n */\n defineProperty(proto, 'z', {\n get: function () {\n return this.array[2];\n },\n set: function (value) {\n this.array[2] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name w\n * @type {number}\n * @memberOf clay.Quaternion\n * @instance\n */\n defineProperty(proto, 'w', {\n get: function () {\n return this.array[3];\n },\n set: function (value) {\n this.array[3] = value;\n this._dirty = true;\n }\n });\n}\n\n// Supply methods that are not in place\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\nQuaternion.add = function (out, a, b) {\n quat.add(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n * @return {clay.Quaternion}\n */\nQuaternion.set = function (out, x, y, z, w) {\n quat.set(out.array, x, y, z, w);\n out._dirty = true;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\nQuaternion.copy = function (out, b) {\n quat.copy(out.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\nQuaternion.calculateW = function (out, a) {\n quat.calculateW(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\nQuaternion.conjugate = function (out, a) {\n quat.conjugate(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @return {clay.Quaternion}\n */\nQuaternion.identity = function (out) {\n quat.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\nQuaternion.invert = function (out, a) {\n quat.invert(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @return {number}\n */\nQuaternion.dot = function (a, b) {\n return quat.dot(a.array, b.array);\n};\n\n/**\n * @param {clay.Quaternion} a\n * @return {number}\n */\nQuaternion.len = function (a) {\n return quat.length(a.array);\n};\n\n// Quaternion.length = Quaternion.len;\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @param {number} t\n * @return {clay.Quaternion}\n */\nQuaternion.lerp = function (out, a, b, t) {\n quat.lerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @param {number} t\n * @return {clay.Quaternion}\n */\nQuaternion.slerp = function (out, a, b, t) {\n quat.slerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\nQuaternion.mul = function (out, a, b) {\n quat.multiply(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {clay.Quaternion} b\n * @return {clay.Quaternion}\n */\nQuaternion.multiply = Quaternion.mul;\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {number} rad\n * @return {clay.Quaternion}\n */\nQuaternion.rotateX = function (out, a, rad) {\n quat.rotateX(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {number} rad\n * @return {clay.Quaternion}\n */\nQuaternion.rotateY = function (out, a, rad) {\n quat.rotateY(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @param {number} rad\n * @return {clay.Quaternion}\n */\nQuaternion.rotateZ = function (out, a, rad) {\n quat.rotateZ(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Vector3} axis\n * @param {number} rad\n * @return {clay.Quaternion}\n */\nQuaternion.setAxisAngle = function (out, axis, rad) {\n quat.setAxisAngle(out.array, axis.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Quaternion} a\n * @return {clay.Quaternion}\n */\nQuaternion.normalize = function (out, a) {\n quat.normalize(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} a\n * @return {number}\n */\nQuaternion.sqrLen = function (a) {\n return quat.sqrLen(a.array);\n};\n\n/**\n * @function\n * @param {clay.Quaternion} a\n * @return {number}\n */\nQuaternion.squaredLength = Quaternion.sqrLen;\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Matrix3} m\n * @return {clay.Quaternion}\n */\nQuaternion.fromMat3 = function (out, m) {\n quat.fromMat3(out.array, m.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Vector3} view\n * @param {clay.Vector3} right\n * @param {clay.Vector3} up\n * @return {clay.Quaternion}\n */\nQuaternion.setAxes = function (out, view, right, up) {\n quat.setAxes(out.array, view.array, right.array, up.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Quaternion} out\n * @param {clay.Vector3} a\n * @param {clay.Vector3} b\n * @return {clay.Quaternion}\n */\nQuaternion.rotationTo = function (out, a, b) {\n quat.rotationTo(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * Set quaternion from euler\n * @param {clay.Quaternion} out\n * @param {clay.Vector3} v\n * @param {String} order\n */\nQuaternion.fromEuler = function (out, v, order) {\n\n out._dirty = true;\n\n v = v.array;\n var target = out.array;\n var c1 = Math.cos(v[0] / 2);\n var c2 = Math.cos(v[1] / 2);\n var c3 = Math.cos(v[2] / 2);\n var s1 = Math.sin(v[0] / 2);\n var s2 = Math.sin(v[1] / 2);\n var s3 = Math.sin(v[2] / 2);\n\n var order = (order || 'XYZ').toUpperCase();\n\n // http://www.mathworks.com/matlabcentral/fileexchange/\n // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/\n // content/SpinCalc.m\n\n switch (order) {\n case 'XYZ':\n target[0] = s1 * c2 * c3 + c1 * s2 * s3;\n target[1] = c1 * s2 * c3 - s1 * c2 * s3;\n target[2] = c1 * c2 * s3 + s1 * s2 * c3;\n target[3] = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case 'YXZ':\n target[0] = s1 * c2 * c3 + c1 * s2 * s3;\n target[1] = c1 * s2 * c3 - s1 * c2 * s3;\n target[2] = c1 * c2 * s3 - s1 * s2 * c3;\n target[3] = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case 'ZXY':\n target[0] = s1 * c2 * c3 - c1 * s2 * s3;\n target[1] = c1 * s2 * c3 + s1 * c2 * s3;\n target[2] = c1 * c2 * s3 + s1 * s2 * c3;\n target[3] = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case 'ZYX':\n target[0] = s1 * c2 * c3 - c1 * s2 * s3;\n target[1] = c1 * s2 * c3 + s1 * c2 * s3;\n target[2] = c1 * c2 * s3 - s1 * s2 * c3;\n target[3] = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n case 'YZX':\n target[0] = s1 * c2 * c3 + c1 * s2 * s3;\n target[1] = c1 * s2 * c3 + s1 * c2 * s3;\n target[2] = c1 * c2 * s3 - s1 * s2 * c3;\n target[3] = c1 * c2 * c3 - s1 * s2 * s3;\n break;\n case 'XZY':\n target[0] = s1 * c2 * c3 - c1 * s2 * s3;\n target[1] = c1 * s2 * c3 - s1 * c2 * s3;\n target[2] = c1 * c2 * s3 + s1 * s2 * c3;\n target[3] = c1 * c2 * c3 + s1 * s2 * s3;\n break;\n }\n};\n\nexport default Quaternion;\n","import Vector3 from './Vector3';\nimport vec3 from '../glmatrix/vec3';\n\nvar vec3Set = vec3.set;\nvar vec3Copy = vec3.copy;\n\n/**\n * Axis aligned bounding box\n * @constructor\n * @alias clay.BoundingBox\n * @param {clay.Vector3} [min]\n * @param {clay.Vector3} [max]\n */\nvar BoundingBox = function (min, max) {\n\n /**\n * Minimum coords of bounding box\n * @type {clay.Vector3}\n */\n this.min = min || new Vector3(Infinity, Infinity, Infinity);\n\n /**\n * Maximum coords of bounding box\n * @type {clay.Vector3}\n */\n this.max = max || new Vector3(-Infinity, -Infinity, -Infinity);\n\n this.vertices = null;\n};\n\nBoundingBox.prototype = {\n\n constructor: BoundingBox,\n /**\n * Update min and max coords from a vertices array\n * @param {array} vertices\n */\n updateFromVertices: function (vertices) {\n if (vertices.length > 0) {\n var min = this.min;\n var max = this.max;\n var minArr = min.array;\n var maxArr = max.array;\n vec3Copy(minArr, vertices[0]);\n vec3Copy(maxArr, vertices[0]);\n for (var i = 1; i < vertices.length; i++) {\n var vertex = vertices[i];\n\n if (vertex[0] < minArr[0]) { minArr[0] = vertex[0]; }\n if (vertex[1] < minArr[1]) { minArr[1] = vertex[1]; }\n if (vertex[2] < minArr[2]) { minArr[2] = vertex[2]; }\n\n if (vertex[0] > maxArr[0]) { maxArr[0] = vertex[0]; }\n if (vertex[1] > maxArr[1]) { maxArr[1] = vertex[1]; }\n if (vertex[2] > maxArr[2]) { maxArr[2] = vertex[2]; }\n }\n min._dirty = true;\n max._dirty = true;\n }\n },\n\n /**\n * Union operation with another bounding box\n * @param {clay.BoundingBox} bbox\n */\n union: function (bbox) {\n var min = this.min;\n var max = this.max;\n vec3.min(min.array, min.array, bbox.min.array);\n vec3.max(max.array, max.array, bbox.max.array);\n min._dirty = true;\n max._dirty = true;\n return this;\n },\n\n /**\n * Intersection operation with another bounding box\n * @param {clay.BoundingBox} bbox\n */\n intersection: function (bbox) {\n var min = this.min;\n var max = this.max;\n vec3.max(min.array, min.array, bbox.min.array);\n vec3.min(max.array, max.array, bbox.max.array);\n min._dirty = true;\n max._dirty = true;\n return this;\n },\n\n /**\n * If intersect with another bounding box\n * @param {clay.BoundingBox} bbox\n * @return {boolean}\n */\n intersectBoundingBox: function (bbox) {\n var _min = this.min.array;\n var _max = this.max.array;\n\n var _min2 = bbox.min.array;\n var _max2 = bbox.max.array;\n\n return ! (_min[0] > _max2[0] || _min[1] > _max2[1] || _min[2] > _max2[2]\n || _max[0] < _min2[0] || _max[1] < _min2[1] || _max[2] < _min2[2]);\n },\n\n /**\n * If contain another bounding box entirely\n * @param {clay.BoundingBox} bbox\n * @return {boolean}\n */\n containBoundingBox: function (bbox) {\n\n var _min = this.min.array;\n var _max = this.max.array;\n\n var _min2 = bbox.min.array;\n var _max2 = bbox.max.array;\n\n return _min[0] <= _min2[0] && _min[1] <= _min2[1] && _min[2] <= _min2[2]\n && _max[0] >= _max2[0] && _max[1] >= _max2[1] && _max[2] >= _max2[2];\n },\n\n /**\n * If contain point entirely\n * @param {clay.Vector3} point\n * @return {boolean}\n */\n containPoint: function (p) {\n var _min = this.min.array;\n var _max = this.max.array;\n\n var _p = p.array;\n\n return _min[0] <= _p[0] && _min[1] <= _p[1] && _min[2] <= _p[2]\n && _max[0] >= _p[0] && _max[1] >= _p[1] && _max[2] >= _p[2];\n },\n\n /**\n * If bounding box is finite\n */\n isFinite: function () {\n var _min = this.min.array;\n var _max = this.max.array;\n return isFinite(_min[0]) && isFinite(_min[1]) && isFinite(_min[2])\n && isFinite(_max[0]) && isFinite(_max[1]) && isFinite(_max[2]);\n },\n\n /**\n * Apply an affine transform matrix to the bounding box\n * @param {clay.Matrix4} matrix\n */\n applyTransform: function (matrix) {\n this.transformFrom(this, matrix);\n },\n\n /**\n * Get from another bounding box and an affine transform matrix.\n * @param {clay.BoundingBox} source\n * @param {clay.Matrix4} matrix\n */\n transformFrom: (function () {\n // http://dev.theomader.com/transform-bounding-boxes/\n var xa = vec3.create();\n var xb = vec3.create();\n var ya = vec3.create();\n var yb = vec3.create();\n var za = vec3.create();\n var zb = vec3.create();\n\n return function (source, matrix) {\n var min = source.min.array;\n var max = source.max.array;\n\n var m = matrix.array;\n\n xa[0] = m[0] * min[0]; xa[1] = m[1] * min[0]; xa[2] = m[2] * min[0];\n xb[0] = m[0] * max[0]; xb[1] = m[1] * max[0]; xb[2] = m[2] * max[0];\n\n ya[0] = m[4] * min[1]; ya[1] = m[5] * min[1]; ya[2] = m[6] * min[1];\n yb[0] = m[4] * max[1]; yb[1] = m[5] * max[1]; yb[2] = m[6] * max[1];\n\n za[0] = m[8] * min[2]; za[1] = m[9] * min[2]; za[2] = m[10] * min[2];\n zb[0] = m[8] * max[2]; zb[1] = m[9] * max[2]; zb[2] = m[10] * max[2];\n\n min = this.min.array;\n max = this.max.array;\n min[0] = Math.min(xa[0], xb[0]) + Math.min(ya[0], yb[0]) + Math.min(za[0], zb[0]) + m[12];\n min[1] = Math.min(xa[1], xb[1]) + Math.min(ya[1], yb[1]) + Math.min(za[1], zb[1]) + m[13];\n min[2] = Math.min(xa[2], xb[2]) + Math.min(ya[2], yb[2]) + Math.min(za[2], zb[2]) + m[14];\n\n max[0] = Math.max(xa[0], xb[0]) + Math.max(ya[0], yb[0]) + Math.max(za[0], zb[0]) + m[12];\n max[1] = Math.max(xa[1], xb[1]) + Math.max(ya[1], yb[1]) + Math.max(za[1], zb[1]) + m[13];\n max[2] = Math.max(xa[2], xb[2]) + Math.max(ya[2], yb[2]) + Math.max(za[2], zb[2]) + m[14];\n\n this.min._dirty = true;\n this.max._dirty = true;\n\n return this;\n };\n })(),\n\n /**\n * Apply a projection matrix to the bounding box\n * @param {clay.Matrix4} matrix\n */\n applyProjection: function (matrix) {\n var min = this.min.array;\n var max = this.max.array;\n\n var m = matrix.array;\n // min in min z\n var v10 = min[0];\n var v11 = min[1];\n var v12 = min[2];\n // max in min z\n var v20 = max[0];\n var v21 = max[1];\n var v22 = min[2];\n // max in max z\n var v30 = max[0];\n var v31 = max[1];\n var v32 = max[2];\n\n if (m[15] === 1) { // Orthographic projection\n min[0] = m[0] * v10 + m[12];\n min[1] = m[5] * v11 + m[13];\n max[2] = m[10] * v12 + m[14];\n\n max[0] = m[0] * v30 + m[12];\n max[1] = m[5] * v31 + m[13];\n min[2] = m[10] * v32 + m[14];\n }\n else {\n var w = -1 / v12;\n min[0] = m[0] * v10 * w;\n min[1] = m[5] * v11 * w;\n max[2] = (m[10] * v12 + m[14]) * w;\n\n w = -1 / v22;\n max[0] = m[0] * v20 * w;\n max[1] = m[5] * v21 * w;\n\n w = -1 / v32;\n min[2] = (m[10] * v32 + m[14]) * w;\n }\n this.min._dirty = true;\n this.max._dirty = true;\n\n return this;\n },\n\n updateVertices: function () {\n var vertices = this.vertices;\n if (!vertices) {\n // Cube vertices\n vertices = [];\n for (var i = 0; i < 8; i++) {\n vertices[i] = vec3.fromValues(0, 0, 0);\n }\n\n /**\n * Eight coords of bounding box\n * @type {Float32Array[]}\n */\n this.vertices = vertices;\n }\n var min = this.min.array;\n var max = this.max.array;\n //--- min z\n // min x\n vec3Set(vertices[0], min[0], min[1], min[2]);\n vec3Set(vertices[1], min[0], max[1], min[2]);\n // max x\n vec3Set(vertices[2], max[0], min[1], min[2]);\n vec3Set(vertices[3], max[0], max[1], min[2]);\n\n //-- max z\n vec3Set(vertices[4], min[0], min[1], max[2]);\n vec3Set(vertices[5], min[0], max[1], max[2]);\n vec3Set(vertices[6], max[0], min[1], max[2]);\n vec3Set(vertices[7], max[0], max[1], max[2]);\n\n return this;\n },\n /**\n * Copy values from another bounding box\n * @param {clay.BoundingBox} bbox\n */\n copy: function (bbox) {\n var min = this.min;\n var max = this.max;\n vec3Copy(min.array, bbox.min.array);\n vec3Copy(max.array, bbox.max.array);\n min._dirty = true;\n max._dirty = true;\n return this;\n },\n\n /**\n * Clone a new bounding box\n * @return {clay.BoundingBox}\n */\n clone: function () {\n var boundingBox = new BoundingBox();\n boundingBox.copy(this);\n return boundingBox;\n }\n};\n\nexport default BoundingBox;\n","import Base from './core/Base';\nimport Vector3 from './math/Vector3';\nimport Quaternion from './math/Quaternion';\nimport Matrix4 from './math/Matrix4';\nimport mat4 from './glmatrix/mat4';\nimport BoundingBox from './math/BoundingBox';\n\nvar nameId = 0;\n\n/**\n * @constructor clay.Node\n * @extends clay.core.Base\n */\nvar Node = Base.extend(/** @lends clay.Node# */{\n /**\n * Scene node name\n * @type {string}\n */\n name: '',\n\n /**\n * Position relative to its parent node. aka translation.\n * @type {clay.Vector3}\n */\n position: null,\n\n /**\n * Rotation relative to its parent node. Represented by a quaternion\n * @type {clay.Quaternion}\n */\n rotation: null,\n\n /**\n * Scale relative to its parent node\n * @type {clay.Vector3}\n */\n scale: null,\n\n /**\n * Affine transform matrix relative to its root scene.\n * @type {clay.Matrix4}\n */\n worldTransform: null,\n\n /**\n * Affine transform matrix relative to its parent node.\n * Composited with position, rotation and scale.\n * @type {clay.Matrix4}\n */\n localTransform: null,\n\n /**\n * If the local transform is update from SRT(scale, rotation, translation, which is position here) each frame\n * @type {boolean}\n */\n autoUpdateLocalTransform: true,\n\n /**\n * Parent of current scene node\n * @type {?clay.Node}\n * @private\n */\n _parent: null,\n /**\n * The root scene mounted. Null if it is a isolated node\n * @type {?clay.Scene}\n * @private\n */\n _scene: null,\n /**\n * @type {boolean}\n * @private\n */\n _needsUpdateWorldTransform: true,\n /**\n * @type {boolean}\n * @private\n */\n _inIterating: false,\n\n // Depth for transparent list sorting\n __depth: 0\n\n}, function () {\n\n if (!this.name) {\n this.name = (this.type || 'NODE') + '_' + (nameId++);\n }\n\n if (!this.position) {\n this.position = new Vector3();\n }\n if (!this.rotation) {\n this.rotation = new Quaternion();\n }\n if (!this.scale) {\n this.scale = new Vector3(1, 1, 1);\n }\n\n this.worldTransform = new Matrix4();\n this.localTransform = new Matrix4();\n\n this._children = [];\n\n},\n/**@lends clay.Node.prototype. */\n{\n\n /**\n * @type {?clay.Vector3}\n * @instance\n */\n target: null,\n /**\n * If node and its chilren invisible\n * @type {boolean}\n * @instance\n */\n invisible: false,\n\n /**\n * If Node is a skinned mesh\n * @return {boolean}\n */\n isSkinnedMesh: function () {\n return false;\n },\n /**\n * Return true if it is a renderable scene node, like Mesh and ParticleSystem\n * @return {boolean}\n */\n isRenderable: function () {\n return false;\n },\n\n /**\n * Set the name of the scene node\n * @param {string} name\n */\n setName: function (name) {\n var scene = this._scene;\n if (scene) {\n var nodeRepository = scene._nodeRepository;\n delete nodeRepository[this.name];\n nodeRepository[name] = this;\n }\n this.name = name;\n },\n\n /**\n * Add a child node\n * @param {clay.Node} node\n */\n add: function (node) {\n var originalParent = node._parent;\n if (originalParent === this) {\n return;\n }\n if (originalParent) {\n originalParent.remove(node);\n }\n node._parent = this;\n this._children.push(node);\n\n var scene = this._scene;\n if (scene && scene !== node.scene) {\n node.traverse(this._addSelfToScene, this);\n }\n // Mark children needs update transform\n // In case child are remove and added again after parent moved\n node._needsUpdateWorldTransform = true;\n },\n\n /**\n * Remove the given child scene node\n * @param {clay.Node} node\n */\n remove: function (node) {\n var children = this._children;\n var idx = children.indexOf(node);\n if (idx < 0) {\n return;\n }\n\n children.splice(idx, 1);\n node._parent = null;\n\n if (this._scene) {\n node.traverse(this._removeSelfFromScene, this);\n }\n },\n\n /**\n * Remove all children\n */\n removeAll: function () {\n var children = this._children;\n\n for (var idx = 0; idx < children.length; idx++) {\n children[idx]._parent = null;\n\n if (this._scene) {\n children[idx].traverse(this._removeSelfFromScene, this);\n }\n }\n\n this._children = [];\n },\n\n /**\n * Get the scene mounted\n * @return {clay.Scene}\n */\n getScene: function () {\n return this._scene;\n },\n\n /**\n * Get parent node\n * @return {clay.Scene}\n */\n getParent: function () {\n return this._parent;\n },\n\n _removeSelfFromScene: function (descendant) {\n descendant._scene.removeFromScene(descendant);\n descendant._scene = null;\n },\n\n _addSelfToScene: function (descendant) {\n this._scene.addToScene(descendant);\n descendant._scene = this._scene;\n },\n\n /**\n * Return true if it is ancestor of the given scene node\n * @param {clay.Node} node\n */\n isAncestor: function (node) {\n var parent = node._parent;\n while(parent) {\n if (parent === this) {\n return true;\n }\n parent = parent._parent;\n }\n return false;\n },\n\n /**\n * Get a new created array of all children nodes\n * @return {clay.Node[]}\n */\n children: function () {\n return this._children.slice();\n },\n\n /**\n * Get child scene node at given index.\n * @param {number} idx\n * @return {clay.Node}\n */\n childAt: function (idx) {\n return this._children[idx];\n },\n\n /**\n * Get first child with the given name\n * @param {string} name\n * @return {clay.Node}\n */\n getChildByName: function (name) {\n var children = this._children;\n for (var i = 0; i < children.length; i++) {\n if (children[i].name === name) {\n return children[i];\n }\n }\n },\n\n /**\n * Get first descendant have the given name\n * @param {string} name\n * @return {clay.Node}\n */\n getDescendantByName: function (name) {\n var children = this._children;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (child.name === name) {\n return child;\n } else {\n var res = child.getDescendantByName(name);\n if (res) {\n return res;\n }\n }\n }\n },\n\n /**\n * Query descendant node by path\n * @param {string} path\n * @return {clay.Node}\n * @example\n * node.queryNode('root/parent/child');\n */\n queryNode: function (path) {\n if (!path) {\n return;\n }\n // TODO Name have slash ?\n var pathArr = path.split('/');\n var current = this;\n for (var i = 0; i < pathArr.length; i++) {\n var name = pathArr[i];\n // Skip empty\n if (!name) {\n continue;\n }\n var found = false;\n var children = current._children;\n for (var j = 0; j < children.length; j++) {\n var child = children[j];\n if (child.name === name) {\n current = child;\n found = true;\n break;\n }\n }\n // Early return if not found\n if (!found) {\n return;\n }\n }\n\n return current;\n },\n\n /**\n * Get query path, relative to rootNode(default is scene)\n * @param {clay.Node} [rootNode]\n * @return {string}\n */\n getPath: function (rootNode) {\n if (!this._parent) {\n return '/';\n }\n\n var current = this._parent;\n var path = this.name;\n while (current._parent) {\n path = current.name + '/' + path;\n if (current._parent == rootNode) {\n break;\n }\n current = current._parent;\n }\n if (!current._parent && rootNode) {\n return null;\n }\n return path;\n },\n\n /**\n * Depth first traverse all its descendant scene nodes.\n *\n * **WARN** Don't do `add`, `remove` operation in the callback during traverse.\n * @param {Function} callback\n * @param {Node} [context]\n */\n traverse: function (callback, context) {\n callback.call(context, this);\n var _children = this._children;\n for(var i = 0, len = _children.length; i < len; i++) {\n _children[i].traverse(callback, context);\n }\n },\n\n /**\n * Traverse all children nodes.\n *\n * **WARN** DON'T do `add`, `remove` operation in the callback during iteration.\n *\n * @param {Function} callback\n * @param {Node} [context]\n */\n eachChild: function (callback, context) {\n var _children = this._children;\n for(var i = 0, len = _children.length; i < len; i++) {\n var child = _children[i];\n callback.call(context, child, i);\n }\n },\n\n /**\n * Set the local transform and decompose to SRT\n * @param {clay.Matrix4} matrix\n */\n setLocalTransform: function (matrix) {\n mat4.copy(this.localTransform.array, matrix.array);\n this.decomposeLocalTransform();\n },\n\n /**\n * Decompose the local transform to SRT\n */\n decomposeLocalTransform: function (keepScale) {\n var scale = !keepScale ? this.scale: null;\n this.localTransform.decomposeMatrix(scale, this.rotation, this.position);\n },\n\n /**\n * Set the world transform and decompose to SRT\n * @param {clay.Matrix4} matrix\n */\n setWorldTransform: function (matrix) {\n mat4.copy(this.worldTransform.array, matrix.array);\n this.decomposeWorldTransform();\n },\n\n /**\n * Decompose the world transform to SRT\n * @function\n */\n decomposeWorldTransform: (function () {\n\n var tmp = mat4.create();\n\n return function (keepScale) {\n var localTransform = this.localTransform;\n var worldTransform = this.worldTransform;\n // Assume world transform is updated\n if (this._parent) {\n mat4.invert(tmp, this._parent.worldTransform.array);\n mat4.multiply(localTransform.array, tmp, worldTransform.array);\n } else {\n mat4.copy(localTransform.array, worldTransform.array);\n }\n var scale = !keepScale ? this.scale: null;\n localTransform.decomposeMatrix(scale, this.rotation, this.position);\n };\n })(),\n\n transformNeedsUpdate: function () {\n return this.position._dirty\n || this.rotation._dirty\n || this.scale._dirty;\n },\n\n /**\n * Update local transform from SRT\n * Notice that local transform will not be updated if _dirty mark of position, rotation, scale is all false\n */\n updateLocalTransform: function () {\n var position = this.position;\n var rotation = this.rotation;\n var scale = this.scale;\n\n if (this.transformNeedsUpdate()) {\n var m = this.localTransform.array;\n\n // Transform order, scale->rotation->position\n mat4.fromRotationTranslation(m, rotation.array, position.array);\n\n mat4.scale(m, m, scale.array);\n\n rotation._dirty = false;\n scale._dirty = false;\n position._dirty = false;\n\n this._needsUpdateWorldTransform = true;\n }\n },\n\n /**\n * Update world transform, assume its parent world transform have been updated\n * @private\n */\n _updateWorldTransformTopDown: function () {\n var localTransform = this.localTransform.array;\n var worldTransform = this.worldTransform.array;\n if (this._parent) {\n mat4.multiplyAffine(\n worldTransform,\n this._parent.worldTransform.array,\n localTransform\n );\n }\n else {\n mat4.copy(worldTransform, localTransform);\n }\n },\n\n /**\n * Update world transform before whole scene is updated.\n */\n updateWorldTransform: function () {\n // Find the root node which transform needs update;\n var rootNodeIsDirty = this;\n while (rootNodeIsDirty && rootNodeIsDirty.getParent()\n && rootNodeIsDirty.getParent().transformNeedsUpdate()\n ) {\n rootNodeIsDirty = rootNodeIsDirty.getParent();\n }\n rootNodeIsDirty.update();\n },\n\n /**\n * Update local transform and world transform recursively\n * @param {boolean} forceUpdateWorld\n */\n update: function (forceUpdateWorld) {\n if (this.autoUpdateLocalTransform) {\n this.updateLocalTransform();\n }\n else {\n // Transform is manually setted\n forceUpdateWorld = true;\n }\n\n if (forceUpdateWorld || this._needsUpdateWorldTransform) {\n this._updateWorldTransformTopDown();\n forceUpdateWorld = true;\n this._needsUpdateWorldTransform = false;\n }\n\n var children = this._children;\n for(var i = 0, len = children.length; i < len; i++) {\n children[i].update(forceUpdateWorld);\n }\n },\n\n /**\n * Get bounding box of node\n * @param {Function} [filter]\n * @param {clay.BoundingBox} [out]\n * @return {clay.BoundingBox}\n */\n // TODO Skinning\n getBoundingBox: (function () {\n function defaultFilter (el) {\n return !el.invisible && el.geometry;\n }\n var tmpBBox = new BoundingBox();\n var tmpMat4 = new Matrix4();\n var invWorldTransform = new Matrix4();\n return function (filter, out) {\n out = out || new BoundingBox();\n filter = filter || defaultFilter;\n\n if (this._parent) {\n Matrix4.invert(invWorldTransform, this._parent.worldTransform);\n }\n else {\n Matrix4.identity(invWorldTransform);\n }\n\n this.traverse(function (mesh) {\n if (mesh.geometry && mesh.geometry.boundingBox) {\n tmpBBox.copy(mesh.geometry.boundingBox);\n Matrix4.multiply(tmpMat4, invWorldTransform, mesh.worldTransform);\n tmpBBox.applyTransform(tmpMat4);\n out.union(tmpBBox);\n }\n }, this, defaultFilter);\n\n return out;\n };\n })(),\n\n /**\n * Get world position, extracted from world transform\n * @param {clay.Vector3} [out]\n * @return {clay.Vector3}\n */\n getWorldPosition: function (out) {\n // PENDING\n if (this.transformNeedsUpdate()) {\n this.updateWorldTransform();\n }\n var m = this.worldTransform.array;\n if (out) {\n var arr = out.array;\n arr[0] = m[12];\n arr[1] = m[13];\n arr[2] = m[14];\n return out;\n }\n else {\n return new Vector3(m[12], m[13], m[14]);\n }\n },\n\n /**\n * Clone a new node\n * @return {Node}\n */\n clone: function () {\n var node = new this.constructor();\n\n var children = this._children;\n\n node.setName(this.name);\n node.position.copy(this.position);\n node.rotation.copy(this.rotation);\n node.scale.copy(this.scale);\n\n for (var i = 0; i < children.length; i++) {\n node.add(children[i].clone());\n }\n\n return node;\n },\n\n /**\n * Rotate the node around a axis by angle degrees, axis passes through point\n * @param {clay.Vector3} point Center point\n * @param {clay.Vector3} axis Center axis\n * @param {number} angle Rotation angle\n * @see http://docs.unity3d.com/Documentation/ScriptReference/Transform.RotateAround.html\n * @function\n */\n rotateAround: (function () {\n var v = new Vector3();\n var RTMatrix = new Matrix4();\n\n // TODO improve performance\n return function (point, axis, angle) {\n\n v.copy(this.position).subtract(point);\n\n var localTransform = this.localTransform;\n localTransform.identity();\n // parent node\n localTransform.translate(point);\n localTransform.rotate(angle, axis);\n\n RTMatrix.fromRotationTranslation(this.rotation, v);\n localTransform.multiply(RTMatrix);\n localTransform.scale(this.scale);\n\n this.decomposeLocalTransform();\n this._needsUpdateWorldTransform = true;\n };\n })(),\n\n /**\n * @param {clay.Vector3} target\n * @param {clay.Vector3} [up]\n * @see http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml\n * @function\n */\n lookAt: (function () {\n var m = new Matrix4();\n return function (target, up) {\n m.lookAt(this.position, target, up || this.localTransform.y).invert();\n this.setLocalTransform(m);\n\n this.target = target;\n };\n })()\n});\n\nexport default Node;\n","import Node from './Node';\nimport glenum from './core/glenum';\n\n/**\n * @constructor\n * @alias clay.Renderable\n * @extends clay.Node\n */\nvar Renderable = Node.extend(/** @lends clay.Renderable# */ {\n /**\n * @type {clay.Material}\n */\n material: null,\n\n /**\n * @type {clay.Geometry}\n */\n geometry: null,\n\n /**\n * @type {number}\n */\n mode: glenum.TRIANGLES,\n\n _renderInfo: null\n},\n/** @lends clay.Renderable.prototype */\n{\n\n __program: null,\n\n /**\n * Group of received light.\n */\n lightGroup: 0,\n /**\n * Render order, Nodes with smaller value renders before nodes with larger values.\n * @type {Number}\n */\n renderOrder: 0,\n\n /**\n * Used when mode is LINES, LINE_STRIP or LINE_LOOP\n * @type {number}\n */\n // lineWidth: 1,\n\n /**\n * If enable culling\n * @type {boolean}\n */\n culling: true,\n /**\n * Specify which side of polygon will be culled.\n * Possible values:\n * + {@link clay.Renderable.BACK}\n * + {@link clay.Renderable.FRONT}\n * + {@link clay.Renderable.FRONT_AND_BACK}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/cullFace\n * @type {number}\n */\n cullFace: glenum.BACK,\n /**\n * Specify which side is front face.\n * Possible values:\n * + {@link clay.Renderable.CW}\n * + {@link clay.Renderable.CCW}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/frontFace\n * @type {number}\n */\n frontFace: glenum.CCW,\n\n /**\n * If enable software frustum culling\n * @type {boolean}\n */\n frustumCulling: true,\n /**\n * @type {boolean}\n */\n receiveShadow: true,\n /**\n * @type {boolean}\n */\n castShadow: true,\n /**\n * @type {boolean}\n */\n ignorePicking: false,\n /**\n * @type {boolean}\n */\n ignorePreZ: false,\n\n /**\n * @type {boolean}\n */\n ignoreGBuffer: false,\n\n /**\n * @return {boolean}\n */\n isRenderable: function() {\n // TODO Shader ?\n return this.geometry && this.material && this.material.shader && !this.invisible\n && this.geometry.vertexCount > 0;\n },\n\n /**\n * Before render hook\n * @type {Function}\n */\n beforeRender: function (_gl) {},\n\n /**\n * Before render hook\n * @type {Function}\n */\n afterRender: function (_gl, renderStat) {},\n\n getBoundingBox: function (filter, out) {\n out = Node.prototype.getBoundingBox.call(this, filter, out);\n if (this.geometry && this.geometry.boundingBox) {\n out.union(this.geometry.boundingBox);\n }\n\n return out;\n },\n\n /**\n * Clone a new renderable\n * @function\n * @return {clay.Renderable}\n */\n clone: (function() {\n var properties = [\n 'castShadow', 'receiveShadow',\n 'mode', 'culling', 'cullFace', 'frontFace',\n 'frustumCulling',\n 'renderOrder', 'lineWidth',\n 'ignorePicking', 'ignorePreZ', 'ignoreGBuffer'\n ];\n return function() {\n var renderable = Node.prototype.clone.call(this);\n\n renderable.geometry = this.geometry;\n renderable.material = this.material;\n\n for (var i = 0; i < properties.length; i++) {\n var name = properties[i];\n // Try not to overwrite the prototype property\n if (renderable[name] !== this[name]) {\n renderable[name] = this[name];\n }\n }\n\n return renderable;\n };\n })()\n});\n\n/**\n * @type {number}\n */\nRenderable.POINTS = glenum.POINTS;\n/**\n * @type {number}\n */\nRenderable.LINES = glenum.LINES;\n/**\n * @type {number}\n */\nRenderable.LINE_LOOP = glenum.LINE_LOOP;\n/**\n * @type {number}\n */\nRenderable.LINE_STRIP = glenum.LINE_STRIP;\n/**\n * @type {number}\n */\nRenderable.TRIANGLES = glenum.TRIANGLES;\n/**\n * @type {number}\n */\nRenderable.TRIANGLE_STRIP = glenum.TRIANGLE_STRIP;\n/**\n * @type {number}\n */\nRenderable.TRIANGLE_FAN = glenum.TRIANGLE_FAN;\n/**\n * @type {number}\n */\nRenderable.BACK = glenum.BACK;\n/**\n * @type {number}\n */\nRenderable.FRONT = glenum.FRONT;\n/**\n * @type {number}\n */\nRenderable.FRONT_AND_BACK = glenum.FRONT_AND_BACK;\n/**\n * @type {number}\n */\nRenderable.CW = glenum.CW;\n/**\n * @type {number}\n */\nRenderable.CCW = glenum.CCW;\n\nexport default Renderable;\n","import Base from '../core/Base';\nimport Ray from '../math/Ray';\nimport Vector2 from '../math/Vector2';\nimport Vector3 from '../math/Vector3';\nimport Matrix4 from '../math/Matrix4';\nimport Renderable from '../Renderable';\nimport glenum from '../core/glenum';\nimport vec3 from '../glmatrix/vec3';\n\n/**\n * @constructor clay.picking.RayPicking\n * @extends clay.core.Base\n */\nvar RayPicking = Base.extend(/** @lends clay.picking.RayPicking# */{\n /**\n * Target scene\n * @type {clay.Scene}\n */\n scene: null,\n /**\n * Target camera\n * @type {clay.Camera}\n */\n camera: null,\n /**\n * Target renderer\n * @type {clay.Renderer}\n */\n renderer: null\n}, function () {\n this._ray = new Ray();\n this._ndc = new Vector2();\n},\n/** @lends clay.picking.RayPicking.prototype */\n{\n\n /**\n * Pick the nearest intersection object in the scene\n * @param {number} x Mouse position x\n * @param {number} y Mouse position y\n * @param {boolean} [forcePickAll=false] ignore ignorePicking\n * @return {clay.picking.RayPicking~Intersection}\n */\n pick: function (x, y, forcePickAll) {\n var out = this.pickAll(x, y, [], forcePickAll);\n return out[0] || null;\n },\n\n /**\n * Pick all intersection objects, wich will be sorted from near to far\n * @param {number} x Mouse position x\n * @param {number} y Mouse position y\n * @param {Array} [output]\n * @param {boolean} [forcePickAll=false] ignore ignorePicking\n * @return {Array.}\n */\n pickAll: function (x, y, output, forcePickAll) {\n this.renderer.screenToNDC(x, y, this._ndc);\n this.camera.castRay(this._ndc, this._ray);\n\n output = output || [];\n\n this._intersectNode(this.scene, output, forcePickAll || false);\n\n output.sort(this._intersectionCompareFunc);\n\n return output;\n },\n\n _intersectNode: function (node, out, forcePickAll) {\n if ((node instanceof Renderable) && node.isRenderable()) {\n if ((!node.ignorePicking || forcePickAll)\n && (\n // Only triangle mesh support ray picking\n (node.mode === glenum.TRIANGLES && node.geometry.isUseIndices())\n // Or if geometry has it's own pickByRay, pick, implementation\n || node.geometry.pickByRay\n || node.geometry.pick\n )\n ) {\n this._intersectRenderable(node, out);\n }\n }\n for (var i = 0; i < node._children.length; i++) {\n this._intersectNode(node._children[i], out, forcePickAll);\n }\n },\n\n _intersectRenderable: (function () {\n\n var v1 = new Vector3();\n var v2 = new Vector3();\n var v3 = new Vector3();\n var ray = new Ray();\n var worldInverse = new Matrix4();\n\n return function (renderable, out) {\n\n var isSkinnedMesh = renderable.isSkinnedMesh();\n ray.copy(this._ray);\n Matrix4.invert(worldInverse, renderable.worldTransform);\n\n // Skinned mesh will ignore the world transform.\n if (!isSkinnedMesh) {\n ray.applyTransform(worldInverse);\n }\n\n var geometry = renderable.geometry;\n\n var bbox = isSkinnedMesh ? renderable.skeleton.boundingBox : geometry.boundingBox;\n\n if (bbox && !ray.intersectBoundingBox(bbox)) {\n return;\n }\n // Use user defined picking algorithm\n if (geometry.pick) {\n geometry.pick(\n this._ndc.x, this._ndc.y,\n this.renderer,\n this.camera,\n renderable, out\n );\n return;\n }\n // Use user defined ray picking algorithm\n else if (geometry.pickByRay) {\n geometry.pickByRay(ray, renderable, out);\n return;\n }\n\n var cullBack = (renderable.cullFace === glenum.BACK && renderable.frontFace === glenum.CCW)\n || (renderable.cullFace === glenum.FRONT && renderable.frontFace === glenum.CW);\n\n var point;\n var indices = geometry.indices;\n var positionAttr = geometry.attributes.position;\n var weightAttr = geometry.attributes.weight;\n var jointAttr = geometry.attributes.joint;\n var skinMatricesArray;\n var skinMatrices = [];\n // Check if valid.\n if (!positionAttr || !positionAttr.value || !indices) {\n return;\n }\n if (isSkinnedMesh) {\n skinMatricesArray = renderable.skeleton.getSubSkinMatrices(renderable.__uid__, renderable.joints);\n for (var i = 0; i < renderable.joints.length; i++) {\n skinMatrices[i] = skinMatrices[i] || [];\n for (var k = 0; k < 16; k++) {\n skinMatrices[i][k] = skinMatricesArray[i * 16 + k];\n }\n }\n var pos = [];\n var weight = [];\n var joint = [];\n var skinnedPos = [];\n var tmp = [];\n var skinnedPositionAttr = geometry.attributes.skinnedPosition;\n if (!skinnedPositionAttr || !skinnedPositionAttr.value) {\n geometry.createAttribute('skinnedPosition', 'f', 3);\n skinnedPositionAttr = geometry.attributes.skinnedPosition;\n skinnedPositionAttr.init(geometry.vertexCount);\n }\n for (var i = 0; i < geometry.vertexCount; i++) {\n positionAttr.get(i, pos);\n weightAttr.get(i, weight);\n jointAttr.get(i, joint);\n weight[3] = 1 - weight[0] - weight[1] - weight[2];\n vec3.set(skinnedPos, 0, 0, 0);\n for (var k = 0; k < 4; k++) {\n if (joint[k] >= 0 && weight[k] > 1e-4) {\n vec3.transformMat4(tmp, pos, skinMatrices[joint[k]]);\n vec3.scaleAndAdd(skinnedPos, skinnedPos, tmp, weight[k]);\n }\n }\n skinnedPositionAttr.set(i, skinnedPos);\n }\n }\n\n for (var i = 0; i < indices.length; i += 3) {\n var i1 = indices[i];\n var i2 = indices[i + 1];\n var i3 = indices[i + 2];\n var finalPosAttr = isSkinnedMesh\n ? geometry.attributes.skinnedPosition\n : positionAttr;\n finalPosAttr.get(i1, v1.array);\n finalPosAttr.get(i2, v2.array);\n finalPosAttr.get(i3, v3.array);\n\n if (cullBack) {\n point = ray.intersectTriangle(v1, v2, v3, renderable.culling);\n }\n else {\n point = ray.intersectTriangle(v1, v3, v2, renderable.culling);\n }\n if (point) {\n var pointW = new Vector3();\n if (!isSkinnedMesh) {\n Vector3.transformMat4(pointW, point, renderable.worldTransform);\n }\n else {\n // TODO point maybe not right.\n Vector3.copy(pointW, point);\n }\n out.push(new RayPicking.Intersection(\n point, pointW, renderable, [i1, i2, i3], i / 3,\n Vector3.dist(pointW, this._ray.origin)\n ));\n }\n }\n };\n })(),\n\n _intersectionCompareFunc: function (a, b) {\n return a.distance - b.distance;\n }\n});\n\n/**\n * @constructor clay.picking.RayPicking~Intersection\n * @param {clay.Vector3} point\n * @param {clay.Vector3} pointWorld\n * @param {clay.Node} target\n * @param {Array.} triangle\n * @param {number} triangleIndex\n * @param {number} distance\n */\nRayPicking.Intersection = function (point, pointWorld, target, triangle, triangleIndex, distance) {\n /**\n * Intersection point in local transform coordinates\n * @type {clay.Vector3}\n */\n this.point = point;\n /**\n * Intersection point in world transform coordinates\n * @type {clay.Vector3}\n */\n this.pointWorld = pointWorld;\n /**\n * Intersection scene node\n * @type {clay.Node}\n */\n this.target = target;\n /**\n * Intersection triangle, which is an array of vertex index\n * @type {Array.}\n */\n this.triangle = triangle;\n /**\n * Index of intersection triangle.\n */\n this.triangleIndex = triangleIndex;\n /**\n * Distance from intersection point to ray origin\n * @type {number}\n */\n this.distance = distance;\n};\n\nexport default RayPicking;\n","var DIRTY_PREFIX = '__dt__';\n\nvar Cache = function () {\n\n this._contextId = 0;\n\n this._caches = [];\n\n this._context = {};\n};\n\nCache.prototype = {\n\n use: function (contextId, documentSchema) {\n var caches = this._caches;\n if (!caches[contextId]) {\n caches[contextId] = {};\n\n if (documentSchema) {\n caches[contextId] = documentSchema();\n }\n }\n this._contextId = contextId;\n\n this._context = caches[contextId];\n },\n\n put: function (key, value) {\n this._context[key] = value;\n },\n\n get: function (key) {\n return this._context[key];\n },\n\n dirty: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n this.put(key, true);\n },\n\n dirtyAll: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n var caches = this._caches;\n for (var i = 0; i < caches.length; i++) {\n if (caches[i]) {\n caches[i][key] = true;\n }\n }\n },\n\n fresh: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n this.put(key, false);\n },\n\n freshAll: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n var caches = this._caches;\n for (var i = 0; i < caches.length; i++) {\n if (caches[i]) {\n caches[i][key] = false;\n }\n }\n },\n\n isDirty: function (field) {\n field = field || '';\n var key = DIRTY_PREFIX + field;\n var context = this._context;\n return !context.hasOwnProperty(key)\n || context[key] === true;\n },\n\n deleteContext: function (contextId) {\n delete this._caches[contextId];\n this._context = {};\n },\n\n delete: function (key) {\n delete this._context[key];\n },\n\n clearAll: function () {\n this._caches = {};\n },\n\n getContext: function () {\n return this._context;\n },\n\n eachContext : function (cb, context) {\n var keys = Object.keys(this._caches);\n keys.forEach(function (key) {\n cb && cb.call(context, key);\n });\n },\n\n miss: function (key) {\n return ! this._context.hasOwnProperty(key);\n }\n};\n\nCache.prototype.constructor = Cache;\n\nexport default Cache;\n","/**\n * Base class for all textures like compressed texture, texture2d, texturecube\n * TODO mapping\n */\nimport Base from './core/Base';\nimport glenum from './core/glenum';\nimport Cache from './core/Cache';\n\n/**\n * @constructor\n * @alias clay.Texture\n * @extends clay.core.Base\n */\nvar Texture = Base.extend( /** @lends clay.Texture# */ {\n /**\n * Texture width, readonly when the texture source is image\n * @type {number}\n */\n width: 512,\n /**\n * Texture height, readonly when the texture source is image\n * @type {number}\n */\n height: 512,\n /**\n * Texel data type.\n * Possible values:\n * + {@link clay.Texture.UNSIGNED_BYTE}\n * + {@link clay.Texture.HALF_FLOAT}\n * + {@link clay.Texture.FLOAT}\n * + {@link clay.Texture.UNSIGNED_INT_24_8_WEBGL}\n * + {@link clay.Texture.UNSIGNED_INT}\n * @type {number}\n */\n type: glenum.UNSIGNED_BYTE,\n /**\n * Format of texel data\n * Possible values:\n * + {@link clay.Texture.RGBA}\n * + {@link clay.Texture.DEPTH_COMPONENT}\n * + {@link clay.Texture.DEPTH_STENCIL}\n * @type {number}\n */\n format: glenum.RGBA,\n /**\n * Texture wrap. Default to be REPEAT.\n * Possible values:\n * + {@link clay.Texture.CLAMP_TO_EDGE}\n * + {@link clay.Texture.REPEAT}\n * + {@link clay.Texture.MIRRORED_REPEAT}\n * @type {number}\n */\n wrapS: glenum.REPEAT,\n /**\n * Texture wrap. Default to be REPEAT.\n * Possible values:\n * + {@link clay.Texture.CLAMP_TO_EDGE}\n * + {@link clay.Texture.REPEAT}\n * + {@link clay.Texture.MIRRORED_REPEAT}\n * @type {number}\n */\n wrapT: glenum.REPEAT,\n /**\n * Possible values:\n * + {@link clay.Texture.NEAREST}\n * + {@link clay.Texture.LINEAR}\n * + {@link clay.Texture.NEAREST_MIPMAP_NEAREST}\n * + {@link clay.Texture.LINEAR_MIPMAP_NEAREST}\n * + {@link clay.Texture.NEAREST_MIPMAP_LINEAR}\n * + {@link clay.Texture.LINEAR_MIPMAP_LINEAR}\n * @type {number}\n */\n minFilter: glenum.LINEAR_MIPMAP_LINEAR,\n /**\n * Possible values:\n * + {@link clay.Texture.NEAREST}\n * + {@link clay.Texture.LINEAR}\n * @type {number}\n */\n magFilter: glenum.LINEAR,\n /**\n * If enable mimap.\n * @type {boolean}\n */\n useMipmap: true,\n\n /**\n * Anisotropic filtering, enabled if value is larger than 1\n * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_texture_filter_anisotropic\n * @type {number}\n */\n anisotropic: 1,\n // pixelStorei parameters, not available when texture is used as render target\n // http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml\n /**\n * If flip in y axis for given image source\n * @type {boolean}\n * @default true\n */\n flipY: true,\n\n /**\n * A flag to indicate if texture source is sRGB\n */\n sRGB: true,\n /**\n * @type {number}\n * @default 4\n */\n unpackAlignment: 4,\n /**\n * @type {boolean}\n * @default false\n */\n premultiplyAlpha: false,\n\n /**\n * Dynamic option for texture like video\n * @type {boolean}\n */\n dynamic: false,\n\n NPOT: false,\n\n // PENDING\n // Init it here to avoid deoptimization when it's assigned in application dynamically\n __used: 0\n\n}, function () {\n this._cache = new Cache();\n},\n/** @lends clay.Texture.prototype */\n{\n\n getWebGLTexture: function (renderer) {\n var _gl = renderer.gl;\n var cache = this._cache;\n cache.use(renderer.__uid__);\n\n if (cache.miss('webgl_texture')) {\n // In a new gl context, create new texture and set dirty true\n cache.put('webgl_texture', _gl.createTexture());\n }\n if (this.dynamic) {\n this.update(renderer);\n }\n else if (cache.isDirty()) {\n this.update(renderer);\n cache.fresh();\n }\n\n return cache.get('webgl_texture');\n },\n\n bind: function () {},\n unbind: function () {},\n\n /**\n * Mark texture is dirty and update in the next frame\n */\n dirty: function () {\n if (this._cache) {\n this._cache.dirtyAll();\n }\n },\n\n update: function (renderer) {},\n\n // Update the common parameters of texture\n updateCommon: function (renderer) {\n var _gl = renderer.gl;\n _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, this.flipY);\n _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);\n _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, this.unpackAlignment);\n\n // Use of none-power of two texture\n // http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences\n if (this.format === glenum.DEPTH_COMPONENT) {\n this.useMipmap = false;\n }\n\n var sRGBExt = renderer.getGLExtension('EXT_sRGB');\n // Fallback\n if (this.format === Texture.SRGB && !sRGBExt) {\n this.format = Texture.RGB;\n }\n if (this.format === Texture.SRGB_ALPHA && !sRGBExt) {\n this.format = Texture.RGBA;\n }\n\n this.NPOT = !this.isPowerOfTwo();\n },\n\n getAvailableWrapS: function () {\n if (this.NPOT) {\n return glenum.CLAMP_TO_EDGE;\n }\n return this.wrapS;\n },\n getAvailableWrapT: function () {\n if (this.NPOT) {\n return glenum.CLAMP_TO_EDGE;\n }\n return this.wrapT;\n },\n getAvailableMinFilter: function () {\n var minFilter = this.minFilter;\n if (this.NPOT || !this.useMipmap) {\n if (minFilter === glenum.NEAREST_MIPMAP_NEAREST ||\n minFilter === glenum.NEAREST_MIPMAP_LINEAR\n ) {\n return glenum.NEAREST;\n }\n else if (minFilter === glenum.LINEAR_MIPMAP_LINEAR ||\n minFilter === glenum.LINEAR_MIPMAP_NEAREST\n ) {\n return glenum.LINEAR;\n }\n else {\n return minFilter;\n }\n }\n else {\n return minFilter;\n }\n },\n getAvailableMagFilter: function () {\n return this.magFilter;\n },\n\n nextHighestPowerOfTwo: function (x) {\n --x;\n for (var i = 1; i < 32; i <<= 1) {\n x = x | x >> i;\n }\n return x + 1;\n },\n /**\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n\n var cache = this._cache;\n\n cache.use(renderer.__uid__);\n\n var webglTexture = cache.get('webgl_texture');\n if (webglTexture){\n renderer.gl.deleteTexture(webglTexture);\n }\n cache.deleteContext(renderer.__uid__);\n\n },\n /**\n * Test if image of texture is valid and loaded.\n * @return {boolean}\n */\n isRenderable: function () {},\n\n /**\n * Test if texture size is power of two\n * @return {boolean}\n */\n isPowerOfTwo: function () {}\n});\n\nObject.defineProperty(Texture.prototype, 'width', {\n get: function () {\n return this._width;\n },\n set: function (value) {\n this._width = value;\n }\n});\nObject.defineProperty(Texture.prototype, 'height', {\n get: function () {\n return this._height;\n },\n set: function (value) {\n this._height = value;\n }\n});\n\n/* DataType */\n\n/**\n * @type {number}\n */\nTexture.BYTE = glenum.BYTE;\n/**\n * @type {number}\n */\nTexture.UNSIGNED_BYTE = glenum.UNSIGNED_BYTE;\n/**\n * @type {number}\n */\nTexture.SHORT = glenum.SHORT;\n/**\n * @type {number}\n */\nTexture.UNSIGNED_SHORT = glenum.UNSIGNED_SHORT;\n/**\n * @type {number}\n */\nTexture.INT = glenum.INT;\n/**\n * @type {number}\n */\nTexture.UNSIGNED_INT = glenum.UNSIGNED_INT;\n/**\n * @type {number}\n */\nTexture.FLOAT = glenum.FLOAT;\n/**\n * @type {number}\n */\nTexture.HALF_FLOAT = 0x8D61;\n\n/**\n * UNSIGNED_INT_24_8_WEBGL for WEBGL_depth_texture extension\n * @type {number}\n */\nTexture.UNSIGNED_INT_24_8_WEBGL = 34042;\n\n/* PixelFormat */\n/**\n * @type {number}\n */\nTexture.DEPTH_COMPONENT = glenum.DEPTH_COMPONENT;\n/**\n * @type {number}\n */\nTexture.DEPTH_STENCIL = glenum.DEPTH_STENCIL;\n/**\n * @type {number}\n */\nTexture.ALPHA = glenum.ALPHA;\n/**\n * @type {number}\n */\nTexture.RGB = glenum.RGB;\n/**\n * @type {number}\n */\nTexture.RGBA = glenum.RGBA;\n/**\n * @type {number}\n */\nTexture.LUMINANCE = glenum.LUMINANCE;\n/**\n * @type {number}\n */\nTexture.LUMINANCE_ALPHA = glenum.LUMINANCE_ALPHA;\n\n/**\n * @see https://www.khronos.org/registry/webgl/extensions/EXT_sRGB/\n * @type {number}\n */\nTexture.SRGB = 0x8C40;\n/**\n * @see https://www.khronos.org/registry/webgl/extensions/EXT_sRGB/\n * @type {number}\n */\nTexture.SRGB_ALPHA = 0x8C42;\n\n/* Compressed Texture */\nTexture.COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;\nTexture.COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;\nTexture.COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;\nTexture.COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;\n\n/* TextureMagFilter */\n/**\n * @type {number}\n */\nTexture.NEAREST = glenum.NEAREST;\n/**\n * @type {number}\n */\nTexture.LINEAR = glenum.LINEAR;\n\n/* TextureMinFilter */\n/**\n * @type {number}\n */\nTexture.NEAREST_MIPMAP_NEAREST = glenum.NEAREST_MIPMAP_NEAREST;\n/**\n * @type {number}\n */\nTexture.LINEAR_MIPMAP_NEAREST = glenum.LINEAR_MIPMAP_NEAREST;\n/**\n * @type {number}\n */\nTexture.NEAREST_MIPMAP_LINEAR = glenum.NEAREST_MIPMAP_LINEAR;\n/**\n * @type {number}\n */\nTexture.LINEAR_MIPMAP_LINEAR = glenum.LINEAR_MIPMAP_LINEAR;\n\n/* TextureWrapMode */\n/**\n * @type {number}\n */\nTexture.REPEAT = glenum.REPEAT;\n/**\n * @type {number}\n */\nTexture.CLAMP_TO_EDGE = glenum.CLAMP_TO_EDGE;\n/**\n * @type {number}\n */\nTexture.MIRRORED_REPEAT = glenum.MIRRORED_REPEAT;\n\n\nexport default Texture;\n","import Renderable from './Renderable';\nimport glenum from './core/glenum';\n\n/**\n * @constructor clay.Mesh\n * @extends clay.Renderable\n */\nvar Mesh = Renderable.extend(/** @lends clay.Mesh# */ {\n /**\n * Used when it is a skinned mesh\n * @type {clay.Skeleton}\n */\n skeleton: null,\n /**\n * Joints indices Meshes can share the one skeleton instance and each mesh can use one part of joints. Joints indices indicate the index of joint in the skeleton instance\n * @type {number[]}\n */\n joints: null\n\n}, function () {\n if (!this.joints) {\n this.joints = [];\n }\n}, {\n\n /**\n * Offset matrix used for multiple skinned mesh clone sharing one skeleton\n * @type {clay.Matrix4}\n */\n offsetMatrix: null,\n\n isInstancedMesh: function () { return false; },\n\n isSkinnedMesh: function () {\n return !!(this.skeleton && this.joints && this.joints.length > 0);\n },\n\n clone: function () {\n var mesh = Renderable.prototype.clone.call(this);\n mesh.skeleton = this.skeleton;\n if (this.joints) {\n mesh.joints = this.joints.slice();\n }\n return mesh;\n }\n});\n\n// Enums\nMesh.POINTS = glenum.POINTS;\nMesh.LINES = glenum.LINES;\nMesh.LINE_LOOP = glenum.LINE_LOOP;\nMesh.LINE_STRIP = glenum.LINE_STRIP;\nMesh.TRIANGLES = glenum.TRIANGLES;\nMesh.TRIANGLE_STRIP = glenum.TRIANGLE_STRIP;\nMesh.TRIANGLE_FAN = glenum.TRIANGLE_FAN;\n\nMesh.BACK = glenum.BACK;\nMesh.FRONT = glenum.FRONT;\nMesh.FRONT_AND_BACK = glenum.FRONT_AND_BACK;\nMesh.CW = glenum.CW;\nMesh.CCW = glenum.CCW;\n\nexport default Mesh;\n","var mathUtil = {};\n\nmathUtil.isPowerOfTwo = function (value) {\n return (value & (value - 1)) === 0;\n};\n\nmathUtil.nextPowerOfTwo = function (value) {\n value --;\n value |= value >> 1;\n value |= value >> 2;\n value |= value >> 4;\n value |= value >> 8;\n value |= value >> 16;\n value ++;\n\n return value;\n};\n\nmathUtil.nearestPowerOfTwo = function (value) {\n return Math.pow( 2, Math.round( Math.log( value ) / Math.LN2 ) );\n};\n\nexport default mathUtil;\n","import Texture from './Texture';\nimport glenum from './core/glenum';\nimport vendor from './core/vendor';\nimport mathUtil from './math/util';\nvar isPowerOfTwo = mathUtil.isPowerOfTwo;\n\nfunction nearestPowerOfTwo(val) {\n return Math.pow(2, Math.round(Math.log(val) / Math.LN2));\n}\nfunction convertTextureToPowerOfTwo(texture, canvas) {\n // var canvas = document.createElement('canvas');\n var width = nearestPowerOfTwo(texture.width);\n var height = nearestPowerOfTwo(texture.height);\n canvas = canvas || document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n var ctx = canvas.getContext('2d');\n ctx.drawImage(texture.image, 0, 0, width, height);\n\n return canvas;\n}\n\n/**\n * @constructor clay.Texture2D\n * @extends clay.Texture\n *\n * @example\n * ...\n * var mat = new clay.Material({\n * shader: clay.shader.library.get('clay.phong', 'diffuseMap')\n * });\n * var diffuseMap = new clay.Texture2D();\n * diffuseMap.load('assets/textures/diffuse.jpg');\n * mat.set('diffuseMap', diffuseMap);\n * ...\n * diffuseMap.success(function () {\n * // Wait for the diffuse texture loaded\n * animation.on('frame', function (frameTime) {\n * renderer.render(scene, camera);\n * });\n * });\n */\nvar Texture2D = Texture.extend(function () {\n return /** @lends clay.Texture2D# */ {\n /**\n * @type {?HTMLImageElement|HTMLCanvasElemnet}\n */\n // TODO mark dirty when assigned.\n image: null,\n /**\n * Pixels data. Will be ignored if image is set.\n * @type {?Uint8Array|Float32Array}\n */\n pixels: null,\n /**\n * @type {Array.}\n * @example\n * [{\n * image: mipmap0,\n * pixels: null\n * }, {\n * image: mipmap1,\n * pixels: null\n * }, ....]\n */\n mipmaps: [],\n\n /**\n * If convert texture to power-of-two\n * @type {boolean}\n */\n convertToPOT: false\n };\n}, {\n\n textureType: 'texture2D',\n\n update: function (renderer) {\n\n var _gl = renderer.gl;\n _gl.bindTexture(_gl.TEXTURE_2D, this._cache.get('webgl_texture'));\n\n this.updateCommon(renderer);\n\n var glFormat = this.format;\n var glType = this.type;\n\n // Convert to pot is only available when using image/canvas/video element.\n var convertToPOT = !!(this.convertToPOT\n && !this.mipmaps.length && this.image\n && (this.wrapS === Texture.REPEAT || this.wrapT === Texture.REPEAT)\n && this.NPOT\n );\n\n _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, convertToPOT ? this.wrapS : this.getAvailableWrapS());\n _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, convertToPOT ? this.wrapT : this.getAvailableWrapT());\n\n _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, convertToPOT ? this.magFilter : this.getAvailableMagFilter());\n _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, convertToPOT ? this.minFilter : this.getAvailableMinFilter());\n\n var anisotropicExt = renderer.getGLExtension('EXT_texture_filter_anisotropic');\n if (anisotropicExt && this.anisotropic > 1) {\n _gl.texParameterf(_gl.TEXTURE_2D, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropic);\n }\n\n // Fallback to float type if browser don't have half float extension\n if (glType === 36193) {\n var halfFloatExt = renderer.getGLExtension('OES_texture_half_float');\n if (!halfFloatExt) {\n glType = glenum.FLOAT;\n }\n }\n\n if (this.mipmaps.length) {\n var width = this.width;\n var height = this.height;\n for (var i = 0; i < this.mipmaps.length; i++) {\n var mipmap = this.mipmaps[i];\n this._updateTextureData(_gl, mipmap, i, width, height, glFormat, glType, false);\n width /= 2;\n height /= 2;\n }\n }\n else {\n this._updateTextureData(_gl, this, 0, this.width, this.height, glFormat, glType, convertToPOT);\n\n if (this.useMipmap && (!this.NPOT || convertToPOT)) {\n _gl.generateMipmap(_gl.TEXTURE_2D);\n }\n }\n\n _gl.bindTexture(_gl.TEXTURE_2D, null);\n },\n\n _updateTextureData: function (_gl, data, level, width, height, glFormat, glType, convertToPOT) {\n if (data.image) {\n var imgData = data.image;\n if (convertToPOT) {\n this._potCanvas = convertTextureToPowerOfTwo(this, this._potCanvas);\n imgData = this._potCanvas;\n }\n _gl.texImage2D(_gl.TEXTURE_2D, level, glFormat, glFormat, glType, imgData);\n }\n else {\n // Can be used as a blank texture when writing render to texture(RTT)\n if (\n glFormat <= Texture.COMPRESSED_RGBA_S3TC_DXT5_EXT\n && glFormat >= Texture.COMPRESSED_RGB_S3TC_DXT1_EXT\n ) {\n _gl.compressedTexImage2D(_gl.TEXTURE_2D, level, glFormat, width, height, 0, data.pixels);\n }\n else {\n // Is a render target if pixels is null\n _gl.texImage2D(_gl.TEXTURE_2D, level, glFormat, width, height, 0, glFormat, glType, data.pixels);\n }\n }\n },\n\n /**\n * @param {clay.Renderer} renderer\n * @memberOf clay.Texture2D.prototype\n */\n generateMipmap: function (renderer) {\n var _gl = renderer.gl;\n if (this.useMipmap && !this.NPOT) {\n _gl.bindTexture(_gl.TEXTURE_2D, this._cache.get('webgl_texture'));\n _gl.generateMipmap(_gl.TEXTURE_2D);\n }\n },\n\n isPowerOfTwo: function () {\n return isPowerOfTwo(this.width) && isPowerOfTwo(this.height);\n },\n\n isRenderable: function () {\n if (this.image) {\n return this.image.width > 0 && this.image.height > 0;\n }\n else {\n return !!(this.width && this.height);\n }\n },\n\n bind: function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, this.getWebGLTexture(renderer));\n },\n\n unbind: function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, null);\n },\n\n load: function (src, crossOrigin) {\n var image = vendor.createImage();\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n var self = this;\n image.onload = function () {\n self.dirty();\n self.trigger('success', self);\n };\n image.onerror = function () {\n self.trigger('error', self);\n };\n\n image.src = src;\n this.image = image;\n\n return this;\n }\n});\n\nObject.defineProperty(Texture2D.prototype, 'width', {\n get: function () {\n if (this.image) {\n return this.image.width;\n }\n return this._width;\n },\n set: function (value) {\n if (this.image) {\n console.warn('Texture from image can\\'t set width');\n }\n else {\n if (this._width !== value) {\n this.dirty();\n }\n this._width = value;\n }\n }\n});\nObject.defineProperty(Texture2D.prototype, 'height', {\n get: function () {\n if (this.image) {\n return this.image.height;\n }\n return this._height;\n },\n set: function (value) {\n if (this.image) {\n console.warn('Texture from image can\\'t set height');\n }\n else {\n if (this._height !== value) {\n this.dirty();\n }\n this._height = value;\n }\n }\n});\n\nexport default Texture2D;\n","import Base from './core/Base';\nimport glenum from './core/glenum';\nimport Cache from './core/Cache';\nimport vendor from './core/vendor';\n\nfunction getArrayCtorByType (type) {\n return ({\n 'byte': vendor.Int8Array,\n 'ubyte': vendor.Uint8Array,\n 'short': vendor.Int16Array,\n 'ushort': vendor.Uint16Array\n })[type] || vendor.Float32Array;\n}\n\nfunction makeAttrKey(attrName) {\n return 'attr_' + attrName;\n}\n/**\n * GeometryBase attribute\n * @alias clay.GeometryBase.Attribute\n * @constructor\n */\nfunction Attribute(name, type, size, semantic) {\n /**\n * Attribute name\n * @type {string}\n */\n this.name = name;\n /**\n * Attribute type\n * Possible values:\n * + `'byte'`\n * + `'ubyte'`\n * + `'short'`\n * + `'ushort'`\n * + `'float'` Most commonly used.\n * @type {string}\n */\n this.type = type;\n /**\n * Size of attribute component. 1 - 4.\n * @type {number}\n */\n this.size = size;\n /**\n * Semantic of this attribute.\n * Possible values:\n * + `'POSITION'`\n * + `'NORMAL'`\n * + `'BINORMAL'`\n * + `'TANGENT'`\n * + `'TEXCOORD'`\n * + `'TEXCOORD_0'`\n * + `'TEXCOORD_1'`\n * + `'COLOR'`\n * + `'JOINT'`\n * + `'WEIGHT'`\n *\n * In shader, attribute with same semantic will be automatically mapped. For example:\n * ```glsl\n * attribute vec3 pos: POSITION\n * ```\n * will use the attribute value with semantic POSITION in geometry, no matter what name it used.\n * @type {string}\n */\n this.semantic = semantic || '';\n\n /**\n * Value of the attribute.\n * @type {TypedArray}\n */\n this.value = null;\n\n // Init getter setter\n switch (size) {\n case 1:\n this.get = function (idx) {\n return this.value[idx];\n };\n this.set = function (idx, value) {\n this.value[idx] = value;\n };\n // Copy from source to target\n this.copy = function (target, source) {\n this.value[target] = this.value[target];\n };\n break;\n case 2:\n this.get = function (idx, out) {\n var arr = this.value;\n out[0] = arr[idx * 2];\n out[1] = arr[idx * 2 + 1];\n return out;\n };\n this.set = function (idx, val) {\n var arr = this.value;\n arr[idx * 2] = val[0];\n arr[idx * 2 + 1] = val[1];\n };\n this.copy = function (target, source) {\n var arr = this.value;\n source *= 2;\n target *= 2;\n arr[target] = arr[source];\n arr[target + 1] = arr[source + 1];\n };\n break;\n case 3:\n this.get = function (idx, out) {\n var idx3 = idx * 3;\n var arr = this.value;\n out[0] = arr[idx3];\n out[1] = arr[idx3 + 1];\n out[2] = arr[idx3 + 2];\n return out;\n };\n this.set = function (idx, val) {\n var idx3 = idx * 3;\n var arr = this.value;\n arr[idx3] = val[0];\n arr[idx3 + 1] = val[1];\n arr[idx3 + 2] = val[2];\n };\n this.copy = function (target, source) {\n var arr = this.value;\n source *= 3;\n target *= 3;\n arr[target] = arr[source];\n arr[target + 1] = arr[source + 1];\n arr[target + 2] = arr[source + 2];\n };\n break;\n case 4:\n this.get = function (idx, out) {\n var arr = this.value;\n var idx4 = idx * 4;\n out[0] = arr[idx4];\n out[1] = arr[idx4 + 1];\n out[2] = arr[idx4 + 2];\n out[3] = arr[idx4 + 3];\n return out;\n };\n this.set = function (idx, val) {\n var arr = this.value;\n var idx4 = idx * 4;\n arr[idx4] = val[0];\n arr[idx4 + 1] = val[1];\n arr[idx4 + 2] = val[2];\n arr[idx4 + 3] = val[3];\n };\n this.copy = function (target, source) {\n var arr = this.value;\n source *= 4;\n target *= 4;\n // copyWithin is extremely slow\n arr[target] = arr[source];\n arr[target + 1] = arr[source + 1];\n arr[target + 2] = arr[source + 2];\n arr[target + 3] = arr[source + 3];\n };\n }\n}\n\n/**\n * Set item value at give index. Second parameter val is number if size is 1\n * @function\n * @name clay.GeometryBase.Attribute#set\n * @param {number} idx\n * @param {number[]|number} val\n * @example\n * geometry.getAttribute('position').set(0, [1, 1, 1]);\n */\n\n/**\n * Get item value at give index. Second parameter out is no need if size is 1\n * @function\n * @name clay.GeometryBase.Attribute#set\n * @param {number} idx\n * @param {number[]} [out]\n * @example\n * geometry.getAttribute('position').get(0, out);\n */\n\n/**\n * Initialize attribute with given vertex count\n * @param {number} nVertex\n */\nAttribute.prototype.init = function (nVertex) {\n if (!this.value || this.value.length !== nVertex * this.size) {\n var ArrayConstructor = getArrayCtorByType(this.type);\n this.value = new ArrayConstructor(nVertex * this.size);\n }\n};\n\n/**\n * Initialize attribute with given array. Which can be 1 dimensional or 2 dimensional\n * @param {Array} array\n * @example\n * geometry.getAttribute('position').fromArray(\n * [-1, 0, 0, 1, 0, 0, 0, 1, 0]\n * );\n * geometry.getAttribute('position').fromArray(\n * [ [-1, 0, 0], [1, 0, 0], [0, 1, 0] ]\n * );\n */\nAttribute.prototype.fromArray = function (array) {\n var ArrayConstructor = getArrayCtorByType(this.type);\n var value;\n // Convert 2d array to flat\n if (array[0] && (array[0].length)) {\n var n = 0;\n var size = this.size;\n value = new ArrayConstructor(array.length * size);\n for (var i = 0; i < array.length; i++) {\n for (var j = 0; j < size; j++) {\n value[n++] = array[i][j];\n }\n }\n }\n else {\n value = new ArrayConstructor(array);\n }\n this.value = value;\n};\n\nAttribute.prototype.clone = function(copyValue) {\n var ret = new Attribute(this.name, this.type, this.size, this.semantic);\n // FIXME\n if (copyValue) {\n console.warn('todo');\n }\n return ret;\n};\n\nfunction AttributeBuffer(name, type, buffer, size, semantic) {\n this.name = name;\n this.type = type;\n this.buffer = buffer;\n this.size = size;\n this.semantic = semantic;\n\n // To be set in mesh\n // symbol in the shader\n this.symbol = '';\n\n // Needs remove flag\n this.needsRemove = false;\n}\n\nfunction IndicesBuffer(buffer) {\n this.buffer = buffer;\n this.count = 0;\n}\n\n/**\n * Base of all geometry. Use {@link clay.Geometry} for common 3D usage.\n * @constructor clay.GeometryBase\n * @extends clay.core.Base\n */\nvar GeometryBase = Base.extend(function () {\n return /** @lends clay.GeometryBase# */ {\n /**\n * Attributes of geometry.\n * @type {Object.}\n */\n attributes: {},\n\n /**\n * Indices of geometry.\n * @type {Uint16Array|Uint32Array}\n */\n indices: null,\n\n /**\n * Is vertices data dynamically updated.\n * Attributes value can't be changed after first render if dyanmic is false.\n * @type {boolean}\n */\n dynamic: true,\n\n _enabledAttributes: null,\n\n // PENDING\n // Init it here to avoid deoptimization when it's assigned in application dynamically\n __used: 0\n };\n}, function () {\n // Use cache\n this._cache = new Cache();\n\n this._attributeList = Object.keys(this.attributes);\n\n this.__vaoCache = {};\n},\n/** @lends clay.GeometryBase.prototype */\n{\n /**\n * Main attribute will be used to count vertex number\n * @type {string}\n */\n mainAttribute: '',\n /**\n * User defined picking algorithm instead of default\n * triangle ray intersection\n * x, y are NDC.\n * ```typescript\n * (x, y, renderer, camera, renderable, out) => boolean\n * ```\n * @type {?Function}\n */\n pick: null,\n\n /**\n * User defined ray picking algorithm instead of default\n * triangle ray intersection\n * ```typescript\n * (ray: clay.Ray, renderable: clay.Renderable, out: Array) => boolean\n * ```\n * @type {?Function}\n */\n pickByRay: null,\n\n /**\n * Mark attributes and indices in geometry needs to update.\n * Usually called after you change the data in attributes.\n */\n dirty: function () {\n var enabledAttributes = this.getEnabledAttributes();\n for (var i = 0; i < enabledAttributes.length; i++) {\n this.dirtyAttribute(enabledAttributes[i]);\n }\n this.dirtyIndices();\n this._enabledAttributes = null;\n\n this._cache.dirty('any');\n },\n /**\n * Mark the indices needs to update.\n */\n dirtyIndices: function () {\n this._cache.dirtyAll('indices');\n },\n /**\n * Mark the attributes needs to update.\n * @param {string} [attrName]\n */\n dirtyAttribute: function (attrName) {\n this._cache.dirtyAll(makeAttrKey(attrName));\n this._cache.dirtyAll('attributes');\n },\n /**\n * Get indices of triangle at given index.\n * @param {number} idx\n * @param {Array.} out\n * @return {Array.}\n */\n getTriangleIndices: function (idx, out) {\n if (idx < this.triangleCount && idx >= 0) {\n if (!out) {\n out = [];\n }\n var indices = this.indices;\n out[0] = indices[idx * 3];\n out[1] = indices[idx * 3 + 1];\n out[2] = indices[idx * 3 + 2];\n return out;\n }\n },\n\n /**\n * Set indices of triangle at given index.\n * @param {number} idx\n * @param {Array.} arr\n */\n setTriangleIndices: function (idx, arr) {\n var indices = this.indices;\n indices[idx * 3] = arr[0];\n indices[idx * 3 + 1] = arr[1];\n indices[idx * 3 + 2] = arr[2];\n },\n\n isUseIndices: function () {\n return !!this.indices;\n },\n\n /**\n * Initialize indices from an array.\n * @param {Array} array\n */\n initIndicesFromArray: function (array) {\n var value;\n var ArrayConstructor = this.vertexCount > 0xffff\n ? vendor.Uint32Array : vendor.Uint16Array;\n // Convert 2d array to flat\n if (array[0] && (array[0].length)) {\n var n = 0;\n var size = 3;\n\n value = new ArrayConstructor(array.length * size);\n for (var i = 0; i < array.length; i++) {\n for (var j = 0; j < size; j++) {\n value[n++] = array[i][j];\n }\n }\n }\n else {\n value = new ArrayConstructor(array);\n }\n\n this.indices = value;\n },\n /**\n * Create a new attribute\n * @param {string} name\n * @param {string} type\n * @param {number} size\n * @param {string} [semantic]\n */\n createAttribute: function (name, type, size, semantic) {\n var attrib = new Attribute(name, type, size, semantic);\n if (this.attributes[name]) {\n this.removeAttribute(name);\n }\n this.attributes[name] = attrib;\n this._attributeList.push(name);\n return attrib;\n },\n /**\n * Remove attribute\n * @param {string} name\n */\n removeAttribute: function (name) {\n var attributeList = this._attributeList;\n var idx = attributeList.indexOf(name);\n if (idx >= 0) {\n attributeList.splice(idx, 1);\n delete this.attributes[name];\n return true;\n }\n return false;\n },\n\n /**\n * Get attribute\n * @param {string} name\n * @return {clay.GeometryBase.Attribute}\n */\n getAttribute: function (name) {\n return this.attributes[name];\n },\n\n /**\n * Get enabled attributes name list\n * Attribute which has the same vertex number with position is treated as a enabled attribute\n * @return {string[]}\n */\n getEnabledAttributes: function () {\n var enabledAttributes = this._enabledAttributes;\n var attributeList = this._attributeList;\n // Cache\n if (enabledAttributes) {\n return enabledAttributes;\n }\n\n var result = [];\n var nVertex = this.vertexCount;\n\n for (var i = 0; i < attributeList.length; i++) {\n var name = attributeList[i];\n var attrib = this.attributes[name];\n if (attrib.value) {\n if (attrib.value.length === nVertex * attrib.size) {\n result.push(name);\n }\n }\n }\n\n this._enabledAttributes = result;\n\n return result;\n },\n\n getBufferChunks: function (renderer) {\n var cache = this._cache;\n cache.use(renderer.__uid__);\n var isAttributesDirty = cache.isDirty('attributes');\n var isIndicesDirty = cache.isDirty('indices');\n if (isAttributesDirty || isIndicesDirty) {\n this._updateBuffer(renderer.gl, isAttributesDirty, isIndicesDirty);\n var enabledAttributes = this.getEnabledAttributes();\n for (var i = 0; i < enabledAttributes.length; i++) {\n cache.fresh(makeAttrKey(enabledAttributes[i]));\n }\n cache.fresh('attributes');\n cache.fresh('indices');\n }\n cache.fresh('any');\n return cache.get('chunks');\n },\n\n _updateBuffer: function (_gl, isAttributesDirty, isIndicesDirty) {\n var cache = this._cache;\n var chunks = cache.get('chunks');\n var firstUpdate = false;\n if (!chunks) {\n chunks = [];\n // Intialize\n chunks[0] = {\n attributeBuffers: [],\n indicesBuffer: null\n };\n cache.put('chunks', chunks);\n firstUpdate = true;\n }\n\n var chunk = chunks[0];\n var attributeBuffers = chunk.attributeBuffers;\n var indicesBuffer = chunk.indicesBuffer;\n\n if (isAttributesDirty || firstUpdate) {\n var attributeList = this.getEnabledAttributes();\n\n var attributeBufferMap = {};\n if (!firstUpdate) {\n for (var i = 0; i < attributeBuffers.length; i++) {\n attributeBufferMap[attributeBuffers[i].name] = attributeBuffers[i];\n }\n }\n // FIXME If some attributes removed\n for (var k = 0; k < attributeList.length; k++) {\n var name = attributeList[k];\n var attribute = this.attributes[name];\n\n var bufferInfo;\n\n if (!firstUpdate) {\n bufferInfo = attributeBufferMap[name];\n }\n var buffer;\n if (bufferInfo) {\n buffer = bufferInfo.buffer;\n }\n else {\n buffer = _gl.createBuffer();\n }\n if (cache.isDirty(makeAttrKey(name))) {\n // Only update when they are dirty.\n // TODO: Use BufferSubData?\n _gl.bindBuffer(_gl.ARRAY_BUFFER, buffer);\n _gl.bufferData(_gl.ARRAY_BUFFER, attribute.value, this.dynamic ? _gl.DYNAMIC_DRAW : _gl.STATIC_DRAW);\n }\n\n attributeBuffers[k] = new AttributeBuffer(name, attribute.type, buffer, attribute.size, attribute.semantic);\n }\n // Remove unused attributes buffers.\n // PENDING\n for (var i = k; i < attributeBuffers.length; i++) {\n _gl.deleteBuffer(attributeBuffers[i].buffer);\n }\n attributeBuffers.length = k;\n\n }\n\n if (this.isUseIndices() && (isIndicesDirty || firstUpdate)) {\n if (!indicesBuffer) {\n indicesBuffer = new IndicesBuffer(_gl.createBuffer());\n chunk.indicesBuffer = indicesBuffer;\n }\n indicesBuffer.count = this.indices.length;\n _gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER, indicesBuffer.buffer);\n _gl.bufferData(_gl.ELEMENT_ARRAY_BUFFER, this.indices, this.dynamic ? _gl.DYNAMIC_DRAW : _gl.STATIC_DRAW);\n }\n },\n\n /**\n * Dispose geometry data in GL context.\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n\n var cache = this._cache;\n\n cache.use(renderer.__uid__);\n var chunks = cache.get('chunks');\n if (chunks) {\n for (var c = 0; c < chunks.length; c++) {\n var chunk = chunks[c];\n\n for (var k = 0; k < chunk.attributeBuffers.length; k++) {\n var attribs = chunk.attributeBuffers[k];\n renderer.gl.deleteBuffer(attribs.buffer);\n }\n\n if (chunk.indicesBuffer) {\n renderer.gl.deleteBuffer(chunk.indicesBuffer.buffer);\n }\n }\n }\n if (this.__vaoCache) {\n var vaoExt = renderer.getGLExtension('OES_vertex_array_object');\n for (var id in this.__vaoCache) {\n var vao = this.__vaoCache[id].vao;\n if (vao) {\n vaoExt.deleteVertexArrayOES(vao);\n }\n }\n }\n this.__vaoCache = {};\n cache.deleteContext(renderer.__uid__);\n }\n\n});\n\nif (Object.defineProperty) {\n /**\n * @name clay.GeometryBase#vertexCount\n * @type {number}\n * @readOnly\n */\n Object.defineProperty(GeometryBase.prototype, 'vertexCount', {\n\n enumerable: false,\n\n get: function () {\n\n var mainAttribute = this.attributes[this.mainAttribute];\n\n if (!mainAttribute) {\n mainAttribute = this.attributes[this._attributeList[0]];\n }\n\n if (!mainAttribute || !mainAttribute.value) {\n return 0;\n }\n return mainAttribute.value.length / mainAttribute.size;\n }\n });\n /**\n * @name clay.GeometryBase#triangleCount\n * @type {number}\n * @readOnly\n */\n Object.defineProperty(GeometryBase.prototype, 'triangleCount', {\n\n enumerable: false,\n\n get: function () {\n var indices = this.indices;\n if (!indices) {\n return 0;\n }\n else {\n return indices.length / 3;\n }\n }\n });\n}\n\nGeometryBase.STATIC_DRAW = glenum.STATIC_DRAW;\nGeometryBase.DYNAMIC_DRAW = glenum.DYNAMIC_DRAW;\nGeometryBase.STREAM_DRAW = glenum.STREAM_DRAW;\n\nGeometryBase.AttributeBuffer = AttributeBuffer;\nGeometryBase.IndicesBuffer = IndicesBuffer;\n\nGeometryBase.Attribute = Attribute;\n\nexport default GeometryBase;\n","import vendor from './core/vendor';\nimport vec3 from './glmatrix/vec3';\nimport mat4 from './glmatrix/mat4';\nimport BoundingBox from './math/BoundingBox';\nimport GeometryBase from './GeometryBase';\n\nvar vec3Create = vec3.create;\nvar vec3Add = vec3.add;\nvar vec3Set = vec3.set;\n\nvar Attribute = GeometryBase.Attribute;\n\n/**\n * Geometry in ClayGL contains vertex attributes of mesh. These vertex attributes will be finally provided to the {@link clay.Shader}.\n * Different {@link clay.Shader} needs different attributes. Here is a list of attributes used in the builtin shaders.\n *\n * + position: `clay.basic`, `clay.lambert`, `clay.standard`\n * + texcoord0: `clay.basic`, `clay.lambert`, `clay.standard`\n * + color: `clay.basic`, `clay.lambert`, `clay.standard`\n * + weight: `clay.basic`, `clay.lambert`, `clay.standard`\n * + joint: `clay.basic`, `clay.lambert`, `clay.standard`\n * + normal: `clay.lambert`, `clay.standard`\n * + tangent: `clay.standard`\n *\n * #### Create a procedural geometry\n *\n * ClayGL provides a couple of builtin procedural geometries. Inlcuding:\n *\n * + {@link clay.geometry.Cube}\n * + {@link clay.geometry.Sphere}\n * + {@link clay.geometry.Plane}\n * + {@link clay.geometry.Cylinder}\n * + {@link clay.geometry.Cone}\n * + {@link clay.geometry.ParametricSurface}\n *\n * It's simple to create a basic geometry with these classes.\n *\n```js\nvar sphere = new clay.geometry.Sphere({\n radius: 2\n});\n```\n *\n * #### Create the geometry data by yourself\n *\n * Usually the vertex attributes data are created by the {@link clay.loader.GLTF} or procedural geometries like {@link clay.geometry.Sphere}.\n * Besides these, you can create the data manually. Here is a simple example to create a triangle.\n```js\nvar TRIANGLE_POSITIONS = [\n [-0.5, -0.5, 0],\n [0.5, -0.5, 0],\n [0, 0.5, 0]\n];\nvar geometry = new clay.StaticGeometryBase();\n// Add triangle vertices to position attribute.\ngeometry.attributes.position.fromArray(TRIANGLE_POSITIONS);\n```\n * Then you can use the utility methods like `generateVertexNormals`, `generateTangents` to create the remaining necessary attributes.\n *\n *\n * #### Use with custom shaders\n *\n * If you wan't to write custom shaders. Don't forget to add SEMANTICS to these attributes. For example\n *\n ```glsl\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n```\n * These `POSITION`, `TEXCOORD_0`, `NORMAL` are SEMANTICS which will map the attributes in shader to the attributes in the GeometryBase\n *\n * Available attributes SEMANTICS includes `POSITION`, `TEXCOORD_0`, `TEXCOORD_1` `NORMAL`, `TANGENT`, `COLOR`, `WEIGHT`, `JOINT`.\n *\n *\n * @constructor clay.Geometry\n * @extends clay.GeometryBase\n */\nvar Geometry = GeometryBase.extend(function () {\n return /** @lends clay.Geometry# */ {\n /**\n * Attributes of geometry. Including:\n * + `position`\n * + `texcoord0`\n * + `texcoord1`\n * + `normal`\n * + `tangent`\n * + `color`\n * + `weight`\n * + `joint`\n * + `barycentric`\n *\n * @type {Object.}\n */\n attributes: {\n position: new Attribute('position', 'float', 3, 'POSITION'),\n texcoord0: new Attribute('texcoord0', 'float', 2, 'TEXCOORD_0'),\n texcoord1: new Attribute('texcoord1', 'float', 2, 'TEXCOORD_1'),\n normal: new Attribute('normal', 'float', 3, 'NORMAL'),\n tangent: new Attribute('tangent', 'float', 4, 'TANGENT'),\n color: new Attribute('color', 'float', 4, 'COLOR'),\n // Skinning attributes\n // Each vertex can be bind to 4 bones, because the\n // sum of weights is 1, so the weights is stored in vec3 and the last\n // can be calculated by 1-w.x-w.y-w.z\n weight: new Attribute('weight', 'float', 3, 'WEIGHT'),\n joint: new Attribute('joint', 'float', 4, 'JOINT'),\n // For wireframe display\n // http://codeflow.org/entries/2012/aug/02/easy-wireframe-display-with-barycentric-coordinates/\n barycentric: new Attribute('barycentric', 'float', 3, null),\n },\n /**\n * Calculated bounding box of geometry.\n * @type {clay.BoundingBox}\n */\n boundingBox: null\n };\n},\n/** @lends clay.Geometry.prototype */\n{\n\n mainAttribute: 'position',\n\n /**\n * Update boundingBox of Geometry\n */\n updateBoundingBox: function () {\n var bbox = this.boundingBox;\n if (!bbox) {\n bbox = this.boundingBox = new BoundingBox();\n }\n var posArr = this.attributes.position.value;\n if (posArr && posArr.length) {\n var min = bbox.min;\n var max = bbox.max;\n var minArr = min.array;\n var maxArr = max.array;\n vec3.set(minArr, posArr[0], posArr[1], posArr[2]);\n vec3.set(maxArr, posArr[0], posArr[1], posArr[2]);\n for (var i = 3; i < posArr.length;) {\n var x = posArr[i++];\n var y = posArr[i++];\n var z = posArr[i++];\n if (x < minArr[0]) { minArr[0] = x; }\n if (y < minArr[1]) { minArr[1] = y; }\n if (z < minArr[2]) { minArr[2] = z; }\n\n if (x > maxArr[0]) { maxArr[0] = x; }\n if (y > maxArr[1]) { maxArr[1] = y; }\n if (z > maxArr[2]) { maxArr[2] = z; }\n }\n min._dirty = true;\n max._dirty = true;\n }\n },\n\n /**\n * Generate normals per vertex.\n */\n generateVertexNormals: function () {\n if (!this.vertexCount) {\n return;\n }\n\n var indices = this.indices;\n var attributes = this.attributes;\n var positions = attributes.position.value;\n var normals = attributes.normal.value;\n\n if (!normals || normals.length !== positions.length) {\n normals = attributes.normal.value = new vendor.Float32Array(positions.length);\n }\n else {\n // Reset\n for (var i = 0; i < normals.length; i++) {\n normals[i] = 0;\n }\n }\n\n var p1 = vec3Create();\n var p2 = vec3Create();\n var p3 = vec3Create();\n\n var v21 = vec3Create();\n var v32 = vec3Create();\n\n var n = vec3Create();\n\n var len = indices ? indices.length : this.vertexCount;\n var i1, i2, i3;\n for (var f = 0; f < len;) {\n if (indices) {\n i1 = indices[f++];\n i2 = indices[f++];\n i3 = indices[f++];\n }\n else {\n i1 = f++;\n i2 = f++;\n i3 = f++;\n }\n\n vec3Set(p1, positions[i1*3], positions[i1*3+1], positions[i1*3+2]);\n vec3Set(p2, positions[i2*3], positions[i2*3+1], positions[i2*3+2]);\n vec3Set(p3, positions[i3*3], positions[i3*3+1], positions[i3*3+2]);\n\n vec3.sub(v21, p1, p2);\n vec3.sub(v32, p2, p3);\n vec3.cross(n, v21, v32);\n // Already be weighted by the triangle area\n for (var i = 0; i < 3; i++) {\n normals[i1*3+i] = normals[i1*3+i] + n[i];\n normals[i2*3+i] = normals[i2*3+i] + n[i];\n normals[i3*3+i] = normals[i3*3+i] + n[i];\n }\n }\n\n for (var i = 0; i < normals.length;) {\n vec3Set(n, normals[i], normals[i+1], normals[i+2]);\n vec3.normalize(n, n);\n normals[i++] = n[0];\n normals[i++] = n[1];\n normals[i++] = n[2];\n }\n this.dirty();\n },\n\n /**\n * Generate normals per face.\n */\n generateFaceNormals: function () {\n if (!this.vertexCount) {\n return;\n }\n\n if (!this.isUniqueVertex()) {\n this.generateUniqueVertex();\n }\n\n var indices = this.indices;\n var attributes = this.attributes;\n var positions = attributes.position.value;\n var normals = attributes.normal.value;\n\n var p1 = vec3Create();\n var p2 = vec3Create();\n var p3 = vec3Create();\n\n var v21 = vec3Create();\n var v32 = vec3Create();\n var n = vec3Create();\n\n if (!normals) {\n normals = attributes.normal.value = new Float32Array(positions.length);\n }\n var len = indices ? indices.length : this.vertexCount;\n var i1, i2, i3;\n for (var f = 0; f < len;) {\n if (indices) {\n i1 = indices[f++];\n i2 = indices[f++];\n i3 = indices[f++];\n }\n else {\n i1 = f++;\n i2 = f++;\n i3 = f++;\n }\n\n vec3Set(p1, positions[i1*3], positions[i1*3+1], positions[i1*3+2]);\n vec3Set(p2, positions[i2*3], positions[i2*3+1], positions[i2*3+2]);\n vec3Set(p3, positions[i3*3], positions[i3*3+1], positions[i3*3+2]);\n\n vec3.sub(v21, p1, p2);\n vec3.sub(v32, p2, p3);\n vec3.cross(n, v21, v32);\n\n vec3.normalize(n, n);\n\n for (var i = 0; i < 3; i++) {\n normals[i1*3 + i] = n[i];\n normals[i2*3 + i] = n[i];\n normals[i3*3 + i] = n[i];\n }\n }\n this.dirty();\n },\n\n /**\n * Generate tangents attributes.\n */\n generateTangents: function () {\n if (!this.vertexCount) {\n return;\n }\n\n var nVertex = this.vertexCount;\n var attributes = this.attributes;\n if (!attributes.tangent.value) {\n attributes.tangent.value = new Float32Array(nVertex * 4);\n }\n var texcoords = attributes.texcoord0.value;\n var positions = attributes.position.value;\n var tangents = attributes.tangent.value;\n var normals = attributes.normal.value;\n\n if (!texcoords) {\n console.warn('Geometry without texcoords can\\'t generate tangents.');\n return;\n }\n\n var tan1 = [];\n var tan2 = [];\n for (var i = 0; i < nVertex; i++) {\n tan1[i] = [0.0, 0.0, 0.0];\n tan2[i] = [0.0, 0.0, 0.0];\n }\n\n var sdir = [0.0, 0.0, 0.0];\n var tdir = [0.0, 0.0, 0.0];\n var indices = this.indices;\n\n var len = indices ? indices.length : this.vertexCount;\n var i1, i2, i3;\n for (var i = 0; i < len;) {\n if (indices) {\n i1 = indices[i++];\n i2 = indices[i++];\n i3 = indices[i++];\n }\n else {\n i1 = i++;\n i2 = i++;\n i3 = i++;\n }\n\n var st1s = texcoords[i1 * 2],\n st2s = texcoords[i2 * 2],\n st3s = texcoords[i3 * 2],\n st1t = texcoords[i1 * 2 + 1],\n st2t = texcoords[i2 * 2 + 1],\n st3t = texcoords[i3 * 2 + 1],\n\n p1x = positions[i1 * 3],\n p2x = positions[i2 * 3],\n p3x = positions[i3 * 3],\n p1y = positions[i1 * 3 + 1],\n p2y = positions[i2 * 3 + 1],\n p3y = positions[i3 * 3 + 1],\n p1z = positions[i1 * 3 + 2],\n p2z = positions[i2 * 3 + 2],\n p3z = positions[i3 * 3 + 2];\n\n var x1 = p2x - p1x,\n x2 = p3x - p1x,\n y1 = p2y - p1y,\n y2 = p3y - p1y,\n z1 = p2z - p1z,\n z2 = p3z - p1z;\n\n var s1 = st2s - st1s,\n s2 = st3s - st1s,\n t1 = st2t - st1t,\n t2 = st3t - st1t;\n\n var r = 1.0 / (s1 * t2 - t1 * s2);\n sdir[0] = (t2 * x1 - t1 * x2) * r;\n sdir[1] = (t2 * y1 - t1 * y2) * r;\n sdir[2] = (t2 * z1 - t1 * z2) * r;\n\n tdir[0] = (s1 * x2 - s2 * x1) * r;\n tdir[1] = (s1 * y2 - s2 * y1) * r;\n tdir[2] = (s1 * z2 - s2 * z1) * r;\n\n vec3Add(tan1[i1], tan1[i1], sdir);\n vec3Add(tan1[i2], tan1[i2], sdir);\n vec3Add(tan1[i3], tan1[i3], sdir);\n vec3Add(tan2[i1], tan2[i1], tdir);\n vec3Add(tan2[i2], tan2[i2], tdir);\n vec3Add(tan2[i3], tan2[i3], tdir);\n }\n var tmp = vec3Create();\n var nCrossT = vec3Create();\n var n = vec3Create();\n for (var i = 0; i < nVertex; i++) {\n n[0] = normals[i * 3];\n n[1] = normals[i * 3 + 1];\n n[2] = normals[i * 3 + 2];\n var t = tan1[i];\n\n // Gram-Schmidt orthogonalize\n vec3.scale(tmp, n, vec3.dot(n, t));\n vec3.sub(tmp, t, tmp);\n vec3.normalize(tmp, tmp);\n // Calculate handedness.\n vec3.cross(nCrossT, n, t);\n tangents[i * 4] = tmp[0];\n tangents[i * 4 + 1] = tmp[1];\n tangents[i * 4 + 2] = tmp[2];\n // PENDING can config ?\n tangents[i * 4 + 3] = vec3.dot(nCrossT, tan2[i]) < 0.0 ? -1.0 : 1.0;\n }\n this.dirty();\n },\n\n /**\n * If vertices are not shared by different indices.\n */\n isUniqueVertex: function () {\n if (this.isUseIndices()) {\n return this.vertexCount === this.indices.length;\n }\n else {\n return true;\n }\n },\n /**\n * Create a unique vertex for each index.\n */\n generateUniqueVertex: function () {\n if (!this.vertexCount || !this.indices) {\n return;\n }\n\n if (this.indices.length > 0xffff) {\n this.indices = new vendor.Uint32Array(this.indices);\n }\n\n var attributes = this.attributes;\n var indices = this.indices;\n\n var attributeNameList = this.getEnabledAttributes();\n\n var oldAttrValues = {};\n for (var a = 0; a < attributeNameList.length; a++) {\n var name = attributeNameList[a];\n oldAttrValues[name] = attributes[name].value;\n attributes[name].init(this.indices.length);\n }\n\n var cursor = 0;\n for (var i = 0; i < indices.length; i++) {\n var ii = indices[i];\n for (var a = 0; a < attributeNameList.length; a++) {\n var name = attributeNameList[a];\n var array = attributes[name].value;\n var size = attributes[name].size;\n\n for (var k = 0; k < size; k++) {\n array[cursor * size + k] = oldAttrValues[name][ii * size + k];\n }\n }\n indices[i] = cursor;\n cursor++;\n }\n\n this.dirty();\n },\n\n /**\n * Generate barycentric coordinates for wireframe draw.\n */\n generateBarycentric: function () {\n if (!this.vertexCount) {\n return;\n }\n\n if (!this.isUniqueVertex()) {\n this.generateUniqueVertex();\n }\n\n var attributes = this.attributes;\n var array = attributes.barycentric.value;\n var indices = this.indices;\n // Already existed;\n if (array && array.length === indices.length * 3) {\n return;\n }\n array = attributes.barycentric.value = new Float32Array(indices.length * 3);\n\n for (var i = 0; i < (indices ? indices.length : this.vertexCount / 3);) {\n for (var j = 0; j < 3; j++) {\n var ii = indices ? indices[i++] : (i * 3 + j);\n array[ii * 3 + j] = 1;\n }\n }\n this.dirty();\n },\n\n /**\n * Apply transform to geometry attributes.\n * @param {clay.Matrix4} matrix\n */\n applyTransform: function (matrix) {\n\n var attributes = this.attributes;\n var positions = attributes.position.value;\n var normals = attributes.normal.value;\n var tangents = attributes.tangent.value;\n\n matrix = matrix.array;\n // Normal Matrix\n var inverseTransposeMatrix = mat4.create();\n mat4.invert(inverseTransposeMatrix, matrix);\n mat4.transpose(inverseTransposeMatrix, inverseTransposeMatrix);\n\n var vec3TransformMat4 = vec3.transformMat4;\n var vec3ForEach = vec3.forEach;\n vec3ForEach(positions, 3, 0, null, vec3TransformMat4, matrix);\n if (normals) {\n vec3ForEach(normals, 3, 0, null, vec3TransformMat4, inverseTransposeMatrix);\n }\n if (tangents) {\n vec3ForEach(tangents, 4, 0, null, vec3TransformMat4, inverseTransposeMatrix);\n }\n\n if (this.boundingBox) {\n this.updateBoundingBox();\n }\n },\n /**\n * Dispose geometry data in GL context.\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n\n var cache = this._cache;\n\n cache.use(renderer.__uid__);\n var chunks = cache.get('chunks');\n if (chunks) {\n for (var c = 0; c < chunks.length; c++) {\n var chunk = chunks[c];\n\n for (var k = 0; k < chunk.attributeBuffers.length; k++) {\n var attribs = chunk.attributeBuffers[k];\n renderer.gl.deleteBuffer(attribs.buffer);\n }\n\n if (chunk.indicesBuffer) {\n renderer.gl.deleteBuffer(chunk.indicesBuffer.buffer);\n }\n }\n }\n if (this.__vaoCache) {\n var vaoExt = renderer.getGLExtension('OES_vertex_array_object');\n for (var id in this.__vaoCache) {\n var vao = this.__vaoCache[id].vao;\n if (vao) {\n vaoExt.deleteVertexArrayOES(vao);\n }\n }\n }\n this.__vaoCache = {};\n cache.deleteContext(renderer.__uid__);\n }\n\n});\n\nGeometry.STATIC_DRAW = GeometryBase.STATIC_DRAW;\nGeometry.DYNAMIC_DRAW = GeometryBase.DYNAMIC_DRAW;\nGeometry.STREAM_DRAW = GeometryBase.STREAM_DRAW;\n\nGeometry.AttributeBuffer = GeometryBase.AttributeBuffer;\nGeometry.IndicesBuffer = GeometryBase.IndicesBuffer;\n\nGeometry.Attribute = Attribute;\n\nexport default Geometry;\n","export default \"vec3 calcAmbientSHLight(int idx, vec3 N) {\\n int offset = 9 * idx;\\n return ambientSHLightCoefficients[0]\\n + ambientSHLightCoefficients[1] * N.x\\n + ambientSHLightCoefficients[2] * N.y\\n + ambientSHLightCoefficients[3] * N.z\\n + ambientSHLightCoefficients[4] * N.x * N.z\\n + ambientSHLightCoefficients[5] * N.z * N.y\\n + ambientSHLightCoefficients[6] * N.y * N.x\\n + ambientSHLightCoefficients[7] * (3.0 * N.z * N.z - 1.0)\\n + ambientSHLightCoefficients[8] * (N.x * N.x - N.y * N.y);\\n}\";\n","import calcAmbientSHLightEssl from './calcAmbientSHLight.glsl.js';\n\nvar uniformVec3Prefix = 'uniform vec3 ';\nvar uniformFloatPrefix = 'uniform float ';\nvar exportHeaderPrefix = '@export clay.header.';\nvar exportEnd = '@end';\nvar unconfigurable = ':unconfigurable;';\nexport default [\n exportHeaderPrefix + 'directional_light',\n uniformVec3Prefix + 'directionalLightDirection[DIRECTIONAL_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'directionalLightColor[DIRECTIONAL_LIGHT_COUNT]' + unconfigurable,\n exportEnd,\n\n exportHeaderPrefix + 'ambient_light',\n uniformVec3Prefix + 'ambientLightColor[AMBIENT_LIGHT_COUNT]' + unconfigurable,\n exportEnd,\n\n exportHeaderPrefix + 'ambient_sh_light',\n uniformVec3Prefix + 'ambientSHLightColor[AMBIENT_SH_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'ambientSHLightCoefficients[AMBIENT_SH_LIGHT_COUNT * 9]' + unconfigurable,\n calcAmbientSHLightEssl,\n exportEnd,\n\n exportHeaderPrefix + 'ambient_cubemap_light',\n uniformVec3Prefix + 'ambientCubemapLightColor[AMBIENT_CUBEMAP_LIGHT_COUNT]' + unconfigurable,\n 'uniform samplerCube ambientCubemapLightCubemap[AMBIENT_CUBEMAP_LIGHT_COUNT]' + unconfigurable,\n 'uniform sampler2D ambientCubemapLightBRDFLookup[AMBIENT_CUBEMAP_LIGHT_COUNT]' + unconfigurable,\n exportEnd,\n\n exportHeaderPrefix + 'point_light',\n uniformVec3Prefix + 'pointLightPosition[POINT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'pointLightRange[POINT_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'pointLightColor[POINT_LIGHT_COUNT]' + unconfigurable,\n exportEnd,\n\n exportHeaderPrefix + 'spot_light',\n uniformVec3Prefix + 'spotLightPosition[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'spotLightDirection[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'spotLightRange[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'spotLightUmbraAngleCosine[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'spotLightPenumbraAngleCosine[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformFloatPrefix + 'spotLightFalloffFactor[SPOT_LIGHT_COUNT]' + unconfigurable,\n uniformVec3Prefix + 'spotLightColor[SPOT_LIGHT_COUNT]' + unconfigurable,\n exportEnd\n].join('\\n');\n","import Node from './Node';\nimport Shader from './Shader';\n\nimport lightShader from './shader/source/header/light';\nShader['import'](lightShader);\n\n/**\n * @constructor clay.Light\n * @extends clay.Node\n */\nvar Light = Node.extend(function(){\n return /** @lends clay.Light# */ {\n /**\n * Light RGB color\n * @type {number[]}\n */\n color: [1, 1, 1],\n\n /**\n * Light intensity\n * @type {number}\n */\n intensity: 1.0,\n\n // Config for shadow map\n /**\n * If light cast shadow\n * @type {boolean}\n */\n castShadow: true,\n\n /**\n * Shadow map size\n * @type {number}\n */\n shadowResolution: 512,\n\n /**\n * Light group, shader with same `lightGroup` will be affected\n *\n * Only useful in forward rendering\n * @type {number}\n */\n group: 0\n };\n},\n/** @lends clay.Light.prototype. */\n{\n /**\n * Light type\n * @type {string}\n * @memberOf clay.Light#\n */\n type: '',\n\n /**\n * @return {clay.Light}\n * @memberOf clay.Light.prototype\n */\n clone: function() {\n var light = Node.prototype.clone.call(this);\n light.color = Array.prototype.slice.call(this.color);\n light.intensity = this.intensity;\n light.castShadow = this.castShadow;\n light.shadowResolution = this.shadowResolution;\n\n return light;\n }\n});\n\nexport default Light;\n","import Vector3 from './Vector3';\nimport mat4 from '../glmatrix/mat4';\nimport vec3 from '../glmatrix/vec3';\nimport vec4 from '../glmatrix/vec4';\n\n/**\n * @constructor\n * @alias clay.Plane\n * @param {clay.Vector3} [normal]\n * @param {number} [distance]\n */\nvar Plane = function(normal, distance) {\n /**\n * Normal of the plane\n * @type {clay.Vector3}\n */\n this.normal = normal || new Vector3(0, 1, 0);\n\n /**\n * Constant of the plane equation, used as distance to the origin\n * @type {number}\n */\n this.distance = distance || 0;\n};\n\nPlane.prototype = {\n\n constructor: Plane,\n\n /**\n * Distance from a given point to the plane\n * @param {clay.Vector3} point\n * @return {number}\n */\n distanceToPoint: function(point) {\n return vec3.dot(point.array, this.normal.array) - this.distance;\n },\n\n /**\n * Calculate the projection point on the plane\n * @param {clay.Vector3} point\n * @param {clay.Vector3} out\n * @return {clay.Vector3}\n */\n projectPoint: function(point, out) {\n if (!out) {\n out = new Vector3();\n }\n var d = this.distanceToPoint(point);\n vec3.scaleAndAdd(out.array, point.array, this.normal.array, -d);\n out._dirty = true;\n return out;\n },\n\n /**\n * Normalize the plane's normal and calculate the distance\n */\n normalize: function() {\n var invLen = 1 / vec3.len(this.normal.array);\n vec3.scale(this.normal.array, invLen);\n this.distance *= invLen;\n },\n\n /**\n * If the plane intersect a frustum\n * @param {clay.Frustum} Frustum\n * @return {boolean}\n */\n intersectFrustum: function(frustum) {\n // Check if all coords of frustum is on plane all under plane\n var coords = frustum.vertices;\n var normal = this.normal.array;\n var onPlane = vec3.dot(coords[0].array, normal) > this.distance;\n for (var i = 1; i < 8; i++) {\n if ((vec3.dot(coords[i].array, normal) > this.distance) != onPlane) {\n return true;\n }\n }\n },\n\n /**\n * Calculate the intersection point between plane and a given line\n * @function\n * @param {clay.Vector3} start start point of line\n * @param {clay.Vector3} end end point of line\n * @param {clay.Vector3} [out]\n * @return {clay.Vector3}\n */\n intersectLine: (function() {\n var rd = vec3.create();\n return function(start, end, out) {\n var d0 = this.distanceToPoint(start);\n var d1 = this.distanceToPoint(end);\n if ((d0 > 0 && d1 > 0) || (d0 < 0 && d1 < 0)) {\n return null;\n }\n // Ray intersection\n var pn = this.normal.array;\n var d = this.distance;\n var ro = start.array;\n // direction\n vec3.sub(rd, end.array, start.array);\n vec3.normalize(rd, rd);\n\n var divider = vec3.dot(pn, rd);\n // ray is parallel to the plane\n if (divider === 0) {\n return null;\n }\n if (!out) {\n out = new Vector3();\n }\n var t = (vec3.dot(pn, ro) - d) / divider;\n vec3.scaleAndAdd(out.array, ro, rd, -t);\n out._dirty = true;\n return out;\n };\n })(),\n\n /**\n * Apply an affine transform matrix to plane\n * @function\n * @return {clay.Matrix4}\n */\n applyTransform: (function() {\n var inverseTranspose = mat4.create();\n var normalv4 = vec4.create();\n var pointv4 = vec4.create();\n pointv4[3] = 1;\n return function(m4) {\n m4 = m4.array;\n // Transform point on plane\n vec3.scale(pointv4, this.normal.array, this.distance);\n vec4.transformMat4(pointv4, pointv4, m4);\n this.distance = vec3.dot(pointv4, this.normal.array);\n // Transform plane normal\n mat4.invert(inverseTranspose, m4);\n mat4.transpose(inverseTranspose, inverseTranspose);\n normalv4[3] = 0;\n vec3.copy(normalv4, this.normal.array);\n vec4.transformMat4(normalv4, normalv4, inverseTranspose);\n vec3.copy(this.normal.array, normalv4);\n };\n })(),\n\n /**\n * Copy from another plane\n * @param {clay.Vector3} plane\n */\n copy: function(plane) {\n vec3.copy(this.normal.array, plane.normal.array);\n this.normal._dirty = true;\n this.distance = plane.distance;\n },\n\n /**\n * Clone a new plane\n * @return {clay.Plane}\n */\n clone: function() {\n var plane = new Plane();\n plane.copy(this);\n return plane;\n }\n};\n\nexport default Plane;\n","import BoundingBox from './BoundingBox';\nimport Plane from './Plane';\n\nimport vec3 from '../glmatrix/vec3';\n\nvar vec3Set = vec3.set;\nvar vec3Copy = vec3.copy;\nvar vec3TranformMat4 = vec3.transformMat4;\nvar mathMin = Math.min;\nvar mathMax = Math.max;\n/**\n * @constructor\n * @alias clay.Frustum\n */\nvar Frustum = function() {\n\n /**\n * Eight planes to enclose the frustum\n * @type {clay.Plane[]}\n */\n this.planes = [];\n\n for (var i = 0; i < 6; i++) {\n this.planes.push(new Plane());\n }\n\n /**\n * Bounding box of frustum\n * @type {clay.BoundingBox}\n */\n this.boundingBox = new BoundingBox();\n\n /**\n * Eight vertices of frustum\n * @type {Float32Array[]}\n */\n this.vertices = [];\n for (var i = 0; i < 8; i++) {\n this.vertices[i] = vec3.fromValues(0, 0, 0);\n }\n};\n\nFrustum.prototype = {\n\n // http://web.archive.org/web/20120531231005/http://crazyjoke.free.fr/doc/3D/plane%20extraction.pdf\n /**\n * Set frustum from a projection matrix\n * @param {clay.Matrix4} projectionMatrix\n */\n setFromProjection: function(projectionMatrix) {\n\n var planes = this.planes;\n var m = projectionMatrix.array;\n var m0 = m[0], m1 = m[1], m2 = m[2], m3 = m[3];\n var m4 = m[4], m5 = m[5], m6 = m[6], m7 = m[7];\n var m8 = m[8], m9 = m[9], m10 = m[10], m11 = m[11];\n var m12 = m[12], m13 = m[13], m14 = m[14], m15 = m[15];\n\n // Update planes\n vec3Set(planes[0].normal.array, m3 - m0, m7 - m4, m11 - m8);\n planes[0].distance = -(m15 - m12);\n planes[0].normalize();\n\n vec3Set(planes[1].normal.array, m3 + m0, m7 + m4, m11 + m8);\n planes[1].distance = -(m15 + m12);\n planes[1].normalize();\n\n vec3Set(planes[2].normal.array, m3 + m1, m7 + m5, m11 + m9);\n planes[2].distance = -(m15 + m13);\n planes[2].normalize();\n\n vec3Set(planes[3].normal.array, m3 - m1, m7 - m5, m11 - m9);\n planes[3].distance = -(m15 - m13);\n planes[3].normalize();\n\n vec3Set(planes[4].normal.array, m3 - m2, m7 - m6, m11 - m10);\n planes[4].distance = -(m15 - m14);\n planes[4].normalize();\n\n vec3Set(planes[5].normal.array, m3 + m2, m7 + m6, m11 + m10);\n planes[5].distance = -(m15 + m14);\n planes[5].normalize();\n\n // Perspective projection\n var boundingBox = this.boundingBox;\n var vertices = this.vertices;\n if (m15 === 0) {\n var aspect = m5 / m0;\n var zNear = -m14 / (m10 - 1);\n var zFar = -m14 / (m10 + 1);\n var farY = -zFar / m5;\n var nearY = -zNear / m5;\n // Update bounding box\n boundingBox.min.set(-farY * aspect, -farY, zFar);\n boundingBox.max.set(farY * aspect, farY, zNear);\n // update vertices\n //--- min z\n // min x\n vec3Set(vertices[0], -farY * aspect, -farY, zFar);\n vec3Set(vertices[1], -farY * aspect, farY, zFar);\n // max x\n vec3Set(vertices[2], farY * aspect, -farY, zFar);\n vec3Set(vertices[3], farY * aspect, farY, zFar);\n //-- max z\n vec3Set(vertices[4], -nearY * aspect, -nearY, zNear);\n vec3Set(vertices[5], -nearY * aspect, nearY, zNear);\n vec3Set(vertices[6], nearY * aspect, -nearY, zNear);\n vec3Set(vertices[7], nearY * aspect, nearY, zNear);\n }\n else { // Orthographic projection\n var left = (-1 - m12) / m0;\n var right = (1 - m12) / m0;\n var top = (1 - m13) / m5;\n var bottom = (-1 - m13) / m5;\n var near = (-1 - m14) / m10;\n var far = (1 - m14) / m10;\n\n\n boundingBox.min.set(Math.min(left, right), Math.min(bottom, top), Math.min(far, near));\n boundingBox.max.set(Math.max(right, left), Math.max(top, bottom), Math.max(near, far));\n\n var min = boundingBox.min.array;\n var max = boundingBox.max.array;\n //--- min z\n // min x\n vec3Set(vertices[0], min[0], min[1], min[2]);\n vec3Set(vertices[1], min[0], max[1], min[2]);\n // max x\n vec3Set(vertices[2], max[0], min[1], min[2]);\n vec3Set(vertices[3], max[0], max[1], min[2]);\n //-- max z\n vec3Set(vertices[4], min[0], min[1], max[2]);\n vec3Set(vertices[5], min[0], max[1], max[2]);\n vec3Set(vertices[6], max[0], min[1], max[2]);\n vec3Set(vertices[7], max[0], max[1], max[2]);\n }\n },\n\n /**\n * Apply a affine transform matrix and set to the given bounding box\n * @function\n * @param {clay.BoundingBox}\n * @param {clay.Matrix4}\n * @return {clay.BoundingBox}\n */\n getTransformedBoundingBox: (function() {\n\n var tmpVec3 = vec3.create();\n\n return function(bbox, matrix) {\n var vertices = this.vertices;\n\n var m4 = matrix.array;\n var min = bbox.min;\n var max = bbox.max;\n var minArr = min.array;\n var maxArr = max.array;\n var v = vertices[0];\n vec3TranformMat4(tmpVec3, v, m4);\n vec3Copy(minArr, tmpVec3);\n vec3Copy(maxArr, tmpVec3);\n\n for (var i = 1; i < 8; i++) {\n v = vertices[i];\n vec3TranformMat4(tmpVec3, v, m4);\n\n minArr[0] = mathMin(tmpVec3[0], minArr[0]);\n minArr[1] = mathMin(tmpVec3[1], minArr[1]);\n minArr[2] = mathMin(tmpVec3[2], minArr[2]);\n\n maxArr[0] = mathMax(tmpVec3[0], maxArr[0]);\n maxArr[1] = mathMax(tmpVec3[1], maxArr[1]);\n maxArr[2] = mathMax(tmpVec3[2], maxArr[2]);\n }\n\n min._dirty = true;\n max._dirty = true;\n\n return bbox;\n };\n }) ()\n};\nexport default Frustum;\n","import Node from './Node';\nimport Matrix4 from './math/Matrix4';\nimport Frustum from './math/Frustum';\nimport Ray from './math/Ray';\n\nimport vec4 from './glmatrix/vec4';\nimport vec3 from './glmatrix/vec3';\n\n\n/**\n * @constructor clay.Camera\n * @extends clay.Node\n */\nvar Camera = Node.extend(function () {\n return /** @lends clay.Camera# */ {\n /**\n * Camera projection matrix\n * @type {clay.Matrix4}\n */\n projectionMatrix: new Matrix4(),\n\n /**\n * Inverse of camera projection matrix\n * @type {clay.Matrix4}\n */\n invProjectionMatrix: new Matrix4(),\n\n /**\n * View matrix, equal to inverse of camera's world matrix\n * @type {clay.Matrix4}\n */\n viewMatrix: new Matrix4(),\n\n /**\n * Camera frustum in view space\n * @type {clay.Frustum}\n */\n frustum: new Frustum()\n };\n}, function () {\n this.update(true);\n},\n/** @lends clay.Camera.prototype */\n{\n\n update: function (force) {\n Node.prototype.update.call(this, force);\n Matrix4.invert(this.viewMatrix, this.worldTransform);\n\n this.updateProjectionMatrix();\n Matrix4.invert(this.invProjectionMatrix, this.projectionMatrix);\n\n this.frustum.setFromProjection(this.projectionMatrix);\n },\n\n /**\n * Set camera view matrix\n */\n setViewMatrix: function (viewMatrix) {\n Matrix4.copy(this.viewMatrix, viewMatrix);\n Matrix4.invert(this.worldTransform, viewMatrix);\n this.decomposeWorldTransform();\n },\n\n /**\n * Decompose camera projection matrix\n */\n decomposeProjectionMatrix: function () {},\n\n /**\n * Set camera projection matrix\n * @param {clay.Matrix4} projectionMatrix\n */\n setProjectionMatrix: function (projectionMatrix) {\n Matrix4.copy(this.projectionMatrix, projectionMatrix);\n Matrix4.invert(this.invProjectionMatrix, projectionMatrix);\n this.decomposeProjectionMatrix();\n },\n /**\n * Update projection matrix, called after update\n */\n updateProjectionMatrix: function () {},\n\n /**\n * Cast a picking ray from camera near plane to far plane\n * @function\n * @param {clay.Vector2} ndc\n * @param {clay.Ray} [out]\n * @return {clay.Ray}\n */\n castRay: (function () {\n var v4 = vec4.create();\n return function (ndc, out) {\n var ray = out !== undefined ? out : new Ray();\n var x = ndc.array[0];\n var y = ndc.array[1];\n vec4.set(v4, x, y, -1, 1);\n vec4.transformMat4(v4, v4, this.invProjectionMatrix.array);\n vec4.transformMat4(v4, v4, this.worldTransform.array);\n vec3.scale(ray.origin.array, v4, 1 / v4[3]);\n\n vec4.set(v4, x, y, 1, 1);\n vec4.transformMat4(v4, v4, this.invProjectionMatrix.array);\n vec4.transformMat4(v4, v4, this.worldTransform.array);\n vec3.scale(v4, v4, 1 / v4[3]);\n vec3.sub(ray.direction.array, v4, ray.origin.array);\n\n vec3.normalize(ray.direction.array, ray.direction.array);\n ray.direction._dirty = true;\n ray.origin._dirty = true;\n\n return ray;\n };\n })(),\n\n /**\n * @function\n * @name clone\n * @return {clay.Camera}\n * @memberOf clay.Camera.prototype\n */\n});\n\nexport default Camera;\n","import Node from './Node';\nimport Light from './Light';\nimport Camera from './Camera';\nimport BoundingBox from './math/BoundingBox';\nimport util from './core/util';\nimport mat4 from './glmatrix/mat4';\nimport LRUCache from './core/LRU';\nimport Matrix4 from './math/Matrix4';\n\nvar IDENTITY = mat4.create();\nvar WORLDVIEW = mat4.create();\n\nvar programKeyCache = {};\n\nfunction getProgramKey(lightNumbers) {\n var defineStr = [];\n var lightTypes = Object.keys(lightNumbers);\n lightTypes.sort();\n for (var i = 0; i < lightTypes.length; i++) {\n var lightType = lightTypes[i];\n defineStr.push(lightType + ' ' + lightNumbers[lightType]);\n }\n var key = defineStr.join('\\n');\n\n if (programKeyCache[key]) {\n return programKeyCache[key];\n }\n\n var id = util.genGUID();\n programKeyCache[key] = id;\n return id;\n}\n\nfunction RenderList() {\n\n this.opaque = [];\n this.transparent = [];\n\n this._opaqueCount = 0;\n this._transparentCount = 0;\n}\n\nRenderList.prototype.startCount = function () {\n this._opaqueCount = 0;\n this._transparentCount = 0;\n};\n\nRenderList.prototype.add = function (object, isTransparent) {\n if (isTransparent) {\n this.transparent[this._transparentCount++] = object;\n }\n else {\n this.opaque[this._opaqueCount++] = object;\n }\n};\n\nRenderList.prototype.endCount = function () {\n this.transparent.length = this._transparentCount;\n this.opaque.length = this._opaqueCount;\n};\n\n/**\n * @typedef {Object} clay.Scene.RenderList\n * @property {Array.} opaque\n * @property {Array.} transparent\n */\n\n/**\n * @constructor clay.Scene\n * @extends clay.Node\n */\nvar Scene = Node.extend(function () {\n return /** @lends clay.Scene# */ {\n /**\n * Global material of scene\n * @type {clay.Material}\n */\n material: null,\n\n lights: [],\n\n /**\n * Scene bounding box in view space.\n * Used when camera needs to adujst the near and far plane automatically\n * so that the view frustum contains the visible objects as tightly as possible.\n * Notice:\n * It is updated after rendering (in the step of frustum culling passingly). So may be not so accurate, but saves a lot of calculation\n *\n * @type {clay.BoundingBox}\n */\n viewBoundingBoxLastFrame: new BoundingBox(),\n\n // Uniforms for shadow map.\n shadowUniforms: {},\n\n _cameraList: [],\n\n // Properties to save the light information in the scene\n // Will be set in the render function\n _lightUniforms: {},\n\n _previousLightNumber: {},\n\n _lightNumber: {\n // groupId: {\n // POINT_LIGHT: 0,\n // DIRECTIONAL_LIGHT: 0,\n // SPOT_LIGHT: 0,\n // AMBIENT_LIGHT: 0,\n // AMBIENT_SH_LIGHT: 0\n // }\n },\n\n _lightProgramKeys: {},\n\n _nodeRepository: {},\n\n _renderLists: new LRUCache(20)\n\n };\n}, function () {\n this._scene = this;\n},\n/** @lends clay.Scene.prototype. */\n{\n\n // Add node to scene\n addToScene: function (node) {\n if (node instanceof Camera) {\n if (this._cameraList.length > 0) {\n console.warn('Found multiple camera in one scene. Use the fist one.');\n }\n this._cameraList.push(node);\n }\n else if (node instanceof Light) {\n this.lights.push(node);\n }\n if (node.name) {\n this._nodeRepository[node.name] = node;\n }\n },\n\n // Remove node from scene\n removeFromScene: function (node) {\n var idx;\n if (node instanceof Camera) {\n idx = this._cameraList.indexOf(node);\n if (idx >= 0) {\n this._cameraList.splice(idx, 1);\n }\n }\n else if (node instanceof Light) {\n idx = this.lights.indexOf(node);\n if (idx >= 0) {\n this.lights.splice(idx, 1);\n }\n }\n if (node.name) {\n delete this._nodeRepository[node.name];\n }\n },\n\n /**\n * Get node by name\n * @param {string} name\n * @return {Node}\n * @DEPRECATED\n */\n getNode: function (name) {\n return this._nodeRepository[name];\n },\n\n /**\n * Set main camera of the scene.\n * @param {claygl.Camera} camera\n */\n setMainCamera: function (camera) {\n var idx = this._cameraList.indexOf(camera);\n if (idx >= 0) {\n this._cameraList.splice(idx, 1);\n }\n this._cameraList.unshift(camera);\n },\n /**\n * Get main camera of the scene.\n */\n getMainCamera: function () {\n return this._cameraList[0];\n },\n\n getLights: function () {\n return this.lights;\n },\n\n updateLights: function () {\n var lights = this.lights;\n this._previousLightNumber = this._lightNumber;\n\n var lightNumber = {};\n for (var i = 0; i < lights.length; i++) {\n var light = lights[i];\n if (light.invisible) {\n continue;\n }\n var group = light.group;\n if (!lightNumber[group]) {\n lightNumber[group] = {};\n }\n // User can use any type of light\n lightNumber[group][light.type] = lightNumber[group][light.type] || 0;\n lightNumber[group][light.type]++;\n }\n this._lightNumber = lightNumber;\n\n for (var groupId in lightNumber) {\n this._lightProgramKeys[groupId] = getProgramKey(lightNumber[groupId]);\n }\n\n this._updateLightUniforms();\n },\n\n /**\n * Clone a node and it's children, including mesh, camera, light, etc.\n * Unlike using `Node#clone`. It will clone skeleton and remap the joints. Material will also be cloned.\n *\n * @param {clay.Node} node\n * @return {clay.Node}\n */\n cloneNode: function (node) {\n var newNode = node.clone();\n var clonedNodesMap = {};\n function buildNodesMap(sNode, tNode) {\n clonedNodesMap[sNode.__uid__] = tNode;\n\n for (var i = 0; i < sNode._children.length; i++) {\n var sChild = sNode._children[i];\n var tChild = tNode._children[i];\n buildNodesMap(sChild, tChild);\n }\n }\n buildNodesMap(node, newNode);\n\n newNode.traverse(function (newChild) {\n if (newChild.skeleton) {\n newChild.skeleton = newChild.skeleton.clone(clonedNodesMap);\n }\n if (newChild.material) {\n newChild.material = newChild.material.clone();\n }\n });\n\n return newNode;\n },\n\n /**\n * Traverse the scene and add the renderable object to the render list.\n * It needs camera for the frustum culling.\n *\n * @param {clay.Camera} camera\n * @param {boolean} updateSceneBoundingBox\n * @return {clay.Scene.RenderList}\n */\n updateRenderList: function (camera, updateSceneBoundingBox) {\n var id = camera.__uid__;\n var renderList = this._renderLists.get(id);\n if (!renderList) {\n renderList = new RenderList();\n this._renderLists.put(id, renderList);\n }\n renderList.startCount();\n\n if (updateSceneBoundingBox) {\n this.viewBoundingBoxLastFrame.min.set(Infinity, Infinity, Infinity);\n this.viewBoundingBoxLastFrame.max.set(-Infinity, -Infinity, -Infinity);\n }\n\n var sceneMaterialTransparent = this.material && this.material.transparent || false;\n this._doUpdateRenderList(this, camera, sceneMaterialTransparent, renderList, updateSceneBoundingBox);\n\n renderList.endCount();\n\n return renderList;\n },\n\n /**\n * Get render list. Used after {@link clay.Scene#updateRenderList}\n * @param {clay.Camera} camera\n * @return {clay.Scene.RenderList}\n */\n getRenderList: function (camera) {\n return this._renderLists.get(camera.__uid__);\n },\n\n _doUpdateRenderList: function (parent, camera, sceneMaterialTransparent, renderList, updateSceneBoundingBox) {\n if (parent.invisible) {\n return;\n }\n // TODO Optimize\n for (var i = 0; i < parent._children.length; i++) {\n var child = parent._children[i];\n\n if (child.isRenderable()) {\n // Frustum culling\n var worldM = child.isSkinnedMesh() ? IDENTITY : child.worldTransform.array;\n var geometry = child.geometry;\n\n mat4.multiplyAffine(WORLDVIEW, camera.viewMatrix.array, worldM);\n if (updateSceneBoundingBox && !geometry.boundingBox || !this.isFrustumCulled(child, camera, WORLDVIEW)) {\n renderList.add(child, child.material.transparent || sceneMaterialTransparent);\n }\n }\n if (child._children.length > 0) {\n this._doUpdateRenderList(child, camera, sceneMaterialTransparent, renderList, updateSceneBoundingBox);\n }\n }\n },\n\n /**\n * If an scene object is culled by camera frustum\n *\n * Object can be a renderable or a light\n *\n * @param {clay.Node} object\n * @param {clay.Camera} camera\n * @param {Array.} worldViewMat represented with array\n * @param {Array.} projectionMat represented with array\n */\n isFrustumCulled: (function () {\n // Frustum culling\n // http://www.cse.chalmers.se/~uffe/vfc_bbox.pdf\n var cullingBoundingBox = new BoundingBox();\n var cullingMatrix = new Matrix4();\n return function(object, camera, worldViewMat) {\n // Bounding box can be a property of object(like light) or renderable.geometry\n // PENDING\n var geoBBox = object.boundingBox;\n if (!geoBBox) {\n if (object.skeleton && object.skeleton.boundingBox) {\n geoBBox = object.skeleton.boundingBox;\n }\n else {\n geoBBox = object.geometry.boundingBox;\n }\n }\n\n if (!geoBBox) {\n return false;\n }\n\n cullingMatrix.array = worldViewMat;\n cullingBoundingBox.transformFrom(geoBBox, cullingMatrix);\n\n // Passingly update the scene bounding box\n // FIXME exclude very large mesh like ground plane or terrain ?\n // FIXME Only rendererable which cast shadow ?\n\n // FIXME boundingBox becomes much larger after transformd.\n if (object.castShadow) {\n this.viewBoundingBoxLastFrame.union(cullingBoundingBox);\n }\n // Ignore frustum culling if object is skinned mesh.\n if (object.frustumCulling) {\n if (!cullingBoundingBox.intersectBoundingBox(camera.frustum.boundingBox)) {\n return true;\n }\n\n cullingMatrix.array = camera.projectionMatrix.array;\n if (\n cullingBoundingBox.max.array[2] > 0 &&\n cullingBoundingBox.min.array[2] < 0\n ) {\n // Clip in the near plane\n cullingBoundingBox.max.array[2] = -1e-20;\n }\n\n cullingBoundingBox.applyProjection(cullingMatrix);\n\n var min = cullingBoundingBox.min.array;\n var max = cullingBoundingBox.max.array;\n\n if (\n max[0] < -1 || min[0] > 1\n || max[1] < -1 || min[1] > 1\n || max[2] < -1 || min[2] > 1\n ) {\n return true;\n }\n }\n\n return false;\n };\n })(),\n\n _updateLightUniforms: function () {\n var lights = this.lights;\n // Put the light cast shadow before the light not cast shadow\n lights.sort(lightSortFunc);\n\n var lightUniforms = this._lightUniforms;\n for (var group in lightUniforms) {\n for (var symbol in lightUniforms[group]) {\n lightUniforms[group][symbol].value.length = 0;\n }\n }\n for (var i = 0; i < lights.length; i++) {\n\n var light = lights[i];\n\n if (light.invisible) {\n continue;\n }\n\n var group = light.group;\n\n for (var symbol in light.uniformTemplates) {\n var uniformTpl = light.uniformTemplates[symbol];\n var value = uniformTpl.value(light);\n if (value == null) {\n continue;\n }\n if (!lightUniforms[group]) {\n lightUniforms[group] = {};\n }\n if (!lightUniforms[group][symbol]) {\n lightUniforms[group][symbol] = {\n type: '',\n value: []\n };\n }\n var lu = lightUniforms[group][symbol];\n lu.type = uniformTpl.type + 'v';\n switch (uniformTpl.type) {\n case '1i':\n case '1f':\n case 't':\n lu.value.push(value);\n break;\n case '2f':\n case '3f':\n case '4f':\n for (var j = 0; j < value.length; j++) {\n lu.value.push(value[j]);\n }\n break;\n default:\n console.error('Unkown light uniform type ' + uniformTpl.type);\n }\n }\n }\n },\n\n getLightGroups: function () {\n var lightGroups = [];\n for (var groupId in this._lightNumber) {\n lightGroups.push(groupId);\n }\n return lightGroups;\n },\n\n getNumberChangedLightGroups: function () {\n var lightGroups = [];\n for (var groupId in this._lightNumber) {\n if (this.isLightNumberChanged(groupId)) {\n lightGroups.push(groupId);\n }\n }\n return lightGroups;\n },\n\n // Determine if light group is different with since last frame\n // Used to determine whether to update shader and scene's uniforms in Renderer.render\n isLightNumberChanged: function (lightGroup) {\n var prevLightNumber = this._previousLightNumber;\n var currentLightNumber = this._lightNumber;\n // PENDING Performance\n for (var type in currentLightNumber[lightGroup]) {\n if (!prevLightNumber[lightGroup]) {\n return true;\n }\n if (currentLightNumber[lightGroup][type] !== prevLightNumber[lightGroup][type]) {\n return true;\n }\n }\n for (var type in prevLightNumber[lightGroup]) {\n if (!currentLightNumber[lightGroup]) {\n return true;\n }\n if (currentLightNumber[lightGroup][type] !== prevLightNumber[lightGroup][type]) {\n return true;\n }\n }\n return false;\n },\n\n getLightsNumbers: function (lightGroup) {\n return this._lightNumber[lightGroup];\n },\n\n getProgramKey: function (lightGroup) {\n return this._lightProgramKeys[lightGroup];\n },\n\n setLightUniforms: (function () {\n function setUniforms(uniforms, program, renderer) {\n for (var symbol in uniforms) {\n var lu = uniforms[symbol];\n if (lu.type === 'tv') {\n if (!program.hasUniform(symbol)) {\n continue;\n }\n var texSlots = [];\n for (var i = 0; i < lu.value.length; i++) {\n var texture = lu.value[i];\n var slot = program.takeCurrentTextureSlot(renderer, texture);\n texSlots.push(slot);\n }\n program.setUniform(renderer.gl, '1iv', symbol, texSlots);\n }\n else {\n program.setUniform(renderer.gl, lu.type, symbol, lu.value);\n }\n }\n }\n\n return function (program, lightGroup, renderer) {\n setUniforms(this._lightUniforms[lightGroup], program, renderer);\n // Set shadows\n setUniforms(this.shadowUniforms, program, renderer);\n };\n })(),\n\n /**\n * Dispose self, clear all the scene objects\n * But resources of gl like texuture, shader will not be disposed.\n * Mostly you should use disposeScene method in Renderer to do dispose.\n */\n dispose: function () {\n this.material = null;\n this._opaqueList = [];\n this._transparentList = [];\n\n this.lights = [];\n\n this._lightUniforms = {};\n\n this._lightNumber = {};\n this._nodeRepository = {};\n }\n});\n\nfunction lightSortFunc(a, b) {\n if (b.castShadow && !a.castShadow) {\n return true;\n }\n}\n\nexport default Scene;\n","var Entry = (function () {\n function Entry(val) {\n this.value = val;\n }\n return Entry;\n}());\nexport { Entry };\nvar LinkedList = (function () {\n function LinkedList() {\n this._len = 0;\n }\n LinkedList.prototype.insert = function (val) {\n var entry = new Entry(val);\n this.insertEntry(entry);\n return entry;\n };\n LinkedList.prototype.insertEntry = function (entry) {\n if (!this.head) {\n this.head = this.tail = entry;\n }\n else {\n this.tail.next = entry;\n entry.prev = this.tail;\n entry.next = null;\n this.tail = entry;\n }\n this._len++;\n };\n LinkedList.prototype.remove = function (entry) {\n var prev = entry.prev;\n var next = entry.next;\n if (prev) {\n prev.next = next;\n }\n else {\n this.head = next;\n }\n if (next) {\n next.prev = prev;\n }\n else {\n this.tail = prev;\n }\n entry.next = entry.prev = null;\n this._len--;\n };\n LinkedList.prototype.len = function () {\n return this._len;\n };\n LinkedList.prototype.clear = function () {\n this.head = this.tail = null;\n this._len = 0;\n };\n return LinkedList;\n}());\nexport { LinkedList };\nvar LRU = (function () {\n function LRU(maxSize) {\n this._list = new LinkedList();\n this._maxSize = 10;\n this._map = {};\n this._maxSize = maxSize;\n }\n LRU.prototype.put = function (key, value) {\n var list = this._list;\n var map = this._map;\n var removed = null;\n if (map[key] == null) {\n var len = list.len();\n var entry = this._lastRemovedEntry;\n if (len >= this._maxSize && len > 0) {\n var leastUsedEntry = list.head;\n list.remove(leastUsedEntry);\n delete map[leastUsedEntry.key];\n removed = leastUsedEntry.value;\n this._lastRemovedEntry = leastUsedEntry;\n }\n if (entry) {\n entry.value = value;\n }\n else {\n entry = new Entry(value);\n }\n entry.key = key;\n list.insertEntry(entry);\n map[key] = entry;\n }\n return removed;\n };\n LRU.prototype.get = function (key) {\n var entry = this._map[key];\n var list = this._list;\n if (entry != null) {\n if (entry !== list.tail) {\n list.remove(entry);\n list.insertEntry(entry);\n }\n return entry.value;\n }\n };\n LRU.prototype.clear = function () {\n this._list.clear();\n this._map = {};\n };\n LRU.prototype.len = function () {\n return this._list.len();\n };\n return LRU;\n}());\nexport default LRU;\n","import Texture from './Texture';\nimport glenum from './core/glenum';\nimport util from './core/util';\nimport mathUtil from './math/util';\nimport vendor from './core/vendor';\nvar isPowerOfTwo = mathUtil.isPowerOfTwo;\n\nvar targetList = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\n/**\n * @constructor clay.TextureCube\n * @extends clay.Texture\n *\n * @example\n * ...\n * var mat = new clay.Material({\n * shader: clay.shader.library.get('clay.phong', 'environmentMap')\n * });\n * var envMap = new clay.TextureCube();\n * envMap.load({\n * 'px': 'assets/textures/sky/px.jpg',\n * 'nx': 'assets/textures/sky/nx.jpg'\n * 'py': 'assets/textures/sky/py.jpg'\n * 'ny': 'assets/textures/sky/ny.jpg'\n * 'pz': 'assets/textures/sky/pz.jpg'\n * 'nz': 'assets/textures/sky/nz.jpg'\n * });\n * mat.set('environmentMap', envMap);\n * ...\n * envMap.success(function () {\n * // Wait for the sky texture loaded\n * animation.on('frame', function (frameTime) {\n * renderer.render(scene, camera);\n * });\n * });\n */\nvar TextureCube = Texture.extend(function () {\n return /** @lends clay.TextureCube# */{\n\n /**\n * @type {boolean}\n * @default false\n */\n // PENDING cubemap should not flipY in default.\n // flipY: false,\n\n /**\n * @type {Object}\n * @property {?HTMLImageElement|HTMLCanvasElemnet} px\n * @property {?HTMLImageElement|HTMLCanvasElemnet} nx\n * @property {?HTMLImageElement|HTMLCanvasElemnet} py\n * @property {?HTMLImageElement|HTMLCanvasElemnet} ny\n * @property {?HTMLImageElement|HTMLCanvasElemnet} pz\n * @property {?HTMLImageElement|HTMLCanvasElemnet} nz\n */\n image: {\n px: null,\n nx: null,\n py: null,\n ny: null,\n pz: null,\n nz: null\n },\n /**\n * Pixels data of each side. Will be ignored if images are set.\n * @type {Object}\n * @property {?Uint8Array} px\n * @property {?Uint8Array} nx\n * @property {?Uint8Array} py\n * @property {?Uint8Array} ny\n * @property {?Uint8Array} pz\n * @property {?Uint8Array} nz\n */\n pixels: {\n px: null,\n nx: null,\n py: null,\n ny: null,\n pz: null,\n nz: null\n },\n\n /**\n * @type {Array.}\n */\n mipmaps: []\n };\n}, {\n\n textureType: 'textureCube',\n\n update: function (renderer) {\n var _gl = renderer.gl;\n _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, this._cache.get('webgl_texture'));\n\n this.updateCommon(renderer);\n\n var glFormat = this.format;\n var glType = this.type;\n\n _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_S, this.getAvailableWrapS());\n _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_T, this.getAvailableWrapT());\n\n _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MAG_FILTER, this.getAvailableMagFilter());\n _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MIN_FILTER, this.getAvailableMinFilter());\n\n var anisotropicExt = renderer.getGLExtension('EXT_texture_filter_anisotropic');\n if (anisotropicExt && this.anisotropic > 1) {\n _gl.texParameterf(_gl.TEXTURE_CUBE_MAP, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropic);\n }\n\n // Fallback to float type if browser don't have half float extension\n if (glType === 36193) {\n var halfFloatExt = renderer.getGLExtension('OES_texture_half_float');\n if (!halfFloatExt) {\n glType = glenum.FLOAT;\n }\n }\n\n if (this.mipmaps.length) {\n var width = this.width;\n var height = this.height;\n for (var i = 0; i < this.mipmaps.length; i++) {\n var mipmap = this.mipmaps[i];\n this._updateTextureData(_gl, mipmap, i, width, height, glFormat, glType);\n width /= 2;\n height /= 2;\n }\n }\n else {\n this._updateTextureData(_gl, this, 0, this.width, this.height, glFormat, glType);\n\n if (!this.NPOT && this.useMipmap) {\n _gl.generateMipmap(_gl.TEXTURE_CUBE_MAP);\n }\n }\n\n _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, null);\n },\n\n _updateTextureData: function (_gl, data, level, width, height, glFormat, glType) {\n for (var i = 0; i < 6; i++) {\n var target = targetList[i];\n var img = data.image && data.image[target];\n if (img) {\n _gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level, glFormat, glFormat, glType, img);\n }\n else {\n _gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level, glFormat, width, height, 0, glFormat, glType, data.pixels && data.pixels[target]);\n }\n }\n },\n\n /**\n * @param {clay.Renderer} renderer\n * @memberOf clay.TextureCube.prototype\n */\n generateMipmap: function (renderer) {\n var _gl = renderer.gl;\n if (this.useMipmap && !this.NPOT) {\n _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, this._cache.get('webgl_texture'));\n _gl.generateMipmap(_gl.TEXTURE_CUBE_MAP);\n }\n },\n\n bind: function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_CUBE_MAP, this.getWebGLTexture(renderer));\n },\n\n unbind: function (renderer) {\n renderer.gl.bindTexture(renderer.gl.TEXTURE_CUBE_MAP, null);\n },\n\n // Overwrite the isPowerOfTwo method\n isPowerOfTwo: function () {\n if (this.image.px) {\n return isPowerOfTwo(this.image.px.width)\n && isPowerOfTwo(this.image.px.height);\n }\n else {\n return isPowerOfTwo(this.width)\n && isPowerOfTwo(this.height);\n }\n },\n\n isRenderable: function () {\n if (this.image.px) {\n return isImageRenderable(this.image.px)\n && isImageRenderable(this.image.nx)\n && isImageRenderable(this.image.py)\n && isImageRenderable(this.image.ny)\n && isImageRenderable(this.image.pz)\n && isImageRenderable(this.image.nz);\n }\n else {\n return !!(this.width && this.height);\n }\n },\n\n load: function (imageList, crossOrigin) {\n var loading = 0;\n var self = this;\n util.each(imageList, function (src, target){\n var image = vendor.createImage();\n if (crossOrigin) {\n image.crossOrigin = crossOrigin;\n }\n image.onload = function () {\n loading --;\n if (loading === 0){\n self.dirty();\n self.trigger('success', self);\n }\n };\n image.onerror = function () {\n loading --;\n };\n\n loading++;\n image.src = src;\n self.image[target] = image;\n });\n\n return this;\n }\n});\n\nObject.defineProperty(TextureCube.prototype, 'width', {\n get: function () {\n if (this.image && this.image.px) {\n return this.image.px.width;\n }\n return this._width;\n },\n set: function (value) {\n if (this.image && this.image.px) {\n console.warn('Texture from image can\\'t set width');\n }\n else {\n if (this._width !== value) {\n this.dirty();\n }\n this._width = value;\n }\n }\n});\nObject.defineProperty(TextureCube.prototype, 'height', {\n get: function () {\n if (this.image && this.image.px) {\n return this.image.px.height;\n }\n return this._height;\n },\n set: function (value) {\n if (this.image && this.image.px) {\n console.warn('Texture from image can\\'t set height');\n }\n else {\n if (this._height !== value) {\n this.dirty();\n }\n this._height = value;\n }\n }\n});\nfunction isImageRenderable(image) {\n return image.width > 0 && image.height > 0;\n}\n\nexport default TextureCube;\n","import Camera from '../Camera';\n\n/**\n * @constructor clay.camera.Perspective\n * @extends clay.Camera\n */\nvar Perspective = Camera.extend(/** @lends clay.camera.Perspective# */{\n /**\n * Vertical field of view in degrees\n * @type {number}\n */\n fov: 50,\n /**\n * Aspect ratio, typically viewport width / height\n * @type {number}\n */\n aspect: 1,\n /**\n * Near bound of the frustum\n * @type {number}\n */\n near: 0.1,\n /**\n * Far bound of the frustum\n * @type {number}\n */\n far: 2000\n},\n/** @lends clay.camera.Perspective.prototype */\n{\n\n updateProjectionMatrix: function() {\n var rad = this.fov / 180 * Math.PI;\n this.projectionMatrix.perspective(rad, this.aspect, this.near, this.far);\n },\n decomposeProjectionMatrix: function () {\n var m = this.projectionMatrix.array;\n var rad = Math.atan(1 / m[5]) * 2;\n this.fov = rad / Math.PI * 180;\n this.aspect = m[5] / m[0];\n this.near = m[14] / (m[10] - 1);\n this.far = m[14] / (m[10] + 1);\n },\n /**\n * @return {clay.camera.Perspective}\n */\n clone: function() {\n var camera = Camera.prototype.clone.call(this);\n camera.fov = this.fov;\n camera.aspect = this.aspect;\n camera.near = this.near;\n camera.far = this.far;\n\n return camera;\n }\n});\n\nexport default Perspective;\n","import Base from './core/Base';\nimport Texture from './Texture';\nimport TextureCube from './TextureCube';\nimport glenum from './core/glenum';\nimport Cache from './core/Cache';\n\nvar KEY_FRAMEBUFFER = 'framebuffer';\nvar KEY_RENDERBUFFER = 'renderbuffer';\nvar KEY_RENDERBUFFER_WIDTH = KEY_RENDERBUFFER + '_width';\nvar KEY_RENDERBUFFER_HEIGHT = KEY_RENDERBUFFER + '_height';\nvar KEY_RENDERBUFFER_ATTACHED = KEY_RENDERBUFFER + '_attached';\nvar KEY_DEPTHTEXTURE_ATTACHED = 'depthtexture_attached';\n\nvar GL_FRAMEBUFFER = glenum.FRAMEBUFFER;\nvar GL_RENDERBUFFER = glenum.RENDERBUFFER;\nvar GL_DEPTH_ATTACHMENT = glenum.DEPTH_ATTACHMENT;\nvar GL_COLOR_ATTACHMENT0 = glenum.COLOR_ATTACHMENT0;\n/**\n * @constructor clay.FrameBuffer\n * @extends clay.core.Base\n */\nvar FrameBuffer = Base.extend(\n/** @lends clay.FrameBuffer# */\n{\n /**\n * If use depth buffer\n * @type {boolean}\n */\n depthBuffer: true,\n\n /**\n * @type {Object}\n */\n viewport: null,\n\n _width: 0,\n _height: 0,\n\n _textures: null,\n\n _boundRenderer: null,\n}, function () {\n // Use cache\n this._cache = new Cache();\n\n this._textures = {};\n},\n\n/**@lends clay.FrameBuffer.prototype. */\n{\n /**\n * Get attached texture width\n * {number}\n */\n // FIXME Can't use before #bind\n getTextureWidth: function () {\n return this._width;\n },\n\n /**\n * Get attached texture height\n * {number}\n */\n getTextureHeight: function () {\n return this._height;\n },\n\n /**\n * Bind the framebuffer to given renderer before rendering\n * @param {clay.Renderer} renderer\n */\n bind: function (renderer) {\n\n if (renderer.__currentFrameBuffer) {\n // Already bound\n if (renderer.__currentFrameBuffer === this) {\n return;\n }\n\n console.warn('Renderer already bound with another framebuffer. Unbind it first');\n }\n renderer.__currentFrameBuffer = this;\n\n var _gl = renderer.gl;\n\n _gl.bindFramebuffer(GL_FRAMEBUFFER, this._getFrameBufferGL(renderer));\n this._boundRenderer = renderer;\n var cache = this._cache;\n\n cache.put('viewport', renderer.viewport);\n\n var hasTextureAttached = false;\n var width;\n var height;\n for (var attachment in this._textures) {\n hasTextureAttached = true;\n var obj = this._textures[attachment];\n if (obj) {\n // TODO Do width, height checking, make sure size are same\n width = obj.texture.width;\n height = obj.texture.height;\n // Attach textures\n this._doAttach(renderer, obj.texture, attachment, obj.target);\n }\n }\n\n this._width = width;\n this._height = height;\n\n if (!hasTextureAttached && this.depthBuffer) {\n console.error('Must attach texture before bind, or renderbuffer may have incorrect width and height.')\n }\n\n if (this.viewport) {\n renderer.setViewport(this.viewport);\n }\n else {\n renderer.setViewport(0, 0, width, height, 1);\n }\n\n var attachedTextures = cache.get('attached_textures');\n if (attachedTextures) {\n for (var attachment in attachedTextures) {\n if (!this._textures[attachment]) {\n var target = attachedTextures[attachment];\n this._doDetach(_gl, attachment, target);\n }\n }\n }\n if (!cache.get(KEY_DEPTHTEXTURE_ATTACHED) && this.depthBuffer) {\n // Create a new render buffer\n if (cache.miss(KEY_RENDERBUFFER)) {\n cache.put(KEY_RENDERBUFFER, _gl.createRenderbuffer());\n }\n var renderbuffer = cache.get(KEY_RENDERBUFFER);\n\n if (width !== cache.get(KEY_RENDERBUFFER_WIDTH)\n || height !== cache.get(KEY_RENDERBUFFER_HEIGHT)) {\n _gl.bindRenderbuffer(GL_RENDERBUFFER, renderbuffer);\n _gl.renderbufferStorage(GL_RENDERBUFFER, _gl.DEPTH_COMPONENT16, width, height);\n cache.put(KEY_RENDERBUFFER_WIDTH, width);\n cache.put(KEY_RENDERBUFFER_HEIGHT, height);\n _gl.bindRenderbuffer(GL_RENDERBUFFER, null);\n }\n if (!cache.get(KEY_RENDERBUFFER_ATTACHED)) {\n _gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderbuffer);\n cache.put(KEY_RENDERBUFFER_ATTACHED, true);\n }\n }\n },\n\n /**\n * Unbind the frame buffer after rendering\n * @param {clay.Renderer} renderer\n */\n unbind: function (renderer) {\n // Remove status record on renderer\n renderer.__currentFrameBuffer = null;\n\n var _gl = renderer.gl;\n\n _gl.bindFramebuffer(GL_FRAMEBUFFER, null);\n this._boundRenderer = null;\n\n this._cache.use(renderer.__uid__);\n var viewport = this._cache.get('viewport');\n // Reset viewport;\n if (viewport) {\n renderer.setViewport(viewport);\n }\n\n this.updateMipmap(renderer);\n },\n\n // Because the data of texture is changed over time,\n // Here update the mipmaps of texture each time after rendered;\n updateMipmap: function (renderer) {\n var _gl = renderer.gl;\n for (var attachment in this._textures) {\n var obj = this._textures[attachment];\n if (obj) {\n var texture = obj.texture;\n // FIXME some texture format can't generate mipmap\n if (!texture.NPOT && texture.useMipmap\n && texture.minFilter === Texture.LINEAR_MIPMAP_LINEAR) {\n var target = texture.textureType === 'textureCube' ? glenum.TEXTURE_CUBE_MAP : glenum.TEXTURE_2D;\n _gl.bindTexture(target, texture.getWebGLTexture(renderer));\n _gl.generateMipmap(target);\n _gl.bindTexture(target, null);\n }\n }\n }\n },\n\n\n // 0x8CD5, 36053, FRAMEBUFFER_COMPLETE\n // 0x8CD6, 36054, FRAMEBUFFER_INCOMPLETE_ATTACHMENT\n // 0x8CD7, 36055, FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\n // 0x8CD9, 36057, FRAMEBUFFER_INCOMPLETE_DIMENSIONS\n // 0x8CDD, 36061, FRAMEBUFFER_UNSUPPORTED\n checkStatus: function (_gl) {\n return _gl.checkFramebufferStatus(GL_FRAMEBUFFER);\n },\n\n _getFrameBufferGL: function (renderer) {\n var cache = this._cache;\n cache.use(renderer.__uid__);\n\n if (cache.miss(KEY_FRAMEBUFFER)) {\n cache.put(KEY_FRAMEBUFFER, renderer.gl.createFramebuffer());\n }\n\n return cache.get(KEY_FRAMEBUFFER);\n },\n\n /**\n * Attach a texture(RTT) to the framebuffer\n * @param {clay.Texture} texture\n * @param {number} [attachment=gl.COLOR_ATTACHMENT0]\n * @param {number} [target=gl.TEXTURE_2D]\n */\n attach: function (texture, attachment, target) {\n\n if (!texture.width) {\n throw new Error('The texture attached to color buffer is not a valid.');\n }\n // TODO width and height check\n\n // If the depth_texture extension is enabled, developers\n // Can attach a depth texture to the depth buffer\n // http://blog.tojicode.com/2012/07/using-webgldepthtexture.html\n attachment = attachment || GL_COLOR_ATTACHMENT0;\n target = target || glenum.TEXTURE_2D;\n\n var boundRenderer = this._boundRenderer;\n var _gl = boundRenderer && boundRenderer.gl;\n var attachedTextures;\n\n if (_gl) {\n var cache = this._cache;\n cache.use(boundRenderer.__uid__);\n attachedTextures = cache.get('attached_textures');\n }\n\n // Check if texture attached\n var previous = this._textures[attachment];\n if (previous && previous.target === target\n && previous.texture === texture\n && (attachedTextures && attachedTextures[attachment] != null)\n ) {\n return;\n }\n\n var canAttach = true;\n if (boundRenderer) {\n canAttach = this._doAttach(boundRenderer, texture, attachment, target);\n // Set viewport again incase attached to different size textures.\n if (!this.viewport) {\n boundRenderer.setViewport(0, 0, texture.width, texture.height, 1);\n }\n }\n\n if (canAttach) {\n this._textures[attachment] = this._textures[attachment] || {};\n this._textures[attachment].texture = texture;\n this._textures[attachment].target = target;\n }\n },\n\n _doAttach: function (renderer, texture, attachment, target) {\n var _gl = renderer.gl;\n // Make sure texture is always updated\n // Because texture width or height may be changed and in this we can't be notified\n // FIXME awkward;\n var webglTexture = texture.getWebGLTexture(renderer);\n // Assume cache has been used.\n var attachedTextures = this._cache.get('attached_textures');\n if (attachedTextures && attachedTextures[attachment]) {\n var obj = attachedTextures[attachment];\n // Check if texture and target not changed\n if (obj.texture === texture && obj.target === target) {\n return;\n }\n }\n attachment = +attachment;\n\n var canAttach = true;\n if (attachment === GL_DEPTH_ATTACHMENT || attachment === glenum.DEPTH_STENCIL_ATTACHMENT) {\n var extension = renderer.getGLExtension('WEBGL_depth_texture');\n\n if (!extension) {\n console.error('Depth texture is not supported by the browser');\n canAttach = false;\n }\n if (texture.format !== glenum.DEPTH_COMPONENT\n && texture.format !== glenum.DEPTH_STENCIL\n ) {\n console.error('The texture attached to depth buffer is not a valid.');\n canAttach = false;\n }\n\n // Dispose render buffer created previous\n if (canAttach) {\n var renderbuffer = this._cache.get(KEY_RENDERBUFFER);\n if (renderbuffer) {\n _gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, null);\n _gl.deleteRenderbuffer(renderbuffer);\n this._cache.put(KEY_RENDERBUFFER, false);\n }\n\n this._cache.put(KEY_RENDERBUFFER_ATTACHED, false);\n this._cache.put(KEY_DEPTHTEXTURE_ATTACHED, true);\n }\n }\n\n // Mipmap level can only be 0\n _gl.framebufferTexture2D(GL_FRAMEBUFFER, attachment, target, webglTexture, 0);\n\n if (!attachedTextures) {\n attachedTextures = {};\n this._cache.put('attached_textures', attachedTextures);\n }\n attachedTextures[attachment] = attachedTextures[attachment] || {};\n attachedTextures[attachment].texture = texture;\n attachedTextures[attachment].target = target;\n\n return canAttach;\n },\n\n _doDetach: function (_gl, attachment, target) {\n // Detach a texture from framebuffer\n // https://github.com/KhronosGroup/WebGL/blob/master/conformance-suites/1.0.0/conformance/framebuffer-test.html#L145\n _gl.framebufferTexture2D(GL_FRAMEBUFFER, attachment, target, null, 0);\n\n // Assume cache has been used.\n var attachedTextures = this._cache.get('attached_textures');\n if (attachedTextures && attachedTextures[attachment]) {\n attachedTextures[attachment] = null;\n }\n\n if (attachment === GL_DEPTH_ATTACHMENT || attachment === glenum.DEPTH_STENCIL_ATTACHMENT) {\n this._cache.put(KEY_DEPTHTEXTURE_ATTACHED, false);\n }\n },\n\n /**\n * Detach a texture\n * @param {number} [attachment=gl.COLOR_ATTACHMENT0]\n * @param {number} [target=gl.TEXTURE_2D]\n */\n detach: function (attachment, target) {\n // TODO depth extension check ?\n this._textures[attachment] = null;\n if (this._boundRenderer) {\n var cache = this._cache;\n cache.use(this._boundRenderer.__uid__);\n this._doDetach(this._boundRenderer.gl, attachment, target);\n }\n },\n /**\n * Dispose\n * @param {WebGLRenderingContext} _gl\n */\n dispose: function (renderer) {\n\n var _gl = renderer.gl;\n var cache = this._cache;\n\n cache.use(renderer.__uid__);\n\n var renderBuffer = cache.get(KEY_RENDERBUFFER);\n if (renderBuffer) {\n _gl.deleteRenderbuffer(renderBuffer);\n }\n var frameBuffer = cache.get(KEY_FRAMEBUFFER);\n if (frameBuffer) {\n _gl.deleteFramebuffer(frameBuffer);\n }\n cache.deleteContext(renderer.__uid__);\n\n // Clear cache for reusing\n this._textures = {};\n\n }\n});\n\nFrameBuffer.DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT;\nFrameBuffer.COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0;\nFrameBuffer.STENCIL_ATTACHMENT = glenum.STENCIL_ATTACHMENT;\nFrameBuffer.DEPTH_STENCIL_ATTACHMENT = glenum.DEPTH_STENCIL_ATTACHMENT;\n\nexport default FrameBuffer;\n","import Base from '../core/Base';\nimport Vector3 from '../math/Vector3';\nimport PerspectiveCamera from '../camera/Perspective';\nimport FrameBuffer from '../FrameBuffer';\n\nvar targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\n/**\n * Pass rendering scene to a environment cube map\n *\n * @constructor clay.prePass.EnvironmentMap\n * @extends clay.core.Base\n * @example\n * // Example of car reflection\n * var envMap = new clay.TextureCube({\n * width: 256,\n * height: 256\n * });\n * var envPass = new clay.prePass.EnvironmentMap({\n * position: car.position,\n * texture: envMap\n * });\n * var carBody = car.getChildByName('body');\n * carBody.material.enableTexture('environmentMap');\n * carBody.material.set('environmentMap', envMap);\n * ...\n * animation.on('frame', function(frameTime) {\n * envPass.render(renderer, scene);\n * renderer.render(scene, camera);\n * });\n */\nvar EnvironmentMapPass = Base.extend(function() {\n var ret = /** @lends clay.prePass.EnvironmentMap# */ {\n /**\n * Camera position\n * @type {clay.Vector3}\n * @memberOf clay.prePass.EnvironmentMap#\n */\n position: new Vector3(),\n /**\n * Camera far plane\n * @type {number}\n * @memberOf clay.prePass.EnvironmentMap#\n */\n far: 1000,\n /**\n * Camera near plane\n * @type {number}\n * @memberOf clay.prePass.EnvironmentMap#\n */\n near: 0.1,\n /**\n * Environment cube map\n * @type {clay.TextureCube}\n * @memberOf clay.prePass.EnvironmentMap#\n */\n texture: null,\n\n /**\n * Used if you wan't have shadow in environment map\n * @type {clay.prePass.ShadowMap}\n */\n shadowMapPass: null,\n };\n var cameras = ret._cameras = {\n px: new PerspectiveCamera({ fov: 90 }),\n nx: new PerspectiveCamera({ fov: 90 }),\n py: new PerspectiveCamera({ fov: 90 }),\n ny: new PerspectiveCamera({ fov: 90 }),\n pz: new PerspectiveCamera({ fov: 90 }),\n nz: new PerspectiveCamera({ fov: 90 })\n };\n cameras.px.lookAt(Vector3.POSITIVE_X, Vector3.NEGATIVE_Y);\n cameras.nx.lookAt(Vector3.NEGATIVE_X, Vector3.NEGATIVE_Y);\n cameras.py.lookAt(Vector3.POSITIVE_Y, Vector3.POSITIVE_Z);\n cameras.ny.lookAt(Vector3.NEGATIVE_Y, Vector3.NEGATIVE_Z);\n cameras.pz.lookAt(Vector3.POSITIVE_Z, Vector3.NEGATIVE_Y);\n cameras.nz.lookAt(Vector3.NEGATIVE_Z, Vector3.NEGATIVE_Y);\n\n // FIXME In windows, use one framebuffer only renders one side of cubemap\n ret._frameBuffer = new FrameBuffer();\n\n return ret;\n}, /** @lends clay.prePass.EnvironmentMap# */ {\n /**\n * @param {string} target\n * @return {clay.Camera}\n */\n getCamera: function (target) {\n return this._cameras[target];\n },\n /**\n * @param {clay.Renderer} renderer\n * @param {clay.Scene} scene\n * @param {boolean} [notUpdateScene=false]\n */\n render: function(renderer, scene, notUpdateScene) {\n var _gl = renderer.gl;\n if (!notUpdateScene) {\n scene.update();\n }\n // Tweak fov\n // http://the-witness.net/news/2012/02/seamless-cube-map-filtering/\n var n = this.texture.width;\n var fov = 2 * Math.atan(n / (n - 0.5)) / Math.PI * 180;\n\n for (var i = 0; i < 6; i++) {\n var target = targets[i];\n var camera = this._cameras[target];\n Vector3.copy(camera.position, this.position);\n\n camera.far = this.far;\n camera.near = this.near;\n camera.fov = fov;\n\n if (this.shadowMapPass) {\n camera.update();\n\n // update boundingBoxLastFrame\n var bbox = scene.getBoundingBox();\n bbox.applyTransform(camera.viewMatrix);\n scene.viewBoundingBoxLastFrame.copy(bbox);\n\n this.shadowMapPass.render(renderer, scene, camera, true);\n }\n this._frameBuffer.attach(\n this.texture, _gl.COLOR_ATTACHMENT0,\n _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i\n );\n this._frameBuffer.bind(renderer);\n renderer.render(scene, camera, true);\n this._frameBuffer.unbind(renderer);\n }\n },\n /**\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n this._frameBuffer.dispose(renderer);\n }\n});\n\nexport default EnvironmentMapPass;\n","import Geometry from '../Geometry';\nimport BoundingBox from '../math/BoundingBox';\n\n/**\n * @constructor clay.geometry.Plane\n * @extends clay.Geometry\n * @param {Object} [opt]\n * @param {number} [opt.widthSegments]\n * @param {number} [opt.heightSegments]\n */\nvar Plane = Geometry.extend(\n/** @lends clay.geometry.Plane# */\n{\n dynamic: false,\n /**\n * @type {number}\n */\n widthSegments: 1,\n /**\n * @type {number}\n */\n heightSegments: 1\n}, function() {\n this.build();\n},\n/** @lends clay.geometry.Plane.prototype */\n{\n /**\n * Build plane geometry\n */\n build: function() {\n var heightSegments = this.heightSegments;\n var widthSegments = this.widthSegments;\n var attributes = this.attributes;\n var positions = [];\n var texcoords = [];\n var normals = [];\n var faces = [];\n\n for (var y = 0; y <= heightSegments; y++) {\n var t = y / heightSegments;\n for (var x = 0; x <= widthSegments; x++) {\n var s = x / widthSegments;\n\n positions.push([2 * s - 1, 2 * t - 1, 0]);\n if (texcoords) {\n texcoords.push([s, t]);\n }\n if (normals) {\n normals.push([0, 0, 1]);\n }\n if (x < widthSegments && y < heightSegments) {\n var i = x + y * (widthSegments + 1);\n faces.push([i, i + 1, i + widthSegments + 1]);\n faces.push([i + widthSegments + 1, i + 1, i + widthSegments + 2]);\n }\n }\n }\n\n attributes.position.fromArray(positions);\n attributes.texcoord0.fromArray(texcoords);\n attributes.normal.fromArray(normals);\n\n this.initIndicesFromArray(faces);\n\n this.boundingBox = new BoundingBox();\n this.boundingBox.min.set(-1, -1, 0);\n this.boundingBox.max.set(1, 1, 0);\n }\n});\n\nexport default Plane;\n","import Geometry from '../Geometry';\nimport Plane from './Plane';\nimport Matrix4 from '../math/Matrix4';\nimport Vector3 from '../math/Vector3';\nimport BoundingBox from '../math/BoundingBox';\nimport vendor from '../core/vendor';\n\nvar planeMatrix = new Matrix4();\n\n/**\n * @constructor clay.geometry.Cube\n * @extends clay.Geometry\n * @param {Object} [opt]\n * @param {number} [opt.widthSegments]\n * @param {number} [opt.heightSegments]\n * @param {number} [opt.depthSegments]\n * @param {boolean} [opt.inside]\n */\nvar Cube = Geometry.extend(\n/**@lends clay.geometry.Cube# */\n{\n dynamic: false,\n /**\n * @type {number}\n */\n widthSegments: 1,\n /**\n * @type {number}\n */\n heightSegments: 1,\n /**\n * @type {number}\n */\n depthSegments: 1,\n /**\n * @type {boolean}\n */\n inside: false\n}, function() {\n this.build();\n},\n/** @lends clay.geometry.Cube.prototype */\n{\n /**\n * Build cube geometry\n */\n build: function() {\n\n var planes = {\n 'px': createPlane('px', this.depthSegments, this.heightSegments),\n 'nx': createPlane('nx', this.depthSegments, this.heightSegments),\n 'py': createPlane('py', this.widthSegments, this.depthSegments),\n 'ny': createPlane('ny', this.widthSegments, this.depthSegments),\n 'pz': createPlane('pz', this.widthSegments, this.heightSegments),\n 'nz': createPlane('nz', this.widthSegments, this.heightSegments),\n };\n\n var attrList = ['position', 'texcoord0', 'normal'];\n var vertexNumber = 0;\n var faceNumber = 0;\n for (var pos in planes) {\n vertexNumber += planes[pos].vertexCount;\n faceNumber += planes[pos].indices.length;\n }\n for (var k = 0; k < attrList.length; k++) {\n this.attributes[attrList[k]].init(vertexNumber);\n }\n this.indices = new vendor.Uint16Array(faceNumber);\n var faceOffset = 0;\n var vertexOffset = 0;\n for (var pos in planes) {\n var plane = planes[pos];\n for (var k = 0; k < attrList.length; k++) {\n var attrName = attrList[k];\n var attrArray = plane.attributes[attrName].value;\n var attrSize = plane.attributes[attrName].size;\n var isNormal = attrName === 'normal';\n for (var i = 0; i < attrArray.length; i++) {\n var value = attrArray[i];\n if (this.inside && isNormal) {\n value = -value;\n }\n this.attributes[attrName].value[i + attrSize * vertexOffset] = value;\n }\n }\n var len = plane.indices.length;\n for (var i = 0; i < plane.indices.length; i++) {\n this.indices[i + faceOffset] = vertexOffset + plane.indices[this.inside ? (len - i - 1) : i];\n }\n faceOffset += plane.indices.length;\n vertexOffset += plane.vertexCount;\n }\n\n this.boundingBox = new BoundingBox();\n this.boundingBox.max.set(1, 1, 1);\n this.boundingBox.min.set(-1, -1, -1);\n }\n});\n\nfunction createPlane(pos, widthSegments, heightSegments) {\n\n planeMatrix.identity();\n\n var plane = new Plane({\n widthSegments: widthSegments,\n heightSegments: heightSegments\n });\n\n switch(pos) {\n case 'px':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.POSITIVE_X);\n Matrix4.rotateY(planeMatrix, planeMatrix, Math.PI / 2);\n break;\n case 'nx':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.NEGATIVE_X);\n Matrix4.rotateY(planeMatrix, planeMatrix, -Math.PI / 2);\n break;\n case 'py':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.POSITIVE_Y);\n Matrix4.rotateX(planeMatrix, planeMatrix, -Math.PI / 2);\n break;\n case 'ny':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.NEGATIVE_Y);\n Matrix4.rotateX(planeMatrix, planeMatrix, Math.PI / 2);\n break;\n case 'pz':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.POSITIVE_Z);\n break;\n case 'nz':\n Matrix4.translate(planeMatrix, planeMatrix, Vector3.NEGATIVE_Z);\n Matrix4.rotateY(planeMatrix, planeMatrix, Math.PI);\n break;\n }\n plane.applyTransform(planeMatrix);\n return plane;\n}\n\nexport default Cube;\n","export default \"@export clay.skybox.vertex\\n#define SHADER_NAME skybox\\nuniform mat4 world : WORLD;\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nattribute vec3 position : POSITION;\\nvarying vec3 v_WorldPosition;\\nvoid main()\\n{\\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n}\\n@end\\n@export clay.skybox.fragment\\n#define PI 3.1415926\\nuniform mat4 viewInverse : VIEWINVERSE;\\n#ifdef EQUIRECTANGULAR\\nuniform sampler2D environmentMap;\\n#else\\nuniform samplerCube environmentMap;\\n#endif\\nuniform float lod: 0.0;\\nvarying vec3 v_WorldPosition;\\n@import clay.util.rgbm\\n@import clay.util.srgb\\n@import clay.util.ACES\\nvoid main()\\n{\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(v_WorldPosition - eyePos);\\n#ifdef EQUIRECTANGULAR\\n float phi = acos(V.y);\\n float theta = atan(-V.x, V.z) + PI * 0.5;\\n vec2 uv = vec2(theta / 2.0 / PI, phi / PI);\\n vec4 texel = decodeHDR(texture2D(environmentMap, fract(uv)));\\n#else\\n #if defined(LOD) || defined(SUPPORT_TEXTURE_LOD)\\n vec4 texel = decodeHDR(textureCubeLodEXT(environmentMap, V, lod));\\n #else\\n vec4 texel = decodeHDR(textureCube(environmentMap, V));\\n #endif\\n#endif\\n#ifdef SRGB_DECODE\\n texel = sRGBToLinear(texel);\\n#endif\\n#ifdef TONEMAPPING\\n texel.rgb = ACESToneMapping(texel.rgb);\\n#endif\\n#ifdef SRGB_ENCODE\\n texel = linearTosRGB(texel);\\n#endif\\n gl_FragColor = encodeHDR(vec4(texel.rgb, 1.0));\\n}\\n@end\";\n","// TODO Should not derived from mesh?\nimport Mesh from '../Mesh';\nimport CubeGeometry from '../geometry/Cube';\nimport Shader from '../Shader';\nimport Material from '../Material';\nimport Texture from '../Texture';\nimport PerspectiveCamera from '../camera/Perspective';\nimport Matrix4 from '../math/Matrix4';\n\nimport skyboxEssl from '../shader/source/skybox.glsl.js';\nShader.import(skyboxEssl);\n/**\n * @constructor clay.plugin.Skybox\n *\n * @example\n * var skyTex = new clay.TextureCube();\n * skyTex.load({\n * 'px': 'assets/textures/sky/px.jpg',\n * 'nx': 'assets/textures/sky/nx.jpg'\n * 'py': 'assets/textures/sky/py.jpg'\n * 'ny': 'assets/textures/sky/ny.jpg'\n * 'pz': 'assets/textures/sky/pz.jpg'\n * 'nz': 'assets/textures/sky/nz.jpg'\n * });\n * var skybox = new clay.plugin.Skybox({\n * scene: scene\n * });\n * skybox.material.set('environmentMap', skyTex);\n */\nvar Skybox = Mesh.extend(function () {\n\n var skyboxShader = new Shader({\n vertex: Shader.source('clay.skybox.vertex'),\n fragment: Shader.source('clay.skybox.fragment')\n });\n var material = new Material({\n shader: skyboxShader,\n depthMask: false\n });\n\n return {\n /**\n * @type {clay.Scene}\n * @memberOf clay.plugin.Skybox.prototype\n */\n scene: null,\n\n geometry: new CubeGeometry(),\n\n material: material,\n\n environmentMap: null,\n\n culling: false,\n\n _dummyCamera: new PerspectiveCamera()\n };\n}, function () {\n var scene = this.scene;\n if (scene) {\n this.attachScene(scene);\n }\n if (this.environmentMap) {\n this.setEnvironmentMap(this.environmentMap);\n }\n}, /** @lends clay.plugin.Skybox# */ {\n /**\n * Attach the skybox to the scene\n * @param {clay.Scene} scene\n */\n attachScene: function (scene) {\n if (this.scene) {\n this.detachScene();\n }\n scene.skybox = this;\n\n this.scene = scene;\n scene.on('beforerender', this._beforeRenderScene, this);\n },\n /**\n * Detach from scene\n */\n detachScene: function () {\n if (this.scene) {\n this.scene.off('beforerender', this._beforeRenderScene);\n this.scene.skybox = null;\n }\n this.scene = null;\n },\n\n /**\n * Dispose skybox\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n this.detachScene();\n this.geometry.dispose(renderer);\n },\n /**\n * Set environment map\n * @param {clay.TextureCube} envMap\n */\n setEnvironmentMap: function (envMap) {\n if (envMap.textureType === 'texture2D') {\n this.material.define('EQUIRECTANGULAR');\n // LINEAR filter can remove the artifacts in pole\n envMap.minFilter = Texture.LINEAR;\n }\n else {\n this.material.undefine('EQUIRECTANGULAR');\n }\n this.material.set('environmentMap', envMap);\n },\n /**\n * Get environment map\n * @return {clay.TextureCube}\n */\n getEnvironmentMap: function () {\n return this.material.get('environmentMap');\n },\n\n _beforeRenderScene: function(renderer, scene, camera) {\n this.renderSkybox(renderer, camera);\n },\n\n renderSkybox: function (renderer, camera) {\n var dummyCamera = this._dummyCamera;\n dummyCamera.aspect = renderer.getViewportAspect();\n dummyCamera.fov = camera.fov || 50;\n dummyCamera.updateProjectionMatrix();\n Matrix4.invert(dummyCamera.invProjectionMatrix, dummyCamera.projectionMatrix);\n dummyCamera.worldTransform.copy(camera.worldTransform);\n dummyCamera.viewMatrix.copy(camera.viewMatrix);\n\n this.position.copy(camera.getWorldPosition());\n this.update();\n\n // Don't remember to disable blend\n renderer.gl.disable(renderer.gl.BLEND);\n if (this.material.get('lod') > 0) {\n this.material.define('fragment', 'LOD');\n }\n else {\n this.material.undefine('fragment', 'LOD');\n }\n renderer.renderPass([this], dummyCamera);\n }\n});\n\nexport default Skybox;\n","import Skybox from './Skybox';\n\nexport default Skybox;","import Texture from '../Texture';\nimport Texture2D from '../Texture2D';\nimport TextureCube from '../TextureCube';\n\n// http://msdn.microsoft.com/en-us/library/windows/desktop/bb943991(v=vs.85).aspx\n// https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js\nvar DDS_MAGIC = 0x20534444;\n\nvar DDSD_CAPS = 0x1;\nvar DDSD_HEIGHT = 0x2;\nvar DDSD_WIDTH = 0x4;\nvar DDSD_PITCH = 0x8;\nvar DDSD_PIXELFORMAT = 0x1000;\nvar DDSD_MIPMAPCOUNT = 0x20000;\nvar DDSD_LINEARSIZE = 0x80000;\nvar DDSD_DEPTH = 0x800000;\n\nvar DDSCAPS_COMPLEX = 0x8;\nvar DDSCAPS_MIPMAP = 0x400000;\nvar DDSCAPS_TEXTURE = 0x1000;\n\nvar DDSCAPS2_CUBEMAP = 0x200;\nvar DDSCAPS2_CUBEMAP_POSITIVEX = 0x400;\nvar DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800;\nvar DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000;\nvar DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000;\nvar DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000;\nvar DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000;\nvar DDSCAPS2_VOLUME = 0x200000;\n\nvar DDPF_ALPHAPIXELS = 0x1;\nvar DDPF_ALPHA = 0x2;\nvar DDPF_FOURCC = 0x4;\nvar DDPF_RGB = 0x40;\nvar DDPF_YUV = 0x200;\nvar DDPF_LUMINANCE = 0x20000;\n\nfunction fourCCToInt32(value) {\n return value.charCodeAt(0) +\n (value.charCodeAt(1) << 8) +\n (value.charCodeAt(2) << 16) +\n (value.charCodeAt(3) << 24);\n}\n\nfunction int32ToFourCC(value) {\n return String.fromCharCode(\n value & 0xff,\n (value >> 8) & 0xff,\n (value >> 16) & 0xff,\n (value >> 24) & 0xff\n );\n}\n\nvar headerLengthInt = 31; // The header length in 32 bit ints\n\nvar FOURCC_DXT1 = fourCCToInt32('DXT1');\nvar FOURCC_DXT3 = fourCCToInt32('DXT3');\nvar FOURCC_DXT5 = fourCCToInt32('DXT5');\n// Offsets into the header array\nvar off_magic = 0;\n\nvar off_size = 1;\nvar off_flags = 2;\nvar off_height = 3;\nvar off_width = 4;\n\nvar off_mipmapCount = 7;\n\nvar off_pfFlags = 20;\nvar off_pfFourCC = 21;\n\nvar off_caps = 27;\nvar off_caps2 = 28;\nvar off_caps3 = 29;\nvar off_caps4 = 30;\n\nvar ret = {\n parse: function(arrayBuffer, out) {\n var header = new Int32Array(arrayBuffer, 0, headerLengthInt);\n if (header[off_magic] !== DDS_MAGIC) {\n return null;\n }\n if (!header(off_pfFlags) & DDPF_FOURCC) {\n return null;\n }\n\n var fourCC = header(off_pfFourCC);\n var width = header[off_width];\n var height = header[off_height];\n var isCubeMap = header[off_caps2] & DDSCAPS2_CUBEMAP;\n var hasMipmap = header[off_flags] & DDSD_MIPMAPCOUNT;\n var blockBytes, internalFormat;\n switch(fourCC) {\n case FOURCC_DXT1:\n blockBytes = 8;\n internalFormat = Texture.COMPRESSED_RGB_S3TC_DXT1_EXT;\n break;\n case FOURCC_DXT3:\n blockBytes = 16;\n internalFormat = Texture.COMPRESSED_RGBA_S3TC_DXT3_EXT;\n break;\n case FOURCC_DXT5:\n blockBytes = 16;\n internalFormat = Texture.COMPRESSED_RGBA_S3TC_DXT5_EXT;\n break;\n default:\n return null;\n }\n var dataOffset = header[off_size] + 4;\n // TODO: Suppose all face are existed\n var faceNumber = isCubeMap ? 6 : 1;\n var mipmapCount = 1;\n if (hasMipmap) {\n mipmapCount = Math.max(1, header[off_mipmapCount]);\n }\n\n var textures = [];\n for (var f = 0; f < faceNumber; f++) {\n var _width = width;\n var _height = height;\n textures[f] = new Texture2D({\n width: _width,\n height: _height,\n format: internalFormat\n });\n var mipmaps = [];\n for (var i = 0; i < mipmapCount; i++) {\n var dataLength = Math.max(4, _width) / 4 * Math.max(4, _height) / 4 * blockBytes;\n var byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength);\n\n dataOffset += dataLength;\n _width *= 0.5;\n _height *= 0.5;\n mipmaps[i] = byteArray;\n }\n textures[f].pixels = mipmaps[0];\n if (hasMipmap) {\n textures[f].mipmaps = mipmaps;\n }\n }\n // TODO\n // return isCubeMap ? textures : textures[0];\n if (out) {\n out.width = textures[0].width;\n out.height = textures[0].height;\n out.format = textures[0].format;\n out.pixels = textures[0].pixels;\n out.mipmaps = textures[0].mipmaps;\n }\n else {\n return textures[0];\n }\n }\n};\n\nexport default ret;\n","import Texture from '../Texture';\nimport Texture2D from '../Texture2D';\nvar toChar = String.fromCharCode;\n\nvar MINELEN = 8;\nvar MAXELEN = 0x7fff;\nfunction rgbe2float(rgbe, buffer, offset, exposure) {\n if (rgbe[3] > 0) {\n var f = Math.pow(2.0, rgbe[3] - 128 - 8 + exposure);\n buffer[offset + 0] = rgbe[0] * f;\n buffer[offset + 1] = rgbe[1] * f;\n buffer[offset + 2] = rgbe[2] * f;\n }\n else {\n buffer[offset + 0] = 0;\n buffer[offset + 1] = 0;\n buffer[offset + 2] = 0;\n }\n buffer[offset + 3] = 1.0;\n return buffer;\n}\n\nfunction uint82string(array, offset, size) {\n var str = '';\n for (var i = offset; i < size; i++) {\n str += toChar(array[i]);\n }\n return str;\n}\n\nfunction copyrgbe(s, t) {\n t[0] = s[0];\n t[1] = s[1];\n t[2] = s[2];\n t[3] = s[3];\n}\n\n// TODO : check\nfunction oldReadColors(scan, buffer, offset, xmax) {\n var rshift = 0, x = 0, len = xmax;\n while (len > 0) {\n scan[x][0] = buffer[offset++];\n scan[x][1] = buffer[offset++];\n scan[x][2] = buffer[offset++];\n scan[x][3] = buffer[offset++];\n if (scan[x][0] === 1 && scan[x][1] === 1 && scan[x][2] === 1) {\n // exp is count of repeated pixels\n for (var i = (scan[x][3] << rshift) >>> 0; i > 0; i--) {\n copyrgbe(scan[x-1], scan[x]);\n x++;\n len--;\n }\n rshift += 8;\n } else {\n x++;\n len--;\n rshift = 0;\n }\n }\n return offset;\n}\n\nfunction readColors(scan, buffer, offset, xmax) {\n if ((xmax < MINELEN) | (xmax > MAXELEN)) {\n return oldReadColors(scan, buffer, offset, xmax);\n }\n var i = buffer[offset++];\n if (i != 2) {\n return oldReadColors(scan, buffer, offset - 1, xmax);\n }\n scan[0][1] = buffer[offset++];\n scan[0][2] = buffer[offset++];\n\n i = buffer[offset++];\n if ((((scan[0][2] << 8) >>> 0) | i) >>> 0 !== xmax) {\n return null;\n }\n for (var i = 0; i < 4; i++) {\n for (var x = 0; x < xmax;) {\n var code = buffer[offset++];\n if (code > 128) {\n code = (code & 127) >>> 0;\n var val = buffer[offset++];\n while (code--) {\n scan[x++][i] = val;\n }\n } else {\n while (code--) {\n scan[x++][i] = buffer[offset++];\n }\n }\n }\n }\n return offset;\n}\n\n\nvar ret = {\n // http://www.graphics.cornell.edu/~bjw/rgbe.html\n // Blender source\n // http://radsite.lbl.gov/radiance/refer/Notes/picture_format.html\n parseRGBE: function(arrayBuffer, texture, exposure) {\n if (exposure == null) {\n exposure = 0;\n }\n var data = new Uint8Array(arrayBuffer);\n var size = data.length;\n if (uint82string(data, 0, 2) !== '#?') {\n return;\n }\n // find empty line, next line is resolution info\n for (var i = 2; i < size; i++) {\n if (toChar(data[i]) === '\\n' && toChar(data[i+1]) === '\\n') {\n break;\n }\n }\n if (i >= size) { // not found\n return;\n }\n // find resolution info line\n i += 2;\n var str = '';\n for (; i < size; i++) {\n var _char = toChar(data[i]);\n if (_char === '\\n') {\n break;\n }\n str += _char;\n }\n // -Y M +X N\n var tmp = str.split(' ');\n var height = parseInt(tmp[1]);\n var width = parseInt(tmp[3]);\n if (!width || !height) {\n return;\n }\n\n // read and decode actual data\n var offset = i+1;\n var scanline = [];\n // memzero\n for (var x = 0; x < width; x++) {\n scanline[x] = [];\n for (var j = 0; j < 4; j++) {\n scanline[x][j] = 0;\n }\n }\n var pixels = new Float32Array(width * height * 4);\n var offset2 = 0;\n for (var y = 0; y < height; y++) {\n var offset = readColors(scanline, data, offset, width);\n if (!offset) {\n return null;\n }\n for (var x = 0; x < width; x++) {\n rgbe2float(scanline[x], pixels, offset2, exposure);\n offset2 += 4;\n }\n }\n\n if (!texture) {\n texture = new Texture2D();\n }\n texture.width = width;\n texture.height = height;\n texture.pixels = pixels;\n // HALF_FLOAT can't use Float32Array\n texture.type = Texture.FLOAT;\n return texture;\n },\n\n parseRGBEFromPNG: function(png) {\n\n }\n};\n\nexport default ret;\n","import Texture2D from '../Texture2D';\nimport TextureCube from '../TextureCube';\nimport vendor from '../core/vendor';\nimport EnvironmentMapPass from '../prePass/EnvironmentMap';\nimport Skydome from '../plugin/Skydome';\nimport Scene from '../Scene';\n\nimport dds from './dds';\nimport hdr from './hdr';\n\n/**\n * @alias clay.util.texture\n */\nvar textureUtil = {\n /**\n * @param {string|object} path\n * @param {object} [option]\n * @param {Function} [onsuccess]\n * @param {Function} [onerror]\n * @return {clay.Texture}\n */\n loadTexture: function (path, option, onsuccess, onerror) {\n var texture;\n if (typeof(option) === 'function') {\n onsuccess = option;\n onerror = onsuccess;\n option = {};\n }\n else {\n option = option || {};\n }\n if (typeof(path) === 'string') {\n if (path.match(/.hdr$/) || option.fileType === 'hdr') {\n texture = new Texture2D({\n width: 0,\n height: 0,\n sRGB: false\n });\n textureUtil._fetchTexture(\n path,\n function (data) {\n hdr.parseRGBE(data, texture, option.exposure);\n texture.dirty();\n onsuccess && onsuccess(texture);\n },\n onerror\n );\n return texture;\n }\n else if (path.match(/.dds$/) || option.fileType === 'dds') {\n texture = new Texture2D({\n width: 0,\n height: 0\n });\n textureUtil._fetchTexture(\n path,\n function (data) {\n dds.parse(data, texture);\n texture.dirty();\n onsuccess && onsuccess(texture);\n },\n onerror\n );\n }\n else {\n texture = new Texture2D();\n texture.load(path);\n texture.success(onsuccess);\n texture.error(onerror);\n }\n }\n else if (typeof path === 'object' && typeof(path.px) !== 'undefined') {\n texture = new TextureCube();\n texture.load(path);\n texture.success(onsuccess);\n texture.error(onerror);\n }\n return texture;\n },\n\n /**\n * Load a panorama texture and render it to a cube map\n * @param {clay.Renderer} renderer\n * @param {string} path\n * @param {clay.TextureCube} cubeMap\n * @param {object} [option]\n * @param {boolean} [option.encodeRGBM]\n * @param {number} [option.exposure]\n * @param {Function} [onsuccess]\n * @param {Function} [onerror]\n */\n loadPanorama: function (renderer, path, cubeMap, option, onsuccess, onerror) {\n var self = this;\n\n if (typeof(option) === 'function') {\n onsuccess = option;\n onerror = onsuccess;\n option = {};\n }\n else {\n option = option || {};\n }\n\n textureUtil.loadTexture(path, option, function (texture) {\n // PENDING\n texture.flipY = option.flipY || false;\n self.panoramaToCubeMap(renderer, texture, cubeMap, option);\n texture.dispose(renderer);\n onsuccess && onsuccess(cubeMap);\n }, onerror);\n },\n\n /**\n * Render a panorama texture to a cube map\n * @param {clay.Renderer} renderer\n * @param {clay.Texture2D} panoramaMap\n * @param {clay.TextureCube} cubeMap\n * @param {Object} option\n * @param {boolean} [option.encodeRGBM]\n */\n panoramaToCubeMap: function (renderer, panoramaMap, cubeMap, option) {\n var environmentMapPass = new EnvironmentMapPass();\n var skydome = new Skydome({\n scene: new Scene()\n });\n skydome.setEnvironmentMap(panoramaMap);\n\n option = option || {};\n if (option.encodeRGBM) {\n skydome.material.define('fragment', 'RGBM_ENCODE');\n }\n\n // Share sRGB\n cubeMap.sRGB = panoramaMap.sRGB;\n\n environmentMapPass.texture = cubeMap;\n environmentMapPass.render(renderer, skydome.scene);\n environmentMapPass.texture = null;\n environmentMapPass.dispose(renderer);\n return cubeMap;\n },\n\n /**\n * Convert height map to normal map\n * @param {HTMLImageElement|HTMLCanvasElement} image\n * @param {boolean} [checkBump=false]\n * @return {HTMLCanvasElement}\n */\n heightToNormal: function (image, checkBump) {\n var canvas = document.createElement('canvas');\n var width = canvas.width = image.width;\n var height = canvas.height = image.height;\n var ctx = canvas.getContext('2d');\n ctx.drawImage(image, 0, 0, width, height);\n checkBump = checkBump || false;\n var srcData = ctx.getImageData(0, 0, width, height);\n var dstData = ctx.createImageData(width, height);\n for (var i = 0; i < srcData.data.length; i += 4) {\n if (checkBump) {\n var r = srcData.data[i];\n var g = srcData.data[i + 1];\n var b = srcData.data[i + 2];\n var diff = Math.abs(r - g) + Math.abs(g - b);\n if (diff > 20) {\n console.warn('Given image is not a height map');\n return image;\n }\n }\n // Modified from http://mrdoob.com/lab/javascript/height2normal/\n var x1, y1, x2, y2;\n if (i % (width * 4) === 0) {\n // left edge\n x1 = srcData.data[i];\n x2 = srcData.data[i + 4];\n }\n else if (i % (width * 4) === (width - 1) * 4) {\n // right edge\n x1 = srcData.data[i - 4];\n x2 = srcData.data[i];\n }\n else {\n x1 = srcData.data[i - 4];\n x2 = srcData.data[i + 4];\n }\n\n if (i < width * 4) {\n // top edge\n y1 = srcData.data[i];\n y2 = srcData.data[i + width * 4];\n }\n else if (i > width * (height - 1) * 4) {\n // bottom edge\n y1 = srcData.data[i - width * 4];\n y2 = srcData.data[i];\n }\n else {\n y1 = srcData.data[i - width * 4];\n y2 = srcData.data[i + width * 4];\n }\n\n dstData.data[i] = (x1 - x2) + 127;\n dstData.data[i + 1] = (y1 - y2) + 127;\n dstData.data[i + 2] = 255;\n dstData.data[i + 3] = 255;\n }\n ctx.putImageData(dstData, 0, 0);\n return canvas;\n },\n\n /**\n * Convert height map to normal map\n * @param {HTMLImageElement|HTMLCanvasElement} image\n * @param {boolean} [checkBump=false]\n * @param {number} [threshold=20]\n * @return {HTMLCanvasElement}\n */\n isHeightImage: function (img, downScaleSize, threshold) {\n if (!img || !img.width || !img.height) {\n return false;\n }\n\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n var size = downScaleSize || 32;\n threshold = threshold || 20;\n canvas.width = canvas.height = size;\n ctx.drawImage(img, 0, 0, size, size);\n var srcData = ctx.getImageData(0, 0, size, size);\n for (var i = 0; i < srcData.data.length; i += 4) {\n var r = srcData.data[i];\n var g = srcData.data[i + 1];\n var b = srcData.data[i + 2];\n var diff = Math.abs(r - g) + Math.abs(g - b);\n if (diff > threshold) {\n return false;\n }\n }\n return true;\n },\n\n _fetchTexture: function (path, onsuccess, onerror) {\n vendor.request.get({\n url: path,\n responseType: 'arraybuffer',\n onload: onsuccess,\n onerror: onerror\n });\n },\n\n /**\n * Create a chessboard texture\n * @param {number} [size]\n * @param {number} [unitSize]\n * @param {string} [color1]\n * @param {string} [color2]\n * @return {clay.Texture2D}\n */\n createChessboard: function (size, unitSize, color1, color2) {\n size = size || 512;\n unitSize = unitSize || 64;\n color1 = color1 || 'black';\n color2 = color2 || 'white';\n\n var repeat = Math.ceil(size / unitSize);\n\n var canvas = document.createElement('canvas');\n canvas.width = size;\n canvas.height = size;\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = color2;\n ctx.fillRect(0, 0, size, size);\n\n ctx.fillStyle = color1;\n for (var i = 0; i < repeat; i++) {\n for (var j = 0; j < repeat; j++) {\n var isFill = j % 2 ? (i % 2) : (i % 2 - 1);\n if (isFill) {\n ctx.fillRect(i * unitSize, j * unitSize, unitSize, unitSize);\n }\n }\n }\n\n var texture = new Texture2D({\n image: canvas,\n anisotropic: 8\n });\n\n return texture;\n },\n\n /**\n * Create a blank pure color 1x1 texture\n * @param {string} color\n * @return {clay.Texture2D}\n */\n createBlank: function (color) {\n var canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = color;\n ctx.fillRect(0, 0, 1, 1);\n\n var texture = new Texture2D({\n image: canvas\n });\n\n return texture;\n }\n};\n\nexport default textureUtil;\n","/**\n * Surface texture in the 3D scene.\n * Provide management and rendering of zrender shapes and groups\n *\n * @module echarts-gl/util/EChartsSurface\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Texture2D from 'claygl/src/Texture2D';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Vector2 from 'claygl/src/math/Vector2';\n\nvar events = ['mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'click', 'dblclick', 'contextmenu'];\n\nfunction makeHandlerName(eventName) {\n return '_on' + eventName;\n}\n/**\n * @constructor\n * @alias echarts-gl/util/EChartsSurface\n * @param {module:echarts~ECharts} chart\n */\nvar EChartsSurface = function (chart) {\n var self = this;\n this._texture = new Texture2D({\n anisotropic: 32,\n flipY: false,\n\n surface: this,\n\n dispose: function (renderer) {\n self.dispose();\n Texture2D.prototype.dispose.call(this, renderer);\n }\n });\n\n events.forEach(function (eventName) {\n this[makeHandlerName(eventName)] = function (eveObj) {\n if (!eveObj.triangle) {\n return;\n }\n this._meshes.forEach(function (mesh) {\n this.dispatchEvent(eventName, mesh, eveObj.triangle, eveObj.point);\n }, this);\n };\n }, this);\n\n this._meshes = [];\n\n if (chart) {\n this.setECharts(chart);\n }\n\n // Texture updated callback;\n this.onupdate = null;\n};\n\nEChartsSurface.prototype = {\n\n constructor: EChartsSurface,\n\n getTexture: function () {\n return this._texture;\n },\n\n setECharts: function (chart) {\n this._chart = chart;\n\n var canvas = chart.getDom();\n if (!(canvas instanceof HTMLCanvasElement)) {\n console.error('ECharts must init on canvas if it is used as texture.');\n // Use an empty canvas\n canvas = document.createElement('canvas');\n }\n else {\n var self = this;\n // Wrap refreshImmediately\n var zr = chart.getZr();\n var oldRefreshImmediately = zr.__oldRefreshImmediately || zr.refreshImmediately;\n zr.refreshImmediately = function () {\n oldRefreshImmediately.call(this);\n self._texture.dirty();\n\n self.onupdate && self.onupdate();\n };\n zr.__oldRefreshImmediately = oldRefreshImmediately;\n }\n\n this._texture.image = canvas;\n this._texture.dirty();\n this.onupdate && this.onupdate();\n },\n\n /**\n * @method\n * @param {clay.Mesh} attachedMesh\n * @param {Array.} triangle Triangle indices\n * @param {clay.math.Vector3} point\n */\n dispatchEvent: (function () {\n\n var p0 = new Vector3();\n var p1 = new Vector3();\n var p2 = new Vector3();\n var uv0 = new Vector2();\n var uv1 = new Vector2();\n var uv2 = new Vector2();\n var uv = new Vector2();\n\n var vCross = new Vector3();\n\n return function (eventName, attachedMesh, triangle, point) {\n var geo = attachedMesh.geometry;\n var position = geo.attributes.position;\n var texcoord = geo.attributes.texcoord0;\n var dot = Vector3.dot;\n var cross = Vector3.cross;\n\n position.get(triangle[0], p0.array);\n position.get(triangle[1], p1.array);\n position.get(triangle[2], p2.array);\n texcoord.get(triangle[0], uv0.array);\n texcoord.get(triangle[1], uv1.array);\n texcoord.get(triangle[2], uv2.array);\n\n cross(vCross, p1, p2);\n var det = dot(p0, vCross);\n var t = dot(point, vCross) / det;\n cross(vCross, p2, p0);\n var u = dot(point, vCross) / det;\n cross(vCross, p0, p1);\n var v = dot(point, vCross) / det;\n\n Vector2.scale(uv, uv0, t);\n Vector2.scaleAndAdd(uv, uv, uv1, u);\n Vector2.scaleAndAdd(uv, uv, uv2, v);\n\n var x = uv.x * this._chart.getWidth();\n var y = uv.y * this._chart.getHeight();\n this._chart.getZr().handler.dispatch(eventName, {\n zrX: x,\n zrY: y\n });\n };\n })(),\n\n attachToMesh: function (mesh) {\n if (this._meshes.indexOf(mesh) >= 0) {\n return;\n }\n\n events.forEach(function (eventName) {\n mesh.on(eventName, this[makeHandlerName(eventName)], this);\n }, this);\n\n this._meshes.push(mesh);\n },\n\n detachFromMesh: function (mesh) {\n var idx = this._meshes.indexOf(mesh);\n if (idx >= 0) {\n this._meshes.splice(idx, 1);\n }\n\n events.forEach(function (eventName) {\n mesh.off(eventName, this[makeHandlerName(eventName)]);\n }, this);\n },\n\n dispose: function () {\n this._meshes.forEach(function (mesh) {\n this.detachFromMesh(mesh);\n }, this);\n }\n};\n\nexport default EChartsSurface;","import Camera from '../Camera';\n/**\n * @constructor clay.camera.Orthographic\n * @extends clay.Camera\n */\nvar Orthographic = Camera.extend(\n/** @lends clay.camera.Orthographic# */\n{\n /**\n * @type {number}\n */\n left: -1,\n /**\n * @type {number}\n */\n right: 1,\n /**\n * @type {number}\n */\n near: -1,\n /**\n * @type {number}\n */\n far: 1,\n /**\n * @type {number}\n */\n top: 1,\n /**\n * @type {number}\n */\n bottom: -1\n},\n/** @lends clay.camera.Orthographic.prototype */\n{\n\n updateProjectionMatrix: function() {\n this.projectionMatrix.ortho(this.left, this.right, this.bottom, this.top, this.near, this.far);\n },\n\n decomposeProjectionMatrix: function () {\n var m = this.projectionMatrix.array;\n this.left = (-1 - m[12]) / m[0];\n this.right = (1 - m[12]) / m[0];\n this.top = (1 - m[13]) / m[5];\n this.bottom = (-1 - m[13]) / m[5];\n this.near = -(-1 - m[14]) / m[10];\n this.far = -(1 - m[14]) / m[10];\n },\n /**\n * @return {clay.camera.Orthographic}\n */\n clone: function() {\n var camera = Camera.prototype.clone.call(this);\n camera.left = this.left;\n camera.right = this.right;\n camera.near = this.near;\n camera.far = this.far;\n camera.top = this.top;\n camera.bottom = this.bottom;\n\n return camera;\n }\n});\n\nexport default Orthographic;\n","export default \"\\n@export clay.compositor.vertex\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nattribute vec3 position : POSITION;\\nattribute vec2 texcoord : TEXCOORD_0;\\nvarying vec2 v_Texcoord;\\nvoid main()\\n{\\n v_Texcoord = texcoord;\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n}\\n@end\";\n","import Base from '../core/Base';\nimport OrthoCamera from '../camera/Orthographic';\nimport Plane from '../geometry/Plane';\nimport Shader from '../Shader';\nimport Material from '../Material';\nimport Mesh from '../Mesh';\nimport glenum from '../core/glenum';\nimport vertexGlsl from '../shader/source/compositor/vertex.glsl.js';\n\nShader['import'](vertexGlsl);\n\nvar planeGeo = new Plane();\nvar mesh = new Mesh({\n geometry: planeGeo,\n frustumCulling: false\n});\nvar camera = new OrthoCamera();\n\n/**\n * @constructor clay.compositor.Pass\n * @extends clay.core.Base\n */\nvar Pass = Base.extend(function () {\n return /** @lends clay.compositor.Pass# */ {\n /**\n * Fragment shader string\n * @type {string}\n */\n // PENDING shader or fragment ?\n fragment: '',\n\n /**\n * @type {Object}\n */\n outputs: null,\n\n /**\n * @type {clay.Material}\n */\n material: null,\n\n /**\n * @type {Boolean}\n */\n blendWithPrevious: false,\n\n /**\n * @type {Boolean}\n */\n clearColor: false,\n\n /**\n * @type {Boolean}\n */\n clearDepth: true\n };\n}, function() {\n\n var shader = new Shader(Shader.source('clay.compositor.vertex'), this.fragment);\n var material = new Material({\n shader: shader\n });\n material.enableTexturesAll();\n\n this.material = material;\n\n},\n/** @lends clay.compositor.Pass.prototype */\n{\n /**\n * @param {string} name\n * @param {} value\n */\n setUniform: function(name, value) {\n this.material.setUniform(name, value);\n },\n /**\n * @param {string} name\n * @return {}\n */\n getUniform: function(name) {\n var uniform = this.material.uniforms[name];\n if (uniform) {\n return uniform.value;\n }\n },\n /**\n * @param {clay.Texture} texture\n * @param {number} attachment\n */\n attachOutput: function(texture, attachment) {\n if (!this.outputs) {\n this.outputs = {};\n }\n attachment = attachment || glenum.COLOR_ATTACHMENT0;\n this.outputs[attachment] = texture;\n },\n /**\n * @param {clay.Texture} texture\n */\n detachOutput: function(texture) {\n for (var attachment in this.outputs) {\n if (this.outputs[attachment] === texture) {\n this.outputs[attachment] = null;\n }\n }\n },\n\n bind: function(renderer, frameBuffer) {\n\n if (this.outputs) {\n for (var attachment in this.outputs) {\n var texture = this.outputs[attachment];\n if (texture) {\n frameBuffer.attach(texture, attachment);\n }\n }\n }\n\n if (frameBuffer) {\n frameBuffer.bind(renderer);\n }\n },\n\n unbind: function(renderer, frameBuffer) {\n frameBuffer.unbind(renderer);\n },\n /**\n * @param {clay.Renderer} renderer\n * @param {clay.FrameBuffer} [frameBuffer]\n */\n render: function(renderer, frameBuffer) {\n\n var _gl = renderer.gl;\n\n if (frameBuffer) {\n this.bind(renderer, frameBuffer);\n // MRT Support in chrome\n // https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/ext-draw-buffers.html\n var ext = renderer.getGLExtension('EXT_draw_buffers');\n if (ext && this.outputs) {\n var bufs = [];\n for (var attachment in this.outputs) {\n attachment = +attachment;\n if (attachment >= _gl.COLOR_ATTACHMENT0 && attachment <= _gl.COLOR_ATTACHMENT0 + 8) {\n bufs.push(attachment);\n }\n }\n ext.drawBuffersEXT(bufs);\n }\n }\n\n this.trigger('beforerender', this, renderer);\n\n // FIXME Don't clear in each pass in default, let the color overwrite the buffer\n // FIXME pixels may be discard\n var clearBit = this.clearDepth ? _gl.DEPTH_BUFFER_BIT : 0;\n _gl.depthMask(true);\n if (this.clearColor) {\n clearBit = clearBit | _gl.COLOR_BUFFER_BIT;\n _gl.colorMask(true, true, true, true);\n var cc = this.clearColor;\n if (Array.isArray(cc)) {\n _gl.clearColor(cc[0], cc[1], cc[2], cc[3]);\n }\n }\n _gl.clear(clearBit);\n\n if (this.blendWithPrevious) {\n // Blend with previous rendered scene in the final output\n // FIXME Configure blend.\n // FIXME It will cause screen blink?\n _gl.enable(_gl.BLEND);\n this.material.transparent = true;\n }\n else {\n _gl.disable(_gl.BLEND);\n this.material.transparent = false;\n }\n\n this.renderQuad(renderer);\n\n this.trigger('afterrender', this, renderer);\n\n if (frameBuffer) {\n this.unbind(renderer, frameBuffer);\n }\n },\n\n /**\n * Simply do quad rendering\n */\n renderQuad: function (renderer) {\n mesh.material = this.material;\n renderer.renderPass([mesh], camera);\n },\n\n /**\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {}\n});\n\nexport default Pass;\n","export default \"#define SAMPLE_NUMBER 1024\\n#define PI 3.14159265358979\\nuniform sampler2D normalDistribution;\\nuniform vec2 viewportSize : [512, 256];\\nconst vec3 N = vec3(0.0, 0.0, 1.0);\\nconst float fSampleNumber = float(SAMPLE_NUMBER);\\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\\n vec3 tangentX = normalize(cross(N, upVector));\\n vec3 tangentZ = cross(N, tangentX);\\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\\n}\\nfloat G_Smith(float roughness, float NoV, float NoL) {\\n float k = roughness * roughness / 2.0;\\n float G1V = NoV / (NoV * (1.0 - k) + k);\\n float G1L = NoL / (NoL * (1.0 - k) + k);\\n return G1L * G1V;\\n}\\nvoid main() {\\n vec2 uv = gl_FragCoord.xy / viewportSize;\\n float NoV = uv.x;\\n float roughness = uv.y;\\n vec3 V;\\n V.x = sqrt(1.0 - NoV * NoV);\\n V.y = 0.0;\\n V.z = NoV;\\n float A = 0.0;\\n float B = 0.0;\\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\\n vec3 L = reflect(-V, H);\\n float NoL = clamp(L.z, 0.0, 1.0);\\n float NoH = clamp(H.z, 0.0, 1.0);\\n float VoH = clamp(dot(V, H), 0.0, 1.0);\\n if (NoL > 0.0) {\\n float G = G_Smith(roughness, NoV, NoL);\\n float G_Vis = G * VoH / (NoH * NoV);\\n float Fc = pow(1.0 - VoH, 5.0);\\n A += (1.0 - Fc) * G_Vis;\\n B += Fc * G_Vis;\\n }\\n }\\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\\n}\\n\";\n","export default \"#define SHADER_NAME prefilter\\n#define SAMPLE_NUMBER 1024\\n#define PI 3.14159265358979\\nuniform mat4 viewInverse : VIEWINVERSE;\\nuniform samplerCube environmentMap;\\nuniform sampler2D normalDistribution;\\nuniform float roughness : 0.5;\\nvarying vec2 v_Texcoord;\\nvarying vec3 v_WorldPosition;\\n@import clay.util.rgbm\\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\\n vec3 tangentX = normalize(cross(N, upVector));\\n vec3 tangentZ = cross(N, tangentX);\\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\\n}\\nvoid main() {\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(v_WorldPosition - eyePos);\\n vec3 N = V;\\n vec3 prefilteredColor = vec3(0.0);\\n float totalWeight = 0.0;\\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\\n vec3 L = reflect(-V, H);\\n float NoL = clamp(dot(N, L), 0.0, 1.0);\\n if (NoL > 0.0) {\\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\\n totalWeight += NoL;\\n }\\n }\\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\\n}\\n\";\n","// Cubemap prefilter utility\n// http://www.unrealengine.com/files/downloads/2013SiggraphPresentationsNotes.pdf\n// http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html\nimport Texture2D from '../Texture2D';\nimport TextureCube from '../TextureCube';\nimport Texture from '../Texture';\nimport FrameBuffer from '../FrameBuffer';\nimport Pass from '../compositor/Pass';\nimport Material from '../Material';\nimport Shader from '../Shader';\nimport Skybox from '../plugin/Skybox';\nimport Scene from '../Scene';\nimport EnvironmentMapPass from '../prePass/EnvironmentMap';\nimport vendor from '../core/vendor';\nimport textureUtil from './texture';\n\nimport integrateBRDFShaderCode from './shader/integrateBRDF.glsl.js';\nimport prefilterFragCode from './shader/prefilter.glsl.js';\n\nvar cubemapUtil = {};\n\nvar targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\n// TODO Downsample\n/**\n * @name clay.util.cubemap.prefilterEnvironmentMap\n * @param {clay.Renderer} renderer\n * @param {clay.Texture} envMap\n * @param {Object} [textureOpts]\n * @param {number} [textureOpts.width=64]\n * @param {number} [textureOpts.height=64]\n * @param {number} [textureOpts.type]\n * @param {boolean} [textureOpts.encodeRGBM=false]\n * @param {boolean} [textureOpts.decodeRGBM=false]\n * @param {clay.Texture2D} [normalDistribution]\n * @param {clay.Texture2D} [brdfLookup]\n */\ncubemapUtil.prefilterEnvironmentMap = function (\n renderer, envMap, textureOpts, normalDistribution, brdfLookup\n) {\n // Not create other renderer, it is easy having issue of cross reference of resources like framebuffer\n // PENDING preserveDrawingBuffer?\n if (!brdfLookup || !normalDistribution) {\n normalDistribution = cubemapUtil.generateNormalDistribution();\n brdfLookup = cubemapUtil.integrateBRDF(renderer, normalDistribution);\n }\n textureOpts = textureOpts || {};\n\n var width = textureOpts.width || 64;\n var height = textureOpts.height || 64;\n\n var textureType = textureOpts.type || envMap.type;\n\n // Use same type with given envMap\n var prefilteredCubeMap = new TextureCube({\n width: width,\n height: height,\n type: textureType,\n flipY: false,\n mipmaps: []\n });\n\n if (!prefilteredCubeMap.isPowerOfTwo()) {\n console.warn('Width and height must be power of two to enable mipmap.');\n }\n\n var size = Math.min(width, height);\n var mipmapNum = Math.log(size) / Math.log(2) + 1;\n\n var prefilterMaterial = new Material({\n shader: new Shader({\n vertex: Shader.source('clay.skybox.vertex'),\n fragment: prefilterFragCode\n })\n });\n prefilterMaterial.set('normalDistribution', normalDistribution);\n\n textureOpts.encodeRGBM && prefilterMaterial.define('fragment', 'RGBM_ENCODE');\n textureOpts.decodeRGBM && prefilterMaterial.define('fragment', 'RGBM_DECODE');\n\n var dummyScene = new Scene();\n var skyEnv;\n\n if (envMap.textureType === 'texture2D') {\n // Convert panorama to cubemap\n var envCubemap = new TextureCube({\n width: width,\n height: height,\n // FIXME FLOAT type will cause GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error on iOS\n type: textureType === Texture.FLOAT ?\n Texture.HALF_FLOAT : textureType\n });\n textureUtil.panoramaToCubeMap(renderer, envMap, envCubemap, {\n // PENDING encodeRGBM so it can be decoded as RGBM\n encodeRGBM: textureOpts.decodeRGBM\n });\n envMap = envCubemap;\n }\n skyEnv = new Skybox({\n scene: dummyScene,\n material: prefilterMaterial\n });\n skyEnv.material.set('environmentMap', envMap);\n\n var envMapPass = new EnvironmentMapPass({\n texture: prefilteredCubeMap\n });\n\n // Force to be UNSIGNED_BYTE\n if (textureOpts.encodeRGBM) {\n textureType = prefilteredCubeMap.type = Texture.UNSIGNED_BYTE;\n }\n\n var renderTargetTmp = new Texture2D({\n width: width,\n height: height,\n type: textureType\n });\n var frameBuffer = new FrameBuffer({\n depthBuffer: false\n });\n var ArrayCtor = vendor[textureType === Texture.UNSIGNED_BYTE ? 'Uint8Array' : 'Float32Array'];\n for (var i = 0; i < mipmapNum; i++) {\n // console.time('prefilter');\n prefilteredCubeMap.mipmaps[i] = {\n pixels: {}\n };\n skyEnv.material.set('roughness', i / (mipmapNum - 1));\n\n // Tweak fov\n // http://the-witness.net/news/2012/02/seamless-cube-map-filtering/\n var n = renderTargetTmp.width;\n var fov = 2 * Math.atan(n / (n - 0.5)) / Math.PI * 180;\n\n for (var j = 0; j < targets.length; j++) {\n var pixels = new ArrayCtor(renderTargetTmp.width * renderTargetTmp.height * 4);\n frameBuffer.attach(renderTargetTmp);\n frameBuffer.bind(renderer);\n\n var camera = envMapPass.getCamera(targets[j]);\n camera.fov = fov;\n renderer.render(dummyScene, camera);\n renderer.gl.readPixels(\n 0, 0, renderTargetTmp.width, renderTargetTmp.height,\n Texture.RGBA, textureType, pixels\n );\n\n // var canvas = document.createElement('canvas');\n // var ctx = canvas.getContext('2d');\n // canvas.width = renderTargetTmp.width;\n // canvas.height = renderTargetTmp.height;\n // var imageData = ctx.createImageData(renderTargetTmp.width, renderTargetTmp.height);\n // for (var k = 0; k < pixels.length; k++) {\n // imageData.data[k] = pixels[k];\n // }\n // ctx.putImageData(imageData, 0, 0);\n // document.body.appendChild(canvas);\n\n frameBuffer.unbind(renderer);\n prefilteredCubeMap.mipmaps[i].pixels[targets[j]] = pixels;\n }\n\n renderTargetTmp.width /= 2;\n renderTargetTmp.height /= 2;\n renderTargetTmp.dirty();\n // console.timeEnd('prefilter');\n }\n\n frameBuffer.dispose(renderer);\n renderTargetTmp.dispose(renderer);\n skyEnv.dispose(renderer);\n // Remove gpu resource allucated in renderer\n normalDistribution.dispose(renderer);\n\n // renderer.dispose();\n\n return {\n environmentMap: prefilteredCubeMap,\n brdfLookup: brdfLookup,\n normalDistribution: normalDistribution,\n maxMipmapLevel: mipmapNum\n };\n};\n\ncubemapUtil.integrateBRDF = function (renderer, normalDistribution) {\n normalDistribution = normalDistribution || cubemapUtil.generateNormalDistribution();\n var framebuffer = new FrameBuffer({\n depthBuffer: false\n });\n var pass = new Pass({\n fragment: integrateBRDFShaderCode\n });\n\n var texture = new Texture2D({\n width: 512,\n height: 256,\n type: Texture.HALF_FLOAT,\n wrapS: Texture.CLAMP_TO_EDGE,\n wrapT: Texture.CLAMP_TO_EDGE,\n minFilter: Texture.NEAREST,\n magFilter: Texture.NEAREST,\n useMipmap: false\n });\n pass.setUniform('normalDistribution', normalDistribution);\n pass.setUniform('viewportSize', [512, 256]);\n pass.attachOutput(texture);\n pass.render(renderer, framebuffer);\n\n // FIXME Only chrome and firefox can readPixels with float type.\n // framebuffer.bind(renderer);\n // var pixels = new Float32Array(512 * 256 * 4);\n // renderer.gl.readPixels(\n // 0, 0, texture.width, texture.height,\n // Texture.RGBA, Texture.FLOAT, pixels\n // );\n // texture.pixels = pixels;\n // texture.flipY = false;\n // texture.dirty();\n // framebuffer.unbind(renderer);\n\n framebuffer.dispose(renderer);\n\n return texture;\n};\n\ncubemapUtil.generateNormalDistribution = function (roughnessLevels, sampleSize) {\n\n // http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html\n // GLSL not support bit operation, use lookup instead\n // V -> i / N, U -> roughness\n var roughnessLevels = roughnessLevels || 256;\n var sampleSize = sampleSize || 1024;\n\n var normalDistribution = new Texture2D({\n width: roughnessLevels,\n height: sampleSize,\n type: Texture.FLOAT,\n minFilter: Texture.NEAREST,\n magFilter: Texture.NEAREST,\n wrapS: Texture.CLAMP_TO_EDGE,\n wrapT: Texture.CLAMP_TO_EDGE,\n useMipmap: false\n });\n var pixels = new Float32Array(sampleSize * roughnessLevels * 4);\n var tmp = [];\n\n // function sortFunc(a, b) {\n // return Math.abs(b) - Math.abs(a);\n // }\n for (var j = 0; j < roughnessLevels; j++) {\n var roughness = j / roughnessLevels;\n var a = roughness * roughness;\n\n for (var i = 0; i < sampleSize; i++) {\n // http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators\n // http://stackoverflow.com/questions/1908492/unsigned-integer-in-javascript\n // http://stackoverflow.com/questions/1822350/what-is-the-javascript-operator-and-how-do-you-use-it\n var y = (i << 16 | i >>> 16) >>> 0;\n y = ((y & 1431655765) << 1 | (y & 2863311530) >>> 1) >>> 0;\n y = ((y & 858993459) << 2 | (y & 3435973836) >>> 2) >>> 0;\n y = ((y & 252645135) << 4 | (y & 4042322160) >>> 4) >>> 0;\n y = (((y & 16711935) << 8 | (y & 4278255360) >>> 8) >>> 0) / 4294967296;\n\n // CDF\n var cosTheta = Math.sqrt((1 - y) / (1 + (a * a - 1.0) * y));\n tmp[i] = cosTheta;\n }\n\n for (var i = 0; i < sampleSize; i++) {\n var offset = (i * roughnessLevels + j) * 4;\n var cosTheta = tmp[i];\n var sinTheta = Math.sqrt(1.0 - cosTheta * cosTheta);\n var x = i / sampleSize;\n var phi = 2.0 * Math.PI * x;\n pixels[offset] = sinTheta * Math.cos(phi);\n pixels[offset + 1] = cosTheta;\n pixels[offset + 2] = sinTheta * Math.sin(phi);\n pixels[offset + 3] = 1.0;\n }\n }\n normalDistribution.pixels = pixels;\n\n return normalDistribution;\n};\n\nexport default cubemapUtil;\n","// https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/AmbientCubemap/\nimport Light from '../Light';\nimport cubemapUtil from '../util/cubemap';\n\n/**\n * Ambient cubemap light provides specular parts of Image Based Lighting.\n * Which is a basic requirement for Physically Based Rendering\n * @constructor clay.light.AmbientCubemap\n * @extends clay.Light\n */\nvar AmbientCubemapLight = Light.extend({\n\n /**\n * @type {clay.TextureCube}\n * @memberOf clay.light.AmbientCubemap#\n */\n cubemap: null,\n\n // TODO\n // range: 100,\n\n castShadow: false,\n\n _normalDistribution: null,\n _brdfLookup: null\n\n}, /** @lends clay.light.AmbientCubemap# */ {\n\n type: 'AMBIENT_CUBEMAP_LIGHT',\n\n /**\n * Do prefitering the cubemap\n * @param {clay.Renderer} renderer\n * @param {number} [size=32]\n */\n prefilter: function (renderer, size) {\n if (!renderer.getGLExtension('EXT_shader_texture_lod')) {\n console.warn('Device not support textureCubeLodEXT');\n return;\n }\n if (!this._brdfLookup) {\n this._normalDistribution = cubemapUtil.generateNormalDistribution();\n this._brdfLookup = cubemapUtil.integrateBRDF(renderer, this._normalDistribution);\n }\n var cubemap = this.cubemap;\n if (cubemap.__prefiltered) {\n return;\n }\n\n var result = cubemapUtil.prefilterEnvironmentMap(\n renderer, cubemap, {\n encodeRGBM: true,\n width: size,\n height: size\n }, this._normalDistribution, this._brdfLookup\n );\n this.cubemap = result.environmentMap;\n this.cubemap.__prefiltered = true;\n\n cubemap.dispose(renderer);\n },\n\n getBRDFLookup: function () {\n return this._brdfLookup;\n },\n\n uniformTemplates: {\n ambientCubemapLightColor: {\n type: '3f',\n value: function (instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0]*intensity, color[1]*intensity, color[2]*intensity];\n }\n },\n\n ambientCubemapLightCubemap: {\n type: 't',\n value: function (instance) {\n return instance.cubemap;\n }\n },\n\n ambientCubemapLightBRDFLookup: {\n type: 't',\n value: function (instance) {\n return instance._brdfLookup;\n }\n }\n }\n /**\n * @function\n * @name clone\n * @return {clay.light.AmbientCubemap}\n * @memberOf clay.light.AmbientCubemap.prototype\n */\n});\n\nexport default AmbientCubemapLight;\n","import Light from '../Light';\nimport vendor from '../core/vendor';\n\n/**\n * Spherical Harmonic Ambient Light\n * @constructor clay.light.AmbientSH\n * @extends clay.Light\n */\nvar AmbientSHLight = Light.extend({\n\n castShadow: false,\n\n /**\n * Spherical Harmonic Coefficients\n * @type {Array.}\n * @memberOf clay.light.AmbientSH#\n */\n coefficients: [],\n\n}, function () {\n this._coefficientsTmpArr = new vendor.Float32Array(9 * 3);\n}, {\n\n type: 'AMBIENT_SH_LIGHT',\n\n uniformTemplates: {\n ambientSHLightColor: {\n type: '3f',\n value: function (instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0] * intensity, color[1] * intensity, color[2] * intensity];\n }\n },\n\n ambientSHLightCoefficients: {\n type: '3f',\n value: function (instance) {\n var coefficientsTmpArr = instance._coefficientsTmpArr;\n for (var i = 0; i < instance.coefficients.length; i++) {\n coefficientsTmpArr[i] = instance.coefficients[i];\n }\n return coefficientsTmpArr;\n }\n }\n }\n /**\n * @function\n * @name clone\n * @return {clay.light.Ambient}\n * @memberOf clay.light.Ambient.prototype\n */\n});\n\nexport default AmbientSHLight;\n","export default \"uniform samplerCube environmentMap;\\nvarying vec2 v_Texcoord;\\n#define TEXTURE_SIZE 16\\nmat3 front = mat3(\\n 1.0, 0.0, 0.0,\\n 0.0, 1.0, 0.0,\\n 0.0, 0.0, 1.0\\n);\\nmat3 back = mat3(\\n -1.0, 0.0, 0.0,\\n 0.0, 1.0, 0.0,\\n 0.0, 0.0, -1.0\\n);\\nmat3 left = mat3(\\n 0.0, 0.0, -1.0,\\n 0.0, 1.0, 0.0,\\n 1.0, 0.0, 0.0\\n);\\nmat3 right = mat3(\\n 0.0, 0.0, 1.0,\\n 0.0, 1.0, 0.0,\\n -1.0, 0.0, 0.0\\n);\\nmat3 up = mat3(\\n 1.0, 0.0, 0.0,\\n 0.0, 0.0, 1.0,\\n 0.0, -1.0, 0.0\\n);\\nmat3 down = mat3(\\n 1.0, 0.0, 0.0,\\n 0.0, 0.0, -1.0,\\n 0.0, 1.0, 0.0\\n);\\nfloat harmonics(vec3 normal){\\n int index = int(gl_FragCoord.x);\\n float x = normal.x;\\n float y = normal.y;\\n float z = normal.z;\\n if(index==0){\\n return 1.0;\\n }\\n else if(index==1){\\n return x;\\n }\\n else if(index==2){\\n return y;\\n }\\n else if(index==3){\\n return z;\\n }\\n else if(index==4){\\n return x*z;\\n }\\n else if(index==5){\\n return y*z;\\n }\\n else if(index==6){\\n return x*y;\\n }\\n else if(index==7){\\n return 3.0*z*z - 1.0;\\n }\\n else{\\n return x*x - y*y;\\n }\\n}\\nvec3 sampleSide(mat3 rot)\\n{\\n vec3 result = vec3(0.0);\\n float divider = 0.0;\\n for (int i = 0; i < TEXTURE_SIZE * TEXTURE_SIZE; i++) {\\n float x = mod(float(i), float(TEXTURE_SIZE));\\n float y = float(i / TEXTURE_SIZE);\\n vec2 sidecoord = ((vec2(x, y) + vec2(0.5, 0.5)) / vec2(TEXTURE_SIZE)) * 2.0 - 1.0;\\n vec3 normal = normalize(vec3(sidecoord, -1.0));\\n vec3 fetchNormal = rot * normal;\\n vec3 texel = textureCube(environmentMap, fetchNormal).rgb;\\n result += harmonics(fetchNormal) * texel * -normal.z;\\n divider += -normal.z;\\n }\\n return result / divider;\\n}\\nvoid main()\\n{\\n vec3 result = (\\n sampleSide(front) +\\n sampleSide(back) +\\n sampleSide(left) +\\n sampleSide(right) +\\n sampleSide(up) +\\n sampleSide(down)\\n ) / 6.0;\\n gl_FragColor = vec4(result, 1.0);\\n}\";\n","// Spherical Harmonic Helpers\nimport Texture from '../Texture';\nimport FrameBuffer from '../FrameBuffer';\nimport Texture2D from '../Texture2D';\nimport Pass from '../compositor/Pass';\nimport vendor from '../core/vendor';\nimport Skybox from '../plugin/Skybox';\nimport Skydome from '../plugin/Skydome';\nimport EnvironmentMapPass from '../prePass/EnvironmentMap';\nimport Scene from '../Scene';\nimport vec3 from '../glmatrix/vec3';\nvar sh = {};\n\nimport projectEnvMapShaderCode from './shader/projectEnvMap.glsl.js';\n\nvar targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\n// Project on gpu, but needs browser to support readPixels as Float32Array.\nfunction projectEnvironmentMapGPU(renderer, envMap) {\n var shTexture = new Texture2D({\n width: 9,\n height: 1,\n type: Texture.FLOAT\n });\n var pass = new Pass({\n fragment: projectEnvMapShaderCode\n });\n pass.material.define('fragment', 'TEXTURE_SIZE', envMap.width);\n pass.setUniform('environmentMap', envMap);\n\n var framebuffer = new FrameBuffer();\n framebuffer.attach(shTexture);\n pass.render(renderer, framebuffer);\n\n framebuffer.bind(renderer);\n // TODO Only chrome and firefox support Float32Array\n var pixels = new vendor.Float32Array(9 * 4);\n renderer.gl.readPixels(0, 0, 9, 1, Texture.RGBA, Texture.FLOAT, pixels);\n\n var coeff = new vendor.Float32Array(9 * 3);\n for (var i = 0; i < 9; i++) {\n coeff[i * 3] = pixels[i * 4];\n coeff[i * 3 + 1] = pixels[i * 4 + 1];\n coeff[i * 3 + 2] = pixels[i * 4 + 2];\n }\n framebuffer.unbind(renderer);\n\n framebuffer.dispose(renderer);\n pass.dispose(renderer);\n return coeff;\n}\n\nfunction harmonics(normal, index){\n var x = normal[0];\n var y = normal[1];\n var z = normal[2];\n\n if (index === 0) {\n return 1.0;\n }\n else if (index === 1) {\n return x;\n }\n else if (index === 2) {\n return y;\n }\n else if (index === 3) {\n return z;\n }\n else if (index === 4) {\n return x * z;\n }\n else if (index === 5) {\n return y * z;\n }\n else if (index === 6) {\n return x * y;\n }\n else if (index === 7) {\n return 3.0 * z * z - 1.0;\n }\n else {\n return x * x - y * y;\n }\n}\n\nvar normalTransform = {\n px: [2, 1, 0, -1, -1, 1],\n nx: [2, 1, 0, 1, -1, -1],\n py: [0, 2, 1, 1, -1, -1],\n ny: [0, 2, 1, 1, 1, 1],\n pz: [0, 1, 2, -1, -1, -1],\n nz: [0, 1, 2, 1, -1, 1]\n};\n\n// Project on cpu.\nfunction projectEnvironmentMapCPU(renderer, cubePixels, width, height) {\n var coeff = new vendor.Float32Array(9 * 3);\n var normal = vec3.create();\n var texel = vec3.create();\n var fetchNormal = vec3.create();\n for (var m = 0; m < 9; m++) {\n var result = vec3.create();\n for (var k = 0; k < targets.length; k++) {\n var pixels = cubePixels[targets[k]];\n\n var sideResult = vec3.create();\n var divider = 0;\n var i = 0;\n var transform = normalTransform[targets[k]];\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width; x++) {\n\n normal[0] = x / (width - 1.0) * 2.0 - 1.0;\n // TODO Flip y?\n normal[1] = y / (height - 1.0) * 2.0 - 1.0;\n normal[2] = -1.0;\n vec3.normalize(normal, normal);\n\n fetchNormal[0] = normal[transform[0]] * transform[3];\n fetchNormal[1] = normal[transform[1]] * transform[4];\n fetchNormal[2] = normal[transform[2]] * transform[5];\n\n texel[0] = pixels[i++] / 255;\n texel[1] = pixels[i++] / 255;\n texel[2] = pixels[i++] / 255;\n // RGBM Decode\n var scale = pixels[i++] / 255 * 8.12;\n texel[0] *= scale;\n texel[1] *= scale;\n texel[2] *= scale;\n\n vec3.scaleAndAdd(sideResult, sideResult, texel, harmonics(fetchNormal, m) * -normal[2]);\n // -normal.z equals cos(theta) of Lambertian\n divider += -normal[2];\n }\n }\n vec3.scaleAndAdd(result, result, sideResult, 1 / divider);\n }\n\n coeff[m * 3] = result[0] / 6.0;\n coeff[m * 3 + 1] = result[1] / 6.0;\n coeff[m * 3 + 2] = result[2] / 6.0;\n }\n return coeff;\n}\n\n/**\n * @param {clay.Renderer} renderer\n * @param {clay.Texture} envMap\n * @param {Object} [textureOpts]\n * @param {Object} [textureOpts.lod]\n * @param {boolean} [textureOpts.decodeRGBM]\n */\nsh.projectEnvironmentMap = function (renderer, envMap, opts) {\n\n // TODO sRGB\n\n opts = opts || {};\n opts.lod = opts.lod || 0;\n\n var skybox;\n var dummyScene = new Scene();\n var size = 64;\n if (envMap.textureType === 'texture2D') {\n skybox = new Skydome({\n scene: dummyScene,\n environmentMap: envMap\n });\n }\n else {\n size = (envMap.image && envMap.image.px) ? envMap.image.px.width : envMap.width;\n skybox = new Skybox({\n scene: dummyScene,\n environmentMap: envMap\n });\n }\n // Convert to rgbm\n var width = Math.ceil(size / Math.pow(2, opts.lod));\n var height = Math.ceil(size / Math.pow(2, opts.lod));\n var rgbmTexture = new Texture2D({\n width: width,\n height: height\n });\n var framebuffer = new FrameBuffer();\n skybox.material.define('fragment', 'RGBM_ENCODE');\n if (opts.decodeRGBM) {\n skybox.material.define('fragment', 'RGBM_DECODE');\n }\n skybox.material.set('lod', opts.lod);\n var envMapPass = new EnvironmentMapPass({\n texture: rgbmTexture\n });\n var cubePixels = {};\n for (var i = 0; i < targets.length; i++) {\n cubePixels[targets[i]] = new Uint8Array(width * height * 4);\n var camera = envMapPass.getCamera(targets[i]);\n camera.fov = 90;\n framebuffer.attach(rgbmTexture);\n framebuffer.bind(renderer);\n renderer.render(dummyScene, camera);\n renderer.gl.readPixels(\n 0, 0, width, height,\n Texture.RGBA, Texture.UNSIGNED_BYTE, cubePixels[targets[i]]\n );\n framebuffer.unbind(renderer);\n }\n\n skybox.dispose(renderer);\n framebuffer.dispose(renderer);\n rgbmTexture.dispose(renderer);\n\n return projectEnvironmentMapCPU(renderer, cubePixels, width, height);\n};\n\nexport default sh;\n","import * as echarts from 'echarts/lib/echarts';\n\nvar retrieve = {\n\n firstNotNull: function () {\n for (var i = 0, len = arguments.length; i < len; i++) {\n if (arguments[i] != null) {\n return arguments[i];\n }\n }\n },\n\n /**\n * @param {module:echarts/data/List} data\n * @param {Object} payload Contains dataIndex (means rawIndex) / dataIndexInside / name\n * each of which can be Array or primary type.\n * @return {number|Array.} dataIndex If not found, return undefined/null.\n */\n queryDataIndex: function (data, payload) {\n if (payload.dataIndexInside != null) {\n return payload.dataIndexInside;\n }\n else if (payload.dataIndex != null) {\n return echarts.util.isArray(payload.dataIndex)\n ? echarts.util.map(payload.dataIndex, function (value) {\n return data.indexOfRawIndex(value);\n })\n : data.indexOfRawIndex(payload.dataIndex);\n }\n else if (payload.name != null) {\n return echarts.util.isArray(payload.name)\n ? echarts.util.map(payload.name, function (value) {\n return data.indexOfName(value);\n })\n : data.indexOfName(payload.name);\n }\n }\n};\n\nexport default retrieve;","import Geometry from '../Geometry';\nimport BoundingBox from '../math/BoundingBox';\n\n/**\n * @constructor clay.geometry.Sphere\n * @extends clay.Geometry\n * @param {Object} [opt]\n * @param {number} [widthSegments]\n * @param {number} [heightSegments]\n * @param {number} [phiStart]\n * @param {number} [phiLength]\n * @param {number} [thetaStart]\n * @param {number} [thetaLength]\n * @param {number} [radius]\n */\nvar Sphere = Geometry.extend(/** @lends clay.geometry.Sphere# */ {\n dynamic: false,\n /**\n * @type {number}\n */\n widthSegments: 40,\n /**\n * @type {number}\n */\n heightSegments: 20,\n\n /**\n * @type {number}\n */\n phiStart: 0,\n /**\n * @type {number}\n */\n phiLength: Math.PI * 2,\n\n /**\n * @type {number}\n */\n thetaStart: 0,\n /**\n * @type {number}\n */\n thetaLength: Math.PI,\n\n /**\n * @type {number}\n */\n radius: 1\n\n}, function() {\n this.build();\n},\n/** @lends clay.geometry.Sphere.prototype */\n{\n /**\n * Build sphere geometry\n */\n build: function() {\n var heightSegments = this.heightSegments;\n var widthSegments = this.widthSegments;\n\n var positionAttr = this.attributes.position;\n var texcoordAttr = this.attributes.texcoord0;\n var normalAttr = this.attributes.normal;\n\n var vertexCount = (widthSegments + 1) * (heightSegments + 1);\n positionAttr.init(vertexCount);\n texcoordAttr.init(vertexCount);\n normalAttr.init(vertexCount);\n\n var IndicesCtor = vertexCount > 0xffff ? Uint32Array : Uint16Array;\n var indices = this.indices = new IndicesCtor(widthSegments * heightSegments * 6);\n\n var x, y, z,\n u, v,\n i, j;\n\n var radius = this.radius;\n var phiStart = this.phiStart;\n var phiLength = this.phiLength;\n var thetaStart = this.thetaStart;\n var thetaLength = this.thetaLength;\n var radius = this.radius;\n\n var pos = [];\n var uv = [];\n var offset = 0;\n var divider = 1 / radius;\n for (j = 0; j <= heightSegments; j ++) {\n for (i = 0; i <= widthSegments; i ++) {\n u = i / widthSegments;\n v = j / heightSegments;\n\n // X axis is inverted so texture can be mapped from left to right\n x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n y = radius * Math.cos(thetaStart + v * thetaLength);\n z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength);\n\n pos[0] = x; pos[1] = y; pos[2] = z;\n uv[0] = u; uv[1] = v;\n positionAttr.set(offset, pos);\n texcoordAttr.set(offset, uv);\n pos[0] *= divider;\n pos[1] *= divider;\n pos[2] *= divider;\n normalAttr.set(offset, pos);\n offset++;\n }\n }\n\n var i1, i2, i3, i4;\n\n var len = widthSegments + 1;\n\n var n = 0;\n for (j = 0; j < heightSegments; j ++) {\n for (i = 0; i < widthSegments; i ++) {\n i2 = j * len + i;\n i1 = (j * len + i + 1);\n i4 = (j + 1) * len + i + 1;\n i3 = (j + 1) * len + i;\n\n indices[n++] = i1;\n indices[n++] = i2;\n indices[n++] = i4;\n\n indices[n++] = i2;\n indices[n++] = i3;\n indices[n++] = i4;\n }\n }\n\n this.boundingBox = new BoundingBox();\n this.boundingBox.max.set(radius, radius, radius);\n this.boundingBox.min.set(-radius, -radius, -radius);\n }\n});\n\nexport default Sphere;\n","import Light from '../Light';\n\n/**\n * @constructor clay.light.Ambient\n * @extends clay.Light\n */\nvar AmbientLight = Light.extend({\n\n castShadow: false\n\n}, {\n\n type: 'AMBIENT_LIGHT',\n\n uniformTemplates: {\n ambientLightColor: {\n type: '3f',\n value: function(instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0]*intensity, color[1]*intensity, color[2]*intensity];\n }\n }\n }\n /**\n * @function\n * @name clone\n * @return {clay.light.Ambient}\n * @memberOf clay.light.Ambient.prototype\n */\n});\n\nexport default AmbientLight;\n","import Light from '../Light';\nimport Vector3 from '../math/Vector3';\n\n/**\n * @constructor clay.light.Directional\n * @extends clay.Light\n *\n * @example\n * var light = new clay.light.Directional({\n * intensity: 0.5,\n * color: [1.0, 0.0, 0.0]\n * });\n * light.position.set(10, 10, 10);\n * light.lookAt(clay.Vector3.ZERO);\n * scene.add(light);\n */\nvar DirectionalLight = Light.extend(/** @lends clay.light.Directional# */ {\n /**\n * @type {number}\n */\n shadowBias: 0.001,\n /**\n * @type {number}\n */\n shadowSlopeScale: 2.0,\n /**\n * Shadow cascade.\n * Use PSSM technique when it is larger than 1 and have a unique directional light in scene.\n * @type {number}\n */\n shadowCascade: 1,\n\n /**\n * Available when shadowCascade is larger than 1 and have a unique directional light in scene.\n * @type {number}\n */\n cascadeSplitLogFactor: 0.2\n}, {\n\n type: 'DIRECTIONAL_LIGHT',\n\n uniformTemplates: {\n directionalLightDirection: {\n type: '3f',\n value: function (instance) {\n instance.__dir = instance.__dir || new Vector3();\n // Direction is target to eye\n return instance.__dir.copy(instance.worldTransform.z).normalize().negate().array;\n }\n },\n directionalLightColor: {\n type: '3f',\n value: function (instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0] * intensity, color[1] * intensity, color[2] * intensity];\n }\n }\n },\n /**\n * @return {clay.light.Directional}\n * @memberOf clay.light.Directional.prototype\n */\n clone: function () {\n var light = Light.prototype.clone.call(this);\n light.shadowBias = this.shadowBias;\n light.shadowSlopeScale = this.shadowSlopeScale;\n return light;\n }\n});\n\nexport default DirectionalLight;\n","import Light from '../Light';\n\n/**\n * @constructor clay.light.Point\n * @extends clay.Light\n */\nvar PointLight = Light.extend(/** @lends clay.light.Point# */ {\n /**\n * @type {number}\n */\n range: 100,\n\n /**\n * @type {number}\n */\n castShadow: false\n}, {\n\n type: 'POINT_LIGHT',\n\n uniformTemplates: {\n pointLightPosition: {\n type: '3f',\n value: function(instance) {\n return instance.getWorldPosition().array;\n }\n },\n pointLightRange: {\n type: '1f',\n value: function(instance) {\n return instance.range;\n }\n },\n pointLightColor: {\n type: '3f',\n value: function(instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0] * intensity, color[1] * intensity, color[2] * intensity];\n }\n }\n },\n /**\n * @return {clay.light.Point}\n * @memberOf clay.light.Point.prototype\n */\n clone: function() {\n var light = Light.prototype.clone.call(this);\n light.range = this.range;\n return light;\n }\n});\n\nexport default PointLight;\n","import Light from '../Light';\nimport Vector3 from '../math/Vector3';\n\n/**\n * @constructor clay.light.Spot\n * @extends clay.Light\n */\nvar SpotLight = Light.extend(/**@lends clay.light.Spot */ {\n /**\n * @type {number}\n */\n range: 20,\n /**\n * @type {number}\n */\n umbraAngle: 30,\n /**\n * @type {number}\n */\n penumbraAngle: 45,\n /**\n * @type {number}\n */\n falloffFactor: 2.0,\n /**\n * @type {number}\n */\n shadowBias: 0.001,\n /**\n * @type {number}\n */\n shadowSlopeScale: 2.0\n}, {\n\n type: 'SPOT_LIGHT',\n\n uniformTemplates: {\n spotLightPosition: {\n type: '3f',\n value: function (instance) {\n return instance.getWorldPosition().array;\n }\n },\n spotLightRange: {\n type: '1f',\n value: function (instance) {\n return instance.range;\n }\n },\n spotLightUmbraAngleCosine: {\n type: '1f',\n value: function (instance) {\n return Math.cos(instance.umbraAngle * Math.PI / 180);\n }\n },\n spotLightPenumbraAngleCosine: {\n type: '1f',\n value: function (instance) {\n return Math.cos(instance.penumbraAngle * Math.PI / 180);\n }\n },\n spotLightFalloffFactor: {\n type: '1f',\n value: function (instance) {\n return instance.falloffFactor;\n }\n },\n spotLightDirection: {\n type: '3f',\n value: function (instance) {\n instance.__dir = instance.__dir || new Vector3();\n // Direction is target to eye\n return instance.__dir.copy(instance.worldTransform.z).negate().array;\n }\n },\n spotLightColor: {\n type: '3f',\n value: function (instance) {\n var color = instance.color;\n var intensity = instance.intensity;\n return [color[0] * intensity, color[1] * intensity, color[2] * intensity];\n }\n }\n },\n /**\n * @return {clay.light.Spot}\n * @memberOf clay.light.Spot.prototype\n */\n clone: function () {\n var light = Light.prototype.clone.call(this);\n light.range = this.range;\n light.umbraAngle = this.umbraAngle;\n light.penumbraAngle = this.penumbraAngle;\n light.falloffFactor = this.falloffFactor;\n light.shadowBias = this.shadowBias;\n light.shadowSlopeScale = this.shadowSlopeScale;\n return light;\n }\n});\n\nexport default SpotLight;\n","import vec4 from '../glmatrix/vec4';\n\n/**\n * @constructor\n * @alias clay.Vector4\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n */\nvar Vector4 = function(x, y, z, w) {\n\n x = x || 0;\n y = y || 0;\n z = z || 0;\n w = w || 0;\n\n /**\n * Storage of Vector4, read and write of x, y, z, w will change the values in array\n * All methods also operate on the array instead of x, y, z, w components\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Vector4#\n */\n this.array = vec4.fromValues(x, y, z, w);\n\n /**\n * Dirty flag is used by the Node to determine\n * if the matrix is updated to latest\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Vector4#\n */\n this._dirty = true;\n};\n\nVector4.prototype = {\n\n constructor: Vector4,\n\n /**\n * Add b to self\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n add: function(b) {\n vec4.add(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y and z components\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @param {number} w\n * @return {clay.Vector4}\n */\n set: function(x, y, z, w) {\n this.array[0] = x;\n this.array[1] = y;\n this.array[2] = z;\n this.array[3] = w;\n this._dirty = true;\n return this;\n },\n\n /**\n * Set x, y, z and w components from array\n * @param {Float32Array|number[]} arr\n * @return {clay.Vector4}\n */\n setArray: function(arr) {\n this.array[0] = arr[0];\n this.array[1] = arr[1];\n this.array[2] = arr[2];\n this.array[3] = arr[3];\n\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Vector4\n * @return {clay.Vector4}\n */\n clone: function() {\n return new Vector4(this.x, this.y, this.z, this.w);\n },\n\n /**\n * Copy from b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n copy: function(b) {\n vec4.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for distance\n * @param {clay.Vector4} b\n * @return {number}\n */\n dist: function(b) {\n return vec4.dist(this.array, b.array);\n },\n\n /**\n * Distance between self and b\n * @param {clay.Vector4} b\n * @return {number}\n */\n distance: function(b) {\n return vec4.distance(this.array, b.array);\n },\n\n /**\n * Alias for divide\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n div: function(b) {\n vec4.div(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Divide self by b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n divide: function(b) {\n vec4.divide(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Dot product of self and b\n * @param {clay.Vector4} b\n * @return {number}\n */\n dot: function(b) {\n return vec4.dot(this.array, b.array);\n },\n\n /**\n * Alias of length\n * @return {number}\n */\n len: function() {\n return vec4.len(this.array);\n },\n\n /**\n * Calculate the length\n * @return {number}\n */\n length: function() {\n return vec4.length(this.array);\n },\n /**\n * Linear interpolation between a and b\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @param {number} t\n * @return {clay.Vector4}\n */\n lerp: function(a, b, t) {\n vec4.lerp(this.array, a.array, b.array, t);\n this._dirty = true;\n return this;\n },\n\n /**\n * Minimum of self and b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n min: function(b) {\n vec4.min(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Maximum of self and b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n max: function(b) {\n vec4.max(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiply\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n mul: function(b) {\n vec4.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Mutiply self and b\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n multiply: function(b) {\n vec4.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Negate self\n * @return {clay.Vector4}\n */\n negate: function() {\n vec4.negate(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Normalize self\n * @return {clay.Vector4}\n */\n normalize: function() {\n vec4.normalize(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Generate random x, y, z, w components with a given scale\n * @param {number} scale\n * @return {clay.Vector4}\n */\n random: function(scale) {\n vec4.random(this.array, scale);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self\n * @param {number} scale\n * @return {clay.Vector4}\n */\n scale: function(s) {\n vec4.scale(this.array, this.array, s);\n this._dirty = true;\n return this;\n },\n /**\n * Scale b and add to self\n * @param {clay.Vector4} b\n * @param {number} scale\n * @return {clay.Vector4}\n */\n scaleAndAdd: function(b, s) {\n vec4.scaleAndAdd(this.array, this.array, b.array, s);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for squaredDistance\n * @param {clay.Vector4} b\n * @return {number}\n */\n sqrDist: function(b) {\n return vec4.sqrDist(this.array, b.array);\n },\n\n /**\n * Squared distance between self and b\n * @param {clay.Vector4} b\n * @return {number}\n */\n squaredDistance: function(b) {\n return vec4.squaredDistance(this.array, b.array);\n },\n\n /**\n * Alias for squaredLength\n * @return {number}\n */\n sqrLen: function() {\n return vec4.sqrLen(this.array);\n },\n\n /**\n * Squared length of self\n * @return {number}\n */\n squaredLength: function() {\n return vec4.squaredLength(this.array);\n },\n\n /**\n * Alias for subtract\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n sub: function(b) {\n vec4.sub(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Subtract b from self\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\n subtract: function(b) {\n vec4.subtract(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Matrix4 m\n * @param {clay.Matrix4} m\n * @return {clay.Vector4}\n */\n transformMat4: function(m) {\n vec4.transformMat4(this.array, this.array, m.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transform self with a Quaternion q\n * @param {clay.Quaternion} q\n * @return {clay.Vector4}\n */\n transformQuat: function(q) {\n vec4.transformQuat(this.array, this.array, q.array);\n this._dirty = true;\n return this;\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\nvar defineProperty = Object.defineProperty;\n// Getter and Setter\nif (defineProperty) {\n\n var proto = Vector4.prototype;\n /**\n * @name x\n * @type {number}\n * @memberOf clay.Vector4\n * @instance\n */\n defineProperty(proto, 'x', {\n get: function () {\n return this.array[0];\n },\n set: function (value) {\n this.array[0] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name y\n * @type {number}\n * @memberOf clay.Vector4\n * @instance\n */\n defineProperty(proto, 'y', {\n get: function () {\n return this.array[1];\n },\n set: function (value) {\n this.array[1] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name z\n * @type {number}\n * @memberOf clay.Vector4\n * @instance\n */\n defineProperty(proto, 'z', {\n get: function () {\n return this.array[2];\n },\n set: function (value) {\n this.array[2] = value;\n this._dirty = true;\n }\n });\n\n /**\n * @name w\n * @type {number}\n * @memberOf clay.Vector4\n * @instance\n */\n defineProperty(proto, 'w', {\n get: function () {\n return this.array[3];\n },\n set: function (value) {\n this.array[3] = value;\n this._dirty = true;\n }\n });\n}\n\n// Supply methods that are not in place\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.add = function(out, a, b) {\n vec4.add(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {number} x\n * @param {number} y\n * @param {number} z\n * @return {clay.Vector4}\n */\nVector4.set = function(out, x, y, z, w) {\n vec4.set(out.array, x, y, z, w);\n out._dirty = true;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.copy = function(out, b) {\n vec4.copy(out.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.dist = function(a, b) {\n return vec4.distance(a.array, b.array);\n};\n\n/**\n * @function\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.distance = Vector4.dist;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.div = function(out, a, b) {\n vec4.divide(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.divide = Vector4.div;\n\n/**\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.dot = function(a, b) {\n return vec4.dot(a.array, b.array);\n};\n\n/**\n * @param {clay.Vector4} a\n * @return {number}\n */\nVector4.len = function(b) {\n return vec4.length(b.array);\n};\n\n// Vector4.length = Vector4.len;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @param {number} t\n * @return {clay.Vector4}\n */\nVector4.lerp = function(out, a, b, t) {\n vec4.lerp(out.array, a.array, b.array, t);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.min = function(out, a, b) {\n vec4.min(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.max = function(out, a, b) {\n vec4.max(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.mul = function(out, a, b) {\n vec4.multiply(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.multiply = Vector4.mul;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @return {clay.Vector4}\n */\nVector4.negate = function(out, a) {\n vec4.negate(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @return {clay.Vector4}\n */\nVector4.normalize = function(out, a) {\n vec4.normalize(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {number} scale\n * @return {clay.Vector4}\n */\nVector4.random = function(out, scale) {\n vec4.random(out.array, scale);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {number} scale\n * @return {clay.Vector4}\n */\nVector4.scale = function(out, a, scale) {\n vec4.scale(out.array, a.array, scale);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @param {number} scale\n * @return {clay.Vector4}\n */\nVector4.scaleAndAdd = function(out, a, b, scale) {\n vec4.scaleAndAdd(out.array, a.array, b.array, scale);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.sqrDist = function(a, b) {\n return vec4.sqrDist(a.array, b.array);\n};\n\n/**\n * @function\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {number}\n */\nVector4.squaredDistance = Vector4.sqrDist;\n\n/**\n * @param {clay.Vector4} a\n * @return {number}\n */\nVector4.sqrLen = function(a) {\n return vec4.sqrLen(a.array);\n};\n/**\n * @function\n * @param {clay.Vector4} a\n * @return {number}\n */\nVector4.squaredLength = Vector4.sqrLen;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.sub = function(out, a, b) {\n vec4.subtract(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n/**\n * @function\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Vector4} b\n * @return {clay.Vector4}\n */\nVector4.subtract = Vector4.sub;\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Matrix4} m\n * @return {clay.Vector4}\n */\nVector4.transformMat4 = function(out, a, m) {\n vec4.transformMat4(out.array, a.array, m.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Vector4} out\n * @param {clay.Vector4} a\n * @param {clay.Quaternion} q\n * @return {clay.Vector4}\n */\nVector4.transformQuat = function(out, a, q) {\n vec4.transformQuat(out.array, a.array, q.array);\n out._dirty = true;\n return out;\n};\n\nexport default Vector4;\n","\n\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 2x2 Matrix\n * @name mat2\n */\n\nvar mat2 = {};\n\n/**\n * Creates a new identity mat2\n *\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.create = function() {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Creates a new mat2 initialized with values from an existing matrix\n *\n * @param {mat2} a matrix to clone\n * @returns {mat2} a new 2x2 matrix\n */\nmat2.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(4);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Copy the values from one mat2 to another\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n};\n\n/**\n * Set a mat2 to the identity matrix\n *\n * @param {mat2} out the receiving matrix\n * @returns {mat2} out\n */\nmat2.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n return out;\n};\n\n/**\n * Transpose the values of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.transpose = function(out, a) {\n // If we are transposing ourselves we can skip a few steps but have to cache some values\n if (out === a) {\n var a1 = a[1];\n out[1] = a[2];\n out[2] = a1;\n } else {\n out[0] = a[0];\n out[1] = a[2];\n out[2] = a[1];\n out[3] = a[3];\n }\n\n return out;\n};\n\n/**\n * Inverts a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.invert = function(out, a) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n\n // Calculate the determinant\n det = a0 * a3 - a2 * a1;\n\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = a3 * det;\n out[1] = -a1 * det;\n out[2] = -a2 * det;\n out[3] = a0 * det;\n\n return out;\n};\n\n/**\n * Calculates the adjugate of a mat2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the source matrix\n * @returns {mat2} out\n */\nmat2.adjoint = function(out, a) {\n // Caching this value is nessecary if out == a\n var a0 = a[0];\n out[0] = a[3];\n out[1] = -a[1];\n out[2] = -a[2];\n out[3] = a0;\n\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2\n *\n * @param {mat2} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2.determinant = function (a) {\n return a[0] * a[3] - a[2] * a[1];\n};\n\n/**\n * Multiplies two mat2's\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the first operand\n * @param {mat2} b the second operand\n * @returns {mat2} out\n */\nmat2.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];\n var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n return out;\n};\n\n/**\n * Alias for {@link mat2.multiply}\n * @function\n */\nmat2.mul = mat2.multiply;\n\n/**\n * Rotates a mat2 by the given angle\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2} out\n */\nmat2.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n return out;\n};\n\n/**\n * Scales the mat2 by the dimensions in the given vec2\n *\n * @param {mat2} out the receiving matrix\n * @param {mat2} a the matrix to rotate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2} out\n **/\nmat2.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n return out;\n};\n\n/**\n * Returns Frobenius norm of a mat2\n *\n * @param {mat2} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2)))\n};\n\n/**\n * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix\n * @param {mat2} L the lower triangular matrix\n * @param {mat2} D the diagonal matrix\n * @param {mat2} U the upper triangular matrix\n * @param {mat2} a the input matrix to factorize\n */\n\nmat2.LDU = function (L, D, U, a) {\n L[2] = a[2]/a[0];\n U[0] = a[0];\n U[1] = a[1];\n U[3] = a[3] - L[2] * U[1];\n return [L, D, U];\n};\n\n\nexport default mat2;","import mat2 from '../glmatrix/mat2';\n\n/**\n * @constructor\n * @alias clay.Matrix2\n */\nvar Matrix2 = function() {\n\n /**\n * Storage of Matrix2\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Matrix2#\n */\n this.array = mat2.create();\n\n /**\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Matrix2#\n */\n this._dirty = true;\n};\n\nMatrix2.prototype = {\n\n constructor: Matrix2,\n\n /**\n * Set components from array\n * @param {Float32Array|number[]} arr\n */\n setArray: function (arr) {\n for (var i = 0; i < this.array.length; i++) {\n this.array[i] = arr[i];\n }\n this._dirty = true;\n return this;\n },\n /**\n * Clone a new Matrix2\n * @return {clay.Matrix2}\n */\n clone: function() {\n return (new Matrix2()).copy(this);\n },\n\n /**\n * Copy from b\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\n copy: function(b) {\n mat2.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate the adjugate of self, in-place\n * @return {clay.Matrix2}\n */\n adjoint: function() {\n mat2.adjoint(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate matrix determinant\n * @return {number}\n */\n determinant: function() {\n return mat2.determinant(this.array);\n },\n\n /**\n * Set to a identity matrix\n * @return {clay.Matrix2}\n */\n identity: function() {\n mat2.identity(this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Invert self\n * @return {clay.Matrix2}\n */\n invert: function() {\n mat2.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for mutiply\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\n mul: function(b) {\n mat2.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Matrix2} a\n * @return {clay.Matrix2}\n */\n mulLeft: function(a) {\n mat2.mul(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply self and b\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\n multiply: function(b) {\n mat2.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply a and self, a is on the left\n * @param {clay.Matrix2} a\n * @return {clay.Matrix2}\n */\n multiplyLeft: function(a) {\n mat2.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian\n * @param {number} rad\n * @return {clay.Matrix2}\n */\n rotate: function(rad) {\n mat2.rotate(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self by s\n * @param {clay.Vector2} s\n * @return {clay.Matrix2}\n */\n scale: function(v) {\n mat2.scale(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n /**\n * Transpose self, in-place.\n * @return {clay.Matrix2}\n */\n transpose: function() {\n mat2.transpose(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\n/**\n * @param {Matrix2} out\n * @param {Matrix2} a\n * @return {Matrix2}\n */\nMatrix2.adjoint = function(out, a) {\n mat2.adjoint(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @return {clay.Matrix2}\n */\nMatrix2.copy = function(out, a) {\n mat2.copy(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} a\n * @return {number}\n */\nMatrix2.determinant = function(a) {\n return mat2.determinant(a.array);\n};\n\n/**\n * @param {clay.Matrix2} out\n * @return {clay.Matrix2}\n */\nMatrix2.identity = function(out) {\n mat2.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @return {clay.Matrix2}\n */\nMatrix2.invert = function(out, a) {\n mat2.invert(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\nMatrix2.mul = function(out, a, b) {\n mat2.mul(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @param {clay.Matrix2} b\n * @return {clay.Matrix2}\n */\nMatrix2.multiply = Matrix2.mul;\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @param {number} rad\n * @return {clay.Matrix2}\n */\nMatrix2.rotate = function(out, a, rad) {\n mat2.rotate(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2} out\n * @param {clay.Matrix2} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix2}\n */\nMatrix2.scale = function(out, a, v) {\n mat2.scale(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n/**\n * @param {Matrix2} out\n * @param {Matrix2} a\n * @return {Matrix2}\n */\nMatrix2.transpose = function(out, a) {\n mat2.transpose(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\nexport default Matrix2;\n","\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport { GLMAT_ARRAY_TYPE } from './common';\n\n/**\n * @class 2x3 Matrix\n * @name mat2d\n *\n * @description\n * A mat2d contains six elements defined as:\n *
\n * [a, c, tx,\n *  b, d, ty]\n * 
\n * This is a short form for the 3x3 matrix:\n *
\n * [a, c, tx,\n *  b, d, ty,\n *  0, 0, 1]\n * 
\n * The last row is ignored so the array is shorter and operations are faster.\n */\n\nvar mat2d = {};\n\n/**\n * Creates a new identity mat2d\n *\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.create = function() {\n var out = new GLMAT_ARRAY_TYPE(6);\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Creates a new mat2d initialized with values from an existing matrix\n *\n * @param {mat2d} a matrix to clone\n * @returns {mat2d} a new 2x3 matrix\n */\nmat2d.clone = function(a) {\n var out = new GLMAT_ARRAY_TYPE(6);\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Copy the values from one mat2d to another\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.copy = function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4];\n out[5] = a[5];\n return out;\n};\n\n/**\n * Set a mat2d to the identity matrix\n *\n * @param {mat2d} out the receiving matrix\n * @returns {mat2d} out\n */\nmat2d.identity = function(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n};\n\n/**\n * Inverts a mat2d\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the source matrix\n * @returns {mat2d} out\n */\nmat2d.invert = function(out, a) {\n var aa = a[0], ab = a[1], ac = a[2], ad = a[3],\n atx = a[4], aty = a[5];\n\n var det = aa * ad - ab * ac;\n if(!det){\n return null;\n }\n det = 1.0 / det;\n\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n};\n\n/**\n * Calculates the determinant of a mat2d\n *\n * @param {mat2d} a the source matrix\n * @returns {Number} determinant of a\n */\nmat2d.determinant = function (a) {\n return a[0] * a[3] - a[1] * a[2];\n};\n\n/**\n * Multiplies two mat2d's\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the first operand\n * @param {mat2d} b the second operand\n * @returns {mat2d} out\n */\nmat2d.multiply = function (out, a, b) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];\n out[0] = a0 * b0 + a2 * b1;\n out[1] = a1 * b0 + a3 * b1;\n out[2] = a0 * b2 + a2 * b3;\n out[3] = a1 * b2 + a3 * b3;\n out[4] = a0 * b4 + a2 * b5 + a4;\n out[5] = a1 * b4 + a3 * b5 + a5;\n return out;\n};\n\n/**\n * Alias for {@link mat2d.multiply}\n * @function\n */\nmat2d.mul = mat2d.multiply;\n\n\n/**\n * Rotates a mat2d by the given angle\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to rotate\n * @param {Number} rad the angle to rotate the matrix by\n * @returns {mat2d} out\n */\nmat2d.rotate = function (out, a, rad) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n s = Math.sin(rad),\n c = Math.cos(rad);\n out[0] = a0 * c + a2 * s;\n out[1] = a1 * c + a3 * s;\n out[2] = a0 * -s + a2 * c;\n out[3] = a1 * -s + a3 * c;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Scales the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to scale the matrix by\n * @returns {mat2d} out\n **/\nmat2d.scale = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0 * v0;\n out[1] = a1 * v0;\n out[2] = a2 * v1;\n out[3] = a3 * v1;\n out[4] = a4;\n out[5] = a5;\n return out;\n};\n\n/**\n * Translates the mat2d by the dimensions in the given vec2\n *\n * @param {mat2d} out the receiving matrix\n * @param {mat2d} a the matrix to translate\n * @param {vec2} v the vec2 to translate the matrix by\n * @returns {mat2d} out\n **/\nmat2d.translate = function(out, a, v) {\n var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],\n v0 = v[0], v1 = v[1];\n out[0] = a0;\n out[1] = a1;\n out[2] = a2;\n out[3] = a3;\n out[4] = a0 * v0 + a2 * v1 + a4;\n out[5] = a1 * v0 + a3 * v1 + a5;\n return out;\n};\n\n/**\n * Returns Frobenius norm of a mat2d\n *\n * @param {mat2d} a the matrix to calculate Frobenius norm of\n * @returns {Number} Frobenius norm\n */\nmat2d.frob = function (a) {\n return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))\n};\n\n\nexport default mat2d;","import mat2d from '../glmatrix/mat2d';\n\n/**\n * @constructor\n * @alias clay.Matrix2d\n */\nvar Matrix2d = function() {\n /**\n * Storage of Matrix2d\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Matrix2d#\n */\n this.array = mat2d.create();\n\n /**\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Matrix2d#\n */\n this._dirty = true;\n};\n\nMatrix2d.prototype = {\n\n constructor: Matrix2d,\n\n /**\n * Set components from array\n * @param {Float32Array|number[]} arr\n */\n setArray: function (arr) {\n for (var i = 0; i < this.array.length; i++) {\n this.array[i] = arr[i];\n }\n this._dirty = true;\n return this;\n },\n /**\n * Clone a new Matrix2d\n * @return {clay.Matrix2d}\n */\n clone: function() {\n return (new Matrix2d()).copy(this);\n },\n\n /**\n * Copy from b\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\n copy: function(b) {\n mat2d.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate matrix determinant\n * @return {number}\n */\n determinant: function() {\n return mat2d.determinant(this.array);\n },\n\n /**\n * Set to a identity matrix\n * @return {clay.Matrix2d}\n */\n identity: function() {\n mat2d.identity(this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Invert self\n * @return {clay.Matrix2d}\n */\n invert: function() {\n mat2d.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for mutiply\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\n mul: function(b) {\n mat2d.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix2d}\n */\n mulLeft: function(b) {\n mat2d.mul(this.array, b.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply self and b\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\n multiply: function(b) {\n mat2d.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply a and self, a is on the left\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix2d}\n */\n multiplyLeft: function(b) {\n mat2d.multiply(this.array, b.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian\n * @param {number} rad\n * @return {clay.Matrix2d}\n */\n rotate: function(rad) {\n mat2d.rotate(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self by s\n * @param {clay.Vector2} s\n * @return {clay.Matrix2d}\n */\n scale: function(s) {\n mat2d.scale(this.array, this.array, s.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Translate self by v\n * @param {clay.Vector2} v\n * @return {clay.Matrix2d}\n */\n translate: function(v) {\n mat2d.translate(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n\n toString: function() {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix2d}\n */\nMatrix2d.copy = function(out, a) {\n mat2d.copy(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} a\n * @return {number}\n */\nMatrix2d.determinant = function(a) {\n return mat2d.determinant(a.array);\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @return {clay.Matrix2d}\n */\nMatrix2d.identity = function(out) {\n mat2d.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix2d}\n */\nMatrix2d.invert = function(out, a) {\n mat2d.invert(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\nMatrix2d.mul = function(out, a, b) {\n mat2d.mul(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {clay.Matrix2d} b\n * @return {clay.Matrix2d}\n */\nMatrix2d.multiply = Matrix2d.mul;\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {number} rad\n * @return {clay.Matrix2d}\n */\nMatrix2d.rotate = function(out, a, rad) {\n mat2d.rotate(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix2d}\n */\nMatrix2d.scale = function(out, a, v) {\n mat2d.scale(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix2d} out\n * @param {clay.Matrix2d} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix2d}\n */\nMatrix2d.translate = function(out, a, v) {\n mat2d.translate(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\nexport default Matrix2d;\n","import mat3 from '../glmatrix/mat3';\n\n/**\n * @constructor\n * @alias clay.Matrix3\n */\nvar Matrix3 = function () {\n\n /**\n * Storage of Matrix3\n * @name array\n * @type {Float32Array}\n * @memberOf clay.Matrix3#\n */\n this.array = mat3.create();\n\n /**\n * @name _dirty\n * @type {boolean}\n * @memberOf clay.Matrix3#\n */\n this._dirty = true;\n};\n\nMatrix3.prototype = {\n\n constructor: Matrix3,\n\n /**\n * Set components from array\n * @param {Float32Array|number[]} arr\n */\n setArray: function (arr) {\n for (var i = 0; i < this.array.length; i++) {\n this.array[i] = arr[i];\n }\n this._dirty = true;\n return this;\n },\n /**\n * Calculate the adjugate of self, in-place\n * @return {clay.Matrix3}\n */\n adjoint: function () {\n mat3.adjoint(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Clone a new Matrix3\n * @return {clay.Matrix3}\n */\n clone: function () {\n return (new Matrix3()).copy(this);\n },\n\n /**\n * Copy from b\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\n copy: function (b) {\n mat3.copy(this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculate matrix determinant\n * @return {number}\n */\n determinant: function () {\n return mat3.determinant(this.array);\n },\n\n /**\n * Copy the values from Matrix2d a\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix3}\n */\n fromMat2d: function (a) {\n mat3.fromMat2d(this.array, a.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Copies the upper-left 3x3 values of Matrix4\n * @param {clay.Matrix4} a\n * @return {clay.Matrix3}\n */\n fromMat4: function (a) {\n mat3.fromMat4(this.array, a.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Calculates a rotation matrix from the given quaternion\n * @param {clay.Quaternion} q\n * @return {clay.Matrix3}\n */\n fromQuat: function (q) {\n mat3.fromQuat(this.array, q.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Set to a identity matrix\n * @return {clay.Matrix3}\n */\n identity: function () {\n mat3.identity(this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Invert self\n * @return {clay.Matrix3}\n */\n invert: function () {\n mat3.invert(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for mutiply\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\n mul: function (b) {\n mat3.mul(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Alias for multiplyLeft\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\n mulLeft: function (a) {\n mat3.mul(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply self and b\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\n multiply: function (b) {\n mat3.multiply(this.array, this.array, b.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Multiply a and self, a is on the left\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\n multiplyLeft: function (a) {\n mat3.multiply(this.array, a.array, this.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Rotate self by a given radian\n * @param {number} rad\n * @return {clay.Matrix3}\n */\n rotate: function (rad) {\n mat3.rotate(this.array, this.array, rad);\n this._dirty = true;\n return this;\n },\n\n /**\n * Scale self by s\n * @param {clay.Vector2} s\n * @return {clay.Matrix3}\n */\n scale: function (v) {\n mat3.scale(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Translate self by v\n * @param {clay.Vector2} v\n * @return {clay.Matrix3}\n */\n translate: function (v) {\n mat3.translate(this.array, this.array, v.array);\n this._dirty = true;\n return this;\n },\n /**\n * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix\n * @param {clay.Matrix4} a\n */\n normalFromMat4: function (a) {\n mat3.normalFromMat4(this.array, a.array);\n this._dirty = true;\n return this;\n },\n\n /**\n * Transpose self, in-place.\n * @return {clay.Matrix2}\n */\n transpose: function () {\n mat3.transpose(this.array, this.array);\n this._dirty = true;\n return this;\n },\n\n toString: function () {\n return '[' + Array.prototype.join.call(this.array, ',') + ']';\n },\n\n toArray: function () {\n return Array.prototype.slice.call(this.array);\n }\n};\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\nMatrix3.adjoint = function (out, a) {\n mat3.adjoint(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\nMatrix3.copy = function (out, a) {\n mat3.copy(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} a\n * @return {number}\n */\nMatrix3.determinant = function (a) {\n return mat3.determinant(a.array);\n};\n\n/**\n * @param {clay.Matrix3} out\n * @return {clay.Matrix3}\n */\nMatrix3.identity = function (out) {\n mat3.identity(out.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\nMatrix3.invert = function (out, a) {\n mat3.invert(out.array, a.array);\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\nMatrix3.mul = function (out, a, b) {\n mat3.mul(out.array, a.array, b.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @function\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {clay.Matrix3} b\n * @return {clay.Matrix3}\n */\nMatrix3.multiply = Matrix3.mul;\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix2d} a\n * @return {clay.Matrix3}\n */\nMatrix3.fromMat2d = function (out, a) {\n mat3.fromMat2d(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix3}\n */\nMatrix3.fromMat4 = function (out, a) {\n mat3.fromMat4(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Quaternion} a\n * @return {clay.Matrix3}\n */\nMatrix3.fromQuat = function (out, q) {\n mat3.fromQuat(out.array, q.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix4} a\n * @return {clay.Matrix3}\n */\nMatrix3.normalFromMat4 = function (out, a) {\n mat3.normalFromMat4(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {number} rad\n * @return {clay.Matrix3}\n */\nMatrix3.rotate = function (out, a, rad) {\n mat3.rotate(out.array, a.array, rad);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix3}\n */\nMatrix3.scale = function (out, a, v) {\n mat3.scale(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @return {clay.Matrix3}\n */\nMatrix3.transpose = function (out, a) {\n mat3.transpose(out.array, a.array);\n out._dirty = true;\n return out;\n};\n\n/**\n * @param {clay.Matrix3} out\n * @param {clay.Matrix3} a\n * @param {clay.Vector2} v\n * @return {clay.Matrix3}\n */\nMatrix3.translate = function (out, a, v) {\n mat3.translate(out.array, a.array, v.array);\n out._dirty = true;\n return out;\n};\n\nexport default Matrix3;\n","var easing = {\n linear: function (k) {\n return k;\n },\n quadraticIn: function (k) {\n return k * k;\n },\n quadraticOut: function (k) {\n return k * (2 - k);\n },\n quadraticInOut: function (k) {\n if ((k *= 2) < 1) {\n return 0.5 * k * k;\n }\n return -0.5 * (--k * (k - 2) - 1);\n },\n cubicIn: function (k) {\n return k * k * k;\n },\n cubicOut: function (k) {\n return --k * k * k + 1;\n },\n cubicInOut: function (k) {\n if ((k *= 2) < 1) {\n return 0.5 * k * k * k;\n }\n return 0.5 * ((k -= 2) * k * k + 2);\n },\n quarticIn: function (k) {\n return k * k * k * k;\n },\n quarticOut: function (k) {\n return 1 - (--k * k * k * k);\n },\n quarticInOut: function (k) {\n if ((k *= 2) < 1) {\n return 0.5 * k * k * k * k;\n }\n return -0.5 * ((k -= 2) * k * k * k - 2);\n },\n quinticIn: function (k) {\n return k * k * k * k * k;\n },\n quinticOut: function (k) {\n return --k * k * k * k * k + 1;\n },\n quinticInOut: function (k) {\n if ((k *= 2) < 1) {\n return 0.5 * k * k * k * k * k;\n }\n return 0.5 * ((k -= 2) * k * k * k * k + 2);\n },\n sinusoidalIn: function (k) {\n return 1 - Math.cos(k * Math.PI / 2);\n },\n sinusoidalOut: function (k) {\n return Math.sin(k * Math.PI / 2);\n },\n sinusoidalInOut: function (k) {\n return 0.5 * (1 - Math.cos(Math.PI * k));\n },\n exponentialIn: function (k) {\n return k === 0 ? 0 : Math.pow(1024, k - 1);\n },\n exponentialOut: function (k) {\n return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);\n },\n exponentialInOut: function (k) {\n if (k === 0) {\n return 0;\n }\n if (k === 1) {\n return 1;\n }\n if ((k *= 2) < 1) {\n return 0.5 * Math.pow(1024, k - 1);\n }\n return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);\n },\n circularIn: function (k) {\n return 1 - Math.sqrt(1 - k * k);\n },\n circularOut: function (k) {\n return Math.sqrt(1 - (--k * k));\n },\n circularInOut: function (k) {\n if ((k *= 2) < 1) {\n return -0.5 * (Math.sqrt(1 - k * k) - 1);\n }\n return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);\n },\n elasticIn: function (k) {\n var s;\n var a = 0.1;\n var p = 0.4;\n if (k === 0) {\n return 0;\n }\n if (k === 1) {\n return 1;\n }\n if (!a || a < 1) {\n a = 1;\n s = p / 4;\n }\n else {\n s = p * Math.asin(1 / a) / (2 * Math.PI);\n }\n return -(a * Math.pow(2, 10 * (k -= 1))\n * Math.sin((k - s) * (2 * Math.PI) / p));\n },\n elasticOut: function (k) {\n var s;\n var a = 0.1;\n var p = 0.4;\n if (k === 0) {\n return 0;\n }\n if (k === 1) {\n return 1;\n }\n if (!a || a < 1) {\n a = 1;\n s = p / 4;\n }\n else {\n s = p * Math.asin(1 / a) / (2 * Math.PI);\n }\n return (a * Math.pow(2, -10 * k)\n * Math.sin((k - s) * (2 * Math.PI) / p) + 1);\n },\n elasticInOut: function (k) {\n var s;\n var a = 0.1;\n var p = 0.4;\n if (k === 0) {\n return 0;\n }\n if (k === 1) {\n return 1;\n }\n if (!a || a < 1) {\n a = 1;\n s = p / 4;\n }\n else {\n s = p * Math.asin(1 / a) / (2 * Math.PI);\n }\n if ((k *= 2) < 1) {\n return -0.5 * (a * Math.pow(2, 10 * (k -= 1))\n * Math.sin((k - s) * (2 * Math.PI) / p));\n }\n return a * Math.pow(2, -10 * (k -= 1))\n * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;\n },\n backIn: function (k) {\n var s = 1.70158;\n return k * k * ((s + 1) * k - s);\n },\n backOut: function (k) {\n var s = 1.70158;\n return --k * k * ((s + 1) * k + s) + 1;\n },\n backInOut: function (k) {\n var s = 1.70158 * 1.525;\n if ((k *= 2) < 1) {\n return 0.5 * (k * k * ((s + 1) * k - s));\n }\n return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);\n },\n bounceIn: function (k) {\n return 1 - easing.bounceOut(1 - k);\n },\n bounceOut: function (k) {\n if (k < (1 / 2.75)) {\n return 7.5625 * k * k;\n }\n else if (k < (2 / 2.75)) {\n return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;\n }\n else if (k < (2.5 / 2.75)) {\n return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;\n }\n else {\n return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;\n }\n },\n bounceInOut: function (k) {\n if (k < 0.5) {\n return easing.bounceIn(k * 2) * 0.5;\n }\n return easing.bounceOut(k * 2 - 1) * 0.5 + 0.5;\n }\n};\nexport default easing;\n","import easingFuncs from './easing';\nvar Clip = (function () {\n function Clip(opts) {\n this._initialized = false;\n this._startTime = 0;\n this._pausedTime = 0;\n this._paused = false;\n this._life = opts.life || 1000;\n this._delay = opts.delay || 0;\n this.loop = opts.loop == null ? false : opts.loop;\n this.gap = opts.gap || 0;\n this.easing = opts.easing || 'linear';\n this.onframe = opts.onframe;\n this.ondestroy = opts.ondestroy;\n this.onrestart = opts.onrestart;\n }\n Clip.prototype.step = function (globalTime, deltaTime) {\n if (!this._initialized) {\n this._startTime = globalTime + this._delay;\n this._initialized = true;\n }\n if (this._paused) {\n this._pausedTime += deltaTime;\n return;\n }\n var percent = (globalTime - this._startTime - this._pausedTime) / this._life;\n if (percent < 0) {\n percent = 0;\n }\n percent = Math.min(percent, 1);\n var easing = this.easing;\n var easingFunc = typeof easing === 'string'\n ? easingFuncs[easing] : easing;\n var schedule = typeof easingFunc === 'function'\n ? easingFunc(percent)\n : percent;\n this.onframe && this.onframe(schedule);\n if (percent === 1) {\n if (this.loop) {\n this._restart(globalTime);\n this.onrestart && this.onrestart();\n }\n else {\n return true;\n }\n }\n return false;\n };\n Clip.prototype._restart = function (globalTime) {\n var remainder = (globalTime - this._startTime - this._pausedTime) % this._life;\n this._startTime = globalTime - remainder + this.gap;\n this._pausedTime = 0;\n };\n Clip.prototype.pause = function () {\n this._paused = true;\n };\n Clip.prototype.resume = function () {\n this._paused = false;\n };\n return Clip;\n}());\nexport default Clip;\n","import LRU from '../core/LRU';\nvar kCSSColorTable = {\n 'transparent': [0, 0, 0, 0], 'aliceblue': [240, 248, 255, 1],\n 'antiquewhite': [250, 235, 215, 1], 'aqua': [0, 255, 255, 1],\n 'aquamarine': [127, 255, 212, 1], 'azure': [240, 255, 255, 1],\n 'beige': [245, 245, 220, 1], 'bisque': [255, 228, 196, 1],\n 'black': [0, 0, 0, 1], 'blanchedalmond': [255, 235, 205, 1],\n 'blue': [0, 0, 255, 1], 'blueviolet': [138, 43, 226, 1],\n 'brown': [165, 42, 42, 1], 'burlywood': [222, 184, 135, 1],\n 'cadetblue': [95, 158, 160, 1], 'chartreuse': [127, 255, 0, 1],\n 'chocolate': [210, 105, 30, 1], 'coral': [255, 127, 80, 1],\n 'cornflowerblue': [100, 149, 237, 1], 'cornsilk': [255, 248, 220, 1],\n 'crimson': [220, 20, 60, 1], 'cyan': [0, 255, 255, 1],\n 'darkblue': [0, 0, 139, 1], 'darkcyan': [0, 139, 139, 1],\n 'darkgoldenrod': [184, 134, 11, 1], 'darkgray': [169, 169, 169, 1],\n 'darkgreen': [0, 100, 0, 1], 'darkgrey': [169, 169, 169, 1],\n 'darkkhaki': [189, 183, 107, 1], 'darkmagenta': [139, 0, 139, 1],\n 'darkolivegreen': [85, 107, 47, 1], 'darkorange': [255, 140, 0, 1],\n 'darkorchid': [153, 50, 204, 1], 'darkred': [139, 0, 0, 1],\n 'darksalmon': [233, 150, 122, 1], 'darkseagreen': [143, 188, 143, 1],\n 'darkslateblue': [72, 61, 139, 1], 'darkslategray': [47, 79, 79, 1],\n 'darkslategrey': [47, 79, 79, 1], 'darkturquoise': [0, 206, 209, 1],\n 'darkviolet': [148, 0, 211, 1], 'deeppink': [255, 20, 147, 1],\n 'deepskyblue': [0, 191, 255, 1], 'dimgray': [105, 105, 105, 1],\n 'dimgrey': [105, 105, 105, 1], 'dodgerblue': [30, 144, 255, 1],\n 'firebrick': [178, 34, 34, 1], 'floralwhite': [255, 250, 240, 1],\n 'forestgreen': [34, 139, 34, 1], 'fuchsia': [255, 0, 255, 1],\n 'gainsboro': [220, 220, 220, 1], 'ghostwhite': [248, 248, 255, 1],\n 'gold': [255, 215, 0, 1], 'goldenrod': [218, 165, 32, 1],\n 'gray': [128, 128, 128, 1], 'green': [0, 128, 0, 1],\n 'greenyellow': [173, 255, 47, 1], 'grey': [128, 128, 128, 1],\n 'honeydew': [240, 255, 240, 1], 'hotpink': [255, 105, 180, 1],\n 'indianred': [205, 92, 92, 1], 'indigo': [75, 0, 130, 1],\n 'ivory': [255, 255, 240, 1], 'khaki': [240, 230, 140, 1],\n 'lavender': [230, 230, 250, 1], 'lavenderblush': [255, 240, 245, 1],\n 'lawngreen': [124, 252, 0, 1], 'lemonchiffon': [255, 250, 205, 1],\n 'lightblue': [173, 216, 230, 1], 'lightcoral': [240, 128, 128, 1],\n 'lightcyan': [224, 255, 255, 1], 'lightgoldenrodyellow': [250, 250, 210, 1],\n 'lightgray': [211, 211, 211, 1], 'lightgreen': [144, 238, 144, 1],\n 'lightgrey': [211, 211, 211, 1], 'lightpink': [255, 182, 193, 1],\n 'lightsalmon': [255, 160, 122, 1], 'lightseagreen': [32, 178, 170, 1],\n 'lightskyblue': [135, 206, 250, 1], 'lightslategray': [119, 136, 153, 1],\n 'lightslategrey': [119, 136, 153, 1], 'lightsteelblue': [176, 196, 222, 1],\n 'lightyellow': [255, 255, 224, 1], 'lime': [0, 255, 0, 1],\n 'limegreen': [50, 205, 50, 1], 'linen': [250, 240, 230, 1],\n 'magenta': [255, 0, 255, 1], 'maroon': [128, 0, 0, 1],\n 'mediumaquamarine': [102, 205, 170, 1], 'mediumblue': [0, 0, 205, 1],\n 'mediumorchid': [186, 85, 211, 1], 'mediumpurple': [147, 112, 219, 1],\n 'mediumseagreen': [60, 179, 113, 1], 'mediumslateblue': [123, 104, 238, 1],\n 'mediumspringgreen': [0, 250, 154, 1], 'mediumturquoise': [72, 209, 204, 1],\n 'mediumvioletred': [199, 21, 133, 1], 'midnightblue': [25, 25, 112, 1],\n 'mintcream': [245, 255, 250, 1], 'mistyrose': [255, 228, 225, 1],\n 'moccasin': [255, 228, 181, 1], 'navajowhite': [255, 222, 173, 1],\n 'navy': [0, 0, 128, 1], 'oldlace': [253, 245, 230, 1],\n 'olive': [128, 128, 0, 1], 'olivedrab': [107, 142, 35, 1],\n 'orange': [255, 165, 0, 1], 'orangered': [255, 69, 0, 1],\n 'orchid': [218, 112, 214, 1], 'palegoldenrod': [238, 232, 170, 1],\n 'palegreen': [152, 251, 152, 1], 'paleturquoise': [175, 238, 238, 1],\n 'palevioletred': [219, 112, 147, 1], 'papayawhip': [255, 239, 213, 1],\n 'peachpuff': [255, 218, 185, 1], 'peru': [205, 133, 63, 1],\n 'pink': [255, 192, 203, 1], 'plum': [221, 160, 221, 1],\n 'powderblue': [176, 224, 230, 1], 'purple': [128, 0, 128, 1],\n 'red': [255, 0, 0, 1], 'rosybrown': [188, 143, 143, 1],\n 'royalblue': [65, 105, 225, 1], 'saddlebrown': [139, 69, 19, 1],\n 'salmon': [250, 128, 114, 1], 'sandybrown': [244, 164, 96, 1],\n 'seagreen': [46, 139, 87, 1], 'seashell': [255, 245, 238, 1],\n 'sienna': [160, 82, 45, 1], 'silver': [192, 192, 192, 1],\n 'skyblue': [135, 206, 235, 1], 'slateblue': [106, 90, 205, 1],\n 'slategray': [112, 128, 144, 1], 'slategrey': [112, 128, 144, 1],\n 'snow': [255, 250, 250, 1], 'springgreen': [0, 255, 127, 1],\n 'steelblue': [70, 130, 180, 1], 'tan': [210, 180, 140, 1],\n 'teal': [0, 128, 128, 1], 'thistle': [216, 191, 216, 1],\n 'tomato': [255, 99, 71, 1], 'turquoise': [64, 224, 208, 1],\n 'violet': [238, 130, 238, 1], 'wheat': [245, 222, 179, 1],\n 'white': [255, 255, 255, 1], 'whitesmoke': [245, 245, 245, 1],\n 'yellow': [255, 255, 0, 1], 'yellowgreen': [154, 205, 50, 1]\n};\nfunction clampCssByte(i) {\n i = Math.round(i);\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\nfunction clampCssAngle(i) {\n i = Math.round(i);\n return i < 0 ? 0 : i > 360 ? 360 : i;\n}\nfunction clampCssFloat(f) {\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\nfunction parseCssInt(val) {\n var str = val;\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssByte(parseFloat(str) / 100 * 255);\n }\n return clampCssByte(parseInt(str, 10));\n}\nfunction parseCssFloat(val) {\n var str = val;\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssFloat(parseFloat(str) / 100);\n }\n return clampCssFloat(parseFloat(str));\n}\nfunction cssHueToRgb(m1, m2, h) {\n if (h < 0) {\n h += 1;\n }\n else if (h > 1) {\n h -= 1;\n }\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n if (h * 2 < 1) {\n return m2;\n }\n if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2 / 3 - h) * 6;\n }\n return m1;\n}\nfunction lerpNumber(a, b, p) {\n return a + (b - a) * p;\n}\nfunction setRgba(out, r, g, b, a) {\n out[0] = r;\n out[1] = g;\n out[2] = b;\n out[3] = a;\n return out;\n}\nfunction copyRgba(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\nvar colorCache = new LRU(20);\nvar lastRemovedArr = null;\nfunction putToCache(colorStr, rgbaArr) {\n if (lastRemovedArr) {\n copyRgba(lastRemovedArr, rgbaArr);\n }\n lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice()));\n}\nexport function parse(colorStr, rgbaArr) {\n if (!colorStr) {\n return;\n }\n rgbaArr = rgbaArr || [];\n var cached = colorCache.get(colorStr);\n if (cached) {\n return copyRgba(rgbaArr, cached);\n }\n colorStr = colorStr + '';\n var str = colorStr.replace(/ /g, '').toLowerCase();\n if (str in kCSSColorTable) {\n copyRgba(rgbaArr, kCSSColorTable[str]);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n var strLen = str.length;\n if (str.charAt(0) === '#') {\n if (strLen === 4 || strLen === 5) {\n var iv = parseInt(str.slice(1, 4), 16);\n if (!(iv >= 0 && iv <= 0xfff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n setRgba(rgbaArr, ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8), (iv & 0xf0) | ((iv & 0xf0) >> 4), (iv & 0xf) | ((iv & 0xf) << 4), strLen === 5 ? parseInt(str.slice(4), 16) / 0xf : 1);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n else if (strLen === 7 || strLen === 9) {\n var iv = parseInt(str.slice(1, 7), 16);\n if (!(iv >= 0 && iv <= 0xffffff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n setRgba(rgbaArr, (iv & 0xff0000) >> 16, (iv & 0xff00) >> 8, iv & 0xff, strLen === 9 ? parseInt(str.slice(7), 16) / 0xff : 1);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n return;\n }\n var op = str.indexOf('(');\n var ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === strLen) {\n var fname = str.substr(0, op);\n var params = str.substr(op + 1, ep - (op + 1)).split(',');\n var alpha = 1;\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) {\n return params.length === 3\n ? setRgba(rgbaArr, +params[0], +params[1], +params[2], 1)\n : setRgba(rgbaArr, 0, 0, 0, 1);\n }\n alpha = parseCssFloat(params.pop());\n case 'rgb':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n setRgba(rgbaArr, parseCssInt(params[0]), parseCssInt(params[1]), parseCssInt(params[2]), alpha);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsla':\n if (params.length !== 4) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n params[3] = parseCssFloat(params[3]);\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsl':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n default:\n return;\n }\n }\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n}\nfunction hsla2rgba(hsla, rgba) {\n var h = (((parseFloat(hsla[0]) % 360) + 360) % 360) / 360;\n var s = parseCssFloat(hsla[1]);\n var l = parseCssFloat(hsla[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n rgba = rgba || [];\n setRgba(rgba, clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), clampCssByte(cssHueToRgb(m1, m2, h) * 255), clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), 1);\n if (hsla.length === 4) {\n rgba[3] = hsla[3];\n }\n return rgba;\n}\nfunction rgba2hsla(rgba) {\n if (!rgba) {\n return;\n }\n var R = rgba[0] / 255;\n var G = rgba[1] / 255;\n var B = rgba[2] / 255;\n var vMin = Math.min(R, G, B);\n var vMax = Math.max(R, G, B);\n var delta = vMax - vMin;\n var L = (vMax + vMin) / 2;\n var H;\n var S;\n if (delta === 0) {\n H = 0;\n S = 0;\n }\n else {\n if (L < 0.5) {\n S = delta / (vMax + vMin);\n }\n else {\n S = delta / (2 - vMax - vMin);\n }\n var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;\n var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;\n var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;\n if (R === vMax) {\n H = deltaB - deltaG;\n }\n else if (G === vMax) {\n H = (1 / 3) + deltaR - deltaB;\n }\n else if (B === vMax) {\n H = (2 / 3) + deltaG - deltaR;\n }\n if (H < 0) {\n H += 1;\n }\n if (H > 1) {\n H -= 1;\n }\n }\n var hsla = [H * 360, S, L];\n if (rgba[3] != null) {\n hsla.push(rgba[3]);\n }\n return hsla;\n}\nexport function lift(color, level) {\n var colorArr = parse(color);\n if (colorArr) {\n for (var i = 0; i < 3; i++) {\n if (level < 0) {\n colorArr[i] = colorArr[i] * (1 - level) | 0;\n }\n else {\n colorArr[i] = ((255 - colorArr[i]) * level + colorArr[i]) | 0;\n }\n if (colorArr[i] > 255) {\n colorArr[i] = 255;\n }\n else if (colorArr[i] < 0) {\n colorArr[i] = 0;\n }\n }\n return stringify(colorArr, colorArr.length === 4 ? 'rgba' : 'rgb');\n }\n}\nexport function toHex(color) {\n var colorArr = parse(color);\n if (colorArr) {\n return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + (+colorArr[2])).toString(16).slice(1);\n }\n}\nexport function fastLerp(normalizedValue, colors, out) {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)) {\n return;\n }\n out = out || [];\n var value = normalizedValue * (colors.length - 1);\n var leftIndex = Math.floor(value);\n var rightIndex = Math.ceil(value);\n var leftColor = colors[leftIndex];\n var rightColor = colors[rightIndex];\n var dv = value - leftIndex;\n out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));\n out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));\n out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));\n out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));\n return out;\n}\nexport var fastMapToColor = fastLerp;\nexport function lerp(normalizedValue, colors, fullOutput) {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)) {\n return;\n }\n var value = normalizedValue * (colors.length - 1);\n var leftIndex = Math.floor(value);\n var rightIndex = Math.ceil(value);\n var leftColor = parse(colors[leftIndex]);\n var rightColor = parse(colors[rightIndex]);\n var dv = value - leftIndex;\n var color = stringify([\n clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)),\n clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)),\n clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)),\n clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))\n ], 'rgba');\n return fullOutput\n ? {\n color: color,\n leftIndex: leftIndex,\n rightIndex: rightIndex,\n value: value\n }\n : color;\n}\nexport var mapToColor = lerp;\nexport function modifyHSL(color, h, s, l) {\n var colorArr = parse(color);\n if (color) {\n colorArr = rgba2hsla(colorArr);\n h != null && (colorArr[0] = clampCssAngle(h));\n s != null && (colorArr[1] = parseCssFloat(s));\n l != null && (colorArr[2] = parseCssFloat(l));\n return stringify(hsla2rgba(colorArr), 'rgba');\n }\n}\nexport function modifyAlpha(color, alpha) {\n var colorArr = parse(color);\n if (colorArr && alpha != null) {\n colorArr[3] = clampCssFloat(alpha);\n return stringify(colorArr, 'rgba');\n }\n}\nexport function stringify(arrColor, type) {\n if (!arrColor || !arrColor.length) {\n return;\n }\n var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2];\n if (type === 'rgba' || type === 'hsva' || type === 'hsla') {\n colorStr += ',' + arrColor[3];\n }\n return type + '(' + colorStr + ')';\n}\nexport function lum(color, backgroundLum) {\n var arr = parse(color);\n return arr\n ? (0.299 * arr[0] + 0.587 * arr[1] + 0.114 * arr[2]) * arr[3] / 255\n + (1 - arr[3]) * backgroundLum\n : 0;\n}\nexport function random() {\n var r = Math.round(Math.random() * 255);\n var g = Math.round(Math.random() * 255);\n var b = Math.round(Math.random() * 255);\n return 'rgb(' + r + ',' + g + ',' + b + ')';\n}\n","var BUILTIN_OBJECT = {\n '[object Function]': true,\n '[object RegExp]': true,\n '[object Date]': true,\n '[object Error]': true,\n '[object CanvasGradient]': true,\n '[object CanvasPattern]': true,\n '[object Image]': true,\n '[object Canvas]': true\n};\nvar TYPED_ARRAY = {\n '[object Int8Array]': true,\n '[object Uint8Array]': true,\n '[object Uint8ClampedArray]': true,\n '[object Int16Array]': true,\n '[object Uint16Array]': true,\n '[object Int32Array]': true,\n '[object Uint32Array]': true,\n '[object Float32Array]': true,\n '[object Float64Array]': true\n};\nvar objToString = Object.prototype.toString;\nvar arrayProto = Array.prototype;\nvar nativeForEach = arrayProto.forEach;\nvar nativeFilter = arrayProto.filter;\nvar nativeSlice = arrayProto.slice;\nvar nativeMap = arrayProto.map;\nvar ctorFunction = function () { }.constructor;\nvar protoFunction = ctorFunction ? ctorFunction.prototype : null;\nvar methods = {};\nexport function $override(name, fn) {\n methods[name] = fn;\n}\nvar idStart = 0x0907;\nexport function guid() {\n return idStart++;\n}\nexport function logError() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (typeof console !== 'undefined') {\n console.error.apply(console, args);\n }\n}\nexport function clone(source) {\n if (source == null || typeof source !== 'object') {\n return source;\n }\n var result = source;\n var typeStr = objToString.call(source);\n if (typeStr === '[object Array]') {\n if (!isPrimitive(source)) {\n result = [];\n for (var i = 0, len = source.length; i < len; i++) {\n result[i] = clone(source[i]);\n }\n }\n }\n else if (TYPED_ARRAY[typeStr]) {\n if (!isPrimitive(source)) {\n var Ctor = source.constructor;\n if (Ctor.from) {\n result = Ctor.from(source);\n }\n else {\n result = new Ctor(source.length);\n for (var i = 0, len = source.length; i < len; i++) {\n result[i] = clone(source[i]);\n }\n }\n }\n }\n else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {\n result = {};\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n result[key] = clone(source[key]);\n }\n }\n }\n return result;\n}\nexport function merge(target, source, overwrite) {\n if (!isObject(source) || !isObject(target)) {\n return overwrite ? clone(source) : target;\n }\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n var targetProp = target[key];\n var sourceProp = source[key];\n if (isObject(sourceProp)\n && isObject(targetProp)\n && !isArray(sourceProp)\n && !isArray(targetProp)\n && !isDom(sourceProp)\n && !isDom(targetProp)\n && !isBuiltInObject(sourceProp)\n && !isBuiltInObject(targetProp)\n && !isPrimitive(sourceProp)\n && !isPrimitive(targetProp)) {\n merge(targetProp, sourceProp, overwrite);\n }\n else if (overwrite || !(key in target)) {\n target[key] = clone(source[key]);\n }\n }\n }\n return target;\n}\nexport function mergeAll(targetAndSources, overwrite) {\n var result = targetAndSources[0];\n for (var i = 1, len = targetAndSources.length; i < len; i++) {\n result = merge(result, targetAndSources[i], overwrite);\n }\n return result;\n}\nexport function extend(target, source) {\n if (Object.assign) {\n Object.assign(target, source);\n }\n else {\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n}\nexport function defaults(target, source, overlay) {\n var keysArr = keys(source);\n for (var i = 0; i < keysArr.length; i++) {\n var key = keysArr[i];\n if ((overlay ? source[key] != null : target[key] == null)) {\n target[key] = source[key];\n }\n }\n return target;\n}\nexport var createCanvas = function () {\n return methods.createCanvas();\n};\nmethods.createCanvas = function () {\n return document.createElement('canvas');\n};\nexport function indexOf(array, value) {\n if (array) {\n if (array.indexOf) {\n return array.indexOf(value);\n }\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n }\n return -1;\n}\nexport function inherits(clazz, baseClazz) {\n var clazzPrototype = clazz.prototype;\n function F() { }\n F.prototype = baseClazz.prototype;\n clazz.prototype = new F();\n for (var prop in clazzPrototype) {\n if (clazzPrototype.hasOwnProperty(prop)) {\n clazz.prototype[prop] = clazzPrototype[prop];\n }\n }\n clazz.prototype.constructor = clazz;\n clazz.superClass = baseClazz;\n}\nexport function mixin(target, source, override) {\n target = 'prototype' in target ? target.prototype : target;\n source = 'prototype' in source ? source.prototype : source;\n if (Object.getOwnPropertyNames) {\n var keyList = Object.getOwnPropertyNames(source);\n for (var i = 0; i < keyList.length; i++) {\n var key = keyList[i];\n if (key !== 'constructor') {\n if ((override ? source[key] != null : target[key] == null)) {\n target[key] = source[key];\n }\n }\n }\n }\n else {\n defaults(target, source, override);\n }\n}\nexport function isArrayLike(data) {\n if (!data) {\n return false;\n }\n if (typeof data === 'string') {\n return false;\n }\n return typeof data.length === 'number';\n}\nexport function each(arr, cb, context) {\n if (!(arr && cb)) {\n return;\n }\n if (arr.forEach && arr.forEach === nativeForEach) {\n arr.forEach(cb, context);\n }\n else if (arr.length === +arr.length) {\n for (var i = 0, len = arr.length; i < len; i++) {\n cb.call(context, arr[i], i, arr);\n }\n }\n else {\n for (var key in arr) {\n if (arr.hasOwnProperty(key)) {\n cb.call(context, arr[key], key, arr);\n }\n }\n }\n}\nexport function map(arr, cb, context) {\n if (!arr) {\n return [];\n }\n if (!cb) {\n return slice(arr);\n }\n if (arr.map && arr.map === nativeMap) {\n return arr.map(cb, context);\n }\n else {\n var result = [];\n for (var i = 0, len = arr.length; i < len; i++) {\n result.push(cb.call(context, arr[i], i, arr));\n }\n return result;\n }\n}\nexport function reduce(arr, cb, memo, context) {\n if (!(arr && cb)) {\n return;\n }\n for (var i = 0, len = arr.length; i < len; i++) {\n memo = cb.call(context, memo, arr[i], i, arr);\n }\n return memo;\n}\nexport function filter(arr, cb, context) {\n if (!arr) {\n return [];\n }\n if (!cb) {\n return slice(arr);\n }\n if (arr.filter && arr.filter === nativeFilter) {\n return arr.filter(cb, context);\n }\n else {\n var result = [];\n for (var i = 0, len = arr.length; i < len; i++) {\n if (cb.call(context, arr[i], i, arr)) {\n result.push(arr[i]);\n }\n }\n return result;\n }\n}\nexport function find(arr, cb, context) {\n if (!(arr && cb)) {\n return;\n }\n for (var i = 0, len = arr.length; i < len; i++) {\n if (cb.call(context, arr[i], i, arr)) {\n return arr[i];\n }\n }\n}\nexport function keys(obj) {\n if (!obj) {\n return [];\n }\n if (Object.keys) {\n return Object.keys(obj);\n }\n var keyList = [];\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n keyList.push(key);\n }\n }\n return keyList;\n}\nfunction bindPolyfill(func, context) {\n var args = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n return function () {\n return func.apply(context, args.concat(nativeSlice.call(arguments)));\n };\n}\nexport var bind = (protoFunction && isFunction(protoFunction.bind))\n ? protoFunction.call.bind(protoFunction.bind)\n : bindPolyfill;\nfunction curry(func) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n return function () {\n return func.apply(this, args.concat(nativeSlice.call(arguments)));\n };\n}\nexport { curry };\nexport function isArray(value) {\n if (Array.isArray) {\n return Array.isArray(value);\n }\n return objToString.call(value) === '[object Array]';\n}\nexport function isFunction(value) {\n return typeof value === 'function';\n}\nexport function isString(value) {\n return typeof value === 'string';\n}\nexport function isStringSafe(value) {\n return objToString.call(value) === '[object String]';\n}\nexport function isNumber(value) {\n return typeof value === 'number';\n}\nexport function isObject(value) {\n var type = typeof value;\n return type === 'function' || (!!value && type === 'object');\n}\nexport function isBuiltInObject(value) {\n return !!BUILTIN_OBJECT[objToString.call(value)];\n}\nexport function isTypedArray(value) {\n return !!TYPED_ARRAY[objToString.call(value)];\n}\nexport function isDom(value) {\n return typeof value === 'object'\n && typeof value.nodeType === 'number'\n && typeof value.ownerDocument === 'object';\n}\nexport function isGradientObject(value) {\n return value.colorStops != null;\n}\nexport function isImagePatternObject(value) {\n return value.image != null;\n}\nexport function isRegExp(value) {\n return objToString.call(value) === '[object RegExp]';\n}\nexport function eqNaN(value) {\n return value !== value;\n}\nexport function retrieve() {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n for (var i = 0, len = args.length; i < len; i++) {\n if (args[i] != null) {\n return args[i];\n }\n }\n}\nexport function retrieve2(value0, value1) {\n return value0 != null\n ? value0\n : value1;\n}\nexport function retrieve3(value0, value1, value2) {\n return value0 != null\n ? value0\n : value1 != null\n ? value1\n : value2;\n}\nexport function slice(arr) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n return nativeSlice.apply(arr, args);\n}\nexport function normalizeCssArray(val) {\n if (typeof (val) === 'number') {\n return [val, val, val, val];\n }\n var len = val.length;\n if (len === 2) {\n return [val[0], val[1], val[0], val[1]];\n }\n else if (len === 3) {\n return [val[0], val[1], val[2], val[1]];\n }\n return val;\n}\nexport function assert(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}\nexport function trim(str) {\n if (str == null) {\n return null;\n }\n else if (typeof str.trim === 'function') {\n return str.trim();\n }\n else {\n return str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n }\n}\nvar primitiveKey = '__ec_primitive__';\nexport function setAsPrimitive(obj) {\n obj[primitiveKey] = true;\n}\nexport function isPrimitive(obj) {\n return obj[primitiveKey];\n}\nvar HashMap = (function () {\n function HashMap(obj) {\n this.data = {};\n var isArr = isArray(obj);\n this.data = {};\n var thisMap = this;\n (obj instanceof HashMap)\n ? obj.each(visit)\n : (obj && each(obj, visit));\n function visit(value, key) {\n isArr ? thisMap.set(value, key) : thisMap.set(key, value);\n }\n }\n HashMap.prototype.get = function (key) {\n return this.data.hasOwnProperty(key) ? this.data[key] : null;\n };\n HashMap.prototype.set = function (key, value) {\n return (this.data[key] = value);\n };\n HashMap.prototype.each = function (cb, context) {\n for (var key in this.data) {\n if (this.data.hasOwnProperty(key)) {\n cb.call(context, this.data[key], key);\n }\n }\n };\n HashMap.prototype.keys = function () {\n return keys(this.data);\n };\n HashMap.prototype.removeKey = function (key) {\n delete this.data[key];\n };\n return HashMap;\n}());\nexport { HashMap };\nexport function createHashMap(obj) {\n return new HashMap(obj);\n}\nexport function concatArray(a, b) {\n var newArray = new a.constructor(a.length + b.length);\n for (var i = 0; i < a.length; i++) {\n newArray[i] = a[i];\n }\n var offset = a.length;\n for (var i = 0; i < b.length; i++) {\n newArray[i + offset] = b[i];\n }\n return newArray;\n}\nexport function createObject(proto, properties) {\n var obj;\n if (Object.create) {\n obj = Object.create(proto);\n }\n else {\n var StyleCtor = function () { };\n StyleCtor.prototype = proto;\n obj = new StyleCtor();\n }\n if (properties) {\n extend(obj, properties);\n }\n return obj;\n}\nexport function hasOwn(own, prop) {\n return own.hasOwnProperty(prop);\n}\nexport function noop() { }\n","import Clip from './Clip';\nimport * as color from '../tool/color';\nimport { isArrayLike, keys, logError } from '../core/util';\nvar arraySlice = Array.prototype.slice;\nexport function interpolateNumber(p0, p1, percent) {\n return (p1 - p0) * percent + p0;\n}\nexport function step(p0, p1, percent) {\n return percent > 0.5 ? p1 : p0;\n}\nexport function interpolate1DArray(out, p0, p1, percent) {\n var len = p0.length;\n for (var i = 0; i < len; i++) {\n out[i] = interpolateNumber(p0[i], p1[i], percent);\n }\n}\nexport function interpolate2DArray(out, p0, p1, percent) {\n var len = p0.length;\n var len2 = len && p0[0].length;\n for (var i = 0; i < len; i++) {\n if (!out[i]) {\n out[i] = [];\n }\n for (var j = 0; j < len2; j++) {\n out[i][j] = interpolateNumber(p0[i][j], p1[i][j], percent);\n }\n }\n}\nfunction add1DArray(out, p0, p1, sign) {\n var len = p0.length;\n for (var i = 0; i < len; i++) {\n out[i] = p0[i] + p1[i] * sign;\n }\n return out;\n}\nfunction add2DArray(out, p0, p1, sign) {\n var len = p0.length;\n var len2 = len && p0[0].length;\n for (var i = 0; i < len; i++) {\n if (!out[i]) {\n out[i] = [];\n }\n for (var j = 0; j < len2; j++) {\n out[i][j] = p0[i][j] + p1[i][j] * sign;\n }\n }\n return out;\n}\nfunction fillArray(val0, val1, arrDim) {\n var arr0 = val0;\n var arr1 = val1;\n if (!arr0.push || !arr1.push) {\n return;\n }\n var arr0Len = arr0.length;\n var arr1Len = arr1.length;\n if (arr0Len !== arr1Len) {\n var isPreviousLarger = arr0Len > arr1Len;\n if (isPreviousLarger) {\n arr0.length = arr1Len;\n }\n else {\n for (var i = arr0Len; i < arr1Len; i++) {\n arr0.push(arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i]));\n }\n }\n }\n var len2 = arr0[0] && arr0[0].length;\n for (var i = 0; i < arr0.length; i++) {\n if (arrDim === 1) {\n if (isNaN(arr0[i])) {\n arr0[i] = arr1[i];\n }\n }\n else {\n for (var j = 0; j < len2; j++) {\n if (isNaN(arr0[i][j])) {\n arr0[i][j] = arr1[i][j];\n }\n }\n }\n }\n}\nfunction is1DArraySame(arr0, arr1) {\n var len = arr0.length;\n if (len !== arr1.length) {\n return false;\n }\n for (var i = 0; i < len; i++) {\n if (arr0[i] !== arr1[i]) {\n return false;\n }\n }\n return true;\n}\nfunction is2DArraySame(arr0, arr1) {\n var len = arr0.length;\n if (len !== arr1.length) {\n return false;\n }\n var len2 = arr0[0].length;\n for (var i = 0; i < len; i++) {\n for (var j = 0; j < len2; j++) {\n if (arr0[i][j] !== arr1[i][j]) {\n return false;\n }\n }\n }\n return true;\n}\nfunction catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {\n var v0 = (p2 - p0) * 0.5;\n var v1 = (p3 - p1) * 0.5;\n return (2 * (p1 - p2) + v0 + v1) * t3\n + (-3 * (p1 - p2) - 2 * v0 - v1) * t2\n + v0 * t + p1;\n}\nfunction catmullRomInterpolate1DArray(out, p0, p1, p2, p3, t, t2, t3) {\n var len = p0.length;\n for (var i = 0; i < len; i++) {\n out[i] = catmullRomInterpolate(p0[i], p1[i], p2[i], p3[i], t, t2, t3);\n }\n}\nfunction catmullRomInterpolate2DArray(out, p0, p1, p2, p3, t, t2, t3) {\n var len = p0.length;\n var len2 = p0[0].length;\n for (var i = 0; i < len; i++) {\n if (!out[i]) {\n out[1] = [];\n }\n for (var j = 0; j < len2; j++) {\n out[i][j] = catmullRomInterpolate(p0[i][j], p1[i][j], p2[i][j], p3[i][j], t, t2, t3);\n }\n }\n}\nexport function cloneValue(value) {\n if (isArrayLike(value)) {\n var len = value.length;\n if (isArrayLike(value[0])) {\n var ret = [];\n for (var i = 0; i < len; i++) {\n ret.push(arraySlice.call(value[i]));\n }\n return ret;\n }\n return arraySlice.call(value);\n }\n return value;\n}\nfunction rgba2String(rgba) {\n rgba[0] = Math.floor(rgba[0]);\n rgba[1] = Math.floor(rgba[1]);\n rgba[2] = Math.floor(rgba[2]);\n return 'rgba(' + rgba.join(',') + ')';\n}\nfunction guessArrayDim(value) {\n return isArrayLike(value && value[0]) ? 2 : 1;\n}\nvar tmpRgba = [0, 0, 0, 0];\nvar Track = (function () {\n function Track(propName) {\n this.keyframes = [];\n this.maxTime = 0;\n this.arrDim = 0;\n this.interpolable = true;\n this._needsSort = false;\n this._isAllValueEqual = true;\n this._lastFrame = 0;\n this._lastFramePercent = 0;\n this.propName = propName;\n }\n Track.prototype.isFinished = function () {\n return this._finished;\n };\n Track.prototype.setFinished = function () {\n this._finished = true;\n if (this._additiveTrack) {\n this._additiveTrack.setFinished();\n }\n };\n Track.prototype.needsAnimate = function () {\n return !this._isAllValueEqual && this.keyframes.length >= 2 && this.interpolable;\n };\n Track.prototype.getAdditiveTrack = function () {\n return this._additiveTrack;\n };\n Track.prototype.addKeyframe = function (time, value) {\n if (time >= this.maxTime) {\n this.maxTime = time;\n }\n else {\n this._needsSort = true;\n }\n var keyframes = this.keyframes;\n var len = keyframes.length;\n if (this.interpolable) {\n if (isArrayLike(value)) {\n var arrayDim = guessArrayDim(value);\n if (len > 0 && this.arrDim !== arrayDim) {\n this.interpolable = false;\n return;\n }\n if (arrayDim === 1 && typeof value[0] !== 'number'\n || arrayDim === 2 && typeof value[0][0] !== 'number') {\n this.interpolable = false;\n return;\n }\n if (len > 0) {\n var lastFrame = keyframes[len - 1];\n if (this._isAllValueEqual) {\n if (arrayDim === 1) {\n if (!is1DArraySame(value, lastFrame.value)) {\n this._isAllValueEqual = false;\n }\n }\n else {\n this._isAllValueEqual = false;\n }\n }\n }\n this.arrDim = arrayDim;\n }\n else {\n if (this.arrDim > 0) {\n this.interpolable = false;\n return;\n }\n if (typeof value === 'string') {\n var colorArray = color.parse(value);\n if (colorArray) {\n value = colorArray;\n this.isValueColor = true;\n }\n else {\n this.interpolable = false;\n }\n }\n else if (typeof value !== 'number' || isNaN(value)) {\n this.interpolable = false;\n return;\n }\n if (this._isAllValueEqual && len > 0) {\n var lastFrame = keyframes[len - 1];\n if (this.isValueColor && !is1DArraySame(lastFrame.value, value)) {\n this._isAllValueEqual = false;\n }\n else if (lastFrame.value !== value) {\n this._isAllValueEqual = false;\n }\n }\n }\n }\n var kf = {\n time: time,\n value: value,\n percent: 0\n };\n this.keyframes.push(kf);\n return kf;\n };\n Track.prototype.prepare = function (additiveTrack) {\n var kfs = this.keyframes;\n if (this._needsSort) {\n kfs.sort(function (a, b) {\n return a.time - b.time;\n });\n }\n var arrDim = this.arrDim;\n var kfsLen = kfs.length;\n var lastKf = kfs[kfsLen - 1];\n for (var i = 0; i < kfsLen; i++) {\n kfs[i].percent = kfs[i].time / this.maxTime;\n if (arrDim > 0 && i !== kfsLen - 1) {\n fillArray(kfs[i].value, lastKf.value, arrDim);\n }\n }\n if (additiveTrack\n && this.needsAnimate()\n && additiveTrack.needsAnimate()\n && arrDim === additiveTrack.arrDim\n && this.isValueColor === additiveTrack.isValueColor\n && !additiveTrack._finished) {\n this._additiveTrack = additiveTrack;\n var startValue = kfs[0].value;\n for (var i = 0; i < kfsLen; i++) {\n if (arrDim === 0) {\n if (this.isValueColor) {\n kfs[i].additiveValue\n = add1DArray([], kfs[i].value, startValue, -1);\n }\n else {\n kfs[i].additiveValue = kfs[i].value - startValue;\n }\n }\n else if (arrDim === 1) {\n kfs[i].additiveValue = add1DArray([], kfs[i].value, startValue, -1);\n }\n else if (arrDim === 2) {\n kfs[i].additiveValue = add2DArray([], kfs[i].value, startValue, -1);\n }\n }\n }\n };\n Track.prototype.step = function (target, percent) {\n if (this._finished) {\n return;\n }\n if (this._additiveTrack && this._additiveTrack._finished) {\n this._additiveTrack = null;\n }\n var isAdditive = this._additiveTrack != null;\n var valueKey = isAdditive ? 'additiveValue' : 'value';\n var keyframes = this.keyframes;\n var kfsNum = this.keyframes.length;\n var propName = this.propName;\n var arrDim = this.arrDim;\n var isValueColor = this.isValueColor;\n var frameIdx;\n if (percent < 0) {\n frameIdx = 0;\n }\n else if (percent < this._lastFramePercent) {\n var start = Math.min(this._lastFrame + 1, kfsNum - 1);\n for (frameIdx = start; frameIdx >= 0; frameIdx--) {\n if (keyframes[frameIdx].percent <= percent) {\n break;\n }\n }\n frameIdx = Math.min(frameIdx, kfsNum - 2);\n }\n else {\n for (frameIdx = this._lastFrame; frameIdx < kfsNum; frameIdx++) {\n if (keyframes[frameIdx].percent > percent) {\n break;\n }\n }\n frameIdx = Math.min(frameIdx - 1, kfsNum - 2);\n }\n var nextFrame = keyframes[frameIdx + 1];\n var frame = keyframes[frameIdx];\n if (!(frame && nextFrame)) {\n return;\n }\n this._lastFrame = frameIdx;\n this._lastFramePercent = percent;\n var range = (nextFrame.percent - frame.percent);\n if (range === 0) {\n return;\n }\n var w = (percent - frame.percent) / range;\n var targetArr = isAdditive ? this._additiveValue\n : (isValueColor ? tmpRgba : target[propName]);\n if ((arrDim > 0 || isValueColor) && !targetArr) {\n targetArr = this._additiveValue = [];\n }\n if (this.useSpline) {\n var p1 = keyframes[frameIdx][valueKey];\n var p0 = keyframes[frameIdx === 0 ? frameIdx : frameIdx - 1][valueKey];\n var p2 = keyframes[frameIdx > kfsNum - 2 ? kfsNum - 1 : frameIdx + 1][valueKey];\n var p3 = keyframes[frameIdx > kfsNum - 3 ? kfsNum - 1 : frameIdx + 2][valueKey];\n if (arrDim > 0) {\n arrDim === 1\n ? catmullRomInterpolate1DArray(targetArr, p0, p1, p2, p3, w, w * w, w * w * w)\n : catmullRomInterpolate2DArray(targetArr, p0, p1, p2, p3, w, w * w, w * w * w);\n }\n else if (isValueColor) {\n catmullRomInterpolate1DArray(targetArr, p0, p1, p2, p3, w, w * w, w * w * w);\n if (!isAdditive) {\n target[propName] = rgba2String(targetArr);\n }\n }\n else {\n var value = void 0;\n if (!this.interpolable) {\n value = p2;\n }\n else {\n value = catmullRomInterpolate(p0, p1, p2, p3, w, w * w, w * w * w);\n }\n if (isAdditive) {\n this._additiveValue = value;\n }\n else {\n target[propName] = value;\n }\n }\n }\n else {\n if (arrDim > 0) {\n arrDim === 1\n ? interpolate1DArray(targetArr, frame[valueKey], nextFrame[valueKey], w)\n : interpolate2DArray(targetArr, frame[valueKey], nextFrame[valueKey], w);\n }\n else if (isValueColor) {\n interpolate1DArray(targetArr, frame[valueKey], nextFrame[valueKey], w);\n if (!isAdditive) {\n target[propName] = rgba2String(targetArr);\n }\n }\n else {\n var value = void 0;\n if (!this.interpolable) {\n value = step(frame[valueKey], nextFrame[valueKey], w);\n }\n else {\n value = interpolateNumber(frame[valueKey], nextFrame[valueKey], w);\n }\n if (isAdditive) {\n this._additiveValue = value;\n }\n else {\n target[propName] = value;\n }\n }\n }\n if (isAdditive) {\n this._addToTarget(target);\n }\n };\n Track.prototype._addToTarget = function (target) {\n var arrDim = this.arrDim;\n var propName = this.propName;\n var additiveValue = this._additiveValue;\n if (arrDim === 0) {\n if (this.isValueColor) {\n color.parse(target[propName], tmpRgba);\n add1DArray(tmpRgba, tmpRgba, additiveValue, 1);\n target[propName] = rgba2String(tmpRgba);\n }\n else {\n target[propName] = target[propName] + additiveValue;\n }\n }\n else if (arrDim === 1) {\n add1DArray(target[propName], target[propName], additiveValue, 1);\n }\n else if (arrDim === 2) {\n add2DArray(target[propName], target[propName], additiveValue, 1);\n }\n };\n return Track;\n}());\nvar Animator = (function () {\n function Animator(target, loop, additiveTo) {\n this._tracks = {};\n this._trackKeys = [];\n this._delay = 0;\n this._maxTime = 0;\n this._paused = false;\n this._started = 0;\n this._clip = null;\n this._target = target;\n this._loop = loop;\n if (loop && additiveTo) {\n logError('Can\\' use additive animation on looped animation.');\n return;\n }\n this._additiveAnimators = additiveTo;\n }\n Animator.prototype.getTarget = function () {\n return this._target;\n };\n Animator.prototype.changeTarget = function (target) {\n this._target = target;\n };\n Animator.prototype.when = function (time, props) {\n return this.whenWithKeys(time, props, keys(props));\n };\n Animator.prototype.whenWithKeys = function (time, props, propNames) {\n var tracks = this._tracks;\n for (var i = 0; i < propNames.length; i++) {\n var propName = propNames[i];\n var track = tracks[propName];\n if (!track) {\n track = tracks[propName] = new Track(propName);\n var initialValue = void 0;\n var additiveTrack = this._getAdditiveTrack(propName);\n if (additiveTrack) {\n var lastFinalKf = additiveTrack.keyframes[additiveTrack.keyframes.length - 1];\n initialValue = lastFinalKf && lastFinalKf.value;\n if (additiveTrack.isValueColor && initialValue) {\n initialValue = rgba2String(initialValue);\n }\n }\n else {\n initialValue = this._target[propName];\n }\n if (initialValue == null) {\n continue;\n }\n if (time !== 0) {\n track.addKeyframe(0, cloneValue(initialValue));\n }\n this._trackKeys.push(propName);\n }\n track.addKeyframe(time, cloneValue(props[propName]));\n }\n this._maxTime = Math.max(this._maxTime, time);\n return this;\n };\n Animator.prototype.pause = function () {\n this._clip.pause();\n this._paused = true;\n };\n Animator.prototype.resume = function () {\n this._clip.resume();\n this._paused = false;\n };\n Animator.prototype.isPaused = function () {\n return !!this._paused;\n };\n Animator.prototype._doneCallback = function () {\n this._setTracksFinished();\n this._clip = null;\n var doneList = this._doneList;\n if (doneList) {\n var len = doneList.length;\n for (var i = 0; i < len; i++) {\n doneList[i].call(this);\n }\n }\n };\n Animator.prototype._abortedCallback = function () {\n this._setTracksFinished();\n var animation = this.animation;\n var abortedList = this._abortedList;\n if (animation) {\n animation.removeClip(this._clip);\n }\n this._clip = null;\n if (abortedList) {\n for (var i = 0; i < abortedList.length; i++) {\n abortedList[i].call(this);\n }\n }\n };\n Animator.prototype._setTracksFinished = function () {\n var tracks = this._tracks;\n var tracksKeys = this._trackKeys;\n for (var i = 0; i < tracksKeys.length; i++) {\n tracks[tracksKeys[i]].setFinished();\n }\n };\n Animator.prototype._getAdditiveTrack = function (trackName) {\n var additiveTrack;\n var additiveAnimators = this._additiveAnimators;\n if (additiveAnimators) {\n for (var i = 0; i < additiveAnimators.length; i++) {\n var track = additiveAnimators[i].getTrack(trackName);\n if (track) {\n additiveTrack = track;\n }\n }\n }\n return additiveTrack;\n };\n Animator.prototype.start = function (easing, forceAnimate) {\n if (this._started > 0) {\n return;\n }\n this._started = 1;\n var self = this;\n var tracks = [];\n for (var i = 0; i < this._trackKeys.length; i++) {\n var propName = this._trackKeys[i];\n var track = this._tracks[propName];\n var additiveTrack = this._getAdditiveTrack(propName);\n var kfs = track.keyframes;\n track.prepare(additiveTrack);\n if (track.needsAnimate()) {\n tracks.push(track);\n }\n else if (!track.interpolable) {\n var lastKf = kfs[kfs.length - 1];\n if (lastKf) {\n self._target[track.propName] = lastKf.value;\n }\n }\n }\n if (tracks.length || forceAnimate) {\n var clip = new Clip({\n life: this._maxTime,\n loop: this._loop,\n delay: this._delay,\n onframe: function (percent) {\n self._started = 2;\n var additiveAnimators = self._additiveAnimators;\n if (additiveAnimators) {\n var stillHasAdditiveAnimator = false;\n for (var i = 0; i < additiveAnimators.length; i++) {\n if (additiveAnimators[i]._clip) {\n stillHasAdditiveAnimator = true;\n break;\n }\n }\n if (!stillHasAdditiveAnimator) {\n self._additiveAnimators = null;\n }\n }\n for (var i = 0; i < tracks.length; i++) {\n tracks[i].step(self._target, percent);\n }\n var onframeList = self._onframeList;\n if (onframeList) {\n for (var i = 0; i < onframeList.length; i++) {\n onframeList[i](self._target, percent);\n }\n }\n },\n ondestroy: function () {\n self._doneCallback();\n }\n });\n this._clip = clip;\n if (this.animation) {\n this.animation.addClip(clip);\n }\n if (easing && easing !== 'spline') {\n clip.easing = easing;\n }\n }\n else {\n this._doneCallback();\n }\n return this;\n };\n Animator.prototype.stop = function (forwardToLast) {\n if (!this._clip) {\n return;\n }\n var clip = this._clip;\n if (forwardToLast) {\n clip.onframe(1);\n }\n this._abortedCallback();\n };\n Animator.prototype.delay = function (time) {\n this._delay = time;\n return this;\n };\n Animator.prototype.during = function (cb) {\n if (cb) {\n if (!this._onframeList) {\n this._onframeList = [];\n }\n this._onframeList.push(cb);\n }\n return this;\n };\n Animator.prototype.done = function (cb) {\n if (cb) {\n if (!this._doneList) {\n this._doneList = [];\n }\n this._doneList.push(cb);\n }\n return this;\n };\n Animator.prototype.aborted = function (cb) {\n if (cb) {\n if (!this._abortedList) {\n this._abortedList = [];\n }\n this._abortedList.push(cb);\n }\n return this;\n };\n Animator.prototype.getClip = function () {\n return this._clip;\n };\n Animator.prototype.getTrack = function (propName) {\n return this._tracks[propName];\n };\n Animator.prototype.stopTracks = function (propNames, forwardToLast) {\n if (!propNames.length || !this._clip) {\n return true;\n }\n var tracks = this._tracks;\n var tracksKeys = this._trackKeys;\n for (var i = 0; i < propNames.length; i++) {\n var track = tracks[propNames[i]];\n if (track) {\n if (forwardToLast) {\n track.step(this._target, 1);\n }\n else if (this._started === 1) {\n track.step(this._target, 0);\n }\n track.setFinished();\n }\n }\n var allAborted = true;\n for (var i = 0; i < tracksKeys.length; i++) {\n if (!tracks[tracksKeys[i]].isFinished()) {\n allAborted = false;\n break;\n }\n }\n if (allAborted) {\n this._abortedCallback();\n }\n return allAborted;\n };\n Animator.prototype.saveFinalToTarget = function (target, trackKeys) {\n if (!target) {\n return;\n }\n trackKeys = trackKeys || this._trackKeys;\n for (var i = 0; i < trackKeys.length; i++) {\n var propName = trackKeys[i];\n var track = this._tracks[propName];\n if (!track || track.isFinished()) {\n continue;\n }\n var kfs = track.keyframes;\n var lastKf = kfs[kfs.length - 1];\n if (lastKf) {\n var val = cloneValue(lastKf.value);\n if (track.isValueColor) {\n val = rgba2String(val);\n }\n target[propName] = val;\n }\n }\n };\n Animator.prototype.__changeFinalValue = function (finalProps, trackKeys) {\n trackKeys = trackKeys || keys(finalProps);\n for (var i = 0; i < trackKeys.length; i++) {\n var propName = trackKeys[i];\n var track = this._tracks[propName];\n if (!track) {\n continue;\n }\n var kfs = track.keyframes;\n if (kfs.length > 1) {\n var lastKf = kfs.pop();\n track.addKeyframe(lastKf.time, finalProps[propName]);\n track.prepare(track.getAdditiveTrack());\n }\n }\n };\n return Animator;\n}());\nexport default Animator;\n","import Animator from 'zrender/lib/animation/Animator';\n\nvar animatableMixin = {\n\n _animators: null,\n\n getAnimators: function () {\n this._animators = this._animators || [];\n\n return this._animators;\n },\n\n animate: function (path, opts) {\n this._animators = this._animators || [];\n\n var el = this;\n\n var target;\n\n if (path) {\n var pathSplitted = path.split('.');\n var prop = el;\n for (var i = 0, l = pathSplitted.length; i < l; i++) {\n if (!prop) {\n continue;\n }\n prop = prop[pathSplitted[i]];\n }\n if (prop) {\n target = prop;\n }\n }\n else {\n target = el;\n }\n if (target == null) {\n throw new Error('Target ' + path + ' not exists');\n }\n\n var animators = this._animators;\n\n var animator = new Animator(target, opts);\n var self = this;\n animator.during(function () {\n if (self.__zr) {\n self.__zr.refresh();\n }\n }).done(function () {\n var idx = animators.indexOf(animator);\n if (idx >= 0) {\n animators.splice(idx, 1);\n }\n });\n animators.push(animator);\n\n if (this.__zr) {\n this.__zr.animation.addAnimator(animator);\n }\n\n return animator;\n },\n\n stopAnimation: function (forwardToLast) {\n this._animators = this._animators || [];\n\n var animators = this._animators;\n var len = animators.length;\n for (var i = 0; i < len; i++) {\n animators[i].stop(forwardToLast);\n }\n animators.length = 0;\n\n return this;\n },\n\n addAnimatorsToZr: function (zr) {\n if (this._animators) {\n for (var i = 0; i < this._animators.length; i++) {\n zr.animation.addAnimator(this._animators[i]);\n }\n }\n },\n\n removeAnimatorsFromZr: function (zr) {\n if (this._animators) {\n for (var i = 0; i < this._animators.length; i++) {\n zr.animation.removeAnimator(this._animators[i]);\n }\n }\n }\n};\n\nexport default animatableMixin;","export default \"\\n@export clay.util.rand\\nhighp float rand(vec2 uv) {\\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\\n highp float dt = dot(uv.xy, vec2(a,b)), sn = mod(dt, 3.141592653589793);\\n return fract(sin(sn) * c);\\n}\\n@end\\n@export clay.util.calculate_attenuation\\nuniform float attenuationFactor : 5.0;\\nfloat lightAttenuation(float dist, float range)\\n{\\n float attenuation = 1.0;\\n attenuation = dist*dist/(range*range+1.0);\\n float att_s = attenuationFactor;\\n attenuation = 1.0/(attenuation*att_s+1.0);\\n att_s = 1.0/(att_s+1.0);\\n attenuation = attenuation - att_s;\\n attenuation /= 1.0 - att_s;\\n return clamp(attenuation, 0.0, 1.0);\\n}\\n@end\\n@export clay.util.edge_factor\\n#ifdef SUPPORT_STANDARD_DERIVATIVES\\nfloat edgeFactor(float width)\\n{\\n vec3 d = fwidth(v_Barycentric);\\n vec3 a3 = smoothstep(vec3(0.0), d * width, v_Barycentric);\\n return min(min(a3.x, a3.y), a3.z);\\n}\\n#else\\nfloat edgeFactor(float width)\\n{\\n return 1.0;\\n}\\n#endif\\n@end\\n@export clay.util.encode_float\\nvec4 encodeFloat(const in float depth)\\n{\\n const vec4 bitShifts = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\\n const vec4 bit_mask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\\n vec4 res = fract(depth * bitShifts);\\n res -= res.xxyz * bit_mask;\\n return res;\\n}\\n@end\\n@export clay.util.decode_float\\nfloat decodeFloat(const in vec4 color)\\n{\\n const vec4 bitShifts = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);\\n return dot(color, bitShifts);\\n}\\n@end\\n@export clay.util.float\\n@import clay.util.encode_float\\n@import clay.util.decode_float\\n@end\\n@export clay.util.rgbm_decode\\nvec3 RGBMDecode(vec4 rgbm, float range) {\\n return range * rgbm.rgb * rgbm.a;\\n}\\n@end\\n@export clay.util.rgbm_encode\\nvec4 RGBMEncode(vec3 color, float range) {\\n if (dot(color, color) == 0.0) {\\n return vec4(0.0);\\n }\\n vec4 rgbm;\\n color /= range;\\n rgbm.a = clamp(max(max(color.r, color.g), max(color.b, 1e-6)), 0.0, 1.0);\\n rgbm.a = ceil(rgbm.a * 255.0) / 255.0;\\n rgbm.rgb = color / rgbm.a;\\n return rgbm;\\n}\\n@end\\n@export clay.util.rgbm\\n@import clay.util.rgbm_decode\\n@import clay.util.rgbm_encode\\nvec4 decodeHDR(vec4 color)\\n{\\n#if defined(RGBM_DECODE) || defined(RGBM)\\n return vec4(RGBMDecode(color, 8.12), 1.0);\\n#else\\n return color;\\n#endif\\n}\\nvec4 encodeHDR(vec4 color)\\n{\\n#if defined(RGBM_ENCODE) || defined(RGBM)\\n return RGBMEncode(color.xyz, 8.12);\\n#else\\n return color;\\n#endif\\n}\\n@end\\n@export clay.util.srgb\\nvec4 sRGBToLinear(in vec4 value) {\\n return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.w);\\n}\\nvec4 linearTosRGB(in vec4 value) {\\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\\n}\\n@end\\n@export clay.chunk.skinning_header\\n#ifdef SKINNING\\nattribute vec3 weight : WEIGHT;\\nattribute vec4 joint : JOINT;\\n#ifdef USE_SKIN_MATRICES_TEXTURE\\nuniform sampler2D skinMatricesTexture : ignore;\\nuniform float skinMatricesTextureSize: ignore;\\nmat4 getSkinMatrix(sampler2D tex, float idx) {\\n float j = idx * 4.0;\\n float x = mod(j, skinMatricesTextureSize);\\n float y = floor(j / skinMatricesTextureSize) + 0.5;\\n vec2 scale = vec2(skinMatricesTextureSize);\\n return mat4(\\n texture2D(tex, vec2(x + 0.5, y) / scale),\\n texture2D(tex, vec2(x + 1.5, y) / scale),\\n texture2D(tex, vec2(x + 2.5, y) / scale),\\n texture2D(tex, vec2(x + 3.5, y) / scale)\\n );\\n}\\nmat4 getSkinMatrix(float idx) {\\n return getSkinMatrix(skinMatricesTexture, idx);\\n}\\n#else\\nuniform mat4 skinMatrix[JOINT_COUNT] : SKIN_MATRIX;\\nmat4 getSkinMatrix(float idx) {\\n return skinMatrix[int(idx)];\\n}\\n#endif\\n#endif\\n@end\\n@export clay.chunk.skin_matrix\\nmat4 skinMatrixWS = getSkinMatrix(joint.x) * weight.x;\\nif (weight.y > 1e-4)\\n{\\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\\n}\\nif (weight.z > 1e-4)\\n{\\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\\n}\\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\\nif (weightW > 1e-4)\\n{\\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\\n}\\n@end\\n@export clay.chunk.instancing_header\\n#ifdef INSTANCING\\nattribute vec4 instanceMat1;\\nattribute vec4 instanceMat2;\\nattribute vec4 instanceMat3;\\n#endif\\n@end\\n@export clay.chunk.instancing_matrix\\nmat4 instanceMat = mat4(\\n vec4(instanceMat1.xyz, 0.0),\\n vec4(instanceMat2.xyz, 0.0),\\n vec4(instanceMat3.xyz, 0.0),\\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\\n);\\n@end\\n@export clay.util.parallax_correct\\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\\n vec3 first = (boxMax - pos) / dir;\\n vec3 second = (boxMin - pos) / dir;\\n vec3 further = max(first, second);\\n float dist = min(further.x, min(further.y, further.z));\\n vec3 fixedPos = pos + dir * dist;\\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\\n return normalize(fixedPos - boxCenter);\\n}\\n@end\\n@export clay.util.clamp_sample\\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\\n{\\n#ifdef STEREO\\n float eye = step(0.5, coord.x) * 0.5;\\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\\n#else\\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\\n#endif\\n return texture2D(texture, coordClamped);\\n}\\n@end\\n@export clay.util.ACES\\nvec3 ACESToneMapping(vec3 color)\\n{\\n const float A = 2.51;\\n const float B = 0.03;\\n const float C = 2.43;\\n const float D = 0.59;\\n const float E = 0.14;\\n return (color * (A * color + B)) / (color * (C * color + D) + E);\\n}\\n@end\";\n","export default \"\\n@export ecgl.common.transformUniforms\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\\nuniform mat4 world : WORLD;\\n@end\\n\\n@export ecgl.common.attributes\\nattribute vec3 position : POSITION;\\nattribute vec2 texcoord : TEXCOORD_0;\\nattribute vec3 normal : NORMAL;\\n@end\\n\\n@export ecgl.common.uv.header\\nuniform vec2 uvRepeat : [1.0, 1.0];\\nuniform vec2 uvOffset : [0.0, 0.0];\\nuniform vec2 detailUvRepeat : [1.0, 1.0];\\nuniform vec2 detailUvOffset : [0.0, 0.0];\\n\\nvarying vec2 v_Texcoord;\\nvarying vec2 v_DetailTexcoord;\\n@end\\n\\n@export ecgl.common.uv.main\\nv_Texcoord = texcoord * uvRepeat + uvOffset;\\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\\n@end\\n\\n@export ecgl.common.uv.fragmentHeader\\nvarying vec2 v_Texcoord;\\nvarying vec2 v_DetailTexcoord;\\n@end\\n\\n\\n@export ecgl.common.albedo.main\\n\\n vec4 albedoTexel = vec4(1.0);\\n#ifdef DIFFUSEMAP_ENABLED\\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\\n #ifdef SRGB_DECODE\\n albedoTexel = sRGBToLinear(albedoTexel);\\n #endif\\n#endif\\n\\n#ifdef DETAILMAP_ENABLED\\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\\n #ifdef SRGB_DECODE\\n detailTexel = sRGBToLinear(detailTexel);\\n #endif\\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.wireframe.vertexHeader\\n\\n#ifdef WIREFRAME_QUAD\\nattribute vec4 barycentric;\\nvarying vec4 v_Barycentric;\\n#elif defined(WIREFRAME_TRIANGLE)\\nattribute vec3 barycentric;\\nvarying vec3 v_Barycentric;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.wireframe.vertexMain\\n\\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\\n v_Barycentric = barycentric;\\n#endif\\n\\n@end\\n\\n\\n@export ecgl.common.wireframe.fragmentHeader\\n\\nuniform float wireframeLineWidth : 1;\\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\\n\\n#ifdef WIREFRAME_QUAD\\nvarying vec4 v_Barycentric;\\nfloat edgeFactor () {\\n vec4 d = fwidth(v_Barycentric);\\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\\n}\\n#elif defined(WIREFRAME_TRIANGLE)\\nvarying vec3 v_Barycentric;\\nfloat edgeFactor () {\\n vec3 d = fwidth(v_Barycentric);\\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\\n return min(min(a3.x, a3.y), a3.z);\\n}\\n#endif\\n\\n@end\\n\\n\\n@export ecgl.common.wireframe.fragmentMain\\n\\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\\n if (wireframeLineWidth > 0.) {\\n vec4 lineColor = wireframeLineColor;\\n#ifdef SRGB_DECODE\\n lineColor = sRGBToLinear(lineColor);\\n#endif\\n\\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\\n }\\n#endif\\n@end\\n\\n\\n\\n\\n@export ecgl.common.bumpMap.header\\n\\n#ifdef BUMPMAP_ENABLED\\nuniform sampler2D bumpMap;\\nuniform float bumpScale : 1.0;\\n\\n\\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\\n{\\n vec2 dSTdx = dFdx(v_Texcoord);\\n vec2 dSTdy = dFdy(v_Texcoord);\\n\\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\\n\\n vec3 vSigmaX = dFdx(surfPos);\\n vec3 vSigmaY = dFdy(surfPos);\\n vec3 vN = surfNormal;\\n\\n vec3 R1 = cross(vSigmaY, vN);\\n vec3 R2 = cross(vN, vSigmaX);\\n\\n float fDet = dot(vSigmaX, R1);\\n\\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\\n return normalize(abs(fDet) * baseNormal - vGrad);\\n\\n}\\n#endif\\n\\n@end\\n\\n@export ecgl.common.normalMap.vertexHeader\\n\\n#ifdef NORMALMAP_ENABLED\\nattribute vec4 tangent : TANGENT;\\nvarying vec3 v_Tangent;\\nvarying vec3 v_Bitangent;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.normalMap.vertexMain\\n\\n#ifdef NORMALMAP_ENABLED\\n if (dot(tangent, tangent) > 0.0) {\\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\\n }\\n#endif\\n\\n@end\\n\\n\\n@export ecgl.common.normalMap.fragmentHeader\\n\\n#ifdef NORMALMAP_ENABLED\\nuniform sampler2D normalMap;\\nvarying vec3 v_Tangent;\\nvarying vec3 v_Bitangent;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.normalMap.fragmentMain\\n#ifdef NORMALMAP_ENABLED\\n if (dot(v_Tangent, v_Tangent) > 0.0) {\\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\\n N = normalize(tbn * N);\\n }\\n }\\n#endif\\n@end\\n\\n\\n\\n@export ecgl.common.vertexAnimation.header\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nattribute vec3 prevNormal;\\nuniform float percent;\\n#endif\\n\\n@end\\n\\n@export ecgl.common.vertexAnimation.main\\n\\n#ifdef VERTEX_ANIMATION\\n vec3 pos = mix(prevPosition, position, percent);\\n vec3 norm = mix(prevNormal, normal, percent);\\n#else\\n vec3 pos = position;\\n vec3 norm = normal;\\n#endif\\n\\n@end\\n\\n\\n@export ecgl.common.ssaoMap.header\\n#ifdef SSAOMAP_ENABLED\\nuniform sampler2D ssaoMap;\\nuniform vec4 viewport : VIEWPORT;\\n#endif\\n@end\\n\\n@export ecgl.common.ssaoMap.main\\n float ao = 1.0;\\n#ifdef SSAOMAP_ENABLED\\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\\n#endif\\n@end\\n\\n\\n\\n\\n@export ecgl.common.diffuseLayer.header\\n\\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\\n#endif\\n\\n@end\\n\\n@export ecgl.common.emissiveLayer.header\\n\\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\\n#endif\\n\\n@end\\n\\n@export ecgl.common.layers.header\\n@import ecgl.common.diffuseLayer.header\\n@import ecgl.common.emissiveLayer.header\\n@end\\n\\n@export ecgl.common.diffuseLayer.main\\n\\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\\n float intensity = layerDiffuseIntensity[_idx_];\\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\\n #ifdef SRGB_DECODE\\n texel2 = sRGBToLinear(texel2);\\n #endif\\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\\n }}\\n#endif\\n\\n@end\\n\\n@export ecgl.common.emissiveLayer.main\\n\\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\\n {{\\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\\n #ifdef SRGB_DECODE\\n texel2 = sRGBToLinear(texel2);\\n #endif\\n float intensity = layerEmissionIntensity[_idx_];\\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\\n }}\\n#endif\\n\\n@end\\n\";\n","export default \"@export ecgl.color.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\n@import ecgl.common.uv.header\\n\\nattribute vec2 texcoord : TEXCOORD_0;\\nattribute vec3 position: POSITION;\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nuniform float percent : 1.0;\\n#endif\\n\\n#ifdef ATMOSPHERE_ENABLED\\nattribute vec3 normal: NORMAL;\\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\\nvarying vec3 v_Normal;\\n#endif\\n\\nvoid main()\\n{\\n#ifdef VERTEX_ANIMATION\\n vec3 pos = mix(prevPosition, position, percent);\\n#else\\n vec3 pos = position;\\n#endif\\n\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n\\n @import ecgl.common.uv.main\\n\\n#ifdef VERTEX_COLOR\\n v_Color = a_Color;\\n#endif\\n\\n#ifdef ATMOSPHERE_ENABLED\\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\\n#endif\\n\\n @import ecgl.common.wireframe.vertexMain\\n\\n}\\n\\n@end\\n\\n@export ecgl.color.fragment\\n\\n#define LAYER_DIFFUSEMAP_COUNT 0\\n#define LAYER_EMISSIVEMAP_COUNT 0\\n\\nuniform sampler2D diffuseMap;\\nuniform sampler2D detailMap;\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\n#ifdef ATMOSPHERE_ENABLED\\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\\nuniform vec3 glowColor;\\nuniform float glowPower;\\nvarying vec3 v_Normal;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\n@import ecgl.common.layers.header\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color);\\n#else\\n gl_FragColor = color;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\n gl_FragColor *= v_Color;\\n#endif\\n\\n @import ecgl.common.albedo.main\\n\\n @import ecgl.common.diffuseLayer.main\\n\\n gl_FragColor *= albedoTexel;\\n\\n#ifdef ATMOSPHERE_ENABLED\\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\\n gl_FragColor.rgb += glowColor * atmoIntensity;\\n#endif\\n\\n @import ecgl.common.emissiveLayer.main\\n\\n @import ecgl.common.wireframe.fragmentMain\\n\\n}\\n@end\";\n","export default \"/**\\n * http: */\\n\\n@export ecgl.lambert.vertex\\n\\n@import ecgl.common.transformUniforms\\n\\n@import ecgl.common.uv.header\\n\\n\\n@import ecgl.common.attributes\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\n\\n@import ecgl.common.vertexAnimation.header\\n\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nvoid main()\\n{\\n @import ecgl.common.uv.main\\n\\n @import ecgl.common.vertexAnimation.main\\n\\n\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n\\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\\n\\n#ifdef VERTEX_COLOR\\n v_Color = a_Color;\\n#endif\\n\\n @import ecgl.common.wireframe.vertexMain\\n}\\n\\n@end\\n\\n\\n@export ecgl.lambert.fragment\\n\\n#define LAYER_DIFFUSEMAP_COUNT 0\\n#define LAYER_EMISSIVEMAP_COUNT 0\\n\\n#define NORMAL_UP_AXIS 1\\n#define NORMAL_FRONT_AXIS 2\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform sampler2D diffuseMap;\\nuniform sampler2D detailMap;\\n\\n@import ecgl.common.layers.header\\n\\nuniform float emissionIntensity: 1.0;\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nuniform mat4 viewInverse : VIEWINVERSE;\\n\\n#ifdef ATMOSPHERE_ENABLED\\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\\nuniform vec3 glowColor;\\nuniform float glowPower;\\n#endif\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n@import clay.header.ambient_light\\n#endif\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n@import clay.header.ambient_sh_light\\n#endif\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n@import clay.header.directional_light\\n#endif\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\n\\n@import ecgl.common.ssaoMap.header\\n\\n@import ecgl.common.bumpMap.header\\n\\n@import clay.util.srgb\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.plugin.compute_shadow_map\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color);\\n#else\\n gl_FragColor = color;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\n #ifdef SRGB_DECODE\\n gl_FragColor *= sRGBToLinear(v_Color);\\n #else\\n gl_FragColor *= v_Color;\\n #endif\\n#endif\\n\\n @import ecgl.common.albedo.main\\n\\n @import ecgl.common.diffuseLayer.main\\n\\n gl_FragColor *= albedoTexel;\\n\\n vec3 N = v_Normal;\\n#ifdef DOUBLE_SIDED\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(eyePos - v_WorldPosition);\\n\\n if (dot(N, V) < 0.0) {\\n N = -N;\\n }\\n#endif\\n\\n float ambientFactor = 1.0;\\n\\n#ifdef BUMPMAP_ENABLED\\n N = bumpNormal(v_WorldPosition, v_Normal, N);\\n ambientFactor = dot(v_Normal, N);\\n#endif\\n\\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\\n\\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\\n\\n @import ecgl.common.ssaoMap.main\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\\n {\\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\\n }\\n#endif\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\\n {{\\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\\n }}\\n#endif\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\\n if(shadowEnabled)\\n {\\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\\n }\\n#endif\\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\\n {\\n vec3 lightDirection = -directionalLightDirection[i];\\n vec3 lightColor = directionalLightColor[i];\\n\\n float shadowContrib = 1.0;\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n if (shadowEnabled)\\n {\\n shadowContrib = shadowContribsDir[i];\\n }\\n#endif\\n\\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\\n\\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\\n }\\n#endif\\n\\n gl_FragColor.rgb *= diffuseColor;\\n\\n#ifdef ATMOSPHERE_ENABLED\\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\\n gl_FragColor.rgb += glowColor * atmoIntensity;\\n#endif\\n\\n @import ecgl.common.emissiveLayer.main\\n\\n @import ecgl.common.wireframe.fragmentMain\\n}\\n\\n@end\";\n","export default \"@export ecgl.realistic.vertex\\n\\n@import ecgl.common.transformUniforms\\n\\n@import ecgl.common.uv.header\\n\\n@import ecgl.common.attributes\\n\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\n#ifdef NORMALMAP_ENABLED\\nattribute vec4 tangent : TANGENT;\\nvarying vec3 v_Tangent;\\nvarying vec3 v_Bitangent;\\n#endif\\n\\n@import ecgl.common.vertexAnimation.header\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nvoid main()\\n{\\n\\n @import ecgl.common.uv.main\\n\\n @import ecgl.common.vertexAnimation.main\\n\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n\\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\\n\\n#ifdef VERTEX_COLOR\\n v_Color = a_Color;\\n#endif\\n\\n#ifdef NORMALMAP_ENABLED\\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\\n#endif\\n\\n @import ecgl.common.wireframe.vertexMain\\n\\n}\\n\\n@end\\n\\n\\n\\n@export ecgl.realistic.fragment\\n\\n#define LAYER_DIFFUSEMAP_COUNT 0\\n#define LAYER_EMISSIVEMAP_COUNT 0\\n#define PI 3.14159265358979\\n#define ROUGHNESS_CHANEL 0\\n#define METALNESS_CHANEL 1\\n\\n#define NORMAL_UP_AXIS 1\\n#define NORMAL_FRONT_AXIS 2\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform sampler2D diffuseMap;\\n\\nuniform sampler2D detailMap;\\nuniform sampler2D metalnessMap;\\nuniform sampler2D roughnessMap;\\n\\n@import ecgl.common.layers.header\\n\\nuniform float emissionIntensity: 1.0;\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nuniform float metalness : 0.0;\\nuniform float roughness : 0.5;\\n\\nuniform mat4 viewInverse : VIEWINVERSE;\\n\\n#ifdef ATMOSPHERE_ENABLED\\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\\nuniform vec3 glowColor;\\nuniform float glowPower;\\n#endif\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n@import clay.header.ambient_light\\n#endif\\n\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n@import clay.header.ambient_sh_light\\n#endif\\n\\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\\n@import clay.header.ambient_cubemap_light\\n#endif\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n@import clay.header.directional_light\\n#endif\\n\\n@import ecgl.common.normalMap.fragmentHeader\\n\\n@import ecgl.common.ssaoMap.header\\n\\n@import ecgl.common.bumpMap.header\\n\\n@import clay.util.srgb\\n\\n@import clay.util.rgbm\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.plugin.compute_shadow_map\\n\\nvec3 F_Schlick(float ndv, vec3 spec) {\\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\\n}\\n\\nfloat D_Phong(float g, float ndh) {\\n float a = pow(8192.0, g);\\n return (a + 2.0) / 8.0 * pow(ndh, a);\\n}\\n\\nvoid main()\\n{\\n vec4 albedoColor = color;\\n\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(eyePos - v_WorldPosition);\\n#ifdef VERTEX_COLOR\\n #ifdef SRGB_DECODE\\n albedoColor *= sRGBToLinear(v_Color);\\n #else\\n albedoColor *= v_Color;\\n #endif\\n#endif\\n\\n @import ecgl.common.albedo.main\\n\\n @import ecgl.common.diffuseLayer.main\\n\\n albedoColor *= albedoTexel;\\n\\n float m = metalness;\\n\\n#ifdef METALNESSMAP_ENABLED\\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\\n#endif\\n\\n vec3 baseColor = albedoColor.rgb;\\n albedoColor.rgb = baseColor * (1.0 - m);\\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\\n\\n float g = 1.0 - roughness;\\n\\n#ifdef ROUGHNESSMAP_ENABLED\\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\\n#endif\\n\\n vec3 N = v_Normal;\\n\\n#ifdef DOUBLE_SIDED\\n if (dot(N, V) < 0.0) {\\n N = -N;\\n }\\n#endif\\n\\n float ambientFactor = 1.0;\\n\\n#ifdef BUMPMAP_ENABLED\\n N = bumpNormal(v_WorldPosition, v_Normal, N);\\n ambientFactor = dot(v_Normal, N);\\n#endif\\n\\n@import ecgl.common.normalMap.fragmentMain\\n\\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\\n\\n vec3 diffuseTerm = vec3(0.0);\\n vec3 specularTerm = vec3(0.0);\\n\\n float ndv = clamp(dot(N, V), 0.0, 1.0);\\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\\n\\n @import ecgl.common.ssaoMap.main\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\\n {{\\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\\n }}\\n#endif\\n\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\\n {{\\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\\n }}\\n#endif\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\\n if(shadowEnabled)\\n {\\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\\n }\\n#endif\\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\\n {{\\n vec3 L = -directionalLightDirection[_idx_];\\n vec3 lc = directionalLightColor[_idx_];\\n\\n vec3 H = normalize(L + V);\\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\\n float ndh = clamp(dot(N, H), 0.0, 1.0);\\n\\n float shadowContrib = 1.0;\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n if (shadowEnabled)\\n {\\n shadowContrib = shadowContribsDir[_idx_];\\n }\\n#endif\\n\\n vec3 li = lc * ndl * shadowContrib;\\n\\n diffuseTerm += li;\\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\\n }}\\n#endif\\n\\n\\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\\n vec3 L = reflect(-V, N);\\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\\n float bias2 = rough2 * 5.0;\\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\\n vec3 envTexel2;\\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\\n {{\\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\\n }}\\n#endif\\n\\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\\n gl_FragColor.a = albedoColor.a;\\n\\n#ifdef ATMOSPHERE_ENABLED\\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\\n gl_FragColor.rgb += glowColor * atmoIntensity;\\n#endif\\n\\n#ifdef SRGB_ENCODE\\n gl_FragColor = linearTosRGB(gl_FragColor);\\n#endif\\n\\n @import ecgl.common.emissiveLayer.main\\n\\n @import ecgl.common.wireframe.fragmentMain\\n}\\n\\n@end\";\n","export default \"@export ecgl.hatching.vertex\\n\\n@import ecgl.realistic.vertex\\n\\n@end\\n\\n\\n@export ecgl.hatching.fragment\\n\\n#define NORMAL_UP_AXIS 1\\n#define NORMAL_FRONT_AXIS 2\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\\n\\nuniform mat4 viewInverse : VIEWINVERSE;\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n@import clay.header.ambient_light\\n#endif\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n@import clay.header.ambient_sh_light\\n#endif\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n@import clay.header.directional_light\\n#endif\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\n\\n@import ecgl.common.ssaoMap.header\\n\\n@import ecgl.common.bumpMap.header\\n\\n@import clay.util.srgb\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.plugin.compute_shadow_map\\n\\nuniform sampler2D hatch1;\\nuniform sampler2D hatch2;\\nuniform sampler2D hatch3;\\nuniform sampler2D hatch4;\\nuniform sampler2D hatch5;\\nuniform sampler2D hatch6;\\n\\nfloat shade(in float tone) {\\n vec4 c = vec4(1. ,1., 1., 1.);\\n float step = 1. / 6.;\\n vec2 uv = v_DetailTexcoord;\\n if (tone <= step / 2.0) {\\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\\n }\\n else if (tone <= step) {\\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\\n }\\n if(tone > step && tone <= 2. * step){\\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\\n }\\n if(tone > 2. * step && tone <= 3. * step){\\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\\n }\\n if(tone > 3. * step && tone <= 4. * step){\\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\\n }\\n if(tone > 4. * step && tone <= 5. * step){\\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\\n }\\n if(tone > 5. * step){\\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\\n }\\n\\n return c.r;\\n}\\n\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n vec4 inkColor = sRGBToLinear(color);\\n#else\\n vec4 inkColor = color;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\n #ifdef SRGB_DECODE\\n inkColor *= sRGBToLinear(v_Color);\\n #else\\n inkColor *= v_Color;\\n #endif\\n#endif\\n\\n vec3 N = v_Normal;\\n#ifdef DOUBLE_SIDED\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(eyePos - v_WorldPosition);\\n\\n if (dot(N, V) < 0.0) {\\n N = -N;\\n }\\n#endif\\n\\n float tone = 0.0;\\n\\n float ambientFactor = 1.0;\\n\\n#ifdef BUMPMAP_ENABLED\\n N = bumpNormal(v_WorldPosition, v_Normal, N);\\n ambientFactor = dot(v_Normal, N);\\n#endif\\n\\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\\n\\n @import ecgl.common.ssaoMap.main\\n\\n#ifdef AMBIENT_LIGHT_COUNT\\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\\n {\\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\\n }\\n#endif\\n#ifdef AMBIENT_SH_LIGHT_COUNT\\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\\n {{\\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\\n }}\\n#endif\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\\n if(shadowEnabled)\\n {\\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\\n }\\n#endif\\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\\n {\\n vec3 lightDirection = -directionalLightDirection[i];\\n float lightTone = dot(directionalLightColor[i], w);\\n\\n float shadowContrib = 1.0;\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n if (shadowEnabled)\\n {\\n shadowContrib = shadowContribsDir[i];\\n }\\n#endif\\n\\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\\n\\n tone += lightTone * clamp(ndl, 0.0, 1.0);\\n }\\n#endif\\n\\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\\n }\\n@end\\n\";\n","export default \"@export ecgl.sm.depth.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nattribute vec3 position : POSITION;\\nattribute vec2 texcoord : TEXCOORD_0;\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nuniform float percent : 1.0;\\n#endif\\n\\nvarying vec4 v_ViewPosition;\\nvarying vec2 v_Texcoord;\\n\\nvoid main(){\\n\\n#ifdef VERTEX_ANIMATION\\n vec3 pos = mix(prevPosition, position, percent);\\n#else\\n vec3 pos = position;\\n#endif\\n\\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\\n gl_Position = v_ViewPosition;\\n\\n v_Texcoord = texcoord;\\n\\n}\\n@end\\n\\n\\n\\n@export ecgl.sm.depth.fragment\\n\\n@import clay.sm.depth.fragment\\n\\n@end\";\n","import Mesh from 'claygl/src/Mesh';\nimport Renderer from 'claygl/src/Renderer';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Shader from 'claygl/src/Shader';\nimport Material from 'claygl/src/Material';\nimport Node3D from 'claygl/src/Node';\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\nimport Scene from 'claygl/src/Scene';\nimport LRUCache from 'zrender/lib/core/LRU';\nimport textureUtil from 'claygl/src/util/texture';\nimport EChartsSurface from './EChartsSurface';\nimport AmbientCubemapLight from 'claygl/src/light/AmbientCubemap';\nimport AmbientSHLight from 'claygl/src/light/AmbientSH';\nimport shUtil from 'claygl/src/util/sh';\nimport retrieve from './retrieve';\n\nimport SphereGeometry from 'claygl/src/geometry/Sphere';\nimport PlaneGeometry from 'claygl/src/geometry/Plane';\nimport CubeGeometry from 'claygl/src/geometry/Cube';\n\nimport AmbientLight from 'claygl/src/light/Ambient';\nimport DirectionalLight from 'claygl/src/light/Directional';\nimport PointLight from 'claygl/src/light/Point';\nimport SpotLight from 'claygl/src/light/Spot';\n\nimport PerspectiveCamera from 'claygl/src/camera/Perspective';\nimport OrthographicCamera from 'claygl/src/camera/Orthographic';\n\n// Math\nimport Vector2 from 'claygl/src/math/Vector2';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Vector4 from 'claygl/src/math/Vector4';\n\nimport Quaternion from 'claygl/src/math/Quaternion';\n\nimport Matrix2 from 'claygl/src/math/Matrix2';\nimport Matrix2d from 'claygl/src/math/Matrix2d';\nimport Matrix3 from 'claygl/src/math/Matrix3';\nimport Matrix4 from 'claygl/src/math/Matrix4';\n\nimport Plane from 'claygl/src/math/Plane';\nimport Ray from 'claygl/src/math/Ray';\nimport BoundingBox from 'claygl/src/math/BoundingBox';\nimport Frustum from 'claygl/src/math/Frustum';\n\nimport animatableMixin from './animatableMixin';\n// Some common shaders\n\nimport utilGLSL from 'claygl/src/shader/source/util.glsl.js';\nimport prezGLSL from 'claygl/src/shader/source/prez.glsl.js';\nimport commonGLSL from './shader/common.glsl.js';\nimport colorGLSL from './shader/color.glsl.js';\nimport lambertGLSL from './shader/lambert.glsl.js';\nimport realisticGLSL from './shader/realistic.glsl.js';\nimport hatchingGLSL from './shader/hatching.glsl.js';\nimport shadowGLSL from './shader/shadow.glsl.js';\n\nObject.assign(Node3D.prototype, animatableMixin);\n\nShader.import(utilGLSL);\nShader.import(prezGLSL);\nShader.import(commonGLSL);\nShader.import(colorGLSL);\nShader.import(lambertGLSL);\nShader.import(realisticGLSL);\nShader.import(hatchingGLSL);\nShader.import(shadowGLSL);\n\nfunction isValueNone(value) {\n return !value || value === 'none';\n}\n\nfunction isValueImage(value) {\n return value instanceof HTMLCanvasElement\n || value instanceof HTMLImageElement\n || value instanceof Image;\n}\n\nfunction isECharts(value) {\n return value.getZr && value.setOption;\n}\n\n// Overwrite addToScene and removeFromScene\nvar oldAddToScene = Scene.prototype.addToScene;\nvar oldRemoveFromScene = Scene.prototype.removeFromScene;\n\nScene.prototype.addToScene = function (node) {\n oldAddToScene.call(this, node);\n\n if (this.__zr) {\n var zr = this.__zr;\n node.traverse(function (child) {\n child.__zr = zr;\n if (child.addAnimatorsToZr) {\n child.addAnimatorsToZr(zr);\n }\n });\n }\n};\n\nScene.prototype.removeFromScene = function (node) {\n oldRemoveFromScene.call(this, node);\n\n node.traverse(function (child) {\n var zr = child.__zr;\n child.__zr = null;\n if (zr && child.removeAnimatorsFromZr) {\n child.removeAnimatorsFromZr(zr);\n }\n });\n};\n\n/**\n * @param {string} textureName\n * @param {string|HTMLImageElement|HTMLCanvasElement} imgValue\n * @param {module:echarts/ExtensionAPI} api\n * @param {Object} [textureOpts]\n */\nMaterial.prototype.setTextureImage = function (textureName, imgValue, api, textureOpts) {\n if (!this.shader) {\n return;\n }\n\n var zr = api.getZr();\n var material = this;\n var texture;\n material.autoUpdateTextureStatus = false;\n // disableTexture first\n material.disableTexture(textureName);\n if (!isValueNone(imgValue)) {\n texture = graphicGL.loadTexture(imgValue, api, textureOpts, function (texture) {\n material.enableTexture(textureName);\n zr && zr.refresh();\n });\n // Set texture immediately for other code to verify if have this texture.\n material.set(textureName, texture);\n }\n\n return texture;\n};\n\nvar graphicGL = {};\n\ngraphicGL.Renderer = Renderer;\n\ngraphicGL.Node = Node3D;\n\ngraphicGL.Mesh = Mesh;\n\ngraphicGL.Shader = Shader;\n\ngraphicGL.Material = Material;\n\ngraphicGL.Texture = Texture;\n\ngraphicGL.Texture2D = Texture2D;\n\n// Geometries\ngraphicGL.Geometry = Geometry;\ngraphicGL.SphereGeometry = SphereGeometry;\ngraphicGL.PlaneGeometry = PlaneGeometry;\ngraphicGL.CubeGeometry = CubeGeometry;\n\n// Lights\ngraphicGL.AmbientLight = AmbientLight;\ngraphicGL.DirectionalLight = DirectionalLight;\ngraphicGL.PointLight = PointLight;\ngraphicGL.SpotLight = SpotLight;\n\n// Cameras\ngraphicGL.PerspectiveCamera = PerspectiveCamera;\ngraphicGL.OrthographicCamera = OrthographicCamera;\n\n// Math\ngraphicGL.Vector2 = Vector2;\ngraphicGL.Vector3 = Vector3;\ngraphicGL.Vector4 = Vector4;\n\ngraphicGL.Quaternion = Quaternion;\n\ngraphicGL.Matrix2 = Matrix2;\ngraphicGL.Matrix2d = Matrix2d;\ngraphicGL.Matrix3 = Matrix3;\ngraphicGL.Matrix4 = Matrix4;\n\ngraphicGL.Plane = Plane;\ngraphicGL.Ray = Ray;\ngraphicGL.BoundingBox = BoundingBox;\ngraphicGL.Frustum = Frustum;\n\n// Texture utilities\nvar blankImage = null;\n\nfunction getBlankImage() {\n if (blankImage !== null) {\n return blankImage;\n }\n blankImage = textureUtil.createBlank('rgba(255,255,255,0)').image;\n return blankImage;\n}\n\n\nfunction nearestPowerOfTwo(val) {\n return Math.pow(2, Math.round(Math.log(val) / Math.LN2));\n}\nfunction convertTextureToPowerOfTwo(texture) {\n if ((texture.wrapS === Texture.REPEAT || texture.wrapT === Texture.REPEAT) && texture.image) {\n // var canvas = document.createElement('canvas');\n var width = nearestPowerOfTwo(texture.width);\n var height = nearestPowerOfTwo(texture.height);\n if (width !== texture.width || height !== texture.height) {\n var canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n var ctx = canvas.getContext('2d');\n ctx.drawImage(texture.image, 0, 0, width, height);\n texture.image = canvas;\n }\n }\n}\n/**\n * @param {string|HTMLImageElement|HTMLCanvasElement} imgValue\n * @param {module:echarts/ExtensionAPI} api\n * @param {Object} [textureOpts]\n * @param {Function} cb\n */\n// TODO Promise, test\ngraphicGL.loadTexture = function (imgValue, api, textureOpts, cb) {\n if (typeof textureOpts === 'function') {\n cb = textureOpts;\n textureOpts = {};\n }\n textureOpts = textureOpts || {};\n\n var keys = Object.keys(textureOpts).sort();\n var prefix = '';\n for (var i = 0; i < keys.length; i++) {\n prefix += keys[i] + '_' + textureOpts[keys[i]] + '_';\n }\n\n var textureCache = api.__textureCache = api.__textureCache || new LRUCache(20);\n\n if (isECharts(imgValue)) {\n var id = imgValue.__textureid__;\n var textureObj = textureCache.get(prefix + id);\n if (!textureObj) {\n var surface = new EChartsSurface(imgValue);\n surface.onupdate = function () {\n api.getZr().refresh();\n };\n textureObj = {\n texture: surface.getTexture()\n };\n for (var i = 0; i < keys.length; i++) {\n textureObj.texture[keys[i]] = textureOpts[keys[i]];\n }\n id = imgValue.__textureid__ || '__ecgl_ec__' + textureObj.texture.__uid__;\n imgValue.__textureid__ = id;\n textureCache.put(prefix + id, textureObj);\n cb && cb(textureObj.texture);\n }\n else {\n textureObj.texture.surface.setECharts(imgValue);\n\n cb && cb(textureObj.texture);\n }\n return textureObj.texture;\n }\n else if (isValueImage(imgValue)) {\n var id = imgValue.__textureid__;\n var textureObj = textureCache.get(prefix + id);\n if (!textureObj) {\n textureObj = {\n texture: new graphicGL.Texture2D({\n image: imgValue\n })\n };\n for (var i = 0; i < keys.length; i++) {\n textureObj.texture[keys[i]] = textureOpts[keys[i]];\n }\n id = imgValue.__textureid__ || '__ecgl_image__' + textureObj.texture.__uid__;\n imgValue.__textureid__ = id;\n textureCache.put(prefix + id, textureObj);\n\n convertTextureToPowerOfTwo(textureObj.texture);\n // TODO Next tick?\n cb && cb(textureObj.texture);\n }\n return textureObj.texture;\n }\n else {\n var textureObj = textureCache.get(prefix + imgValue);\n if (textureObj) {\n if (textureObj.callbacks) {\n // Add to pending callbacks\n textureObj.callbacks.push(cb);\n }\n else {\n // TODO Next tick?\n cb && cb(textureObj.texture);\n }\n }\n else {\n // Maybe base64\n if (imgValue.match(/.hdr$|^data:application\\/octet-stream/)) {\n textureObj = {\n callbacks: [cb]\n };\n var texture = textureUtil.loadTexture(imgValue, {\n exposure: textureOpts.exposure,\n fileType: 'hdr'\n }, function () {\n texture.dirty();\n textureObj.callbacks.forEach(function (cb) {\n cb && cb(texture);\n });\n textureObj.callbacks = null;\n });\n textureObj.texture = texture;\n textureCache.put(prefix + imgValue, textureObj);\n }\n else {\n var texture = new graphicGL.Texture2D({\n image: new Image()\n });\n for (var i = 0; i < keys.length; i++) {\n texture[keys[i]] = textureOpts[keys[i]];\n }\n\n textureObj = {\n texture: texture,\n callbacks: [cb]\n };\n var originalImage = texture.image;\n originalImage.onload = function () {\n texture.image = originalImage;\n convertTextureToPowerOfTwo(texture);\n\n texture.dirty();\n textureObj.callbacks.forEach(function (cb) {\n cb && cb(texture);\n });\n textureObj.callbacks = null;\n };\n originalImage.crossOrigin = 'Anonymous';\n originalImage.src = imgValue;\n // Use blank image as place holder.\n texture.image = getBlankImage();\n\n textureCache.put(prefix + imgValue, textureObj);\n }\n }\n\n return textureObj.texture;\n }\n};\n\n/**\n * Create ambientCubemap and ambientSH light. respectively to have specular and diffuse light\n * @return {Object} { specular, diffuse }\n */\ngraphicGL.createAmbientCubemap = function (opt, renderer, api, cb) {\n opt = opt || {};\n var textureUrl = opt.texture;\n var exposure = retrieve.firstNotNull(opt.exposure, 1.0);\n\n var ambientCubemap = new AmbientCubemapLight({\n intensity: retrieve.firstNotNull(opt.specularIntensity, 1.0)\n });\n var ambientSH = new AmbientSHLight({\n intensity: retrieve.firstNotNull(opt.diffuseIntensity, 1.0),\n coefficients: [0.844, 0.712, 0.691, -0.037, 0.083, 0.167, 0.343, 0.288, 0.299, -0.041, -0.021, -0.009, -0.003, -0.041, -0.064, -0.011, -0.007, -0.004, -0.031, 0.034, 0.081, -0.060, -0.049, -0.060, 0.046, 0.056, 0.050]\n });\n\n\n ambientCubemap.cubemap = graphicGL.loadTexture(textureUrl, api, {\n exposure: exposure\n }, function () {\n // TODO Performance when multiple view\n ambientCubemap.cubemap.flipY = false;\n if (process.env.NODE_ENV !== 'production') {\n var time = Date.now();\n }\n ambientCubemap.prefilter(renderer, 32);\n if (process.env.NODE_ENV !== 'production') {\n var dTime = Date.now() - time;\n console.log('Prefilter environment map: ' + dTime + 'ms');\n }\n ambientSH.coefficients = shUtil.projectEnvironmentMap(renderer, ambientCubemap.cubemap, {\n lod: 1\n });\n\n cb && cb();\n\n // TODO Refresh ?\n });\n\n return {\n specular: ambientCubemap,\n diffuse: ambientSH\n };\n};\n\n/**\n * Create a blank texture for placeholder\n */\ngraphicGL.createBlankTexture = textureUtil.createBlank;\n\n/**\n * If value is image\n * @param {*}\n * @return {boolean}\n */\ngraphicGL.isImage = isValueImage;\n\ngraphicGL.additiveBlend = function (gl) {\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE);\n};\n\n/**\n * @param {string|Array.} colorStr\n * @param {Array.} [rgba]\n * @return {Array.} rgba\n */\ngraphicGL.parseColor = function (colorStr, rgba) {\n if (colorStr instanceof Array) {\n if (!rgba) {\n rgba = [];\n }\n // Color has been parsed.\n rgba[0] = colorStr[0];\n rgba[1] = colorStr[1];\n rgba[2] = colorStr[2];\n if (colorStr.length > 3) {\n rgba[3] = colorStr[3];\n }\n else {\n rgba[3] = 1;\n }\n return rgba;\n }\n\n rgba = echarts.color.parse(colorStr || '#000', rgba) || [0, 0, 0, 0];\n rgba[0] /= 255;\n rgba[1] /= 255;\n rgba[2] /= 255;\n return rgba;\n};\n\n/**\n * Convert alpha beta rotation to direction.\n * @param {number} alpha\n * @param {number} beta\n * @return {Array.}\n */\ngraphicGL.directionFromAlphaBeta = function (alpha, beta) {\n var theta = alpha / 180 * Math.PI + Math.PI / 2;\n var phi = -beta / 180 * Math.PI + Math.PI / 2;\n\n var dir = [];\n var r = Math.sin(theta);\n dir[0] = r * Math.cos(phi);\n dir[1] = -Math.cos(theta);\n dir[2] = r * Math.sin(phi);\n\n return dir;\n};\n/**\n * Get shadow resolution from shadowQuality configuration\n */\ngraphicGL.getShadowResolution = function (shadowQuality) {\n var shadowResolution = 1024;\n switch (shadowQuality) {\n case 'low':\n shadowResolution = 512;\n break;\n case 'medium':\n break;\n case 'high':\n shadowResolution = 2048;\n break;\n case 'ultra':\n shadowResolution = 4096;\n break;\n }\n return shadowResolution;\n};\n\n/**\n * Shading utilities\n */\ngraphicGL.COMMON_SHADERS = ['lambert', 'color', 'realistic', 'hatching', 'shadow'];\n\n/**\n * Create shader including vertex and fragment\n * @param {string} prefix.\n */\ngraphicGL.createShader = function (prefix) {\n if (prefix === 'ecgl.shadow') {\n prefix = 'ecgl.displayShadow';\n }\n var vertexShaderStr = Shader.source(prefix + '.vertex');\n var fragmentShaderStr = Shader.source(prefix + '.fragment');\n if (!vertexShaderStr) {\n console.error('Vertex shader of \\'%s\\' not exits', prefix);\n }\n if (!fragmentShaderStr) {\n console.error('Fragment shader of \\'%s\\' not exits', prefix);\n }\n var shader = new Shader(vertexShaderStr, fragmentShaderStr);\n shader.name = prefix;\n return shader;\n};\n\ngraphicGL.createMaterial = function (prefix, defines) {\n if (!(defines instanceof Array)) {\n defines = [defines];\n }\n var shader = graphicGL.createShader(prefix);\n var material = new Material({\n shader: shader\n });\n defines.forEach(function (defineName) {\n if (typeof defineName === 'string') {\n material.define(defineName);\n }\n });\n return material;\n};\n/**\n * Set material from model.\n * @param {clay.Material} material\n * @param {module:echarts/model/Model} model\n * @param {module:echarts/ExtensionAPI} api\n */\ngraphicGL.setMaterialFromModel = function (shading, material, model, api) {\n material.autoUpdateTextureStatus = false;\n\n var materialModel = model.getModel(shading + 'Material');\n var detailTexture = materialModel.get('detailTexture');\n var uvRepeat = retrieve.firstNotNull(materialModel.get('textureTiling'), 1.0);\n var uvOffset = retrieve.firstNotNull(materialModel.get('textureOffset'), 0.0);\n if (typeof uvRepeat === 'number') {\n uvRepeat = [uvRepeat, uvRepeat];\n }\n if (typeof uvOffset === 'number') {\n uvOffset = [uvOffset, uvOffset];\n }\n var repeatParam = (uvRepeat[0] > 1 || uvRepeat[1] > 1) ? graphicGL.Texture.REPEAT : graphicGL.Texture.CLAMP_TO_EDGE;\n var textureOpt = {\n anisotropic: 8,\n wrapS: repeatParam,\n wrapT: repeatParam\n };\n if (shading === 'realistic') {\n var roughness = materialModel.get('roughness');\n var metalness = materialModel.get('metalness');\n if (metalness != null) {\n // Try to treat as a texture, TODO More check\n if (isNaN(metalness)) {\n material.setTextureImage('metalnessMap', metalness, api, textureOpt);\n metalness = retrieve.firstNotNull(materialModel.get('metalnessAdjust'), 0.5);\n }\n }\n else {\n // Default metalness.\n metalness = 0;\n }\n if (roughness != null) {\n // Try to treat as a texture, TODO More check\n if (isNaN(roughness)) {\n material.setTextureImage('roughnessMap', roughness, api, textureOpt);\n roughness = retrieve.firstNotNull(materialModel.get('roughnessAdjust'), 0.5);\n }\n }\n else {\n // Default roughness.\n roughness = 0.5;\n }\n var normalTextureVal = materialModel.get('normalTexture');\n material.setTextureImage('detailMap', detailTexture, api, textureOpt);\n material.setTextureImage('normalMap', normalTextureVal, api, textureOpt);\n material.set({\n roughness: roughness,\n metalness: metalness,\n detailUvRepeat: uvRepeat,\n detailUvOffset: uvOffset\n });\n // var normalTexture = material.get('normalMap');\n // if (normalTexture) {\n // PENDING\n // normalTexture.format = Texture.SRGB;\n // }\n }\n else if (shading === 'lambert') {\n material.setTextureImage('detailMap', detailTexture, api, textureOpt);\n material.set({\n detailUvRepeat: uvRepeat,\n detailUvOffset: uvOffset\n });\n }\n else if (shading === 'color') {\n material.setTextureImage('detailMap', detailTexture, api, textureOpt);\n material.set({\n detailUvRepeat: uvRepeat,\n detailUvOffset: uvOffset\n });\n }\n else if (shading === 'hatching') {\n var tams = materialModel.get('hatchingTextures') || [];\n if (tams.length < 6) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Invalid hatchingTextures.');\n }\n }\n for (var i = 0; i < 6; i++) {\n material.setTextureImage('hatch' + (i + 1), tams[i], api, {\n anisotropic: 8,\n wrapS: graphicGL.Texture.REPEAT,\n wrapT: graphicGL.Texture.REPEAT\n });\n }\n material.set({\n detailUvRepeat: uvRepeat,\n detailUvOffset: uvOffset\n });\n }\n};\n\ngraphicGL.updateVertexAnimation = function (\n mappingAttributes, previousMesh, currentMesh, seriesModel\n) {\n var enableAnimation = seriesModel.get('animation');\n var duration = seriesModel.get('animationDurationUpdate');\n var easing = seriesModel.get('animationEasingUpdate');\n var shadowDepthMaterial = currentMesh.shadowDepthMaterial;\n\n if (enableAnimation && previousMesh && duration > 0\n // Only animate when bar count are not changed\n && previousMesh.geometry.vertexCount === currentMesh.geometry.vertexCount\n ) {\n currentMesh.material.define('vertex', 'VERTEX_ANIMATION');\n currentMesh.ignorePreZ = true;\n if (shadowDepthMaterial) {\n shadowDepthMaterial.define('vertex', 'VERTEX_ANIMATION');\n }\n for (var i = 0; i < mappingAttributes.length; i++) {\n currentMesh.geometry.attributes[mappingAttributes[i][0]].value =\n previousMesh.geometry.attributes[mappingAttributes[i][1]].value;\n }\n currentMesh.geometry.dirty();\n currentMesh.__percent = 0;\n currentMesh.material.set('percent', 0);\n currentMesh.stopAnimation();\n currentMesh.animate()\n .when(duration, {\n __percent: 1\n })\n .during(function () {\n currentMesh.material.set('percent', currentMesh.__percent);\n if (shadowDepthMaterial) {\n shadowDepthMaterial.set('percent', currentMesh.__percent);\n }\n })\n .done(function () {\n currentMesh.ignorePreZ = false;\n currentMesh.material.undefine('vertex', 'VERTEX_ANIMATION');\n if (shadowDepthMaterial) {\n shadowDepthMaterial.undefine('vertex', 'VERTEX_ANIMATION');\n }\n })\n .start(easing);\n }\n else {\n currentMesh.material.undefine('vertex', 'VERTEX_ANIMATION');\n if (shadowDepthMaterial) {\n shadowDepthMaterial.undefine('vertex', 'VERTEX_ANIMATION');\n }\n }\n};\n\nexport default graphicGL;\n","var requestAnimationFrame;\nrequestAnimationFrame = (typeof window !== 'undefined'\n && ((window.requestAnimationFrame && window.requestAnimationFrame.bind(window))\n || (window.msRequestAnimationFrame && window.msRequestAnimationFrame.bind(window))\n || window.mozRequestAnimationFrame\n || window.webkitRequestAnimationFrame)) || function (func) {\n return setTimeout(func, 16);\n};\nexport default requestAnimationFrame;\n","/**\n * Provide WebGL layer to zrender. Which is rendered on top of clay.\n *\n *\n * Relationship between zrender, LayerGL(renderer) and ViewGL(Scene, Camera, Viewport)\n * zrender\n * / \\\n * LayerGL LayerGL\n * (renderer) (renderer)\n * / \\\n * ViewGL ViewGL\n */\n\nimport * as echarts from 'echarts/lib/echarts';\nimport Renderer from 'claygl/src/Renderer';\nimport RayPicking from 'claygl/src/picking/RayPicking';\nimport Texture from 'claygl/src/Texture';\nimport graphicGL from '../util/graphicGL';\n\n// PENDING, clay. notifier is same with zrender Eventful\nimport notifier from 'claygl/src/core/mixin/notifier';\nimport requestAnimationFrame from 'zrender/lib/animation/requestAnimationFrame';\n\n/**\n * @constructor\n * @alias module:echarts-gl/core/LayerGL\n * @param {string} id Layer ID\n * @param {module:zrender/ZRender} zr\n */\nvar LayerGL = function (id, zr) {\n\n /**\n * Layer ID\n * @type {string}\n */\n this.id = id;\n\n /**\n * @type {module:zrender/ZRender}\n */\n this.zr = zr;\n\n /**\n * @type {clay.Renderer}\n */\n try {\n this.renderer = new Renderer({\n clearBit: 0,\n devicePixelRatio: zr.painter.dpr,\n preserveDrawingBuffer: true,\n // PENDING\n premultipliedAlpha: true\n });\n this.renderer.resize(zr.painter.getWidth(), zr.painter.getHeight());\n }\n catch (e) {\n this.renderer = null;\n this.dom = document.createElement('div');\n this.dom.style.cssText = 'position:absolute; left: 0; top: 0; right: 0; bottom: 0;';\n this.dom.className = 'ecgl-nowebgl';\n this.dom.innerHTML = 'Sorry, your browser does not support WebGL';\n\n console.error(e);\n return;\n }\n\n this.onglobalout = this.onglobalout.bind(this);\n zr.on('globalout', this.onglobalout);\n\n /**\n * Canvas dom for webgl rendering\n * @type {HTMLCanvasElement}\n */\n this.dom = this.renderer.canvas;\n var style = this.dom.style;\n style.position = 'absolute';\n style.left = '0';\n style.top = '0';\n\n /**\n * @type {Array.}\n */\n this.views = [];\n\n this._picking = new RayPicking({\n renderer: this.renderer\n });\n\n this._viewsToDispose = [];\n\n /**\n * Current accumulating id.\n */\n this._accumulatingId = 0;\n\n this._zrEventProxy = new echarts.graphic.Rect({\n shape: {x: -1, y: -1, width: 2, height: 2},\n // FIXME Better solution.\n __isGLToZRProxy: true\n });\n\n this._backgroundColor = null;\n\n this._disposed = false;\n};\n\nLayerGL.prototype.setUnpainted = function () {};\n\n/**\n * @param {module:echarts-gl/core/ViewGL} view\n */\nLayerGL.prototype.addView = function (view) {\n if (view.layer === this) {\n return;\n }\n // If needs to dispose in this layer. unmark it.\n var idx = this._viewsToDispose.indexOf(view);\n if (idx >= 0) {\n this._viewsToDispose.splice(idx, 1);\n }\n\n this.views.push(view);\n\n view.layer = this;\n\n var zr = this.zr;\n view.scene.traverse(function (node) {\n node.__zr = zr;\n if (node.addAnimatorsToZr) {\n node.addAnimatorsToZr(zr);\n }\n });\n};\n\nfunction removeFromZr(node) {\n var zr = node.__zr;\n node.__zr = null;\n if (zr && node.removeAnimatorsFromZr) {\n node.removeAnimatorsFromZr(zr);\n }\n}\n/**\n * @param {module:echarts-gl/core/ViewGL} view\n */\nLayerGL.prototype.removeView = function (view) {\n if (view.layer !== this) {\n return;\n }\n\n var idx = this.views.indexOf(view);\n if (idx >= 0) {\n this.views.splice(idx, 1);\n view.scene.traverse(removeFromZr, this);\n view.layer = null;\n\n // Mark to dispose in this layer.\n this._viewsToDispose.push(view);\n }\n};\n\n/**\n * Remove all views\n */\nLayerGL.prototype.removeViewsAll = function () {\n this.views.forEach(function (view) {\n view.scene.traverse(removeFromZr, this);\n view.layer = null;\n\n // Mark to dispose in this layer.\n this._viewsToDispose.push(view);\n }, this);\n\n this.views.length = 0;\n\n};\n\n/**\n * Resize the canvas and viewport, will be invoked by zrender\n * @param {number} width\n * @param {number} height\n */\nLayerGL.prototype.resize = function (width, height) {\n var renderer = this.renderer;\n renderer.resize(width, height);\n};\n\n/**\n * Clear color and depth\n * @return {[type]} [description]\n */\nLayerGL.prototype.clear = function () {\n var gl = this.renderer.gl;\n var clearColor = this._backgroundColor || [0, 0, 0, 0];\n gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);\n gl.depthMask(true);\n gl.colorMask(true, true, true, true);\n gl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT);\n};\n\n/**\n * Clear depth\n */\nLayerGL.prototype.clearDepth = function () {\n var gl = this.renderer.gl;\n gl.clear(gl.DEPTH_BUFFER_BIT);\n};\n\n/**\n * Clear color\n */\nLayerGL.prototype.clearColor = function () {\n var gl = this.renderer.gl;\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n};\n\n/**\n * Mark layer to refresh next tick\n */\nLayerGL.prototype.needsRefresh = function () {\n this.zr.refresh();\n};\n\n/**\n * Refresh the layer, will be invoked by zrender\n */\nLayerGL.prototype.refresh = function (bgColor) {\n\n this._backgroundColor = bgColor ? graphicGL.parseColor(bgColor) : [0, 0, 0, 0];\n this.renderer.clearColor = this._backgroundColor;\n\n for (var i = 0; i < this.views.length; i++) {\n this.views[i].prepareRender(this.renderer);\n }\n\n this._doRender(false);\n\n // Auto dispose unused resources on GPU, like program(shader), texture, geometry(buffers)\n this._trackAndClean();\n\n // Dispose trashed views\n for (var i = 0; i < this._viewsToDispose.length; i++) {\n this._viewsToDispose[i].dispose(this.renderer);\n }\n this._viewsToDispose.length = 0;\n\n this._startAccumulating();\n};\n\n\nLayerGL.prototype.renderToCanvas = function (ctx) {\n // PENDING will block the page\n this._startAccumulating(true);\n ctx.drawImage(this.dom, 0, 0, ctx.canvas.width, ctx.canvas.height);\n};\n\nLayerGL.prototype._doRender = function (accumulating) {\n this.clear();\n this.renderer.saveViewport();\n for (var i = 0; i < this.views.length; i++) {\n this.views[i].render(this.renderer, accumulating);\n }\n this.renderer.restoreViewport();\n};\n\n/**\n * Stop accumulating\n */\nLayerGL.prototype._stopAccumulating = function () {\n this._accumulatingId = 0;\n clearTimeout(this._accumulatingTimeout);\n};\n\nvar accumulatingId = 1;\n/**\n * Start accumulating all the views.\n * Accumulating is for antialising and have more sampling in SSAO\n * @private\n */\nLayerGL.prototype._startAccumulating = function (immediate) {\n var self = this;\n this._stopAccumulating();\n\n var needsAccumulate = false;\n for (var i = 0; i < this.views.length; i++) {\n needsAccumulate = this.views[i].needsAccumulate() || needsAccumulate;\n }\n if (!needsAccumulate) {\n return;\n }\n\n function accumulate(id) {\n if (!self._accumulatingId || id !== self._accumulatingId) {\n return;\n }\n\n var isFinished = true;\n for (var i = 0; i < self.views.length; i++) {\n isFinished = self.views[i].isAccumulateFinished() && needsAccumulate;\n }\n\n if (!isFinished) {\n self._doRender(true);\n\n if (immediate) {\n accumulate(id);\n }\n else {\n requestAnimationFrame(function () {\n accumulate(id);\n });\n }\n }\n }\n\n this._accumulatingId = accumulatingId++;\n\n if (immediate) {\n accumulate(self._accumulatingId);\n }\n else {\n this._accumulatingTimeout = setTimeout(function () {\n accumulate(self._accumulatingId);\n }, 50);\n }\n};\n\nLayerGL.prototype._trackAndClean = function () {\n var textureList = [];\n var geometriesList = [];\n\n // Mark all resources unused;\n if (this._textureList) {\n markUnused(this._textureList);\n markUnused(this._geometriesList);\n }\n\n for (var i = 0; i < this.views.length; i++) {\n collectResources(this.views[i].scene, textureList, geometriesList);\n }\n\n // Dispose those unsed resources.\n if (this._textureList) {\n checkAndDispose(this.renderer, this._textureList);\n checkAndDispose(this.renderer, this._geometriesList);\n }\n\n this._textureList = textureList;\n this._geometriesList = geometriesList;\n};\n\nfunction markUnused(resourceList) {\n for (var i = 0; i < resourceList.length; i++) {\n resourceList[i].__used__ = 0;\n }\n}\nfunction checkAndDispose(renderer, resourceList) {\n for (var i = 0; i < resourceList.length; i++) {\n if (!resourceList[i].__used__) {\n resourceList[i].dispose(renderer);\n }\n }\n}\nfunction updateUsed(resource, list) {\n resource.__used__ = resource.__used__ || 0;\n resource.__used__++;\n if (resource.__used__ === 1) {\n // Don't push to the list twice.\n list.push(resource);\n }\n}\nfunction collectResources(scene, textureResourceList, geometryResourceList) {\n var prevMaterial;\n var prevGeometry;\n scene.traverse(function (renderable) {\n if (renderable.isRenderable()) {\n var geometry = renderable.geometry;\n var material = renderable.material;\n\n // TODO optimize!!\n if (material !== prevMaterial) {\n var textureUniforms = material.getTextureUniforms();\n for (var u = 0; u < textureUniforms.length; u++) {\n var uniformName = textureUniforms[u];\n var val = material.uniforms[uniformName].value;\n if (!val) {\n continue;\n }\n if (val instanceof Texture) {\n updateUsed(val, textureResourceList);\n }\n else if (val instanceof Array) {\n for (var k = 0; k < val.length; k++) {\n if (val[k] instanceof Texture) {\n updateUsed(val[k], textureResourceList);\n }\n }\n }\n }\n }\n if (geometry !== prevGeometry) {\n updateUsed(geometry, geometryResourceList);\n }\n\n prevMaterial = material;\n prevGeometry = geometry;\n }\n });\n\n for (var k = 0; k < scene.lights.length; k++) {\n // Track AmbientCubemap\n if (scene.lights[k].cubemap) {\n updateUsed(scene.lights[k].cubemap, textureResourceList);\n }\n }\n}\n/**\n * Dispose the layer\n */\nLayerGL.prototype.dispose = function () {\n if (this._disposed) {\n return;\n }\n this._stopAccumulating();\n if (this._textureList) {\n markUnused(this._textureList);\n markUnused(this._geometriesList);\n checkAndDispose(this.renderer, this._textureList);\n checkAndDispose(this.renderer, this._geometriesList);\n }\n this.zr.off('globalout', this.onglobalout);\n this._disposed = true;\n};\n\n// Event handlers\nLayerGL.prototype.onmousedown = function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n e = e.event;\n var obj = this.pickObject(e.offsetX, e.offsetY);\n if (obj) {\n this._dispatchEvent('mousedown', e, obj);\n this._dispatchDataEvent('mousedown', e, obj);\n }\n\n this._downX = e.offsetX;\n this._downY = e.offsetY;\n};\n\nLayerGL.prototype.onmousemove = function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n e = e.event;\n var obj = this.pickObject(e.offsetX, e.offsetY);\n\n var target = obj && obj.target;\n var lastHovered = this._hovered;\n this._hovered = obj;\n\n if (lastHovered && target !== lastHovered.target) {\n lastHovered.relatedTarget = target;\n this._dispatchEvent('mouseout', e, lastHovered);\n // this._dispatchDataEvent('mouseout', e, lastHovered);\n\n this.zr.setCursorStyle('default');\n }\n\n this._dispatchEvent('mousemove', e, obj);\n\n if (obj) {\n this.zr.setCursorStyle('pointer');\n\n if (!lastHovered || (target !== lastHovered.target)) {\n this._dispatchEvent('mouseover', e, obj);\n // this._dispatchDataEvent('mouseover', e, obj);\n }\n }\n\n this._dispatchDataEvent('mousemove', e, obj);\n};\n\nLayerGL.prototype.onmouseup = function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n e = e.event;\n var obj = this.pickObject(e.offsetX, e.offsetY);\n\n if (obj) {\n this._dispatchEvent('mouseup', e, obj);\n this._dispatchDataEvent('mouseup', e, obj);\n }\n\n this._upX = e.offsetX;\n this._upY = e.offsetY;\n};\n\nLayerGL.prototype.onclick = LayerGL.prototype.dblclick = function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n // Ignore click event if mouse moved\n var dx = this._upX - this._downX;\n var dy = this._upY - this._downY;\n if (Math.sqrt(dx * dx + dy * dy) > 20) {\n return;\n }\n\n e = e.event;\n var obj = this.pickObject(e.offsetX, e.offsetY);\n\n if (obj) {\n this._dispatchEvent(e.type, e, obj);\n this._dispatchDataEvent(e.type, e, obj);\n }\n\n // Try set depth of field onclick\n var result = this._clickToSetFocusPoint(e);\n if (result) {\n var success = result.view.setDOFFocusOnPoint(result.distance);\n if (success) {\n this.zr.refresh();\n }\n }\n};\n\nLayerGL.prototype._clickToSetFocusPoint = function (e) {\n var renderer = this.renderer;\n var oldViewport = renderer.viewport;\n for (var i = this.views.length - 1; i >= 0; i--) {\n var viewGL = this.views[i];\n if (viewGL.hasDOF() && viewGL.containPoint(e.offsetX, e.offsetY)) {\n this._picking.scene = viewGL.scene;\n this._picking.camera = viewGL.camera;\n // Only used for picking, renderer.setViewport will also invoke gl.viewport.\n // Set directly, PENDING.\n renderer.viewport = viewGL.viewport;\n var result = this._picking.pick(e.offsetX, e.offsetY, true);\n if (result) {\n result.view = viewGL;\n return result;\n }\n }\n }\n renderer.viewport = oldViewport;\n};\n\nLayerGL.prototype.onglobalout = function (e) {\n var lastHovered = this._hovered;\n if (lastHovered) {\n this._dispatchEvent('mouseout', e, {\n target: lastHovered.target\n });\n }\n};\n\nLayerGL.prototype.pickObject = function (x, y) {\n\n var output = [];\n var renderer = this.renderer;\n var oldViewport = renderer.viewport;\n for (var i = 0; i < this.views.length; i++) {\n var viewGL = this.views[i];\n if (viewGL.containPoint(x, y)) {\n this._picking.scene = viewGL.scene;\n this._picking.camera = viewGL.camera;\n // Only used for picking, renderer.setViewport will also invoke gl.viewport.\n // Set directly, PENDING.\n renderer.viewport = viewGL.viewport;\n this._picking.pickAll(x, y, output);\n }\n }\n renderer.viewport = oldViewport;\n output.sort(function (a, b) {\n return a.distance - b.distance;\n });\n return output[0];\n};\n\nLayerGL.prototype._dispatchEvent = function (eveName, originalEvent, newEvent) {\n if (!newEvent) {\n newEvent = {};\n }\n var current = newEvent.target;\n\n newEvent.cancelBubble = false;\n newEvent.event = originalEvent;\n newEvent.type = eveName;\n newEvent.offsetX = originalEvent.offsetX;\n newEvent.offsetY = originalEvent.offsetY;\n\n while (current) {\n current.trigger(eveName, newEvent);\n current = current.getParent();\n\n if (newEvent.cancelBubble) {\n break;\n }\n }\n\n this._dispatchToView(eveName, newEvent);\n};\n\nLayerGL.prototype._dispatchDataEvent = function (eveName, originalEvent, newEvent) {\n var mesh = newEvent && newEvent.target;\n\n var dataIndex = mesh && mesh.dataIndex;\n var seriesIndex = mesh && mesh.seriesIndex;\n // Custom event data\n var eventData = mesh && mesh.eventData;\n var elChangedInMouseMove = false;\n\n var eventProxy = this._zrEventProxy;\n eventProxy.x = originalEvent.offsetX;\n eventProxy.y = originalEvent.offsetY;\n eventProxy.update();\n\n var targetInfo = {\n target: eventProxy\n };\n const ecData = echarts.helper.getECData(eventProxy);\n if (eveName === 'mousemove') {\n if (dataIndex != null) {\n if (dataIndex !== this._lastDataIndex) {\n if (parseInt(this._lastDataIndex, 10) >= 0) {\n ecData.dataIndex = this._lastDataIndex;\n ecData.seriesIndex = this._lastSeriesIndex;\n // FIXME May cause double events.\n this.zr.handler.dispatchToElement(targetInfo, 'mouseout', originalEvent);\n }\n elChangedInMouseMove = true;\n }\n }\n else if (eventData != null) {\n if (eventData !== this._lastEventData) {\n if (this._lastEventData != null) {\n ecData.eventData = this._lastEventData;\n // FIXME May cause double events.\n this.zr.handler.dispatchToElement(targetInfo, 'mouseout', originalEvent);\n }\n elChangedInMouseMove = true;\n }\n }\n this._lastEventData = eventData;\n this._lastDataIndex = dataIndex;\n this._lastSeriesIndex = seriesIndex;\n }\n\n ecData.eventData = eventData;\n ecData.dataIndex = dataIndex;\n ecData.seriesIndex = seriesIndex;\n\n if (eventData != null || (parseInt(dataIndex, 10) >= 0 && parseInt(seriesIndex, 10) >= 0)) {\n this.zr.handler.dispatchToElement(targetInfo, eveName, originalEvent);\n\n if (elChangedInMouseMove) {\n this.zr.handler.dispatchToElement(targetInfo, 'mouseover', originalEvent);\n }\n }\n};\n\nLayerGL.prototype._dispatchToView = function (eventName, e) {\n for (var i = 0; i < this.views.length; i++) {\n if (this.views[i].containPoint(e.offsetX, e.offsetY)) {\n this.views[i].trigger(eventName, e);\n }\n }\n};\n\nObject.assign(LayerGL.prototype, notifier);\n\nexport default LayerGL;","import * as echarts from 'echarts/lib/echarts';\n\nvar GL_SERIES = ['bar3D', 'line3D', 'map3D', 'scatter3D', 'surface', 'lines3D', 'scatterGL', 'scatter3D'];\n\nfunction convertNormalEmphasis(option, optType) {\n if (option && option[optType] && (option[optType].normal || option[optType].emphasis)) {\n var normalOpt = option[optType].normal;\n var emphasisOpt = option[optType].emphasis;\n\n if (normalOpt) {\n option[optType] = normalOpt;\n }\n if (emphasisOpt) {\n option.emphasis = option.emphasis || {};\n option.emphasis[optType] = emphasisOpt;\n }\n }\n}\n\nfunction convertNormalEmphasisForEach(option) {\n convertNormalEmphasis(option, 'itemStyle');\n convertNormalEmphasis(option, 'lineStyle');\n convertNormalEmphasis(option, 'areaStyle');\n convertNormalEmphasis(option, 'label');\n}\n\nfunction removeTextStyleInAxis(axesOpt) {\n if (!axesOpt) {\n return;\n }\n if (!(axesOpt instanceof Array)) {\n axesOpt = [axesOpt];\n }\n echarts.util.each(axesOpt, function (axisOpt) {\n if (axisOpt.axisLabel) {\n var labelOpt = axisOpt.axisLabel;\n Object.assign(labelOpt, labelOpt.textStyle);\n labelOpt.textStyle = null;\n }\n });\n}\n\nexport default function (option) {\n echarts.util.each(option.series, function (series) {\n if (echarts.util.indexOf(GL_SERIES, series.type) >= 0) {\n convertNormalEmphasisForEach(series);\n\n // Compatitable with original mapbox\n if (series.coordinateSystem === 'mapbox') {\n series.coordinateSystem = 'mapbox3D';\n option.mapbox3D = option.mapbox;\n }\n }\n });\n\n removeTextStyleInAxis(option.xAxis3D);\n removeTextStyleInAxis(option.yAxis3D);\n removeTextStyleInAxis(option.zAxis3D);\n removeTextStyleInAxis(option.grid3D);\n\n convertNormalEmphasis(option.geo3D);\n};","/**\n * echarts-gl\n * Extension pack of ECharts providing 3d plots and globe visualization\n *\n * Copyright (c) 2014, echarts-gl\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport * as echarts from 'echarts/lib/echarts';\nimport LayerGL from './core/LayerGL';\nimport backwardCompat from './preprocessor/backwardCompat';\n\nfunction EChartsGL (zr) {\n this._layers = {};\n\n this._zr = zr;\n}\n\nEChartsGL.prototype.update = function (ecModel, api) {\n var self = this;\n var zr = api.getZr();\n\n if (!zr.getWidth() || !zr.getHeight()) {\n console.warn('Dom has no width or height');\n return;\n }\n\n function getLayerGL(model) {\n // Disable auto sleep in gl layer.\n zr.setSleepAfterStill(0);\n\n var zlevel;\n // Host on coordinate system.\n if (model.coordinateSystem && model.coordinateSystem.model) {\n zlevel = model.get('zlevel');\n }\n else {\n zlevel = model.get('zlevel');\n }\n\n var layers = self._layers;\n var layerGL = layers[zlevel];\n if (!layerGL) {\n layerGL = layers[zlevel] = new LayerGL('gl-' + zlevel, zr);\n\n if (zr.painter.isSingleCanvas()) {\n layerGL.virtual = true;\n // If container is canvas, use image to represent LayerGL\n // FIXME Performance\n var img = new echarts.graphic.Image({\n z: 1e4,\n style: {\n image: layerGL.renderer.canvas\n },\n silent: true\n });\n layerGL.__hostImage = img;\n\n zr.add(img);\n }\n\n zr.painter.insertLayer(zlevel, layerGL);\n }\n if (layerGL.__hostImage) {\n layerGL.__hostImage.setStyle({\n width: layerGL.renderer.getWidth(),\n height: layerGL.renderer.getHeight()\n });\n }\n\n return layerGL;\n }\n\n function setSilent(groupGL, silent) {\n if (groupGL) {\n groupGL.traverse(function (mesh) {\n if (mesh.isRenderable && mesh.isRenderable()) {\n mesh.ignorePicking = mesh.$ignorePicking != null\n ? mesh.$ignorePicking : silent;\n }\n });\n }\n }\n\n for (var zlevel in this._layers) {\n this._layers[zlevel].removeViewsAll();\n }\n\n ecModel.eachComponent(function (componentType, componentModel) {\n if (componentType !== 'series') {\n var view = api.getViewOfComponentModel(componentModel);\n var coordSys = componentModel.coordinateSystem;\n // View with __ecgl__ flag is a echarts-gl component.\n if (view.__ecgl__) {\n var viewGL;\n if (coordSys) {\n if (!coordSys.viewGL) {\n console.error('Can\\'t find viewGL in coordinateSystem of component ' + componentModel.id);\n return;\n }\n viewGL = coordSys.viewGL;\n }\n else {\n if (!componentModel.viewGL) {\n console.error('Can\\'t find viewGL of component ' + componentModel.id);\n return;\n }\n viewGL = coordSys.viewGL;\n }\n\n var viewGL = coordSys.viewGL;\n var layerGL = getLayerGL(componentModel);\n\n layerGL.addView(viewGL);\n\n view.afterRender && view.afterRender(\n componentModel, ecModel, api, layerGL\n );\n\n setSilent(view.groupGL, componentModel.get('silent'));\n }\n }\n });\n\n ecModel.eachSeries(function (seriesModel) {\n var chartView = api.getViewOfSeriesModel(seriesModel);\n var coordSys = seriesModel.coordinateSystem;\n if (chartView.__ecgl__) {\n if ((coordSys && !coordSys.viewGL) && !chartView.viewGL) {\n console.error('Can\\'t find viewGL of series ' + chartView.id);\n return;\n }\n var viewGL = (coordSys && coordSys.viewGL) || chartView.viewGL;\n // TODO Check zlevel not same with component of coordinate system ?\n var layerGL = getLayerGL(seriesModel);\n layerGL.addView(viewGL);\n\n chartView.afterRender && chartView.afterRender(\n seriesModel, ecModel, api, layerGL\n );\n\n setSilent(chartView.groupGL, seriesModel.get('silent'));\n }\n });\n};\n\n// Hack original getRenderedCanvas. Will removed after new echarts released\n// TODO\n\necharts.registerPostInit(function (chart) {\n var zr = chart.getZr();\n var oldDispose = zr.painter.dispose;\n\n zr.painter.dispose = function () {\n this.eachOtherLayer(function (layer) {\n if (layer instanceof LayerGL) {\n layer.dispose();\n }\n });\n oldDispose.call(this);\n }\n zr.painter.getRenderedCanvas = function (opts) {\n opts = opts || {};\n if (this._singleCanvas) {\n return this._layers[0].dom;\n }\n\n var canvas = document.createElement('canvas');\n var dpr = opts.pixelRatio || this.dpr;\n canvas.width = this.getWidth() * dpr;\n canvas.height = this.getHeight() * dpr;\n var ctx = canvas.getContext('2d');\n ctx.dpr = dpr;\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n if (opts.backgroundColor) {\n ctx.fillStyle = opts.backgroundColor;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n }\n\n var displayList = this.storage.getDisplayList(true);\n\n var scope = {};\n var zlevel;\n\n var self = this;\n function findAndDrawOtherLayer(smaller, larger) {\n var zlevelList = self._zlevelList;\n if (smaller == null) {\n smaller = -Infinity;\n }\n var intermediateLayer;\n for (var i = 0; i < zlevelList.length; i++) {\n var z = zlevelList[i];\n var layer = self._layers[z];\n if (!layer.__builtin__ && z > smaller && z < larger) {\n intermediateLayer = layer;\n break;\n }\n }\n if (intermediateLayer && intermediateLayer.renderToCanvas) {\n ctx.save();\n intermediateLayer.renderToCanvas(ctx);\n ctx.restore();\n }\n }\n var layer = {\n ctx: ctx\n };\n for (var i = 0; i < displayList.length; i++) {\n var el = displayList[i];\n\n if (el.zlevel !== zlevel) {\n findAndDrawOtherLayer(zlevel, el.zlevel);\n zlevel = el.zlevel;\n }\n this._doPaintEl(el, layer, true, null, scope);\n }\n\n findAndDrawOtherLayer(zlevel, Infinity);\n\n return canvas;\n };\n});\n\necharts.registerPostUpdate(function (ecModel, api) {\n var zr = api.getZr();\n\n var egl = zr.__egl = zr.__egl || new EChartsGL(zr);\n\n egl.update(ecModel, api);\n});\n\necharts.registerPreprocessor(backwardCompat);\n\n\nexport default EChartsGL;","export default {\n defaultOption: {\n\n viewControl: {\n // perspective, orthographic.\n // TODO Isometric\n projection: 'perspective',\n // If rotate on on init\n autoRotate: false,\n // cw or ccw\n autoRotateDirection: 'cw',\n // Degree per second\n autoRotateSpeed: 10,\n\n // Start rotating after still for a given time\n // default is 3 seconds\n autoRotateAfterStill: 3,\n\n // Rotate, zoom damping.\n damping: 0.8,\n // Sensitivities for operations.\n // Can be array to set x,y respectively\n rotateSensitivity: 1,\n zoomSensitivity: 1,\n // Can be array to set x,y respectively\n panSensitivity: 1,\n // Which mouse button do rotate or pan\n panMouseButton: 'middle',\n rotateMouseButton: 'left',\n\n // Distance to the target\n // Only available when camera is perspective.\n distance: 150,\n // Min distance mouse can zoom in\n minDistance: 40,\n // Max distance mouse can zoom out\n maxDistance: 400,\n\n // Size of viewing volume.\n // Only available when camera is orthographic\n orthographicSize: 150,\n maxOrthographicSize: 400,\n minOrthographicSize: 20,\n\n // Center view point\n center: [0, 0, 0],\n // Alpha angle for top-down rotation\n // Positive to rotate to top.\n alpha: 0,\n // beta angle for left-right rotation\n // Positive to rotate to right.\n beta: 0,\n\n minAlpha: -90,\n maxAlpha: 90\n\n // minBeta: -Infinity\n // maxBeta: -Infinity\n }\n },\n\n setView: function (opts) {\n opts = opts || {};\n this.option.viewControl = this.option.viewControl || {};\n if (opts.alpha != null) {\n this.option.viewControl.alpha = opts.alpha;\n }\n if (opts.beta != null) {\n this.option.viewControl.beta = opts.beta;\n }\n if (opts.distance != null) {\n this.option.viewControl.distance = opts.distance;\n }\n if (opts.center != null) {\n this.option.viewControl.center = opts.center;\n }\n }\n};","export default {\n defaultOption: {\n // Post effect\n postEffect: {\n enable: false,\n\n bloom: {\n enable: true,\n intensity: 0.1\n },\n depthOfField: {\n enable: false,\n focalRange: 20,\n focalDistance: 50,\n blurRadius: 10,\n fstop: 2.8,\n quality: 'medium'\n },\n\n screenSpaceAmbientOcclusion: {\n enable: false,\n radius: 2,\n // low, medium, high, ultra\n quality: 'medium',\n intensity: 1\n },\n\n screenSpaceReflection: {\n enable: false,\n quality: 'medium',\n maxRoughness: 0.8\n },\n\n colorCorrection: {\n enable: true,\n\n exposure: 0,\n\n brightness: 0,\n\n contrast: 1,\n\n saturation: 1,\n\n lookupTexture: ''\n },\n\n edge: {\n enable: false\n },\n\n FXAA: {\n enable: false\n }\n },\n\n // Temporal super sampling when the picture is still.\n temporalSuperSampling: {\n // Only enabled when postEffect is enabled\n enable: 'auto'\n }\n }\n};","export default {\n defaultOption: {\n // Light is available when material.shading is not color\n light: {\n // Main light\n main: {\n shadow: false,\n // low, medium, high, ultra\n shadowQuality: 'high',\n\n color: '#fff',\n intensity: 1,\n\n alpha: 0,\n beta: 0\n },\n ambient: {\n color: '#fff',\n intensity: 0.2\n },\n ambientCubemap: {\n // Panorama environment texture,\n // Support .hdr and commmon web formats.\n texture: null,\n // Available when texture is hdr.\n exposure: 1,\n // Intensity for diffuse term\n diffuseIntensity: 0.5,\n // Intensity for specular term, only available when shading is realastic\n specularIntensity: 0.5\n }\n }\n }\n};","import * as echarts from 'echarts/lib/echarts';\nimport componentViewControlMixin from '../common/componentViewControlMixin';\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\n\nvar Grid3DModel = echarts.ComponentModel.extend({\n\n type: 'grid3D',\n\n dependencies: ['xAxis3D', 'yAxis3D', 'zAxis3D'],\n\n defaultOption: {\n\n show: true,\n\n zlevel: -10,\n\n // Layout used for viewport\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n\n environment: 'auto',\n\n // Dimension of grid3D\n boxWidth: 100,\n boxHeight: 100,\n boxDepth: 100,\n\n // Common axis options.\n axisPointer: {\n show: true,\n lineStyle: {\n color: 'rgba(0, 0, 0, 0.8)',\n width: 1\n },\n\n label: {\n show: true,\n // (dimValue: number, value: Array) => string\n formatter: null,\n\n // TODO, Consider boxWidth\n margin: 8,\n // backgroundColor: '#ffbd67',\n // borderColor: '#000',\n // borderWidth: 0,\n\n textStyle: {\n fontSize: 14,\n color: '#fff',\n backgroundColor: 'rgba(0,0,0,0.5)',\n padding: 3,\n borderRadius: 3\n }\n }\n },\n\n axisLine: {\n show: true,\n lineStyle: {\n color: '#333',\n width: 2,\n type: 'solid'\n }\n },\n\n axisTick: {\n show: true,\n inside: false,\n length: 3,\n lineStyle: {\n width: 1\n }\n },\n axisLabel: {\n show: true,\n inside: false,\n rotate: 0,\n margin: 8,\n textStyle: {\n fontSize: 12\n }\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: ['#ccc'],\n width: 1,\n type: 'solid'\n }\n },\n splitArea: {\n show: false,\n areaStyle: {\n color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)']\n }\n },\n\n // Light options\n light: {\n main: {\n // Alpha angle for top-down rotation\n // Positive to rotate to top.\n alpha: 30,\n // beta angle for left-right rotation\n // Positive to rotate to right.\n beta: 40\n },\n ambient: {\n intensity: 0.4\n }\n },\n\n viewControl: {\n // Small damping for precise control.\n // damping: 0.1,\n\n // Alpha angle for top-down rotation\n // Positive to rotate to top.\n alpha: 20,\n // beta angle for left-right rotation\n // Positive to rotate to right.\n beta: 40,\n\n autoRotate: false,\n\n // Distance to the surface of grid3D.\n distance: 200,\n\n // Min distance to the surface of grid3D\n minDistance: 40,\n // Max distance to the surface of grid3D\n maxDistance: 400\n }\n }\n});\n\necharts.util.merge(Grid3DModel.prototype, componentViewControlMixin);\necharts.util.merge(Grid3DModel.prototype, componentPostEffectMixin);\necharts.util.merge(Grid3DModel.prototype, componentLightMixin);\n\nexport default Grid3DModel;\n\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import LRU from '../../core/LRU';\nvar globalImageCache = new LRU(50);\nexport function findExistImage(newImageOrSrc) {\n if (typeof newImageOrSrc === 'string') {\n var cachedImgObj = globalImageCache.get(newImageOrSrc);\n return cachedImgObj && cachedImgObj.image;\n }\n else {\n return newImageOrSrc;\n }\n}\nexport function createOrUpdateImage(newImageOrSrc, image, hostEl, onload, cbPayload) {\n if (!newImageOrSrc) {\n return image;\n }\n else if (typeof newImageOrSrc === 'string') {\n if ((image && image.__zrImageSrc === newImageOrSrc) || !hostEl) {\n return image;\n }\n var cachedImgObj = globalImageCache.get(newImageOrSrc);\n var pendingWrap = { hostEl: hostEl, cb: onload, cbPayload: cbPayload };\n if (cachedImgObj) {\n image = cachedImgObj.image;\n !isImageReady(image) && cachedImgObj.pending.push(pendingWrap);\n }\n else {\n image = new Image();\n image.onload = image.onerror = imageOnLoad;\n globalImageCache.put(newImageOrSrc, image.__cachedImgObj = {\n image: image,\n pending: [pendingWrap]\n });\n image.src = image.__zrImageSrc = newImageOrSrc;\n }\n return image;\n }\n else {\n return newImageOrSrc;\n }\n}\nfunction imageOnLoad() {\n var cachedImgObj = this.__cachedImgObj;\n this.onload = this.onerror = this.__cachedImgObj = null;\n for (var i = 0; i < cachedImgObj.pending.length; i++) {\n var pendingWrap = cachedImgObj.pending[i];\n var cb = pendingWrap.cb;\n cb && cb(this, pendingWrap.cbPayload);\n pendingWrap.hostEl.dirty();\n }\n cachedImgObj.pending.length = 0;\n}\nexport function isImageReady(image) {\n return image && image.width && image.height;\n}\n","export function create() {\n return [1, 0, 0, 1, 0, 0];\n}\nexport function identity(out) {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\nexport function copy(out, m) {\n out[0] = m[0];\n out[1] = m[1];\n out[2] = m[2];\n out[3] = m[3];\n out[4] = m[4];\n out[5] = m[5];\n return out;\n}\nexport function mul(out, m1, m2) {\n var out0 = m1[0] * m2[0] + m1[2] * m2[1];\n var out1 = m1[1] * m2[0] + m1[3] * m2[1];\n var out2 = m1[0] * m2[2] + m1[2] * m2[3];\n var out3 = m1[1] * m2[2] + m1[3] * m2[3];\n var out4 = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];\n var out5 = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = out3;\n out[4] = out4;\n out[5] = out5;\n return out;\n}\nexport function translate(out, a, v) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4] + v[0];\n out[5] = a[5] + v[1];\n return out;\n}\nexport function rotate(out, a, rad) {\n var aa = a[0];\n var ac = a[2];\n var atx = a[4];\n var ab = a[1];\n var ad = a[3];\n var aty = a[5];\n var st = Math.sin(rad);\n var ct = Math.cos(rad);\n out[0] = aa * ct + ab * st;\n out[1] = -aa * st + ab * ct;\n out[2] = ac * ct + ad * st;\n out[3] = -ac * st + ct * ad;\n out[4] = ct * atx + st * aty;\n out[5] = ct * aty - st * atx;\n return out;\n}\nexport function scale(out, a, v) {\n var vx = v[0];\n var vy = v[1];\n out[0] = a[0] * vx;\n out[1] = a[1] * vy;\n out[2] = a[2] * vx;\n out[3] = a[3] * vy;\n out[4] = a[4] * vx;\n out[5] = a[5] * vy;\n return out;\n}\nexport function invert(out, a) {\n var aa = a[0];\n var ac = a[2];\n var atx = a[4];\n var ab = a[1];\n var ad = a[3];\n var aty = a[5];\n var det = aa * ad - ab * ac;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n}\nexport function clone(a) {\n var b = create();\n copy(b, a);\n return b;\n}\n","var Point = (function () {\n function Point(x, y) {\n this.x = x || 0;\n this.y = y || 0;\n }\n Point.prototype.copy = function (other) {\n this.x = other.x;\n this.y = other.y;\n return this;\n };\n Point.prototype.clone = function () {\n return new Point(this.x, this.y);\n };\n Point.prototype.set = function (x, y) {\n this.x = x;\n this.y = y;\n return this;\n };\n Point.prototype.equal = function (other) {\n return other.x === this.x && other.y === this.y;\n };\n Point.prototype.add = function (other) {\n this.x += other.x;\n this.y += other.y;\n return this;\n };\n Point.prototype.scale = function (scalar) {\n this.x *= scalar;\n this.y *= scalar;\n };\n Point.prototype.scaleAndAdd = function (other, scalar) {\n this.x += other.x * scalar;\n this.y += other.y * scalar;\n };\n Point.prototype.sub = function (other) {\n this.x -= other.x;\n this.y -= other.y;\n return this;\n };\n Point.prototype.dot = function (other) {\n return this.x * other.x + this.y * other.y;\n };\n Point.prototype.len = function () {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n };\n Point.prototype.lenSquare = function () {\n return this.x * this.x + this.y * this.y;\n };\n Point.prototype.normalize = function () {\n var len = this.len();\n this.x /= len;\n this.y /= len;\n return this;\n };\n Point.prototype.distance = function (other) {\n var dx = this.x - other.x;\n var dy = this.y - other.y;\n return Math.sqrt(dx * dx + dy * dy);\n };\n Point.prototype.distanceSquare = function (other) {\n var dx = this.x - other.x;\n var dy = this.y - other.y;\n return dx * dx + dy * dy;\n };\n Point.prototype.negate = function () {\n this.x = -this.x;\n this.y = -this.y;\n return this;\n };\n Point.prototype.transform = function (m) {\n if (!m) {\n return;\n }\n var x = this.x;\n var y = this.y;\n this.x = m[0] * x + m[2] * y + m[4];\n this.y = m[1] * x + m[3] * y + m[5];\n return this;\n };\n Point.prototype.toArray = function (out) {\n out[0] = this.x;\n out[1] = this.y;\n return out;\n };\n Point.prototype.fromArray = function (input) {\n this.x = input[0];\n this.y = input[1];\n };\n Point.set = function (p, x, y) {\n p.x = x;\n p.y = y;\n };\n Point.copy = function (p, p2) {\n p.x = p2.x;\n p.y = p2.y;\n };\n Point.len = function (p) {\n return Math.sqrt(p.x * p.x + p.y * p.y);\n };\n Point.lenSquare = function (p) {\n return p.x * p.x + p.y * p.y;\n };\n Point.dot = function (p0, p1) {\n return p0.x * p1.x + p0.y * p1.y;\n };\n Point.add = function (out, p0, p1) {\n out.x = p0.x + p1.x;\n out.y = p0.y + p1.y;\n };\n Point.sub = function (out, p0, p1) {\n out.x = p0.x - p1.x;\n out.y = p0.y - p1.y;\n };\n Point.scale = function (out, p0, scalar) {\n out.x = p0.x * scalar;\n out.y = p0.y * scalar;\n };\n Point.scaleAndAdd = function (out, p0, p1, scalar) {\n out.x = p0.x + p1.x * scalar;\n out.y = p0.y + p1.y * scalar;\n };\n Point.lerp = function (out, p0, p1, t) {\n var onet = 1 - t;\n out.x = onet * p0.x + t * p1.x;\n out.y = onet * p0.y + t * p1.y;\n };\n return Point;\n}());\nexport default Point;\n","import * as matrix from './matrix';\nimport Point from './Point';\nvar mathMin = Math.min;\nvar mathMax = Math.max;\nvar lt = new Point();\nvar rb = new Point();\nvar lb = new Point();\nvar rt = new Point();\nvar minTv = new Point();\nvar maxTv = new Point();\nvar BoundingRect = (function () {\n function BoundingRect(x, y, width, height) {\n if (width < 0) {\n x = x + width;\n width = -width;\n }\n if (height < 0) {\n y = y + height;\n height = -height;\n }\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n BoundingRect.prototype.union = function (other) {\n var x = mathMin(other.x, this.x);\n var y = mathMin(other.y, this.y);\n if (isFinite(this.x) && isFinite(this.width)) {\n this.width = mathMax(other.x + other.width, this.x + this.width) - x;\n }\n else {\n this.width = other.width;\n }\n if (isFinite(this.y) && isFinite(this.height)) {\n this.height = mathMax(other.y + other.height, this.y + this.height) - y;\n }\n else {\n this.height = other.height;\n }\n this.x = x;\n this.y = y;\n };\n BoundingRect.prototype.applyTransform = function (m) {\n BoundingRect.applyTransform(this, this, m);\n };\n BoundingRect.prototype.calculateTransform = function (b) {\n var a = this;\n var sx = b.width / a.width;\n var sy = b.height / a.height;\n var m = matrix.create();\n matrix.translate(m, m, [-a.x, -a.y]);\n matrix.scale(m, m, [sx, sy]);\n matrix.translate(m, m, [b.x, b.y]);\n return m;\n };\n BoundingRect.prototype.intersect = function (b, mtv) {\n if (!b) {\n return false;\n }\n if (!(b instanceof BoundingRect)) {\n b = BoundingRect.create(b);\n }\n var a = this;\n var ax0 = a.x;\n var ax1 = a.x + a.width;\n var ay0 = a.y;\n var ay1 = a.y + a.height;\n var bx0 = b.x;\n var bx1 = b.x + b.width;\n var by0 = b.y;\n var by1 = b.y + b.height;\n var overlap = !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);\n if (mtv) {\n var dMin = Infinity;\n var dMax = 0;\n var d0 = Math.abs(ax1 - bx0);\n var d1 = Math.abs(bx1 - ax0);\n var d2 = Math.abs(ay1 - by0);\n var d3 = Math.abs(by1 - ay0);\n var dx = Math.min(d0, d1);\n var dy = Math.min(d2, d3);\n if (ax1 < bx0 || bx1 < ax0) {\n if (dx > dMax) {\n dMax = dx;\n if (d0 < d1) {\n Point.set(maxTv, -d0, 0);\n }\n else {\n Point.set(maxTv, d1, 0);\n }\n }\n }\n else {\n if (dx < dMin) {\n dMin = dx;\n if (d0 < d1) {\n Point.set(minTv, d0, 0);\n }\n else {\n Point.set(minTv, -d1, 0);\n }\n }\n }\n if (ay1 < by0 || by1 < ay0) {\n if (dy > dMax) {\n dMax = dy;\n if (d2 < d3) {\n Point.set(maxTv, 0, -d2);\n }\n else {\n Point.set(maxTv, 0, d3);\n }\n }\n }\n else {\n if (dx < dMin) {\n dMin = dx;\n if (d2 < d3) {\n Point.set(minTv, 0, d2);\n }\n else {\n Point.set(minTv, 0, -d3);\n }\n }\n }\n }\n if (mtv) {\n Point.copy(mtv, overlap ? minTv : maxTv);\n }\n return overlap;\n };\n BoundingRect.prototype.contain = function (x, y) {\n var rect = this;\n return x >= rect.x\n && x <= (rect.x + rect.width)\n && y >= rect.y\n && y <= (rect.y + rect.height);\n };\n BoundingRect.prototype.clone = function () {\n return new BoundingRect(this.x, this.y, this.width, this.height);\n };\n BoundingRect.prototype.copy = function (other) {\n BoundingRect.copy(this, other);\n };\n BoundingRect.prototype.plain = function () {\n return {\n x: this.x,\n y: this.y,\n width: this.width,\n height: this.height\n };\n };\n BoundingRect.prototype.isFinite = function () {\n return isFinite(this.x)\n && isFinite(this.y)\n && isFinite(this.width)\n && isFinite(this.height);\n };\n BoundingRect.prototype.isZero = function () {\n return this.width === 0 || this.height === 0;\n };\n BoundingRect.create = function (rect) {\n return new BoundingRect(rect.x, rect.y, rect.width, rect.height);\n };\n BoundingRect.copy = function (target, source) {\n target.x = source.x;\n target.y = source.y;\n target.width = source.width;\n target.height = source.height;\n };\n BoundingRect.applyTransform = function (target, source, m) {\n if (!m) {\n if (target !== source) {\n BoundingRect.copy(target, source);\n }\n return;\n }\n if (m[1] < 1e-5 && m[1] > -1e-5 && m[2] < 1e-5 && m[2] > -1e-5) {\n var sx = m[0];\n var sy = m[3];\n var tx = m[4];\n var ty = m[5];\n target.x = source.x * sx + tx;\n target.y = source.y * sy + ty;\n target.width = source.width * sx;\n target.height = source.height * sy;\n if (target.width < 0) {\n target.x += target.width;\n target.width = -target.width;\n }\n if (target.height < 0) {\n target.y += target.height;\n target.height = -target.height;\n }\n return;\n }\n lt.x = lb.x = source.x;\n lt.y = rt.y = source.y;\n rb.x = rt.x = source.x + source.width;\n rb.y = lb.y = source.y + source.height;\n lt.transform(m);\n rt.transform(m);\n rb.transform(m);\n lb.transform(m);\n target.x = mathMin(lt.x, rb.x, lb.x, rt.x);\n target.y = mathMin(lt.y, rb.y, lb.y, rt.y);\n var maxX = mathMax(lt.x, rb.x, lb.x, rt.x);\n var maxY = mathMax(lt.y, rb.y, lb.y, rt.y);\n target.width = maxX - target.x;\n target.height = maxY - target.y;\n };\n return BoundingRect;\n}());\nexport default BoundingRect;\n","import BoundingRect from '../core/BoundingRect';\nimport { createCanvas } from '../core/util';\nimport LRU from '../core/LRU';\nvar textWidthCache = {};\nexport var DEFAULT_FONT = '12px sans-serif';\nvar _ctx;\nvar _cachedFont;\nfunction defaultMeasureText(text, font) {\n if (!_ctx) {\n _ctx = createCanvas().getContext('2d');\n }\n if (_cachedFont !== font) {\n _cachedFont = _ctx.font = font || DEFAULT_FONT;\n }\n return _ctx.measureText(text);\n}\nvar methods = {\n measureText: defaultMeasureText\n};\nexport function $override(name, fn) {\n methods[name] = fn;\n}\nexport function getWidth(text, font) {\n font = font || DEFAULT_FONT;\n var cacheOfFont = textWidthCache[font];\n if (!cacheOfFont) {\n cacheOfFont = textWidthCache[font] = new LRU(500);\n }\n var width = cacheOfFont.get(text);\n if (width == null) {\n width = methods.measureText(text, font).width;\n cacheOfFont.put(text, width);\n }\n return width;\n}\nexport function innerGetBoundingRect(text, font, textAlign, textBaseline) {\n var width = getWidth(text, font);\n var height = getLineHeight(font);\n var x = adjustTextX(0, width, textAlign);\n var y = adjustTextY(0, height, textBaseline);\n var rect = new BoundingRect(x, y, width, height);\n return rect;\n}\nexport function getBoundingRect(text, font, textAlign, textBaseline) {\n var textLines = ((text || '') + '').split('\\n');\n var len = textLines.length;\n if (len === 1) {\n return innerGetBoundingRect(textLines[0], font, textAlign, textBaseline);\n }\n else {\n var uniondRect = new BoundingRect(0, 0, 0, 0);\n for (var i = 0; i < textLines.length; i++) {\n var rect = innerGetBoundingRect(textLines[i], font, textAlign, textBaseline);\n i === 0 ? uniondRect.copy(rect) : uniondRect.union(rect);\n }\n return uniondRect;\n }\n}\nexport function adjustTextX(x, width, textAlign) {\n if (textAlign === 'right') {\n x -= width;\n }\n else if (textAlign === 'center') {\n x -= width / 2;\n }\n return x;\n}\nexport function adjustTextY(y, height, verticalAlign) {\n if (verticalAlign === 'middle') {\n y -= height / 2;\n }\n else if (verticalAlign === 'bottom') {\n y -= height;\n }\n return y;\n}\nexport function getLineHeight(font) {\n return getWidth('国', font);\n}\nexport function measureText(text, font) {\n return methods.measureText(text, font);\n}\nexport function parsePercent(value, maxValue) {\n if (typeof value === 'string') {\n if (value.lastIndexOf('%') >= 0) {\n return parseFloat(value) / 100 * maxValue;\n }\n return parseFloat(value);\n }\n return value;\n}\nexport function calculateTextPosition(out, opts, rect) {\n var textPosition = opts.position || 'inside';\n var distance = opts.distance != null ? opts.distance : 5;\n var height = rect.height;\n var width = rect.width;\n var halfHeight = height / 2;\n var x = rect.x;\n var y = rect.y;\n var textAlign = 'left';\n var textVerticalAlign = 'top';\n if (textPosition instanceof Array) {\n x += parsePercent(textPosition[0], rect.width);\n y += parsePercent(textPosition[1], rect.height);\n textAlign = null;\n textVerticalAlign = null;\n }\n else {\n switch (textPosition) {\n case 'left':\n x -= distance;\n y += halfHeight;\n textAlign = 'right';\n textVerticalAlign = 'middle';\n break;\n case 'right':\n x += distance + width;\n y += halfHeight;\n textVerticalAlign = 'middle';\n break;\n case 'top':\n x += width / 2;\n y -= distance;\n textAlign = 'center';\n textVerticalAlign = 'bottom';\n break;\n case 'bottom':\n x += width / 2;\n y += height + distance;\n textAlign = 'center';\n break;\n case 'inside':\n x += width / 2;\n y += halfHeight;\n textAlign = 'center';\n textVerticalAlign = 'middle';\n break;\n case 'insideLeft':\n x += distance;\n y += halfHeight;\n textVerticalAlign = 'middle';\n break;\n case 'insideRight':\n x += width - distance;\n y += halfHeight;\n textAlign = 'right';\n textVerticalAlign = 'middle';\n break;\n case 'insideTop':\n x += width / 2;\n y += distance;\n textAlign = 'center';\n break;\n case 'insideBottom':\n x += width / 2;\n y += height - distance;\n textAlign = 'center';\n textVerticalAlign = 'bottom';\n break;\n case 'insideTopLeft':\n x += distance;\n y += distance;\n break;\n case 'insideTopRight':\n x += width - distance;\n y += distance;\n textAlign = 'right';\n break;\n case 'insideBottomLeft':\n x += distance;\n y += height - distance;\n textVerticalAlign = 'bottom';\n break;\n case 'insideBottomRight':\n x += width - distance;\n y += height - distance;\n textAlign = 'right';\n textVerticalAlign = 'bottom';\n break;\n }\n }\n out = out || {};\n out.x = x;\n out.y = y;\n out.align = textAlign;\n out.verticalAlign = textVerticalAlign;\n return out;\n}\n","import * as imageHelper from '../helper/image';\nimport { extend, retrieve2, retrieve3, reduce } from '../../core/util';\nimport { getLineHeight, getWidth, parsePercent } from '../../contain/text';\nvar STYLE_REG = /\\{([a-zA-Z0-9_]+)\\|([^}]*)\\}/g;\nexport function truncateText(text, containerWidth, font, ellipsis, options) {\n if (!containerWidth) {\n return '';\n }\n var textLines = (text + '').split('\\n');\n options = prepareTruncateOptions(containerWidth, font, ellipsis, options);\n for (var i = 0, len = textLines.length; i < len; i++) {\n textLines[i] = truncateSingleLine(textLines[i], options);\n }\n return textLines.join('\\n');\n}\nfunction prepareTruncateOptions(containerWidth, font, ellipsis, options) {\n options = options || {};\n var preparedOpts = extend({}, options);\n preparedOpts.font = font;\n ellipsis = retrieve2(ellipsis, '...');\n preparedOpts.maxIterations = retrieve2(options.maxIterations, 2);\n var minChar = preparedOpts.minChar = retrieve2(options.minChar, 0);\n preparedOpts.cnCharWidth = getWidth('国', font);\n var ascCharWidth = preparedOpts.ascCharWidth = getWidth('a', font);\n preparedOpts.placeholder = retrieve2(options.placeholder, '');\n var contentWidth = containerWidth = Math.max(0, containerWidth - 1);\n for (var i = 0; i < minChar && contentWidth >= ascCharWidth; i++) {\n contentWidth -= ascCharWidth;\n }\n var ellipsisWidth = getWidth(ellipsis, font);\n if (ellipsisWidth > contentWidth) {\n ellipsis = '';\n ellipsisWidth = 0;\n }\n contentWidth = containerWidth - ellipsisWidth;\n preparedOpts.ellipsis = ellipsis;\n preparedOpts.ellipsisWidth = ellipsisWidth;\n preparedOpts.contentWidth = contentWidth;\n preparedOpts.containerWidth = containerWidth;\n return preparedOpts;\n}\nfunction truncateSingleLine(textLine, options) {\n var containerWidth = options.containerWidth;\n var font = options.font;\n var contentWidth = options.contentWidth;\n if (!containerWidth) {\n return '';\n }\n var lineWidth = getWidth(textLine, font);\n if (lineWidth <= containerWidth) {\n return textLine;\n }\n for (var j = 0;; j++) {\n if (lineWidth <= contentWidth || j >= options.maxIterations) {\n textLine += options.ellipsis;\n break;\n }\n var subLength = j === 0\n ? estimateLength(textLine, contentWidth, options.ascCharWidth, options.cnCharWidth)\n : lineWidth > 0\n ? Math.floor(textLine.length * contentWidth / lineWidth)\n : 0;\n textLine = textLine.substr(0, subLength);\n lineWidth = getWidth(textLine, font);\n }\n if (textLine === '') {\n textLine = options.placeholder;\n }\n return textLine;\n}\nfunction estimateLength(text, contentWidth, ascCharWidth, cnCharWidth) {\n var width = 0;\n var i = 0;\n for (var len = text.length; i < len && width < contentWidth; i++) {\n var charCode = text.charCodeAt(i);\n width += (0 <= charCode && charCode <= 127) ? ascCharWidth : cnCharWidth;\n }\n return i;\n}\nexport function parsePlainText(text, style) {\n text != null && (text += '');\n var overflow = style.overflow;\n var padding = style.padding;\n var font = style.font;\n var truncate = overflow === 'truncate';\n var calculatedLineHeight = getLineHeight(font);\n var lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);\n var truncateLineOverflow = style.lineOverflow === 'truncate';\n var width = style.width;\n var lines;\n if (width != null && overflow === 'break' || overflow === 'breakAll') {\n lines = text ? wrapText(text, style.font, width, overflow === 'breakAll', 0).lines : [];\n }\n else {\n lines = text ? text.split('\\n') : [];\n }\n var contentHeight = lines.length * lineHeight;\n var height = retrieve2(style.height, contentHeight);\n if (contentHeight > height && truncateLineOverflow) {\n var lineCount = Math.floor(height / lineHeight);\n lines = lines.slice(0, lineCount);\n }\n var outerHeight = height;\n var outerWidth = width;\n if (padding) {\n outerHeight += padding[0] + padding[2];\n if (outerWidth != null) {\n outerWidth += padding[1] + padding[3];\n }\n }\n if (text && truncate && outerWidth != null) {\n var options = prepareTruncateOptions(width, font, style.ellipsis, {\n minChar: style.truncateMinChar,\n placeholder: style.placeholder\n });\n for (var i = 0; i < lines.length; i++) {\n lines[i] = truncateSingleLine(lines[i], options);\n }\n }\n if (width == null) {\n var maxWidth = 0;\n for (var i = 0; i < lines.length; i++) {\n maxWidth = Math.max(getWidth(lines[i], font), maxWidth);\n }\n width = maxWidth;\n }\n return {\n lines: lines,\n height: height,\n outerHeight: outerHeight,\n lineHeight: lineHeight,\n calculatedLineHeight: calculatedLineHeight,\n contentHeight: contentHeight,\n width: width\n };\n}\nvar RichTextToken = (function () {\n function RichTextToken() {\n }\n return RichTextToken;\n}());\nvar RichTextLine = (function () {\n function RichTextLine(tokens) {\n this.tokens = [];\n if (tokens) {\n this.tokens = tokens;\n }\n }\n return RichTextLine;\n}());\nvar RichTextContentBlock = (function () {\n function RichTextContentBlock() {\n this.width = 0;\n this.height = 0;\n this.contentWidth = 0;\n this.contentHeight = 0;\n this.outerWidth = 0;\n this.outerHeight = 0;\n this.lines = [];\n }\n return RichTextContentBlock;\n}());\nexport { RichTextContentBlock };\nexport function parseRichText(text, style) {\n var contentBlock = new RichTextContentBlock();\n text != null && (text += '');\n if (!text) {\n return contentBlock;\n }\n var topWidth = style.width;\n var topHeight = style.height;\n var overflow = style.overflow;\n var wrapInfo = (overflow === 'break' || overflow === 'breakAll') && topWidth != null\n ? { width: topWidth, accumWidth: 0, breakAll: overflow === 'breakAll' }\n : null;\n var lastIndex = STYLE_REG.lastIndex = 0;\n var result;\n while ((result = STYLE_REG.exec(text)) != null) {\n var matchedIndex = result.index;\n if (matchedIndex > lastIndex) {\n pushTokens(contentBlock, text.substring(lastIndex, matchedIndex), style, wrapInfo);\n }\n pushTokens(contentBlock, result[2], style, wrapInfo, result[1]);\n lastIndex = STYLE_REG.lastIndex;\n }\n if (lastIndex < text.length) {\n pushTokens(contentBlock, text.substring(lastIndex, text.length), style, wrapInfo);\n }\n var pendingList = [];\n var calculatedHeight = 0;\n var calculatedWidth = 0;\n var stlPadding = style.padding;\n var truncate = overflow === 'truncate';\n var truncateLine = style.lineOverflow === 'truncate';\n function finishLine(line, lineWidth, lineHeight) {\n line.width = lineWidth;\n line.lineHeight = lineHeight;\n calculatedHeight += lineHeight;\n calculatedWidth = Math.max(calculatedWidth, lineWidth);\n }\n outer: for (var i = 0; i < contentBlock.lines.length; i++) {\n var line = contentBlock.lines[i];\n var lineHeight = 0;\n var lineWidth = 0;\n for (var j = 0; j < line.tokens.length; j++) {\n var token = line.tokens[j];\n var tokenStyle = token.styleName && style.rich[token.styleName] || {};\n var textPadding = token.textPadding = tokenStyle.padding;\n var paddingH = textPadding ? textPadding[1] + textPadding[3] : 0;\n var font = token.font = tokenStyle.font || style.font;\n token.contentHeight = getLineHeight(font);\n var tokenHeight = retrieve2(tokenStyle.height, token.contentHeight);\n token.innerHeight = tokenHeight;\n textPadding && (tokenHeight += textPadding[0] + textPadding[2]);\n token.height = tokenHeight;\n token.lineHeight = retrieve3(tokenStyle.lineHeight, style.lineHeight, tokenHeight);\n token.align = tokenStyle && tokenStyle.align || style.align;\n token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || 'middle';\n if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {\n if (j > 0) {\n line.tokens = line.tokens.slice(0, j);\n finishLine(line, lineWidth, lineHeight);\n contentBlock.lines = contentBlock.lines.slice(0, i + 1);\n }\n else {\n contentBlock.lines = contentBlock.lines.slice(0, i);\n }\n break outer;\n }\n var styleTokenWidth = tokenStyle.width;\n var tokenWidthNotSpecified = styleTokenWidth == null || styleTokenWidth === 'auto';\n if (typeof styleTokenWidth === 'string' && styleTokenWidth.charAt(styleTokenWidth.length - 1) === '%') {\n token.percentWidth = styleTokenWidth;\n pendingList.push(token);\n token.contentWidth = getWidth(token.text, font);\n }\n else {\n if (tokenWidthNotSpecified) {\n var textBackgroundColor = tokenStyle.backgroundColor;\n var bgImg = textBackgroundColor && textBackgroundColor.image;\n if (bgImg) {\n bgImg = imageHelper.findExistImage(bgImg);\n if (imageHelper.isImageReady(bgImg)) {\n token.width = Math.max(token.width, bgImg.width * tokenHeight / bgImg.height);\n }\n }\n }\n var remainTruncWidth = truncate && topWidth != null\n ? topWidth - lineWidth : null;\n if (remainTruncWidth != null && remainTruncWidth < token.width) {\n if (!tokenWidthNotSpecified || remainTruncWidth < paddingH) {\n token.text = '';\n token.width = token.contentWidth = 0;\n }\n else {\n token.text = truncateText(token.text, remainTruncWidth - paddingH, font, style.ellipsis, { minChar: style.truncateMinChar });\n token.width = token.contentWidth = getWidth(token.text, font);\n }\n }\n else {\n token.contentWidth = getWidth(token.text, font);\n }\n }\n token.width += paddingH;\n lineWidth += token.width;\n tokenStyle && (lineHeight = Math.max(lineHeight, token.lineHeight));\n }\n finishLine(line, lineWidth, lineHeight);\n }\n contentBlock.outerWidth = contentBlock.width = retrieve2(topWidth, calculatedWidth);\n contentBlock.outerHeight = contentBlock.height = retrieve2(topHeight, calculatedHeight);\n contentBlock.contentHeight = calculatedHeight;\n contentBlock.contentWidth = calculatedWidth;\n if (stlPadding) {\n contentBlock.outerWidth += stlPadding[1] + stlPadding[3];\n contentBlock.outerHeight += stlPadding[0] + stlPadding[2];\n }\n for (var i = 0; i < pendingList.length; i++) {\n var token = pendingList[i];\n var percentWidth = token.percentWidth;\n token.width = parseInt(percentWidth, 10) / 100 * contentBlock.width;\n }\n return contentBlock;\n}\nfunction pushTokens(block, str, style, wrapInfo, styleName) {\n var isEmptyStr = str === '';\n var tokenStyle = styleName && style.rich[styleName] || {};\n var lines = block.lines;\n var font = tokenStyle.font || style.font;\n var newLine = false;\n var strLines;\n var linesWidths;\n if (wrapInfo) {\n var tokenPadding = tokenStyle.padding;\n var tokenPaddingH = tokenPadding ? tokenPadding[1] + tokenPadding[3] : 0;\n if (tokenStyle.width != null && tokenStyle.width !== 'auto') {\n var outerWidth_1 = parsePercent(tokenStyle.width, wrapInfo.width) + tokenPaddingH;\n if (lines.length > 0) {\n if (outerWidth_1 + wrapInfo.accumWidth > wrapInfo.width) {\n strLines = str.split('\\n');\n newLine = true;\n }\n }\n wrapInfo.accumWidth = outerWidth_1;\n }\n else {\n var res = wrapText(str, font, wrapInfo.width, wrapInfo.breakAll, wrapInfo.accumWidth);\n wrapInfo.accumWidth = res.accumWidth + tokenPaddingH;\n linesWidths = res.linesWidths;\n strLines = res.lines;\n }\n }\n else {\n strLines = str.split('\\n');\n }\n for (var i = 0; i < strLines.length; i++) {\n var text = strLines[i];\n var token = new RichTextToken();\n token.styleName = styleName;\n token.text = text;\n token.isLineHolder = !text && !isEmptyStr;\n if (typeof tokenStyle.width === 'number') {\n token.width = tokenStyle.width;\n }\n else {\n token.width = linesWidths\n ? linesWidths[i]\n : getWidth(text, font);\n }\n if (!i && !newLine) {\n var tokens = (lines[lines.length - 1] || (lines[0] = new RichTextLine())).tokens;\n var tokensLen = tokens.length;\n (tokensLen === 1 && tokens[0].isLineHolder)\n ? (tokens[0] = token)\n : ((text || !tokensLen || isEmptyStr) && tokens.push(token));\n }\n else {\n lines.push(new RichTextLine([token]));\n }\n }\n}\nfunction isLatin(ch) {\n var code = ch.charCodeAt(0);\n return code >= 0x21 && code <= 0xFF;\n}\nvar breakCharMap = reduce(',&?/;] '.split(''), function (obj, ch) {\n obj[ch] = true;\n return obj;\n}, {});\nfunction isWordBreakChar(ch) {\n if (isLatin(ch)) {\n if (breakCharMap[ch]) {\n return true;\n }\n return false;\n }\n return true;\n}\nfunction wrapText(text, font, lineWidth, isBreakAll, lastAccumWidth) {\n var lines = [];\n var linesWidths = [];\n var line = '';\n var currentWord = '';\n var currentWordWidth = 0;\n var accumWidth = 0;\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch === '\\n') {\n if (currentWord) {\n line += currentWord;\n accumWidth += currentWordWidth;\n }\n lines.push(line);\n linesWidths.push(accumWidth);\n line = '';\n currentWord = '';\n currentWordWidth = 0;\n accumWidth = 0;\n continue;\n }\n var chWidth = getWidth(ch, font);\n var inWord = isBreakAll ? false : !isWordBreakChar(ch);\n if (!lines.length\n ? lastAccumWidth + accumWidth + chWidth > lineWidth\n : accumWidth + chWidth > lineWidth) {\n if (!accumWidth) {\n if (inWord) {\n lines.push(currentWord);\n linesWidths.push(currentWordWidth);\n currentWord = ch;\n currentWordWidth = chWidth;\n }\n else {\n lines.push(ch);\n linesWidths.push(chWidth);\n }\n }\n else if (line || currentWord) {\n if (inWord) {\n if (!line) {\n line = currentWord;\n currentWord = '';\n currentWordWidth = 0;\n accumWidth = currentWordWidth;\n }\n lines.push(line);\n linesWidths.push(accumWidth - currentWordWidth);\n currentWord += ch;\n currentWordWidth += chWidth;\n line = '';\n accumWidth = currentWordWidth;\n }\n else {\n if (currentWord) {\n line += currentWord;\n accumWidth += currentWordWidth;\n currentWord = '';\n currentWordWidth = 0;\n }\n lines.push(line);\n linesWidths.push(accumWidth);\n line = ch;\n accumWidth = chWidth;\n }\n }\n continue;\n }\n accumWidth += chWidth;\n if (inWord) {\n currentWord += ch;\n currentWordWidth += chWidth;\n }\n else {\n if (currentWord) {\n line += currentWord;\n currentWord = '';\n currentWordWidth = 0;\n }\n line += ch;\n }\n }\n if (!lines.length && !line) {\n line = text;\n currentWord = '';\n currentWordWidth = 0;\n }\n if (currentWord) {\n line += currentWord;\n }\n if (line) {\n lines.push(line);\n linesWidths.push(accumWidth);\n }\n if (lines.length === 1) {\n accumWidth += lastAccumWidth;\n }\n return {\n accumWidth: accumWidth,\n lines: lines,\n linesWidths: linesWidths\n };\n}\n","export function create(x, y) {\n if (x == null) {\n x = 0;\n }\n if (y == null) {\n y = 0;\n }\n return [x, y];\n}\nexport function copy(out, v) {\n out[0] = v[0];\n out[1] = v[1];\n return out;\n}\nexport function clone(v) {\n return [v[0], v[1]];\n}\nexport function set(out, a, b) {\n out[0] = a;\n out[1] = b;\n return out;\n}\nexport function add(out, v1, v2) {\n out[0] = v1[0] + v2[0];\n out[1] = v1[1] + v2[1];\n return out;\n}\nexport function scaleAndAdd(out, v1, v2, a) {\n out[0] = v1[0] + v2[0] * a;\n out[1] = v1[1] + v2[1] * a;\n return out;\n}\nexport function sub(out, v1, v2) {\n out[0] = v1[0] - v2[0];\n out[1] = v1[1] - v2[1];\n return out;\n}\nexport function len(v) {\n return Math.sqrt(lenSquare(v));\n}\nexport var length = len;\nexport function lenSquare(v) {\n return v[0] * v[0] + v[1] * v[1];\n}\nexport var lengthSquare = lenSquare;\nexport function mul(out, v1, v2) {\n out[0] = v1[0] * v2[0];\n out[1] = v1[1] * v2[1];\n return out;\n}\nexport function div(out, v1, v2) {\n out[0] = v1[0] / v2[0];\n out[1] = v1[1] / v2[1];\n return out;\n}\nexport function dot(v1, v2) {\n return v1[0] * v2[0] + v1[1] * v2[1];\n}\nexport function scale(out, v, s) {\n out[0] = v[0] * s;\n out[1] = v[1] * s;\n return out;\n}\nexport function normalize(out, v) {\n var d = len(v);\n if (d === 0) {\n out[0] = 0;\n out[1] = 0;\n }\n else {\n out[0] = v[0] / d;\n out[1] = v[1] / d;\n }\n return out;\n}\nexport function distance(v1, v2) {\n return Math.sqrt((v1[0] - v2[0]) * (v1[0] - v2[0])\n + (v1[1] - v2[1]) * (v1[1] - v2[1]));\n}\nexport var dist = distance;\nexport function distanceSquare(v1, v2) {\n return (v1[0] - v2[0]) * (v1[0] - v2[0])\n + (v1[1] - v2[1]) * (v1[1] - v2[1]);\n}\nexport var distSquare = distanceSquare;\nexport function negate(out, v) {\n out[0] = -v[0];\n out[1] = -v[1];\n return out;\n}\nexport function lerp(out, v1, v2, t) {\n out[0] = v1[0] + t * (v2[0] - v1[0]);\n out[1] = v1[1] + t * (v2[1] - v1[1]);\n return out;\n}\nexport function applyTransform(out, v, m) {\n var x = v[0];\n var y = v[1];\n out[0] = m[0] * x + m[2] * y + m[4];\n out[1] = m[1] * x + m[3] * y + m[5];\n return out;\n}\nexport function min(out, v1, v2) {\n out[0] = Math.min(v1[0], v2[0]);\n out[1] = Math.min(v1[1], v2[1]);\n return out;\n}\nexport function max(out, v1, v2) {\n out[0] = Math.max(v1[0], v2[0]);\n out[1] = Math.max(v1[1], v2[1]);\n return out;\n}\n","import * as matrix from './matrix';\nimport * as vector from './vector';\nvar mIdentity = matrix.identity;\nvar EPSILON = 5e-5;\nfunction isNotAroundZero(val) {\n return val > EPSILON || val < -EPSILON;\n}\nvar scaleTmp = [];\nvar tmpTransform = [];\nvar originTransform = matrix.create();\nvar abs = Math.abs;\nvar Transformable = (function () {\n function Transformable() {\n }\n Transformable.prototype.setPosition = function (arr) {\n this.x = arr[0];\n this.y = arr[1];\n };\n Transformable.prototype.setScale = function (arr) {\n this.scaleX = arr[0];\n this.scaleY = arr[1];\n };\n Transformable.prototype.setSkew = function (arr) {\n this.skewX = arr[0];\n this.skewY = arr[1];\n };\n Transformable.prototype.setOrigin = function (arr) {\n this.originX = arr[0];\n this.originY = arr[1];\n };\n Transformable.prototype.needLocalTransform = function () {\n return isNotAroundZero(this.rotation)\n || isNotAroundZero(this.x)\n || isNotAroundZero(this.y)\n || isNotAroundZero(this.scaleX - 1)\n || isNotAroundZero(this.scaleY - 1);\n };\n Transformable.prototype.updateTransform = function () {\n var parent = this.parent;\n var parentHasTransform = parent && parent.transform;\n var needLocalTransform = this.needLocalTransform();\n var m = this.transform;\n if (!(needLocalTransform || parentHasTransform)) {\n m && mIdentity(m);\n return;\n }\n m = m || matrix.create();\n if (needLocalTransform) {\n this.getLocalTransform(m);\n }\n else {\n mIdentity(m);\n }\n if (parentHasTransform) {\n if (needLocalTransform) {\n matrix.mul(m, parent.transform, m);\n }\n else {\n matrix.copy(m, parent.transform);\n }\n }\n this.transform = m;\n this._resolveGlobalScaleRatio(m);\n };\n Transformable.prototype._resolveGlobalScaleRatio = function (m) {\n var globalScaleRatio = this.globalScaleRatio;\n if (globalScaleRatio != null && globalScaleRatio !== 1) {\n this.getGlobalScale(scaleTmp);\n var relX = scaleTmp[0] < 0 ? -1 : 1;\n var relY = scaleTmp[1] < 0 ? -1 : 1;\n var sx = ((scaleTmp[0] - relX) * globalScaleRatio + relX) / scaleTmp[0] || 0;\n var sy = ((scaleTmp[1] - relY) * globalScaleRatio + relY) / scaleTmp[1] || 0;\n m[0] *= sx;\n m[1] *= sx;\n m[2] *= sy;\n m[3] *= sy;\n }\n this.invTransform = this.invTransform || matrix.create();\n matrix.invert(this.invTransform, m);\n };\n Transformable.prototype.getLocalTransform = function (m) {\n return Transformable.getLocalTransform(this, m);\n };\n Transformable.prototype.getComputedTransform = function () {\n var transformNode = this;\n var ancestors = [];\n while (transformNode) {\n ancestors.push(transformNode);\n transformNode = transformNode.parent;\n }\n while (transformNode = ancestors.pop()) {\n transformNode.updateTransform();\n }\n return this.transform;\n };\n Transformable.prototype.setLocalTransform = function (m) {\n if (!m) {\n return;\n }\n var sx = m[0] * m[0] + m[1] * m[1];\n var sy = m[2] * m[2] + m[3] * m[3];\n var rotation = Math.atan2(m[1], m[0]);\n var shearX = Math.PI / 2 + rotation - Math.atan2(m[3], m[2]);\n sy = Math.sqrt(sy) * Math.cos(shearX);\n sx = Math.sqrt(sx);\n this.skewX = shearX;\n this.skewY = 0;\n this.rotation = -rotation;\n this.x = +m[4];\n this.y = +m[5];\n this.scaleX = sx;\n this.scaleY = sy;\n this.originX = 0;\n this.originY = 0;\n };\n Transformable.prototype.decomposeTransform = function () {\n if (!this.transform) {\n return;\n }\n var parent = this.parent;\n var m = this.transform;\n if (parent && parent.transform) {\n matrix.mul(tmpTransform, parent.invTransform, m);\n m = tmpTransform;\n }\n var ox = this.originX;\n var oy = this.originY;\n if (ox || oy) {\n originTransform[4] = ox;\n originTransform[5] = oy;\n matrix.mul(tmpTransform, m, originTransform);\n tmpTransform[4] -= ox;\n tmpTransform[5] -= oy;\n m = tmpTransform;\n }\n this.setLocalTransform(m);\n };\n Transformable.prototype.getGlobalScale = function (out) {\n var m = this.transform;\n out = out || [];\n if (!m) {\n out[0] = 1;\n out[1] = 1;\n return out;\n }\n out[0] = Math.sqrt(m[0] * m[0] + m[1] * m[1]);\n out[1] = Math.sqrt(m[2] * m[2] + m[3] * m[3]);\n if (m[0] < 0) {\n out[0] = -out[0];\n }\n if (m[3] < 0) {\n out[1] = -out[1];\n }\n return out;\n };\n Transformable.prototype.transformCoordToLocal = function (x, y) {\n var v2 = [x, y];\n var invTransform = this.invTransform;\n if (invTransform) {\n vector.applyTransform(v2, v2, invTransform);\n }\n return v2;\n };\n Transformable.prototype.transformCoordToGlobal = function (x, y) {\n var v2 = [x, y];\n var transform = this.transform;\n if (transform) {\n vector.applyTransform(v2, v2, transform);\n }\n return v2;\n };\n Transformable.prototype.getLineScale = function () {\n var m = this.transform;\n return m && abs(m[0] - 1) > 1e-10 && abs(m[3] - 1) > 1e-10\n ? Math.sqrt(abs(m[0] * m[3] - m[2] * m[1]))\n : 1;\n };\n Transformable.getLocalTransform = function (target, m) {\n m = m || [];\n var ox = target.originX || 0;\n var oy = target.originY || 0;\n var sx = target.scaleX;\n var sy = target.scaleY;\n var rotation = target.rotation || 0;\n var x = target.x;\n var y = target.y;\n var skewX = target.skewX ? Math.tan(target.skewX) : 0;\n var skewY = target.skewY ? Math.tan(-target.skewY) : 0;\n if (ox || oy) {\n m[4] = -ox * sx - skewX * oy * sy;\n m[5] = -oy * sy - skewY * ox * sx;\n }\n else {\n m[4] = m[5] = 0;\n }\n m[0] = sx;\n m[3] = sy;\n m[1] = skewY * sx;\n m[2] = skewX * sy;\n rotation && matrix.rotate(m, m, rotation);\n m[4] += ox + x;\n m[5] += oy + y;\n return m;\n };\n Transformable.initDefaultProps = (function () {\n var proto = Transformable.prototype;\n proto.x = 0;\n proto.y = 0;\n proto.scaleX = 1;\n proto.scaleY = 1;\n proto.originX = 0;\n proto.originY = 0;\n proto.skewX = 0;\n proto.skewY = 0;\n proto.rotation = 0;\n proto.globalScaleRatio = 1;\n })();\n return Transformable;\n}());\n;\nexport default Transformable;\n","var Eventful = (function () {\n function Eventful(eventProcessors) {\n if (eventProcessors) {\n this._$eventProcessor = eventProcessors;\n }\n }\n Eventful.prototype.on = function (event, query, handler, context) {\n if (!this._$handlers) {\n this._$handlers = {};\n }\n var _h = this._$handlers;\n if (typeof query === 'function') {\n context = handler;\n handler = query;\n query = null;\n }\n if (!handler || !event) {\n return this;\n }\n var eventProcessor = this._$eventProcessor;\n if (query != null && eventProcessor && eventProcessor.normalizeQuery) {\n query = eventProcessor.normalizeQuery(query);\n }\n if (!_h[event]) {\n _h[event] = [];\n }\n for (var i = 0; i < _h[event].length; i++) {\n if (_h[event][i].h === handler) {\n return this;\n }\n }\n var wrap = {\n h: handler,\n query: query,\n ctx: (context || this),\n callAtLast: handler.zrEventfulCallAtLast\n };\n var lastIndex = _h[event].length - 1;\n var lastWrap = _h[event][lastIndex];\n (lastWrap && lastWrap.callAtLast)\n ? _h[event].splice(lastIndex, 0, wrap)\n : _h[event].push(wrap);\n return this;\n };\n Eventful.prototype.isSilent = function (eventName) {\n var _h = this._$handlers;\n return !_h || !_h[eventName] || !_h[eventName].length;\n };\n Eventful.prototype.off = function (eventType, handler) {\n var _h = this._$handlers;\n if (!_h) {\n return this;\n }\n if (!eventType) {\n this._$handlers = {};\n return this;\n }\n if (handler) {\n if (_h[eventType]) {\n var newList = [];\n for (var i = 0, l = _h[eventType].length; i < l; i++) {\n if (_h[eventType][i].h !== handler) {\n newList.push(_h[eventType][i]);\n }\n }\n _h[eventType] = newList;\n }\n if (_h[eventType] && _h[eventType].length === 0) {\n delete _h[eventType];\n }\n }\n else {\n delete _h[eventType];\n }\n return this;\n };\n Eventful.prototype.trigger = function (eventType) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n if (!this._$handlers) {\n return this;\n }\n var _h = this._$handlers[eventType];\n var eventProcessor = this._$eventProcessor;\n if (_h) {\n var argLen = args.length;\n var len = _h.length;\n for (var i = 0; i < len; i++) {\n var hItem = _h[i];\n if (eventProcessor\n && eventProcessor.filter\n && hItem.query != null\n && !eventProcessor.filter(eventType, hItem.query)) {\n continue;\n }\n switch (argLen) {\n case 0:\n hItem.h.call(hItem.ctx);\n break;\n case 1:\n hItem.h.call(hItem.ctx, args[0]);\n break;\n case 2:\n hItem.h.call(hItem.ctx, args[0], args[1]);\n break;\n default:\n hItem.h.apply(hItem.ctx, args);\n break;\n }\n }\n }\n eventProcessor && eventProcessor.afterTrigger\n && eventProcessor.afterTrigger(eventType);\n return this;\n };\n Eventful.prototype.triggerWithContext = function (type) {\n if (!this._$handlers) {\n return this;\n }\n var _h = this._$handlers[type];\n var eventProcessor = this._$eventProcessor;\n if (_h) {\n var args = arguments;\n var argLen = args.length;\n var ctx = args[argLen - 1];\n var len = _h.length;\n for (var i = 0; i < len; i++) {\n var hItem = _h[i];\n if (eventProcessor\n && eventProcessor.filter\n && hItem.query != null\n && !eventProcessor.filter(type, hItem.query)) {\n continue;\n }\n switch (argLen) {\n case 0:\n hItem.h.call(ctx);\n break;\n case 1:\n hItem.h.call(ctx, args[0]);\n break;\n case 2:\n hItem.h.call(ctx, args[0], args[1]);\n break;\n default:\n hItem.h.apply(ctx, args.slice(1, argLen - 1));\n break;\n }\n }\n }\n eventProcessor && eventProcessor.afterTrigger\n && eventProcessor.afterTrigger(type);\n return this;\n };\n return Eventful;\n}());\nexport default Eventful;\n","var dpr = 1;\nif (typeof window !== 'undefined') {\n dpr = Math.max(window.devicePixelRatio\n || (window.screen && window.screen.deviceXDPI / window.screen.logicalXDPI)\n || 1, 1);\n}\nexport var debugMode = 0;\nexport var devicePixelRatio = dpr;\nexport var DARK_MODE_THRESHOLD = 0.4;\nexport var DARK_LABEL_COLOR = '#333';\nexport var LIGHT_LABEL_COLOR = '#ccc';\nexport var LIGHTER_LABEL_COLOR = '#eee';\n","var Browser = (function () {\n function Browser() {\n this.firefox = false;\n this.ie = false;\n this.edge = false;\n this.newEdge = false;\n this.weChat = false;\n }\n return Browser;\n}());\nvar Env = (function () {\n function Env() {\n this.browser = new Browser();\n this.node = false;\n this.wxa = false;\n this.worker = false;\n this.canvasSupported = false;\n this.svgSupported = false;\n this.touchEventsSupported = false;\n this.pointerEventsSupported = false;\n this.domSupported = false;\n this.transformSupported = false;\n this.transform3dSupported = false;\n }\n return Env;\n}());\nvar env = new Env();\nif (typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function') {\n env.wxa = true;\n env.canvasSupported = true;\n env.touchEventsSupported = true;\n}\nelse if (typeof document === 'undefined' && typeof self !== 'undefined') {\n env.worker = true;\n env.canvasSupported = true;\n}\nelse if (typeof navigator === 'undefined') {\n env.node = true;\n env.canvasSupported = true;\n env.svgSupported = true;\n}\nelse {\n detect(navigator.userAgent, env);\n}\nfunction detect(ua, env) {\n var browser = env.browser;\n var firefox = ua.match(/Firefox\\/([\\d.]+)/);\n var ie = ua.match(/MSIE\\s([\\d.]+)/)\n || ua.match(/Trident\\/.+?rv:(([\\d.]+))/);\n var edge = ua.match(/Edge?\\/([\\d.]+)/);\n var weChat = (/micromessenger/i).test(ua);\n if (firefox) {\n browser.firefox = true;\n browser.version = firefox[1];\n }\n if (ie) {\n browser.ie = true;\n browser.version = ie[1];\n }\n if (edge) {\n browser.edge = true;\n browser.version = edge[1];\n browser.newEdge = +edge[1].split('.')[0] > 18;\n }\n if (weChat) {\n browser.weChat = true;\n }\n env.canvasSupported = !!document.createElement('canvas').getContext;\n env.svgSupported = typeof SVGRect !== 'undefined';\n env.touchEventsSupported = 'ontouchstart' in window && !browser.ie && !browser.edge;\n env.pointerEventsSupported = 'onpointerdown' in window\n && (browser.edge || (browser.ie && +browser.version >= 11));\n env.domSupported = typeof document !== 'undefined';\n var style = document.documentElement.style;\n env.transform3dSupported = ((browser.ie && 'transition' in style)\n || browser.edge\n || (('WebKitCSSMatrix' in window) && ('m11' in new WebKitCSSMatrix()))\n || 'MozPerspective' in style)\n && !('OTransition' in style);\n env.transformSupported = env.transform3dSupported\n || (browser.ie && +browser.version >= 9);\n}\nexport default env;\n","export var REDARAW_BIT = 1;\nexport var STYLE_CHANGED_BIT = 2;\nexport var SHAPE_CHANGED_BIT = 4;\n","import Transformable from './core/Transformable';\nimport Animator, { cloneValue } from './animation/Animator';\nimport BoundingRect from './core/BoundingRect';\nimport Eventful from './core/Eventful';\nimport { calculateTextPosition, parsePercent } from './contain/text';\nimport { guid, isObject, keys, extend, indexOf, logError, mixin, isArrayLike, isTypedArray } from './core/util';\nimport { LIGHT_LABEL_COLOR, DARK_LABEL_COLOR } from './config';\nimport { parse, stringify } from './tool/color';\nimport env from './core/env';\nimport { REDARAW_BIT } from './graphic/constants';\nexport var PRESERVED_NORMAL_STATE = '__zr_normal__';\nvar PRIMARY_STATES_KEYS = ['x', 'y', 'scaleX', 'scaleY', 'originX', 'originY', 'rotation', 'ignore'];\nvar DEFAULT_ANIMATABLE_MAP = {\n x: true,\n y: true,\n scaleX: true,\n scaleY: true,\n originX: true,\n originY: true,\n rotation: true,\n ignore: false\n};\nvar tmpTextPosCalcRes = {};\nvar tmpBoundingRect = new BoundingRect(0, 0, 0, 0);\nvar Element = (function () {\n function Element(props) {\n this.id = guid();\n this.animators = [];\n this.currentStates = [];\n this.states = {};\n this._init(props);\n }\n Element.prototype._init = function (props) {\n this.attr(props);\n };\n Element.prototype.drift = function (dx, dy, e) {\n switch (this.draggable) {\n case 'horizontal':\n dy = 0;\n break;\n case 'vertical':\n dx = 0;\n break;\n }\n var m = this.transform;\n if (!m) {\n m = this.transform = [1, 0, 0, 1, 0, 0];\n }\n m[4] += dx;\n m[5] += dy;\n this.decomposeTransform();\n this.markRedraw();\n };\n Element.prototype.beforeUpdate = function () { };\n Element.prototype.afterUpdate = function () { };\n Element.prototype.update = function () {\n this.updateTransform();\n if (this.__dirty) {\n this.updateInnerText();\n }\n };\n Element.prototype.updateInnerText = function (forceUpdate) {\n var textEl = this._textContent;\n if (textEl && (!textEl.ignore || forceUpdate)) {\n if (!this.textConfig) {\n this.textConfig = {};\n }\n var textConfig = this.textConfig;\n var isLocal = textConfig.local;\n var attachedTransform = textEl.attachedTransform;\n var textAlign = void 0;\n var textVerticalAlign = void 0;\n var textStyleChanged = false;\n if (isLocal) {\n attachedTransform.parent = this;\n }\n else {\n attachedTransform.parent = null;\n }\n var innerOrigin = false;\n attachedTransform.x = textEl.x;\n attachedTransform.y = textEl.y;\n attachedTransform.originX = textEl.originX;\n attachedTransform.originY = textEl.originY;\n attachedTransform.rotation = textEl.rotation;\n attachedTransform.scaleX = textEl.scaleX;\n attachedTransform.scaleY = textEl.scaleY;\n if (textConfig.position != null) {\n var layoutRect = tmpBoundingRect;\n if (textConfig.layoutRect) {\n layoutRect.copy(textConfig.layoutRect);\n }\n else {\n layoutRect.copy(this.getBoundingRect());\n }\n if (!isLocal) {\n layoutRect.applyTransform(this.transform);\n }\n if (this.calculateTextPosition) {\n this.calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n }\n else {\n calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n }\n attachedTransform.x = tmpTextPosCalcRes.x;\n attachedTransform.y = tmpTextPosCalcRes.y;\n textAlign = tmpTextPosCalcRes.align;\n textVerticalAlign = tmpTextPosCalcRes.verticalAlign;\n var textOrigin = textConfig.origin;\n if (textOrigin && textConfig.rotation != null) {\n var relOriginX = void 0;\n var relOriginY = void 0;\n if (textOrigin === 'center') {\n relOriginX = layoutRect.width * 0.5;\n relOriginY = layoutRect.height * 0.5;\n }\n else {\n relOriginX = parsePercent(textOrigin[0], layoutRect.width);\n relOriginY = parsePercent(textOrigin[1], layoutRect.height);\n }\n innerOrigin = true;\n attachedTransform.originX = -attachedTransform.x + relOriginX + (isLocal ? 0 : layoutRect.x);\n attachedTransform.originY = -attachedTransform.y + relOriginY + (isLocal ? 0 : layoutRect.y);\n }\n }\n if (textConfig.rotation != null) {\n attachedTransform.rotation = textConfig.rotation;\n }\n var textOffset = textConfig.offset;\n if (textOffset) {\n attachedTransform.x += textOffset[0];\n attachedTransform.y += textOffset[1];\n if (!innerOrigin) {\n attachedTransform.originX = -textOffset[0];\n attachedTransform.originY = -textOffset[1];\n }\n }\n var isInside = textConfig.inside == null\n ? (typeof textConfig.position === 'string' && textConfig.position.indexOf('inside') >= 0)\n : textConfig.inside;\n var innerTextDefaultStyle = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {});\n var textFill = void 0;\n var textStroke = void 0;\n var autoStroke = void 0;\n if (isInside && this.canBeInsideText()) {\n textFill = textConfig.insideFill;\n textStroke = textConfig.insideStroke;\n if (textFill == null || textFill === 'auto') {\n textFill = this.getInsideTextFill();\n }\n if (textStroke == null || textStroke === 'auto') {\n textStroke = this.getInsideTextStroke(textFill);\n autoStroke = true;\n }\n }\n else {\n textFill = textConfig.outsideFill;\n textStroke = textConfig.outsideStroke;\n if (textFill == null || textFill === 'auto') {\n textFill = this.getOutsideFill();\n }\n if (textStroke == null || textStroke === 'auto') {\n textStroke = this.getOutsideStroke(textFill);\n autoStroke = true;\n }\n }\n textFill = textFill || '#000';\n if (textFill !== innerTextDefaultStyle.fill\n || textStroke !== innerTextDefaultStyle.stroke\n || autoStroke !== innerTextDefaultStyle.autoStroke\n || textAlign !== innerTextDefaultStyle.align\n || textVerticalAlign !== innerTextDefaultStyle.verticalAlign) {\n textStyleChanged = true;\n innerTextDefaultStyle.fill = textFill;\n innerTextDefaultStyle.stroke = textStroke;\n innerTextDefaultStyle.autoStroke = autoStroke;\n innerTextDefaultStyle.align = textAlign;\n innerTextDefaultStyle.verticalAlign = textVerticalAlign;\n textEl.setDefaultTextStyle(innerTextDefaultStyle);\n }\n textEl.__dirty |= REDARAW_BIT;\n if (textStyleChanged) {\n textEl.dirtyStyle(true);\n }\n }\n };\n Element.prototype.canBeInsideText = function () {\n return true;\n };\n Element.prototype.getInsideTextFill = function () {\n return '#fff';\n };\n Element.prototype.getInsideTextStroke = function (textFill) {\n return '#000';\n };\n Element.prototype.getOutsideFill = function () {\n return this.__zr && this.__zr.isDarkMode() ? LIGHT_LABEL_COLOR : DARK_LABEL_COLOR;\n };\n Element.prototype.getOutsideStroke = function (textFill) {\n var backgroundColor = this.__zr && this.__zr.getBackgroundColor();\n var colorArr = typeof backgroundColor === 'string' && parse(backgroundColor);\n if (!colorArr) {\n colorArr = [255, 255, 255, 1];\n }\n var alpha = colorArr[3];\n var isDark = this.__zr.isDarkMode();\n for (var i = 0; i < 3; i++) {\n colorArr[i] = colorArr[i] * alpha + (isDark ? 0 : 255) * (1 - alpha);\n }\n colorArr[3] = 1;\n return stringify(colorArr, 'rgba');\n };\n Element.prototype.traverse = function (cb, context) { };\n Element.prototype.attrKV = function (key, value) {\n if (key === 'textConfig') {\n this.setTextConfig(value);\n }\n else if (key === 'textContent') {\n this.setTextContent(value);\n }\n else if (key === 'clipPath') {\n this.setClipPath(value);\n }\n else if (key === 'extra') {\n this.extra = this.extra || {};\n extend(this.extra, value);\n }\n else {\n this[key] = value;\n }\n };\n Element.prototype.hide = function () {\n this.ignore = true;\n this.markRedraw();\n };\n Element.prototype.show = function () {\n this.ignore = false;\n this.markRedraw();\n };\n Element.prototype.attr = function (keyOrObj, value) {\n if (typeof keyOrObj === 'string') {\n this.attrKV(keyOrObj, value);\n }\n else if (isObject(keyOrObj)) {\n var obj = keyOrObj;\n var keysArr = keys(obj);\n for (var i = 0; i < keysArr.length; i++) {\n var key = keysArr[i];\n this.attrKV(key, keyOrObj[key]);\n }\n }\n this.markRedraw();\n return this;\n };\n Element.prototype.saveCurrentToNormalState = function (toState) {\n this._innerSaveToNormal(toState);\n var normalState = this._normalState;\n for (var i = 0; i < this.animators.length; i++) {\n var animator = this.animators[i];\n var fromStateTransition = animator.__fromStateTransition;\n if (fromStateTransition && fromStateTransition !== PRESERVED_NORMAL_STATE) {\n continue;\n }\n var targetName = animator.targetName;\n var target = targetName\n ? normalState[targetName] : normalState;\n animator.saveFinalToTarget(target);\n }\n };\n Element.prototype._innerSaveToNormal = function (toState) {\n var normalState = this._normalState;\n if (!normalState) {\n normalState = this._normalState = {};\n }\n if (toState.textConfig && !normalState.textConfig) {\n normalState.textConfig = this.textConfig;\n }\n this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);\n };\n Element.prototype._savePrimaryToNormal = function (toState, normalState, primaryKeys) {\n for (var i = 0; i < primaryKeys.length; i++) {\n var key = primaryKeys[i];\n if (toState[key] != null && !(key in normalState)) {\n normalState[key] = this[key];\n }\n }\n };\n Element.prototype.hasState = function () {\n return this.currentStates.length > 0;\n };\n Element.prototype.getState = function (name) {\n return this.states[name];\n };\n Element.prototype.ensureState = function (name) {\n var states = this.states;\n if (!states[name]) {\n states[name] = {};\n }\n return states[name];\n };\n Element.prototype.clearStates = function (noAnimation) {\n this.useState(PRESERVED_NORMAL_STATE, false, noAnimation);\n };\n Element.prototype.useState = function (stateName, keepCurrentStates, noAnimation, forceUseHoverLayer) {\n var toNormalState = stateName === PRESERVED_NORMAL_STATE;\n var hasStates = this.hasState();\n if (!hasStates && toNormalState) {\n return;\n }\n var currentStates = this.currentStates;\n var animationCfg = this.stateTransition;\n if (indexOf(currentStates, stateName) >= 0 && (keepCurrentStates || currentStates.length === 1)) {\n return;\n }\n var state;\n if (this.stateProxy && !toNormalState) {\n state = this.stateProxy(stateName);\n }\n if (!state) {\n state = (this.states && this.states[stateName]);\n }\n if (!state && !toNormalState) {\n logError(\"State \" + stateName + \" not exists.\");\n return;\n }\n if (!toNormalState) {\n this.saveCurrentToNormalState(state);\n }\n var useHoverLayer = !!((state && state.hoverLayer) || forceUseHoverLayer);\n if (useHoverLayer) {\n this._toggleHoverLayerFlag(true);\n }\n this._applyStateObj(stateName, state, this._normalState, keepCurrentStates, !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0, animationCfg);\n var textContent = this._textContent;\n var textGuide = this._textGuide;\n if (textContent) {\n textContent.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);\n }\n if (textGuide) {\n textGuide.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);\n }\n if (toNormalState) {\n this.currentStates = [];\n this._normalState = {};\n }\n else {\n if (!keepCurrentStates) {\n this.currentStates = [stateName];\n }\n else {\n this.currentStates.push(stateName);\n }\n }\n this._updateAnimationTargets();\n this.markRedraw();\n if (!useHoverLayer && this.__inHover) {\n this._toggleHoverLayerFlag(false);\n this.__dirty &= ~REDARAW_BIT;\n }\n return state;\n };\n Element.prototype.useStates = function (states, noAnimation, forceUseHoverLayer) {\n if (!states.length) {\n this.clearStates();\n }\n else {\n var stateObjects = [];\n var currentStates = this.currentStates;\n var len = states.length;\n var notChange = len === currentStates.length;\n if (notChange) {\n for (var i = 0; i < len; i++) {\n if (states[i] !== currentStates[i]) {\n notChange = false;\n break;\n }\n }\n }\n if (notChange) {\n return;\n }\n for (var i = 0; i < len; i++) {\n var stateName = states[i];\n var stateObj = void 0;\n if (this.stateProxy) {\n stateObj = this.stateProxy(stateName, states);\n }\n if (!stateObj) {\n stateObj = this.states[stateName];\n }\n if (stateObj) {\n stateObjects.push(stateObj);\n }\n }\n var lastStateObj = stateObjects[len - 1];\n var useHoverLayer = !!((lastStateObj && lastStateObj.hoverLayer) || forceUseHoverLayer);\n if (useHoverLayer) {\n this._toggleHoverLayerFlag(true);\n }\n var mergedState = this._mergeStates(stateObjects);\n var animationCfg = this.stateTransition;\n this.saveCurrentToNormalState(mergedState);\n this._applyStateObj(states.join(','), mergedState, this._normalState, false, !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0, animationCfg);\n var textContent = this._textContent;\n var textGuide = this._textGuide;\n if (textContent) {\n textContent.useStates(states, noAnimation, useHoverLayer);\n }\n if (textGuide) {\n textGuide.useStates(states, noAnimation, useHoverLayer);\n }\n this._updateAnimationTargets();\n this.currentStates = states.slice();\n this.markRedraw();\n if (!useHoverLayer && this.__inHover) {\n this._toggleHoverLayerFlag(false);\n this.__dirty &= ~REDARAW_BIT;\n }\n }\n };\n Element.prototype._updateAnimationTargets = function () {\n for (var i = 0; i < this.animators.length; i++) {\n var animator = this.animators[i];\n if (animator.targetName) {\n animator.changeTarget(this[animator.targetName]);\n }\n }\n };\n Element.prototype.removeState = function (state) {\n var idx = indexOf(this.currentStates, state);\n if (idx >= 0) {\n var currentStates = this.currentStates.slice();\n currentStates.splice(idx, 1);\n this.useStates(currentStates);\n }\n };\n Element.prototype.replaceState = function (oldState, newState, forceAdd) {\n var currentStates = this.currentStates.slice();\n var idx = indexOf(currentStates, oldState);\n var newStateExists = indexOf(currentStates, newState) >= 0;\n if (idx >= 0) {\n if (!newStateExists) {\n currentStates[idx] = newState;\n }\n else {\n currentStates.splice(idx, 1);\n }\n }\n else if (forceAdd && !newStateExists) {\n currentStates.push(newState);\n }\n this.useStates(currentStates);\n };\n Element.prototype.toggleState = function (state, enable) {\n if (enable) {\n this.useState(state, true);\n }\n else {\n this.removeState(state);\n }\n };\n Element.prototype._mergeStates = function (states) {\n var mergedState = {};\n var mergedTextConfig;\n for (var i = 0; i < states.length; i++) {\n var state = states[i];\n extend(mergedState, state);\n if (state.textConfig) {\n mergedTextConfig = mergedTextConfig || {};\n extend(mergedTextConfig, state.textConfig);\n }\n }\n if (mergedTextConfig) {\n mergedState.textConfig = mergedTextConfig;\n }\n return mergedState;\n };\n Element.prototype._applyStateObj = function (stateName, state, normalState, keepCurrentStates, transition, animationCfg) {\n var needsRestoreToNormal = !(state && keepCurrentStates);\n if (state && state.textConfig) {\n this.textConfig = extend({}, keepCurrentStates ? this.textConfig : normalState.textConfig);\n extend(this.textConfig, state.textConfig);\n }\n else if (needsRestoreToNormal) {\n if (normalState.textConfig) {\n this.textConfig = normalState.textConfig;\n }\n }\n var transitionTarget = {};\n var hasTransition = false;\n for (var i = 0; i < PRIMARY_STATES_KEYS.length; i++) {\n var key = PRIMARY_STATES_KEYS[i];\n var propNeedsTransition = transition && DEFAULT_ANIMATABLE_MAP[key];\n if (state && state[key] != null) {\n if (propNeedsTransition) {\n hasTransition = true;\n transitionTarget[key] = state[key];\n }\n else {\n this[key] = state[key];\n }\n }\n else if (needsRestoreToNormal) {\n if (normalState[key] != null) {\n if (propNeedsTransition) {\n hasTransition = true;\n transitionTarget[key] = normalState[key];\n }\n else {\n this[key] = normalState[key];\n }\n }\n }\n }\n if (!transition) {\n for (var i = 0; i < this.animators.length; i++) {\n var animator = this.animators[i];\n var targetName = animator.targetName;\n animator.__changeFinalValue(targetName\n ? (state || normalState)[targetName]\n : (state || normalState));\n }\n }\n if (hasTransition) {\n this._transitionState(stateName, transitionTarget, animationCfg);\n }\n };\n Element.prototype._attachComponent = function (componentEl) {\n if (componentEl.__zr && !componentEl.__hostTarget) {\n throw new Error('Text element has been added to zrender.');\n }\n if (componentEl === this) {\n throw new Error('Recursive component attachment.');\n }\n var zr = this.__zr;\n if (zr) {\n componentEl.addSelfToZr(zr);\n }\n componentEl.__zr = zr;\n componentEl.__hostTarget = this;\n };\n Element.prototype._detachComponent = function (componentEl) {\n if (componentEl.__zr) {\n componentEl.removeSelfFromZr(componentEl.__zr);\n }\n componentEl.__zr = null;\n componentEl.__hostTarget = null;\n };\n Element.prototype.getClipPath = function () {\n return this._clipPath;\n };\n Element.prototype.setClipPath = function (clipPath) {\n if (this._clipPath && this._clipPath !== clipPath) {\n this.removeClipPath();\n }\n this._attachComponent(clipPath);\n this._clipPath = clipPath;\n this.markRedraw();\n };\n Element.prototype.removeClipPath = function () {\n var clipPath = this._clipPath;\n if (clipPath) {\n this._detachComponent(clipPath);\n this._clipPath = null;\n this.markRedraw();\n }\n };\n Element.prototype.getTextContent = function () {\n return this._textContent;\n };\n Element.prototype.setTextContent = function (textEl) {\n var previousTextContent = this._textContent;\n if (previousTextContent === textEl) {\n return;\n }\n if (previousTextContent && previousTextContent !== textEl) {\n this.removeTextContent();\n }\n if (textEl.__zr && !textEl.__hostTarget) {\n throw new Error('Text element has been added to zrender.');\n }\n textEl.attachedTransform = new Transformable();\n this._attachComponent(textEl);\n this._textContent = textEl;\n this.markRedraw();\n };\n Element.prototype.setTextConfig = function (cfg) {\n if (!this.textConfig) {\n this.textConfig = {};\n }\n extend(this.textConfig, cfg);\n this.markRedraw();\n };\n Element.prototype.removeTextConfig = function () {\n this.textConfig = null;\n this.markRedraw();\n };\n Element.prototype.removeTextContent = function () {\n var textEl = this._textContent;\n if (textEl) {\n textEl.attachedTransform = null;\n this._detachComponent(textEl);\n this._textContent = null;\n this._innerTextDefaultStyle = null;\n this.markRedraw();\n }\n };\n Element.prototype.getTextGuideLine = function () {\n return this._textGuide;\n };\n Element.prototype.setTextGuideLine = function (guideLine) {\n if (this._textGuide && this._textGuide !== guideLine) {\n this.removeTextGuideLine();\n }\n this._attachComponent(guideLine);\n this._textGuide = guideLine;\n this.markRedraw();\n };\n Element.prototype.removeTextGuideLine = function () {\n var textGuide = this._textGuide;\n if (textGuide) {\n this._detachComponent(textGuide);\n this._textGuide = null;\n this.markRedraw();\n }\n };\n Element.prototype.markRedraw = function () {\n this.__dirty |= REDARAW_BIT;\n var zr = this.__zr;\n if (zr) {\n if (this.__inHover) {\n zr.refreshHover();\n }\n else {\n zr.refresh();\n }\n }\n if (this.__hostTarget) {\n this.__hostTarget.markRedraw();\n }\n };\n Element.prototype.dirty = function () {\n this.markRedraw();\n };\n Element.prototype._toggleHoverLayerFlag = function (inHover) {\n this.__inHover = inHover;\n var textContent = this._textContent;\n var textGuide = this._textGuide;\n if (textContent) {\n textContent.__inHover = inHover;\n }\n if (textGuide) {\n textGuide.__inHover = inHover;\n }\n };\n Element.prototype.addSelfToZr = function (zr) {\n this.__zr = zr;\n var animators = this.animators;\n if (animators) {\n for (var i = 0; i < animators.length; i++) {\n zr.animation.addAnimator(animators[i]);\n }\n }\n if (this._clipPath) {\n this._clipPath.addSelfToZr(zr);\n }\n if (this._textContent) {\n this._textContent.addSelfToZr(zr);\n }\n if (this._textGuide) {\n this._textGuide.addSelfToZr(zr);\n }\n };\n Element.prototype.removeSelfFromZr = function (zr) {\n this.__zr = null;\n var animators = this.animators;\n if (animators) {\n for (var i = 0; i < animators.length; i++) {\n zr.animation.removeAnimator(animators[i]);\n }\n }\n if (this._clipPath) {\n this._clipPath.removeSelfFromZr(zr);\n }\n if (this._textContent) {\n this._textContent.removeSelfFromZr(zr);\n }\n if (this._textGuide) {\n this._textGuide.removeSelfFromZr(zr);\n }\n };\n Element.prototype.animate = function (key, loop) {\n var target = key ? this[key] : this;\n if (!target) {\n logError('Property \"'\n + key\n + '\" is not existed in element '\n + this.id);\n return;\n }\n var animator = new Animator(target, loop);\n this.addAnimator(animator, key);\n return animator;\n };\n Element.prototype.addAnimator = function (animator, key) {\n var zr = this.__zr;\n var el = this;\n animator.during(function () {\n el.updateDuringAnimation(key);\n }).done(function () {\n var animators = el.animators;\n var idx = indexOf(animators, animator);\n if (idx >= 0) {\n animators.splice(idx, 1);\n }\n });\n this.animators.push(animator);\n if (zr) {\n zr.animation.addAnimator(animator);\n }\n zr && zr.wakeUp();\n };\n Element.prototype.updateDuringAnimation = function (key) {\n this.markRedraw();\n };\n Element.prototype.stopAnimation = function (scope, forwardToLast) {\n var animators = this.animators;\n var len = animators.length;\n var leftAnimators = [];\n for (var i = 0; i < len; i++) {\n var animator = animators[i];\n if (!scope || scope === animator.scope) {\n animator.stop(forwardToLast);\n }\n else {\n leftAnimators.push(animator);\n }\n }\n this.animators = leftAnimators;\n return this;\n };\n Element.prototype.animateTo = function (target, cfg, animationProps) {\n animateTo(this, target, cfg, animationProps);\n };\n Element.prototype.animateFrom = function (target, cfg, animationProps) {\n animateTo(this, target, cfg, animationProps, true);\n };\n Element.prototype._transitionState = function (stateName, target, cfg, animationProps) {\n var animators = animateTo(this, target, cfg, animationProps);\n for (var i = 0; i < animators.length; i++) {\n animators[i].__fromStateTransition = stateName;\n }\n };\n Element.prototype.getBoundingRect = function () {\n return null;\n };\n Element.prototype.getPaintRect = function () {\n return null;\n };\n Element.initDefaultProps = (function () {\n var elProto = Element.prototype;\n elProto.type = 'element';\n elProto.name = '';\n elProto.ignore = false;\n elProto.silent = false;\n elProto.isGroup = false;\n elProto.draggable = false;\n elProto.dragging = false;\n elProto.ignoreClip = false;\n elProto.__inHover = false;\n elProto.__dirty = REDARAW_BIT;\n var logs = {};\n function logDeprecatedError(key, xKey, yKey) {\n if (!logs[key + xKey + yKey]) {\n console.warn(\"DEPRECATED: '\" + key + \"' has been deprecated. use '\" + xKey + \"', '\" + yKey + \"' instead\");\n logs[key + xKey + yKey] = true;\n }\n }\n function createLegacyProperty(key, privateKey, xKey, yKey) {\n Object.defineProperty(elProto, key, {\n get: function () {\n logDeprecatedError(key, xKey, yKey);\n if (!this[privateKey]) {\n var pos = this[privateKey] = [];\n enhanceArray(this, pos);\n }\n return this[privateKey];\n },\n set: function (pos) {\n logDeprecatedError(key, xKey, yKey);\n this[xKey] = pos[0];\n this[yKey] = pos[1];\n this[privateKey] = pos;\n enhanceArray(this, pos);\n }\n });\n function enhanceArray(self, pos) {\n Object.defineProperty(pos, 0, {\n get: function () {\n return self[xKey];\n },\n set: function (val) {\n self[xKey] = val;\n }\n });\n Object.defineProperty(pos, 1, {\n get: function () {\n return self[yKey];\n },\n set: function (val) {\n self[yKey] = val;\n }\n });\n }\n }\n if (Object.defineProperty && (!env.browser.ie || env.browser.version > 8)) {\n createLegacyProperty('position', '_legacyPos', 'x', 'y');\n createLegacyProperty('scale', '_legacyScale', 'scaleX', 'scaleY');\n createLegacyProperty('origin', '_legacyOrigin', 'originX', 'originY');\n }\n })();\n return Element;\n}());\nmixin(Element, Eventful);\nmixin(Element, Transformable);\nfunction animateTo(animatable, target, cfg, animationProps, reverse) {\n cfg = cfg || {};\n var animators = [];\n animateToShallow(animatable, '', animatable, target, cfg, animationProps, animators, reverse);\n var finishCount = animators.length;\n var doneHappened = false;\n var cfgDone = cfg.done;\n var cfgAborted = cfg.aborted;\n var doneCb = function () {\n doneHappened = true;\n finishCount--;\n if (finishCount <= 0) {\n doneHappened\n ? (cfgDone && cfgDone())\n : (cfgAborted && cfgAborted());\n }\n };\n var abortedCb = function () {\n finishCount--;\n if (finishCount <= 0) {\n doneHappened\n ? (cfgDone && cfgDone())\n : (cfgAborted && cfgAborted());\n }\n };\n if (!finishCount) {\n cfgDone && cfgDone();\n }\n if (animators.length > 0 && cfg.during) {\n animators[0].during(function (target, percent) {\n cfg.during(percent);\n });\n }\n for (var i = 0; i < animators.length; i++) {\n var animator = animators[i];\n if (doneCb) {\n animator.done(doneCb);\n }\n if (abortedCb) {\n animator.aborted(abortedCb);\n }\n animator.start(cfg.easing, cfg.force);\n }\n return animators;\n}\nfunction copyArrShallow(source, target, len) {\n for (var i = 0; i < len; i++) {\n source[i] = target[i];\n }\n}\nfunction is2DArray(value) {\n return isArrayLike(value[0]);\n}\nfunction copyValue(target, source, key) {\n if (isArrayLike(source[key])) {\n if (!isArrayLike(target[key])) {\n target[key] = [];\n }\n if (isTypedArray(source[key])) {\n var len = source[key].length;\n if (target[key].length !== len) {\n target[key] = new (source[key].constructor)(len);\n copyArrShallow(target[key], source[key], len);\n }\n }\n else {\n var sourceArr = source[key];\n var targetArr = target[key];\n var len0 = sourceArr.length;\n if (is2DArray(sourceArr)) {\n var len1 = sourceArr[0].length;\n for (var i = 0; i < len0; i++) {\n if (!targetArr[i]) {\n targetArr[i] = Array.prototype.slice.call(sourceArr[i]);\n }\n else {\n copyArrShallow(targetArr[i], sourceArr[i], len1);\n }\n }\n }\n else {\n copyArrShallow(targetArr, sourceArr, len0);\n }\n targetArr.length = sourceArr.length;\n }\n }\n else {\n target[key] = source[key];\n }\n}\nfunction animateToShallow(animatable, topKey, source, target, cfg, animationProps, animators, reverse) {\n var animatableKeys = [];\n var changedKeys = [];\n var targetKeys = keys(target);\n var duration = cfg.duration;\n var delay = cfg.delay;\n var additive = cfg.additive;\n var setToFinal = cfg.setToFinal;\n var animateAll = !isObject(animationProps);\n for (var k = 0; k < targetKeys.length; k++) {\n var innerKey = targetKeys[k];\n if (source[innerKey] != null\n && target[innerKey] != null\n && (animateAll || animationProps[innerKey])) {\n if (isObject(target[innerKey]) && !isArrayLike(target[innerKey])) {\n if (topKey) {\n if (!reverse) {\n source[innerKey] = target[innerKey];\n animatable.updateDuringAnimation(topKey);\n }\n continue;\n }\n animateToShallow(animatable, innerKey, source[innerKey], target[innerKey], cfg, animationProps && animationProps[innerKey], animators, reverse);\n }\n else {\n animatableKeys.push(innerKey);\n changedKeys.push(innerKey);\n }\n }\n else if (!reverse) {\n source[innerKey] = target[innerKey];\n animatable.updateDuringAnimation(topKey);\n changedKeys.push(innerKey);\n }\n }\n var keyLen = animatableKeys.length;\n if (keyLen > 0\n || (cfg.force && !animators.length)) {\n var existsAnimators = animatable.animators;\n var existsAnimatorsOnSameTarget = [];\n for (var i = 0; i < existsAnimators.length; i++) {\n if (existsAnimators[i].targetName === topKey) {\n existsAnimatorsOnSameTarget.push(existsAnimators[i]);\n }\n }\n if (!additive && existsAnimatorsOnSameTarget.length) {\n for (var i = 0; i < existsAnimatorsOnSameTarget.length; i++) {\n var allAborted = existsAnimatorsOnSameTarget[i].stopTracks(changedKeys);\n if (allAborted) {\n var idx = indexOf(existsAnimators, existsAnimatorsOnSameTarget[i]);\n existsAnimators.splice(idx, 1);\n }\n }\n }\n var revertedSource = void 0;\n var reversedTarget = void 0;\n var sourceClone = void 0;\n if (reverse) {\n reversedTarget = {};\n if (setToFinal) {\n revertedSource = {};\n }\n for (var i = 0; i < keyLen; i++) {\n var innerKey = animatableKeys[i];\n reversedTarget[innerKey] = source[innerKey];\n if (setToFinal) {\n revertedSource[innerKey] = target[innerKey];\n }\n else {\n source[innerKey] = target[innerKey];\n }\n }\n }\n else if (setToFinal) {\n sourceClone = {};\n for (var i = 0; i < keyLen; i++) {\n var innerKey = animatableKeys[i];\n sourceClone[innerKey] = cloneValue(source[innerKey]);\n copyValue(source, target, innerKey);\n }\n }\n var animator = new Animator(source, false, additive ? existsAnimatorsOnSameTarget : null);\n animator.targetName = topKey;\n if (cfg.scope) {\n animator.scope = cfg.scope;\n }\n if (setToFinal && revertedSource) {\n animator.whenWithKeys(0, revertedSource, animatableKeys);\n }\n if (sourceClone) {\n animator.whenWithKeys(0, sourceClone, animatableKeys);\n }\n animator.whenWithKeys(duration == null ? 500 : duration, reverse ? reversedTarget : target, animatableKeys).delay(delay || 0);\n animatable.addAnimator(animator, topKey);\n animators.push(animator);\n }\n}\nexport default Element;\n","import { __extends } from \"tslib\";\nimport Element from '../Element';\nimport BoundingRect from '../core/BoundingRect';\nimport { keys, extend, createObject } from '../core/util';\nimport { REDARAW_BIT, STYLE_CHANGED_BIT } from './constants';\nvar STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));\nexport var DEFAULT_COMMON_STYLE = {\n shadowBlur: 0,\n shadowOffsetX: 0,\n shadowOffsetY: 0,\n shadowColor: '#000',\n opacity: 1,\n blend: 'source-over'\n};\nexport var DEFAULT_COMMON_ANIMATION_PROPS = {\n style: {\n shadowBlur: true,\n shadowOffsetX: true,\n shadowOffsetY: true,\n shadowColor: true,\n opacity: true\n }\n};\nDEFAULT_COMMON_STYLE[STYLE_MAGIC_KEY] = true;\nvar PRIMARY_STATES_KEYS = ['z', 'z2', 'invisible'];\nvar PRIMARY_STATES_KEYS_IN_HOVER_LAYER = ['invisible'];\nvar Displayable = (function (_super) {\n __extends(Displayable, _super);\n function Displayable(props) {\n return _super.call(this, props) || this;\n }\n Displayable.prototype._init = function (props) {\n var keysArr = keys(props);\n for (var i = 0; i < keysArr.length; i++) {\n var key = keysArr[i];\n if (key === 'style') {\n this.useStyle(props[key]);\n }\n else {\n _super.prototype.attrKV.call(this, key, props[key]);\n }\n }\n if (!this.style) {\n this.useStyle({});\n }\n };\n Displayable.prototype.beforeBrush = function () { };\n Displayable.prototype.afterBrush = function () { };\n Displayable.prototype.innerBeforeBrush = function () { };\n Displayable.prototype.innerAfterBrush = function () { };\n Displayable.prototype.shouldBePainted = function (viewWidth, viewHeight, considerClipPath, considerAncestors) {\n var m = this.transform;\n if (this.ignore\n || this.invisible\n || this.style.opacity === 0\n || (this.culling\n && isDisplayableCulled(this, viewWidth, viewHeight))\n || (m && !m[0] && !m[3])) {\n return false;\n }\n if (considerClipPath && this.__clipPaths) {\n for (var i = 0; i < this.__clipPaths.length; ++i) {\n if (this.__clipPaths[i].isZeroArea()) {\n return false;\n }\n }\n }\n if (considerAncestors && this.parent) {\n var parent_1 = this.parent;\n while (parent_1) {\n if (parent_1.ignore) {\n return false;\n }\n parent_1 = parent_1.parent;\n }\n }\n return true;\n };\n Displayable.prototype.contain = function (x, y) {\n return this.rectContain(x, y);\n };\n Displayable.prototype.traverse = function (cb, context) {\n cb.call(context, this);\n };\n Displayable.prototype.rectContain = function (x, y) {\n var coord = this.transformCoordToLocal(x, y);\n var rect = this.getBoundingRect();\n return rect.contain(coord[0], coord[1]);\n };\n Displayable.prototype.getPaintRect = function () {\n var rect = this._paintRect;\n if (!this._paintRect || this.__dirty) {\n var transform = this.transform;\n var elRect = this.getBoundingRect();\n var style = this.style;\n var shadowSize = style.shadowBlur || 0;\n var shadowOffsetX = style.shadowOffsetX || 0;\n var shadowOffsetY = style.shadowOffsetY || 0;\n rect = this._paintRect || (this._paintRect = new BoundingRect(0, 0, 0, 0));\n if (transform) {\n BoundingRect.applyTransform(rect, elRect, transform);\n }\n else {\n rect.copy(elRect);\n }\n if (shadowSize || shadowOffsetX || shadowOffsetY) {\n rect.width += shadowSize * 2 + Math.abs(shadowOffsetX);\n rect.height += shadowSize * 2 + Math.abs(shadowOffsetY);\n rect.x = Math.min(rect.x, rect.x + shadowOffsetX - shadowSize);\n rect.y = Math.min(rect.y, rect.y + shadowOffsetY - shadowSize);\n }\n var tolerance = this.dirtyRectTolerance;\n if (!rect.isZero()) {\n rect.x = Math.floor(rect.x - tolerance);\n rect.y = Math.floor(rect.y - tolerance);\n rect.width = Math.ceil(rect.width + 1 + tolerance * 2);\n rect.height = Math.ceil(rect.height + 1 + tolerance * 2);\n }\n }\n return rect;\n };\n Displayable.prototype.setPrevPaintRect = function (paintRect) {\n if (paintRect) {\n this._prevPaintRect = this._prevPaintRect || new BoundingRect(0, 0, 0, 0);\n this._prevPaintRect.copy(paintRect);\n }\n else {\n this._prevPaintRect = null;\n }\n };\n Displayable.prototype.getPrevPaintRect = function () {\n return this._prevPaintRect;\n };\n Displayable.prototype.animateStyle = function (loop) {\n return this.animate('style', loop);\n };\n Displayable.prototype.updateDuringAnimation = function (targetKey) {\n if (targetKey === 'style') {\n this.dirtyStyle();\n }\n else {\n this.markRedraw();\n }\n };\n Displayable.prototype.attrKV = function (key, value) {\n if (key !== 'style') {\n _super.prototype.attrKV.call(this, key, value);\n }\n else {\n if (!this.style) {\n this.useStyle(value);\n }\n else {\n this.setStyle(value);\n }\n }\n };\n Displayable.prototype.setStyle = function (keyOrObj, value) {\n if (typeof keyOrObj === 'string') {\n this.style[keyOrObj] = value;\n }\n else {\n extend(this.style, keyOrObj);\n }\n this.dirtyStyle();\n return this;\n };\n Displayable.prototype.dirtyStyle = function (notRedraw) {\n if (!notRedraw) {\n this.markRedraw();\n }\n this.__dirty |= STYLE_CHANGED_BIT;\n if (this._rect) {\n this._rect = null;\n }\n };\n Displayable.prototype.dirty = function () {\n this.dirtyStyle();\n };\n Displayable.prototype.styleChanged = function () {\n return !!(this.__dirty & STYLE_CHANGED_BIT);\n };\n Displayable.prototype.styleUpdated = function () {\n this.__dirty &= ~STYLE_CHANGED_BIT;\n };\n Displayable.prototype.createStyle = function (obj) {\n return createObject(DEFAULT_COMMON_STYLE, obj);\n };\n Displayable.prototype.useStyle = function (obj) {\n if (!obj[STYLE_MAGIC_KEY]) {\n obj = this.createStyle(obj);\n }\n if (this.__inHover) {\n this.__hoverStyle = obj;\n }\n else {\n this.style = obj;\n }\n this.dirtyStyle();\n };\n Displayable.prototype.isStyleObject = function (obj) {\n return obj[STYLE_MAGIC_KEY];\n };\n Displayable.prototype._innerSaveToNormal = function (toState) {\n _super.prototype._innerSaveToNormal.call(this, toState);\n var normalState = this._normalState;\n if (toState.style && !normalState.style) {\n normalState.style = this._mergeStyle(this.createStyle(), this.style);\n }\n this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);\n };\n Displayable.prototype._applyStateObj = function (stateName, state, normalState, keepCurrentStates, transition, animationCfg) {\n _super.prototype._applyStateObj.call(this, stateName, state, normalState, keepCurrentStates, transition, animationCfg);\n var needsRestoreToNormal = !(state && keepCurrentStates);\n var targetStyle;\n if (state && state.style) {\n if (transition) {\n if (keepCurrentStates) {\n targetStyle = state.style;\n }\n else {\n targetStyle = this._mergeStyle(this.createStyle(), normalState.style);\n this._mergeStyle(targetStyle, state.style);\n }\n }\n else {\n targetStyle = this._mergeStyle(this.createStyle(), keepCurrentStates ? this.style : normalState.style);\n this._mergeStyle(targetStyle, state.style);\n }\n }\n else if (needsRestoreToNormal) {\n targetStyle = normalState.style;\n }\n if (targetStyle) {\n if (transition) {\n var sourceStyle = this.style;\n this.style = this.createStyle(needsRestoreToNormal ? {} : sourceStyle);\n if (needsRestoreToNormal) {\n var changedKeys = keys(sourceStyle);\n for (var i = 0; i < changedKeys.length; i++) {\n var key = changedKeys[i];\n if (key in targetStyle) {\n targetStyle[key] = targetStyle[key];\n this.style[key] = sourceStyle[key];\n }\n }\n }\n var targetKeys = keys(targetStyle);\n for (var i = 0; i < targetKeys.length; i++) {\n var key = targetKeys[i];\n this.style[key] = this.style[key];\n }\n this._transitionState(stateName, {\n style: targetStyle\n }, animationCfg, this.getAnimationStyleProps());\n }\n else {\n this.useStyle(targetStyle);\n }\n }\n var statesKeys = this.__inHover ? PRIMARY_STATES_KEYS_IN_HOVER_LAYER : PRIMARY_STATES_KEYS;\n for (var i = 0; i < statesKeys.length; i++) {\n var key = statesKeys[i];\n if (state && state[key] != null) {\n this[key] = state[key];\n }\n else if (needsRestoreToNormal) {\n if (normalState[key] != null) {\n this[key] = normalState[key];\n }\n }\n }\n };\n Displayable.prototype._mergeStates = function (states) {\n var mergedState = _super.prototype._mergeStates.call(this, states);\n var mergedStyle;\n for (var i = 0; i < states.length; i++) {\n var state = states[i];\n if (state.style) {\n mergedStyle = mergedStyle || {};\n this._mergeStyle(mergedStyle, state.style);\n }\n }\n if (mergedStyle) {\n mergedState.style = mergedStyle;\n }\n return mergedState;\n };\n Displayable.prototype._mergeStyle = function (targetStyle, sourceStyle) {\n extend(targetStyle, sourceStyle);\n return targetStyle;\n };\n Displayable.prototype.getAnimationStyleProps = function () {\n return DEFAULT_COMMON_ANIMATION_PROPS;\n };\n Displayable.initDefaultProps = (function () {\n var dispProto = Displayable.prototype;\n dispProto.type = 'displayable';\n dispProto.invisible = false;\n dispProto.z = 0;\n dispProto.z2 = 0;\n dispProto.zlevel = 0;\n dispProto.culling = false;\n dispProto.cursor = 'pointer';\n dispProto.rectHover = false;\n dispProto.incremental = false;\n dispProto._rect = null;\n dispProto.dirtyRectTolerance = 0;\n dispProto.__dirty = REDARAW_BIT | STYLE_CHANGED_BIT;\n })();\n return Displayable;\n}(Element));\nvar tmpRect = new BoundingRect(0, 0, 0, 0);\nvar viewRect = new BoundingRect(0, 0, 0, 0);\nfunction isDisplayableCulled(el, width, height) {\n tmpRect.copy(el.getBoundingRect());\n if (el.transform) {\n tmpRect.applyTransform(el.transform);\n }\n viewRect.width = width;\n viewRect.height = height;\n return !tmpRect.intersect(viewRect);\n}\nexport default Displayable;\n","import { create as v2Create, distSquare as v2DistSquare } from './vector';\nvar mathPow = Math.pow;\nvar mathSqrt = Math.sqrt;\nvar EPSILON = 1e-8;\nvar EPSILON_NUMERIC = 1e-4;\nvar THREE_SQRT = mathSqrt(3);\nvar ONE_THIRD = 1 / 3;\nvar _v0 = v2Create();\nvar _v1 = v2Create();\nvar _v2 = v2Create();\nfunction isAroundZero(val) {\n return val > -EPSILON && val < EPSILON;\n}\nfunction isNotAroundZero(val) {\n return val > EPSILON || val < -EPSILON;\n}\nexport function cubicAt(p0, p1, p2, p3, t) {\n var onet = 1 - t;\n return onet * onet * (onet * p0 + 3 * t * p1)\n + t * t * (t * p3 + 3 * onet * p2);\n}\nexport function cubicDerivativeAt(p0, p1, p2, p3, t) {\n var onet = 1 - t;\n return 3 * (((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet\n + (p3 - p2) * t * t);\n}\nexport function cubicRootAt(p0, p1, p2, p3, val, roots) {\n var a = p3 + 3 * (p1 - p2) - p0;\n var b = 3 * (p2 - p1 * 2 + p0);\n var c = 3 * (p1 - p0);\n var d = p0 - val;\n var A = b * b - 3 * a * c;\n var B = b * c - 9 * a * d;\n var C = c * c - 3 * b * d;\n var n = 0;\n if (isAroundZero(A) && isAroundZero(B)) {\n if (isAroundZero(b)) {\n roots[0] = 0;\n }\n else {\n var t1 = -c / b;\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n }\n }\n else {\n var disc = B * B - 4 * A * C;\n if (isAroundZero(disc)) {\n var K = B / A;\n var t1 = -b / a + K;\n var t2 = -K / 2;\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n if (t2 >= 0 && t2 <= 1) {\n roots[n++] = t2;\n }\n }\n else if (disc > 0) {\n var discSqrt = mathSqrt(disc);\n var Y1 = A * b + 1.5 * a * (-B + discSqrt);\n var Y2 = A * b + 1.5 * a * (-B - discSqrt);\n if (Y1 < 0) {\n Y1 = -mathPow(-Y1, ONE_THIRD);\n }\n else {\n Y1 = mathPow(Y1, ONE_THIRD);\n }\n if (Y2 < 0) {\n Y2 = -mathPow(-Y2, ONE_THIRD);\n }\n else {\n Y2 = mathPow(Y2, ONE_THIRD);\n }\n var t1 = (-b - (Y1 + Y2)) / (3 * a);\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n }\n else {\n var T = (2 * A * b - 3 * a * B) / (2 * mathSqrt(A * A * A));\n var theta = Math.acos(T) / 3;\n var ASqrt = mathSqrt(A);\n var tmp = Math.cos(theta);\n var t1 = (-b - 2 * ASqrt * tmp) / (3 * a);\n var t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a);\n var t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n if (t2 >= 0 && t2 <= 1) {\n roots[n++] = t2;\n }\n if (t3 >= 0 && t3 <= 1) {\n roots[n++] = t3;\n }\n }\n }\n return n;\n}\nexport function cubicExtrema(p0, p1, p2, p3, extrema) {\n var b = 6 * p2 - 12 * p1 + 6 * p0;\n var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;\n var c = 3 * p1 - 3 * p0;\n var n = 0;\n if (isAroundZero(a)) {\n if (isNotAroundZero(b)) {\n var t1 = -c / b;\n if (t1 >= 0 && t1 <= 1) {\n extrema[n++] = t1;\n }\n }\n }\n else {\n var disc = b * b - 4 * a * c;\n if (isAroundZero(disc)) {\n extrema[0] = -b / (2 * a);\n }\n else if (disc > 0) {\n var discSqrt = mathSqrt(disc);\n var t1 = (-b + discSqrt) / (2 * a);\n var t2 = (-b - discSqrt) / (2 * a);\n if (t1 >= 0 && t1 <= 1) {\n extrema[n++] = t1;\n }\n if (t2 >= 0 && t2 <= 1) {\n extrema[n++] = t2;\n }\n }\n }\n return n;\n}\nexport function cubicSubdivide(p0, p1, p2, p3, t, out) {\n var p01 = (p1 - p0) * t + p0;\n var p12 = (p2 - p1) * t + p1;\n var p23 = (p3 - p2) * t + p2;\n var p012 = (p12 - p01) * t + p01;\n var p123 = (p23 - p12) * t + p12;\n var p0123 = (p123 - p012) * t + p012;\n out[0] = p0;\n out[1] = p01;\n out[2] = p012;\n out[3] = p0123;\n out[4] = p0123;\n out[5] = p123;\n out[6] = p23;\n out[7] = p3;\n}\nexport function cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {\n var t;\n var interval = 0.005;\n var d = Infinity;\n var prev;\n var next;\n var d1;\n var d2;\n _v0[0] = x;\n _v0[1] = y;\n for (var _t = 0; _t < 1; _t += 0.05) {\n _v1[0] = cubicAt(x0, x1, x2, x3, _t);\n _v1[1] = cubicAt(y0, y1, y2, y3, _t);\n d1 = v2DistSquare(_v0, _v1);\n if (d1 < d) {\n t = _t;\n d = d1;\n }\n }\n d = Infinity;\n for (var i = 0; i < 32; i++) {\n if (interval < EPSILON_NUMERIC) {\n break;\n }\n prev = t - interval;\n next = t + interval;\n _v1[0] = cubicAt(x0, x1, x2, x3, prev);\n _v1[1] = cubicAt(y0, y1, y2, y3, prev);\n d1 = v2DistSquare(_v1, _v0);\n if (prev >= 0 && d1 < d) {\n t = prev;\n d = d1;\n }\n else {\n _v2[0] = cubicAt(x0, x1, x2, x3, next);\n _v2[1] = cubicAt(y0, y1, y2, y3, next);\n d2 = v2DistSquare(_v2, _v0);\n if (next <= 1 && d2 < d) {\n t = next;\n d = d2;\n }\n else {\n interval *= 0.5;\n }\n }\n }\n if (out) {\n out[0] = cubicAt(x0, x1, x2, x3, t);\n out[1] = cubicAt(y0, y1, y2, y3, t);\n }\n return mathSqrt(d);\n}\nexport function cubicLength(x0, y0, x1, y1, x2, y2, x3, y3, iteration) {\n var px = x0;\n var py = y0;\n var d = 0;\n var step = 1 / iteration;\n for (var i = 1; i <= iteration; i++) {\n var t = i * step;\n var x = cubicAt(x0, x1, x2, x3, t);\n var y = cubicAt(y0, y1, y2, y3, t);\n var dx = x - px;\n var dy = y - py;\n d += Math.sqrt(dx * dx + dy * dy);\n px = x;\n py = y;\n }\n return d;\n}\nexport function quadraticAt(p0, p1, p2, t) {\n var onet = 1 - t;\n return onet * (onet * p0 + 2 * t * p1) + t * t * p2;\n}\nexport function quadraticDerivativeAt(p0, p1, p2, t) {\n return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));\n}\nexport function quadraticRootAt(p0, p1, p2, val, roots) {\n var a = p0 - 2 * p1 + p2;\n var b = 2 * (p1 - p0);\n var c = p0 - val;\n var n = 0;\n if (isAroundZero(a)) {\n if (isNotAroundZero(b)) {\n var t1 = -c / b;\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n }\n }\n else {\n var disc = b * b - 4 * a * c;\n if (isAroundZero(disc)) {\n var t1 = -b / (2 * a);\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n }\n else if (disc > 0) {\n var discSqrt = mathSqrt(disc);\n var t1 = (-b + discSqrt) / (2 * a);\n var t2 = (-b - discSqrt) / (2 * a);\n if (t1 >= 0 && t1 <= 1) {\n roots[n++] = t1;\n }\n if (t2 >= 0 && t2 <= 1) {\n roots[n++] = t2;\n }\n }\n }\n return n;\n}\nexport function quadraticExtremum(p0, p1, p2) {\n var divider = p0 + p2 - 2 * p1;\n if (divider === 0) {\n return 0.5;\n }\n else {\n return (p0 - p1) / divider;\n }\n}\nexport function quadraticSubdivide(p0, p1, p2, t, out) {\n var p01 = (p1 - p0) * t + p0;\n var p12 = (p2 - p1) * t + p1;\n var p012 = (p12 - p01) * t + p01;\n out[0] = p0;\n out[1] = p01;\n out[2] = p012;\n out[3] = p012;\n out[4] = p12;\n out[5] = p2;\n}\nexport function quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {\n var t;\n var interval = 0.005;\n var d = Infinity;\n _v0[0] = x;\n _v0[1] = y;\n for (var _t = 0; _t < 1; _t += 0.05) {\n _v1[0] = quadraticAt(x0, x1, x2, _t);\n _v1[1] = quadraticAt(y0, y1, y2, _t);\n var d1 = v2DistSquare(_v0, _v1);\n if (d1 < d) {\n t = _t;\n d = d1;\n }\n }\n d = Infinity;\n for (var i = 0; i < 32; i++) {\n if (interval < EPSILON_NUMERIC) {\n break;\n }\n var prev = t - interval;\n var next = t + interval;\n _v1[0] = quadraticAt(x0, x1, x2, prev);\n _v1[1] = quadraticAt(y0, y1, y2, prev);\n var d1 = v2DistSquare(_v1, _v0);\n if (prev >= 0 && d1 < d) {\n t = prev;\n d = d1;\n }\n else {\n _v2[0] = quadraticAt(x0, x1, x2, next);\n _v2[1] = quadraticAt(y0, y1, y2, next);\n var d2 = v2DistSquare(_v2, _v0);\n if (next <= 1 && d2 < d) {\n t = next;\n d = d2;\n }\n else {\n interval *= 0.5;\n }\n }\n }\n if (out) {\n out[0] = quadraticAt(x0, x1, x2, t);\n out[1] = quadraticAt(y0, y1, y2, t);\n }\n return mathSqrt(d);\n}\nexport function quadraticLength(x0, y0, x1, y1, x2, y2, iteration) {\n var px = x0;\n var py = y0;\n var d = 0;\n var step = 1 / iteration;\n for (var i = 1; i <= iteration; i++) {\n var t = i * step;\n var x = quadraticAt(x0, x1, x2, t);\n var y = quadraticAt(y0, y1, y2, t);\n var dx = x - px;\n var dy = y - py;\n d += Math.sqrt(dx * dx + dy * dy);\n px = x;\n py = y;\n }\n return d;\n}\n","import * as vec2 from './vector';\nimport * as curve from './curve';\nvar mathMin = Math.min;\nvar mathMax = Math.max;\nvar mathSin = Math.sin;\nvar mathCos = Math.cos;\nvar PI2 = Math.PI * 2;\nvar start = vec2.create();\nvar end = vec2.create();\nvar extremity = vec2.create();\nexport function fromPoints(points, min, max) {\n if (points.length === 0) {\n return;\n }\n var p = points[0];\n var left = p[0];\n var right = p[0];\n var top = p[1];\n var bottom = p[1];\n for (var i = 1; i < points.length; i++) {\n p = points[i];\n left = mathMin(left, p[0]);\n right = mathMax(right, p[0]);\n top = mathMin(top, p[1]);\n bottom = mathMax(bottom, p[1]);\n }\n min[0] = left;\n min[1] = top;\n max[0] = right;\n max[1] = bottom;\n}\nexport function fromLine(x0, y0, x1, y1, min, max) {\n min[0] = mathMin(x0, x1);\n min[1] = mathMin(y0, y1);\n max[0] = mathMax(x0, x1);\n max[1] = mathMax(y0, y1);\n}\nvar xDim = [];\nvar yDim = [];\nexport function fromCubic(x0, y0, x1, y1, x2, y2, x3, y3, min, max) {\n var cubicExtrema = curve.cubicExtrema;\n var cubicAt = curve.cubicAt;\n var n = cubicExtrema(x0, x1, x2, x3, xDim);\n min[0] = Infinity;\n min[1] = Infinity;\n max[0] = -Infinity;\n max[1] = -Infinity;\n for (var i = 0; i < n; i++) {\n var x = cubicAt(x0, x1, x2, x3, xDim[i]);\n min[0] = mathMin(x, min[0]);\n max[0] = mathMax(x, max[0]);\n }\n n = cubicExtrema(y0, y1, y2, y3, yDim);\n for (var i = 0; i < n; i++) {\n var y = cubicAt(y0, y1, y2, y3, yDim[i]);\n min[1] = mathMin(y, min[1]);\n max[1] = mathMax(y, max[1]);\n }\n min[0] = mathMin(x0, min[0]);\n max[0] = mathMax(x0, max[0]);\n min[0] = mathMin(x3, min[0]);\n max[0] = mathMax(x3, max[0]);\n min[1] = mathMin(y0, min[1]);\n max[1] = mathMax(y0, max[1]);\n min[1] = mathMin(y3, min[1]);\n max[1] = mathMax(y3, max[1]);\n}\nexport function fromQuadratic(x0, y0, x1, y1, x2, y2, min, max) {\n var quadraticExtremum = curve.quadraticExtremum;\n var quadraticAt = curve.quadraticAt;\n var tx = mathMax(mathMin(quadraticExtremum(x0, x1, x2), 1), 0);\n var ty = mathMax(mathMin(quadraticExtremum(y0, y1, y2), 1), 0);\n var x = quadraticAt(x0, x1, x2, tx);\n var y = quadraticAt(y0, y1, y2, ty);\n min[0] = mathMin(x0, x2, x);\n min[1] = mathMin(y0, y2, y);\n max[0] = mathMax(x0, x2, x);\n max[1] = mathMax(y0, y2, y);\n}\nexport function fromArc(x, y, rx, ry, startAngle, endAngle, anticlockwise, min, max) {\n var vec2Min = vec2.min;\n var vec2Max = vec2.max;\n var diff = Math.abs(startAngle - endAngle);\n if (diff % PI2 < 1e-4 && diff > 1e-4) {\n min[0] = x - rx;\n min[1] = y - ry;\n max[0] = x + rx;\n max[1] = y + ry;\n return;\n }\n start[0] = mathCos(startAngle) * rx + x;\n start[1] = mathSin(startAngle) * ry + y;\n end[0] = mathCos(endAngle) * rx + x;\n end[1] = mathSin(endAngle) * ry + y;\n vec2Min(min, start, end);\n vec2Max(max, start, end);\n startAngle = startAngle % (PI2);\n if (startAngle < 0) {\n startAngle = startAngle + PI2;\n }\n endAngle = endAngle % (PI2);\n if (endAngle < 0) {\n endAngle = endAngle + PI2;\n }\n if (startAngle > endAngle && !anticlockwise) {\n endAngle += PI2;\n }\n else if (startAngle < endAngle && anticlockwise) {\n startAngle += PI2;\n }\n if (anticlockwise) {\n var tmp = endAngle;\n endAngle = startAngle;\n startAngle = tmp;\n }\n for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {\n if (angle > startAngle) {\n extremity[0] = mathCos(angle) * rx + x;\n extremity[1] = mathSin(angle) * ry + y;\n vec2Min(min, extremity, min);\n vec2Max(max, extremity, max);\n }\n }\n}\n","import * as vec2 from './vector';\nimport BoundingRect from './BoundingRect';\nimport { devicePixelRatio as dpr } from '../config';\nimport { fromLine, fromCubic, fromQuadratic, fromArc } from './bbox';\nimport { cubicAt, cubicLength, cubicSubdivide, quadraticLength, quadraticSubdivide } from './curve';\nvar CMD = {\n M: 1,\n L: 2,\n C: 3,\n Q: 4,\n A: 5,\n Z: 6,\n R: 7\n};\nvar tmpOutX = [];\nvar tmpOutY = [];\nvar min = [];\nvar max = [];\nvar min2 = [];\nvar max2 = [];\nvar mathMin = Math.min;\nvar mathMax = Math.max;\nvar mathCos = Math.cos;\nvar mathSin = Math.sin;\nvar mathSqrt = Math.sqrt;\nvar mathAbs = Math.abs;\nvar PI = Math.PI;\nvar PI2 = PI * 2;\nvar hasTypedArray = typeof Float32Array !== 'undefined';\nvar tmpAngles = [];\nfunction modPI2(radian) {\n var n = Math.round(radian / PI * 1e8) / 1e8;\n return (n % 2) * PI;\n}\nexport function normalizeArcAngles(angles, anticlockwise) {\n var newStartAngle = modPI2(angles[0]);\n if (newStartAngle < 0) {\n newStartAngle += PI2;\n }\n var delta = newStartAngle - angles[0];\n var newEndAngle = angles[1];\n newEndAngle += delta;\n if (!anticlockwise && newEndAngle - newStartAngle >= PI2) {\n newEndAngle = newStartAngle + PI2;\n }\n else if (anticlockwise && newStartAngle - newEndAngle >= PI2) {\n newEndAngle = newStartAngle - PI2;\n }\n else if (!anticlockwise && newStartAngle > newEndAngle) {\n newEndAngle = newStartAngle + (PI2 - modPI2(newStartAngle - newEndAngle));\n }\n else if (anticlockwise && newStartAngle < newEndAngle) {\n newEndAngle = newStartAngle - (PI2 - modPI2(newEndAngle - newStartAngle));\n }\n angles[0] = newStartAngle;\n angles[1] = newEndAngle;\n}\nvar PathProxy = (function () {\n function PathProxy(notSaveData) {\n this.dpr = 1;\n this._xi = 0;\n this._yi = 0;\n this._x0 = 0;\n this._y0 = 0;\n this._len = 0;\n if (notSaveData) {\n this._saveData = false;\n }\n if (this._saveData) {\n this.data = [];\n }\n }\n PathProxy.prototype.increaseVersion = function () {\n this._version++;\n };\n PathProxy.prototype.getVersion = function () {\n return this._version;\n };\n PathProxy.prototype.setScale = function (sx, sy, segmentIgnoreThreshold) {\n segmentIgnoreThreshold = segmentIgnoreThreshold || 0;\n if (segmentIgnoreThreshold > 0) {\n this._ux = mathAbs(segmentIgnoreThreshold / dpr / sx) || 0;\n this._uy = mathAbs(segmentIgnoreThreshold / dpr / sy) || 0;\n }\n };\n PathProxy.prototype.setDPR = function (dpr) {\n this.dpr = dpr;\n };\n PathProxy.prototype.setContext = function (ctx) {\n this._ctx = ctx;\n };\n PathProxy.prototype.getContext = function () {\n return this._ctx;\n };\n PathProxy.prototype.beginPath = function () {\n this._ctx && this._ctx.beginPath();\n this.reset();\n return this;\n };\n PathProxy.prototype.reset = function () {\n if (this._saveData) {\n this._len = 0;\n }\n if (this._lineDash) {\n this._lineDash = null;\n this._dashOffset = 0;\n }\n if (this._pathSegLen) {\n this._pathSegLen = null;\n this._pathLen = 0;\n }\n this._version++;\n };\n PathProxy.prototype.moveTo = function (x, y) {\n this._drawPendingPt();\n this.addData(CMD.M, x, y);\n this._ctx && this._ctx.moveTo(x, y);\n this._x0 = x;\n this._y0 = y;\n this._xi = x;\n this._yi = y;\n return this;\n };\n PathProxy.prototype.lineTo = function (x, y) {\n var dx = mathAbs(x - this._xi);\n var dy = mathAbs(y - this._yi);\n var exceedUnit = dx > this._ux || dy > this._uy;\n this.addData(CMD.L, x, y);\n if (this._ctx && exceedUnit) {\n this._needsDash ? this._dashedLineTo(x, y)\n : this._ctx.lineTo(x, y);\n }\n if (exceedUnit) {\n this._xi = x;\n this._yi = y;\n this._pendingPtDist = 0;\n }\n else {\n var d2 = dx * dx + dy * dy;\n if (d2 > this._pendingPtDist) {\n this._pendingPtX = x;\n this._pendingPtY = y;\n this._pendingPtDist = d2;\n }\n }\n return this;\n };\n PathProxy.prototype.bezierCurveTo = function (x1, y1, x2, y2, x3, y3) {\n this.addData(CMD.C, x1, y1, x2, y2, x3, y3);\n if (this._ctx) {\n this._needsDash ? this._dashedBezierTo(x1, y1, x2, y2, x3, y3)\n : this._ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n }\n this._xi = x3;\n this._yi = y3;\n return this;\n };\n PathProxy.prototype.quadraticCurveTo = function (x1, y1, x2, y2) {\n this.addData(CMD.Q, x1, y1, x2, y2);\n if (this._ctx) {\n this._needsDash ? this._dashedQuadraticTo(x1, y1, x2, y2)\n : this._ctx.quadraticCurveTo(x1, y1, x2, y2);\n }\n this._xi = x2;\n this._yi = y2;\n return this;\n };\n PathProxy.prototype.arc = function (cx, cy, r, startAngle, endAngle, anticlockwise) {\n tmpAngles[0] = startAngle;\n tmpAngles[1] = endAngle;\n normalizeArcAngles(tmpAngles, anticlockwise);\n startAngle = tmpAngles[0];\n endAngle = tmpAngles[1];\n var delta = endAngle - startAngle;\n this.addData(CMD.A, cx, cy, r, r, startAngle, delta, 0, anticlockwise ? 0 : 1);\n this._ctx && this._ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);\n this._xi = mathCos(endAngle) * r + cx;\n this._yi = mathSin(endAngle) * r + cy;\n return this;\n };\n PathProxy.prototype.arcTo = function (x1, y1, x2, y2, radius) {\n if (this._ctx) {\n this._ctx.arcTo(x1, y1, x2, y2, radius);\n }\n return this;\n };\n PathProxy.prototype.rect = function (x, y, w, h) {\n this._ctx && this._ctx.rect(x, y, w, h);\n this.addData(CMD.R, x, y, w, h);\n return this;\n };\n PathProxy.prototype.closePath = function () {\n this._drawPendingPt();\n this.addData(CMD.Z);\n var ctx = this._ctx;\n var x0 = this._x0;\n var y0 = this._y0;\n if (ctx) {\n this._needsDash && this._dashedLineTo(x0, y0);\n ctx.closePath();\n }\n this._xi = x0;\n this._yi = y0;\n return this;\n };\n PathProxy.prototype.fill = function (ctx) {\n ctx && ctx.fill();\n this.toStatic();\n };\n PathProxy.prototype.stroke = function (ctx) {\n ctx && ctx.stroke();\n this.toStatic();\n };\n PathProxy.prototype.setLineDash = function (lineDash) {\n if (lineDash instanceof Array) {\n this._lineDash = lineDash;\n this._dashIdx = 0;\n var lineDashSum = 0;\n for (var i = 0; i < lineDash.length; i++) {\n lineDashSum += lineDash[i];\n }\n this._dashSum = lineDashSum;\n this._needsDash = true;\n }\n else {\n this._lineDash = null;\n this._needsDash = false;\n }\n return this;\n };\n PathProxy.prototype.setLineDashOffset = function (offset) {\n this._dashOffset = offset;\n return this;\n };\n PathProxy.prototype.len = function () {\n return this._len;\n };\n PathProxy.prototype.setData = function (data) {\n var len = data.length;\n if (!(this.data && this.data.length === len) && hasTypedArray) {\n this.data = new Float32Array(len);\n }\n for (var i = 0; i < len; i++) {\n this.data[i] = data[i];\n }\n this._len = len;\n };\n PathProxy.prototype.appendPath = function (path) {\n if (!(path instanceof Array)) {\n path = [path];\n }\n var len = path.length;\n var appendSize = 0;\n var offset = this._len;\n for (var i = 0; i < len; i++) {\n appendSize += path[i].len();\n }\n if (hasTypedArray && (this.data instanceof Float32Array)) {\n this.data = new Float32Array(offset + appendSize);\n }\n for (var i = 0; i < len; i++) {\n var appendPathData = path[i].data;\n for (var k = 0; k < appendPathData.length; k++) {\n this.data[offset++] = appendPathData[k];\n }\n }\n this._len = offset;\n };\n PathProxy.prototype.addData = function (cmd, a, b, c, d, e, f, g, h) {\n if (!this._saveData) {\n return;\n }\n var data = this.data;\n if (this._len + arguments.length > data.length) {\n this._expandData();\n data = this.data;\n }\n for (var i = 0; i < arguments.length; i++) {\n data[this._len++] = arguments[i];\n }\n };\n PathProxy.prototype._drawPendingPt = function () {\n if (this._pendingPtDist > 0) {\n this._ctx && this._ctx.lineTo(this._pendingPtX, this._pendingPtY);\n this._pendingPtDist = 0;\n }\n };\n PathProxy.prototype._expandData = function () {\n if (!(this.data instanceof Array)) {\n var newData = [];\n for (var i = 0; i < this._len; i++) {\n newData[i] = this.data[i];\n }\n this.data = newData;\n }\n };\n PathProxy.prototype._dashedLineTo = function (x1, y1) {\n var dashSum = this._dashSum;\n var lineDash = this._lineDash;\n var ctx = this._ctx;\n var offset = this._dashOffset;\n var x0 = this._xi;\n var y0 = this._yi;\n var dx = x1 - x0;\n var dy = y1 - y0;\n var dist = mathSqrt(dx * dx + dy * dy);\n var x = x0;\n var y = y0;\n var nDash = lineDash.length;\n var dash;\n var idx;\n dx /= dist;\n dy /= dist;\n if (offset < 0) {\n offset = dashSum + offset;\n }\n offset %= dashSum;\n x -= offset * dx;\n y -= offset * dy;\n while ((dx > 0 && x <= x1) || (dx < 0 && x >= x1)\n || (dx === 0 && ((dy > 0 && y <= y1) || (dy < 0 && y >= y1)))) {\n idx = this._dashIdx;\n dash = lineDash[idx];\n x += dx * dash;\n y += dy * dash;\n this._dashIdx = (idx + 1) % nDash;\n if ((dx > 0 && x < x0) || (dx < 0 && x > x0) || (dy > 0 && y < y0) || (dy < 0 && y > y0)) {\n continue;\n }\n ctx[idx % 2 ? 'moveTo' : 'lineTo'](dx >= 0 ? mathMin(x, x1) : mathMax(x, x1), dy >= 0 ? mathMin(y, y1) : mathMax(y, y1));\n }\n dx = x - x1;\n dy = y - y1;\n this._dashOffset = -mathSqrt(dx * dx + dy * dy);\n };\n PathProxy.prototype._dashedBezierTo = function (x1, y1, x2, y2, x3, y3) {\n var ctx = this._ctx;\n var dashSum = this._dashSum;\n var offset = this._dashOffset;\n var lineDash = this._lineDash;\n var x0 = this._xi;\n var y0 = this._yi;\n var bezierLen = 0;\n var idx = this._dashIdx;\n var nDash = lineDash.length;\n var t;\n var dx;\n var dy;\n var x;\n var y;\n var tmpLen = 0;\n if (offset < 0) {\n offset = dashSum + offset;\n }\n offset %= dashSum;\n for (t = 0; t < 1; t += 0.1) {\n dx = cubicAt(x0, x1, x2, x3, t + 0.1)\n - cubicAt(x0, x1, x2, x3, t);\n dy = cubicAt(y0, y1, y2, y3, t + 0.1)\n - cubicAt(y0, y1, y2, y3, t);\n bezierLen += mathSqrt(dx * dx + dy * dy);\n }\n for (; idx < nDash; idx++) {\n tmpLen += lineDash[idx];\n if (tmpLen > offset) {\n break;\n }\n }\n t = (tmpLen - offset) / bezierLen;\n while (t <= 1) {\n x = cubicAt(x0, x1, x2, x3, t);\n y = cubicAt(y0, y1, y2, y3, t);\n idx % 2 ? ctx.moveTo(x, y)\n : ctx.lineTo(x, y);\n t += lineDash[idx] / bezierLen;\n idx = (idx + 1) % nDash;\n }\n (idx % 2 !== 0) && ctx.lineTo(x3, y3);\n dx = x3 - x;\n dy = y3 - y;\n this._dashOffset = -mathSqrt(dx * dx + dy * dy);\n };\n PathProxy.prototype._dashedQuadraticTo = function (x1, y1, x2, y2) {\n var x3 = x2;\n var y3 = y2;\n x2 = (x2 + 2 * x1) / 3;\n y2 = (y2 + 2 * y1) / 3;\n x1 = (this._xi + 2 * x1) / 3;\n y1 = (this._yi + 2 * y1) / 3;\n this._dashedBezierTo(x1, y1, x2, y2, x3, y3);\n };\n PathProxy.prototype.toStatic = function () {\n if (!this._saveData) {\n return;\n }\n this._drawPendingPt();\n var data = this.data;\n if (data instanceof Array) {\n data.length = this._len;\n if (hasTypedArray && this._len > 11) {\n this.data = new Float32Array(data);\n }\n }\n };\n PathProxy.prototype.getBoundingRect = function () {\n min[0] = min[1] = min2[0] = min2[1] = Number.MAX_VALUE;\n max[0] = max[1] = max2[0] = max2[1] = -Number.MAX_VALUE;\n var data = this.data;\n var xi = 0;\n var yi = 0;\n var x0 = 0;\n var y0 = 0;\n var i;\n for (i = 0; i < this._len;) {\n var cmd = data[i++];\n var isFirst = i === 1;\n if (isFirst) {\n xi = data[i];\n yi = data[i + 1];\n x0 = xi;\n y0 = yi;\n }\n switch (cmd) {\n case CMD.M:\n xi = x0 = data[i++];\n yi = y0 = data[i++];\n min2[0] = x0;\n min2[1] = y0;\n max2[0] = x0;\n max2[1] = y0;\n break;\n case CMD.L:\n fromLine(xi, yi, data[i], data[i + 1], min2, max2);\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.C:\n fromCubic(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], min2, max2);\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.Q:\n fromQuadratic(xi, yi, data[i++], data[i++], data[i], data[i + 1], min2, max2);\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.A:\n var cx = data[i++];\n var cy = data[i++];\n var rx = data[i++];\n var ry = data[i++];\n var startAngle = data[i++];\n var endAngle = data[i++] + startAngle;\n i += 1;\n var anticlockwise = !data[i++];\n if (isFirst) {\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n fromArc(cx, cy, rx, ry, startAngle, endAngle, anticlockwise, min2, max2);\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n var width = data[i++];\n var height = data[i++];\n fromLine(x0, y0, x0 + width, y0 + height, min2, max2);\n break;\n case CMD.Z:\n xi = x0;\n yi = y0;\n break;\n }\n vec2.min(min, min, min2);\n vec2.max(max, max, max2);\n }\n if (i === 0) {\n min[0] = min[1] = max[0] = max[1] = 0;\n }\n return new BoundingRect(min[0], min[1], max[0] - min[0], max[1] - min[1]);\n };\n PathProxy.prototype._calculateLength = function () {\n var data = this.data;\n var len = this._len;\n var ux = this._ux;\n var uy = this._uy;\n var xi = 0;\n var yi = 0;\n var x0 = 0;\n var y0 = 0;\n if (!this._pathSegLen) {\n this._pathSegLen = [];\n }\n var pathSegLen = this._pathSegLen;\n var pathTotalLen = 0;\n var segCount = 0;\n for (var i = 0; i < len;) {\n var cmd = data[i++];\n var isFirst = i === 1;\n if (isFirst) {\n xi = data[i];\n yi = data[i + 1];\n x0 = xi;\n y0 = yi;\n }\n var l = -1;\n switch (cmd) {\n case CMD.M:\n xi = x0 = data[i++];\n yi = y0 = data[i++];\n break;\n case CMD.L: {\n var x2 = data[i++];\n var y2 = data[i++];\n var dx = x2 - xi;\n var dy = y2 - yi;\n if (mathAbs(dx) > ux || mathAbs(dy) > uy || i === len - 1) {\n l = Math.sqrt(dx * dx + dy * dy);\n xi = x2;\n yi = y2;\n }\n break;\n }\n case CMD.C: {\n var x1 = data[i++];\n var y1 = data[i++];\n var x2 = data[i++];\n var y2 = data[i++];\n var x3 = data[i++];\n var y3 = data[i++];\n l = cubicLength(xi, yi, x1, y1, x2, y2, x3, y3, 10);\n xi = x3;\n yi = y3;\n break;\n }\n case CMD.Q: {\n var x1 = data[i++];\n var y1 = data[i++];\n var x2 = data[i++];\n var y2 = data[i++];\n l = quadraticLength(xi, yi, x1, y1, x2, y2, 10);\n xi = x2;\n yi = y2;\n break;\n }\n case CMD.A:\n var cx = data[i++];\n var cy = data[i++];\n var rx = data[i++];\n var ry = data[i++];\n var startAngle = data[i++];\n var delta = data[i++];\n var endAngle = delta + startAngle;\n i += 1;\n var anticlockwise = !data[i++];\n if (isFirst) {\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n l = mathMax(rx, ry) * mathMin(PI2, Math.abs(delta));\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R: {\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n var width = data[i++];\n var height = data[i++];\n l = width * 2 + height * 2;\n break;\n }\n case CMD.Z: {\n var dx = x0 - xi;\n var dy = y0 - yi;\n l = Math.sqrt(dx * dx + dy * dy);\n xi = x0;\n yi = y0;\n break;\n }\n }\n if (l >= 0) {\n pathSegLen[segCount++] = l;\n pathTotalLen += l;\n }\n }\n this._pathLen = pathTotalLen;\n return pathTotalLen;\n };\n PathProxy.prototype.rebuildPath = function (ctx, percent) {\n var d = this.data;\n var ux = this._ux;\n var uy = this._uy;\n var len = this._len;\n var x0;\n var y0;\n var xi;\n var yi;\n var x;\n var y;\n var drawPart = percent < 1;\n var pathSegLen;\n var pathTotalLen;\n var accumLength = 0;\n var segCount = 0;\n var displayedLength;\n var pendingPtDist = 0;\n var pendingPtX;\n var pendingPtY;\n if (drawPart) {\n if (!this._pathSegLen) {\n this._calculateLength();\n }\n pathSegLen = this._pathSegLen;\n pathTotalLen = this._pathLen;\n displayedLength = percent * pathTotalLen;\n if (!displayedLength) {\n return;\n }\n }\n lo: for (var i = 0; i < len;) {\n var cmd = d[i++];\n var isFirst = i === 1;\n if (isFirst) {\n xi = d[i];\n yi = d[i + 1];\n x0 = xi;\n y0 = yi;\n }\n switch (cmd) {\n case CMD.M:\n if (pendingPtDist > 0) {\n ctx.lineTo(pendingPtX, pendingPtY);\n pendingPtDist = 0;\n }\n x0 = xi = d[i++];\n y0 = yi = d[i++];\n ctx.moveTo(xi, yi);\n break;\n case CMD.L: {\n x = d[i++];\n y = d[i++];\n var dx = mathAbs(x - xi);\n var dy = mathAbs(y - yi);\n if (dx > ux || dy > uy) {\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var t = (displayedLength - accumLength) / l;\n ctx.lineTo(xi * (1 - t) + x * t, yi * (1 - t) + y * t);\n break lo;\n }\n accumLength += l;\n }\n ctx.lineTo(x, y);\n xi = x;\n yi = y;\n pendingPtDist = 0;\n }\n else {\n var d2 = dx * dx + dy * dy;\n if (d2 > pendingPtDist) {\n pendingPtX = x;\n pendingPtY = y;\n pendingPtDist = d2;\n }\n }\n break;\n }\n case CMD.C: {\n var x1 = d[i++];\n var y1 = d[i++];\n var x2 = d[i++];\n var y2 = d[i++];\n var x3 = d[i++];\n var y3 = d[i++];\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var t = (displayedLength - accumLength) / l;\n cubicSubdivide(xi, x1, x2, x3, t, tmpOutX);\n cubicSubdivide(yi, y1, y2, y3, t, tmpOutY);\n ctx.bezierCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2], tmpOutX[3], tmpOutY[3]);\n break lo;\n }\n accumLength += l;\n }\n ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n xi = x3;\n yi = y3;\n break;\n }\n case CMD.Q: {\n var x1 = d[i++];\n var y1 = d[i++];\n var x2 = d[i++];\n var y2 = d[i++];\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var t = (displayedLength - accumLength) / l;\n quadraticSubdivide(xi, x1, x2, t, tmpOutX);\n quadraticSubdivide(yi, y1, y2, t, tmpOutY);\n ctx.quadraticCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2]);\n break lo;\n }\n accumLength += l;\n }\n ctx.quadraticCurveTo(x1, y1, x2, y2);\n xi = x2;\n yi = y2;\n break;\n }\n case CMD.A:\n var cx = d[i++];\n var cy = d[i++];\n var rx = d[i++];\n var ry = d[i++];\n var startAngle = d[i++];\n var delta = d[i++];\n var psi = d[i++];\n var anticlockwise = !d[i++];\n var r = (rx > ry) ? rx : ry;\n var scaleX = (rx > ry) ? 1 : rx / ry;\n var scaleY = (rx > ry) ? ry / rx : 1;\n var isEllipse = mathAbs(rx - ry) > 1e-3;\n var endAngle = startAngle + delta;\n var breakBuild = false;\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n endAngle = startAngle + delta * (displayedLength - accumLength) / l;\n breakBuild = true;\n }\n accumLength += l;\n }\n if (isEllipse && ctx.ellipse) {\n ctx.ellipse(cx, cy, rx, ry, psi, startAngle, endAngle, anticlockwise);\n }\n else {\n ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);\n }\n if (breakBuild) {\n break lo;\n }\n if (isFirst) {\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = d[i];\n y0 = yi = d[i + 1];\n x = d[i++];\n y = d[i++];\n var width = d[i++];\n var height = d[i++];\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var d_1 = displayedLength - accumLength;\n ctx.moveTo(x, y);\n ctx.lineTo(x + mathMin(d_1, width), y);\n d_1 -= width;\n if (d_1 > 0) {\n ctx.lineTo(x + width, y + mathMin(d_1, height));\n }\n d_1 -= height;\n if (d_1 > 0) {\n ctx.lineTo(x + mathMax(width - d_1, 0), y + height);\n }\n d_1 -= width;\n if (d_1 > 0) {\n ctx.lineTo(x, y + mathMax(height - d_1, 0));\n }\n break lo;\n }\n accumLength += l;\n }\n ctx.rect(x, y, width, height);\n break;\n case CMD.Z:\n if (pendingPtDist > 0) {\n ctx.lineTo(pendingPtX, pendingPtY);\n pendingPtDist = 0;\n }\n if (drawPart) {\n var l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n var t = (displayedLength - accumLength) / l;\n ctx.lineTo(xi * (1 - t) + x0 * t, yi * (1 - t) + y0 * t);\n break lo;\n }\n accumLength += l;\n }\n ctx.closePath();\n xi = x0;\n yi = y0;\n }\n }\n };\n PathProxy.CMD = CMD;\n PathProxy.initDefaultProps = (function () {\n var proto = PathProxy.prototype;\n proto._saveData = true;\n proto._needsDash = false;\n proto._dashOffset = 0;\n proto._dashIdx = 0;\n proto._dashSum = 0;\n proto._ux = 0;\n proto._uy = 0;\n proto._pendingPtDist = 0;\n proto._version = 0;\n })();\n return PathProxy;\n}());\nexport default PathProxy;\n","export function containStroke(x0, y0, x1, y1, lineWidth, x, y) {\n if (lineWidth === 0) {\n return false;\n }\n var _l = lineWidth;\n var _a = 0;\n var _b = x0;\n if ((y > y0 + _l && y > y1 + _l)\n || (y < y0 - _l && y < y1 - _l)\n || (x > x0 + _l && x > x1 + _l)\n || (x < x0 - _l && x < x1 - _l)) {\n return false;\n }\n if (x0 !== x1) {\n _a = (y0 - y1) / (x0 - x1);\n _b = (x0 * y1 - x1 * y0) / (x0 - x1);\n }\n else {\n return Math.abs(x - x0) <= _l / 2;\n }\n var tmp = _a * x - y + _b;\n var _s = tmp * tmp / (_a * _a + 1);\n return _s <= _l / 2 * _l / 2;\n}\n","import * as curve from '../core/curve';\nexport function containStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {\n if (lineWidth === 0) {\n return false;\n }\n var _l = lineWidth;\n if ((y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)\n || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)\n || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)\n || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)) {\n return false;\n }\n var d = curve.cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, null);\n return d <= _l / 2;\n}\n","import { quadraticProjectPoint } from '../core/curve';\nexport function containStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {\n if (lineWidth === 0) {\n return false;\n }\n var _l = lineWidth;\n if ((y > y0 + _l && y > y1 + _l && y > y2 + _l)\n || (y < y0 - _l && y < y1 - _l && y < y2 - _l)\n || (x > x0 + _l && x > x1 + _l && x > x2 + _l)\n || (x < x0 - _l && x < x1 - _l && x < x2 - _l)) {\n return false;\n }\n var d = quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, null);\n return d <= _l / 2;\n}\n","var PI2 = Math.PI * 2;\nexport function normalizeRadian(angle) {\n angle %= PI2;\n if (angle < 0) {\n angle += PI2;\n }\n return angle;\n}\n","import { normalizeRadian } from './util';\nvar PI2 = Math.PI * 2;\nexport function containStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {\n if (lineWidth === 0) {\n return false;\n }\n var _l = lineWidth;\n x -= cx;\n y -= cy;\n var d = Math.sqrt(x * x + y * y);\n if ((d - _l > r) || (d + _l < r)) {\n return false;\n }\n if (Math.abs(startAngle - endAngle) % PI2 < 1e-4) {\n return true;\n }\n if (anticlockwise) {\n var tmp = startAngle;\n startAngle = normalizeRadian(endAngle);\n endAngle = normalizeRadian(tmp);\n }\n else {\n startAngle = normalizeRadian(startAngle);\n endAngle = normalizeRadian(endAngle);\n }\n if (startAngle > endAngle) {\n endAngle += PI2;\n }\n var angle = Math.atan2(y, x);\n if (angle < 0) {\n angle += PI2;\n }\n return (angle >= startAngle && angle <= endAngle)\n || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);\n}\n","export default function windingLine(x0, y0, x1, y1, x, y) {\n if ((y > y0 && y > y1) || (y < y0 && y < y1)) {\n return 0;\n }\n if (y1 === y0) {\n return 0;\n }\n var t = (y - y0) / (y1 - y0);\n var dir = y1 < y0 ? 1 : -1;\n if (t === 1 || t === 0) {\n dir = y1 < y0 ? 0.5 : -0.5;\n }\n var x_ = t * (x1 - x0) + x0;\n return x_ === x ? Infinity : x_ > x ? dir : 0;\n}\n","import PathProxy from '../core/PathProxy';\nimport * as line from './line';\nimport * as cubic from './cubic';\nimport * as quadratic from './quadratic';\nimport * as arc from './arc';\nimport * as curve from '../core/curve';\nimport windingLine from './windingLine';\nvar CMD = PathProxy.CMD;\nvar PI2 = Math.PI * 2;\nvar EPSILON = 1e-4;\nfunction isAroundEqual(a, b) {\n return Math.abs(a - b) < EPSILON;\n}\nvar roots = [-1, -1, -1];\nvar extrema = [-1, -1];\nfunction swapExtrema() {\n var tmp = extrema[0];\n extrema[0] = extrema[1];\n extrema[1] = tmp;\n}\nfunction windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {\n if ((y > y0 && y > y1 && y > y2 && y > y3)\n || (y < y0 && y < y1 && y < y2 && y < y3)) {\n return 0;\n }\n var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);\n if (nRoots === 0) {\n return 0;\n }\n else {\n var w = 0;\n var nExtrema = -1;\n var y0_ = void 0;\n var y1_ = void 0;\n for (var i = 0; i < nRoots; i++) {\n var t = roots[i];\n var unit = (t === 0 || t === 1) ? 0.5 : 1;\n var x_ = curve.cubicAt(x0, x1, x2, x3, t);\n if (x_ < x) {\n continue;\n }\n if (nExtrema < 0) {\n nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);\n if (extrema[1] < extrema[0] && nExtrema > 1) {\n swapExtrema();\n }\n y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);\n if (nExtrema > 1) {\n y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);\n }\n }\n if (nExtrema === 2) {\n if (t < extrema[0]) {\n w += y0_ < y0 ? unit : -unit;\n }\n else if (t < extrema[1]) {\n w += y1_ < y0_ ? unit : -unit;\n }\n else {\n w += y3 < y1_ ? unit : -unit;\n }\n }\n else {\n if (t < extrema[0]) {\n w += y0_ < y0 ? unit : -unit;\n }\n else {\n w += y3 < y0_ ? unit : -unit;\n }\n }\n }\n return w;\n }\n}\nfunction windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {\n if ((y > y0 && y > y1 && y > y2)\n || (y < y0 && y < y1 && y < y2)) {\n return 0;\n }\n var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);\n if (nRoots === 0) {\n return 0;\n }\n else {\n var t = curve.quadraticExtremum(y0, y1, y2);\n if (t >= 0 && t <= 1) {\n var w = 0;\n var y_ = curve.quadraticAt(y0, y1, y2, t);\n for (var i = 0; i < nRoots; i++) {\n var unit = (roots[i] === 0 || roots[i] === 1) ? 0.5 : 1;\n var x_ = curve.quadraticAt(x0, x1, x2, roots[i]);\n if (x_ < x) {\n continue;\n }\n if (roots[i] < t) {\n w += y_ < y0 ? unit : -unit;\n }\n else {\n w += y2 < y_ ? unit : -unit;\n }\n }\n return w;\n }\n else {\n var unit = (roots[0] === 0 || roots[0] === 1) ? 0.5 : 1;\n var x_ = curve.quadraticAt(x0, x1, x2, roots[0]);\n if (x_ < x) {\n return 0;\n }\n return y2 < y0 ? unit : -unit;\n }\n }\n}\nfunction windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {\n y -= cy;\n if (y > r || y < -r) {\n return 0;\n }\n var tmp = Math.sqrt(r * r - y * y);\n roots[0] = -tmp;\n roots[1] = tmp;\n var dTheta = Math.abs(startAngle - endAngle);\n if (dTheta < 1e-4) {\n return 0;\n }\n if (dTheta >= PI2 - 1e-4) {\n startAngle = 0;\n endAngle = PI2;\n var dir = anticlockwise ? 1 : -1;\n if (x >= roots[0] + cx && x <= roots[1] + cx) {\n return dir;\n }\n else {\n return 0;\n }\n }\n if (startAngle > endAngle) {\n var tmp_1 = startAngle;\n startAngle = endAngle;\n endAngle = tmp_1;\n }\n if (startAngle < 0) {\n startAngle += PI2;\n endAngle += PI2;\n }\n var w = 0;\n for (var i = 0; i < 2; i++) {\n var x_ = roots[i];\n if (x_ + cx > x) {\n var angle = Math.atan2(y, x_);\n var dir = anticlockwise ? 1 : -1;\n if (angle < 0) {\n angle = PI2 + angle;\n }\n if ((angle >= startAngle && angle <= endAngle)\n || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)) {\n if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {\n dir = -dir;\n }\n w += dir;\n }\n }\n }\n return w;\n}\nfunction containPath(path, lineWidth, isStroke, x, y) {\n var data = path.data;\n var len = path.len();\n var w = 0;\n var xi = 0;\n var yi = 0;\n var x0 = 0;\n var y0 = 0;\n var x1;\n var y1;\n for (var i = 0; i < len;) {\n var cmd = data[i++];\n var isFirst = i === 1;\n if (cmd === CMD.M && i > 1) {\n if (!isStroke) {\n w += windingLine(xi, yi, x0, y0, x, y);\n }\n }\n if (isFirst) {\n xi = data[i];\n yi = data[i + 1];\n x0 = xi;\n y0 = yi;\n }\n switch (cmd) {\n case CMD.M:\n x0 = data[i++];\n y0 = data[i++];\n xi = x0;\n yi = y0;\n break;\n case CMD.L:\n if (isStroke) {\n if (line.containStroke(xi, yi, data[i], data[i + 1], lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingLine(xi, yi, data[i], data[i + 1], x, y) || 0;\n }\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.C:\n if (isStroke) {\n if (cubic.containStroke(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingCubic(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], x, y) || 0;\n }\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.Q:\n if (isStroke) {\n if (quadratic.containStroke(xi, yi, data[i++], data[i++], data[i], data[i + 1], lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingQuadratic(xi, yi, data[i++], data[i++], data[i], data[i + 1], x, y) || 0;\n }\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.A:\n var cx = data[i++];\n var cy = data[i++];\n var rx = data[i++];\n var ry = data[i++];\n var theta = data[i++];\n var dTheta = data[i++];\n i += 1;\n var anticlockwise = !!(1 - data[i++]);\n x1 = Math.cos(theta) * rx + cx;\n y1 = Math.sin(theta) * ry + cy;\n if (!isFirst) {\n w += windingLine(xi, yi, x1, y1, x, y);\n }\n else {\n x0 = x1;\n y0 = y1;\n }\n var _x = (x - cx) * ry / rx + cx;\n if (isStroke) {\n if (arc.containStroke(cx, cy, ry, theta, theta + dTheta, anticlockwise, lineWidth, _x, y)) {\n return true;\n }\n }\n else {\n w += windingArc(cx, cy, ry, theta, theta + dTheta, anticlockwise, _x, y);\n }\n xi = Math.cos(theta + dTheta) * rx + cx;\n yi = Math.sin(theta + dTheta) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n var width = data[i++];\n var height = data[i++];\n x1 = x0 + width;\n y1 = y0 + height;\n if (isStroke) {\n if (line.containStroke(x0, y0, x1, y0, lineWidth, x, y)\n || line.containStroke(x1, y0, x1, y1, lineWidth, x, y)\n || line.containStroke(x1, y1, x0, y1, lineWidth, x, y)\n || line.containStroke(x0, y1, x0, y0, lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingLine(x1, y0, x1, y1, x, y);\n w += windingLine(x0, y1, x0, y0, x, y);\n }\n break;\n case CMD.Z:\n if (isStroke) {\n if (line.containStroke(xi, yi, x0, y0, lineWidth, x, y)) {\n return true;\n }\n }\n else {\n w += windingLine(xi, yi, x0, y0, x, y);\n }\n xi = x0;\n yi = y0;\n break;\n }\n }\n if (!isStroke && !isAroundEqual(yi, y0)) {\n w += windingLine(xi, yi, x0, y0, x, y) || 0;\n }\n return w !== 0;\n}\nexport function contain(pathProxy, x, y) {\n return containPath(pathProxy, 0, false, x, y);\n}\nexport function containStroke(pathProxy, lineWidth, x, y) {\n return containPath(pathProxy, lineWidth, true, x, y);\n}\n","import { __extends } from \"tslib\";\nimport Displayable, { DEFAULT_COMMON_STYLE, DEFAULT_COMMON_ANIMATION_PROPS } from './Displayable';\nimport PathProxy from '../core/PathProxy';\nimport * as pathContain from '../contain/path';\nimport { defaults, keys, extend, clone, isString, createObject } from '../core/util';\nimport { lum } from '../tool/color';\nimport { DARK_LABEL_COLOR, LIGHT_LABEL_COLOR, DARK_MODE_THRESHOLD, LIGHTER_LABEL_COLOR } from '../config';\nimport { REDARAW_BIT, SHAPE_CHANGED_BIT, STYLE_CHANGED_BIT } from './constants';\nexport var DEFAULT_PATH_STYLE = defaults({\n fill: '#000',\n stroke: null,\n strokePercent: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n lineDashOffset: 0,\n lineWidth: 1,\n lineCap: 'butt',\n miterLimit: 10,\n strokeNoScale: false,\n strokeFirst: false\n}, DEFAULT_COMMON_STYLE);\nexport var DEFAULT_PATH_ANIMATION_PROPS = {\n style: defaults({\n fill: true,\n stroke: true,\n strokePercent: true,\n fillOpacity: true,\n strokeOpacity: true,\n lineDashOffset: true,\n lineWidth: true,\n miterLimit: true\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n};\nvar pathCopyParams = [\n 'x', 'y', 'rotation', 'scaleX', 'scaleY', 'originX', 'originY', 'invisible',\n 'culling', 'z', 'z2', 'zlevel', 'parent'\n];\nvar Path = (function (_super) {\n __extends(Path, _super);\n function Path(opts) {\n return _super.call(this, opts) || this;\n }\n Path.prototype.update = function () {\n var _this = this;\n _super.prototype.update.call(this);\n var style = this.style;\n if (style.decal) {\n var decalEl = this._decalEl = this._decalEl || new Path();\n if (decalEl.buildPath === Path.prototype.buildPath) {\n decalEl.buildPath = function (ctx) {\n _this.buildPath(ctx, _this.shape);\n };\n }\n decalEl.silent = true;\n var decalElStyle = decalEl.style;\n for (var key in style) {\n if (decalElStyle[key] !== style[key]) {\n decalElStyle[key] = style[key];\n }\n }\n decalElStyle.fill = style.fill ? style.decal : null;\n decalElStyle.decal = null;\n decalElStyle.shadowColor = null;\n style.strokeFirst && (decalElStyle.stroke = null);\n for (var i = 0; i < pathCopyParams.length; ++i) {\n decalEl[pathCopyParams[i]] = this[pathCopyParams[i]];\n }\n decalEl.__dirty |= REDARAW_BIT;\n }\n else if (this._decalEl) {\n this._decalEl = null;\n }\n };\n Path.prototype.getDecalElement = function () {\n return this._decalEl;\n };\n Path.prototype._init = function (props) {\n var keysArr = keys(props);\n this.shape = this.getDefaultShape();\n var defaultStyle = this.getDefaultStyle();\n if (defaultStyle) {\n this.useStyle(defaultStyle);\n }\n for (var i = 0; i < keysArr.length; i++) {\n var key = keysArr[i];\n var value = props[key];\n if (key === 'style') {\n if (!this.style) {\n this.useStyle(value);\n }\n else {\n extend(this.style, value);\n }\n }\n else if (key === 'shape') {\n extend(this.shape, value);\n }\n else {\n _super.prototype.attrKV.call(this, key, value);\n }\n }\n if (!this.style) {\n this.useStyle({});\n }\n };\n Path.prototype.getDefaultStyle = function () {\n return null;\n };\n Path.prototype.getDefaultShape = function () {\n return {};\n };\n Path.prototype.canBeInsideText = function () {\n return this.hasFill();\n };\n Path.prototype.getInsideTextFill = function () {\n var pathFill = this.style.fill;\n if (pathFill !== 'none') {\n if (isString(pathFill)) {\n var fillLum = lum(pathFill, 0);\n if (fillLum > 0.5) {\n return DARK_LABEL_COLOR;\n }\n else if (fillLum > 0.2) {\n return LIGHTER_LABEL_COLOR;\n }\n return LIGHT_LABEL_COLOR;\n }\n else if (pathFill) {\n return LIGHT_LABEL_COLOR;\n }\n }\n return DARK_LABEL_COLOR;\n };\n Path.prototype.getInsideTextStroke = function (textFill) {\n var pathFill = this.style.fill;\n if (isString(pathFill)) {\n var zr = this.__zr;\n var isDarkMode = !!(zr && zr.isDarkMode());\n var isDarkLabel = lum(textFill, 0) < DARK_MODE_THRESHOLD;\n if (isDarkMode === isDarkLabel) {\n return pathFill;\n }\n }\n };\n Path.prototype.buildPath = function (ctx, shapeCfg, inBundle) { };\n Path.prototype.pathUpdated = function () {\n this.__dirty &= ~SHAPE_CHANGED_BIT;\n };\n Path.prototype.createPathProxy = function () {\n this.path = new PathProxy(false);\n };\n Path.prototype.hasStroke = function () {\n var style = this.style;\n var stroke = style.stroke;\n return !(stroke == null || stroke === 'none' || !(style.lineWidth > 0));\n };\n Path.prototype.hasFill = function () {\n var style = this.style;\n var fill = style.fill;\n return fill != null && fill !== 'none';\n };\n Path.prototype.getBoundingRect = function () {\n var rect = this._rect;\n var style = this.style;\n var needsUpdateRect = !rect;\n if (needsUpdateRect) {\n var firstInvoke = false;\n if (!this.path) {\n firstInvoke = true;\n this.createPathProxy();\n }\n var path = this.path;\n if (firstInvoke || (this.__dirty & SHAPE_CHANGED_BIT)) {\n path.beginPath();\n this.buildPath(path, this.shape, false);\n this.pathUpdated();\n }\n rect = path.getBoundingRect();\n }\n this._rect = rect;\n if (this.hasStroke() && this.path && this.path.len() > 0) {\n var rectWithStroke = this._rectWithStroke || (this._rectWithStroke = rect.clone());\n if (this.__dirty || needsUpdateRect) {\n rectWithStroke.copy(rect);\n var lineScale = style.strokeNoScale ? this.getLineScale() : 1;\n var w = style.lineWidth;\n if (!this.hasFill()) {\n var strokeContainThreshold = this.strokeContainThreshold;\n w = Math.max(w, strokeContainThreshold == null ? 4 : strokeContainThreshold);\n }\n if (lineScale > 1e-10) {\n rectWithStroke.width += w / lineScale;\n rectWithStroke.height += w / lineScale;\n rectWithStroke.x -= w / lineScale / 2;\n rectWithStroke.y -= w / lineScale / 2;\n }\n }\n return rectWithStroke;\n }\n return rect;\n };\n Path.prototype.contain = function (x, y) {\n var localPos = this.transformCoordToLocal(x, y);\n var rect = this.getBoundingRect();\n var style = this.style;\n x = localPos[0];\n y = localPos[1];\n if (rect.contain(x, y)) {\n var pathProxy = this.path;\n if (this.hasStroke()) {\n var lineWidth = style.lineWidth;\n var lineScale = style.strokeNoScale ? this.getLineScale() : 1;\n if (lineScale > 1e-10) {\n if (!this.hasFill()) {\n lineWidth = Math.max(lineWidth, this.strokeContainThreshold);\n }\n if (pathContain.containStroke(pathProxy, lineWidth / lineScale, x, y)) {\n return true;\n }\n }\n }\n if (this.hasFill()) {\n return pathContain.contain(pathProxy, x, y);\n }\n }\n return false;\n };\n Path.prototype.dirtyShape = function () {\n this.__dirty |= SHAPE_CHANGED_BIT;\n if (this._rect) {\n this._rect = null;\n }\n if (this._decalEl) {\n this._decalEl.dirtyShape();\n }\n this.markRedraw();\n };\n Path.prototype.dirty = function () {\n this.dirtyStyle();\n this.dirtyShape();\n };\n Path.prototype.animateShape = function (loop) {\n return this.animate('shape', loop);\n };\n Path.prototype.updateDuringAnimation = function (targetKey) {\n if (targetKey === 'style') {\n this.dirtyStyle();\n }\n else if (targetKey === 'shape') {\n this.dirtyShape();\n }\n else {\n this.markRedraw();\n }\n };\n Path.prototype.attrKV = function (key, value) {\n if (key === 'shape') {\n this.setShape(value);\n }\n else {\n _super.prototype.attrKV.call(this, key, value);\n }\n };\n Path.prototype.setShape = function (keyOrObj, value) {\n var shape = this.shape;\n if (!shape) {\n shape = this.shape = {};\n }\n if (typeof keyOrObj === 'string') {\n shape[keyOrObj] = value;\n }\n else {\n extend(shape, keyOrObj);\n }\n this.dirtyShape();\n return this;\n };\n Path.prototype.shapeChanged = function () {\n return !!(this.__dirty & SHAPE_CHANGED_BIT);\n };\n Path.prototype.createStyle = function (obj) {\n return createObject(DEFAULT_PATH_STYLE, obj);\n };\n Path.prototype._innerSaveToNormal = function (toState) {\n _super.prototype._innerSaveToNormal.call(this, toState);\n var normalState = this._normalState;\n if (toState.shape && !normalState.shape) {\n normalState.shape = extend({}, this.shape);\n }\n };\n Path.prototype._applyStateObj = function (stateName, state, normalState, keepCurrentStates, transition, animationCfg) {\n _super.prototype._applyStateObj.call(this, stateName, state, normalState, keepCurrentStates, transition, animationCfg);\n var needsRestoreToNormal = !(state && keepCurrentStates);\n var targetShape;\n if (state && state.shape) {\n if (transition) {\n if (keepCurrentStates) {\n targetShape = state.shape;\n }\n else {\n targetShape = extend({}, normalState.shape);\n extend(targetShape, state.shape);\n }\n }\n else {\n targetShape = extend({}, keepCurrentStates ? this.shape : normalState.shape);\n extend(targetShape, state.shape);\n }\n }\n else if (needsRestoreToNormal) {\n targetShape = normalState.shape;\n }\n if (targetShape) {\n if (transition) {\n this.shape = extend({}, this.shape);\n var targetShapePrimaryProps = {};\n var shapeKeys = keys(targetShape);\n for (var i = 0; i < shapeKeys.length; i++) {\n var key = shapeKeys[i];\n if (typeof targetShape[key] === 'object') {\n this.shape[key] = targetShape[key];\n }\n else {\n targetShapePrimaryProps[key] = targetShape[key];\n }\n }\n this._transitionState(stateName, {\n shape: targetShapePrimaryProps\n }, animationCfg);\n }\n else {\n this.shape = targetShape;\n this.dirtyShape();\n }\n }\n };\n Path.prototype._mergeStates = function (states) {\n var mergedState = _super.prototype._mergeStates.call(this, states);\n var mergedShape;\n for (var i = 0; i < states.length; i++) {\n var state = states[i];\n if (state.shape) {\n mergedShape = mergedShape || {};\n this._mergeStyle(mergedShape, state.shape);\n }\n }\n if (mergedShape) {\n mergedState.shape = mergedShape;\n }\n return mergedState;\n };\n Path.prototype.getAnimationStyleProps = function () {\n return DEFAULT_PATH_ANIMATION_PROPS;\n };\n Path.prototype.isZeroArea = function () {\n return false;\n };\n Path.extend = function (defaultProps) {\n var Sub = (function (_super) {\n __extends(Sub, _super);\n function Sub(opts) {\n var _this = _super.call(this, opts) || this;\n defaultProps.init && defaultProps.init.call(_this, opts);\n return _this;\n }\n Sub.prototype.getDefaultStyle = function () {\n return clone(defaultProps.style);\n };\n Sub.prototype.getDefaultShape = function () {\n return clone(defaultProps.shape);\n };\n return Sub;\n }(Path));\n for (var key in defaultProps) {\n if (typeof defaultProps[key] === 'function') {\n Sub.prototype[key] = defaultProps[key];\n }\n }\n return Sub;\n };\n Path.initDefaultProps = (function () {\n var pathProto = Path.prototype;\n pathProto.type = 'path';\n pathProto.strokeContainThreshold = 5;\n pathProto.segmentIgnoreThreshold = 0;\n pathProto.subPixelOptimize = false;\n pathProto.autoBatch = false;\n pathProto.__dirty = REDARAW_BIT | STYLE_CHANGED_BIT | SHAPE_CHANGED_BIT;\n })();\n return Path;\n}(Displayable));\nexport default Path;\n","import { __extends } from \"tslib\";\nimport Displayable from './Displayable';\nimport { getBoundingRect, DEFAULT_FONT } from '../contain/text';\nimport { DEFAULT_PATH_STYLE } from './Path';\nimport { createObject, defaults } from '../core/util';\nexport var DEFAULT_TSPAN_STYLE = defaults({\n strokeFirst: true,\n font: DEFAULT_FONT,\n x: 0,\n y: 0,\n textAlign: 'left',\n textBaseline: 'top',\n miterLimit: 2\n}, DEFAULT_PATH_STYLE);\nvar TSpan = (function (_super) {\n __extends(TSpan, _super);\n function TSpan() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TSpan.prototype.hasStroke = function () {\n var style = this.style;\n var stroke = style.stroke;\n return stroke != null && stroke !== 'none' && style.lineWidth > 0;\n };\n TSpan.prototype.hasFill = function () {\n var style = this.style;\n var fill = style.fill;\n return fill != null && fill !== 'none';\n };\n TSpan.prototype.createStyle = function (obj) {\n return createObject(DEFAULT_TSPAN_STYLE, obj);\n };\n TSpan.prototype.setBoundingRect = function (rect) {\n this._rect = rect;\n };\n TSpan.prototype.getBoundingRect = function () {\n var style = this.style;\n if (!this._rect) {\n var text = style.text;\n text != null ? (text += '') : (text = '');\n var rect = getBoundingRect(text, style.font, style.textAlign, style.textBaseline);\n rect.x += style.x || 0;\n rect.y += style.y || 0;\n if (this.hasStroke()) {\n var w = style.lineWidth;\n rect.x -= w / 2;\n rect.y -= w / 2;\n rect.width += w;\n rect.height += w;\n }\n this._rect = rect;\n }\n return this._rect;\n };\n TSpan.initDefaultProps = (function () {\n var tspanProto = TSpan.prototype;\n tspanProto.dirtyRectTolerance = 10;\n })();\n return TSpan;\n}(Displayable));\nTSpan.prototype.type = 'tspan';\nexport default TSpan;\n","import { __extends } from \"tslib\";\nimport Displayable, { DEFAULT_COMMON_STYLE, DEFAULT_COMMON_ANIMATION_PROPS } from './Displayable';\nimport BoundingRect from '../core/BoundingRect';\nimport { defaults, createObject } from '../core/util';\nexport var DEFAULT_IMAGE_STYLE = defaults({\n x: 0,\n y: 0\n}, DEFAULT_COMMON_STYLE);\nexport var DEFAULT_IMAGE_ANIMATION_PROPS = {\n style: defaults({\n x: true,\n y: true,\n width: true,\n height: true,\n sx: true,\n sy: true,\n sWidth: true,\n sHeight: true\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n};\nfunction isImageLike(source) {\n return !!(source\n && typeof source !== 'string'\n && source.width && source.height);\n}\nvar ZRImage = (function (_super) {\n __extends(ZRImage, _super);\n function ZRImage() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ZRImage.prototype.createStyle = function (obj) {\n return createObject(DEFAULT_IMAGE_STYLE, obj);\n };\n ZRImage.prototype._getSize = function (dim) {\n var style = this.style;\n var size = style[dim];\n if (size != null) {\n return size;\n }\n var imageSource = isImageLike(style.image)\n ? style.image : this.__image;\n if (!imageSource) {\n return 0;\n }\n var otherDim = dim === 'width' ? 'height' : 'width';\n var otherDimSize = style[otherDim];\n if (otherDimSize == null) {\n return imageSource[dim];\n }\n else {\n return imageSource[dim] / imageSource[otherDim] * otherDimSize;\n }\n };\n ZRImage.prototype.getWidth = function () {\n return this._getSize('width');\n };\n ZRImage.prototype.getHeight = function () {\n return this._getSize('height');\n };\n ZRImage.prototype.getAnimationStyleProps = function () {\n return DEFAULT_IMAGE_ANIMATION_PROPS;\n };\n ZRImage.prototype.getBoundingRect = function () {\n var style = this.style;\n if (!this._rect) {\n this._rect = new BoundingRect(style.x || 0, style.y || 0, this.getWidth(), this.getHeight());\n }\n return this._rect;\n };\n return ZRImage;\n}(Displayable));\nZRImage.prototype.type = 'image';\nexport default ZRImage;\n","export function buildPath(ctx, shape) {\n var x = shape.x;\n var y = shape.y;\n var width = shape.width;\n var height = shape.height;\n var r = shape.r;\n var r1;\n var r2;\n var r3;\n var r4;\n if (width < 0) {\n x = x + width;\n width = -width;\n }\n if (height < 0) {\n y = y + height;\n height = -height;\n }\n if (typeof r === 'number') {\n r1 = r2 = r3 = r4 = r;\n }\n else if (r instanceof Array) {\n if (r.length === 1) {\n r1 = r2 = r3 = r4 = r[0];\n }\n else if (r.length === 2) {\n r1 = r3 = r[0];\n r2 = r4 = r[1];\n }\n else if (r.length === 3) {\n r1 = r[0];\n r2 = r4 = r[1];\n r3 = r[2];\n }\n else {\n r1 = r[0];\n r2 = r[1];\n r3 = r[2];\n r4 = r[3];\n }\n }\n else {\n r1 = r2 = r3 = r4 = 0;\n }\n var total;\n if (r1 + r2 > width) {\n total = r1 + r2;\n r1 *= width / total;\n r2 *= width / total;\n }\n if (r3 + r4 > width) {\n total = r3 + r4;\n r3 *= width / total;\n r4 *= width / total;\n }\n if (r2 + r3 > height) {\n total = r2 + r3;\n r2 *= height / total;\n r3 *= height / total;\n }\n if (r1 + r4 > height) {\n total = r1 + r4;\n r1 *= height / total;\n r4 *= height / total;\n }\n ctx.moveTo(x + r1, y);\n ctx.lineTo(x + width - r2, y);\n r2 !== 0 && ctx.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0);\n ctx.lineTo(x + width, y + height - r3);\n r3 !== 0 && ctx.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2);\n ctx.lineTo(x + r4, y + height);\n r4 !== 0 && ctx.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI);\n ctx.lineTo(x, y + r1);\n r1 !== 0 && ctx.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);\n}\n","var round = Math.round;\nexport function subPixelOptimizeLine(outputShape, inputShape, style) {\n if (!inputShape) {\n return;\n }\n var x1 = inputShape.x1;\n var x2 = inputShape.x2;\n var y1 = inputShape.y1;\n var y2 = inputShape.y2;\n outputShape.x1 = x1;\n outputShape.x2 = x2;\n outputShape.y1 = y1;\n outputShape.y2 = y2;\n var lineWidth = style && style.lineWidth;\n if (!lineWidth) {\n return outputShape;\n }\n if (round(x1 * 2) === round(x2 * 2)) {\n outputShape.x1 = outputShape.x2 = subPixelOptimize(x1, lineWidth, true);\n }\n if (round(y1 * 2) === round(y2 * 2)) {\n outputShape.y1 = outputShape.y2 = subPixelOptimize(y1, lineWidth, true);\n }\n return outputShape;\n}\nexport function subPixelOptimizeRect(outputShape, inputShape, style) {\n if (!inputShape) {\n return;\n }\n var originX = inputShape.x;\n var originY = inputShape.y;\n var originWidth = inputShape.width;\n var originHeight = inputShape.height;\n outputShape.x = originX;\n outputShape.y = originY;\n outputShape.width = originWidth;\n outputShape.height = originHeight;\n var lineWidth = style && style.lineWidth;\n if (!lineWidth) {\n return outputShape;\n }\n outputShape.x = subPixelOptimize(originX, lineWidth, true);\n outputShape.y = subPixelOptimize(originY, lineWidth, true);\n outputShape.width = Math.max(subPixelOptimize(originX + originWidth, lineWidth, false) - outputShape.x, originWidth === 0 ? 0 : 1);\n outputShape.height = Math.max(subPixelOptimize(originY + originHeight, lineWidth, false) - outputShape.y, originHeight === 0 ? 0 : 1);\n return outputShape;\n}\nexport function subPixelOptimize(position, lineWidth, positiveOrNegative) {\n if (!lineWidth) {\n return position;\n }\n var doubledPosition = round(position * 2);\n return (doubledPosition + round(lineWidth)) % 2 === 0\n ? doubledPosition / 2\n : (doubledPosition + (positiveOrNegative ? 1 : -1)) / 2;\n}\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as roundRectHelper from '../helper/roundRect';\nimport { subPixelOptimizeRect } from '../helper/subPixelOptimize';\nvar RectShape = (function () {\n function RectShape() {\n this.x = 0;\n this.y = 0;\n this.width = 0;\n this.height = 0;\n }\n return RectShape;\n}());\nexport { RectShape };\nvar subPixelOptimizeOutputShape = {};\nvar Rect = (function (_super) {\n __extends(Rect, _super);\n function Rect(opts) {\n return _super.call(this, opts) || this;\n }\n Rect.prototype.getDefaultShape = function () {\n return new RectShape();\n };\n Rect.prototype.buildPath = function (ctx, shape) {\n var x;\n var y;\n var width;\n var height;\n if (this.subPixelOptimize) {\n var optimizedShape = subPixelOptimizeRect(subPixelOptimizeOutputShape, shape, this.style);\n x = optimizedShape.x;\n y = optimizedShape.y;\n width = optimizedShape.width;\n height = optimizedShape.height;\n optimizedShape.r = shape.r;\n shape = optimizedShape;\n }\n else {\n x = shape.x;\n y = shape.y;\n width = shape.width;\n height = shape.height;\n }\n if (!shape.r) {\n ctx.rect(x, y, width, height);\n }\n else {\n roundRectHelper.buildPath(ctx, shape);\n }\n };\n Rect.prototype.isZeroArea = function () {\n return !this.shape.width || !this.shape.height;\n };\n return Rect;\n}(Path));\nRect.prototype.type = 'rect';\nexport default Rect;\n","import { __extends } from \"tslib\";\nimport { parseRichText, parsePlainText } from './helper/parseText';\nimport TSpan from './TSpan';\nimport { retrieve2, each, normalizeCssArray, trim, retrieve3, extend, keys, defaults } from '../core/util';\nimport { DEFAULT_FONT, adjustTextX, adjustTextY } from '../contain/text';\nimport ZRImage from './Image';\nimport Rect from './shape/Rect';\nimport BoundingRect from '../core/BoundingRect';\nimport { copy } from '../core/matrix';\nimport Displayable, { DEFAULT_COMMON_ANIMATION_PROPS } from './Displayable';\nvar DEFAULT_RICH_TEXT_COLOR = {\n fill: '#000'\n};\nvar DEFAULT_STROKE_LINE_WIDTH = 2;\nexport var DEFAULT_TEXT_ANIMATION_PROPS = {\n style: defaults({\n fill: true,\n stroke: true,\n fillOpacity: true,\n strokeOpacity: true,\n lineWidth: true,\n fontSize: true,\n lineHeight: true,\n width: true,\n height: true,\n textShadowColor: true,\n textShadowBlur: true,\n textShadowOffsetX: true,\n textShadowOffsetY: true,\n backgroundColor: true,\n padding: true,\n borderColor: true,\n borderWidth: true,\n borderRadius: true\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n};\nvar ZRText = (function (_super) {\n __extends(ZRText, _super);\n function ZRText(opts) {\n var _this = _super.call(this) || this;\n _this.type = 'text';\n _this._children = [];\n _this._defaultStyle = DEFAULT_RICH_TEXT_COLOR;\n _this.attr(opts);\n return _this;\n }\n ZRText.prototype.childrenRef = function () {\n return this._children;\n };\n ZRText.prototype.update = function () {\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n child.zlevel = this.zlevel;\n child.z = this.z;\n child.z2 = this.z2;\n child.culling = this.culling;\n child.cursor = this.cursor;\n child.invisible = this.invisible;\n }\n var attachedTransform = this.attachedTransform;\n if (attachedTransform) {\n attachedTransform.updateTransform();\n var m = attachedTransform.transform;\n if (m) {\n this.transform = this.transform || [];\n copy(this.transform, m);\n }\n else {\n this.transform = null;\n }\n }\n else {\n _super.prototype.update.call(this);\n }\n };\n ZRText.prototype.getComputedTransform = function () {\n if (this.__hostTarget) {\n this.__hostTarget.getComputedTransform();\n this.__hostTarget.updateInnerText(true);\n }\n return this.attachedTransform ? this.attachedTransform.getComputedTransform()\n : _super.prototype.getComputedTransform.call(this);\n };\n ZRText.prototype._updateSubTexts = function () {\n this._childCursor = 0;\n normalizeTextStyle(this.style);\n this.style.rich\n ? this._updateRichTexts()\n : this._updatePlainTexts();\n this._children.length = this._childCursor;\n this.styleUpdated();\n };\n ZRText.prototype.addSelfToZr = function (zr) {\n _super.prototype.addSelfToZr.call(this, zr);\n for (var i = 0; i < this._children.length; i++) {\n this._children[i].__zr = zr;\n }\n };\n ZRText.prototype.removeSelfFromZr = function (zr) {\n _super.prototype.removeSelfFromZr.call(this, zr);\n for (var i = 0; i < this._children.length; i++) {\n this._children[i].__zr = null;\n }\n };\n ZRText.prototype.getBoundingRect = function () {\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n if (!this._rect) {\n var tmpRect = new BoundingRect(0, 0, 0, 0);\n var children = this._children;\n var tmpMat = [];\n var rect = null;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n var childRect = child.getBoundingRect();\n var transform = child.getLocalTransform(tmpMat);\n if (transform) {\n tmpRect.copy(childRect);\n tmpRect.applyTransform(transform);\n rect = rect || tmpRect.clone();\n rect.union(tmpRect);\n }\n else {\n rect = rect || childRect.clone();\n rect.union(childRect);\n }\n }\n this._rect = rect || tmpRect;\n }\n return this._rect;\n };\n ZRText.prototype.setDefaultTextStyle = function (defaultTextStyle) {\n this._defaultStyle = defaultTextStyle || DEFAULT_RICH_TEXT_COLOR;\n };\n ZRText.prototype.setTextContent = function (textContent) {\n throw new Error('Can\\'t attach text on another text');\n };\n ZRText.prototype._mergeStyle = function (targetStyle, sourceStyle) {\n if (!sourceStyle) {\n return targetStyle;\n }\n var sourceRich = sourceStyle.rich;\n var targetRich = targetStyle.rich || (sourceRich && {});\n extend(targetStyle, sourceStyle);\n if (sourceRich && targetRich) {\n this._mergeRich(targetRich, sourceRich);\n targetStyle.rich = targetRich;\n }\n else if (targetRich) {\n targetStyle.rich = targetRich;\n }\n return targetStyle;\n };\n ZRText.prototype._mergeRich = function (targetRich, sourceRich) {\n var richNames = keys(sourceRich);\n for (var i = 0; i < richNames.length; i++) {\n var richName = richNames[i];\n targetRich[richName] = targetRich[richName] || {};\n extend(targetRich[richName], sourceRich[richName]);\n }\n };\n ZRText.prototype.getAnimationStyleProps = function () {\n return DEFAULT_TEXT_ANIMATION_PROPS;\n };\n ZRText.prototype._getOrCreateChild = function (Ctor) {\n var child = this._children[this._childCursor];\n if (!child || !(child instanceof Ctor)) {\n child = new Ctor();\n }\n this._children[this._childCursor++] = child;\n child.__zr = this.__zr;\n child.parent = this;\n return child;\n };\n ZRText.prototype._updatePlainTexts = function () {\n var style = this.style;\n var textFont = style.font || DEFAULT_FONT;\n var textPadding = style.padding;\n var text = getStyleText(style);\n var contentBlock = parsePlainText(text, style);\n var needDrawBg = needDrawBackground(style);\n var bgColorDrawn = !!(style.backgroundColor);\n var outerHeight = contentBlock.outerHeight;\n var textLines = contentBlock.lines;\n var lineHeight = contentBlock.lineHeight;\n var defaultStyle = this._defaultStyle;\n var baseX = style.x || 0;\n var baseY = style.y || 0;\n var textAlign = style.align || defaultStyle.align || 'left';\n var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign || 'top';\n var textX = baseX;\n var textY = adjustTextY(baseY, contentBlock.contentHeight, verticalAlign);\n if (needDrawBg || textPadding) {\n var outerWidth_1 = contentBlock.width;\n textPadding && (outerWidth_1 += textPadding[1] + textPadding[3]);\n var boxX = adjustTextX(baseX, outerWidth_1, textAlign);\n var boxY = adjustTextY(baseY, outerHeight, verticalAlign);\n needDrawBg && this._renderBackground(style, style, boxX, boxY, outerWidth_1, outerHeight);\n }\n textY += lineHeight / 2;\n if (textPadding) {\n textX = getTextXForPadding(baseX, textAlign, textPadding);\n if (verticalAlign === 'top') {\n textY += textPadding[0];\n }\n else if (verticalAlign === 'bottom') {\n textY -= textPadding[2];\n }\n }\n var defaultLineWidth = 0;\n var useDefaultFill = false;\n var textFill = getFill('fill' in style\n ? style.fill\n : (useDefaultFill = true, defaultStyle.fill));\n var textStroke = getStroke('stroke' in style\n ? style.stroke\n : (!bgColorDrawn\n && (!defaultStyle.autoStroke || useDefaultFill))\n ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)\n : null);\n var hasShadow = style.textShadowBlur > 0;\n var fixedBoundingRect = style.width != null\n && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');\n var calculatedLineHeight = contentBlock.calculatedLineHeight;\n for (var i = 0; i < textLines.length; i++) {\n var el = this._getOrCreateChild(TSpan);\n var subElStyle = el.createStyle();\n el.useStyle(subElStyle);\n subElStyle.text = textLines[i];\n subElStyle.x = textX;\n subElStyle.y = textY;\n if (textAlign) {\n subElStyle.textAlign = textAlign;\n }\n subElStyle.textBaseline = 'middle';\n subElStyle.opacity = style.opacity;\n subElStyle.strokeFirst = true;\n if (hasShadow) {\n subElStyle.shadowBlur = style.textShadowBlur || 0;\n subElStyle.shadowColor = style.textShadowColor || 'transparent';\n subElStyle.shadowOffsetX = style.textShadowOffsetX || 0;\n subElStyle.shadowOffsetY = style.textShadowOffsetY || 0;\n }\n if (textStroke) {\n subElStyle.stroke = textStroke;\n subElStyle.lineWidth = style.lineWidth || defaultLineWidth;\n subElStyle.lineDash = style.lineDash;\n subElStyle.lineDashOffset = style.lineDashOffset || 0;\n }\n if (textFill) {\n subElStyle.fill = textFill;\n }\n subElStyle.font = textFont;\n textY += lineHeight;\n if (fixedBoundingRect) {\n el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, style.width, subElStyle.textAlign), adjustTextY(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline), style.width, calculatedLineHeight));\n }\n }\n };\n ZRText.prototype._updateRichTexts = function () {\n var style = this.style;\n var text = getStyleText(style);\n var contentBlock = parseRichText(text, style);\n var contentWidth = contentBlock.width;\n var outerWidth = contentBlock.outerWidth;\n var outerHeight = contentBlock.outerHeight;\n var textPadding = style.padding;\n var baseX = style.x || 0;\n var baseY = style.y || 0;\n var defaultStyle = this._defaultStyle;\n var textAlign = style.align || defaultStyle.align;\n var verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;\n var boxX = adjustTextX(baseX, outerWidth, textAlign);\n var boxY = adjustTextY(baseY, outerHeight, verticalAlign);\n var xLeft = boxX;\n var lineTop = boxY;\n if (textPadding) {\n xLeft += textPadding[3];\n lineTop += textPadding[0];\n }\n var xRight = xLeft + contentWidth;\n if (needDrawBackground(style)) {\n this._renderBackground(style, style, boxX, boxY, outerWidth, outerHeight);\n }\n var bgColorDrawn = !!(style.backgroundColor);\n for (var i = 0; i < contentBlock.lines.length; i++) {\n var line = contentBlock.lines[i];\n var tokens = line.tokens;\n var tokenCount = tokens.length;\n var lineHeight = line.lineHeight;\n var remainedWidth = line.width;\n var leftIndex = 0;\n var lineXLeft = xLeft;\n var lineXRight = xRight;\n var rightIndex = tokenCount - 1;\n var token = void 0;\n while (leftIndex < tokenCount\n && (token = tokens[leftIndex], !token.align || token.align === 'left')) {\n this._placeToken(token, style, lineHeight, lineTop, lineXLeft, 'left', bgColorDrawn);\n remainedWidth -= token.width;\n lineXLeft += token.width;\n leftIndex++;\n }\n while (rightIndex >= 0\n && (token = tokens[rightIndex], token.align === 'right')) {\n this._placeToken(token, style, lineHeight, lineTop, lineXRight, 'right', bgColorDrawn);\n remainedWidth -= token.width;\n lineXRight -= token.width;\n rightIndex--;\n }\n lineXLeft += (contentWidth - (lineXLeft - xLeft) - (xRight - lineXRight) - remainedWidth) / 2;\n while (leftIndex <= rightIndex) {\n token = tokens[leftIndex];\n this._placeToken(token, style, lineHeight, lineTop, lineXLeft + token.width / 2, 'center', bgColorDrawn);\n lineXLeft += token.width;\n leftIndex++;\n }\n lineTop += lineHeight;\n }\n };\n ZRText.prototype._placeToken = function (token, style, lineHeight, lineTop, x, textAlign, parentBgColorDrawn) {\n var tokenStyle = style.rich[token.styleName] || {};\n tokenStyle.text = token.text;\n var verticalAlign = token.verticalAlign;\n var y = lineTop + lineHeight / 2;\n if (verticalAlign === 'top') {\n y = lineTop + token.height / 2;\n }\n else if (verticalAlign === 'bottom') {\n y = lineTop + lineHeight - token.height / 2;\n }\n var needDrawBg = !token.isLineHolder && needDrawBackground(tokenStyle);\n needDrawBg && this._renderBackground(tokenStyle, style, textAlign === 'right'\n ? x - token.width\n : textAlign === 'center'\n ? x - token.width / 2\n : x, y - token.height / 2, token.width, token.height);\n var bgColorDrawn = !!tokenStyle.backgroundColor;\n var textPadding = token.textPadding;\n if (textPadding) {\n x = getTextXForPadding(x, textAlign, textPadding);\n y -= token.height / 2 - textPadding[0] - token.innerHeight / 2;\n }\n var el = this._getOrCreateChild(TSpan);\n var subElStyle = el.createStyle();\n el.useStyle(subElStyle);\n var defaultStyle = this._defaultStyle;\n var useDefaultFill = false;\n var defaultLineWidth = 0;\n var textFill = getStroke('fill' in tokenStyle ? tokenStyle.fill\n : 'fill' in style ? style.fill\n : (useDefaultFill = true, defaultStyle.fill));\n var textStroke = getStroke('stroke' in tokenStyle ? tokenStyle.stroke\n : 'stroke' in style ? style.stroke\n : (!bgColorDrawn\n && !parentBgColorDrawn\n && (!defaultStyle.autoStroke || useDefaultFill)) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)\n : null);\n var hasShadow = tokenStyle.textShadowBlur > 0\n || style.textShadowBlur > 0;\n subElStyle.text = token.text;\n subElStyle.x = x;\n subElStyle.y = y;\n if (hasShadow) {\n subElStyle.shadowBlur = tokenStyle.textShadowBlur || style.textShadowBlur || 0;\n subElStyle.shadowColor = tokenStyle.textShadowColor || style.textShadowColor || 'transparent';\n subElStyle.shadowOffsetX = tokenStyle.textShadowOffsetX || style.textShadowOffsetX || 0;\n subElStyle.shadowOffsetY = tokenStyle.textShadowOffsetY || style.textShadowOffsetY || 0;\n }\n subElStyle.textAlign = textAlign;\n subElStyle.textBaseline = 'middle';\n subElStyle.font = token.font || DEFAULT_FONT;\n subElStyle.opacity = retrieve3(tokenStyle.opacity, style.opacity, 1);\n if (textStroke) {\n subElStyle.lineWidth = retrieve3(tokenStyle.lineWidth, style.lineWidth, defaultLineWidth);\n subElStyle.lineDash = retrieve2(tokenStyle.lineDash, style.lineDash);\n subElStyle.lineDashOffset = style.lineDashOffset || 0;\n subElStyle.stroke = textStroke;\n }\n if (textFill) {\n subElStyle.fill = textFill;\n }\n var textWidth = token.contentWidth;\n var textHeight = token.contentHeight;\n el.setBoundingRect(new BoundingRect(adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign), adjustTextY(subElStyle.y, textHeight, subElStyle.textBaseline), textWidth, textHeight));\n };\n ZRText.prototype._renderBackground = function (style, topStyle, x, y, width, height) {\n var textBackgroundColor = style.backgroundColor;\n var textBorderWidth = style.borderWidth;\n var textBorderColor = style.borderColor;\n var isImageBg = textBackgroundColor && textBackgroundColor.image;\n var isPlainOrGradientBg = textBackgroundColor && !isImageBg;\n var textBorderRadius = style.borderRadius;\n var self = this;\n var rectEl;\n var imgEl;\n if (isPlainOrGradientBg || (textBorderWidth && textBorderColor)) {\n rectEl = this._getOrCreateChild(Rect);\n rectEl.useStyle(rectEl.createStyle());\n rectEl.style.fill = null;\n var rectShape = rectEl.shape;\n rectShape.x = x;\n rectShape.y = y;\n rectShape.width = width;\n rectShape.height = height;\n rectShape.r = textBorderRadius;\n rectEl.dirtyShape();\n }\n if (isPlainOrGradientBg) {\n var rectStyle = rectEl.style;\n rectStyle.fill = textBackgroundColor || null;\n rectStyle.fillOpacity = retrieve2(style.fillOpacity, 1);\n }\n else if (isImageBg) {\n imgEl = this._getOrCreateChild(ZRImage);\n imgEl.onload = function () {\n self.dirtyStyle();\n };\n var imgStyle = imgEl.style;\n imgStyle.image = textBackgroundColor.image;\n imgStyle.x = x;\n imgStyle.y = y;\n imgStyle.width = width;\n imgStyle.height = height;\n }\n if (textBorderWidth && textBorderColor) {\n var rectStyle = rectEl.style;\n rectStyle.lineWidth = textBorderWidth;\n rectStyle.stroke = textBorderColor;\n rectStyle.strokeOpacity = retrieve2(style.strokeOpacity, 1);\n rectStyle.lineDash = style.borderDash;\n rectStyle.lineDashOffset = style.borderDashOffset || 0;\n rectEl.strokeContainThreshold = 0;\n if (rectEl.hasFill() && rectEl.hasStroke()) {\n rectStyle.strokeFirst = true;\n rectStyle.lineWidth *= 2;\n }\n }\n var commonStyle = (rectEl || imgEl).style;\n commonStyle.shadowBlur = style.shadowBlur || 0;\n commonStyle.shadowColor = style.shadowColor || 'transparent';\n commonStyle.shadowOffsetX = style.shadowOffsetX || 0;\n commonStyle.shadowOffsetY = style.shadowOffsetY || 0;\n commonStyle.opacity = retrieve3(style.opacity, topStyle.opacity, 1);\n };\n ZRText.makeFont = function (style) {\n var font = '';\n if (style.fontSize || style.fontFamily || style.fontWeight) {\n var fontSize = '';\n if (typeof style.fontSize === 'string'\n && (style.fontSize.indexOf('px') !== -1\n || style.fontSize.indexOf('rem') !== -1\n || style.fontSize.indexOf('em') !== -1)) {\n fontSize = style.fontSize;\n }\n else if (!isNaN(+style.fontSize)) {\n fontSize = style.fontSize + 'px';\n }\n else {\n fontSize = '12px';\n }\n font = [\n style.fontStyle,\n style.fontWeight,\n fontSize,\n style.fontFamily || 'sans-serif'\n ].join(' ');\n }\n return font && trim(font) || style.textFont || style.font;\n };\n return ZRText;\n}(Displayable));\nvar VALID_TEXT_ALIGN = { left: true, right: 1, center: 1 };\nvar VALID_TEXT_VERTICAL_ALIGN = { top: 1, bottom: 1, middle: 1 };\nexport function normalizeTextStyle(style) {\n normalizeStyle(style);\n each(style.rich, normalizeStyle);\n return style;\n}\nfunction normalizeStyle(style) {\n if (style) {\n style.font = ZRText.makeFont(style);\n var textAlign = style.align;\n textAlign === 'middle' && (textAlign = 'center');\n style.align = (textAlign == null || VALID_TEXT_ALIGN[textAlign]) ? textAlign : 'left';\n var verticalAlign = style.verticalAlign;\n verticalAlign === 'center' && (verticalAlign = 'middle');\n style.verticalAlign = (verticalAlign == null || VALID_TEXT_VERTICAL_ALIGN[verticalAlign]) ? verticalAlign : 'top';\n var textPadding = style.padding;\n if (textPadding) {\n style.padding = normalizeCssArray(style.padding);\n }\n }\n}\nfunction getStroke(stroke, lineWidth) {\n return (stroke == null || lineWidth <= 0 || stroke === 'transparent' || stroke === 'none')\n ? null\n : (stroke.image || stroke.colorStops)\n ? '#000'\n : stroke;\n}\nfunction getFill(fill) {\n return (fill == null || fill === 'none')\n ? null\n : (fill.image || fill.colorStops)\n ? '#000'\n : fill;\n}\nfunction getTextXForPadding(x, textAlign, textPadding) {\n return textAlign === 'right'\n ? (x - textPadding[1])\n : textAlign === 'center'\n ? (x + textPadding[3] / 2 - textPadding[1] / 2)\n : (x + textPadding[3]);\n}\nfunction getStyleText(style) {\n var text = style.text;\n text != null && (text += '');\n return text;\n}\nfunction needDrawBackground(style) {\n return !!(style.backgroundColor\n || (style.borderWidth && style.borderColor));\n}\nexport default ZRText;\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/*\n* A third-party license is embeded for some of the code in this file:\n* The method \"quantile\" was copied from \"d3.js\".\n* (See more details in the comment of the method below.)\n* The use of the source code of this file is also subject to the terms\n* and consitions of the license of \"d3.js\" (BSD-3Clause, see\n* ).\n*/\nimport * as zrUtil from 'zrender/lib/core/util';\nvar RADIAN_EPSILON = 1e-4; // Although chrome already enlarge this number to 100 for `toFixed`, but\n// we sill follow the spec for compatibility.\n\nvar ROUND_SUPPORTED_PRECISION_MAX = 20;\n\nfunction _trim(str) {\n return str.replace(/^\\s+|\\s+$/g, '');\n}\n/**\n * Linear mapping a value from domain to range\n * @param val\n * @param domain Domain extent domain[0] can be bigger than domain[1]\n * @param range Range extent range[0] can be bigger than range[1]\n * @param clamp Default to be false\n */\n\n\nexport function linearMap(val, domain, range, clamp) {\n var d0 = domain[0];\n var d1 = domain[1];\n var r0 = range[0];\n var r1 = range[1];\n var subDomain = d1 - d0;\n var subRange = r1 - r0;\n\n if (subDomain === 0) {\n return subRange === 0 ? r0 : (r0 + r1) / 2;\n } // Avoid accuracy problem in edge, such as\n // 146.39 - 62.83 === 83.55999999999999.\n // See echarts/test/ut/spec/util/number.js#linearMap#accuracyError\n // It is a little verbose for efficiency considering this method\n // is a hotspot.\n\n\n if (clamp) {\n if (subDomain > 0) {\n if (val <= d0) {\n return r0;\n } else if (val >= d1) {\n return r1;\n }\n } else {\n if (val >= d0) {\n return r0;\n } else if (val <= d1) {\n return r1;\n }\n }\n } else {\n if (val === d0) {\n return r0;\n }\n\n if (val === d1) {\n return r1;\n }\n }\n\n return (val - d0) / subDomain * subRange + r0;\n}\n/**\n * Convert a percent string to absolute number.\n * Returns NaN if percent is not a valid string or number\n */\n\nexport function parsePercent(percent, all) {\n switch (percent) {\n case 'center':\n case 'middle':\n percent = '50%';\n break;\n\n case 'left':\n case 'top':\n percent = '0%';\n break;\n\n case 'right':\n case 'bottom':\n percent = '100%';\n break;\n }\n\n if (typeof percent === 'string') {\n if (_trim(percent).match(/%$/)) {\n return parseFloat(percent) / 100 * all;\n }\n\n return parseFloat(percent);\n }\n\n return percent == null ? NaN : +percent;\n}\nexport function round(x, precision, returnStr) {\n if (precision == null) {\n precision = 10;\n } // Avoid range error\n\n\n precision = Math.min(Math.max(0, precision), ROUND_SUPPORTED_PRECISION_MAX); // PENDING: 1.005.toFixed(2) is '1.00' rather than '1.01'\n\n x = (+x).toFixed(precision);\n return returnStr ? x : +x;\n}\n/**\n * Inplacd asc sort arr.\n * The input arr will be modified.\n */\n\nexport function asc(arr) {\n arr.sort(function (a, b) {\n return a - b;\n });\n return arr;\n}\n/**\n * Get precision.\n */\n\nexport function getPrecision(val) {\n val = +val;\n\n if (isNaN(val)) {\n return 0;\n } // It is much faster than methods converting number to string as follows\n // let tmp = val.toString();\n // return tmp.length - 1 - tmp.indexOf('.');\n // especially when precision is low\n // Notice:\n // (1) If the loop count is over about 20, it is slower than `getPrecisionSafe`.\n // (see https://jsbench.me/2vkpcekkvw/1)\n // (2) If the val is less than for example 1e-15, the result may be incorrect.\n // (see test/ut/spec/util/number.test.ts `getPrecision_equal_random`)\n\n\n if (val > 1e-14) {\n var e = 1;\n\n for (var i = 0; i < 15; i++, e *= 10) {\n if (Math.round(val * e) / e === val) {\n return i;\n }\n }\n }\n\n return getPrecisionSafe(val);\n}\n/**\n * Get precision with slow but safe method\n */\n\nexport function getPrecisionSafe(val) {\n // toLowerCase for: '3.4E-12'\n var str = val.toString().toLowerCase(); // Consider scientific notation: '3.4e-12' '3.4e+12'\n\n var eIndex = str.indexOf('e');\n var exp = eIndex > 0 ? +str.slice(eIndex + 1) : 0;\n var significandPartLen = eIndex > 0 ? eIndex : str.length;\n var dotIndex = str.indexOf('.');\n var decimalPartLen = dotIndex < 0 ? 0 : significandPartLen - 1 - dotIndex;\n return Math.max(0, decimalPartLen - exp);\n}\n/**\n * Minimal dicernible data precisioin according to a single pixel.\n */\n\nexport function getPixelPrecision(dataExtent, pixelExtent) {\n var log = Math.log;\n var LN10 = Math.LN10;\n var dataQuantity = Math.floor(log(dataExtent[1] - dataExtent[0]) / LN10);\n var sizeQuantity = Math.round(log(Math.abs(pixelExtent[1] - pixelExtent[0])) / LN10); // toFixed() digits argument must be between 0 and 20.\n\n var precision = Math.min(Math.max(-dataQuantity + sizeQuantity, 0), 20);\n return !isFinite(precision) ? 20 : precision;\n}\n/**\n * Get a data of given precision, assuring the sum of percentages\n * in valueList is 1.\n * The largest remainer method is used.\n * https://en.wikipedia.org/wiki/Largest_remainder_method\n *\n * @param valueList a list of all data\n * @param idx index of the data to be processed in valueList\n * @param precision integer number showing digits of precision\n * @return percent ranging from 0 to 100\n */\n\nexport function getPercentWithPrecision(valueList, idx, precision) {\n if (!valueList[idx]) {\n return 0;\n }\n\n var sum = zrUtil.reduce(valueList, function (acc, val) {\n return acc + (isNaN(val) ? 0 : val);\n }, 0);\n\n if (sum === 0) {\n return 0;\n }\n\n var digits = Math.pow(10, precision);\n var votesPerQuota = zrUtil.map(valueList, function (val) {\n return (isNaN(val) ? 0 : val) / sum * digits * 100;\n });\n var targetSeats = digits * 100;\n var seats = zrUtil.map(votesPerQuota, function (votes) {\n // Assign automatic seats.\n return Math.floor(votes);\n });\n var currentSum = zrUtil.reduce(seats, function (acc, val) {\n return acc + val;\n }, 0);\n var remainder = zrUtil.map(votesPerQuota, function (votes, idx) {\n return votes - seats[idx];\n }); // Has remainding votes.\n\n while (currentSum < targetSeats) {\n // Find next largest remainder.\n var max = Number.NEGATIVE_INFINITY;\n var maxId = null;\n\n for (var i = 0, len = remainder.length; i < len; ++i) {\n if (remainder[i] > max) {\n max = remainder[i];\n maxId = i;\n }\n } // Add a vote to max remainder.\n\n\n ++seats[maxId];\n remainder[maxId] = 0;\n ++currentSum;\n }\n\n return seats[idx] / digits;\n}\n/**\n * Solve the floating point adding problem like 0.1 + 0.2 === 0.30000000000000004\n * See \n */\n\nexport function addSafe(val0, val1) {\n var maxPrecision = Math.max(getPrecision(val0), getPrecision(val1)); // const multiplier = Math.pow(10, maxPrecision);\n // return (Math.round(val0 * multiplier) + Math.round(val1 * multiplier)) / multiplier;\n\n var sum = val0 + val1; // // PENDING: support more?\n\n return maxPrecision > ROUND_SUPPORTED_PRECISION_MAX ? sum : round(sum, maxPrecision);\n} // Number.MAX_SAFE_INTEGER, ie do not support.\n\nexport var MAX_SAFE_INTEGER = 9007199254740991;\n/**\n * To 0 - 2 * PI, considering negative radian.\n */\n\nexport function remRadian(radian) {\n var pi2 = Math.PI * 2;\n return (radian % pi2 + pi2) % pi2;\n}\n/**\n * @param {type} radian\n * @return {boolean}\n */\n\nexport function isRadianAroundZero(val) {\n return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;\n} // eslint-disable-next-line\n\nvar TIME_REG = /^(?:(\\d{4})(?:[-\\/](\\d{1,2})(?:[-\\/](\\d{1,2})(?:[T ](\\d{1,2})(?::(\\d{1,2})(?::(\\d{1,2})(?:[.,](\\d+))?)?)?(Z|[\\+\\-]\\d\\d:?\\d\\d)?)?)?)?)?$/; // jshint ignore:line\n\n/**\n * @param value valid type: number | string | Date, otherwise return `new Date(NaN)`\n * These values can be accepted:\n * + An instance of Date, represent a time in its own time zone.\n * + Or string in a subset of ISO 8601, only including:\n * + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06',\n * + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123',\n * + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00',\n * all of which will be treated as local time if time zone is not specified\n * (see ).\n * + Or other string format, including (all of which will be treated as loacal time):\n * '2012', '2012-3-1', '2012/3/1', '2012/03/01',\n * '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123'\n * + a timestamp, which represent a time in UTC.\n * @return date Never be null/undefined. If invalid, return `new Date(NaN)`.\n */\n\nexport function parseDate(value) {\n if (value instanceof Date) {\n return value;\n } else if (typeof value === 'string') {\n // Different browsers parse date in different way, so we parse it manually.\n // Some other issues:\n // new Date('1970-01-01') is UTC,\n // new Date('1970/01/01') and new Date('1970-1-01') is local.\n // See issue #3623\n var match = TIME_REG.exec(value);\n\n if (!match) {\n // return Invalid Date.\n return new Date(NaN);\n } // Use local time when no timezone offset specifed.\n\n\n if (!match[8]) {\n // match[n] can only be string or undefined.\n // But take care of '12' + 1 => '121'.\n return new Date(+match[1], +(match[2] || 1) - 1, +match[3] || 1, +match[4] || 0, +(match[5] || 0), +match[6] || 0, +match[7] || 0);\n } // Timezoneoffset of Javascript Date has considered DST (Daylight Saving Time,\n // https://tc39.github.io/ecma262/#sec-daylight-saving-time-adjustment).\n // For example, system timezone is set as \"Time Zone: America/Toronto\",\n // then these code will get different result:\n // `new Date(1478411999999).getTimezoneOffset(); // get 240`\n // `new Date(1478412000000).getTimezoneOffset(); // get 300`\n // So we should not use `new Date`, but use `Date.UTC`.\n else {\n var hour = +match[4] || 0;\n\n if (match[8].toUpperCase() !== 'Z') {\n hour -= +match[8].slice(0, 3);\n }\n\n return new Date(Date.UTC(+match[1], +(match[2] || 1) - 1, +match[3] || 1, hour, +(match[5] || 0), +match[6] || 0, +match[7] || 0));\n }\n } else if (value == null) {\n return new Date(NaN);\n }\n\n return new Date(Math.round(value));\n}\n/**\n * Quantity of a number. e.g. 0.1, 1, 10, 100\n *\n * @param val\n * @return\n */\n\nexport function quantity(val) {\n return Math.pow(10, quantityExponent(val));\n}\n/**\n * Exponent of the quantity of a number\n * e.g., 1234 equals to 1.234*10^3, so quantityExponent(1234) is 3\n *\n * @param val non-negative value\n * @return\n */\n\nexport function quantityExponent(val) {\n if (val === 0) {\n return 0;\n }\n\n var exp = Math.floor(Math.log(val) / Math.LN10);\n /**\n * exp is expected to be the rounded-down result of the base-10 log of val.\n * But due to the precision loss with Math.log(val), we need to restore it\n * using 10^exp to make sure we can get val back from exp. #11249\n */\n\n if (val / Math.pow(10, exp) >= 10) {\n exp++;\n }\n\n return exp;\n}\n/**\n * find a “nice” number approximately equal to x. Round the number if round = true,\n * take ceiling if round = false. The primary observation is that the “nicest”\n * numbers in decimal are 1, 2, and 5, and all power-of-ten multiples of these numbers.\n *\n * See \"Nice Numbers for Graph Labels\" of Graphic Gems.\n *\n * @param val Non-negative value.\n * @param round\n * @return Niced number\n */\n\nexport function nice(val, round) {\n var exponent = quantityExponent(val);\n var exp10 = Math.pow(10, exponent);\n var f = val / exp10; // 1 <= f < 10\n\n var nf;\n\n if (round) {\n if (f < 1.5) {\n nf = 1;\n } else if (f < 2.5) {\n nf = 2;\n } else if (f < 4) {\n nf = 3;\n } else if (f < 7) {\n nf = 5;\n } else {\n nf = 10;\n }\n } else {\n if (f < 1) {\n nf = 1;\n } else if (f < 2) {\n nf = 2;\n } else if (f < 3) {\n nf = 3;\n } else if (f < 5) {\n nf = 5;\n } else {\n nf = 10;\n }\n }\n\n val = nf * exp10; // Fix 3 * 0.1 === 0.30000000000000004 issue (see IEEE 754).\n // 20 is the uppper bound of toFixed.\n\n return exponent >= -20 ? +val.toFixed(exponent < 0 ? -exponent : 0) : val;\n}\n/**\n * This code was copied from \"d3.js\"\n * .\n * See the license statement at the head of this file.\n * @param ascArr\n */\n\nexport function quantile(ascArr, p) {\n var H = (ascArr.length - 1) * p + 1;\n var h = Math.floor(H);\n var v = +ascArr[h - 1];\n var e = H - h;\n return e ? v + e * (ascArr[h] - v) : v;\n}\n/**\n * Order intervals asc, and split them when overlap.\n * expect(numberUtil.reformIntervals([\n * {interval: [18, 62], close: [1, 1]},\n * {interval: [-Infinity, -70], close: [0, 0]},\n * {interval: [-70, -26], close: [1, 1]},\n * {interval: [-26, 18], close: [1, 1]},\n * {interval: [62, 150], close: [1, 1]},\n * {interval: [106, 150], close: [1, 1]},\n * {interval: [150, Infinity], close: [0, 0]}\n * ])).toEqual([\n * {interval: [-Infinity, -70], close: [0, 0]},\n * {interval: [-70, -26], close: [1, 1]},\n * {interval: [-26, 18], close: [0, 1]},\n * {interval: [18, 62], close: [0, 1]},\n * {interval: [62, 150], close: [0, 1]},\n * {interval: [150, Infinity], close: [0, 0]}\n * ]);\n * @param list, where `close` mean open or close\n * of the interval, and Infinity can be used.\n * @return The origin list, which has been reformed.\n */\n\nexport function reformIntervals(list) {\n list.sort(function (a, b) {\n return littleThan(a, b, 0) ? -1 : 1;\n });\n var curr = -Infinity;\n var currClose = 1;\n\n for (var i = 0; i < list.length;) {\n var interval = list[i].interval;\n var close_1 = list[i].close;\n\n for (var lg = 0; lg < 2; lg++) {\n if (interval[lg] <= curr) {\n interval[lg] = curr;\n close_1[lg] = !lg ? 1 - currClose : 1;\n }\n\n curr = interval[lg];\n currClose = close_1[lg];\n }\n\n if (interval[0] === interval[1] && close_1[0] * close_1[1] !== 1) {\n list.splice(i, 1);\n } else {\n i++;\n }\n }\n\n return list;\n\n function littleThan(a, b, lg) {\n return a.interval[lg] < b.interval[lg] || a.interval[lg] === b.interval[lg] && (a.close[lg] - b.close[lg] === (!lg ? 1 : -1) || !lg && littleThan(a, b, 1));\n }\n}\n/**\n * [Numberic is defined as]:\n * `parseFloat(val) == val`\n * For example:\n * numeric:\n * typeof number except NaN, '-123', '123', '2e3', '-2e3', '011', 'Infinity', Infinity,\n * and they rounded by white-spaces or line-terminal like ' -123 \\n ' (see es spec)\n * not-numeric:\n * null, undefined, [], {}, true, false, 'NaN', NaN, '123ab',\n * empty string, string with only white-spaces or line-terminal (see es spec),\n * 0x12, '0x12', '-0x12', 012, '012', '-012',\n * non-string, ...\n *\n * @test See full test cases in `test/ut/spec/util/number.js`.\n * @return Must be a typeof number. If not numeric, return NaN.\n */\n\nexport function numericToNumber(val) {\n var valFloat = parseFloat(val);\n return valFloat == val // eslint-disable-line eqeqeq\n && (valFloat !== 0 || typeof val !== 'string' || val.indexOf('x') <= 0) // For case ' 0x0 '.\n ? valFloat : NaN;\n}\n/**\n * Definition of \"numeric\": see `numericToNumber`.\n */\n\nexport function isNumeric(val) {\n return !isNaN(numericToNumber(val));\n}\n/**\n * Use random base to prevent users hard code depending on\n * this auto generated marker id.\n * @return An positive integer.\n */\n\nexport function getRandomIdBase() {\n return Math.round(Math.random() * 9);\n}\n/**\n * Get the greatest common dividor\n *\n * @param {number} a one number\n * @param {number} b the other number\n */\n\nexport function getGreatestCommonDividor(a, b) {\n if (b === 0) {\n return a;\n }\n\n return getGreatestCommonDividor(b, a % b);\n}\n/**\n * Get the least common multiple\n *\n * @param {number} a one number\n * @param {number} b the other number\n */\n\nexport function getLeastCommonMultiple(a, b) {\n if (a == null) {\n return b;\n }\n\n if (b == null) {\n return a;\n }\n\n return a * b / getGreatestCommonDividor(a, b);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { map, isString, isFunction, eqNaN, isRegExp } from 'zrender/lib/core/util';\nvar ECHARTS_PREFIX = '[ECharts] ';\nvar storedLogs = {};\nvar hasConsole = typeof console !== 'undefined' // eslint-disable-next-line\n&& console.warn && console.log;\nexport function log(str) {\n if (hasConsole) {\n // eslint-disable-next-line\n console.log(ECHARTS_PREFIX + str);\n }\n}\nexport function warn(str) {\n if (hasConsole) {\n console.warn(ECHARTS_PREFIX + str);\n }\n}\nexport function error(str) {\n if (hasConsole) {\n console.error(ECHARTS_PREFIX + str);\n }\n}\nexport function deprecateLog(str) {\n if (process.env.NODE_ENV !== 'production') {\n if (storedLogs[str]) {\n // Not display duplicate message.\n return;\n }\n\n if (hasConsole) {\n storedLogs[str] = true;\n console.warn(ECHARTS_PREFIX + 'DEPRECATED: ' + str);\n }\n }\n}\nexport function deprecateReplaceLog(oldOpt, newOpt, scope) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateLog((scope ? \"[\" + scope + \"]\" : '') + (oldOpt + \" is deprecated, use \" + newOpt + \" instead.\"));\n }\n}\nexport function consoleLog() {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n if (process.env.NODE_ENV !== 'production') {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && console.log) {\n console.log.apply(console, args);\n }\n /* eslint-enable no-console */\n\n }\n}\n/**\n * If in __DEV__ environment, get console printable message for users hint.\n * Parameters are separated by ' '.\n * @usuage\n * makePrintable('This is an error on', someVar, someObj);\n *\n * @param hintInfo anything about the current execution context to hint users.\n * @throws Error\n */\n\nexport function makePrintable() {\n var hintInfo = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n hintInfo[_i] = arguments[_i];\n }\n\n var msg = '';\n\n if (process.env.NODE_ENV !== 'production') {\n // Fuzzy stringify for print.\n // This code only exist in dev environment.\n var makePrintableStringIfPossible_1 = function (val) {\n return val === void 0 ? 'undefined' : val === Infinity ? 'Infinity' : val === -Infinity ? '-Infinity' : eqNaN(val) ? 'NaN' : val instanceof Date ? 'Date(' + val.toISOString() + ')' : isFunction(val) ? 'function () { ... }' : isRegExp(val) ? val + '' : null;\n };\n\n msg = map(hintInfo, function (arg) {\n if (isString(arg)) {\n // Print without quotation mark for some statement.\n return arg;\n } else {\n var printableStr = makePrintableStringIfPossible_1(arg);\n\n if (printableStr != null) {\n return printableStr;\n } else if (typeof JSON !== 'undefined' && JSON.stringify) {\n try {\n return JSON.stringify(arg, function (n, val) {\n var printableStr = makePrintableStringIfPossible_1(val);\n return printableStr == null ? val : printableStr;\n }); // In most cases the info object is small, so do not line break.\n } catch (err) {\n return '?';\n }\n } else {\n return '?';\n }\n }\n }).join(' ');\n }\n\n return msg;\n}\n/**\n * @throws Error\n */\n\nexport function throwError(msg) {\n throw new Error(msg);\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { each, isObject, isArray, createHashMap, map, assert, isString, indexOf, isStringSafe } from 'zrender/lib/core/util';\nimport env from 'zrender/lib/core/env';\nimport { isNumeric, getRandomIdBase, getPrecision, round } from './number';\nimport { interpolateNumber } from 'zrender/lib/animation/Animator';\nimport { warn } from './log';\n/**\n * Make the name displayable. But we should\n * make sure it is not duplicated with user\n * specified name, so use '\\0';\n */\n\nvar DUMMY_COMPONENT_NAME_PREFIX = 'series\\0';\nvar INTERNAL_COMPONENT_ID_PREFIX = '\\0_ec_\\0';\n/**\n * If value is not array, then translate it to array.\n * @param {*} value\n * @return {Array} [value] or value\n */\n\nexport function normalizeToArray(value) {\n return value instanceof Array ? value : value == null ? [] : [value];\n}\n/**\n * Sync default option between normal and emphasis like `position` and `show`\n * In case some one will write code like\n * label: {\n * show: false,\n * position: 'outside',\n * fontSize: 18\n * },\n * emphasis: {\n * label: { show: true }\n * }\n */\n\nexport function defaultEmphasis(opt, key, subOpts) {\n // Caution: performance sensitive.\n if (opt) {\n opt[key] = opt[key] || {};\n opt.emphasis = opt.emphasis || {};\n opt.emphasis[key] = opt.emphasis[key] || {}; // Default emphasis option from normal\n\n for (var i = 0, len = subOpts.length; i < len; i++) {\n var subOptName = subOpts[i];\n\n if (!opt.emphasis[key].hasOwnProperty(subOptName) && opt[key].hasOwnProperty(subOptName)) {\n opt.emphasis[key][subOptName] = opt[key][subOptName];\n }\n }\n }\n}\nexport var TEXT_STYLE_OPTIONS = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'rich', 'tag', 'color', 'textBorderColor', 'textBorderWidth', 'width', 'height', 'lineHeight', 'align', 'verticalAlign', 'baseline', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY', 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY', 'backgroundColor', 'borderColor', 'borderWidth', 'borderRadius', 'padding']; // modelUtil.LABEL_OPTIONS = modelUtil.TEXT_STYLE_OPTIONS.concat([\n// 'position', 'offset', 'rotate', 'origin', 'show', 'distance', 'formatter',\n// 'fontStyle', 'fontWeight', 'fontSize', 'fontFamily',\n// // FIXME: deprecated, check and remove it.\n// 'textStyle'\n// ]);\n\n/**\n * The method do not ensure performance.\n * data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]\n * This helper method retieves value from data.\n */\n\nexport function getDataItemValue(dataItem) {\n return isObject(dataItem) && !isArray(dataItem) && !(dataItem instanceof Date) ? dataItem.value : dataItem;\n}\n/**\n * data could be [12, 2323, {value: 223}, [1221, 23], {value: [2, 23]}]\n * This helper method determine if dataItem has extra option besides value\n */\n\nexport function isDataItemOption(dataItem) {\n return isObject(dataItem) && !(dataItem instanceof Array); // // markLine data can be array\n // && !(dataItem[0] && isObject(dataItem[0]) && !(dataItem[0] instanceof Array));\n}\n;\n/**\n * Mapping to existings for merge.\n *\n * Mode \"normalMege\":\n * The mapping result (merge result) will keep the order of the existing\n * component, rather than the order of new option. Because we should ensure\n * some specified index reference (like xAxisIndex) keep work.\n * And in most cases, \"merge option\" is used to update partial option but not\n * be expected to change the order.\n *\n * Mode \"replaceMege\":\n * (1) Only the id mapped components will be merged.\n * (2) Other existing components (except internal compoonets) will be removed.\n * (3) Other new options will be used to create new component.\n * (4) The index of the existing compoents will not be modified.\n * That means their might be \"hole\" after the removal.\n * The new components are created first at those available index.\n *\n * Mode \"replaceAll\":\n * This mode try to support that reproduce an echarts instance from another\n * echarts instance (via `getOption`) in some simple cases.\n * In this senario, the `result` index are exactly the consistent with the `newCmptOptions`,\n * which ensures the compoennt index referring (like `xAxisIndex: ?`) corrent. That is,\n * the \"hole\" in `newCmptOptions` will also be kept.\n * On the contrary, other modes try best to eliminate holes.\n * PENDING: This is an experimental mode yet.\n *\n * @return See the comment of .\n */\n\nexport function mappingToExists(existings, newCmptOptions, mode) {\n var isNormalMergeMode = mode === 'normalMerge';\n var isReplaceMergeMode = mode === 'replaceMerge';\n var isReplaceAllMode = mode === 'replaceAll';\n existings = existings || [];\n newCmptOptions = (newCmptOptions || []).slice();\n var existingIdIdxMap = createHashMap(); // Validate id and name on user input option.\n\n each(newCmptOptions, function (cmptOption, index) {\n if (!isObject(cmptOption)) {\n newCmptOptions[index] = null;\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // There is some legacy case that name is set as `false`.\n // But should work normally rather than throw error.\n if (cmptOption.id != null && !isValidIdOrName(cmptOption.id)) {\n warnInvalidateIdOrName(cmptOption.id);\n }\n\n if (cmptOption.name != null && !isValidIdOrName(cmptOption.name)) {\n warnInvalidateIdOrName(cmptOption.name);\n }\n }\n });\n var result = prepareResult(existings, existingIdIdxMap, mode);\n\n if (isNormalMergeMode || isReplaceMergeMode) {\n mappingById(result, existings, existingIdIdxMap, newCmptOptions);\n }\n\n if (isNormalMergeMode) {\n mappingByName(result, newCmptOptions);\n }\n\n if (isNormalMergeMode || isReplaceMergeMode) {\n mappingByIndex(result, newCmptOptions, isReplaceMergeMode);\n } else if (isReplaceAllMode) {\n mappingInReplaceAllMode(result, newCmptOptions);\n }\n\n makeIdAndName(result); // The array `result` MUST NOT contain elided items, otherwise the\n // forEach will ommit those items and result in incorrect result.\n\n return result;\n}\n\nfunction prepareResult(existings, existingIdIdxMap, mode) {\n var result = [];\n\n if (mode === 'replaceAll') {\n return result;\n } // Do not use native `map` to in case that the array `existings`\n // contains elided items, which will be ommited.\n\n\n for (var index = 0; index < existings.length; index++) {\n var existing = existings[index]; // Because of replaceMerge, `existing` may be null/undefined.\n\n if (existing && existing.id != null) {\n existingIdIdxMap.set(existing.id, index);\n } // For non-internal-componnets:\n // Mode \"normalMerge\": all existings kept.\n // Mode \"replaceMerge\": all existing removed unless mapped by id.\n // For internal-components:\n // go with \"replaceMerge\" approach in both mode.\n\n\n result.push({\n existing: mode === 'replaceMerge' || isComponentIdInternal(existing) ? null : existing,\n newOption: null,\n keyInfo: null,\n brandNew: null\n });\n }\n\n return result;\n}\n\nfunction mappingById(result, existings, existingIdIdxMap, newCmptOptions) {\n // Mapping by id if specified.\n each(newCmptOptions, function (cmptOption, index) {\n if (!cmptOption || cmptOption.id == null) {\n return;\n }\n\n var optionId = makeComparableKey(cmptOption.id);\n var existingIdx = existingIdIdxMap.get(optionId);\n\n if (existingIdx != null) {\n var resultItem = result[existingIdx];\n assert(!resultItem.newOption, 'Duplicated option on id \"' + optionId + '\".');\n resultItem.newOption = cmptOption; // In both mode, if id matched, new option will be merged to\n // the existings rather than creating new component model.\n\n resultItem.existing = existings[existingIdx];\n newCmptOptions[index] = null;\n }\n });\n}\n\nfunction mappingByName(result, newCmptOptions) {\n // Mapping by name if specified.\n each(newCmptOptions, function (cmptOption, index) {\n if (!cmptOption || cmptOption.name == null) {\n return;\n }\n\n for (var i = 0; i < result.length; i++) {\n var existing = result[i].existing;\n\n if (!result[i].newOption // Consider name: two map to one.\n // Can not match when both ids existing but different.\n && existing && (existing.id == null || cmptOption.id == null) && !isComponentIdInternal(cmptOption) && !isComponentIdInternal(existing) && keyExistAndEqual('name', existing, cmptOption)) {\n result[i].newOption = cmptOption;\n newCmptOptions[index] = null;\n return;\n }\n }\n });\n}\n\nfunction mappingByIndex(result, newCmptOptions, brandNew) {\n each(newCmptOptions, function (cmptOption) {\n if (!cmptOption) {\n return;\n } // Find the first place that not mapped by id and not internal component (consider the \"hole\").\n\n\n var resultItem;\n var nextIdx = 0;\n\n while ( // Be `!resultItem` only when `nextIdx >= result.length`.\n (resultItem = result[nextIdx]) && ( // (1) Existing models that already have id should be able to mapped to. Because\n // after mapping performed, model will always be assigned with an id if user not given.\n // After that all models have id.\n // (2) If new option has id, it can only set to a hole or append to the last. It should\n // not be merged to the existings with different id. Because id should not be overwritten.\n // (3) Name can be overwritten, because axis use name as 'show label text'.\n resultItem.newOption || isComponentIdInternal(resultItem.existing) || // In mode \"replaceMerge\", here no not-mapped-non-internal-existing.\n resultItem.existing && cmptOption.id != null && !keyExistAndEqual('id', cmptOption, resultItem.existing))) {\n nextIdx++;\n }\n\n if (resultItem) {\n resultItem.newOption = cmptOption;\n resultItem.brandNew = brandNew;\n } else {\n result.push({\n newOption: cmptOption,\n brandNew: brandNew,\n existing: null,\n keyInfo: null\n });\n }\n\n nextIdx++;\n });\n}\n\nfunction mappingInReplaceAllMode(result, newCmptOptions) {\n each(newCmptOptions, function (cmptOption) {\n // The feature \"reproduce\" requires \"hole\" will also reproduced\n // in case that compoennt index referring are broken.\n result.push({\n newOption: cmptOption,\n brandNew: true,\n existing: null,\n keyInfo: null\n });\n });\n}\n/**\n * Make id and name for mapping result (result of mappingToExists)\n * into `keyInfo` field.\n */\n\n\nfunction makeIdAndName(mapResult) {\n // We use this id to hash component models and view instances\n // in echarts. id can be specified by user, or auto generated.\n // The id generation rule ensures new view instance are able\n // to mapped to old instance when setOption are called in\n // no-merge mode. So we generate model id by name and plus\n // type in view id.\n // name can be duplicated among components, which is convenient\n // to specify multi components (like series) by one name.\n // Ensure that each id is distinct.\n var idMap = createHashMap();\n each(mapResult, function (item) {\n var existing = item.existing;\n existing && idMap.set(existing.id, item);\n });\n each(mapResult, function (item) {\n var opt = item.newOption; // Force ensure id not duplicated.\n\n assert(!opt || opt.id == null || !idMap.get(opt.id) || idMap.get(opt.id) === item, 'id duplicates: ' + (opt && opt.id));\n opt && opt.id != null && idMap.set(opt.id, item);\n !item.keyInfo && (item.keyInfo = {});\n }); // Make name and id.\n\n each(mapResult, function (item, index) {\n var existing = item.existing;\n var opt = item.newOption;\n var keyInfo = item.keyInfo;\n\n if (!isObject(opt)) {\n return;\n } // name can be overwitten. Consider case: axis.name = '20km'.\n // But id generated by name will not be changed, which affect\n // only in that case: setOption with 'not merge mode' and view\n // instance will be recreated, which can be accepted.\n\n\n keyInfo.name = opt.name != null ? makeComparableKey(opt.name) : existing ? existing.name // Avoid diffferent series has the same name,\n // because name may be used like in color pallet.\n : DUMMY_COMPONENT_NAME_PREFIX + index;\n\n if (existing) {\n keyInfo.id = makeComparableKey(existing.id);\n } else if (opt.id != null) {\n keyInfo.id = makeComparableKey(opt.id);\n } else {\n // Consider this situatoin:\n // optionA: [{name: 'a'}, {name: 'a'}, {..}]\n // optionB [{..}, {name: 'a'}, {name: 'a'}]\n // Series with the same name between optionA and optionB\n // should be mapped.\n var idNum = 0;\n\n do {\n keyInfo.id = '\\0' + keyInfo.name + '\\0' + idNum++;\n } while (idMap.get(keyInfo.id));\n }\n\n idMap.set(keyInfo.id, item);\n });\n}\n\nfunction keyExistAndEqual(attr, obj1, obj2) {\n var key1 = convertOptionIdName(obj1[attr], null);\n var key2 = convertOptionIdName(obj2[attr], null); // See `MappingExistingItem`. `id` and `name` trade string equals to number.\n\n return key1 != null && key2 != null && key1 === key2;\n}\n/**\n * @return return null if not exist.\n */\n\n\nfunction makeComparableKey(val) {\n if (process.env.NODE_ENV !== 'production') {\n if (val == null) {\n throw new Error();\n }\n }\n\n return convertOptionIdName(val, '');\n}\n\nexport function convertOptionIdName(idOrName, defaultValue) {\n if (idOrName == null) {\n return defaultValue;\n }\n\n var type = typeof idOrName;\n return type === 'string' ? idOrName : type === 'number' || isStringSafe(idOrName) ? idOrName + '' : defaultValue;\n}\n\nfunction warnInvalidateIdOrName(idOrName) {\n if (process.env.NODE_ENV !== 'production') {\n warn('`' + idOrName + '` is invalid id or name. Must be a string or number.');\n }\n}\n\nfunction isValidIdOrName(idOrName) {\n return isStringSafe(idOrName) || isNumeric(idOrName);\n}\n\nexport function isNameSpecified(componentModel) {\n var name = componentModel.name; // Is specified when `indexOf` get -1 or > 0.\n\n return !!(name && name.indexOf(DUMMY_COMPONENT_NAME_PREFIX));\n}\n/**\n * @public\n * @param {Object} cmptOption\n * @return {boolean}\n */\n\nexport function isComponentIdInternal(cmptOption) {\n return cmptOption && cmptOption.id != null && makeComparableKey(cmptOption.id).indexOf(INTERNAL_COMPONENT_ID_PREFIX) === 0;\n}\nexport function makeInternalComponentId(idSuffix) {\n return INTERNAL_COMPONENT_ID_PREFIX + idSuffix;\n}\nexport function setComponentTypeToKeyInfo(mappingResult, mainType, componentModelCtor) {\n // Set mainType and complete subType.\n each(mappingResult, function (item) {\n var newOption = item.newOption;\n\n if (isObject(newOption)) {\n item.keyInfo.mainType = mainType;\n item.keyInfo.subType = determineSubType(mainType, newOption, item.existing, componentModelCtor);\n }\n });\n}\n\nfunction determineSubType(mainType, newCmptOption, existComponent, componentModelCtor) {\n var subType = newCmptOption.type ? newCmptOption.type : existComponent ? existComponent.subType // Use determineSubType only when there is no existComponent.\n : componentModelCtor.determineSubType(mainType, newCmptOption); // tooltip, markline, markpoint may always has no subType\n\n return subType;\n}\n/**\n * A helper for removing duplicate items between batchA and batchB,\n * and in themselves, and categorize by series.\n *\n * @param batchA Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...]\n * @param batchB Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...]\n * @return result: [resultBatchA, resultBatchB]\n */\n\n\nexport function compressBatches(batchA, batchB) {\n var mapA = {};\n var mapB = {};\n makeMap(batchA || [], mapA);\n makeMap(batchB || [], mapB, mapA);\n return [mapToArray(mapA), mapToArray(mapB)];\n\n function makeMap(sourceBatch, map, otherMap) {\n for (var i = 0, len = sourceBatch.length; i < len; i++) {\n var seriesId = convertOptionIdName(sourceBatch[i].seriesId, null);\n\n if (seriesId == null) {\n return;\n }\n\n var dataIndices = normalizeToArray(sourceBatch[i].dataIndex);\n var otherDataIndices = otherMap && otherMap[seriesId];\n\n for (var j = 0, lenj = dataIndices.length; j < lenj; j++) {\n var dataIndex = dataIndices[j];\n\n if (otherDataIndices && otherDataIndices[dataIndex]) {\n otherDataIndices[dataIndex] = null;\n } else {\n (map[seriesId] || (map[seriesId] = {}))[dataIndex] = 1;\n }\n }\n }\n }\n\n function mapToArray(map, isData) {\n var result = [];\n\n for (var i in map) {\n if (map.hasOwnProperty(i) && map[i] != null) {\n if (isData) {\n result.push(+i);\n } else {\n var dataIndices = mapToArray(map[i], true);\n dataIndices.length && result.push({\n seriesId: i,\n dataIndex: dataIndices\n });\n }\n }\n }\n\n return result;\n }\n}\n/**\n * @param payload Contains dataIndex (means rawIndex) / dataIndexInside / name\n * each of which can be Array or primary type.\n * @return dataIndex If not found, return undefined/null.\n */\n\nexport function queryDataIndex(data, payload) {\n if (payload.dataIndexInside != null) {\n return payload.dataIndexInside;\n } else if (payload.dataIndex != null) {\n return isArray(payload.dataIndex) ? map(payload.dataIndex, function (value) {\n return data.indexOfRawIndex(value);\n }) : data.indexOfRawIndex(payload.dataIndex);\n } else if (payload.name != null) {\n return isArray(payload.name) ? map(payload.name, function (value) {\n return data.indexOfName(value);\n }) : data.indexOfName(payload.name);\n }\n}\n/**\n * Enable property storage to any host object.\n * Notice: Serialization is not supported.\n *\n * For example:\n * let inner = zrUitl.makeInner();\n *\n * function some1(hostObj) {\n * inner(hostObj).someProperty = 1212;\n * ...\n * }\n * function some2() {\n * let fields = inner(this);\n * fields.someProperty1 = 1212;\n * fields.someProperty2 = 'xx';\n * ...\n * }\n *\n * @return {Function}\n */\n\nexport function makeInner() {\n var key = '__ec_inner_' + innerUniqueIndex++;\n return function (hostObj) {\n return hostObj[key] || (hostObj[key] = {});\n };\n}\nvar innerUniqueIndex = getRandomIdBase();\n/**\n * The same behavior as `component.getReferringComponents`.\n */\n\nexport function parseFinder(ecModel, finderInput, opt) {\n var _a = preParseFinder(finderInput, opt),\n mainTypeSpecified = _a.mainTypeSpecified,\n queryOptionMap = _a.queryOptionMap,\n others = _a.others;\n\n var result = others;\n var defaultMainType = opt ? opt.defaultMainType : null;\n\n if (!mainTypeSpecified && defaultMainType) {\n queryOptionMap.set(defaultMainType, {});\n }\n\n queryOptionMap.each(function (queryOption, mainType) {\n var queryResult = queryReferringComponents(ecModel, mainType, queryOption, {\n useDefault: defaultMainType === mainType,\n enableAll: opt && opt.enableAll != null ? opt.enableAll : true,\n enableNone: opt && opt.enableNone != null ? opt.enableNone : true\n });\n result[mainType + 'Models'] = queryResult.models;\n result[mainType + 'Model'] = queryResult.models[0];\n });\n return result;\n}\nexport function preParseFinder(finderInput, opt) {\n var finder;\n\n if (isString(finderInput)) {\n var obj = {};\n obj[finderInput + 'Index'] = 0;\n finder = obj;\n } else {\n finder = finderInput;\n }\n\n var queryOptionMap = createHashMap();\n var others = {};\n var mainTypeSpecified = false;\n each(finder, function (value, key) {\n // Exclude 'dataIndex' and other illgal keys.\n if (key === 'dataIndex' || key === 'dataIndexInside') {\n others[key] = value;\n return;\n }\n\n var parsedKey = key.match(/^(\\w+)(Index|Id|Name)$/) || [];\n var mainType = parsedKey[1];\n var queryType = (parsedKey[2] || '').toLowerCase();\n\n if (!mainType || !queryType || opt && opt.includeMainTypes && indexOf(opt.includeMainTypes, mainType) < 0) {\n return;\n }\n\n mainTypeSpecified = mainTypeSpecified || !!mainType;\n var queryOption = queryOptionMap.get(mainType) || queryOptionMap.set(mainType, {});\n queryOption[queryType] = value;\n });\n return {\n mainTypeSpecified: mainTypeSpecified,\n queryOptionMap: queryOptionMap,\n others: others\n };\n}\nexport var SINGLE_REFERRING = {\n useDefault: true,\n enableAll: false,\n enableNone: false\n};\nexport var MULTIPLE_REFERRING = {\n useDefault: false,\n enableAll: true,\n enableNone: true\n};\nexport function queryReferringComponents(ecModel, mainType, userOption, opt) {\n opt = opt || SINGLE_REFERRING;\n var indexOption = userOption.index;\n var idOption = userOption.id;\n var nameOption = userOption.name;\n var result = {\n models: null,\n specified: indexOption != null || idOption != null || nameOption != null\n };\n\n if (!result.specified) {\n // Use the first as default if `useDefault`.\n var firstCmpt = void 0;\n result.models = opt.useDefault && (firstCmpt = ecModel.getComponent(mainType)) ? [firstCmpt] : [];\n return result;\n }\n\n if (indexOption === 'none' || indexOption === false) {\n assert(opt.enableNone, '`\"none\"` or `false` is not a valid value on index option.');\n result.models = [];\n return result;\n } // `queryComponents` will return all components if\n // both all of index/id/name are null/undefined.\n\n\n if (indexOption === 'all') {\n assert(opt.enableAll, '`\"all\"` is not a valid value on index option.');\n indexOption = idOption = nameOption = null;\n }\n\n result.models = ecModel.queryComponents({\n mainType: mainType,\n index: indexOption,\n id: idOption,\n name: nameOption\n });\n return result;\n}\nexport function setAttribute(dom, key, value) {\n dom.setAttribute ? dom.setAttribute(key, value) : dom[key] = value;\n}\nexport function getAttribute(dom, key) {\n return dom.getAttribute ? dom.getAttribute(key) : dom[key];\n}\nexport function getTooltipRenderMode(renderModeOption) {\n if (renderModeOption === 'auto') {\n // Using html when `document` exists, use richText otherwise\n return env.domSupported ? 'html' : 'richText';\n } else {\n return renderModeOption || 'html';\n }\n}\n/**\n * Group a list by key.\n */\n\nexport function groupData(array, getKey // return key\n) {\n var buckets = createHashMap();\n var keys = [];\n each(array, function (item) {\n var key = getKey(item);\n (buckets.get(key) || (keys.push(key), buckets.set(key, []))).push(item);\n });\n return {\n keys: keys,\n buckets: buckets\n };\n}\n/**\n * Interpolate raw values of a series with percent\n *\n * @param data data\n * @param labelModel label model of the text element\n * @param sourceValue start value. May be null/undefined when init.\n * @param targetValue end value\n * @param percent 0~1 percentage; 0 uses start value while 1 uses end value\n * @return interpolated values\n * If `sourceValue` and `targetValue` are `number`, return `number`.\n * If `sourceValue` and `targetValue` are `string`, return `string`.\n * If `sourceValue` and `targetValue` are `(string | number)[]`, return `(string | number)[]`.\n * Other cases do not supported.\n */\n\nexport function interpolateRawValues(data, precision, sourceValue, targetValue, percent) {\n var isAutoPrecision = precision == null || precision === 'auto';\n\n if (targetValue == null) {\n return targetValue;\n }\n\n if (typeof targetValue === 'number') {\n var value = interpolateNumber(sourceValue || 0, targetValue, percent);\n return round(value, isAutoPrecision ? Math.max(getPrecision(sourceValue || 0), getPrecision(targetValue)) : precision);\n } else if (typeof targetValue === 'string') {\n return percent < 1 ? sourceValue : targetValue;\n } else {\n var interpolated = [];\n var leftArr = sourceValue;\n var rightArr = targetValue;\n var length_1 = Math.max(leftArr ? leftArr.length : 0, rightArr.length);\n\n for (var i = 0; i < length_1; ++i) {\n var info = data.getDimensionInfo(i); // Don't interpolate ordinal dims\n\n if (info.type === 'ordinal') {\n // In init, there is no `sourceValue`, but should better not to get undefined result.\n interpolated[i] = (percent < 1 && leftArr ? leftArr : rightArr)[i];\n } else {\n var leftVal = leftArr && leftArr[i] ? leftArr[i] : 0;\n var rightVal = rightArr[i];\n var value = interpolateNumber(leftVal, rightVal, percent);\n interpolated[i] = round(value, isAutoPrecision ? Math.max(getPrecision(leftVal), getPrecision(rightVal)) : precision);\n }\n }\n\n return interpolated;\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { makeInner } from './model';\nexport var getECData = makeInner();","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport LRU from 'zrender/lib/core/LRU';\nimport { extend, indexOf, isArrayLike, isObject, keys, isArray, each } from 'zrender/lib/core/util';\nimport { getECData } from './innerStore';\nimport * as colorTool from 'zrender/lib/tool/color';\nimport { queryDataIndex, makeInner } from './model';\nimport Path from 'zrender/lib/graphic/Path';\nimport { error } from './log'; // Reserve 0 as default.\n\nvar _highlightNextDigit = 1;\nvar _highlightKeyMap = {};\nvar getSavedStates = makeInner();\nexport var HOVER_STATE_NORMAL = 0;\nexport var HOVER_STATE_BLUR = 1;\nexport var HOVER_STATE_EMPHASIS = 2;\nexport var SPECIAL_STATES = ['emphasis', 'blur', 'select'];\nexport var DISPLAY_STATES = ['normal', 'emphasis', 'blur', 'select'];\nexport var Z2_EMPHASIS_LIFT = 10;\nexport var Z2_SELECT_LIFT = 9;\nexport var HIGHLIGHT_ACTION_TYPE = 'highlight';\nexport var DOWNPLAY_ACTION_TYPE = 'downplay';\nexport var SELECT_ACTION_TYPE = 'select';\nexport var UNSELECT_ACTION_TYPE = 'unselect';\nexport var TOGGLE_SELECT_ACTION_TYPE = 'toggleSelect';\n\nfunction hasFillOrStroke(fillOrStroke) {\n return fillOrStroke != null && fillOrStroke !== 'none';\n} // Most lifted color are duplicated.\n\n\nvar liftedColorCache = new LRU(100);\n\nfunction liftColor(color) {\n if (typeof color !== 'string') {\n return color;\n }\n\n var liftedColor = liftedColorCache.get(color);\n\n if (!liftedColor) {\n liftedColor = colorTool.lift(color, -0.1);\n liftedColorCache.put(color, liftedColor);\n }\n\n return liftedColor;\n}\n\nfunction doChangeHoverState(el, stateName, hoverStateEnum) {\n if (el.onHoverStateChange && (el.hoverState || 0) !== hoverStateEnum) {\n el.onHoverStateChange(stateName);\n }\n\n el.hoverState = hoverStateEnum;\n}\n\nfunction singleEnterEmphasis(el) {\n // Only mark the flag.\n // States will be applied in the echarts.ts in next frame.\n doChangeHoverState(el, 'emphasis', HOVER_STATE_EMPHASIS);\n}\n\nfunction singleLeaveEmphasis(el) {\n // Only mark the flag.\n // States will be applied in the echarts.ts in next frame.\n if (el.hoverState === HOVER_STATE_EMPHASIS) {\n doChangeHoverState(el, 'normal', HOVER_STATE_NORMAL);\n }\n}\n\nfunction singleEnterBlur(el) {\n doChangeHoverState(el, 'blur', HOVER_STATE_BLUR);\n}\n\nfunction singleLeaveBlur(el) {\n if (el.hoverState === HOVER_STATE_BLUR) {\n doChangeHoverState(el, 'normal', HOVER_STATE_NORMAL);\n }\n}\n\nfunction singleEnterSelect(el) {\n el.selected = true;\n}\n\nfunction singleLeaveSelect(el) {\n el.selected = false;\n}\n\nfunction updateElementState(el, updater, commonParam) {\n updater(el, commonParam);\n}\n\nfunction traverseUpdateState(el, updater, commonParam) {\n updateElementState(el, updater, commonParam);\n el.isGroup && el.traverse(function (child) {\n updateElementState(child, updater, commonParam);\n });\n}\n\nexport function setStatesFlag(el, stateName) {\n switch (stateName) {\n case 'emphasis':\n el.hoverState = HOVER_STATE_EMPHASIS;\n break;\n\n case 'normal':\n el.hoverState = HOVER_STATE_NORMAL;\n break;\n\n case 'blur':\n el.hoverState = HOVER_STATE_BLUR;\n break;\n\n case 'select':\n el.selected = true;\n }\n}\n/**\n * If we reuse elements when rerender.\n * DONT forget to clearStates before we update the style and shape.\n * Or we may update on the wrong state instead of normal state.\n */\n\nexport function clearStates(el) {\n if (el.isGroup) {\n el.traverse(function (child) {\n child.clearStates();\n });\n } else {\n el.clearStates();\n }\n}\n\nfunction getFromStateStyle(el, props, toStateName, defaultValue) {\n var style = el.style;\n var fromState = {};\n\n for (var i = 0; i < props.length; i++) {\n var propName = props[i];\n var val = style[propName];\n fromState[propName] = val == null ? defaultValue && defaultValue[propName] : val;\n }\n\n for (var i = 0; i < el.animators.length; i++) {\n var animator = el.animators[i];\n\n if (animator.__fromStateTransition // Dont consider the animation to emphasis state.\n && animator.__fromStateTransition.indexOf(toStateName) < 0 && animator.targetName === 'style') {\n animator.saveFinalToTarget(fromState, props);\n }\n }\n\n return fromState;\n}\n\nfunction createEmphasisDefaultState(el, stateName, targetStates, state) {\n var hasSelect = targetStates && indexOf(targetStates, 'select') >= 0;\n var cloned = false;\n\n if (el instanceof Path) {\n var store = getSavedStates(el);\n var fromFill = hasSelect ? store.selectFill || store.normalFill : store.normalFill;\n var fromStroke = hasSelect ? store.selectStroke || store.normalStroke : store.normalStroke;\n\n if (hasFillOrStroke(fromFill) || hasFillOrStroke(fromStroke)) {\n state = state || {}; // Apply default color lift\n\n var emphasisStyle = state.style || {};\n\n if (!hasFillOrStroke(emphasisStyle.fill) && hasFillOrStroke(fromFill)) {\n cloned = true; // Not modify the original value.\n\n state = extend({}, state);\n emphasisStyle = extend({}, emphasisStyle); // Already being applied 'emphasis'. DON'T lift color multiple times.\n\n emphasisStyle.fill = liftColor(fromFill);\n } // Not highlight stroke if fill has been highlighted.\n else if (!hasFillOrStroke(emphasisStyle.stroke) && hasFillOrStroke(fromStroke)) {\n if (!cloned) {\n state = extend({}, state);\n emphasisStyle = extend({}, emphasisStyle);\n }\n\n emphasisStyle.stroke = liftColor(fromStroke);\n }\n\n state.style = emphasisStyle;\n }\n }\n\n if (state) {\n // TODO Share with textContent?\n if (state.z2 == null) {\n if (!cloned) {\n state = extend({}, state);\n }\n\n var z2EmphasisLift = el.z2EmphasisLift;\n state.z2 = el.z2 + (z2EmphasisLift != null ? z2EmphasisLift : Z2_EMPHASIS_LIFT);\n }\n }\n\n return state;\n}\n\nfunction createSelectDefaultState(el, stateName, state) {\n // const hasSelect = indexOf(el.currentStates, stateName) >= 0;\n if (state) {\n // TODO Share with textContent?\n if (state.z2 == null) {\n state = extend({}, state);\n var z2SelectLift = el.z2SelectLift;\n state.z2 = el.z2 + (z2SelectLift != null ? z2SelectLift : Z2_SELECT_LIFT);\n }\n }\n\n return state;\n}\n\nfunction createBlurDefaultState(el, stateName, state) {\n var hasBlur = indexOf(el.currentStates, stateName) >= 0;\n var currentOpacity = el.style.opacity;\n var fromState = !hasBlur ? getFromStateStyle(el, ['opacity'], stateName, {\n opacity: 1\n }) : null;\n state = state || {};\n var blurStyle = state.style || {};\n\n if (blurStyle.opacity == null) {\n // clone state\n state = extend({}, state);\n blurStyle = extend({\n // Already being applied 'emphasis'. DON'T mul opacity multiple times.\n opacity: hasBlur ? currentOpacity : fromState.opacity * 0.1\n }, blurStyle);\n state.style = blurStyle;\n }\n\n return state;\n}\n\nfunction elementStateProxy(stateName, targetStates) {\n var state = this.states[stateName];\n\n if (this.style) {\n if (stateName === 'emphasis') {\n return createEmphasisDefaultState(this, stateName, targetStates, state);\n } else if (stateName === 'blur') {\n return createBlurDefaultState(this, stateName, state);\n } else if (stateName === 'select') {\n return createSelectDefaultState(this, stateName, state);\n }\n }\n\n return state;\n}\n/**FI\n * Set hover style (namely \"emphasis style\") of element.\n * @param el Should not be `zrender/graphic/Group`.\n * @param focus 'self' | 'selfInSeries' | 'series'\n */\n\n\nexport function setDefaultStateProxy(el) {\n el.stateProxy = elementStateProxy;\n var textContent = el.getTextContent();\n var textGuide = el.getTextGuideLine();\n\n if (textContent) {\n textContent.stateProxy = elementStateProxy;\n }\n\n if (textGuide) {\n textGuide.stateProxy = elementStateProxy;\n }\n}\nexport function enterEmphasisWhenMouseOver(el, e) {\n !shouldSilent(el, e) // \"emphasis\" event highlight has higher priority than mouse highlight.\n && !el.__highByOuter && traverseUpdateState(el, singleEnterEmphasis);\n}\nexport function leaveEmphasisWhenMouseOut(el, e) {\n !shouldSilent(el, e) // \"emphasis\" event highlight has higher priority than mouse highlight.\n && !el.__highByOuter && traverseUpdateState(el, singleLeaveEmphasis);\n}\nexport function enterEmphasis(el, highlightDigit) {\n el.__highByOuter |= 1 << (highlightDigit || 0);\n traverseUpdateState(el, singleEnterEmphasis);\n}\nexport function leaveEmphasis(el, highlightDigit) {\n !(el.__highByOuter &= ~(1 << (highlightDigit || 0))) && traverseUpdateState(el, singleLeaveEmphasis);\n}\nexport function enterBlur(el) {\n traverseUpdateState(el, singleEnterBlur);\n}\nexport function leaveBlur(el) {\n traverseUpdateState(el, singleLeaveBlur);\n}\nexport function enterSelect(el) {\n traverseUpdateState(el, singleEnterSelect);\n}\nexport function leaveSelect(el) {\n traverseUpdateState(el, singleLeaveSelect);\n}\n\nfunction shouldSilent(el, e) {\n return el.__highDownSilentOnTouch && e.zrByTouch;\n}\n\nexport function allLeaveBlur(api) {\n var model = api.getModel();\n model.eachComponent(function (componentType, componentModel) {\n var view = componentType === 'series' ? api.getViewOfSeriesModel(componentModel) : api.getViewOfComponentModel(componentModel); // Leave blur anyway\n\n view.group.traverse(function (child) {\n singleLeaveBlur(child);\n });\n });\n}\nexport function blurSeries(targetSeriesIndex, focus, blurScope, api) {\n var ecModel = api.getModel();\n blurScope = blurScope || 'coordinateSystem';\n\n function leaveBlurOfIndices(data, dataIndices) {\n for (var i = 0; i < dataIndices.length; i++) {\n var itemEl = data.getItemGraphicEl(dataIndices[i]);\n itemEl && leaveBlur(itemEl);\n }\n }\n\n if (targetSeriesIndex == null) {\n return;\n }\n\n if (!focus || focus === 'none') {\n return;\n }\n\n var targetSeriesModel = ecModel.getSeriesByIndex(targetSeriesIndex);\n var targetCoordSys = targetSeriesModel.coordinateSystem;\n\n if (targetCoordSys && targetCoordSys.master) {\n targetCoordSys = targetCoordSys.master;\n }\n\n var blurredSeries = [];\n ecModel.eachSeries(function (seriesModel) {\n var sameSeries = targetSeriesModel === seriesModel;\n var coordSys = seriesModel.coordinateSystem;\n\n if (coordSys && coordSys.master) {\n coordSys = coordSys.master;\n }\n\n var sameCoordSys = coordSys && targetCoordSys ? coordSys === targetCoordSys : sameSeries; // If there is no coordinate system. use sameSeries instead.\n\n if (!( // Not blur other series if blurScope series\n blurScope === 'series' && !sameSeries // Not blur other coordinate system if blurScope is coordinateSystem\n || blurScope === 'coordinateSystem' && !sameCoordSys // Not blur self series if focus is series.\n || focus === 'series' && sameSeries // TODO blurScope: coordinate system\n )) {\n var view = api.getViewOfSeriesModel(seriesModel);\n view.group.traverse(function (child) {\n singleEnterBlur(child);\n });\n\n if (isArrayLike(focus)) {\n leaveBlurOfIndices(seriesModel.getData(), focus);\n } else if (isObject(focus)) {\n var dataTypes = keys(focus);\n\n for (var d = 0; d < dataTypes.length; d++) {\n leaveBlurOfIndices(seriesModel.getData(dataTypes[d]), focus[dataTypes[d]]);\n }\n }\n\n blurredSeries.push(seriesModel);\n }\n });\n ecModel.eachComponent(function (componentType, componentModel) {\n if (componentType === 'series') {\n return;\n }\n\n var view = api.getViewOfComponentModel(componentModel);\n\n if (view && view.blurSeries) {\n view.blurSeries(blurredSeries, ecModel);\n }\n });\n}\nexport function blurComponent(componentMainType, componentIndex, api) {\n if (componentMainType == null || componentIndex == null) {\n return;\n }\n\n var componentModel = api.getModel().getComponent(componentMainType, componentIndex);\n\n if (!componentModel) {\n return;\n }\n\n var view = api.getViewOfComponentModel(componentModel);\n\n if (!view || !view.focusBlurEnabled) {\n return;\n }\n\n view.group.traverse(function (child) {\n singleEnterBlur(child);\n });\n}\nexport function blurSeriesFromHighlightPayload(seriesModel, payload, api) {\n var seriesIndex = seriesModel.seriesIndex;\n var data = seriesModel.getData(payload.dataType);\n var dataIndex = queryDataIndex(data, payload); // Pick the first one if there is multiple/none exists.\n\n dataIndex = (isArray(dataIndex) ? dataIndex[0] : dataIndex) || 0;\n var el = data.getItemGraphicEl(dataIndex);\n\n if (!el) {\n var count = data.count();\n var current = 0; // If data on dataIndex is NaN.\n\n while (!el && current < count) {\n el = data.getItemGraphicEl(current++);\n }\n }\n\n if (el) {\n var ecData = getECData(el);\n blurSeries(seriesIndex, ecData.focus, ecData.blurScope, api);\n } else {\n // If there is no element put on the data. Try getting it from raw option\n // TODO Should put it on seriesModel?\n var focus_1 = seriesModel.get(['emphasis', 'focus']);\n var blurScope = seriesModel.get(['emphasis', 'blurScope']);\n\n if (focus_1 != null) {\n blurSeries(seriesIndex, focus_1, blurScope, api);\n }\n }\n}\nexport function findComponentHighDownDispatchers(componentMainType, componentIndex, name, api) {\n var ret = {\n focusSelf: false,\n dispatchers: null\n };\n\n if (componentMainType == null || componentMainType === 'series' || componentIndex == null || name == null) {\n return ret;\n }\n\n var componentModel = api.getModel().getComponent(componentMainType, componentIndex);\n\n if (!componentModel) {\n return ret;\n }\n\n var view = api.getViewOfComponentModel(componentModel);\n\n if (!view || !view.findHighDownDispatchers) {\n return ret;\n }\n\n var dispatchers = view.findHighDownDispatchers(name); // At presnet, the component (like Geo) only blur inside itself.\n // So we do not use `blurScope` in component.\n\n var focusSelf;\n\n for (var i = 0; i < dispatchers.length; i++) {\n if (process.env.NODE_ENV !== 'production' && !isHighDownDispatcher(dispatchers[i])) {\n error('param should be highDownDispatcher');\n }\n\n if (getECData(dispatchers[i]).focus === 'self') {\n focusSelf = true;\n break;\n }\n }\n\n return {\n focusSelf: focusSelf,\n dispatchers: dispatchers\n };\n}\nexport function handleGlobalMouseOverForHighDown(dispatcher, e, api) {\n if (process.env.NODE_ENV !== 'production' && !isHighDownDispatcher(dispatcher)) {\n error('param should be highDownDispatcher');\n }\n\n var ecData = getECData(dispatcher);\n\n var _a = findComponentHighDownDispatchers(ecData.componentMainType, ecData.componentIndex, ecData.componentHighDownName, api),\n dispatchers = _a.dispatchers,\n focusSelf = _a.focusSelf; // If `findHighDownDispatchers` is supported on the component,\n // highlight/downplay elements with the same name.\n\n\n if (dispatchers) {\n if (focusSelf) {\n blurComponent(ecData.componentMainType, ecData.componentIndex, api);\n }\n\n each(dispatchers, function (dispatcher) {\n return enterEmphasisWhenMouseOver(dispatcher, e);\n });\n } else {\n // Try blur all in the related series. Then emphasis the hoverred.\n // TODO. progressive mode.\n blurSeries(ecData.seriesIndex, ecData.focus, ecData.blurScope, api);\n\n if (ecData.focus === 'self') {\n blurComponent(ecData.componentMainType, ecData.componentIndex, api);\n } // Other than series, component that not support `findHighDownDispatcher` will\n // also use it. But in this case, highlight/downplay are only supported in\n // mouse hover but not in dispatchAction.\n\n\n enterEmphasisWhenMouseOver(dispatcher, e);\n }\n}\nexport function handleGlboalMouseOutForHighDown(dispatcher, e, api) {\n if (process.env.NODE_ENV !== 'production' && !isHighDownDispatcher(dispatcher)) {\n error('param should be highDownDispatcher');\n }\n\n allLeaveBlur(api);\n var ecData = getECData(dispatcher);\n var dispatchers = findComponentHighDownDispatchers(ecData.componentMainType, ecData.componentIndex, ecData.componentHighDownName, api).dispatchers;\n\n if (dispatchers) {\n each(dispatchers, function (dispatcher) {\n return leaveEmphasisWhenMouseOut(dispatcher, e);\n });\n } else {\n leaveEmphasisWhenMouseOut(dispatcher, e);\n }\n}\nexport function toggleSelectionFromPayload(seriesModel, payload, api) {\n if (!isSelectChangePayload(payload)) {\n return;\n }\n\n var dataType = payload.dataType;\n var data = seriesModel.getData(dataType);\n var dataIndex = queryDataIndex(data, payload);\n\n if (!isArray(dataIndex)) {\n dataIndex = [dataIndex];\n }\n\n seriesModel[payload.type === TOGGLE_SELECT_ACTION_TYPE ? 'toggleSelect' : payload.type === SELECT_ACTION_TYPE ? 'select' : 'unselect'](dataIndex, dataType);\n}\nexport function updateSeriesElementSelection(seriesModel) {\n var allData = seriesModel.getAllData();\n each(allData, function (_a) {\n var data = _a.data,\n type = _a.type;\n data.eachItemGraphicEl(function (el, idx) {\n seriesModel.isSelected(idx, type) ? enterSelect(el) : leaveSelect(el);\n });\n });\n}\nexport function getAllSelectedIndices(ecModel) {\n var ret = [];\n ecModel.eachSeries(function (seriesModel) {\n var allData = seriesModel.getAllData();\n each(allData, function (_a) {\n var data = _a.data,\n type = _a.type;\n var dataIndices = seriesModel.getSelectedDataIndices();\n\n if (dataIndices.length > 0) {\n var item = {\n dataIndex: dataIndices,\n seriesIndex: seriesModel.seriesIndex\n };\n\n if (type != null) {\n item.dataType = type;\n }\n\n ret.push(item);\n }\n });\n });\n return ret;\n}\n/**\n * Enable the function that mouseover will trigger the emphasis state.\n *\n * NOTE:\n * This function should be used on the element with dataIndex, seriesIndex.\n *\n */\n\nexport function enableHoverEmphasis(el, focus, blurScope) {\n setAsHighDownDispatcher(el, true);\n traverseUpdateState(el, setDefaultStateProxy);\n enableHoverFocus(el, focus, blurScope);\n}\nexport function enableHoverFocus(el, focus, blurScope) {\n var ecData = getECData(el);\n\n if (focus != null) {\n // TODO dataIndex may be set after this function. This check is not useful.\n // if (ecData.dataIndex == null) {\n // if (__DEV__) {\n // console.warn('focus can only been set on element with dataIndex');\n // }\n // }\n // else {\n ecData.focus = focus;\n ecData.blurScope = blurScope; // }\n } else if (ecData.focus) {\n ecData.focus = null;\n }\n}\nvar OTHER_STATES = ['emphasis', 'blur', 'select'];\nvar defaultStyleGetterMap = {\n itemStyle: 'getItemStyle',\n lineStyle: 'getLineStyle',\n areaStyle: 'getAreaStyle'\n};\n/**\n * Set emphasis/blur/selected states of element.\n */\n\nexport function setStatesStylesFromModel(el, itemModel, styleType, // default itemStyle\ngetter) {\n styleType = styleType || 'itemStyle';\n\n for (var i = 0; i < OTHER_STATES.length; i++) {\n var stateName = OTHER_STATES[i];\n var model = itemModel.getModel([stateName, styleType]);\n var state = el.ensureState(stateName); // Let it throw error if getterType is not found.\n\n state.style = getter ? getter(model) : model[defaultStyleGetterMap[styleType]]();\n }\n}\n/**\n * @parame el\n * @param el.highDownSilentOnTouch\n * In touch device, mouseover event will be trigger on touchstart event\n * (see module:zrender/dom/HandlerProxy). By this mechanism, we can\n * conveniently use hoverStyle when tap on touch screen without additional\n * code for compatibility.\n * But if the chart/component has select feature, which usually also use\n * hoverStyle, there might be conflict between 'select-highlight' and\n * 'hover-highlight' especially when roam is enabled (see geo for example).\n * In this case, `highDownSilentOnTouch` should be used to disable\n * hover-highlight on touch device.\n * @param asDispatcher If `false`, do not set as \"highDownDispatcher\".\n */\n\nexport function setAsHighDownDispatcher(el, asDispatcher) {\n var disable = asDispatcher === false;\n var extendedEl = el; // Make `highDownSilentOnTouch` and `onStateChange` only work after\n // `setAsHighDownDispatcher` called. Avoid it is modified by user unexpectedly.\n\n if (el.highDownSilentOnTouch) {\n extendedEl.__highDownSilentOnTouch = el.highDownSilentOnTouch;\n } // Simple optimize, since this method might be\n // called for each elements of a group in some cases.\n\n\n if (!disable || extendedEl.__highDownDispatcher) {\n // Emphasis, normal can be triggered manually by API or other components like hover link.\n // el[method]('emphasis', onElementEmphasisEvent)[method]('normal', onElementNormalEvent);\n // Also keep previous record.\n extendedEl.__highByOuter = extendedEl.__highByOuter || 0;\n extendedEl.__highDownDispatcher = !disable;\n }\n}\nexport function isHighDownDispatcher(el) {\n return !!(el && el.__highDownDispatcher);\n}\n/**\n * Enable component highlight/downplay features:\n * + hover link (within the same name)\n * + focus blur in component\n */\n\nexport function enableComponentHighDownFeatures(el, componentModel, componentHighDownName) {\n var ecData = getECData(el);\n ecData.componentMainType = componentModel.mainType;\n ecData.componentIndex = componentModel.componentIndex;\n ecData.componentHighDownName = componentHighDownName;\n}\n/**\n * Support hightlight/downplay record on each elements.\n * For the case: hover highlight/downplay (legend, visualMap, ...) and\n * user triggerred hightlight/downplay should not conflict.\n * Only all of the highlightDigit cleared, return to normal.\n * @param {string} highlightKey\n * @return {number} highlightDigit\n */\n\nexport function getHighlightDigit(highlightKey) {\n var highlightDigit = _highlightKeyMap[highlightKey];\n\n if (highlightDigit == null && _highlightNextDigit <= 32) {\n highlightDigit = _highlightKeyMap[highlightKey] = _highlightNextDigit++;\n }\n\n return highlightDigit;\n}\nexport function isSelectChangePayload(payload) {\n var payloadType = payload.type;\n return payloadType === SELECT_ACTION_TYPE || payloadType === UNSELECT_ACTION_TYPE || payloadType === TOGGLE_SELECT_ACTION_TYPE;\n}\nexport function isHighDownPayload(payload) {\n var payloadType = payload.type;\n return payloadType === HIGHLIGHT_ACTION_TYPE || payloadType === DOWNPLAY_ACTION_TYPE;\n}\nexport function savePathStates(el) {\n var store = getSavedStates(el);\n store.normalFill = el.style.fill;\n store.normalStroke = el.style.stroke;\n var selectState = el.states.select || {};\n store.selectFill = selectState.style && selectState.style.fill || null;\n store.selectStroke = selectState.style && selectState.style.stroke || null;\n}","import PathProxy from '../core/PathProxy';\nimport { applyTransform as v2ApplyTransform } from '../core/vector';\nvar CMD = PathProxy.CMD;\nvar points = [[], [], []];\nvar mathSqrt = Math.sqrt;\nvar mathAtan2 = Math.atan2;\nexport default function transformPath(path, m) {\n var data = path.data;\n var len = path.len();\n var cmd;\n var nPoint;\n var i;\n var j;\n var k;\n var p;\n var M = CMD.M;\n var C = CMD.C;\n var L = CMD.L;\n var R = CMD.R;\n var A = CMD.A;\n var Q = CMD.Q;\n for (i = 0, j = 0; i < len;) {\n cmd = data[i++];\n j = i;\n nPoint = 0;\n switch (cmd) {\n case M:\n nPoint = 1;\n break;\n case L:\n nPoint = 1;\n break;\n case C:\n nPoint = 3;\n break;\n case Q:\n nPoint = 2;\n break;\n case A:\n var x = m[4];\n var y = m[5];\n var sx = mathSqrt(m[0] * m[0] + m[1] * m[1]);\n var sy = mathSqrt(m[2] * m[2] + m[3] * m[3]);\n var angle = mathAtan2(-m[1] / sy, m[0] / sx);\n data[i] *= sx;\n data[i++] += x;\n data[i] *= sy;\n data[i++] += y;\n data[i++] *= sx;\n data[i++] *= sy;\n data[i++] += angle;\n data[i++] += angle;\n i += 2;\n j = i;\n break;\n case R:\n p[0] = data[i++];\n p[1] = data[i++];\n v2ApplyTransform(p, p, m);\n data[j++] = p[0];\n data[j++] = p[1];\n p[0] += data[i++];\n p[1] += data[i++];\n v2ApplyTransform(p, p, m);\n data[j++] = p[0];\n data[j++] = p[1];\n }\n for (k = 0; k < nPoint; k++) {\n var p_1 = points[k];\n p_1[0] = data[i++];\n p_1[1] = data[i++];\n v2ApplyTransform(p_1, p_1, m);\n data[j++] = p_1[0];\n data[j++] = p_1[1];\n }\n }\n path.increaseVersion();\n}\n","import { __extends } from \"tslib\";\nimport Path from '../graphic/Path';\nimport PathProxy from '../core/PathProxy';\nimport transformPath from './transformPath';\nimport { extend } from '../core/util';\nvar mathSqrt = Math.sqrt;\nvar mathSin = Math.sin;\nvar mathCos = Math.cos;\nvar PI = Math.PI;\nfunction vMag(v) {\n return Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n}\n;\nfunction vRatio(u, v) {\n return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));\n}\n;\nfunction vAngle(u, v) {\n return (u[0] * v[1] < u[1] * v[0] ? -1 : 1)\n * Math.acos(vRatio(u, v));\n}\n;\nfunction processArc(x1, y1, x2, y2, fa, fs, rx, ry, psiDeg, cmd, path) {\n var psi = psiDeg * (PI / 180.0);\n var xp = mathCos(psi) * (x1 - x2) / 2.0\n + mathSin(psi) * (y1 - y2) / 2.0;\n var yp = -1 * mathSin(psi) * (x1 - x2) / 2.0\n + mathCos(psi) * (y1 - y2) / 2.0;\n var lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);\n if (lambda > 1) {\n rx *= mathSqrt(lambda);\n ry *= mathSqrt(lambda);\n }\n var f = (fa === fs ? -1 : 1)\n * mathSqrt((((rx * rx) * (ry * ry))\n - ((rx * rx) * (yp * yp))\n - ((ry * ry) * (xp * xp))) / ((rx * rx) * (yp * yp)\n + (ry * ry) * (xp * xp))) || 0;\n var cxp = f * rx * yp / ry;\n var cyp = f * -ry * xp / rx;\n var cx = (x1 + x2) / 2.0\n + mathCos(psi) * cxp\n - mathSin(psi) * cyp;\n var cy = (y1 + y2) / 2.0\n + mathSin(psi) * cxp\n + mathCos(psi) * cyp;\n var theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);\n var u = [(xp - cxp) / rx, (yp - cyp) / ry];\n var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];\n var dTheta = vAngle(u, v);\n if (vRatio(u, v) <= -1) {\n dTheta = PI;\n }\n if (vRatio(u, v) >= 1) {\n dTheta = 0;\n }\n if (dTheta < 0) {\n var n = Math.round(dTheta / PI * 1e6) / 1e6;\n dTheta = PI * 2 + (n % 2) * PI;\n }\n path.addData(cmd, cx, cy, rx, ry, theta, dTheta, psi, fs);\n}\nvar commandReg = /([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig;\nvar numberReg = /-?([0-9]*\\.)?[0-9]+([eE]-?[0-9]+)?/g;\nfunction createPathProxyFromString(data) {\n var path = new PathProxy();\n if (!data) {\n return path;\n }\n var cpx = 0;\n var cpy = 0;\n var subpathX = cpx;\n var subpathY = cpy;\n var prevCmd;\n var CMD = PathProxy.CMD;\n var cmdList = data.match(commandReg);\n if (!cmdList) {\n return path;\n }\n for (var l = 0; l < cmdList.length; l++) {\n var cmdText = cmdList[l];\n var cmdStr = cmdText.charAt(0);\n var cmd = void 0;\n var p = cmdText.match(numberReg) || [];\n var pLen = p.length;\n for (var i = 0; i < pLen; i++) {\n p[i] = parseFloat(p[i]);\n }\n var off = 0;\n while (off < pLen) {\n var ctlPtx = void 0;\n var ctlPty = void 0;\n var rx = void 0;\n var ry = void 0;\n var psi = void 0;\n var fa = void 0;\n var fs = void 0;\n var x1 = cpx;\n var y1 = cpy;\n var len = void 0;\n var pathData = void 0;\n switch (cmdStr) {\n case 'l':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'L':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'm':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'l';\n break;\n case 'M':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'L';\n break;\n case 'h':\n cpx += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'H':\n cpx = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'v':\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'V':\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'C':\n cmd = CMD.C;\n path.addData(cmd, p[off++], p[off++], p[off++], p[off++], p[off++], p[off++]);\n cpx = p[off - 2];\n cpy = p[off - 1];\n break;\n case 'c':\n cmd = CMD.C;\n path.addData(cmd, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy, p[off++] + cpx, p[off++] + cpy);\n cpx += p[off - 2];\n cpy += p[off - 1];\n break;\n case 'S':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 's':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = cpx + p[off++];\n y1 = cpy + p[off++];\n cpx += p[off++];\n cpy += p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 'Q':\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'q':\n x1 = p[off++] + cpx;\n y1 = p[off++] + cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'T':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 't':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 'A':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n x1 = cpx, y1 = cpy;\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.A;\n processArc(x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path);\n break;\n case 'a':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n x1 = cpx, y1 = cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.A;\n processArc(x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path);\n break;\n }\n }\n if (cmdStr === 'z' || cmdStr === 'Z') {\n cmd = CMD.Z;\n path.addData(cmd);\n cpx = subpathX;\n cpy = subpathY;\n }\n prevCmd = cmd;\n }\n path.toStatic();\n return path;\n}\nvar SVGPath = (function (_super) {\n __extends(SVGPath, _super);\n function SVGPath() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SVGPath.prototype.applyTransform = function (m) { };\n return SVGPath;\n}(Path));\nfunction isPathProxy(path) {\n return path.setData != null;\n}\nfunction createPathOptions(str, opts) {\n var pathProxy = createPathProxyFromString(str);\n var innerOpts = extend({}, opts);\n innerOpts.buildPath = function (path) {\n if (isPathProxy(path)) {\n path.setData(pathProxy.data);\n var ctx = path.getContext();\n if (ctx) {\n path.rebuildPath(ctx, 1);\n }\n }\n else {\n var ctx = path;\n pathProxy.rebuildPath(ctx, 1);\n }\n };\n innerOpts.applyTransform = function (m) {\n transformPath(pathProxy, m);\n this.dirtyShape();\n };\n return innerOpts;\n}\nexport function createFromString(str, opts) {\n return new SVGPath(createPathOptions(str, opts));\n}\nexport function extendFromString(str, defaultOpts) {\n var innerOpts = createPathOptions(str, defaultOpts);\n var Sub = (function (_super) {\n __extends(Sub, _super);\n function Sub(opts) {\n var _this = _super.call(this, opts) || this;\n _this.applyTransform = innerOpts.applyTransform;\n _this.buildPath = innerOpts.buildPath;\n return _this;\n }\n return Sub;\n }(SVGPath));\n return Sub;\n}\nexport function mergePath(pathEls, opts) {\n var pathList = [];\n var len = pathEls.length;\n for (var i = 0; i < len; i++) {\n var pathEl = pathEls[i];\n if (!pathEl.path) {\n pathEl.createPathProxy();\n }\n if (pathEl.shapeChanged()) {\n pathEl.buildPath(pathEl.path, pathEl.shape, true);\n }\n pathList.push(pathEl.path);\n }\n var pathBundle = new Path(opts);\n pathBundle.createPathProxy();\n pathBundle.buildPath = function (path) {\n if (isPathProxy(path)) {\n path.appendPath(pathList);\n var ctx = path.getContext();\n if (ctx) {\n path.rebuildPath(ctx, 1);\n }\n }\n };\n return pathBundle;\n}\n","import { __extends } from \"tslib\";\nimport * as zrUtil from '../core/util';\nimport Element from '../Element';\nimport BoundingRect from '../core/BoundingRect';\nvar Group = (function (_super) {\n __extends(Group, _super);\n function Group(opts) {\n var _this = _super.call(this) || this;\n _this.isGroup = true;\n _this._children = [];\n _this.attr(opts);\n return _this;\n }\n Group.prototype.childrenRef = function () {\n return this._children;\n };\n Group.prototype.children = function () {\n return this._children.slice();\n };\n Group.prototype.childAt = function (idx) {\n return this._children[idx];\n };\n Group.prototype.childOfName = function (name) {\n var children = this._children;\n for (var i = 0; i < children.length; i++) {\n if (children[i].name === name) {\n return children[i];\n }\n }\n };\n Group.prototype.childCount = function () {\n return this._children.length;\n };\n Group.prototype.add = function (child) {\n if (child) {\n if (child !== this && child.parent !== this) {\n this._children.push(child);\n this._doAdd(child);\n }\n if (child.__hostTarget) {\n throw 'This elemenet has been used as an attachment';\n }\n }\n return this;\n };\n Group.prototype.addBefore = function (child, nextSibling) {\n if (child && child !== this && child.parent !== this\n && nextSibling && nextSibling.parent === this) {\n var children = this._children;\n var idx = children.indexOf(nextSibling);\n if (idx >= 0) {\n children.splice(idx, 0, child);\n this._doAdd(child);\n }\n }\n return this;\n };\n Group.prototype.replaceAt = function (child, index) {\n var children = this._children;\n var old = children[index];\n if (child && child !== this && child.parent !== this && child !== old) {\n children[index] = child;\n old.parent = null;\n var zr = this.__zr;\n if (zr) {\n old.removeSelfFromZr(zr);\n }\n this._doAdd(child);\n }\n return this;\n };\n Group.prototype._doAdd = function (child) {\n if (child.parent) {\n child.parent.remove(child);\n }\n child.parent = this;\n var zr = this.__zr;\n if (zr && zr !== child.__zr) {\n child.addSelfToZr(zr);\n }\n zr && zr.refresh();\n };\n Group.prototype.remove = function (child) {\n var zr = this.__zr;\n var children = this._children;\n var idx = zrUtil.indexOf(children, child);\n if (idx < 0) {\n return this;\n }\n children.splice(idx, 1);\n child.parent = null;\n if (zr) {\n child.removeSelfFromZr(zr);\n }\n zr && zr.refresh();\n return this;\n };\n Group.prototype.removeAll = function () {\n var children = this._children;\n var zr = this.__zr;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (zr) {\n child.removeSelfFromZr(zr);\n }\n child.parent = null;\n }\n children.length = 0;\n return this;\n };\n Group.prototype.eachChild = function (cb, context) {\n var children = this._children;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n cb.call(context, child, i);\n }\n return this;\n };\n Group.prototype.traverse = function (cb, context) {\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n var stopped = cb.call(context, child);\n if (child.isGroup && !stopped) {\n child.traverse(cb, context);\n }\n }\n return this;\n };\n Group.prototype.addSelfToZr = function (zr) {\n _super.prototype.addSelfToZr.call(this, zr);\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n child.addSelfToZr(zr);\n }\n };\n Group.prototype.removeSelfFromZr = function (zr) {\n _super.prototype.removeSelfFromZr.call(this, zr);\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n child.removeSelfFromZr(zr);\n }\n };\n Group.prototype.getBoundingRect = function (includeChildren) {\n var tmpRect = new BoundingRect(0, 0, 0, 0);\n var children = includeChildren || this._children;\n var tmpMat = [];\n var rect = null;\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (child.ignore || child.invisible) {\n continue;\n }\n var childRect = child.getBoundingRect();\n var transform = child.getLocalTransform(tmpMat);\n if (transform) {\n BoundingRect.applyTransform(tmpRect, childRect, transform);\n rect = rect || tmpRect.clone();\n rect.union(tmpRect);\n }\n else {\n rect = rect || childRect.clone();\n rect.union(childRect);\n }\n }\n return rect || tmpRect;\n };\n return Group;\n}(Element));\nGroup.prototype.type = 'group';\nexport default Group;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nvar CircleShape = (function () {\n function CircleShape() {\n this.cx = 0;\n this.cy = 0;\n this.r = 0;\n }\n return CircleShape;\n}());\nexport { CircleShape };\nvar Circle = (function (_super) {\n __extends(Circle, _super);\n function Circle(opts) {\n return _super.call(this, opts) || this;\n }\n Circle.prototype.getDefaultShape = function () {\n return new CircleShape();\n };\n Circle.prototype.buildPath = function (ctx, shape, inBundle) {\n if (inBundle) {\n ctx.moveTo(shape.cx + shape.r, shape.cy);\n }\n ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2);\n };\n return Circle;\n}(Path));\n;\nCircle.prototype.type = 'circle';\nexport default Circle;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nvar EllipseShape = (function () {\n function EllipseShape() {\n this.cx = 0;\n this.cy = 0;\n this.rx = 0;\n this.ry = 0;\n }\n return EllipseShape;\n}());\nexport { EllipseShape };\nvar Ellipse = (function (_super) {\n __extends(Ellipse, _super);\n function Ellipse(opts) {\n return _super.call(this, opts) || this;\n }\n Ellipse.prototype.getDefaultShape = function () {\n return new EllipseShape();\n };\n Ellipse.prototype.buildPath = function (ctx, shape) {\n var k = 0.5522848;\n var x = shape.cx;\n var y = shape.cy;\n var a = shape.rx;\n var b = shape.ry;\n var ox = a * k;\n var oy = b * k;\n ctx.moveTo(x - a, y);\n ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);\n ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);\n ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);\n ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);\n ctx.closePath();\n };\n return Ellipse;\n}(Path));\nEllipse.prototype.type = 'ellipse';\nexport default Ellipse;\n","import { normalizeArcAngles } from '../../core/PathProxy';\nvar PI = Math.PI;\nvar PI2 = PI * 2;\nvar mathSin = Math.sin;\nvar mathCos = Math.cos;\nvar mathACos = Math.acos;\nvar mathATan2 = Math.atan2;\nvar mathAbs = Math.abs;\nvar mathSqrt = Math.sqrt;\nvar mathMax = Math.max;\nvar mathMin = Math.min;\nvar e = 1e-4;\nfunction intersect(x0, y0, x1, y1, x2, y2, x3, y3) {\n var x10 = x1 - x0;\n var y10 = y1 - y0;\n var x32 = x3 - x2;\n var y32 = y3 - y2;\n var t = y32 * x10 - x32 * y10;\n if (t * t < e) {\n return;\n }\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;\n return [x0 + t * x10, y0 + t * y10];\n}\nfunction computeCornerTangents(x0, y0, x1, y1, radius, cr, clockwise) {\n var x01 = x0 - x1;\n var y01 = y0 - y1;\n var lo = (clockwise ? cr : -cr) / mathSqrt(x01 * x01 + y01 * y01);\n var ox = lo * y01;\n var oy = -lo * x01;\n var x11 = x0 + ox;\n var y11 = y0 + oy;\n var x10 = x1 + ox;\n var y10 = y1 + oy;\n var x00 = (x11 + x10) / 2;\n var y00 = (y11 + y10) / 2;\n var dx = x10 - x11;\n var dy = y10 - y11;\n var d2 = dx * dx + dy * dy;\n var r = radius - cr;\n var s = x11 * y10 - x10 * y11;\n var d = (dy < 0 ? -1 : 1) * mathSqrt(mathMax(0, r * r * d2 - s * s));\n var cx0 = (s * dy - dx * d) / d2;\n var cy0 = (-s * dx - dy * d) / d2;\n var cx1 = (s * dy + dx * d) / d2;\n var cy1 = (-s * dx + dy * d) / d2;\n var dx0 = cx0 - x00;\n var dy0 = cy0 - y00;\n var dx1 = cx1 - x00;\n var dy1 = cy1 - y00;\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {\n cx0 = cx1;\n cy0 = cy1;\n }\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (radius / r - 1),\n y11: cy0 * (radius / r - 1)\n };\n}\nexport function buildPath(ctx, shape) {\n var radius = mathMax(shape.r, 0);\n var innerRadius = mathMax(shape.r0 || 0, 0);\n var hasRadius = radius > 0;\n var hasInnerRadius = innerRadius > 0;\n if (!hasRadius && !hasInnerRadius) {\n return;\n }\n if (!hasRadius) {\n radius = innerRadius;\n innerRadius = 0;\n }\n if (innerRadius > radius) {\n var tmp = radius;\n radius = innerRadius;\n innerRadius = tmp;\n }\n var clockwise = !!shape.clockwise;\n var startAngle = shape.startAngle;\n var endAngle = shape.endAngle;\n var arc;\n if (startAngle === endAngle) {\n arc = 0;\n }\n else {\n var tmpAngles = [startAngle, endAngle];\n normalizeArcAngles(tmpAngles, !clockwise);\n arc = mathAbs(tmpAngles[0] - tmpAngles[1]);\n }\n var x = shape.cx;\n var y = shape.cy;\n var cornerRadius = shape.cornerRadius || 0;\n var innerCornerRadius = shape.innerCornerRadius || 0;\n if (!(radius > e)) {\n ctx.moveTo(x, y);\n }\n else if (arc > PI2 - e) {\n ctx.moveTo(x + radius * mathCos(startAngle), y + radius * mathSin(startAngle));\n ctx.arc(x, y, radius, startAngle, endAngle, !clockwise);\n if (innerRadius > e) {\n ctx.moveTo(x + innerRadius * mathCos(endAngle), y + innerRadius * mathSin(endAngle));\n ctx.arc(x, y, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n else {\n var halfRd = mathAbs(radius - innerRadius) / 2;\n var cr = mathMin(halfRd, cornerRadius);\n var icr = mathMin(halfRd, innerCornerRadius);\n var cr0 = icr;\n var cr1 = cr;\n var xrs = radius * mathCos(startAngle);\n var yrs = radius * mathSin(startAngle);\n var xire = innerRadius * mathCos(endAngle);\n var yire = innerRadius * mathSin(endAngle);\n var xre = void 0;\n var yre = void 0;\n var xirs = void 0;\n var yirs = void 0;\n if (cr > e || icr > e) {\n xre = radius * mathCos(endAngle);\n yre = radius * mathSin(endAngle);\n xirs = innerRadius * mathCos(startAngle);\n yirs = innerRadius * mathSin(startAngle);\n if (arc < PI) {\n var it_1 = intersect(xrs, yrs, xirs, yirs, xre, yre, xire, yire);\n if (it_1) {\n var x0 = xrs - it_1[0];\n var y0 = yrs - it_1[1];\n var x1 = xre - it_1[0];\n var y1 = yre - it_1[1];\n var a = 1 / mathSin(mathACos((x0 * x1 + y0 * y1) / (mathSqrt(x0 * x0 + y0 * y0) * mathSqrt(x1 * x1 + y1 * y1))) / 2);\n var b = mathSqrt(it_1[0] * it_1[0] + it_1[1] * it_1[1]);\n cr0 = mathMin(icr, (innerRadius - b) / (a - 1));\n cr1 = mathMin(cr, (radius - b) / (a + 1));\n }\n }\n }\n if (!(arc > e)) {\n ctx.moveTo(x + xrs, y + yrs);\n }\n else if (cr1 > e) {\n var ct0 = computeCornerTangents(xirs, yirs, xrs, yrs, radius, cr1, clockwise);\n var ct1 = computeCornerTangents(xre, yre, xire, yire, radius, cr1, clockwise);\n ctx.moveTo(x + ct0.cx + ct0.x01, y + ct0.cy + ct0.y01);\n if (cr1 < cr) {\n ctx.arc(x + ct0.cx, y + ct0.cy, cr1, mathATan2(ct0.y01, ct0.x01), mathATan2(ct1.y01, ct1.x01), !clockwise);\n }\n else {\n ctx.arc(x + ct0.cx, y + ct0.cy, cr1, mathATan2(ct0.y01, ct0.x01), mathATan2(ct0.y11, ct0.x11), !clockwise);\n ctx.arc(x, y, radius, mathATan2(ct0.cy + ct0.y11, ct0.cx + ct0.x11), mathATan2(ct1.cy + ct1.y11, ct1.cx + ct1.x11), !clockwise);\n ctx.arc(x + ct1.cx, y + ct1.cy, cr1, mathATan2(ct1.y11, ct1.x11), mathATan2(ct1.y01, ct1.x01), !clockwise);\n }\n }\n else {\n ctx.moveTo(x + xrs, y + yrs);\n ctx.arc(x, y, radius, startAngle, endAngle, !clockwise);\n }\n if (!(innerRadius > e) || !(arc > e)) {\n ctx.lineTo(x + xire, y + yire);\n }\n else if (cr0 > e) {\n var ct0 = computeCornerTangents(xire, yire, xre, yre, innerRadius, -cr0, clockwise);\n var ct1 = computeCornerTangents(xrs, yrs, xirs, yirs, innerRadius, -cr0, clockwise);\n ctx.lineTo(x + ct0.cx + ct0.x01, y + ct0.cy + ct0.y01);\n if (cr0 < icr) {\n ctx.arc(x + ct0.cx, y + ct0.cy, cr0, mathATan2(ct0.y01, ct0.x01), mathATan2(ct1.y01, ct1.x01), !clockwise);\n }\n else {\n ctx.arc(x + ct0.cx, y + ct0.cy, cr0, mathATan2(ct0.y01, ct0.x01), mathATan2(ct0.y11, ct0.x11), !clockwise);\n ctx.arc(x, y, innerRadius, mathATan2(ct0.cy + ct0.y11, ct0.cx + ct0.x11), mathATan2(ct1.cy + ct1.y11, ct1.cx + ct1.x11), clockwise);\n ctx.arc(x + ct1.cx, y + ct1.cy, cr0, mathATan2(ct1.y11, ct1.x11), mathATan2(ct1.y01, ct1.x01), !clockwise);\n }\n }\n else {\n ctx.lineTo(x + xire, y + yire);\n ctx.arc(x, y, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n ctx.closePath();\n}\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as roundSectorHelper from '../helper/roundSector';\nvar SectorShape = (function () {\n function SectorShape() {\n this.cx = 0;\n this.cy = 0;\n this.r0 = 0;\n this.r = 0;\n this.startAngle = 0;\n this.endAngle = Math.PI * 2;\n this.clockwise = true;\n this.cornerRadius = 0;\n this.innerCornerRadius = 0;\n }\n return SectorShape;\n}());\nexport { SectorShape };\nvar Sector = (function (_super) {\n __extends(Sector, _super);\n function Sector(opts) {\n return _super.call(this, opts) || this;\n }\n Sector.prototype.getDefaultShape = function () {\n return new SectorShape();\n };\n Sector.prototype.buildPath = function (ctx, shape) {\n roundSectorHelper.buildPath(ctx, shape);\n };\n Sector.prototype.isZeroArea = function () {\n return this.shape.startAngle === this.shape.endAngle\n || this.shape.r === this.shape.r0;\n };\n return Sector;\n}(Path));\nSector.prototype.type = 'sector';\nexport default Sector;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nvar RingShape = (function () {\n function RingShape() {\n this.cx = 0;\n this.cy = 0;\n this.r = 0;\n this.r0 = 0;\n }\n return RingShape;\n}());\nexport { RingShape };\nvar Ring = (function (_super) {\n __extends(Ring, _super);\n function Ring(opts) {\n return _super.call(this, opts) || this;\n }\n Ring.prototype.getDefaultShape = function () {\n return new RingShape();\n };\n Ring.prototype.buildPath = function (ctx, shape) {\n var x = shape.cx;\n var y = shape.cy;\n var PI2 = Math.PI * 2;\n ctx.moveTo(x + shape.r, y);\n ctx.arc(x, y, shape.r, 0, PI2, false);\n ctx.moveTo(x + shape.r0, y);\n ctx.arc(x, y, shape.r0, 0, PI2, true);\n };\n return Ring;\n}(Path));\nRing.prototype.type = 'ring';\nexport default Ring;\n","import { distance as v2Distance } from '../../core/vector';\nfunction interpolate(p0, p1, p2, p3, t, t2, t3) {\n var v0 = (p2 - p0) * 0.5;\n var v1 = (p3 - p1) * 0.5;\n return (2 * (p1 - p2) + v0 + v1) * t3\n + (-3 * (p1 - p2) - 2 * v0 - v1) * t2\n + v0 * t + p1;\n}\nexport default function smoothSpline(points, isLoop) {\n var len = points.length;\n var ret = [];\n var distance = 0;\n for (var i = 1; i < len; i++) {\n distance += v2Distance(points[i - 1], points[i]);\n }\n var segs = distance / 2;\n segs = segs < len ? len : segs;\n for (var i = 0; i < segs; i++) {\n var pos = i / (segs - 1) * (isLoop ? len : len - 1);\n var idx = Math.floor(pos);\n var w = pos - idx;\n var p0 = void 0;\n var p1 = points[idx % len];\n var p2 = void 0;\n var p3 = void 0;\n if (!isLoop) {\n p0 = points[idx === 0 ? idx : idx - 1];\n p2 = points[idx > len - 2 ? len - 1 : idx + 1];\n p3 = points[idx > len - 3 ? len - 1 : idx + 2];\n }\n else {\n p0 = points[(idx - 1 + len) % len];\n p2 = points[(idx + 1) % len];\n p3 = points[(idx + 2) % len];\n }\n var w2 = w * w;\n var w3 = w * w2;\n ret.push([\n interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),\n interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)\n ]);\n }\n return ret;\n}\n","import { min as v2Min, max as v2Max, scale as v2Scale, distance as v2Distance, add as v2Add, clone as v2Clone, sub as v2Sub } from '../../core/vector';\nexport default function smoothBezier(points, smooth, isLoop, constraint) {\n var cps = [];\n var v = [];\n var v1 = [];\n var v2 = [];\n var prevPoint;\n var nextPoint;\n var min;\n var max;\n if (constraint) {\n min = [Infinity, Infinity];\n max = [-Infinity, -Infinity];\n for (var i = 0, len = points.length; i < len; i++) {\n v2Min(min, min, points[i]);\n v2Max(max, max, points[i]);\n }\n v2Min(min, min, constraint[0]);\n v2Max(max, max, constraint[1]);\n }\n for (var i = 0, len = points.length; i < len; i++) {\n var point = points[i];\n if (isLoop) {\n prevPoint = points[i ? i - 1 : len - 1];\n nextPoint = points[(i + 1) % len];\n }\n else {\n if (i === 0 || i === len - 1) {\n cps.push(v2Clone(points[i]));\n continue;\n }\n else {\n prevPoint = points[i - 1];\n nextPoint = points[i + 1];\n }\n }\n v2Sub(v, nextPoint, prevPoint);\n v2Scale(v, v, smooth);\n var d0 = v2Distance(point, prevPoint);\n var d1 = v2Distance(point, nextPoint);\n var sum = d0 + d1;\n if (sum !== 0) {\n d0 /= sum;\n d1 /= sum;\n }\n v2Scale(v1, v, -d0);\n v2Scale(v2, v, d1);\n var cp0 = v2Add([], point, v1);\n var cp1 = v2Add([], point, v2);\n if (constraint) {\n v2Max(cp0, cp0, min);\n v2Min(cp0, cp0, max);\n v2Max(cp1, cp1, min);\n v2Min(cp1, cp1, max);\n }\n cps.push(cp0);\n cps.push(cp1);\n }\n if (isLoop) {\n cps.push(cps.shift());\n }\n return cps;\n}\n","import smoothSpline from './smoothSpline';\nimport smoothBezier from './smoothBezier';\nexport function buildPath(ctx, shape, closePath) {\n var smooth = shape.smooth;\n var points = shape.points;\n if (points && points.length >= 2) {\n if (smooth && smooth !== 'spline') {\n var controlPoints = smoothBezier(points, smooth, closePath, shape.smoothConstraint);\n ctx.moveTo(points[0][0], points[0][1]);\n var len = points.length;\n for (var i = 0; i < (closePath ? len : len - 1); i++) {\n var cp1 = controlPoints[i * 2];\n var cp2 = controlPoints[i * 2 + 1];\n var p = points[(i + 1) % len];\n ctx.bezierCurveTo(cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]);\n }\n }\n else {\n if (smooth === 'spline') {\n points = smoothSpline(points, closePath);\n }\n ctx.moveTo(points[0][0], points[0][1]);\n for (var i = 1, l = points.length; i < l; i++) {\n ctx.lineTo(points[i][0], points[i][1]);\n }\n }\n closePath && ctx.closePath();\n }\n}\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as polyHelper from '../helper/poly';\nvar PolygonShape = (function () {\n function PolygonShape() {\n this.points = null;\n this.smooth = 0;\n this.smoothConstraint = null;\n }\n return PolygonShape;\n}());\nexport { PolygonShape };\nvar Polygon = (function (_super) {\n __extends(Polygon, _super);\n function Polygon(opts) {\n return _super.call(this, opts) || this;\n }\n Polygon.prototype.getDefaultShape = function () {\n return new PolygonShape();\n };\n Polygon.prototype.buildPath = function (ctx, shape) {\n polyHelper.buildPath(ctx, shape, true);\n };\n return Polygon;\n}(Path));\n;\nPolygon.prototype.type = 'polygon';\nexport default Polygon;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as polyHelper from '../helper/poly';\nvar PolylineShape = (function () {\n function PolylineShape() {\n this.points = null;\n this.percent = 1;\n this.smooth = 0;\n this.smoothConstraint = null;\n }\n return PolylineShape;\n}());\nexport { PolylineShape };\nvar Polyline = (function (_super) {\n __extends(Polyline, _super);\n function Polyline(opts) {\n return _super.call(this, opts) || this;\n }\n Polyline.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n Polyline.prototype.getDefaultShape = function () {\n return new PolylineShape();\n };\n Polyline.prototype.buildPath = function (ctx, shape) {\n polyHelper.buildPath(ctx, shape, false);\n };\n return Polyline;\n}(Path));\nPolyline.prototype.type = 'polyline';\nexport default Polyline;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport { subPixelOptimizeLine } from '../helper/subPixelOptimize';\nvar subPixelOptimizeOutputShape = {};\nvar LineShape = (function () {\n function LineShape() {\n this.x1 = 0;\n this.y1 = 0;\n this.x2 = 0;\n this.y2 = 0;\n this.percent = 1;\n }\n return LineShape;\n}());\nexport { LineShape };\nvar Line = (function (_super) {\n __extends(Line, _super);\n function Line(opts) {\n return _super.call(this, opts) || this;\n }\n Line.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n Line.prototype.getDefaultShape = function () {\n return new LineShape();\n };\n Line.prototype.buildPath = function (ctx, shape) {\n var x1;\n var y1;\n var x2;\n var y2;\n if (this.subPixelOptimize) {\n var optimizedShape = subPixelOptimizeLine(subPixelOptimizeOutputShape, shape, this.style);\n x1 = optimizedShape.x1;\n y1 = optimizedShape.y1;\n x2 = optimizedShape.x2;\n y2 = optimizedShape.y2;\n }\n else {\n x1 = shape.x1;\n y1 = shape.y1;\n x2 = shape.x2;\n y2 = shape.y2;\n }\n var percent = shape.percent;\n if (percent === 0) {\n return;\n }\n ctx.moveTo(x1, y1);\n if (percent < 1) {\n x2 = x1 * (1 - percent) + x2 * percent;\n y2 = y1 * (1 - percent) + y2 * percent;\n }\n ctx.lineTo(x2, y2);\n };\n Line.prototype.pointAt = function (p) {\n var shape = this.shape;\n return [\n shape.x1 * (1 - p) + shape.x2 * p,\n shape.y1 * (1 - p) + shape.y2 * p\n ];\n };\n return Line;\n}(Path));\nLine.prototype.type = 'line';\nexport default Line;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nimport * as vec2 from '../../core/vector';\nimport { quadraticSubdivide, cubicSubdivide, quadraticAt, cubicAt, quadraticDerivativeAt, cubicDerivativeAt } from '../../core/curve';\nvar out = [];\nvar BezierCurveShape = (function () {\n function BezierCurveShape() {\n this.x1 = 0;\n this.y1 = 0;\n this.x2 = 0;\n this.y2 = 0;\n this.cpx1 = 0;\n this.cpy1 = 0;\n this.percent = 1;\n }\n return BezierCurveShape;\n}());\nexport { BezierCurveShape };\nfunction someVectorAt(shape, t, isTangent) {\n var cpx2 = shape.cpx2;\n var cpy2 = shape.cpy2;\n if (cpx2 === null || cpy2 === null) {\n return [\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.x1, shape.cpx1, shape.cpx2, shape.x2, t),\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.y1, shape.cpy1, shape.cpy2, shape.y2, t)\n ];\n }\n else {\n return [\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.x1, shape.cpx1, shape.x2, t),\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.y1, shape.cpy1, shape.y2, t)\n ];\n }\n}\nvar BezierCurve = (function (_super) {\n __extends(BezierCurve, _super);\n function BezierCurve(opts) {\n return _super.call(this, opts) || this;\n }\n BezierCurve.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n BezierCurve.prototype.getDefaultShape = function () {\n return new BezierCurveShape();\n };\n BezierCurve.prototype.buildPath = function (ctx, shape) {\n var x1 = shape.x1;\n var y1 = shape.y1;\n var x2 = shape.x2;\n var y2 = shape.y2;\n var cpx1 = shape.cpx1;\n var cpy1 = shape.cpy1;\n var cpx2 = shape.cpx2;\n var cpy2 = shape.cpy2;\n var percent = shape.percent;\n if (percent === 0) {\n return;\n }\n ctx.moveTo(x1, y1);\n if (cpx2 == null || cpy2 == null) {\n if (percent < 1) {\n quadraticSubdivide(x1, cpx1, x2, percent, out);\n cpx1 = out[1];\n x2 = out[2];\n quadraticSubdivide(y1, cpy1, y2, percent, out);\n cpy1 = out[1];\n y2 = out[2];\n }\n ctx.quadraticCurveTo(cpx1, cpy1, x2, y2);\n }\n else {\n if (percent < 1) {\n cubicSubdivide(x1, cpx1, cpx2, x2, percent, out);\n cpx1 = out[1];\n cpx2 = out[2];\n x2 = out[3];\n cubicSubdivide(y1, cpy1, cpy2, y2, percent, out);\n cpy1 = out[1];\n cpy2 = out[2];\n y2 = out[3];\n }\n ctx.bezierCurveTo(cpx1, cpy1, cpx2, cpy2, x2, y2);\n }\n };\n BezierCurve.prototype.pointAt = function (t) {\n return someVectorAt(this.shape, t, false);\n };\n BezierCurve.prototype.tangentAt = function (t) {\n var p = someVectorAt(this.shape, t, true);\n return vec2.normalize(p, p);\n };\n return BezierCurve;\n}(Path));\n;\nBezierCurve.prototype.type = 'bezier-curve';\nexport default BezierCurve;\n","import { __extends } from \"tslib\";\nimport Path from '../Path';\nvar ArcShape = (function () {\n function ArcShape() {\n this.cx = 0;\n this.cy = 0;\n this.r = 0;\n this.startAngle = 0;\n this.endAngle = Math.PI * 2;\n this.clockwise = true;\n }\n return ArcShape;\n}());\nexport { ArcShape };\nvar Arc = (function (_super) {\n __extends(Arc, _super);\n function Arc(opts) {\n return _super.call(this, opts) || this;\n }\n Arc.prototype.getDefaultStyle = function () {\n return {\n stroke: '#000',\n fill: null\n };\n };\n Arc.prototype.getDefaultShape = function () {\n return new ArcShape();\n };\n Arc.prototype.buildPath = function (ctx, shape) {\n var x = shape.cx;\n var y = shape.cy;\n var r = Math.max(shape.r, 0);\n var startAngle = shape.startAngle;\n var endAngle = shape.endAngle;\n var clockwise = shape.clockwise;\n var unitX = Math.cos(startAngle);\n var unitY = Math.sin(startAngle);\n ctx.moveTo(unitX * r + x, unitY * r + y);\n ctx.arc(x, y, r, startAngle, endAngle, !clockwise);\n };\n return Arc;\n}(Path));\nArc.prototype.type = 'arc';\nexport default Arc;\n","import { __extends } from \"tslib\";\nimport Path from './Path';\nvar CompoundPath = (function (_super) {\n __extends(CompoundPath, _super);\n function CompoundPath() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.type = 'compound';\n return _this;\n }\n CompoundPath.prototype._updatePathDirty = function () {\n var paths = this.shape.paths;\n var dirtyPath = this.shapeChanged();\n for (var i = 0; i < paths.length; i++) {\n dirtyPath = dirtyPath || paths[i].shapeChanged();\n }\n if (dirtyPath) {\n this.dirtyShape();\n }\n };\n CompoundPath.prototype.beforeBrush = function () {\n this._updatePathDirty();\n var paths = this.shape.paths || [];\n var scale = this.getGlobalScale();\n for (var i = 0; i < paths.length; i++) {\n if (!paths[i].path) {\n paths[i].createPathProxy();\n }\n paths[i].path.setScale(scale[0], scale[1], paths[i].segmentIgnoreThreshold);\n }\n };\n CompoundPath.prototype.buildPath = function (ctx, shape) {\n var paths = shape.paths || [];\n for (var i = 0; i < paths.length; i++) {\n paths[i].buildPath(ctx, paths[i].shape, true);\n }\n };\n CompoundPath.prototype.afterBrush = function () {\n var paths = this.shape.paths || [];\n for (var i = 0; i < paths.length; i++) {\n paths[i].pathUpdated();\n }\n };\n CompoundPath.prototype.getBoundingRect = function () {\n this._updatePathDirty.call(this);\n return Path.prototype.getBoundingRect.call(this);\n };\n return CompoundPath;\n}(Path));\nexport default CompoundPath;\n","var Gradient = (function () {\n function Gradient(colorStops) {\n this.colorStops = colorStops || [];\n }\n Gradient.prototype.addColorStop = function (offset, color) {\n this.colorStops.push({\n offset: offset,\n color: color\n });\n };\n return Gradient;\n}());\nexport default Gradient;\n","import { __extends } from \"tslib\";\nimport Gradient from './Gradient';\nvar LinearGradient = (function (_super) {\n __extends(LinearGradient, _super);\n function LinearGradient(x, y, x2, y2, colorStops, globalCoord) {\n var _this = _super.call(this, colorStops) || this;\n _this.x = x == null ? 0 : x;\n _this.y = y == null ? 0 : y;\n _this.x2 = x2 == null ? 1 : x2;\n _this.y2 = y2 == null ? 0 : y2;\n _this.type = 'linear';\n _this.global = globalCoord || false;\n return _this;\n }\n return LinearGradient;\n}(Gradient));\nexport default LinearGradient;\n;\n","import { __extends } from \"tslib\";\nimport Gradient from './Gradient';\nvar RadialGradient = (function (_super) {\n __extends(RadialGradient, _super);\n function RadialGradient(x, y, r, colorStops, globalCoord) {\n var _this = _super.call(this, colorStops) || this;\n _this.x = x == null ? 0.5 : x;\n _this.y = y == null ? 0.5 : y;\n _this.r = r == null ? 0.5 : r;\n _this.type = 'radial';\n _this.global = globalCoord || false;\n return _this;\n }\n return RadialGradient;\n}(Gradient));\nexport default RadialGradient;\n","import Point from './Point';\nvar extent = [0, 0];\nvar extent2 = [0, 0];\nvar minTv = new Point();\nvar maxTv = new Point();\nvar OrientedBoundingRect = (function () {\n function OrientedBoundingRect(rect, transform) {\n this._corners = [];\n this._axes = [];\n this._origin = [0, 0];\n for (var i = 0; i < 4; i++) {\n this._corners[i] = new Point();\n }\n for (var i = 0; i < 2; i++) {\n this._axes[i] = new Point();\n }\n if (rect) {\n this.fromBoundingRect(rect, transform);\n }\n }\n OrientedBoundingRect.prototype.fromBoundingRect = function (rect, transform) {\n var corners = this._corners;\n var axes = this._axes;\n var x = rect.x;\n var y = rect.y;\n var x2 = x + rect.width;\n var y2 = y + rect.height;\n corners[0].set(x, y);\n corners[1].set(x2, y);\n corners[2].set(x2, y2);\n corners[3].set(x, y2);\n if (transform) {\n for (var i = 0; i < 4; i++) {\n corners[i].transform(transform);\n }\n }\n Point.sub(axes[0], corners[1], corners[0]);\n Point.sub(axes[1], corners[3], corners[0]);\n axes[0].normalize();\n axes[1].normalize();\n for (var i = 0; i < 2; i++) {\n this._origin[i] = axes[i].dot(corners[0]);\n }\n };\n OrientedBoundingRect.prototype.intersect = function (other, mtv) {\n var overlapped = true;\n var noMtv = !mtv;\n minTv.set(Infinity, Infinity);\n maxTv.set(0, 0);\n if (!this._intersectCheckOneSide(this, other, minTv, maxTv, noMtv, 1)) {\n overlapped = false;\n if (noMtv) {\n return overlapped;\n }\n }\n if (!this._intersectCheckOneSide(other, this, minTv, maxTv, noMtv, -1)) {\n overlapped = false;\n if (noMtv) {\n return overlapped;\n }\n }\n if (!noMtv) {\n Point.copy(mtv, overlapped ? minTv : maxTv);\n }\n return overlapped;\n };\n OrientedBoundingRect.prototype._intersectCheckOneSide = function (self, other, minTv, maxTv, noMtv, inverse) {\n var overlapped = true;\n for (var i = 0; i < 2; i++) {\n var axis = this._axes[i];\n this._getProjMinMaxOnAxis(i, self._corners, extent);\n this._getProjMinMaxOnAxis(i, other._corners, extent2);\n if (extent[1] < extent2[0] || extent[0] > extent2[1]) {\n overlapped = false;\n if (noMtv) {\n return overlapped;\n }\n var dist0 = Math.abs(extent2[0] - extent[1]);\n var dist1 = Math.abs(extent[0] - extent2[1]);\n if (Math.min(dist0, dist1) > maxTv.len()) {\n if (dist0 < dist1) {\n Point.scale(maxTv, axis, -dist0 * inverse);\n }\n else {\n Point.scale(maxTv, axis, dist1 * inverse);\n }\n }\n }\n else if (minTv) {\n var dist0 = Math.abs(extent2[0] - extent[1]);\n var dist1 = Math.abs(extent[0] - extent2[1]);\n if (Math.min(dist0, dist1) < minTv.len()) {\n if (dist0 < dist1) {\n Point.scale(minTv, axis, dist0 * inverse);\n }\n else {\n Point.scale(minTv, axis, -dist1 * inverse);\n }\n }\n }\n }\n return overlapped;\n };\n OrientedBoundingRect.prototype._getProjMinMaxOnAxis = function (dim, corners, out) {\n var axis = this._axes[dim];\n var origin = this._origin;\n var proj = corners[0].dot(axis) + origin[dim];\n var min = proj;\n var max = proj;\n for (var i = 1; i < corners.length; i++) {\n var proj_1 = corners[i].dot(axis) + origin[dim];\n min = Math.min(proj_1, min);\n max = Math.max(proj_1, max);\n }\n out[0] = min;\n out[1] = max;\n };\n return OrientedBoundingRect;\n}());\nexport default OrientedBoundingRect;\n","import { __extends } from \"tslib\";\nimport Displayble from './Displayable';\nimport BoundingRect from '../core/BoundingRect';\nvar m = [];\nvar IncrementalDisplayable = (function (_super) {\n __extends(IncrementalDisplayable, _super);\n function IncrementalDisplayable() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.notClear = true;\n _this.incremental = true;\n _this._displayables = [];\n _this._temporaryDisplayables = [];\n _this._cursor = 0;\n return _this;\n }\n IncrementalDisplayable.prototype.traverse = function (cb, context) {\n cb.call(context, this);\n };\n IncrementalDisplayable.prototype.useStyle = function () {\n this.style = {};\n };\n IncrementalDisplayable.prototype.getCursor = function () {\n return this._cursor;\n };\n IncrementalDisplayable.prototype.innerAfterBrush = function () {\n this._cursor = this._displayables.length;\n };\n IncrementalDisplayable.prototype.clearDisplaybles = function () {\n this._displayables = [];\n this._temporaryDisplayables = [];\n this._cursor = 0;\n this.markRedraw();\n this.notClear = false;\n };\n IncrementalDisplayable.prototype.clearTemporalDisplayables = function () {\n this._temporaryDisplayables = [];\n };\n IncrementalDisplayable.prototype.addDisplayable = function (displayable, notPersistent) {\n if (notPersistent) {\n this._temporaryDisplayables.push(displayable);\n }\n else {\n this._displayables.push(displayable);\n }\n this.markRedraw();\n };\n IncrementalDisplayable.prototype.addDisplayables = function (displayables, notPersistent) {\n notPersistent = notPersistent || false;\n for (var i = 0; i < displayables.length; i++) {\n this.addDisplayable(displayables[i], notPersistent);\n }\n };\n IncrementalDisplayable.prototype.getDisplayables = function () {\n return this._displayables;\n };\n IncrementalDisplayable.prototype.getTemporalDisplayables = function () {\n return this._temporaryDisplayables;\n };\n IncrementalDisplayable.prototype.eachPendingDisplayable = function (cb) {\n for (var i = this._cursor; i < this._displayables.length; i++) {\n cb && cb(this._displayables[i]);\n }\n for (var i = 0; i < this._temporaryDisplayables.length; i++) {\n cb && cb(this._temporaryDisplayables[i]);\n }\n };\n IncrementalDisplayable.prototype.update = function () {\n this.updateTransform();\n for (var i = this._cursor; i < this._displayables.length; i++) {\n var displayable = this._displayables[i];\n displayable.parent = this;\n displayable.update();\n displayable.parent = null;\n }\n for (var i = 0; i < this._temporaryDisplayables.length; i++) {\n var displayable = this._temporaryDisplayables[i];\n displayable.parent = this;\n displayable.update();\n displayable.parent = null;\n }\n };\n IncrementalDisplayable.prototype.getBoundingRect = function () {\n if (!this._rect) {\n var rect = new BoundingRect(Infinity, Infinity, -Infinity, -Infinity);\n for (var i = 0; i < this._displayables.length; i++) {\n var displayable = this._displayables[i];\n var childRect = displayable.getBoundingRect().clone();\n if (displayable.needLocalTransform()) {\n childRect.applyTransform(displayable.getLocalTransform(m));\n }\n rect.union(childRect);\n }\n this._rect = rect;\n }\n return this._rect;\n };\n IncrementalDisplayable.prototype.contain = function (x, y) {\n var localPos = this.transformCoordToLocal(x, y);\n var rect = this.getBoundingRect();\n if (rect.contain(localPos[0], localPos[1])) {\n for (var i = 0; i < this._displayables.length; i++) {\n var displayable = this._displayables[i];\n if (displayable.contain(x, y)) {\n return true;\n }\n }\n }\n return false;\n };\n return IncrementalDisplayable;\n}(Displayble));\nexport default IncrementalDisplayable;\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as pathTool from 'zrender/lib/tool/path';\nimport * as matrix from 'zrender/lib/core/matrix';\nimport * as vector from 'zrender/lib/core/vector';\nimport Path from 'zrender/lib/graphic/Path';\nimport Transformable from 'zrender/lib/core/Transformable';\nimport ZRImage from 'zrender/lib/graphic/Image';\nimport Group from 'zrender/lib/graphic/Group';\nimport ZRText from 'zrender/lib/graphic/Text';\nimport Circle from 'zrender/lib/graphic/shape/Circle';\nimport Ellipse from 'zrender/lib/graphic/shape/Ellipse';\nimport Sector from 'zrender/lib/graphic/shape/Sector';\nimport Ring from 'zrender/lib/graphic/shape/Ring';\nimport Polygon from 'zrender/lib/graphic/shape/Polygon';\nimport Polyline from 'zrender/lib/graphic/shape/Polyline';\nimport Rect from 'zrender/lib/graphic/shape/Rect';\nimport Line from 'zrender/lib/graphic/shape/Line';\nimport BezierCurve from 'zrender/lib/graphic/shape/BezierCurve';\nimport Arc from 'zrender/lib/graphic/shape/Arc';\nimport CompoundPath from 'zrender/lib/graphic/CompoundPath';\nimport LinearGradient from 'zrender/lib/graphic/LinearGradient';\nimport RadialGradient from 'zrender/lib/graphic/RadialGradient';\nimport BoundingRect from 'zrender/lib/core/BoundingRect';\nimport OrientedBoundingRect from 'zrender/lib/core/OrientedBoundingRect';\nimport Point from 'zrender/lib/core/Point';\nimport IncrementalDisplayable from 'zrender/lib/graphic/IncrementalDisplayable';\nimport * as subPixelOptimizeUtil from 'zrender/lib/graphic/helper/subPixelOptimize';\nimport { extend, isArrayLike, map, defaults, isObject, retrieve2, isString, keys, each, hasOwn } from 'zrender/lib/core/util';\nimport { getECData } from './innerStore';\nvar mathMax = Math.max;\nvar mathMin = Math.min;\nvar _customShapeMap = {};\n/**\n * Extend shape with parameters\n */\n\nexport function extendShape(opts) {\n return Path.extend(opts);\n}\nvar extendPathFromString = pathTool.extendFromString;\n/**\n * Extend path\n */\n\nexport function extendPath(pathData, opts) {\n return extendPathFromString(pathData, opts);\n}\n/**\n * Register a user defined shape.\n * The shape class can be fetched by `getShapeClass`\n * This method will overwrite the registered shapes, including\n * the registered built-in shapes, if using the same `name`.\n * The shape can be used in `custom series` and\n * `graphic component` by declaring `{type: name}`.\n *\n * @param name\n * @param ShapeClass Can be generated by `extendShape`.\n */\n\nexport function registerShape(name, ShapeClass) {\n _customShapeMap[name] = ShapeClass;\n}\n/**\n * Find shape class registered by `registerShape`. Usually used in\n * fetching user defined shape.\n *\n * [Caution]:\n * (1) This method **MUST NOT be used inside echarts !!!**, unless it is prepared\n * to use user registered shapes.\n * Because the built-in shape (see `getBuiltInShape`) will be registered by\n * `registerShape` by default. That enables users to get both built-in\n * shapes as well as the shapes belonging to themsleves. But users can overwrite\n * the built-in shapes by using names like 'circle', 'rect' via calling\n * `registerShape`. So the echarts inner featrues should not fetch shapes from here\n * in case that it is overwritten by users, except that some features, like\n * `custom series`, `graphic component`, do it deliberately.\n *\n * (2) In the features like `custom series`, `graphic component`, the user input\n * `{tpye: 'xxx'}` does not only specify shapes but also specify other graphic\n * elements like `'group'`, `'text'`, `'image'` or event `'path'`. Those names\n * are reserved names, that is, if some user register a shape named `'image'`,\n * the shape will not be used. If we intending to add some more reserved names\n * in feature, that might bring break changes (disable some existing user shape\n * names). But that case probably rearly happen. So we dont make more mechanism\n * to resolve this issue here.\n *\n * @param name\n * @return The shape class. If not found, return nothing.\n */\n\nexport function getShapeClass(name) {\n if (_customShapeMap.hasOwnProperty(name)) {\n return _customShapeMap[name];\n }\n}\n/**\n * Create a path element from path data string\n * @param pathData\n * @param opts\n * @param rect\n * @param layout 'center' or 'cover' default to be cover\n */\n\nexport function makePath(pathData, opts, rect, layout) {\n var path = pathTool.createFromString(pathData, opts);\n\n if (rect) {\n if (layout === 'center') {\n rect = centerGraphic(rect, path.getBoundingRect());\n }\n\n resizePath(path, rect);\n }\n\n return path;\n}\n/**\n * Create a image element from image url\n * @param imageUrl image url\n * @param opts options\n * @param rect constrain rect\n * @param layout 'center' or 'cover'. Default to be 'cover'\n */\n\nexport function makeImage(imageUrl, rect, layout) {\n var zrImg = new ZRImage({\n style: {\n image: imageUrl,\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height\n },\n onload: function (img) {\n if (layout === 'center') {\n var boundingRect = {\n width: img.width,\n height: img.height\n };\n zrImg.setStyle(centerGraphic(rect, boundingRect));\n }\n }\n });\n return zrImg;\n}\n/**\n * Get position of centered element in bounding box.\n *\n * @param rect element local bounding box\n * @param boundingRect constraint bounding box\n * @return element position containing x, y, width, and height\n */\n\nfunction centerGraphic(rect, boundingRect) {\n // Set rect to center, keep width / height ratio.\n var aspect = boundingRect.width / boundingRect.height;\n var width = rect.height * aspect;\n var height;\n\n if (width <= rect.width) {\n height = rect.height;\n } else {\n width = rect.width;\n height = width / aspect;\n }\n\n var cx = rect.x + rect.width / 2;\n var cy = rect.y + rect.height / 2;\n return {\n x: cx - width / 2,\n y: cy - height / 2,\n width: width,\n height: height\n };\n}\n\nexport var mergePath = pathTool.mergePath;\n/**\n * Resize a path to fit the rect\n * @param path\n * @param rect\n */\n\nexport function resizePath(path, rect) {\n if (!path.applyTransform) {\n return;\n }\n\n var pathRect = path.getBoundingRect();\n var m = pathRect.calculateTransform(rect);\n path.applyTransform(m);\n}\n/**\n * Sub pixel optimize line for canvas\n */\n\nexport function subPixelOptimizeLine(param) {\n subPixelOptimizeUtil.subPixelOptimizeLine(param.shape, param.shape, param.style);\n return param;\n}\n/**\n * Sub pixel optimize rect for canvas\n */\n\nexport function subPixelOptimizeRect(param) {\n subPixelOptimizeUtil.subPixelOptimizeRect(param.shape, param.shape, param.style);\n return param;\n}\n/**\n * Sub pixel optimize for canvas\n *\n * @param position Coordinate, such as x, y\n * @param lineWidth Should be nonnegative integer.\n * @param positiveOrNegative Default false (negative).\n * @return Optimized position.\n */\n\nexport var subPixelOptimize = subPixelOptimizeUtil.subPixelOptimize;\n\nfunction animateOrSetProps(animationType, el, props, animatableModel, dataIndex, cb, during) {\n var isFrom = false;\n var removeOpt;\n\n if (typeof dataIndex === 'function') {\n during = cb;\n cb = dataIndex;\n dataIndex = null;\n } else if (isObject(dataIndex)) {\n cb = dataIndex.cb;\n during = dataIndex.during;\n isFrom = dataIndex.isFrom;\n removeOpt = dataIndex.removeOpt;\n dataIndex = dataIndex.dataIndex;\n }\n\n var isUpdate = animationType === 'update';\n var isRemove = animationType === 'remove';\n var animationPayload; // Check if there is global animation configuration from dataZoom/resize can override the config in option.\n // If animation is enabled. Will use this animation config in payload.\n // If animation is disabled. Just ignore it.\n\n if (animatableModel && animatableModel.ecModel) {\n var updatePayload = animatableModel.ecModel.getUpdatePayload();\n animationPayload = updatePayload && updatePayload.animation;\n }\n\n var animationEnabled = animatableModel && animatableModel.isAnimationEnabled();\n\n if (!isRemove) {\n // Must stop the remove animation.\n el.stopAnimation('remove');\n }\n\n if (animationEnabled) {\n var duration = void 0;\n var animationEasing = void 0;\n var animationDelay = void 0;\n\n if (animationPayload) {\n duration = animationPayload.duration || 0;\n animationEasing = animationPayload.easing || 'cubicOut';\n animationDelay = animationPayload.delay || 0;\n } else if (isRemove) {\n removeOpt = removeOpt || {};\n duration = retrieve2(removeOpt.duration, 200);\n animationEasing = retrieve2(removeOpt.easing, 'cubicOut');\n animationDelay = 0;\n } else {\n duration = animatableModel.getShallow(isUpdate ? 'animationDurationUpdate' : 'animationDuration');\n animationEasing = animatableModel.getShallow(isUpdate ? 'animationEasingUpdate' : 'animationEasing');\n animationDelay = animatableModel.getShallow(isUpdate ? 'animationDelayUpdate' : 'animationDelay');\n }\n\n if (typeof animationDelay === 'function') {\n animationDelay = animationDelay(dataIndex, animatableModel.getAnimationDelayParams ? animatableModel.getAnimationDelayParams(el, dataIndex) : null);\n }\n\n if (typeof duration === 'function') {\n duration = duration(dataIndex);\n }\n\n duration > 0 ? isFrom ? el.animateFrom(props, {\n duration: duration,\n delay: animationDelay || 0,\n easing: animationEasing,\n done: cb,\n force: !!cb || !!during,\n scope: animationType,\n during: during\n }) : el.animateTo(props, {\n duration: duration,\n delay: animationDelay || 0,\n easing: animationEasing,\n done: cb,\n force: !!cb || !!during,\n setToFinal: true,\n scope: animationType,\n during: during\n }) : ( // FIXME:\n // If `duration` is 0, only the animation on props\n // can be stoped, other animation should be continued?\n // But at present using duration 0 in `animateTo`, `animateFrom`\n // might cause unexpected behavior.\n el.stopAnimation(), // If `isFrom`, the props is the \"from\" props.\n !isFrom && el.attr(props), cb && cb());\n } else {\n el.stopAnimation();\n !isFrom && el.attr(props); // Call during once.\n\n during && during(1);\n cb && cb();\n }\n}\n/**\n * Update graphic element properties with or without animation according to the\n * configuration in series.\n *\n * Caution: this method will stop previous animation.\n * So do not use this method to one element twice before\n * animation starts, unless you know what you are doing.\n * @example\n * graphic.updateProps(el, {\n * position: [100, 100]\n * }, seriesModel, dataIndex, function () { console.log('Animation done!'); });\n * // Or\n * graphic.updateProps(el, {\n * position: [100, 100]\n * }, seriesModel, function () { console.log('Animation done!'); });\n */\n\n\nfunction updateProps(el, props, // TODO: TYPE AnimatableModel\nanimatableModel, dataIndex, cb, during) {\n animateOrSetProps('update', el, props, animatableModel, dataIndex, cb, during);\n}\n\nexport { updateProps };\n/**\n * Init graphic element properties with or without animation according to the\n * configuration in series.\n *\n * Caution: this method will stop previous animation.\n * So do not use this method to one element twice before\n * animation starts, unless you know what you are doing.\n */\n\nexport function initProps(el, props, animatableModel, dataIndex, cb, during) {\n animateOrSetProps('init', el, props, animatableModel, dataIndex, cb, during);\n}\n/**\n * Remove graphic element\n */\n\nexport function removeElement(el, props, animatableModel, dataIndex, cb, during) {\n // Don't do remove animation twice.\n if (isElementRemoved(el)) {\n return;\n }\n\n animateOrSetProps('remove', el, props, animatableModel, dataIndex, cb, during);\n}\n\nfunction fadeOutDisplayable(el, animatableModel, dataIndex, done) {\n el.removeTextContent();\n el.removeTextGuideLine();\n removeElement(el, {\n style: {\n opacity: 0\n }\n }, animatableModel, dataIndex, done);\n}\n\nexport function removeElementWithFadeOut(el, animatableModel, dataIndex) {\n function doRemove() {\n el.parent && el.parent.remove(el);\n } // Hide label and labelLine first\n // TODO Also use fade out animation?\n\n\n if (!el.isGroup) {\n fadeOutDisplayable(el, animatableModel, dataIndex, doRemove);\n } else {\n el.traverse(function (disp) {\n if (!disp.isGroup) {\n // Can invoke doRemove multiple times.\n fadeOutDisplayable(disp, animatableModel, dataIndex, doRemove);\n }\n });\n }\n}\n/**\n * If element is removed.\n * It can determine if element is having remove animation.\n */\n\nexport function isElementRemoved(el) {\n if (!el.__zr) {\n return true;\n }\n\n for (var i = 0; i < el.animators.length; i++) {\n var animator = el.animators[i];\n\n if (animator.scope === 'remove') {\n return true;\n }\n }\n\n return false;\n}\n/**\n * Get transform matrix of target (param target),\n * in coordinate of its ancestor (param ancestor)\n *\n * @param target\n * @param [ancestor]\n */\n\nexport function getTransform(target, ancestor) {\n var mat = matrix.identity([]);\n\n while (target && target !== ancestor) {\n matrix.mul(mat, target.getLocalTransform(), mat);\n target = target.parent;\n }\n\n return mat;\n}\n/**\n * Apply transform to an vertex.\n * @param target [x, y]\n * @param transform Can be:\n * + Transform matrix: like [1, 0, 0, 1, 0, 0]\n * + {position, rotation, scale}, the same as `zrender/Transformable`.\n * @param invert Whether use invert matrix.\n * @return [x, y]\n */\n\nexport function applyTransform(target, transform, invert) {\n if (transform && !isArrayLike(transform)) {\n transform = Transformable.getLocalTransform(transform);\n }\n\n if (invert) {\n transform = matrix.invert([], transform);\n }\n\n return vector.applyTransform([], target, transform);\n}\n/**\n * @param direction 'left' 'right' 'top' 'bottom'\n * @param transform Transform matrix: like [1, 0, 0, 1, 0, 0]\n * @param invert Whether use invert matrix.\n * @return Transformed direction. 'left' 'right' 'top' 'bottom'\n */\n\nexport function transformDirection(direction, transform, invert) {\n // Pick a base, ensure that transform result will not be (0, 0).\n var hBase = transform[4] === 0 || transform[5] === 0 || transform[0] === 0 ? 1 : Math.abs(2 * transform[4] / transform[0]);\n var vBase = transform[4] === 0 || transform[5] === 0 || transform[2] === 0 ? 1 : Math.abs(2 * transform[4] / transform[2]);\n var vertex = [direction === 'left' ? -hBase : direction === 'right' ? hBase : 0, direction === 'top' ? -vBase : direction === 'bottom' ? vBase : 0];\n vertex = applyTransform(vertex, transform, invert);\n return Math.abs(vertex[0]) > Math.abs(vertex[1]) ? vertex[0] > 0 ? 'right' : 'left' : vertex[1] > 0 ? 'bottom' : 'top';\n}\n\nfunction isNotGroup(el) {\n return !el.isGroup;\n}\n\nfunction isPath(el) {\n return el.shape != null;\n}\n/**\n * Apply group transition animation from g1 to g2.\n * If no animatableModel, no animation.\n */\n\n\nexport function groupTransition(g1, g2, animatableModel) {\n if (!g1 || !g2) {\n return;\n }\n\n function getElMap(g) {\n var elMap = {};\n g.traverse(function (el) {\n if (isNotGroup(el) && el.anid) {\n elMap[el.anid] = el;\n }\n });\n return elMap;\n }\n\n function getAnimatableProps(el) {\n var obj = {\n x: el.x,\n y: el.y,\n rotation: el.rotation\n };\n\n if (isPath(el)) {\n obj.shape = extend({}, el.shape);\n }\n\n return obj;\n }\n\n var elMap1 = getElMap(g1);\n g2.traverse(function (el) {\n if (isNotGroup(el) && el.anid) {\n var oldEl = elMap1[el.anid];\n\n if (oldEl) {\n var newProp = getAnimatableProps(el);\n el.attr(getAnimatableProps(oldEl));\n updateProps(el, newProp, animatableModel, getECData(el).dataIndex);\n }\n }\n });\n}\nexport function clipPointsByRect(points, rect) {\n // FIXME: this way migth be incorrect when grpahic clipped by a corner.\n // and when element have border.\n return map(points, function (point) {\n var x = point[0];\n x = mathMax(x, rect.x);\n x = mathMin(x, rect.x + rect.width);\n var y = point[1];\n y = mathMax(y, rect.y);\n y = mathMin(y, rect.y + rect.height);\n return [x, y];\n });\n}\n/**\n * Return a new clipped rect. If rect size are negative, return undefined.\n */\n\nexport function clipRectByRect(targetRect, rect) {\n var x = mathMax(targetRect.x, rect.x);\n var x2 = mathMin(targetRect.x + targetRect.width, rect.x + rect.width);\n var y = mathMax(targetRect.y, rect.y);\n var y2 = mathMin(targetRect.y + targetRect.height, rect.y + rect.height); // If the total rect is cliped, nothing, including the border,\n // should be painted. So return undefined.\n\n if (x2 >= x && y2 >= y) {\n return {\n x: x,\n y: y,\n width: x2 - x,\n height: y2 - y\n };\n }\n}\nexport function createIcon(iconStr, // Support 'image://' or 'path://' or direct svg path.\nopt, rect) {\n var innerOpts = extend({\n rectHover: true\n }, opt);\n var style = innerOpts.style = {\n strokeNoScale: true\n };\n rect = rect || {\n x: -1,\n y: -1,\n width: 2,\n height: 2\n };\n\n if (iconStr) {\n return iconStr.indexOf('image://') === 0 ? (style.image = iconStr.slice(8), defaults(style, rect), new ZRImage(innerOpts)) : makePath(iconStr.replace('path://', ''), innerOpts, rect, 'center');\n }\n}\n/**\n * Return `true` if the given line (line `a`) and the given polygon\n * are intersect.\n * Note that we do not count colinear as intersect here because no\n * requirement for that. We could do that if required in future.\n */\n\nexport function linePolygonIntersect(a1x, a1y, a2x, a2y, points) {\n for (var i = 0, p2 = points[points.length - 1]; i < points.length; i++) {\n var p = points[i];\n\n if (lineLineIntersect(a1x, a1y, a2x, a2y, p[0], p[1], p2[0], p2[1])) {\n return true;\n }\n\n p2 = p;\n }\n}\n/**\n * Return `true` if the given two lines (line `a` and line `b`)\n * are intersect.\n * Note that we do not count colinear as intersect here because no\n * requirement for that. We could do that if required in future.\n */\n\nexport function lineLineIntersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) {\n // let `vec_m` to be `vec_a2 - vec_a1` and `vec_n` to be `vec_b2 - vec_b1`.\n var mx = a2x - a1x;\n var my = a2y - a1y;\n var nx = b2x - b1x;\n var ny = b2y - b1y; // `vec_m` and `vec_n` are parallel iff\n // exising `k` such that `vec_m = k · vec_n`, equivalent to `vec_m X vec_n = 0`.\n\n var nmCrossProduct = crossProduct2d(nx, ny, mx, my);\n\n if (nearZero(nmCrossProduct)) {\n return false;\n } // `vec_m` and `vec_n` are intersect iff\n // existing `p` and `q` in [0, 1] such that `vec_a1 + p * vec_m = vec_b1 + q * vec_n`,\n // such that `q = ((vec_a1 - vec_b1) X vec_m) / (vec_n X vec_m)`\n // and `p = ((vec_a1 - vec_b1) X vec_n) / (vec_n X vec_m)`.\n\n\n var b1a1x = a1x - b1x;\n var b1a1y = a1y - b1y;\n var q = crossProduct2d(b1a1x, b1a1y, mx, my) / nmCrossProduct;\n\n if (q < 0 || q > 1) {\n return false;\n }\n\n var p = crossProduct2d(b1a1x, b1a1y, nx, ny) / nmCrossProduct;\n\n if (p < 0 || p > 1) {\n return false;\n }\n\n return true;\n}\n/**\n * Cross product of 2-dimension vector.\n */\n\nfunction crossProduct2d(x1, y1, x2, y2) {\n return x1 * y2 - x2 * y1;\n}\n\nfunction nearZero(val) {\n return val <= 1e-6 && val >= -1e-6;\n}\n\nexport function setTooltipConfig(opt) {\n var itemTooltipOption = opt.itemTooltipOption;\n var componentModel = opt.componentModel;\n var itemName = opt.itemName;\n var itemTooltipOptionObj = isString(itemTooltipOption) ? {\n formatter: itemTooltipOption\n } : itemTooltipOption;\n var mainType = componentModel.mainType;\n var componentIndex = componentModel.componentIndex;\n var formatterParams = {\n componentType: mainType,\n name: itemName,\n $vars: ['name']\n };\n formatterParams[mainType + 'Index'] = componentIndex;\n var formatterParamsExtra = opt.formatterParamsExtra;\n\n if (formatterParamsExtra) {\n each(keys(formatterParamsExtra), function (key) {\n if (!hasOwn(formatterParams, key)) {\n formatterParams[key] = formatterParamsExtra[key];\n formatterParams.$vars.push(key);\n }\n });\n }\n\n var ecData = getECData(opt.el);\n ecData.componentMainType = mainType;\n ecData.componentIndex = componentIndex;\n ecData.tooltipConfig = {\n name: itemName,\n option: defaults({\n content: itemName,\n formatterParams: formatterParams\n }, itemTooltipOptionObj)\n };\n} // Register built-in shapes. These shapes might be overwirtten\n// by users, although we do not recommend that.\n\nregisterShape('circle', Circle);\nregisterShape('ellipse', Ellipse);\nregisterShape('sector', Sector);\nregisterShape('ring', Ring);\nregisterShape('polygon', Polygon);\nregisterShape('polyline', Polyline);\nregisterShape('rect', Rect);\nregisterShape('line', Line);\nregisterShape('bezierCurve', BezierCurve);\nregisterShape('arc', Arc);\nexport { Group, ZRImage as Image, ZRText as Text, Circle, Ellipse, Sector, Ring, Polygon, Polyline, Rect, Line, BezierCurve, Arc, IncrementalDisplayable, CompoundPath, LinearGradient, RadialGradient, BoundingRect, OrientedBoundingRect, Point, Path };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport ZRText from 'zrender/lib/graphic/Text';\nimport { isFunction, retrieve2, extend, keys, trim } from 'zrender/lib/core/util';\nimport { SPECIAL_STATES, DISPLAY_STATES } from '../util/states';\nimport { deprecateReplaceLog } from '../util/log';\nimport { makeInner, interpolateRawValues } from '../util/model';\nimport { initProps, updateProps } from '../util/graphic';\nvar EMPTY_OBJ = {};\nexport function setLabelText(label, labelTexts) {\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n var text = labelTexts[stateName];\n var state = label.ensureState(stateName);\n state.style = state.style || {};\n state.style.text = text;\n }\n\n var oldStates = label.currentStates.slice();\n label.clearStates(true);\n label.setStyle({\n text: labelTexts.normal\n });\n label.useStates(oldStates, true);\n}\n\nfunction getLabelText(opt, stateModels, interpolatedValue) {\n var labelFetcher = opt.labelFetcher;\n var labelDataIndex = opt.labelDataIndex;\n var labelDimIndex = opt.labelDimIndex;\n var normalModel = stateModels.normal;\n var baseText;\n\n if (labelFetcher) {\n baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, normalModel && normalModel.get('formatter'), interpolatedValue != null ? {\n interpolatedValue: interpolatedValue\n } : null);\n }\n\n if (baseText == null) {\n baseText = isFunction(opt.defaultText) ? opt.defaultText(labelDataIndex, opt, interpolatedValue) : opt.defaultText;\n }\n\n var statesText = {\n normal: baseText\n };\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n var stateModel = stateModels[stateName];\n statesText[stateName] = retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, stateName, null, labelDimIndex, stateModel && stateModel.get('formatter')) : null, baseText);\n }\n\n return statesText;\n}\n\nfunction setLabelStyle(targetEl, labelStatesModels, opt, stateSpecified // TODO specified position?\n) {\n opt = opt || EMPTY_OBJ;\n var isSetOnText = targetEl instanceof ZRText;\n var needsCreateText = false;\n\n for (var i = 0; i < DISPLAY_STATES.length; i++) {\n var stateModel = labelStatesModels[DISPLAY_STATES[i]];\n\n if (stateModel && stateModel.getShallow('show')) {\n needsCreateText = true;\n break;\n }\n }\n\n var textContent = isSetOnText ? targetEl : targetEl.getTextContent();\n\n if (needsCreateText) {\n if (!isSetOnText) {\n // Reuse the previous\n if (!textContent) {\n textContent = new ZRText();\n targetEl.setTextContent(textContent);\n } // Use same state proxy\n\n\n if (targetEl.stateProxy) {\n textContent.stateProxy = targetEl.stateProxy;\n }\n }\n\n var labelStatesTexts = getLabelText(opt, labelStatesModels);\n var normalModel = labelStatesModels.normal;\n var showNormal = !!normalModel.getShallow('show');\n var normalStyle = createTextStyle(normalModel, stateSpecified && stateSpecified.normal, opt, false, !isSetOnText);\n normalStyle.text = labelStatesTexts.normal;\n\n if (!isSetOnText) {\n // Always create new\n targetEl.setTextConfig(createTextConfig(normalModel, opt, false));\n }\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n var stateModel = labelStatesModels[stateName];\n\n if (stateModel) {\n var stateObj = textContent.ensureState(stateName);\n var stateShow = !!retrieve2(stateModel.getShallow('show'), showNormal);\n\n if (stateShow !== showNormal) {\n stateObj.ignore = !stateShow;\n }\n\n stateObj.style = createTextStyle(stateModel, stateSpecified && stateSpecified[stateName], opt, true, !isSetOnText);\n stateObj.style.text = labelStatesTexts[stateName];\n\n if (!isSetOnText) {\n var targetElEmphasisState = targetEl.ensureState(stateName);\n targetElEmphasisState.textConfig = createTextConfig(stateModel, opt, true);\n }\n }\n } // PENDING: if there is many requirements that emphasis position\n // need to be different from normal position, we might consider\n // auto slient is those cases.\n\n\n textContent.silent = !!normalModel.getShallow('silent'); // Keep x and y\n\n if (textContent.style.x != null) {\n normalStyle.x = textContent.style.x;\n }\n\n if (textContent.style.y != null) {\n normalStyle.y = textContent.style.y;\n }\n\n textContent.ignore = !showNormal; // Always create new style.\n\n textContent.useStyle(normalStyle);\n textContent.dirty();\n\n if (opt.enableTextSetter) {\n labelInner(textContent).setLabelText = function (interpolatedValue) {\n var labelStatesTexts = getLabelText(opt, labelStatesModels, interpolatedValue);\n setLabelText(textContent, labelStatesTexts);\n };\n }\n } else if (textContent) {\n // Not display rich text.\n textContent.ignore = true;\n }\n\n targetEl.dirty();\n}\n\nexport { setLabelStyle };\nexport function getLabelStatesModels(itemModel, labelName) {\n labelName = labelName || 'label';\n var statesModels = {\n normal: itemModel.getModel(labelName)\n };\n\n for (var i = 0; i < SPECIAL_STATES.length; i++) {\n var stateName = SPECIAL_STATES[i];\n statesModels[stateName] = itemModel.getModel([stateName, labelName]);\n }\n\n return statesModels;\n}\n/**\n * Set basic textStyle properties.\n */\n\nexport function createTextStyle(textStyleModel, specifiedTextStyle, // Fixed style in the code. Can't be set by model.\nopt, isNotNormal, isAttached // If text is attached on an element. If so, auto color will handling in zrender.\n) {\n var textStyle = {};\n setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttached);\n specifiedTextStyle && extend(textStyle, specifiedTextStyle); // textStyle.host && textStyle.host.dirty && textStyle.host.dirty(false);\n\n return textStyle;\n}\nexport function createTextConfig(textStyleModel, opt, isNotNormal) {\n opt = opt || {};\n var textConfig = {};\n var labelPosition;\n var labelRotate = textStyleModel.getShallow('rotate');\n var labelDistance = retrieve2(textStyleModel.getShallow('distance'), isNotNormal ? null : 5);\n var labelOffset = textStyleModel.getShallow('offset');\n labelPosition = textStyleModel.getShallow('position') || (isNotNormal ? null : 'inside'); // 'outside' is not a valid zr textPostion value, but used\n // in bar series, and magric type should be considered.\n\n labelPosition === 'outside' && (labelPosition = opt.defaultOutsidePosition || 'top');\n\n if (labelPosition != null) {\n textConfig.position = labelPosition;\n }\n\n if (labelOffset != null) {\n textConfig.offset = labelOffset;\n }\n\n if (labelRotate != null) {\n labelRotate *= Math.PI / 180;\n textConfig.rotation = labelRotate;\n }\n\n if (labelDistance != null) {\n textConfig.distance = labelDistance;\n } // fill and auto is determined by the color of path fill if it's not specified by developers.\n\n\n textConfig.outsideFill = textStyleModel.get('color') === 'inherit' ? opt.inheritColor || null : 'auto';\n return textConfig;\n}\n/**\n * The uniform entry of set text style, that is, retrieve style definitions\n * from `model` and set to `textStyle` object.\n *\n * Never in merge mode, but in overwrite mode, that is, all of the text style\n * properties will be set. (Consider the states of normal and emphasis and\n * default value can be adopted, merge would make the logic too complicated\n * to manage.)\n */\n\nfunction setTextStyleCommon(textStyle, textStyleModel, opt, isNotNormal, isAttached) {\n // Consider there will be abnormal when merge hover style to normal style if given default value.\n opt = opt || EMPTY_OBJ;\n var ecModel = textStyleModel.ecModel;\n var globalTextStyle = ecModel && ecModel.option.textStyle; // Consider case:\n // {\n // data: [{\n // value: 12,\n // label: {\n // rich: {\n // // no 'a' here but using parent 'a'.\n // }\n // }\n // }],\n // rich: {\n // a: { ... }\n // }\n // }\n\n var richItemNames = getRichItemNames(textStyleModel);\n var richResult;\n\n if (richItemNames) {\n richResult = {};\n\n for (var name_1 in richItemNames) {\n if (richItemNames.hasOwnProperty(name_1)) {\n // Cascade is supported in rich.\n var richTextStyle = textStyleModel.getModel(['rich', name_1]); // In rich, never `disableBox`.\n // FIXME: consider `label: {formatter: '{a|xx}', color: 'blue', rich: {a: {}}}`,\n // the default color `'blue'` will not be adopted if no color declared in `rich`.\n // That might confuses users. So probably we should put `textStyleModel` as the\n // root ancestor of the `richTextStyle`. But that would be a break change.\n\n setTokenTextStyle(richResult[name_1] = {}, richTextStyle, globalTextStyle, opt, isNotNormal, isAttached, false, true);\n }\n }\n }\n\n if (richResult) {\n textStyle.rich = richResult;\n }\n\n var overflow = textStyleModel.get('overflow');\n\n if (overflow) {\n textStyle.overflow = overflow;\n }\n\n var margin = textStyleModel.get('minMargin');\n\n if (margin != null) {\n textStyle.margin = margin;\n }\n\n setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isNotNormal, isAttached, true, false);\n} // Consider case:\n// {\n// data: [{\n// value: 12,\n// label: {\n// rich: {\n// // no 'a' here but using parent 'a'.\n// }\n// }\n// }],\n// rich: {\n// a: { ... }\n// }\n// }\n// TODO TextStyleModel\n\n\nfunction getRichItemNames(textStyleModel) {\n // Use object to remove duplicated names.\n var richItemNameMap;\n\n while (textStyleModel && textStyleModel !== textStyleModel.ecModel) {\n var rich = (textStyleModel.option || EMPTY_OBJ).rich;\n\n if (rich) {\n richItemNameMap = richItemNameMap || {};\n var richKeys = keys(rich);\n\n for (var i = 0; i < richKeys.length; i++) {\n var richKey = richKeys[i];\n richItemNameMap[richKey] = 1;\n }\n }\n\n textStyleModel = textStyleModel.parentModel;\n }\n\n return richItemNameMap;\n}\n\nvar TEXT_PROPS_WITH_GLOBAL = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily', 'textShadowColor', 'textShadowBlur', 'textShadowOffsetX', 'textShadowOffsetY'];\nvar TEXT_PROPS_SELF = ['align', 'lineHeight', 'width', 'height', 'tag', 'verticalAlign'];\nvar TEXT_PROPS_BOX = ['padding', 'borderWidth', 'borderRadius', 'borderDashOffset', 'backgroundColor', 'borderColor', 'shadowColor', 'shadowBlur', 'shadowOffsetX', 'shadowOffsetY'];\n\nfunction setTokenTextStyle(textStyle, textStyleModel, globalTextStyle, opt, isNotNormal, isAttached, isBlock, inRich) {\n // In merge mode, default value should not be given.\n globalTextStyle = !isNotNormal && globalTextStyle || EMPTY_OBJ;\n var inheritColor = opt && opt.inheritColor;\n var fillColor = textStyleModel.getShallow('color');\n var strokeColor = textStyleModel.getShallow('textBorderColor');\n var opacity = retrieve2(textStyleModel.getShallow('opacity'), globalTextStyle.opacity);\n\n if (fillColor === 'inherit' || fillColor === 'auto') {\n if (process.env.NODE_ENV !== 'production') {\n if (fillColor === 'auto') {\n deprecateReplaceLog('color: \\'auto\\'', 'color: \\'inherit\\'');\n }\n }\n\n if (inheritColor) {\n fillColor = inheritColor;\n } else {\n fillColor = null;\n }\n }\n\n if (strokeColor === 'inherit' || strokeColor === 'auto') {\n if (process.env.NODE_ENV !== 'production') {\n if (strokeColor === 'auto') {\n deprecateReplaceLog('color: \\'auto\\'', 'color: \\'inherit\\'');\n }\n }\n\n if (inheritColor) {\n strokeColor = inheritColor;\n } else {\n strokeColor = null;\n }\n }\n\n if (!isAttached) {\n // Only use default global textStyle.color if text is individual.\n // Otherwise it will use the strategy of attached text color because text may be on a path.\n fillColor = fillColor || globalTextStyle.color;\n strokeColor = strokeColor || globalTextStyle.textBorderColor;\n }\n\n if (fillColor != null) {\n textStyle.fill = fillColor;\n }\n\n if (strokeColor != null) {\n textStyle.stroke = strokeColor;\n }\n\n var textBorderWidth = retrieve2(textStyleModel.getShallow('textBorderWidth'), globalTextStyle.textBorderWidth);\n\n if (textBorderWidth != null) {\n textStyle.lineWidth = textBorderWidth;\n }\n\n var textBorderType = retrieve2(textStyleModel.getShallow('textBorderType'), globalTextStyle.textBorderType);\n\n if (textBorderType != null) {\n textStyle.lineDash = textBorderType;\n }\n\n var textBorderDashOffset = retrieve2(textStyleModel.getShallow('textBorderDashOffset'), globalTextStyle.textBorderDashOffset);\n\n if (textBorderDashOffset != null) {\n textStyle.lineDashOffset = textBorderDashOffset;\n }\n\n if (!isNotNormal && opacity == null && !inRich) {\n opacity = opt && opt.defaultOpacity;\n }\n\n if (opacity != null) {\n textStyle.opacity = opacity;\n } // TODO\n\n\n if (!isNotNormal && !isAttached) {\n // Set default finally.\n if (textStyle.fill == null && opt.inheritColor) {\n textStyle.fill = opt.inheritColor;\n }\n } // Do not use `getFont` here, because merge should be supported, where\n // part of these properties may be changed in emphasis style, and the\n // others should remain their original value got from normal style.\n\n\n for (var i = 0; i < TEXT_PROPS_WITH_GLOBAL.length; i++) {\n var key = TEXT_PROPS_WITH_GLOBAL[i];\n var val = retrieve2(textStyleModel.getShallow(key), globalTextStyle[key]);\n\n if (val != null) {\n textStyle[key] = val;\n }\n }\n\n for (var i = 0; i < TEXT_PROPS_SELF.length; i++) {\n var key = TEXT_PROPS_SELF[i];\n var val = textStyleModel.getShallow(key);\n\n if (val != null) {\n textStyle[key] = val;\n }\n }\n\n if (textStyle.verticalAlign == null) {\n var baseline = textStyleModel.getShallow('baseline');\n\n if (baseline != null) {\n textStyle.verticalAlign = baseline;\n }\n }\n\n if (!isBlock || !opt.disableBox) {\n for (var i = 0; i < TEXT_PROPS_BOX.length; i++) {\n var key = TEXT_PROPS_BOX[i];\n var val = textStyleModel.getShallow(key);\n\n if (val != null) {\n textStyle[key] = val;\n }\n }\n\n var borderType = textStyleModel.getShallow('borderType');\n\n if (borderType != null) {\n textStyle.borderDash = borderType;\n }\n\n if ((textStyle.backgroundColor === 'auto' || textStyle.backgroundColor === 'inherit') && inheritColor) {\n if (process.env.NODE_ENV !== 'production') {\n if (textStyle.backgroundColor === 'auto') {\n deprecateReplaceLog('backgroundColor: \\'auto\\'', 'backgroundColor: \\'inherit\\'');\n }\n }\n\n textStyle.backgroundColor = inheritColor;\n }\n\n if ((textStyle.borderColor === 'auto' || textStyle.borderColor === 'inherit') && inheritColor) {\n if (process.env.NODE_ENV !== 'production') {\n if (textStyle.borderColor === 'auto') {\n deprecateReplaceLog('borderColor: \\'auto\\'', 'borderColor: \\'inherit\\'');\n }\n }\n\n textStyle.borderColor = inheritColor;\n }\n }\n}\n\nexport function getFont(opt, ecModel) {\n var gTextStyleModel = ecModel && ecModel.getModel('textStyle');\n return trim([// FIXME in node-canvas fontWeight is before fontStyle\n opt.fontStyle || gTextStyleModel && gTextStyleModel.getShallow('fontStyle') || '', opt.fontWeight || gTextStyleModel && gTextStyleModel.getShallow('fontWeight') || '', (opt.fontSize || gTextStyleModel && gTextStyleModel.getShallow('fontSize') || 12) + 'px', opt.fontFamily || gTextStyleModel && gTextStyleModel.getShallow('fontFamily') || 'sans-serif'].join(' '));\n}\nexport var labelInner = makeInner();\nexport function setLabelValueAnimation(label, labelStatesModels, value, getDefaultText) {\n if (!label) {\n return;\n }\n\n var obj = labelInner(label);\n obj.prevValue = obj.value;\n obj.value = value;\n var normalLabelModel = labelStatesModels.normal;\n obj.valueAnimation = normalLabelModel.get('valueAnimation');\n\n if (obj.valueAnimation) {\n obj.precision = normalLabelModel.get('precision');\n obj.defaultInterpolatedText = getDefaultText;\n obj.statesModels = labelStatesModels;\n }\n}\nexport function animateLabelValue(textEl, dataIndex, data, animatableModel, labelFetcher) {\n var labelInnerStore = labelInner(textEl);\n\n if (!labelInnerStore.valueAnimation) {\n return;\n }\n\n var defaultInterpolatedText = labelInnerStore.defaultInterpolatedText; // Consider the case that being animating, do not use the `obj.value`,\n // Otherwise it will jump to the `obj.value` when this new animation started.\n\n var currValue = retrieve2(labelInnerStore.interpolatedValue, labelInnerStore.prevValue);\n var targetValue = labelInnerStore.value;\n\n function during(percent) {\n var interpolated = interpolateRawValues(data, labelInnerStore.precision, currValue, targetValue, percent);\n labelInnerStore.interpolatedValue = percent === 1 ? null : interpolated;\n var labelText = getLabelText({\n labelDataIndex: dataIndex,\n labelFetcher: labelFetcher,\n defaultText: defaultInterpolatedText ? defaultInterpolatedText(interpolated) : interpolated + ''\n }, labelInnerStore.statesModels, interpolated);\n setLabelText(textEl, labelText);\n }\n\n (currValue == null ? initProps : updateProps)(textEl, {}, animatableModel, dataIndex, null, during);\n}","/**\n * Provide orbit control for 3D objects\n *\n * @module echarts-gl/util/OrbitControl\n * @author Yi Shen(http://github.com/pissang)\n */\n\n// TODO Remove magic numbers on sensitivity\nimport Base from 'claygl/src/core/Base';\nimport Vector2 from 'claygl/src/math/Vector2';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Quaternion from 'claygl/src/math/Quaternion';\nimport retrieve from './retrieve';\nvar firstNotNull = retrieve.firstNotNull;\n\n\nvar MOUSE_BUTTON_KEY_MAP = {\n left: 0,\n middle: 1,\n right: 2\n};\n\nfunction convertToArray(val) {\n if (!(val instanceof Array)) {\n val = [val, val];\n }\n return val;\n}\n\n/**\n * @alias module:echarts-x/util/OrbitControl\n */\nvar OrbitControl = Base.extend(function () {\n\n return {\n /**\n * @type {module:zrender~ZRender}\n */\n zr: null,\n\n /**\n * @type {module:echarts-gl/core/ViewGL}\n */\n viewGL: null,\n\n /**\n * @type {clay.math.Vector3}\n */\n _center: new Vector3(),\n\n /**\n * Minimum distance to the center\n * Only available when camera is perspective.\n * @type {number}\n * @default 0.5\n */\n minDistance: 0.5,\n\n /**\n * Maximum distance to the center\n * Only available when camera is perspective.\n * @type {number}\n * @default 2\n */\n maxDistance: 1.5,\n\n /**\n * Only available when camera is orthographic\n */\n maxOrthographicSize: 300,\n\n /**\n * Only available when camera is orthographic\n */\n minOrthographicSize: 30,\n\n /**\n * Minimum alpha rotation\n */\n minAlpha: -90,\n\n /**\n * Maximum alpha rotation\n */\n maxAlpha: 90,\n\n /**\n * Minimum beta rotation\n */\n minBeta: -Infinity,\n /**\n * Maximum beta rotation\n */\n maxBeta: Infinity,\n\n /**\n * Start auto rotating after still for the given time\n */\n autoRotateAfterStill: 0,\n\n /**\n * Direction of autoRotate. cw or ccw when looking top down.\n */\n autoRotateDirection: 'cw',\n\n /**\n * Degree per second\n */\n autoRotateSpeed: 60,\n\n /**\n * @param {number}\n */\n damping: 0.8,\n\n /**\n * @param {number}\n */\n rotateSensitivity: 1,\n\n /**\n * @param {number}\n */\n zoomSensitivity: 1,\n\n /**\n * @param {number}\n */\n panSensitivity: 1,\n\n panMouseButton: 'middle',\n rotateMouseButton: 'left',\n\n /**\n * Pan or rotate\n * @private\n * @type {String}\n */\n _mode: 'rotate',\n\n /**\n * @private\n * @type {clay.Camera}\n */\n _camera: null,\n\n _needsUpdate: false,\n\n _rotating: false,\n\n // Rotation around yAxis in radian\n _phi: 0,\n // Rotation around xAxis in radian\n _theta: 0,\n\n _mouseX: 0,\n _mouseY: 0,\n\n _rotateVelocity: new Vector2(),\n\n _panVelocity: new Vector2(),\n\n _distance: 500,\n\n _zoomSpeed: 0,\n\n _stillTimeout: 0,\n\n _animators: []\n };\n}, function () {\n // Each OrbitControl has it's own handler\n ['_mouseDownHandler', '_mouseWheelHandler', '_mouseMoveHandler', '_mouseUpHandler',\n '_pinchHandler', '_contextMenuHandler', '_update'].forEach(function (hdlName) {\n this[hdlName] = this[hdlName].bind(this);\n }, this);\n}, {\n /**\n * Initialize.\n * Mouse event binding\n */\n init: function () {\n var zr = this.zr;\n\n if (zr) {\n zr.on('mousedown', this._mouseDownHandler);\n zr.on('globalout', this._mouseUpHandler);\n zr.on('mousewheel', this._mouseWheelHandler);\n zr.on('pinch', this._pinchHandler);\n\n zr.animation.on('frame', this._update);\n\n zr.dom.addEventListener('contextmenu', this._contextMenuHandler);\n }\n },\n\n /**\n * Dispose.\n * Mouse event unbinding\n */\n dispose: function () {\n var zr = this.zr;\n\n if (zr) {\n zr.off('mousedown', this._mouseDownHandler);\n zr.off('mousemove', this._mouseMoveHandler);\n zr.off('mouseup', this._mouseUpHandler);\n zr.off('mousewheel', this._mouseWheelHandler);\n zr.off('pinch', this._pinchHandler);\n zr.off('globalout', this._mouseUpHandler);\n zr.dom.removeEventListener('contextmenu', this._contextMenuHandler);\n\n zr.animation.off('frame', this._update);\n }\n this.stopAllAnimation();\n },\n\n /**\n * Get distance\n * @return {number}\n */\n getDistance: function () {\n return this._distance;\n },\n\n /**\n * Set distance\n * @param {number} distance\n */\n setDistance: function (distance) {\n this._distance = distance;\n this._needsUpdate = true;\n },\n\n /**\n * Get size of orthographic viewing volume\n * @return {number}\n */\n getOrthographicSize: function () {\n return this._orthoSize;\n },\n\n /**\n * Set size of orthographic viewing volume\n * @param {number} size\n */\n setOrthographicSize: function (size) {\n this._orthoSize = size;\n this._needsUpdate = true;\n },\n\n /**\n * Get alpha rotation\n * Alpha angle for top-down rotation. Positive to rotate to top.\n *\n * Which means camera rotation around x axis.\n */\n getAlpha: function () {\n return this._theta / Math.PI * 180;\n },\n\n /**\n * Get beta rotation\n * Beta angle for left-right rotation. Positive to rotate to right.\n *\n * Which means camera rotation around y axis.\n */\n getBeta: function () {\n return -this._phi / Math.PI * 180;\n },\n\n /**\n * Get control center\n * @return {Array.}\n */\n getCenter: function () {\n return this._center.toArray();\n },\n\n /**\n * Set alpha rotation angle\n * @param {number} alpha\n */\n setAlpha: function (alpha) {\n alpha = Math.max(Math.min(this.maxAlpha, alpha), this.minAlpha);\n\n this._theta = alpha / 180 * Math.PI;\n this._needsUpdate = true;\n },\n\n /**\n * Set beta rotation angle\n * @param {number} beta\n */\n setBeta: function (beta) {\n beta = Math.max(Math.min(this.maxBeta, beta), this.minBeta);\n\n this._phi = -beta / 180 * Math.PI;\n this._needsUpdate = true;\n },\n\n /**\n * Set control center\n * @param {Array.} center\n */\n setCenter: function (centerArr) {\n this._center.setArray(centerArr);\n },\n\n /**\n * @param {module:echarts-gl/core/ViewGL} viewGL\n */\n setViewGL: function (viewGL) {\n this.viewGL = viewGL;\n },\n\n /**\n * @return {clay.Camera}\n */\n getCamera: function () {\n return this.viewGL.camera;\n },\n\n setFromViewControlModel: function (viewControlModel, extraOpts) {\n extraOpts = extraOpts || {};\n var baseDistance = extraOpts.baseDistance || 0;\n var baseOrthoSize = extraOpts.baseOrthoSize || 1;\n\n var projection = viewControlModel.get('projection');\n if (projection !== 'perspective' && projection !== 'orthographic' && projection !== 'isometric') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Unkown projection type %s, use perspective projection instead.', projection);\n }\n projection = 'perspective';\n }\n this._projection = projection;\n this.viewGL.setProjection(projection);\n\n var targetDistance = viewControlModel.get('distance') + baseDistance;\n var targetOrthographicSize = viewControlModel.get('orthographicSize') + baseOrthoSize;\n\n [\n ['damping', 0.8],\n ['autoRotate', false],\n ['autoRotateAfterStill', 3],\n ['autoRotateDirection', 'cw'],\n ['autoRotateSpeed', 10],\n ['minDistance', 30],\n ['maxDistance', 400],\n ['minOrthographicSize', 30],\n ['maxOrthographicSize', 300],\n ['minAlpha', -90],\n ['maxAlpha', 90],\n ['minBeta', -Infinity],\n ['maxBeta', Infinity],\n ['rotateSensitivity', 1],\n ['zoomSensitivity', 1],\n ['panSensitivity', 1],\n ['panMouseButton', 'left'],\n ['rotateMouseButton', 'middle'],\n ].forEach(function (prop) {\n this[prop[0]] = firstNotNull(viewControlModel.get(prop[0]), prop[1]);\n }, this);\n\n this.minDistance += baseDistance;\n this.maxDistance += baseDistance;\n this.minOrthographicSize += baseOrthoSize,\n this.maxOrthographicSize += baseOrthoSize;\n\n var ecModel = viewControlModel.ecModel;\n\n var animationOpts = {};\n ['animation', 'animationDurationUpdate', 'animationEasingUpdate'].forEach(function (key) {\n animationOpts[key] = firstNotNull(\n viewControlModel.get(key), ecModel && ecModel.get(key)\n );\n });\n\n var alpha = firstNotNull(extraOpts.alpha, viewControlModel.get('alpha')) || 0;\n var beta = firstNotNull(extraOpts.beta, viewControlModel.get('beta')) || 0;\n var center = firstNotNull(extraOpts.center, viewControlModel.get('center')) || [0, 0, 0];\n if (animationOpts.animation && animationOpts.animationDurationUpdate > 0 && this._notFirst) {\n this.animateTo({\n alpha: alpha,\n beta: beta,\n center: center,\n distance: targetDistance,\n orthographicSize: targetOrthographicSize,\n easing: animationOpts.animationEasingUpdate,\n duration: animationOpts.animationDurationUpdate\n });\n }\n else {\n this.setDistance(targetDistance);\n this.setAlpha(alpha);\n this.setBeta(beta);\n this.setCenter(center);\n this.setOrthographicSize(targetOrthographicSize);\n }\n\n this._notFirst = true;\n\n this._validateProperties();\n },\n\n _validateProperties: function () {\n if (process.env.NODE_ENV !== 'production') {\n if (MOUSE_BUTTON_KEY_MAP[this.panMouseButton] == null) {\n console.error('Unkown panMouseButton %s. It should be left|middle|right', this.panMouseButton);\n }\n if (MOUSE_BUTTON_KEY_MAP[this.rotateMouseButton] == null) {\n console.error('Unkown rotateMouseButton %s. It should be left|middle|right', this.rotateMouseButton);\n }\n if (this.autoRotateDirection !== 'cw' && this.autoRotateDirection !== 'ccw') {\n console.error('Unkown autoRotateDirection %s. It should be cw|ccw', this.autoRotateDirection);\n }\n }\n },\n\n /**\n * @param {Object} opts\n * @param {number} opts.distance\n * @param {number} opts.alpha\n * @param {number} opts.beta\n * @param {number} opts.orthographicSize\n * @param {number} [opts.duration=1000]\n * @param {number} [opts.easing='linear']\n */\n animateTo: function (opts) {\n var zr = this.zr;\n var self = this;\n\n var obj = {};\n var target = {};\n\n if (opts.distance != null) {\n obj.distance = this.getDistance();\n target.distance = opts.distance;\n }\n if (opts.orthographicSize != null) {\n obj.orthographicSize = this.getOrthographicSize();\n target.orthographicSize = opts.orthographicSize;\n }\n if (opts.alpha != null) {\n obj.alpha = this.getAlpha();\n target.alpha = opts.alpha;\n }\n if (opts.beta != null) {\n obj.beta = this.getBeta();\n target.beta = opts.beta;\n }\n if (opts.center != null) {\n obj.center = this.getCenter();\n target.center = opts.center;\n }\n\n return this._addAnimator(\n zr.animation.animate(obj)\n .when(opts.duration || 1000, target)\n .during(function () {\n if (obj.alpha != null) {\n self.setAlpha(obj.alpha);\n }\n if (obj.beta != null) {\n self.setBeta(obj.beta);\n }\n if (obj.distance != null) {\n self.setDistance(obj.distance);\n }\n if (obj.center != null) {\n self.setCenter(obj.center);\n }\n if (obj.orthographicSize != null) {\n self.setOrthographicSize(obj.orthographicSize);\n }\n self._needsUpdate = true;\n })\n ).start(opts.easing || 'linear');\n },\n\n /**\n * Stop all animation\n */\n stopAllAnimation: function () {\n for (var i = 0; i < this._animators.length; i++) {\n this._animators[i].stop();\n }\n this._animators.length = 0;\n },\n\n update: function () {\n this._needsUpdate = true;\n this._update(20);\n },\n\n _isAnimating: function () {\n return this._animators.length > 0;\n },\n /**\n * Call update each frame\n * @param {number} deltaTime Frame time\n */\n _update: function (deltaTime) {\n\n if (this._rotating) {\n var radian = (this.autoRotateDirection === 'cw' ? 1 : -1)\n * this.autoRotateSpeed / 180 * Math.PI;\n this._phi -= radian * deltaTime / 1000;\n this._needsUpdate = true;\n }\n else if (this._rotateVelocity.len() > 0) {\n this._needsUpdate = true;\n }\n\n if (Math.abs(this._zoomSpeed) > 0.1 || this._panVelocity.len() > 0) {\n this._needsUpdate = true;\n }\n\n if (!this._needsUpdate) {\n return;\n }\n\n deltaTime = Math.min(deltaTime, 50);\n\n this._updateDistanceOrSize(deltaTime);\n\n this._updatePan(deltaTime);\n\n this._updateRotate(deltaTime);\n\n this._updateTransform();\n\n this.getCamera().update();\n\n this.zr && this.zr.refresh();\n\n this.trigger('update');\n\n this._needsUpdate = false;\n },\n\n _updateRotate: function (deltaTime) {\n var velocity = this._rotateVelocity;\n this._phi = velocity.y * deltaTime / 20 + this._phi;\n this._theta = velocity.x * deltaTime / 20 + this._theta;\n\n this.setAlpha(this.getAlpha());\n this.setBeta(this.getBeta());\n\n this._vectorDamping(velocity, Math.pow(this.damping, deltaTime / 16));\n },\n\n _updateDistanceOrSize: function (deltaTime) {\n if (this._projection === 'perspective') {\n this._setDistance(this._distance + this._zoomSpeed * deltaTime / 20);\n }\n else {\n this._setOrthoSize(this._orthoSize + this._zoomSpeed * deltaTime / 20);\n }\n\n this._zoomSpeed *= Math.pow(this.damping, deltaTime / 16);\n },\n\n\n _setDistance: function (distance) {\n this._distance = Math.max(Math.min(distance, this.maxDistance), this.minDistance);\n },\n\n _setOrthoSize: function (size) {\n this._orthoSize = Math.max(Math.min(size, this.maxOrthographicSize), this.minOrthographicSize);\n var camera = this.getCamera();\n var cameraHeight = this._orthoSize;\n var cameraWidth = cameraHeight / this.viewGL.viewport.height * this.viewGL.viewport.width;\n camera.left = -cameraWidth / 2;\n camera.right = cameraWidth / 2;\n camera.top = cameraHeight / 2;\n camera.bottom = -cameraHeight / 2;\n },\n\n _updatePan: function (deltaTime) {\n\n var velocity = this._panVelocity;\n var len = this._distance;\n\n var target = this.getCamera();\n var yAxis = target.worldTransform.y;\n var xAxis = target.worldTransform.x;\n\n // PENDING\n this._center\n .scaleAndAdd(xAxis, -velocity.x * len / 200)\n .scaleAndAdd(yAxis, -velocity.y * len / 200);\n\n this._vectorDamping(velocity, 0);\n },\n\n _updateTransform: function () {\n var camera = this.getCamera();\n\n var dir = new Vector3();\n var theta = this._theta + Math.PI / 2;\n var phi = this._phi + Math.PI / 2;\n var r = Math.sin(theta);\n\n dir.x = r * Math.cos(phi);\n dir.y = -Math.cos(theta);\n dir.z = r * Math.sin(phi);\n\n camera.position.copy(this._center).scaleAndAdd(dir, this._distance);\n camera.rotation.identity()\n // First around y, then around x\n .rotateY(-this._phi)\n .rotateX(-this._theta);\n },\n\n _startCountingStill: function () {\n clearTimeout(this._stillTimeout);\n\n var time = this.autoRotateAfterStill;\n var self = this;\n if (!isNaN(time) && time > 0) {\n this._stillTimeout = setTimeout(function () {\n self._rotating = true;\n }, time * 1000);\n }\n },\n\n _vectorDamping: function (v, damping) {\n var speed = v.len();\n speed = speed * damping;\n if (speed < 1e-4) {\n speed = 0;\n }\n v.normalize().scale(speed);\n },\n\n _decomposeTransform: function () {\n if (!this.getCamera()) {\n return;\n }\n\n this.getCamera().updateWorldTransform();\n\n var forward = this.getCamera().worldTransform.z;\n var alpha = Math.asin(forward.y);\n var beta = Math.atan2(forward.x, forward.z);\n\n this._theta = alpha;\n this._phi = -beta;\n\n this.setBeta(this.getBeta());\n this.setAlpha(this.getAlpha());\n\n // Is perspective\n if (this.getCamera().aspect) {\n this._setDistance(this.getCamera().position.dist(this._center));\n }\n else {\n this._setOrthoSize(this.getCamera().top - this.getCamera().bottom);\n }\n },\n\n _mouseDownHandler: function (e) {\n if (e.target) {\n // If mouseon some zrender element.\n return;\n }\n if (this._isAnimating()) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY;\n if (this.viewGL && !this.viewGL.containPoint(x, y)) {\n return;\n }\n\n this.zr.on('mousemove', this._mouseMoveHandler);\n this.zr.on('mouseup', this._mouseUpHandler);\n\n if (e.event.targetTouches) {\n if (e.event.targetTouches.length === 1) {\n this._mode = 'rotate';\n }\n }\n else {\n if (e.event.button === MOUSE_BUTTON_KEY_MAP[this.rotateMouseButton]) {\n this._mode = 'rotate';\n }\n else if (e.event.button === MOUSE_BUTTON_KEY_MAP[this.panMouseButton]) {\n this._mode = 'pan';\n }\n else {\n this._mode = '';\n }\n }\n\n // Reset rotate velocity\n this._rotateVelocity.set(0, 0);\n this._rotating = false;\n if (this.autoRotate) {\n this._startCountingStill();\n }\n\n this._mouseX = e.offsetX;\n this._mouseY = e.offsetY;\n },\n\n _mouseMoveHandler: function (e) {\n if (e.target && e.target.__isGLToZRProxy) {\n return;\n }\n\n if (this._isAnimating()) {\n return;\n }\n\n var panSensitivity = convertToArray(this.panSensitivity);\n var rotateSensitivity = convertToArray(this.rotateSensitivity);\n\n if (this._mode === 'rotate') {\n this._rotateVelocity.y = (e.offsetX - this._mouseX) / this.zr.getHeight() * 2 * rotateSensitivity[0];\n this._rotateVelocity.x = (e.offsetY - this._mouseY) / this.zr.getWidth() * 2 * rotateSensitivity[1];\n }\n else if (this._mode === 'pan') {\n this._panVelocity.x = (e.offsetX - this._mouseX) / this.zr.getWidth() * panSensitivity[0] * 400;\n this._panVelocity.y = (-e.offsetY + this._mouseY) / this.zr.getHeight() * panSensitivity[1] * 400;\n }\n\n\n this._mouseX = e.offsetX;\n this._mouseY = e.offsetY;\n\n e.event.preventDefault();\n },\n\n _mouseWheelHandler: function (e) {\n if (this._isAnimating()) {\n return;\n }\n var delta = e.event.wheelDelta // Webkit\n || -e.event.detail; // Firefox\n this._zoomHandler(e, delta);\n },\n\n _pinchHandler: function (e) {\n if (this._isAnimating()) {\n return;\n }\n this._zoomHandler(e, e.pinchScale > 1 ? 1 : -1);\n // Not rotate when pinch\n this._mode = '';\n },\n\n _zoomHandler: function (e, delta) {\n if (delta === 0) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY;\n if (this.viewGL && !this.viewGL.containPoint(x, y)) {\n return;\n }\n\n var speed;\n if (this._projection === 'perspective') {\n speed = Math.max(Math.max(Math.min(\n this._distance - this.minDistance,\n this.maxDistance - this._distance\n )) / 20, 0.5);\n }\n else {\n speed = Math.max(Math.max(Math.min(\n this._orthoSize - this.minOrthographicSize,\n this.maxOrthographicSize - this._orthoSize\n )) / 20, 0.5);\n }\n this._zoomSpeed = (delta > 0 ? -1 : 1) * speed * this.zoomSensitivity;\n\n this._rotating = false;\n\n if (this.autoRotate && this._mode === 'rotate') {\n this._startCountingStill();\n }\n\n e.event.preventDefault();\n },\n\n _mouseUpHandler: function () {\n this.zr.off('mousemove', this._mouseMoveHandler);\n this.zr.off('mouseup', this._mouseUpHandler);\n },\n\n _isRightMouseButtonUsed: function () {\n return this.rotateMouseButton === 'right'\n || this.panMouseButton === 'right';\n },\n\n _contextMenuHandler: function (e) {\n if (this._isRightMouseButtonUsed()) {\n e.preventDefault();\n }\n },\n\n _addAnimator: function (animator) {\n var animators = this._animators;\n animators.push(animator);\n animator.done(function () {\n var idx = animators.indexOf(animator);\n if (idx >= 0) {\n animators.splice(idx, 1);\n }\n });\n return animator;\n }\n});\n\n/**\n * If auto rotate the target\n * @type {boolean}\n * @default false\n */\nObject.defineProperty(OrbitControl.prototype, 'autoRotate', {\n get: function (val) {\n return this._autoRotate;\n },\n set: function (val) {\n this._autoRotate = val;\n this._rotating = val;\n }\n});\n\n\nexport default OrbitControl;","export default {\n convertToDynamicArray: function (clear) {\n if (clear) {\n this.resetOffset();\n }\n var attributes = this.attributes;\n for (var name in attributes) {\n if (clear || !attributes[name].value) {\n attributes[name].value = [];\n }\n else {\n attributes[name].value = Array.prototype.slice.call(attributes[name].value);\n }\n }\n if (clear || !this.indices) {\n this.indices = [];\n }\n else {\n this.indices = Array.prototype.slice.call(this.indices);\n }\n },\n\n convertToTypedArray: function () {\n var attributes = this.attributes;\n for (var name in attributes) {\n if (attributes[name].value && attributes[name].value.length > 0) {\n attributes[name].value = new Float32Array(attributes[name].value);\n }\n else {\n attributes[name].value = null;\n }\n }\n if (this.indices && this.indices.length > 0) {\n this.indices = this.vertexCount > 0xffff ? new Uint32Array(this.indices) : new Uint16Array(this.indices);\n }\n\n this.dirty();\n }\n};","/**\n * @fileoverview gl-matrix - High performance matrix and vector operations\n * @author Brandon Jones\n * @author Colin MacKenzie IV\n * @version 2.2.2\n */\n\n/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\nANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\nimport vec2 from './vec2';\nimport vec3 from './vec3';\nimport vec4 from './vec4';\nimport mat2 from './mat2';\nimport mat2d from './mat2d';\nimport mat3 from './mat3';\nimport mat4 from './mat4';\nimport quat from './quat';\n\nexport default {\n vec2: vec2,\n vec3: vec3,\n vec4: vec4,\n mat2: mat2,\n mat2d: mat2d,\n mat3: mat3,\n mat4: mat4,\n quat: quat\n};\n","// DEPRECATED\nimport glmatrix from '../glmatrix';\n\nexport default glmatrix;\n","/**\n * Lines geometry\n * Use screen space projected lines lineWidth > MAX_LINE_WIDTH\n * https://mattdesl.svbtle.com/drawing-lines-is-hard\n * @module echarts-gl/util/geometry/LinesGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\nimport dynamicConvertMixin from './dynamicConvertMixin';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\n// var CURVE_RECURSION_LIMIT = 8;\n// var CURVE_COLLINEAR_EPSILON = 40;\n\nvar sampleLinePoints = [[0, 0], [1, 1]];\n/**\n * @constructor\n * @alias module:echarts-gl/util/geometry/LinesGeometry\n * @extends clay.Geometry\n */\n\nvar LinesGeometry = Geometry.extend(function () {\n return {\n\n segmentScale: 1,\n\n dynamic: true,\n /**\n * Need to use mesh to expand lines if lineWidth > MAX_LINE_WIDTH\n */\n useNativeLine: true,\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION'),\n positionPrev: new Geometry.Attribute('positionPrev', 'float', 3),\n positionNext: new Geometry.Attribute('positionNext', 'float', 3),\n prevPositionPrev: new Geometry.Attribute('prevPositionPrev', 'float', 3),\n prevPosition: new Geometry.Attribute('prevPosition', 'float', 3),\n prevPositionNext: new Geometry.Attribute('prevPositionNext', 'float', 3),\n offset: new Geometry.Attribute('offset', 'float', 1),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR')\n }\n };\n},\n/** @lends module: echarts-gl/util/geometry/LinesGeometry.prototype */\n{\n\n /**\n * Reset offset\n */\n resetOffset: function () {\n this._vertexOffset = 0;\n this._triangleOffset = 0;\n\n this._itemVertexOffsets = [];\n },\n\n /**\n * @param {number} nVertex\n */\n setVertexCount: function (nVertex) {\n var attributes = this.attributes;\n if (this.vertexCount !== nVertex) {\n attributes.position.init(nVertex);\n attributes.color.init(nVertex);\n\n if (!this.useNativeLine) {\n attributes.positionPrev.init(nVertex);\n attributes.positionNext.init(nVertex);\n attributes.offset.init(nVertex);\n }\n\n if (nVertex > 0xffff) {\n if (this.indices instanceof Uint16Array) {\n this.indices = new Uint32Array(this.indices);\n }\n }\n else {\n if (this.indices instanceof Uint32Array) {\n this.indices = new Uint16Array(this.indices);\n }\n }\n }\n },\n\n /**\n * @param {number} nTriangle\n */\n setTriangleCount: function (nTriangle) {\n if (this.triangleCount !== nTriangle) {\n if (nTriangle === 0) {\n this.indices = null;\n }\n else {\n this.indices = this.vertexCount > 0xffff ? new Uint32Array(nTriangle * 3) : new Uint16Array(nTriangle * 3);\n }\n }\n },\n\n _getCubicCurveApproxStep: function (p0, p1, p2, p3) {\n var len = vec3.dist(p0, p1) + vec3.dist(p2, p1) + vec3.dist(p3, p2);\n var step = 1 / (len + 1) * this.segmentScale;\n return step;\n },\n\n /**\n * Get vertex count of cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @return number\n */\n getCubicCurveVertexCount: function (p0, p1, p2, p3) {\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n var segCount = Math.ceil(1 / step);\n if (!this.useNativeLine) {\n return segCount * 2 + 2;\n }\n else {\n return segCount * 2;\n }\n },\n\n /**\n * Get face count of cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @return number\n */\n getCubicCurveTriangleCount: function (p0, p1, p2, p3) {\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n var segCount = Math.ceil(1 / step);\n if (!this.useNativeLine) {\n return segCount * 2;\n }\n else {\n return 0;\n }\n },\n\n /**\n * Get vertex count of line\n * @return {number}\n */\n getLineVertexCount: function () {\n return this.getPolylineVertexCount(sampleLinePoints);\n },\n\n /**\n * Get face count of line\n * @return {number}\n */\n getLineTriangleCount: function () {\n return this.getPolylineTriangleCount(sampleLinePoints);\n },\n\n /**\n * Get how many vertices will polyline take.\n * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount.\n * @return {number}\n */\n getPolylineVertexCount: function (points) {\n var pointsLen;\n if (typeof points === 'number') {\n pointsLen = points;\n }\n else {\n var is2DArray = typeof points[0] !== 'number';\n pointsLen = is2DArray ? points.length : (points.length / 3);\n }\n return !this.useNativeLine ? ((pointsLen - 1) * 2 + 2) : (pointsLen - 1) * 2;\n },\n\n /**\n * Get how many triangles will polyline take.\n * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount.\n * @return {number}\n */\n getPolylineTriangleCount: function (points) {\n var pointsLen;\n if (typeof points === 'number') {\n pointsLen = points;\n }\n else {\n var is2DArray = typeof points[0] !== 'number';\n pointsLen = is2DArray ? points.length : (points.length / 3);\n }\n return !this.useNativeLine ? Math.max(pointsLen - 1, 0) * 2 : 0;\n },\n\n /**\n * Add a cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @param {Array.} color\n * @param {number} [lineWidth=1]\n */\n addCubicCurve: function (p0, p1, p2, p3, color, lineWidth) {\n if (lineWidth == null) {\n lineWidth = 1;\n }\n // incremental interpolation\n // http://antigrain.com/research/bezier_interpolation/index.html#PAGE_BEZIER_INTERPOLATION\n var x0 = p0[0], y0 = p0[1], z0 = p0[2];\n var x1 = p1[0], y1 = p1[1], z1 = p1[2];\n var x2 = p2[0], y2 = p2[1], z2 = p2[2];\n var x3 = p3[0], y3 = p3[1], z3 = p3[2];\n\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n\n var step2 = step * step;\n var step3 = step2 * step;\n\n var pre1 = 3.0 * step;\n var pre2 = 3.0 * step2;\n var pre4 = 6.0 * step2;\n var pre5 = 6.0 * step3;\n\n var tmp1x = x0 - x1 * 2.0 + x2;\n var tmp1y = y0 - y1 * 2.0 + y2;\n var tmp1z = z0 - z1 * 2.0 + z2;\n\n var tmp2x = (x1 - x2) * 3.0 - x0 + x3;\n var tmp2y = (y1 - y2) * 3.0 - y0 + y3;\n var tmp2z = (z1 - z2) * 3.0 - z0 + z3;\n\n var fx = x0;\n var fy = y0;\n var fz = z0;\n\n var dfx = (x1 - x0) * pre1 + tmp1x * pre2 + tmp2x * step3;\n var dfy = (y1 - y0) * pre1 + tmp1y * pre2 + tmp2y * step3;\n var dfz = (z1 - z0) * pre1 + tmp1z * pre2 + tmp2z * step3;\n\n var ddfx = tmp1x * pre4 + tmp2x * pre5;\n var ddfy = tmp1y * pre4 + tmp2y * pre5;\n var ddfz = tmp1z * pre4 + tmp2z * pre5;\n\n var dddfx = tmp2x * pre5;\n var dddfy = tmp2y * pre5;\n var dddfz = tmp2z * pre5;\n\n var t = 0;\n\n var k = 0;\n var segCount = Math.ceil(1 / step);\n\n var points = new Float32Array((segCount + 1) * 3);\n var points = [];\n var offset = 0;\n for (var k = 0; k < segCount + 1; k++) {\n points[offset++] = fx;\n points[offset++] = fy;\n points[offset++] = fz;\n\n fx += dfx; fy += dfy; fz += dfz;\n dfx += ddfx; dfy += ddfy; dfz += ddfz;\n ddfx += dddfx; ddfy += dddfy; ddfz += dddfz;\n t += step;\n\n if (t > 1) {\n fx = dfx > 0 ? Math.min(fx, x3) : Math.max(fx, x3);\n fy = dfy > 0 ? Math.min(fy, y3) : Math.max(fy, y3);\n fz = dfz > 0 ? Math.min(fz, z3) : Math.max(fz, z3);\n }\n }\n\n return this.addPolyline(points, color, lineWidth);\n },\n\n /**\n * Add a straight line\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} color\n * @param {number} [lineWidth=1]\n */\n addLine: function (p0, p1, color, lineWidth) {\n return this.addPolyline([p0, p1], color, lineWidth);\n },\n\n /**\n * Add a straight line\n * @param {Array. | Array.} points\n * @param {Array. | Array.} color\n * @param {number} [lineWidth=1]\n * @param {number} [startOffset=0]\n * @param {number} [pointsCount] Default to be amount of points in the first argument\n */\n addPolyline: function (points, color, lineWidth, startOffset, pointsCount) {\n if (!points.length) {\n return;\n }\n var is2DArray = typeof points[0] !== 'number';\n if (pointsCount == null) {\n pointsCount = is2DArray ? points.length : points.length / 3;\n }\n if (pointsCount < 2) {\n return;\n }\n if (startOffset == null) {\n startOffset = 0;\n }\n if (lineWidth == null) {\n lineWidth = 1;\n }\n\n this._itemVertexOffsets.push(this._vertexOffset);\n\n var is2DArray = typeof points[0] !== 'number';\n var notSharingColor = is2DArray\n ? typeof color[0] !== 'number'\n : color.length / 4 === pointsCount;\n\n var positionAttr = this.attributes.position;\n var positionPrevAttr = this.attributes.positionPrev;\n var positionNextAttr = this.attributes.positionNext;\n var colorAttr = this.attributes.color;\n var offsetAttr = this.attributes.offset;\n var indices = this.indices;\n\n var vertexOffset = this._vertexOffset;\n var point;\n var pointColor;\n\n lineWidth = Math.max(lineWidth, 0.01);\n\n for (var k = startOffset; k < pointsCount; k++) {\n if (is2DArray) {\n point = points[k];\n if (notSharingColor) {\n pointColor = color[k];\n }\n else {\n pointColor = color;\n }\n }\n else {\n var k3 = k * 3;\n point = point || [];\n point[0] = points[k3];\n point[1] = points[k3 + 1];\n point[2] = points[k3 + 2];\n\n if (notSharingColor) {\n var k4 = k * 4;\n pointColor = pointColor || [];\n pointColor[0] = color[k4];\n pointColor[1] = color[k4 + 1];\n pointColor[2] = color[k4 + 2];\n pointColor[3] = color[k4 + 3];\n }\n else {\n pointColor = color;\n }\n }\n if (!this.useNativeLine) {\n if (k < pointsCount - 1) {\n // Set to next two points\n positionPrevAttr.set(vertexOffset + 2, point);\n positionPrevAttr.set(vertexOffset + 3, point);\n }\n if (k > 0) {\n // Set to previous two points\n positionNextAttr.set(vertexOffset - 2, point);\n positionNextAttr.set(vertexOffset - 1, point);\n }\n\n positionAttr.set(vertexOffset, point);\n positionAttr.set(vertexOffset + 1, point);\n\n colorAttr.set(vertexOffset, pointColor);\n colorAttr.set(vertexOffset + 1, pointColor);\n\n offsetAttr.set(vertexOffset, lineWidth / 2);\n offsetAttr.set(vertexOffset + 1, -lineWidth / 2);\n\n vertexOffset += 2;\n }\n else {\n if (k > 1) {\n positionAttr.copy(vertexOffset, vertexOffset - 1);\n colorAttr.copy(vertexOffset, vertexOffset - 1);\n vertexOffset++;\n }\n }\n\n if (!this.useNativeLine) {\n if (k > 0) {\n var idx3 = this._triangleOffset * 3;\n var indices = this.indices;\n // 0-----2\n // 1-----3\n // 0->1->2, 1->3->2\n indices[idx3] = vertexOffset - 4;\n indices[idx3 + 1] = vertexOffset - 3;\n indices[idx3 + 2] = vertexOffset - 2;\n\n indices[idx3 + 3] = vertexOffset - 3;\n indices[idx3 + 4] = vertexOffset - 1;\n indices[idx3 + 5] = vertexOffset - 2;\n\n this._triangleOffset += 2;\n }\n }\n else {\n colorAttr.set(vertexOffset, pointColor);\n positionAttr.set(vertexOffset, point);\n vertexOffset++;\n }\n }\n if (!this.useNativeLine) {\n var start = this._vertexOffset;\n var end = this._vertexOffset + pointsCount * 2;\n positionPrevAttr.copy(start, start + 2);\n positionPrevAttr.copy(start + 1, start + 3);\n positionNextAttr.copy(end - 1, end - 3);\n positionNextAttr.copy(end - 2, end - 4);\n }\n\n this._vertexOffset = vertexOffset;\n\n return this._vertexOffset;\n },\n\n /**\n * Set color of single line.\n */\n setItemColor: function (idx, color) {\n var startOffset = this._itemVertexOffsets[idx];\n var endOffset = idx < this._itemVertexOffsets.length - 1 ? this._itemVertexOffsets[idx + 1] : this._vertexOffset;\n\n for (var i = startOffset; i < endOffset; i++) {\n this.attributes.color.set(i, color);\n }\n this.dirty('color');\n },\n\n /**\n * @return {number}\n */\n currentTriangleOffset: function () {\n return this._triangleOffset;\n },\n\n /**\n * @return {number}\n */\n currentVertexOffset: function () {\n return this._vertexOffset;\n }\n});\n\necharts.util.defaults(LinesGeometry.prototype, dynamicConvertMixin);\n\nexport default LinesGeometry;","/**\n * Texture Atlas for the sprites.\n * It uses zrender for 2d element management and rendering\n * @module echarts-gl/util/ZRTextureAtlasSurface\n */\n\n// TODO Expand.\nimport * as echarts from 'echarts/lib/echarts';\nimport Texture2D from 'claygl/src/Texture2D';\n\nfunction ZRTextureAtlasSurfaceNode(zr, offsetX, offsetY, width, height, gap, dpr) {\n this._zr = zr;\n\n /**\n * Current cursor x\n * @type {number}\n * @private\n */\n this._x = 0;\n\n /**\n * Current cursor y\n * @type {number}\n */\n this._y = 0;\n\n this._rowHeight = 0;\n /**\n * width without dpr.\n * @type {number}\n * @private\n */\n this.width = width;\n\n /**\n * height without dpr.\n * @type {number}\n * @private\n */\n this.height = height;\n\n /**\n * offsetX without dpr\n * @type {number}\n */\n this.offsetX = offsetX;\n /**\n * offsetY without dpr\n * @type {number}\n */\n this.offsetY = offsetY;\n\n this.dpr = dpr;\n\n this.gap = gap;\n}\n\nZRTextureAtlasSurfaceNode.prototype = {\n\n constructor: ZRTextureAtlasSurfaceNode,\n\n clear: function () {\n this._x = 0;\n this._y = 0;\n this._rowHeight = 0;\n },\n\n /**\n * Add shape to atlas\n * @param {module:zrender/graphic/Displayable} shape\n * @param {number} width\n * @param {number} height\n * @return {Array}\n */\n add: function (el, width, height) {\n // FIXME Text element not consider textAlign and textVerticalAlign.\n\n // TODO, inner text, shadow\n var rect = el.getBoundingRect();\n\n // FIXME aspect ratio\n if (width == null) {\n width = rect.width;\n }\n if (height == null) {\n height = rect.height;\n }\n width *= this.dpr;\n height *= this.dpr;\n\n this._fitElement(el, width, height);\n\n // var aspect = el.scale[1] / el.scale[0];\n // Adjust aspect ratio to make the text more clearly\n // FIXME If height > width, width is useless ?\n // width = height * aspect;\n // el.position[0] *= aspect;\n // el.scale[0] = el.scale[1];\n\n var x = this._x;\n var y = this._y;\n\n var canvasWidth = this.width * this.dpr;\n var canvasHeight = this.height * this.dpr;\n var gap = this.gap;\n\n if (x + width + gap > canvasWidth) {\n // Change a new row\n x = this._x = 0;\n y += this._rowHeight + gap;\n this._y = y;\n // Reset row height\n this._rowHeight = 0;\n }\n\n this._x += width + gap;\n\n this._rowHeight = Math.max(this._rowHeight, height);\n\n if (y + height + gap > canvasHeight) {\n // There is no space anymore\n return null;\n }\n\n // Shift the el\n el.x += this.offsetX * this.dpr + x;\n el.y += this.offsetY * this.dpr + y;\n\n this._zr.add(el);\n\n var coordsOffset = [\n this.offsetX / this.width,\n this.offsetY / this.height\n ];\n var coords = [\n [x / canvasWidth + coordsOffset[0], y / canvasHeight + coordsOffset[1]],\n [(x + width) / canvasWidth + coordsOffset[0], (y + height) / canvasHeight + coordsOffset[1]]\n ];\n\n return coords;\n },\n\n /**\n * Fit element size by correct its position and scaling\n * @param {module:zrender/graphic/Displayable} el\n * @param {number} spriteWidth\n * @param {number} spriteHeight\n */\n _fitElement: function (el, spriteWidth, spriteHeight) {\n // TODO, inner text, shadow\n var rect = el.getBoundingRect();\n\n var scaleX = spriteWidth / rect.width;\n var scaleY = spriteHeight / rect.height;\n el.x = -rect.x * scaleX;\n el.y = -rect.y * scaleY;\n el.scaleX = scaleX;\n el.scaleY = scaleY;\n el.update();\n }\n}\n/**\n * constructor\n * @alias module:echarts-gl/util/ZRTextureAtlasSurface\n * @param {number} opt.width\n * @param {number} opt.height\n * @param {number} opt.devicePixelRatio\n * @param {number} opt.gap Gap for safe.\n * @param {Function} opt.onupdate\n */\nfunction ZRTextureAtlasSurface (opt) {\n\n opt = opt || {};\n opt.width = opt.width || 512;\n opt.height = opt.height || 512;\n opt.devicePixelRatio = opt.devicePixelRatio || 1;\n opt.gap = opt.gap == null ? 2 : opt.gap;\n\n var canvas = document.createElement('canvas');\n canvas.width = opt.width * opt.devicePixelRatio;\n canvas.height = opt.height * opt.devicePixelRatio;\n\n this._canvas = canvas;\n\n this._texture = new Texture2D({\n image: canvas,\n flipY: false\n });\n\n var self = this;\n /**\n * zrender instance in the Chart\n * @type {zrender~ZRender}\n */\n this._zr = echarts.zrender.init(canvas);\n var oldRefreshImmediately = this._zr.refreshImmediately;\n this._zr.refreshImmediately = function () {\n oldRefreshImmediately.call(this);\n self._texture.dirty();\n self.onupdate && self.onupdate();\n };\n\n this._dpr = opt.devicePixelRatio;\n\n /**\n * Texture coords map for each sprite image\n * @type {Object}\n */\n this._coords = {};\n\n this.onupdate = opt.onupdate;\n\n this._gap = opt.gap;\n\n // Left sub atlas.\n this._textureAtlasNodes = [new ZRTextureAtlasSurfaceNode(\n this._zr, 0, 0, opt.width, opt.height, this._gap, this._dpr\n )];\n\n this._nodeWidth = opt.width;\n this._nodeHeight = opt.height;\n\n this._currentNodeIdx = 0;\n}\n\nZRTextureAtlasSurface.prototype = {\n\n /**\n * Clear the texture atlas\n */\n clear: function () {\n\n for (var i = 0; i < this._textureAtlasNodes.length; i++) {\n this._textureAtlasNodes[i].clear();\n }\n\n this._currentNodeIdx = 0;\n\n this._zr.clear();\n this._coords = {};\n },\n\n /**\n * @return {number}\n */\n getWidth: function () {\n return this._width;\n },\n\n /**\n * @return {number}\n */\n getHeight: function () {\n return this._height;\n },\n\n /**\n * @return {number}\n */\n getTexture: function () {\n return this._texture;\n },\n\n /**\n * @return {number}\n */\n getDevicePixelRatio: function () {\n return this._dpr;\n },\n\n getZr: function () {\n return this._zr;\n },\n\n _getCurrentNode: function () {\n return this._textureAtlasNodes[this._currentNodeIdx];\n },\n\n _expand: function () {\n this._currentNodeIdx++;\n if (this._textureAtlasNodes[this._currentNodeIdx]) {\n // Use the node created previously.\n return this._textureAtlasNodes[this._currentNodeIdx];\n }\n\n var maxSize = 4096 / this._dpr;\n var textureAtlasNodes = this._textureAtlasNodes;\n var nodeLen = textureAtlasNodes.length;\n var offsetX = (nodeLen * this._nodeWidth) % maxSize;\n var offsetY = Math.floor(nodeLen * this._nodeWidth / maxSize) * this._nodeHeight;\n if (offsetY >= maxSize) {\n // Failed if image is too large.\n if (process.env.NODE_ENV !== 'production') {\n console.error('Too much labels. Some will be ignored.');\n }\n return;\n }\n\n var width = (offsetX + this._nodeWidth) * this._dpr;\n var height = (offsetY + this._nodeHeight) * this._dpr;\n try {\n // Resize will error in node.\n this._zr.resize({\n width: width,\n height: height\n });\n }\n catch (e) {\n this._canvas.width = width;\n this._canvas.height = height;\n }\n\n var newNode = new ZRTextureAtlasSurfaceNode(\n this._zr, offsetX, offsetY, this._nodeWidth, this._nodeHeight, this._gap, this._dpr\n );\n this._textureAtlasNodes.push(newNode);\n\n return newNode;\n },\n\n add: function (el, width, height) {\n if (this._coords[el.id]) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Element already been add');\n }\n return this._coords[el.id];\n }\n var coords = this._getCurrentNode().add(el, width, height);\n if (!coords) {\n var newNode = this._expand();\n if (!newNode) {\n // To maximum\n return;\n }\n coords = newNode.add(el, width, height);\n }\n\n this._coords[el.id] = coords;\n\n return coords;\n },\n\n /**\n * Get coord scale after texture atlas is expanded.\n * @return {Array.}\n */\n getCoordsScale: function () {\n var dpr = this._dpr;\n return [this._nodeWidth / this._canvas.width * dpr, this._nodeHeight / this._canvas.height * dpr];\n },\n\n /**\n * Get texture coords of sprite image\n * @param {string} id Image id\n * @return {Array}\n */\n getCoords: function (id) {\n return this._coords[id];\n },\n\n dispose: function () {\n this._zr.dispose();\n }\n};\n\nexport default ZRTextureAtlasSurface;","import graphicGL from '../../util/graphicGL';\nimport Skybox from 'claygl/src/plugin/Skybox';\nimport * as echarts from 'echarts/lib/echarts';\n\nfunction SceneHelper() {\n}\n\nSceneHelper.prototype = {\n constructor: SceneHelper,\n\n setScene: function (scene) {\n this._scene = scene;\n\n if (this._skybox) {\n this._skybox.attachScene(this._scene);\n }\n },\n\n initLight: function (rootNode) {\n this._lightRoot = rootNode;\n /**\n * @type {clay.light.Directional}\n */\n this.mainLight = new graphicGL.DirectionalLight({\n shadowBias: 0.005\n });\n\n /**\n * @type {clay.light.Ambient}\n */\n this.ambientLight = new graphicGL.AmbientLight();\n\n rootNode.add(this.mainLight);\n rootNode.add(this.ambientLight);\n },\n\n dispose: function () {\n if (this._lightRoot) {\n this._lightRoot.remove(this.mainLight);\n this._lightRoot.remove(this.ambientLight);\n }\n },\n\n updateLight: function (componentModel) {\n\n var mainLight = this.mainLight;\n var ambientLight = this.ambientLight;\n\n var lightModel = componentModel.getModel('light');\n var mainLightModel = lightModel.getModel('main');\n var ambientLightModel = lightModel.getModel('ambient');\n\n mainLight.intensity = mainLightModel.get('intensity');\n ambientLight.intensity = ambientLightModel.get('intensity');\n mainLight.color = graphicGL.parseColor(mainLightModel.get('color')).slice(0, 3);\n ambientLight.color = graphicGL.parseColor(ambientLightModel.get('color')).slice(0, 3);\n\n var alpha = mainLightModel.get('alpha') || 0;\n var beta = mainLightModel.get('beta') || 0;\n mainLight.position.setArray(graphicGL.directionFromAlphaBeta(alpha, beta));\n mainLight.lookAt(graphicGL.Vector3.ZERO);\n\n mainLight.castShadow = mainLightModel.get('shadow');\n mainLight.shadowResolution = graphicGL.getShadowResolution(mainLightModel.get('shadowQuality'));\n },\n\n updateAmbientCubemap: function (renderer, componentModel, api) {\n var ambientCubemapModel = componentModel.getModel('light.ambientCubemap');\n\n var textureUrl = ambientCubemapModel.get('texture');\n if (textureUrl) {\n this._cubemapLightsCache = this._cubemapLightsCache || {};\n var lights = this._cubemapLightsCache[textureUrl];\n if (!lights) {\n var self = this;\n lights = this._cubemapLightsCache[textureUrl]\n = graphicGL.createAmbientCubemap(ambientCubemapModel.option, renderer, api, function () {\n // Use prefitered cubemap\n if (self._isSkyboxFromAmbientCubemap) {\n self._skybox.setEnvironmentMap(lights.specular.cubemap);\n }\n\n api.getZr().refresh();\n });\n }\n this._lightRoot.add(lights.diffuse);\n this._lightRoot.add(lights.specular);\n\n this._currentCubemapLights = lights;\n }\n else if (this._currentCubemapLights) {\n this._lightRoot.remove(this._currentCubemapLights.diffuse);\n this._lightRoot.remove(this._currentCubemapLights.specular);\n this._currentCubemapLights = null;\n }\n },\n\n updateSkybox: function (renderer, componentModel, api) {\n var environmentUrl = componentModel.get('environment');\n\n var self = this;\n function getSkybox() {\n self._skybox = self._skybox || new Skybox();\n return self._skybox;\n }\n\n var skybox = getSkybox();\n if (environmentUrl && environmentUrl !== 'none') {\n if (environmentUrl === 'auto') {\n this._isSkyboxFromAmbientCubemap = true;\n // Use environment in ambient cubemap\n if (this._currentCubemapLights) {\n var cubemap = this._currentCubemapLights.specular.cubemap;\n skybox.setEnvironmentMap(cubemap);\n if (this._scene) {\n skybox.attachScene(this._scene);\n }\n skybox.material.set('lod', 3);\n }\n else if (this._skybox) {\n this._skybox.detachScene();\n }\n }\n // Is gradient or color string\n else if ((typeof environmentUrl === 'object' && environmentUrl.colorStops)\n || (typeof environmentUrl === 'string' && echarts.color.parse(environmentUrl))\n ) {\n this._isSkyboxFromAmbientCubemap = false;\n var texture = new graphicGL.Texture2D({\n anisotropic: 8,\n flipY: false\n });\n skybox.setEnvironmentMap(texture);\n var canvas = texture.image = document.createElement('canvas');\n canvas.width = canvas.height = 16;\n var ctx = canvas.getContext('2d');\n var rect = new echarts.graphic.Rect({\n shape: { x: 0, y: 0, width: 16, height: 16 },\n style: { fill: environmentUrl }\n });\n echarts.innerDrawElementOnCanvas(ctx, rect);\n\n skybox.attachScene(this._scene);\n }\n else {\n this._isSkyboxFromAmbientCubemap = false;\n // Panorama\n var texture = graphicGL.loadTexture(environmentUrl, api, {\n anisotropic: 8,\n flipY: false\n });\n skybox.setEnvironmentMap(texture);\n\n skybox.attachScene(this._scene);\n }\n }\n else {\n if (this._skybox) {\n this._skybox.detachScene(this._scene);\n }\n this._skybox = null;\n }\n\n var coordSys = componentModel.coordinateSystem;\n if (this._skybox) {\n if (coordSys && coordSys.viewGL\n && environmentUrl !== 'auto'\n && !(environmentUrl.match && environmentUrl.match(/.hdr$/))\n ) {\n var srgbDefineMethod = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._skybox.material[srgbDefineMethod]('fragment', 'SRGB_DECODE');\n }\n else {\n this._skybox.material.undefine('fragment', 'SRGB_DECODE');\n }\n // var ambientCubemapUrl = environmentUrl === 'auto'\n // ? componentModel.get('light.ambientCubemap.texture')\n // : environmentUrl;\n }\n }\n};\n\nexport default SceneHelper;","/**\n * @module echarts-gl/util/geometry/QuadsGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\nimport dynamicConvertMixin from './dynamicConvertMixin';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\n/**\n * @constructor\n * @alias module:echarts-gl/util/geometry/QuadsGeometry\n * @extends clay.Geometry\n */\n\nvar QuadsGeometry = Geometry.extend(function () {\n return {\n\n segmentScale: 1,\n\n /**\n * Need to use mesh to expand lines if lineWidth > MAX_LINE_WIDTH\n */\n useNativeLine: true,\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION'),\n normal: new Geometry.Attribute('normal', 'float', 3, 'NORMAL'),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR')\n }\n };\n},\n/** @lends module: echarts-gl/util/geometry/QuadsGeometry.prototype */\n{\n\n /**\n * Reset offset\n */\n resetOffset: function () {\n this._vertexOffset = 0;\n this._faceOffset = 0;\n },\n\n /**\n * @param {number} nQuad\n */\n setQuadCount: function (nQuad) {\n var attributes = this.attributes;\n var vertexCount = this.getQuadVertexCount() * nQuad;\n var triangleCount = this.getQuadTriangleCount() * nQuad;\n if (this.vertexCount !== vertexCount) {\n attributes.position.init(vertexCount);\n attributes.normal.init(vertexCount);\n attributes.color.init(vertexCount);\n }\n if (this.triangleCount !== triangleCount) {\n this.indices = vertexCount > 0xffff ? new Uint32Array(triangleCount * 3) : new Uint16Array(triangleCount * 3);\n }\n },\n\n getQuadVertexCount: function () {\n return 4;\n },\n\n getQuadTriangleCount: function () {\n return 2;\n },\n\n /**\n * Add a quad, which in following order:\n * 0-----1\n * 3-----2\n */\n addQuad: (function () {\n var a = vec3.create();\n var b = vec3.create();\n var normal = vec3.create();\n var indices = [0, 3, 1, 3, 2, 1];\n return function (coords, color) {\n var positionAttr = this.attributes.position;\n var normalAttr = this.attributes.normal;\n var colorAttr = this.attributes.color;\n\n vec3.sub(a, coords[1], coords[0]);\n vec3.sub(b, coords[2], coords[1]);\n vec3.cross(normal, a, b);\n vec3.normalize(normal, normal);\n\n for (var i = 0; i < 4; i++) {\n positionAttr.set(this._vertexOffset + i, coords[i]);\n colorAttr.set(this._vertexOffset + i, color);\n normalAttr.set(this._vertexOffset + i, normal);\n }\n var idx = this._faceOffset * 3;\n for (var i = 0; i < 6; i++) {\n this.indices[idx + i] = indices[i] + this._vertexOffset;\n }\n this._vertexOffset += 4;\n this._faceOffset += 2;\n };\n })()\n});\n\necharts.util.defaults(QuadsGeometry.prototype, dynamicConvertMixin);\n\nexport default QuadsGeometry;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport QuadsGeometry from '../../util/geometry/Quads';\nvar firstNotNull = retrieve.firstNotNull;\n\nvar dimIndicesMap = {\n // Left to right\n x: 0,\n // Far to near\n y: 2,\n // Bottom to up\n z: 1\n};\n\nfunction updateFacePlane(node, plane, otherAxis, dir) {\n var coord = [0, 0, 0];\n var distance = dir < 0 ? otherAxis.getExtentMin() : otherAxis.getExtentMax();\n coord[dimIndicesMap[otherAxis.dim]] = distance;\n node.position.setArray(coord);\n node.rotation.identity();\n\n // Negative distance because on the opposite of normal direction.\n plane.distance = -Math.abs(distance);\n plane.normal.set(0, 0, 0);\n if (otherAxis.dim === 'x') {\n node.rotation.rotateY(dir * Math.PI / 2);\n plane.normal.x = -dir;\n }\n else if (otherAxis.dim === 'z') {\n node.rotation.rotateX(-dir * Math.PI / 2);\n plane.normal.y = -dir;\n }\n else {\n if (dir > 0) {\n node.rotation.rotateY(Math.PI);\n }\n plane.normal.z = -dir;\n }\n}\n\n\nfunction Grid3DFace(faceInfo, linesMaterial, quadsMaterial) {\n this.rootNode = new graphicGL.Node();\n\n var linesMesh = new graphicGL.Mesh({\n geometry: new Lines3DGeometry({ useNativeLine: false }),\n material: linesMaterial,\n castShadow: false,\n ignorePicking: true,\n $ignorePicking: true,\n renderOrder: 1\n });\n var quadsMesh = new graphicGL.Mesh({\n geometry: new QuadsGeometry(),\n material: quadsMaterial,\n castShadow: false,\n culling: false,\n ignorePicking: true,\n $ignorePicking: true,\n renderOrder: 0\n });\n // Quads are behind lines.\n this.rootNode.add(quadsMesh);\n this.rootNode.add(linesMesh);\n\n this.faceInfo = faceInfo;\n this.plane =new graphicGL.Plane();\n this.linesMesh =linesMesh;\n this.quadsMesh =quadsMesh;\n}\n\nGrid3DFace.prototype.update = function (grid3DModel, ecModel, api) {\n var cartesian = grid3DModel.coordinateSystem;\n var axes = [\n cartesian.getAxis(this.faceInfo[0]),\n cartesian.getAxis(this.faceInfo[1])\n ];\n var lineGeometry = this.linesMesh.geometry;\n var quadsGeometry = this.quadsMesh.geometry;\n\n lineGeometry.convertToDynamicArray(true);\n quadsGeometry.convertToDynamicArray(true);\n this._updateSplitLines(lineGeometry, axes, grid3DModel, api);\n this._udpateSplitAreas(quadsGeometry, axes, grid3DModel, api);\n lineGeometry.convertToTypedArray();\n quadsGeometry.convertToTypedArray();\n\n\n var otherAxis = cartesian.getAxis(this.faceInfo[2]);\n updateFacePlane(this.rootNode, this.plane, otherAxis, this.faceInfo[3]);\n};\n\nGrid3DFace.prototype._updateSplitLines = function (geometry, axes, grid3DModel, api) {\n var dpr = api.getDevicePixelRatio();\n axes.forEach(function (axis, idx) {\n var axisModel = axis.model;\n var otherExtent = axes[1 - idx].getExtent();\n\n if (axis.scale.isBlank()) {\n return;\n }\n\n var splitLineModel = axisModel.getModel('splitLine', grid3DModel.getModel('splitLine'));\n // Render splitLines\n if (splitLineModel.get('show')) {\n var lineStyleModel = splitLineModel.getModel('lineStyle');\n var lineColors = lineStyleModel.get('color');\n var opacity = firstNotNull(lineStyleModel.get('opacity'), 1.0);\n var lineWidth = firstNotNull(lineStyleModel.get('width'), 1.0);\n\n lineColors = echarts.util.isArray(lineColors) ? lineColors : [lineColors];\n\n var ticksCoords = axis.getTicksCoords({\n tickModel: splitLineModel\n });\n\n var count = 0;\n for (var i = 0; i < ticksCoords.length; i++) {\n var tickCoord = ticksCoords[i].coord;\n var lineColor = graphicGL.parseColor(lineColors[count % lineColors.length]);\n lineColor[3] *= opacity;\n\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n // 0 - x, 1 - y\n p0[idx] = p1[idx] = tickCoord;\n p0[1 - idx] = otherExtent[0];\n p1[1 - idx] = otherExtent[1];\n\n geometry.addLine(p0, p1, lineColor, lineWidth * dpr);\n\n count++;\n }\n }\n });\n};\n\nGrid3DFace.prototype._udpateSplitAreas = function (geometry, axes, grid3DModel, api) {\n axes.forEach(function (axis, idx) {\n var axisModel = axis.model;\n var otherExtent = axes[1 - idx].getExtent();\n\n if (axis.scale.isBlank()) {\n return;\n }\n\n var splitAreaModel = axisModel.getModel('splitArea', grid3DModel.getModel('splitArea'));\n // Render splitAreas\n if (splitAreaModel.get('show')) {\n var areaStyleModel = splitAreaModel.getModel('areaStyle');\n var colors = areaStyleModel.get('color');\n var opacity = firstNotNull(areaStyleModel.get('opacity'), 1.0);\n\n colors = echarts.util.isArray(colors) ? colors : [colors];\n\n var ticksCoords = axis.getTicksCoords({\n tickModel: splitAreaModel,\n clamp: true\n });\n\n var count = 0;\n var prevP0 = [0, 0, 0];\n var prevP1 = [0, 0, 0];\n // 0 - x, 1 - y\n for (var i = 0; i < ticksCoords.length; i++) {\n var tickCoord = ticksCoords[i].coord;\n\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n // 0 - x, 1 - y\n p0[idx] = p1[idx] = tickCoord;\n p0[1 - idx] = otherExtent[0];\n p1[1 - idx] = otherExtent[1];\n\n if (i === 0) {\n prevP0 = p0;\n prevP1 = p1;\n continue;\n }\n\n var color = graphicGL.parseColor(colors[count % colors.length]);\n color[3] *= opacity;\n geometry.addQuad([prevP0, p0, p1, prevP1], color);\n\n prevP0 = p0;\n prevP1 = p1;\n\n count++;\n }\n }\n });\n};\n\nexport default Grid3DFace;","/**\n * Geometry collecting sprites\n *\n * @module echarts-gl/util/geometry/Sprites\n * @author Yi Shen(https://github.com/pissang)\n */\nimport * as echarts from 'echarts/lib/echarts';\nimport Geometry from 'claygl/src/Geometry';\nimport dynamicConvertMixin from './dynamicConvertMixin';\n\nvar squareTriangles = [\n 0, 1, 2, 0, 2, 3\n];\n\nvar SpritesGeometry = Geometry.extend(function () {\n return {\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION'),\n texcoord: new Geometry.Attribute('texcoord', 'float', 2, 'TEXCOORD_0'),\n offset: new Geometry.Attribute('offset', 'float', 2),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR')\n }\n };\n}, {\n resetOffset: function () {\n this._vertexOffset = 0;\n this._faceOffset = 0;\n },\n setSpriteCount: function (spriteCount) {\n this._spriteCount = spriteCount;\n\n var vertexCount = spriteCount * 4;\n var triangleCount = spriteCount * 2;\n\n if (this.vertexCount !== vertexCount) {\n this.attributes.position.init(vertexCount);\n this.attributes.offset.init(vertexCount);\n this.attributes.color.init(vertexCount);\n }\n if (this.triangleCount !== triangleCount) {\n this.indices = vertexCount > 0xffff ? new Uint32Array(triangleCount * 3) : new Uint16Array(triangleCount * 3);\n }\n },\n\n setSpriteAlign: function (spriteOffset, size, align, verticalAlign, margin) {\n if (align == null) {\n align = 'left';\n }\n if (verticalAlign == null) {\n verticalAlign = 'top';\n }\n\n var leftOffset, topOffset, rightOffset, bottomOffset;\n margin = margin || 0;\n switch (align) {\n case 'left':\n leftOffset = margin;\n rightOffset = size[0] + margin;\n break;\n case 'center':\n case 'middle':\n leftOffset = -size[0] / 2;\n rightOffset = size[0] / 2;\n break;\n case 'right':\n leftOffset = -size[0] - margin;\n rightOffset = -margin;\n break;\n }\n switch (verticalAlign) {\n case 'bottom':\n topOffset = margin;\n bottomOffset = size[1] + margin;\n break;\n case 'middle':\n topOffset = -size[1] / 2;\n bottomOffset = size[1] / 2;\n break;\n case 'top':\n topOffset = -size[1] - margin;\n bottomOffset = -margin;\n break;\n }\n // 3----2\n // 0----1\n var vertexOffset = spriteOffset * 4;\n var offsetAttr = this.attributes.offset;\n offsetAttr.set(vertexOffset, [leftOffset, bottomOffset]);\n offsetAttr.set(vertexOffset + 1, [rightOffset, bottomOffset]);\n offsetAttr.set(vertexOffset + 2, [rightOffset, topOffset]);\n offsetAttr.set(vertexOffset + 3, [leftOffset, topOffset]);\n },\n /**\n * Add sprite\n * @param {Array.} position\n * @param {Array.} size [width, height]\n * @param {Array.} coords [leftBottom, rightTop]\n * @param {string} [align='left'] 'left' 'center' 'right'\n * @param {string} [verticalAlign='top'] 'top' 'middle' 'bottom'\n * @param {number} [screenMargin=0]\n */\n addSprite: function (position, size, coords, align, verticalAlign, screenMargin) {\n var vertexOffset = this._vertexOffset;\n this.setSprite(\n this._vertexOffset / 4, position, size, coords, align, verticalAlign, screenMargin\n )\n for (var i = 0; i < squareTriangles.length; i++) {\n this.indices[this._faceOffset * 3 + i] = squareTriangles[i] + vertexOffset;\n }\n this._faceOffset += 2;\n this._vertexOffset += 4;\n\n return vertexOffset / 4;\n },\n\n setSprite: function (spriteOffset, position, size, coords, align, verticalAlign, screenMargin) {\n var vertexOffset = spriteOffset * 4;\n\n var attributes = this.attributes;\n for (var i = 0; i < 4; i++) {\n attributes.position.set(vertexOffset + i, position);\n }\n // 3----2\n // 0----1\n var texcoordAttr = attributes.texcoord;\n\n texcoordAttr.set(vertexOffset, [coords[0][0], coords[0][1]]);\n texcoordAttr.set(vertexOffset + 1, [coords[1][0], coords[0][1]]);\n texcoordAttr.set(vertexOffset + 2, [coords[1][0], coords[1][1]]);\n texcoordAttr.set(vertexOffset + 3, [coords[0][0], coords[1][1]]);\n\n this.setSpriteAlign(spriteOffset, size, align, verticalAlign, screenMargin);\n }\n});\n\necharts.util.defaults(SpritesGeometry.prototype, dynamicConvertMixin);\n\nexport default SpritesGeometry;","export default \"@export ecgl.labels.vertex\\n\\nattribute vec3 position: POSITION;\\nattribute vec2 texcoord: TEXCOORD_0;\\nattribute vec2 offset;\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform vec4 viewport : VIEWPORT;\\n\\nvarying vec2 v_Texcoord;\\n\\nvoid main()\\n{\\n vec4 proj = worldViewProjection * vec4(position, 1.0);\\n\\n vec2 screen = (proj.xy / abs(proj.w) + 1.0) * 0.5 * viewport.zw;\\n\\n screen += offset;\\n\\n proj.xy = (screen / viewport.zw - 0.5) * 2.0 * abs(proj.w);\\n gl_Position = proj;\\n#ifdef VERTEX_COLOR\\n v_Color = a_Color;\\n#endif\\n v_Texcoord = texcoord;\\n}\\n@end\\n\\n\\n@export ecgl.labels.fragment\\n\\nuniform vec3 color : [1.0, 1.0, 1.0];\\nuniform float alpha : 1.0;\\nuniform sampler2D textureAtlas;\\nuniform vec2 uvScale: [1.0, 1.0];\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\nvarying float v_Miter;\\n\\nvarying vec2 v_Texcoord;\\n\\nvoid main()\\n{\\n gl_FragColor = vec4(color, alpha) * texture2D(textureAtlas, v_Texcoord * uvScale);\\n#ifdef VERTEX_COLOR\\n gl_FragColor *= v_Color;\\n#endif\\n}\\n\\n@end\";\n","import graphicGL from '../graphicGL';\nimport SpritesGeometry from '../geometry/Sprites';\n\nimport labelsGLSL from '../shader/labels.glsl.js';\ngraphicGL.Shader.import(labelsGLSL);\n\nexport default graphicGL.Mesh.extend(function () {\n var geometry = new SpritesGeometry({\n dynamic: true\n });\n var material = new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.labels'),\n transparent: true,\n depthMask: false\n });\n\n return {\n geometry: geometry,\n material: material,\n culling: false,\n castShadow: false,\n ignorePicking: true\n };\n});","import * as echarts from 'echarts/lib/echarts';\nimport {createTextStyle} from 'echarts/lib/label/labelStyle';\n\nimport graphicGL from '../../util/graphicGL';\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport retrieve from '../../util/retrieve';\nimport LabelsMesh from '../../util/mesh/LabelsMesh';\n\nvar firstNotNull = retrieve.firstNotNull;\n\nvar dimIndicesMap = {\n // Left to right\n x: 0,\n // Far to near\n y: 2,\n // Bottom to up\n z: 1\n};\n\nfunction Grid3DAxis(dim, linesMaterial) {\n var linesMesh = new graphicGL.Mesh({\n geometry: new Lines3DGeometry({ useNativeLine: false }),\n material: linesMaterial,\n castShadow: false,\n ignorePicking: true, renderOrder: 2\n });\n var axisLabelsMesh = new LabelsMesh();\n axisLabelsMesh.material.depthMask = false;\n\n var rootNode = new graphicGL.Node();\n rootNode.add(linesMesh);\n rootNode.add(axisLabelsMesh);\n\n this.rootNode = rootNode;\n this.dim = dim;\n\n this.linesMesh = linesMesh;\n this.labelsMesh = axisLabelsMesh;\n this.axisLineCoords = null;\n this.labelElements = [];\n}\n\nvar otherDim = {\n x: 'y', y: 'x', z: 'y'\n};\nGrid3DAxis.prototype.update = function (\n grid3DModel, axisLabelSurface, api\n) {\n var cartesian = grid3DModel.coordinateSystem;\n var axis = cartesian.getAxis(this.dim);\n\n var linesGeo = this.linesMesh.geometry;\n var labelsGeo = this.labelsMesh.geometry;\n linesGeo.convertToDynamicArray(true);\n labelsGeo.convertToDynamicArray(true);\n var axisModel = axis.model;\n var extent = axis.getExtent();\n\n var dpr = api.getDevicePixelRatio();\n var axisLineModel = axisModel.getModel('axisLine', grid3DModel.getModel('axisLine'));\n var axisTickModel = axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));\n var axisLabelModel = axisModel.getModel('axisLabel', grid3DModel.getModel('axisLabel'));\n var axisLineColor = axisLineModel.get('lineStyle.color');\n // Render axisLine\n if (axisLineModel.get('show')) {\n var axisLineStyleModel = axisLineModel.getModel('lineStyle');\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n var idx = dimIndicesMap[axis.dim];\n p0[idx] = extent[0];\n p1[idx] = extent[1];\n\n // Save some useful info.\n this.axisLineCoords =[p0, p1];\n\n var color = graphicGL.parseColor(axisLineColor);\n var lineWidth = firstNotNull(axisLineStyleModel.get('width'), 1.0);\n var opacity = firstNotNull(axisLineStyleModel.get('opacity'), 1.0);\n color[3] *= opacity;\n linesGeo.addLine(p0, p1, color, lineWidth * dpr);\n }\n // Render axis ticksCoords\n if (axisTickModel.get('show')) {\n var lineStyleModel = axisTickModel.getModel('lineStyle');\n var lineColor = graphicGL.parseColor(\n firstNotNull(lineStyleModel.get('color'), axisLineColor)\n );\n var lineWidth = firstNotNull(lineStyleModel.get('width'), 1.0);\n lineColor[3] *= firstNotNull(lineStyleModel.get('opacity'), 1.0);\n var ticksCoords = axis.getTicksCoords();\n var tickLength = axisTickModel.get('length');\n\n for (var i = 0; i < ticksCoords.length; i++) {\n var tickCoord = ticksCoords[i].coord;\n\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n var idx = dimIndicesMap[axis.dim];\n var otherIdx = dimIndicesMap[otherDim[axis.dim]];\n // 0 : x, 1 : y\n p0[idx] = p1[idx] = tickCoord;\n p1[otherIdx] = tickLength;\n\n linesGeo.addLine(p0, p1, lineColor, lineWidth * dpr);\n }\n }\n\n this.labelElements = [];\n var dpr = api.getDevicePixelRatio();\n if (axisLabelModel.get('show')) {\n var ticksCoords = axis.getTicksCoords();\n var categoryData = axisModel.get('data');\n\n var labelMargin = axisLabelModel.get('margin');\n var labels = axis.getViewLabels();\n\n for (var i = 0; i < labels.length; i++) {\n var tickValue = labels[i].tickValue;\n var formattedLabel = labels[i].formattedLabel;\n var rawLabel = labels[i].rawLabel;\n\n var tickCoord = axis.dataToCoord(tickValue);\n\n var p = [0, 0, 0];\n var idx = dimIndicesMap[axis.dim];\n var otherIdx = dimIndicesMap[otherDim[axis.dim]];\n // 0 : x, 1 : y\n p[idx] = p[idx] = tickCoord;\n p[otherIdx] = labelMargin;\n\n var itemTextStyleModel = axisLabelModel;\n if (categoryData && categoryData[tickValue] && categoryData[tickValue].textStyle) {\n itemTextStyleModel = new echarts.Model(\n categoryData[tickValue].textStyle, axisLabelModel, axisModel.ecModel\n );\n }\n var textColor = firstNotNull(itemTextStyleModel.get('color'), axisLineColor);\n\n var textEl = new echarts.graphic.Text({\n style: createTextStyle(itemTextStyleModel, {\n text: formattedLabel,\n fill: typeof textColor === 'function'\n ? textColor(\n // (1) In category axis with data zoom, tick is not the original\n // index of axis.data. So tick should not be exposed to user\n // in category axis.\n // (2) Compatible with previous version, which always returns labelStr.\n // But in interval scale labelStr is like '223,445', which maked\n // user repalce ','. So we modify it to return original val but remain\n // it as 'string' to avoid error in replacing.\n axis.type === 'category' ? rawLabel : axis.type === 'value' ? tickValue + '' : tickValue,\n i\n )\n : textColor,\n verticalAlign: 'top',\n align: 'left'\n })\n });\n\n var coords = axisLabelSurface.add(textEl);\n var rect = textEl.getBoundingRect();\n labelsGeo.addSprite(p, [rect.width * dpr, rect.height * dpr], coords);\n\n this.labelElements.push(textEl);\n }\n }\n\n if (axisModel.get('name')) {\n var nameTextStyleModel = axisModel.getModel('nameTextStyle');\n var p = [0, 0, 0];\n var idx = dimIndicesMap[axis.dim];\n var otherIdx = dimIndicesMap[otherDim[axis.dim]];\n var labelColor = firstNotNull(nameTextStyleModel.get('color'), axisLineColor);\n var strokeColor = nameTextStyleModel.get('borderColor');\n var lineWidth = nameTextStyleModel.get('borderWidth');\n // TODO start and end\n p[idx] = p[idx] = (extent[0] + extent[1]) / 2;\n p[otherIdx] = axisModel.get('nameGap');\n\n var textEl = new echarts.graphic.Text({\n style: createTextStyle(nameTextStyleModel, {\n text: axisModel.get('name'),\n fill: labelColor,\n stroke: strokeColor,\n lineWidth: lineWidth\n })\n });\n\n var coords = axisLabelSurface.add(textEl);\n var rect = textEl.getBoundingRect();\n labelsGeo.addSprite(p, [rect.width * dpr, rect.height * dpr], coords);\n\n textEl.__idx = this.labelElements.length;\n this.nameLabelElement = textEl;\n }\n\n this.labelsMesh.material.set('textureAtlas', axisLabelSurface.getTexture());\n this.labelsMesh.material.set('uvScale', axisLabelSurface.getCoordsScale());\n\n linesGeo.convertToTypedArray();\n labelsGeo.convertToTypedArray();\n};\n\nGrid3DAxis.prototype.setSpriteAlign = function (textAlign, textVerticalAlign, api) {\n var dpr = api.getDevicePixelRatio();\n var labelGeo = this.labelsMesh.geometry;\n for (var i = 0; i < this.labelElements.length; i++) {\n var labelEl = this.labelElements[i];\n var rect = labelEl.getBoundingRect();\n\n labelGeo.setSpriteAlign(i, [rect.width * dpr, rect.height * dpr], textAlign, textVerticalAlign);\n }\n // name label\n var nameLabelEl = this.nameLabelElement;\n if (nameLabelEl) {\n var rect = nameLabelEl.getBoundingRect();\n labelGeo.setSpriteAlign(nameLabelEl.__idx, [rect.width * dpr, rect.height * dpr], textAlign, textVerticalAlign);\n labelGeo.dirty();\n }\n\n this.textAlign = textAlign;\n this.textVerticalAlign = textVerticalAlign;\n};\n\nexport default Grid3DAxis;","export default \"@export ecgl.lines3D.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nattribute vec3 position: POSITION;\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n\\nvoid main()\\n{\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n v_Color = a_Color;\\n}\\n\\n@end\\n\\n@export ecgl.lines3D.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nvarying vec4 v_Color;\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color * v_Color);\\n#else\\n gl_FragColor = color * v_Color;\\n#endif\\n}\\n@end\\n\\n\\n\\n@export ecgl.lines3D.clipNear\\n\\nvec4 clipNear(vec4 p1, vec4 p2) {\\n float n = (p1.w - near) / (p1.w - p2.w);\\n return vec4(mix(p1.xy, p2.xy, n), -near, near);\\n}\\n\\n@end\\n\\n@export ecgl.lines3D.expandLine\\n#ifdef VERTEX_ANIMATION\\n vec4 prevProj = worldViewProjection * vec4(mix(prevPositionPrev, positionPrev, percent), 1.0);\\n vec4 currProj = worldViewProjection * vec4(mix(prevPosition, position, percent), 1.0);\\n vec4 nextProj = worldViewProjection * vec4(mix(prevPositionNext, positionNext, percent), 1.0);\\n#else\\n vec4 prevProj = worldViewProjection * vec4(positionPrev, 1.0);\\n vec4 currProj = worldViewProjection * vec4(position, 1.0);\\n vec4 nextProj = worldViewProjection * vec4(positionNext, 1.0);\\n#endif\\n\\n if (currProj.w < 0.0) {\\n if (nextProj.w > 0.0) {\\n currProj = clipNear(currProj, nextProj);\\n }\\n else if (prevProj.w > 0.0) {\\n currProj = clipNear(currProj, prevProj);\\n }\\n }\\n\\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\\n\\n vec2 dir;\\n float len = offset;\\n if (position == positionPrev) {\\n dir = normalize(nextScreen - currScreen);\\n }\\n else if (position == positionNext) {\\n dir = normalize(currScreen - prevScreen);\\n }\\n else {\\n vec2 dirA = normalize(currScreen - prevScreen);\\n vec2 dirB = normalize(nextScreen - currScreen);\\n\\n vec2 tanget = normalize(dirA + dirB);\\n\\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\\n len *= miter;\\n dir = tanget;\\n }\\n\\n dir = vec2(-dir.y, dir.x) * len;\\n currScreen += dir;\\n\\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\\n@end\\n\\n\\n@export ecgl.meshLines3D.vertex\\n\\nattribute vec3 position: POSITION;\\nattribute vec3 positionPrev;\\nattribute vec3 positionNext;\\nattribute float offset;\\nattribute vec4 a_Color : COLOR;\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nattribute vec3 prevPositionPrev;\\nattribute vec3 prevPositionNext;\\nuniform float percent : 1.0;\\n#endif\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform vec4 viewport : VIEWPORT;\\nuniform float near : NEAR;\\n\\nvarying vec4 v_Color;\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n@import ecgl.lines3D.clipNear\\n\\nvoid main()\\n{\\n @import ecgl.lines3D.expandLine\\n\\n gl_Position = currProj;\\n\\n v_Color = a_Color;\\n\\n @import ecgl.common.wireframe.vertexMain\\n}\\n@end\\n\\n\\n@export ecgl.meshLines3D.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nvarying vec4 v_Color;\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color * v_Color);\\n#else\\n gl_FragColor = color * v_Color;\\n#endif\\n\\n @import ecgl.common.wireframe.fragmentMain\\n}\\n\\n@end\";\n","// TODO orthographic camera\n\nimport * as echarts from 'echarts/lib/echarts';\nimport {createTextStyle} from 'echarts/lib/label/labelStyle';\nimport graphicGL from '../../util/graphicGL';\nimport OrbitControl from '../../util/OrbitControl';\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport retrieve from '../../util/retrieve';\nvar firstNotNull = retrieve.firstNotNull;\nimport ZRTextureAtlasSurface from '../../util/ZRTextureAtlasSurface';\nimport SceneHelper from '../common/SceneHelper';\nimport Grid3DFace from './Grid3DFace';\nimport Grid3DAxis from './Grid3DAxis';\nimport LabelsMesh from '../../util/mesh/LabelsMesh';\n\nimport lines3DGLSL from '../../util/shader/lines3D.glsl.js';\ngraphicGL.Shader.import(lines3DGLSL);\n\nvar dimIndicesMap = {\n // Left to right\n x: 0,\n // Far to near\n y: 2,\n // Bottom to up\n z: 1\n};\n\nexport default echarts.ComponentView.extend({\n\n type: 'grid3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n var FACES = [\n // planeDim0, planeDim1, offsetDim, dir on dim3 axis(gl), plane.\n ['y', 'z', 'x', -1, 'left'],\n ['y', 'z', 'x', 1, 'right'],\n ['x', 'y', 'z', -1, 'bottom'],\n ['x', 'y','z', 1, 'top'],\n ['x', 'z', 'y', -1, 'far'],\n ['x', 'z','y', 1, 'near']\n ];\n\n var DIMS = ['x', 'y', 'z'];\n\n var quadsMaterial = new graphicGL.Material({\n // transparent: true,\n shader: graphicGL.createShader('ecgl.color'),\n depthMask: false,\n transparent: true\n });\n var linesMaterial = new graphicGL.Material({\n // transparent: true,\n shader: graphicGL.createShader('ecgl.meshLines3D'),\n depthMask: false,\n transparent: true\n });\n quadsMaterial.define('fragment', 'DOUBLE_SIDED');\n quadsMaterial.define('both', 'VERTEX_COLOR');\n\n this.groupGL = new graphicGL.Node();\n\n this._control = new OrbitControl({\n zr: api.getZr()\n });\n this._control.init();\n\n // Save mesh and other infos for each face.\n this._faces = FACES.map(function (faceInfo) {\n var face = new Grid3DFace(faceInfo, linesMaterial, quadsMaterial);\n this.groupGL.add(face.rootNode);\n return face;\n }, this);\n\n // Save mesh and other infos for each axis.\n this._axes = DIMS.map(function (dim) {\n var axis = new Grid3DAxis(dim, linesMaterial);\n this.groupGL.add(axis.rootNode);\n return axis;\n }, this);\n\n var dpr = api.getDevicePixelRatio();\n // Texture surface for label.\n this._axisLabelSurface = new ZRTextureAtlasSurface({\n width: 256, height: 256,\n devicePixelRatio: dpr\n });\n this._axisLabelSurface.onupdate = function () {\n api.getZr().refresh();\n };\n\n this._axisPointerLineMesh = new graphicGL.Mesh({\n geometry: new Lines3DGeometry({ useNativeLine: false }),\n material: linesMaterial,\n castShadow: false,\n // PENDING\n ignorePicking: true,\n renderOrder: 3\n });\n this.groupGL.add(this._axisPointerLineMesh);\n\n this._axisPointerLabelsSurface = new ZRTextureAtlasSurface({\n width: 128, height: 128,\n devicePixelRatio: dpr\n });\n this._axisPointerLabelsMesh = new LabelsMesh({\n ignorePicking: true, renderOrder: 4,\n castShadow: false\n });\n this._axisPointerLabelsMesh.material.set('textureAtlas', this._axisPointerLabelsSurface.getTexture());\n this.groupGL.add(this._axisPointerLabelsMesh);\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper();\n this._sceneHelper.initLight(this._lightRoot);\n },\n\n render: function (grid3DModel, ecModel, api) {\n\n this._model = grid3DModel;\n this._api = api;\n\n var cartesian = grid3DModel.coordinateSystem;\n\n // Always have light.\n cartesian.viewGL.add(this._lightRoot);\n\n if (grid3DModel.get('show')) {\n cartesian.viewGL.add(this.groupGL);\n }\n else {\n cartesian.viewGL.remove(this.groupGL);\n }\n\n // cartesian.viewGL.setCameraType(grid3DModel.get('viewControl.projection'));\n\n var control = this._control;\n control.setViewGL(cartesian.viewGL);\n\n var viewControlModel = grid3DModel.getModel('viewControl');\n control.setFromViewControlModel(viewControlModel, 0);\n\n this._axisLabelSurface.clear();\n\n control.off('update');\n if (grid3DModel.get('show')) {\n this._faces.forEach(function (face) {\n face.update(grid3DModel, ecModel, api);\n }, this);\n this._axes.forEach(function (axis) {\n axis.update(grid3DModel, this._axisLabelSurface, api);\n }, this);\n }\n\n control.on('update', this._onCameraChange.bind(this, grid3DModel, api), this);\n\n this._sceneHelper.setScene(cartesian.viewGL.scene);\n this._sceneHelper.updateLight(grid3DModel);\n\n // Set post effect\n cartesian.viewGL.setPostEffect(grid3DModel.getModel('postEffect'), api);\n cartesian.viewGL.setTemporalSuperSampling(grid3DModel.getModel('temporalSuperSampling'));\n\n this._initMouseHandler(grid3DModel);\n },\n\n afterRender: function (grid3DModel, ecModel, api, layerGL) {\n // Create ambient cubemap after render because we need to know the renderer.\n // TODO\n var renderer = layerGL.renderer;\n\n this._sceneHelper.updateAmbientCubemap(renderer, grid3DModel, api);\n\n this._sceneHelper.updateSkybox(renderer, grid3DModel, api);\n },\n\n /**\n * showAxisPointer will be triggered by action.\n */\n showAxisPointer: function (grid3dModel, ecModel, api, payload) {\n this._doShowAxisPointer();\n this._updateAxisPointer(payload.value);\n },\n\n /**\n * hideAxisPointer will be triggered by action.\n */\n hideAxisPointer: function (grid3dModel, ecModel, api, payload) {\n this._doHideAxisPointer();\n },\n\n _initMouseHandler: function (grid3DModel) {\n var cartesian = grid3DModel.coordinateSystem;\n var viewGL = cartesian.viewGL;\n\n // TODO xAxis3D.axisPointer.show ?\n if (grid3DModel.get('show') && grid3DModel.get('axisPointer.show')) {\n viewGL.on('mousemove', this._updateAxisPointerOnMousePosition, this);\n }\n else {\n viewGL.off('mousemove', this._updateAxisPointerOnMousePosition);\n }\n },\n\n /**\n * Try find and show axisPointer on the intersect point\n * of mouse ray with grid plane.\n */\n _updateAxisPointerOnMousePosition: function (e) {\n // Ignore if mouse is on the element.\n if (e.target) {\n return;\n }\n var grid3DModel = this._model;\n var cartesian = grid3DModel.coordinateSystem;\n var viewGL = cartesian.viewGL;\n\n var ray = viewGL.castRay(e.offsetX, e.offsetY, new graphicGL.Ray());\n\n var nearestIntersectPoint;\n for (var i = 0; i < this._faces.length; i++) {\n var face = this._faces[i];\n if (face.rootNode.invisible) {\n continue;\n }\n\n // Plane is not face the camera. flip it\n if (face.plane.normal.dot(viewGL.camera.worldTransform.z) < 0) {\n face.plane.normal.negate();\n }\n\n var point = ray.intersectPlane(face.plane);\n if (!point) {\n continue;\n }\n var axis0 = cartesian.getAxis(face.faceInfo[0]);\n var axis1 = cartesian.getAxis(face.faceInfo[1]);\n var idx0 = dimIndicesMap[face.faceInfo[0]];\n var idx1 = dimIndicesMap[face.faceInfo[1]];\n if (axis0.contain(point.array[idx0]) && axis1.contain(point.array[idx1])) {\n nearestIntersectPoint = point;\n }\n }\n\n if (nearestIntersectPoint) {\n var data = cartesian.pointToData(nearestIntersectPoint.array, [], true);\n this._updateAxisPointer(data);\n\n this._doShowAxisPointer();\n }\n else {\n this._doHideAxisPointer();\n }\n },\n\n _onCameraChange: function (grid3DModel, api) {\n\n if (grid3DModel.get('show')) {\n this._updateFaceVisibility();\n this._updateAxisLinePosition();\n }\n\n var control = this._control;\n\n api.dispatchAction({\n type: 'grid3DChangeCamera',\n alpha: control.getAlpha(),\n beta: control.getBeta(),\n distance: control.getDistance(),\n center: control.getCenter(),\n from: this.uid,\n grid3DId: grid3DModel.id\n });\n },\n\n /**\n * Update visibility of each face when camera view changed, front face will be invisible.\n * @private\n */\n _updateFaceVisibility: function () {\n var camera = this._control.getCamera();\n var viewSpacePos = new graphicGL.Vector3();\n camera.update();\n for (var idx = 0; idx < this._faces.length / 2; idx++) {\n var depths = [];\n for (var k = 0; k < 2; k++) {\n var face = this._faces[idx * 2 + k];\n face.rootNode.getWorldPosition(viewSpacePos);\n viewSpacePos.transformMat4(camera.viewMatrix);\n depths[k] = viewSpacePos.z;\n }\n // Set the front face invisible\n var frontIndex = depths[0] > depths[1] ? 0 : 1;\n var frontFace = this._faces[idx * 2 + frontIndex];\n var backFace = this._faces[idx * 2 + 1 - frontIndex];\n // Update rotation.\n frontFace.rootNode.invisible = true;\n backFace.rootNode.invisible = false;\n }\n },\n\n /**\n * Update axis line position when camera view changed.\n * @private\n */\n _updateAxisLinePosition: function () {\n // Put xAxis, yAxis on x, y visible plane.\n // Put zAxis on the left.\n // TODO\n var cartesian = this._model.coordinateSystem;\n var xAxis = cartesian.getAxis('x');\n var yAxis = cartesian.getAxis('y');\n var zAxis = cartesian.getAxis('z');\n var top = zAxis.getExtentMax();\n var bottom = zAxis.getExtentMin();\n var left = xAxis.getExtentMin();\n var right = xAxis.getExtentMax();\n var near = yAxis.getExtentMax();\n var far = yAxis.getExtentMin();\n\n var xAxisNode = this._axes[0].rootNode;\n var yAxisNode = this._axes[1].rootNode;\n var zAxisNode = this._axes[2].rootNode;\n\n var faces = this._faces;\n // Notice: in cartesian up axis is z, but in webgl up axis is y.\n var xAxisZOffset = (faces[4].rootNode.invisible ? far : near);\n var xAxisYOffset = (faces[2].rootNode.invisible ? top : bottom);\n var yAxisXOffset = (faces[0].rootNode.invisible ? left : right);\n var yAxisYOffset = (faces[2].rootNode.invisible ? top : bottom);\n var zAxisXOffset = (faces[0].rootNode.invisible ? right : left);\n var zAxisZOffset = (faces[4].rootNode.invisible ? far : near);\n\n xAxisNode.rotation.identity();\n yAxisNode.rotation.identity();\n zAxisNode.rotation.identity();\n if (faces[4].rootNode.invisible) {\n this._axes[0].flipped = true;\n xAxisNode.rotation.rotateX(Math.PI);\n }\n if (faces[0].rootNode.invisible) {\n this._axes[1].flipped = true;\n yAxisNode.rotation.rotateZ(Math.PI);\n }\n if (faces[4].rootNode.invisible) {\n this._axes[2].flipped = true;\n zAxisNode.rotation.rotateY(Math.PI);\n }\n\n xAxisNode.position.set(0, xAxisYOffset, xAxisZOffset);\n yAxisNode.position.set(yAxisXOffset, yAxisYOffset, 0); // Actually z\n zAxisNode.position.set(zAxisXOffset, 0, zAxisZOffset); // Actually y\n\n xAxisNode.update();\n yAxisNode.update();\n zAxisNode.update();\n\n this._updateAxisLabelAlign();\n },\n\n /**\n * Update label align on axis when axisLine position changed.\n * @private\n */\n _updateAxisLabelAlign: function () {\n // var cartesian = this._model.coordinateSystem;\n var camera = this._control.getCamera();\n var coords = [new graphicGL.Vector4(), new graphicGL.Vector4()];\n var center = new graphicGL.Vector4();\n this.groupGL.getWorldPosition(center);\n center.w = 1.0;\n center.transformMat4(camera.viewMatrix)\n .transformMat4(camera.projectionMatrix);\n center.x /= center.w;\n center.y /= center.w;\n this._axes.forEach(function (axisInfo) {\n var lineCoords = axisInfo.axisLineCoords;\n var labelGeo = axisInfo.labelsMesh.geometry;\n for (var i = 0; i < coords.length; i++) {\n coords[i].setArray(lineCoords[i]);\n coords[i].w = 1.0;\n coords[i].transformMat4(axisInfo.rootNode.worldTransform)\n .transformMat4(camera.viewMatrix)\n .transformMat4(camera.projectionMatrix);\n coords[i].x /= coords[i].w;\n coords[i].y /= coords[i].w;\n }\n var dx = coords[1].x - coords[0].x;\n var dy = coords[1].y - coords[0].y;\n var cx = (coords[1].x + coords[0].x) / 2;\n var cy = (coords[1].y + coords[0].y) / 2;\n var textAlign;\n var verticalAlign;\n if (Math.abs(dy / dx) < 0.5) {\n textAlign = 'center';\n verticalAlign = cy > center.y ? 'bottom' : 'top';\n }\n else {\n verticalAlign = 'middle';\n textAlign = cx > center.x ? 'left' : 'right';\n }\n\n // axis labels\n axisInfo.setSpriteAlign(textAlign, verticalAlign, this._api);\n }, this);\n },\n\n _doShowAxisPointer: function () {\n if (!this._axisPointerLineMesh.invisible) {\n return;\n }\n\n this._axisPointerLineMesh.invisible = false;\n this._axisPointerLabelsMesh.invisible = false;\n this._api.getZr().refresh();\n },\n\n _doHideAxisPointer: function () {\n if (this._axisPointerLineMesh.invisible) {\n return;\n }\n\n this._axisPointerLineMesh.invisible = true;\n this._axisPointerLabelsMesh.invisible = true;\n this._api.getZr().refresh();\n },\n /**\n * @private updateAxisPointer.\n */\n _updateAxisPointer: function (data) {\n var cartesian = this._model.coordinateSystem;\n var point = cartesian.dataToPoint(data);\n\n var axisPointerLineMesh = this._axisPointerLineMesh;\n var linesGeo = axisPointerLineMesh.geometry;\n\n var axisPointerParentModel = this._model.getModel('axisPointer');\n\n var dpr = this._api.getDevicePixelRatio();\n linesGeo.convertToDynamicArray(true);\n\n\n function ifShowAxisPointer(axis) {\n return retrieve.firstNotNull(\n axis.model.get('axisPointer.show'),\n axisPointerParentModel.get('show')\n );\n }\n function getAxisColorAndLineWidth(axis) {\n var axisPointerModel = axis.model.getModel('axisPointer', axisPointerParentModel);\n var lineStyleModel = axisPointerModel.getModel('lineStyle');\n\n var color = graphicGL.parseColor(lineStyleModel.get('color'));\n var lineWidth = firstNotNull(lineStyleModel.get('width'), 1);\n var opacity = firstNotNull(lineStyleModel.get('opacity'), 1);\n color[3] *= opacity;\n\n return {\n color: color,\n lineWidth: lineWidth\n };\n }\n for (var k = 0; k < this._faces.length; k++) {\n var face = this._faces[k];\n if (face.rootNode.invisible) {\n continue;\n }\n\n var faceInfo = face.faceInfo;\n var otherCoord = faceInfo[3] < 0\n ? cartesian.getAxis(faceInfo[2]).getExtentMin()\n : cartesian.getAxis(faceInfo[2]).getExtentMax();\n var otherDimIdx = dimIndicesMap[faceInfo[2]];\n\n // Line on face.\n for (var i = 0; i < 2; i++) {\n var dim = faceInfo[i];\n var faceOtherDim = faceInfo[1 - i];\n var axis = cartesian.getAxis(dim);\n var faceOtherAxis = cartesian.getAxis(faceOtherDim);\n\n if (!ifShowAxisPointer(axis)) {\n continue;\n }\n\n var p0 = [0, 0, 0]; var p1 = [0, 0, 0];\n var dimIdx = dimIndicesMap[dim];\n var faceOtherDimIdx = dimIndicesMap[faceOtherDim];\n p0[dimIdx] = p1[dimIdx] = point[dimIdx];\n\n p0[otherDimIdx] = p1[otherDimIdx] = otherCoord;\n p0[faceOtherDimIdx] = faceOtherAxis.getExtentMin();\n p1[faceOtherDimIdx] = faceOtherAxis.getExtentMax();\n\n var colorAndLineWidth = getAxisColorAndLineWidth(axis);\n linesGeo.addLine(p0, p1, colorAndLineWidth.color, colorAndLineWidth.lineWidth * dpr);\n }\n\n // Project line.\n if (ifShowAxisPointer(cartesian.getAxis(faceInfo[2]))) {\n var p0 = point.slice();\n var p1 = point.slice();\n p1[otherDimIdx] = otherCoord;\n var colorAndLineWidth = getAxisColorAndLineWidth(cartesian.getAxis(faceInfo[2]));\n linesGeo.addLine(p0, p1, colorAndLineWidth.color, colorAndLineWidth.lineWidth * dpr);\n }\n }\n linesGeo.convertToTypedArray();\n\n this._updateAxisPointerLabelsMesh(data);\n\n this._api.getZr().refresh();\n },\n\n _updateAxisPointerLabelsMesh: function (data) {\n var grid3dModel = this._model;\n var axisPointerLabelsMesh = this._axisPointerLabelsMesh;\n var axisPointerLabelsSurface = this._axisPointerLabelsSurface;\n var cartesian = grid3dModel.coordinateSystem;\n\n var axisPointerParentModel = grid3dModel.getModel('axisPointer');\n\n axisPointerLabelsMesh.geometry.convertToDynamicArray(true);\n axisPointerLabelsSurface.clear();\n\n var otherDim = {\n x: 'y', y: 'x', z: 'y'\n };\n this._axes.forEach(function (axisInfo, idx) {\n var axis = cartesian.getAxis(axisInfo.dim);\n var axisModel = axis.model;\n var axisPointerModel = axisModel.getModel('axisPointer', axisPointerParentModel);\n var labelModel = axisPointerModel.getModel('label');\n var lineColor = axisPointerModel.get('lineStyle.color');\n if (!labelModel.get('show') || !axisPointerModel.get('show')) {\n return;\n }\n var val = data[idx];\n var formatter = labelModel.get('formatter');\n var text = axis.scale.getLabel({ value: val });\n if (formatter != null) {\n text = formatter(text, data);\n }\n else {\n if (axis.scale.type === 'interval' || axis.scale.type === 'log') {\n var precision = echarts.number.getPrecisionSafe(axis.scale.getTicks()[0]);\n text = val.toFixed(precision + 2);\n }\n }\n\n var labelColor = labelModel.get('color');\n var textEl = new echarts.graphic.Text({\n style: createTextStyle(labelModel, {\n text: text,\n fill: labelColor || lineColor,\n align: 'left',\n verticalAlign: 'top'\n })\n });\n\n var coords = axisPointerLabelsSurface.add(textEl);\n var rect = textEl.getBoundingRect();\n var dpr = this._api.getDevicePixelRatio();\n var pos = axisInfo.rootNode.position.toArray();\n var otherIdx = dimIndicesMap[otherDim[axisInfo.dim]];\n pos[otherIdx] += (axisInfo.flipped ? -1 : 1) * labelModel.get('margin');\n pos[dimIndicesMap[axisInfo.dim]] = axis.dataToCoord(data[idx]);\n\n axisPointerLabelsMesh.geometry.addSprite(\n pos, [rect.width * dpr, rect.height * dpr], coords,\n axisInfo.textAlign, axisInfo.textVerticalAlign\n );\n }, this);\n axisPointerLabelsSurface.getZr().refreshImmediately();\n axisPointerLabelsMesh.material.set('uvScale', axisPointerLabelsSurface.getCoordsScale());\n axisPointerLabelsMesh.geometry.convertToTypedArray();\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n this._control.dispose();\n this._axisLabelSurface.dispose();\n this._axisPointerLabelsSurface.dispose();\n }\n});","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util';\n\nvar Cartesian =\n/** @class */\nfunction () {\n function Cartesian(name) {\n this.type = 'cartesian';\n this._dimList = [];\n this._axes = {};\n this.name = name || '';\n }\n\n Cartesian.prototype.getAxis = function (dim) {\n return this._axes[dim];\n };\n\n Cartesian.prototype.getAxes = function () {\n return zrUtil.map(this._dimList, function (dim) {\n return this._axes[dim];\n }, this);\n };\n\n Cartesian.prototype.getAxesByScale = function (scaleType) {\n scaleType = scaleType.toLowerCase();\n return zrUtil.filter(this.getAxes(), function (axis) {\n return axis.scale.type === scaleType;\n });\n };\n\n Cartesian.prototype.addAxis = function (axis) {\n var dim = axis.dim;\n this._axes[dim] = axis;\n\n this._dimList.push(dim);\n };\n\n return Cartesian;\n}();\n\n;\nexport default Cartesian;","import * as echarts from 'echarts/lib/echarts';\nimport Cartesian from 'echarts/lib/coord/cartesian/Cartesian';\n\nfunction Cartesian3D(name) {\n\n Cartesian.call(this, name);\n\n this.type = 'cartesian3D';\n\n this.dimensions = ['x', 'y', 'z'];\n\n this.size = [0, 0, 0];\n}\n\nCartesian3D.prototype = {\n\n constructor: Cartesian3D,\n\n\n model: null,\n\n containPoint: function (point) {\n return this.getAxis('x').contain(point[0])\n && this.getAxis('y').contain(point[2])\n && this.getAxis('z').contain(point[1]);\n },\n\n containData: function (data) {\n return this.getAxis('x').containData(data[0])\n && this.getAxis('y').containData(data[1])\n && this.getAxis('z').containData(data[2]);\n },\n\n dataToPoint: function (data, out, clamp) {\n out = out || [];\n out[0] = this.getAxis('x').dataToCoord(data[0], clamp);\n out[2] = this.getAxis('y').dataToCoord(data[1], clamp);\n out[1] = this.getAxis('z').dataToCoord(data[2], clamp);\n return out;\n },\n\n pointToData: function (point, out, clamp) {\n out = out || [];\n out[0] = this.getAxis('x').coordToData(point[0], clamp);\n out[1] = this.getAxis('y').coordToData(point[2], clamp);\n out[2] = this.getAxis('z').coordToData(point[1], clamp);\n return out;\n }\n};\n\necharts.util.inherits(Cartesian3D, Cartesian);\n\nexport default Cartesian3D;","import * as echarts from 'echarts/lib/echarts';\n\nfunction Axis3D(dim, scale, extent) {\n\n echarts.Axis.call(this, dim, scale, extent);\n}\n\nAxis3D.prototype = {\n constructor: Axis3D,\n\n getExtentMin: function () {\n var extent = this._extent;\n return Math.min(extent[0], extent[1]);\n },\n\n getExtentMax: function () {\n var extent = this._extent;\n return Math.max(extent[0], extent[1]);\n },\n\n calculateCategoryInterval: function () {\n // TODO consider label length\n return Math.floor(this.scale.count() / 8);\n }\n};\n\necharts.util.inherits(Axis3D, echarts.Axis);\n\nexport default Axis3D;","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { __spreadArrays } from \"tslib\";\nimport * as zrUtil from 'zrender/lib/core/util';\nvar TYPE_DELIMITER = '.';\nvar IS_CONTAINER = '___EC__COMPONENT__CONTAINER___';\nvar IS_EXTENDED_CLASS = '___EC__EXTENDED_CLASS___';\n/**\n * Notice, parseClassType('') should returns {main: '', sub: ''}\n * @public\n */\n\nexport function parseClassType(componentType) {\n var ret = {\n main: '',\n sub: ''\n };\n\n if (componentType) {\n var typeArr = componentType.split(TYPE_DELIMITER);\n ret.main = typeArr[0] || '';\n ret.sub = typeArr[1] || '';\n }\n\n return ret;\n}\n/**\n * @public\n */\n\nfunction checkClassType(componentType) {\n zrUtil.assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(componentType), 'componentType \"' + componentType + '\" illegal');\n}\n\nexport function isExtendedClass(clz) {\n return !!(clz && clz[IS_EXTENDED_CLASS]);\n}\n/**\n * Implements `ExtendableConstructor` for `rootClz`.\n *\n * @usage\n * ```ts\n * class Xxx {}\n * type XxxConstructor = typeof Xxx & ExtendableConstructor\n * enableClassExtend(Xxx as XxxConstructor);\n * ```\n */\n\nexport function enableClassExtend(rootClz, mandatoryMethods) {\n rootClz.$constructor = rootClz; // FIXME: not necessary?\n\n rootClz.extend = function (proto) {\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.each(mandatoryMethods, function (method) {\n if (!proto[method]) {\n console.warn('Method `' + method + '` should be implemented' + (proto.type ? ' in ' + proto.type : '') + '.');\n }\n });\n }\n\n var superClass = this; // For backward compat, we both support ts class inheritance and this\n // \"extend\" approach.\n // The constructor should keep the same behavior as ts class inheritance:\n // If this constructor/$constructor is not declared, auto invoke the super\n // constructor.\n // If this constructor/$constructor is declared, it is responsible for\n // calling the super constructor.\n\n function ExtendedClass() {\n var args = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n\n if (!proto.$constructor) {\n if (!isESClass(superClass)) {\n // Will throw error if superClass is an es6 native class.\n superClass.apply(this, arguments);\n } else {\n var ins = zrUtil.createObject( // @ts-ignore\n ExtendedClass.prototype, new (superClass.bind.apply(superClass, __spreadArrays([void 0], args)))());\n return ins;\n }\n } else {\n proto.$constructor.apply(this, arguments);\n }\n }\n\n ExtendedClass[IS_EXTENDED_CLASS] = true;\n zrUtil.extend(ExtendedClass.prototype, proto);\n ExtendedClass.extend = this.extend;\n ExtendedClass.superCall = superCall;\n ExtendedClass.superApply = superApply;\n zrUtil.inherits(ExtendedClass, this);\n ExtendedClass.superClass = superClass;\n return ExtendedClass;\n };\n}\n\nfunction isESClass(fn) {\n return typeof fn === 'function' && /^class\\s/.test(Function.prototype.toString.call(fn));\n}\n/**\n * A work around to both support ts extend and this extend mechanism.\n * on sub-class.\n * @usage\n * ```ts\n * class Component { ... }\n * classUtil.enableClassExtend(Component);\n * classUtil.enableClassManagement(Component, {registerWhenExtend: true});\n *\n * class Series extends Component { ... }\n * // Without calling `markExtend`, `registerWhenExtend` will not work.\n * Component.markExtend(Series);\n * ```\n */\n\n\nexport function mountExtend(SubClz, SupperClz) {\n SubClz.extend = SupperClz.extend;\n} // A random offset.\n\nvar classBase = Math.round(Math.random() * 10);\n/**\n * Implements `CheckableConstructor` for `target`.\n * Can not use instanceof, consider different scope by\n * cross domain or es module import in ec extensions.\n * Mount a method \"isInstance()\" to Clz.\n *\n * @usage\n * ```ts\n * class Xxx {}\n * type XxxConstructor = typeof Xxx & CheckableConstructor;\n * enableClassCheck(Xxx as XxxConstructor)\n * ```\n */\n\nexport function enableClassCheck(target) {\n var classAttr = ['__\\0is_clz', classBase++].join('_');\n target.prototype[classAttr] = true;\n\n if (process.env.NODE_ENV !== 'production') {\n zrUtil.assert(!target.isInstance, 'The method \"is\" can not be defined.');\n }\n\n target.isInstance = function (obj) {\n return !!(obj && obj[classAttr]);\n };\n} // superCall should have class info, which can not be fetch from 'this'.\n// Consider this case:\n// class A has method f,\n// class B inherits class A, overrides method f, f call superApply('f'),\n// class C inherits class B, do not overrides method f,\n// then when method of class C is called, dead loop occured.\n\nfunction superCall(context, methodName) {\n var args = [];\n\n for (var _i = 2; _i < arguments.length; _i++) {\n args[_i - 2] = arguments[_i];\n }\n\n return this.superClass.prototype[methodName].apply(context, args);\n}\n\nfunction superApply(context, methodName, args) {\n return this.superClass.prototype[methodName].apply(context, args);\n}\n/**\n * Implements `ClassManager` for `target`\n *\n * @usage\n * ```ts\n * class Xxx {}\n * type XxxConstructor = typeof Xxx & ClassManager\n * enableClassManagement(Xxx as XxxConstructor);\n * ```\n */\n\n\nexport function enableClassManagement(target) {\n /**\n * Component model classes\n * key: componentType,\n * value:\n * componentClass, when componentType is 'xxx'\n * or Object., when componentType is 'xxx.yy'\n */\n var storage = {};\n\n target.registerClass = function (clz) {\n // `type` should not be a \"instance memeber\".\n // If using TS class, should better declared as `static type = 'series.pie'`.\n // otherwise users have to mount `type` on prototype manually.\n // For backward compat and enable instance visit type via `this.type`,\n // we stil support fetch `type` from prototype.\n var componentFullType = clz.type || clz.prototype.type;\n\n if (componentFullType) {\n checkClassType(componentFullType); // If only static type declared, we assign it to prototype mandatorily.\n\n clz.prototype.type = componentFullType;\n var componentTypeInfo = parseClassType(componentFullType);\n\n if (!componentTypeInfo.sub) {\n if (process.env.NODE_ENV !== 'production') {\n if (storage[componentTypeInfo.main]) {\n console.warn(componentTypeInfo.main + ' exists.');\n }\n }\n\n storage[componentTypeInfo.main] = clz;\n } else if (componentTypeInfo.sub !== IS_CONTAINER) {\n var container = makeContainer(componentTypeInfo);\n container[componentTypeInfo.sub] = clz;\n }\n }\n\n return clz;\n };\n\n target.getClass = function (mainType, subType, throwWhenNotFound) {\n var clz = storage[mainType];\n\n if (clz && clz[IS_CONTAINER]) {\n clz = subType ? clz[subType] : null;\n }\n\n if (throwWhenNotFound && !clz) {\n throw new Error(!subType ? mainType + '.' + 'type should be specified.' : 'Component ' + mainType + '.' + (subType || '') + ' is used but not imported.');\n }\n\n return clz;\n };\n\n target.getClassesByMainType = function (componentType) {\n var componentTypeInfo = parseClassType(componentType);\n var result = [];\n var obj = storage[componentTypeInfo.main];\n\n if (obj && obj[IS_CONTAINER]) {\n zrUtil.each(obj, function (o, type) {\n type !== IS_CONTAINER && result.push(o);\n });\n } else {\n result.push(obj);\n }\n\n return result;\n };\n\n target.hasClass = function (componentType) {\n // Just consider componentType.main.\n var componentTypeInfo = parseClassType(componentType);\n return !!storage[componentTypeInfo.main];\n };\n /**\n * @return Like ['aa', 'bb'], but can not be ['aa.xx']\n */\n\n\n target.getAllClassMainTypes = function () {\n var types = [];\n zrUtil.each(storage, function (obj, type) {\n types.push(type);\n });\n return types;\n };\n /**\n * If a main type is container and has sub types\n */\n\n\n target.hasSubTypes = function (componentType) {\n var componentTypeInfo = parseClassType(componentType);\n var obj = storage[componentTypeInfo.main];\n return obj && obj[IS_CONTAINER];\n };\n\n function makeContainer(componentTypeInfo) {\n var container = storage[componentTypeInfo.main];\n\n if (!container || !container[IS_CONTAINER]) {\n container = storage[componentTypeInfo.main] = {};\n container[IS_CONTAINER] = true;\n }\n\n return container;\n }\n} // /**\n// * @param {string|Array.} properties\n// */\n// export function setReadOnly(obj, properties) {\n// FIXME It seems broken in IE8 simulation of IE11\n// if (!zrUtil.isArray(properties)) {\n// properties = properties != null ? [properties] : [];\n// }\n// zrUtil.each(properties, function (prop) {\n// let value = obj[prop];\n// Object.defineProperty\n// && Object.defineProperty(obj, prop, {\n// value: value, writable: false\n// });\n// zrUtil.isArray(obj[prop])\n// && Object.freeze\n// && Object.freeze(obj[prop]);\n// });\n// }","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// TODO Parse shadow style\n// TODO Only shallow path support\nimport * as zrUtil from 'zrender/lib/core/util';\nexport default function makeStyleMapper(properties, ignoreParent) {\n // Normalize\n for (var i = 0; i < properties.length; i++) {\n if (!properties[i][1]) {\n properties[i][1] = properties[i][0];\n }\n }\n\n ignoreParent = ignoreParent || false;\n return function (model, excludes, includes) {\n var style = {};\n\n for (var i = 0; i < properties.length; i++) {\n var propName = properties[i][1];\n\n if (excludes && zrUtil.indexOf(excludes, propName) >= 0 || includes && zrUtil.indexOf(includes, propName) < 0) {\n continue;\n }\n\n var val = model.getShallow(propName, ignoreParent);\n\n if (val != null) {\n style[properties[i][0]] = val;\n }\n } // TODO Text or image?\n\n\n return style;\n };\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport makeStyleMapper from './makeStyleMapper';\nexport var AREA_STYLE_KEY_MAP = [['fill', 'color'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['opacity'], ['shadowColor'] // Option decal is in `DecalObject` but style.decal is in `PatternObject`.\n// So do not transfer decal directly.\n];\nvar getAreaStyle = makeStyleMapper(AREA_STYLE_KEY_MAP);\n\nvar AreaStyleMixin =\n/** @class */\nfunction () {\n function AreaStyleMixin() {}\n\n AreaStyleMixin.prototype.getAreaStyle = function (excludes, includes) {\n return getAreaStyle(this, excludes, includes);\n };\n\n return AreaStyleMixin;\n}();\n\n;\nexport { AreaStyleMixin };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { getFont } from '../../label/labelStyle';\nimport ZRText from 'zrender/lib/graphic/Text';\nvar PATH_COLOR = ['textStyle', 'color']; // TODO Performance improvement?\n\nvar tmpRichText = new ZRText();\n\nvar TextStyleMixin =\n/** @class */\nfunction () {\n function TextStyleMixin() {}\n /**\n * Get color property or get color from option.textStyle.color\n */\n // TODO Callback\n\n\n TextStyleMixin.prototype.getTextColor = function (isEmphasis) {\n var ecModel = this.ecModel;\n return this.getShallow('color') || (!isEmphasis && ecModel ? ecModel.get(PATH_COLOR) : null);\n };\n /**\n * Create font string from fontStyle, fontWeight, fontSize, fontFamily\n * @return {string}\n */\n\n\n TextStyleMixin.prototype.getFont = function () {\n return getFont({\n fontStyle: this.getShallow('fontStyle'),\n fontWeight: this.getShallow('fontWeight'),\n fontSize: this.getShallow('fontSize'),\n fontFamily: this.getShallow('fontFamily')\n }, this.ecModel);\n };\n\n TextStyleMixin.prototype.getTextRect = function (text) {\n tmpRichText.useStyle({\n text: text,\n fontStyle: this.getShallow('fontStyle'),\n fontWeight: this.getShallow('fontWeight'),\n fontSize: this.getShallow('fontSize'),\n fontFamily: this.getShallow('fontFamily'),\n verticalAlign: this.getShallow('verticalAlign') || this.getShallow('baseline'),\n padding: this.getShallow('padding'),\n lineHeight: this.getShallow('lineHeight'),\n rich: this.getShallow('rich')\n });\n tmpRichText.update();\n return tmpRichText.getBoundingRect();\n };\n\n return TextStyleMixin;\n}();\n\n;\nexport default TextStyleMixin;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport makeStyleMapper from './makeStyleMapper';\nexport var LINE_STYLE_KEY_MAP = [['lineWidth', 'width'], ['stroke', 'color'], ['opacity'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor'], ['lineDash', 'type'], ['lineDashOffset', 'dashOffset'], ['lineCap', 'cap'], ['lineJoin', 'join'], ['miterLimit'] // Option decal is in `DecalObject` but style.decal is in `PatternObject`.\n// So do not transfer decal directly.\n];\nvar getLineStyle = makeStyleMapper(LINE_STYLE_KEY_MAP);\n\nvar LineStyleMixin =\n/** @class */\nfunction () {\n function LineStyleMixin() {}\n\n LineStyleMixin.prototype.getLineStyle = function (excludes) {\n return getLineStyle(this, excludes);\n };\n\n return LineStyleMixin;\n}();\n\n;\nexport { LineStyleMixin };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport makeStyleMapper from './makeStyleMapper';\nexport var ITEM_STYLE_KEY_MAP = [['fill', 'color'], ['stroke', 'borderColor'], ['lineWidth', 'borderWidth'], ['opacity'], ['shadowBlur'], ['shadowOffsetX'], ['shadowOffsetY'], ['shadowColor'], ['lineDash', 'borderType'], ['lineDashOffset', 'borderDashOffset'], ['lineCap', 'borderCap'], ['lineJoin', 'borderJoin'], ['miterLimit', 'borderMiterLimit'] // Option decal is in `DecalObject` but style.decal is in `PatternObject`.\n// So do not transfer decal directly.\n];\nvar getItemStyle = makeStyleMapper(ITEM_STYLE_KEY_MAP);\n\nvar ItemStyleMixin =\n/** @class */\nfunction () {\n function ItemStyleMixin() {}\n\n ItemStyleMixin.prototype.getItemStyle = function (excludes, includes) {\n return getItemStyle(this, excludes, includes);\n };\n\n return ItemStyleMixin;\n}();\n\nexport { ItemStyleMixin };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport env from 'zrender/lib/core/env';\nimport { enableClassExtend, enableClassCheck } from '../util/clazz';\nimport { AreaStyleMixin } from './mixin/areaStyle';\nimport TextStyleMixin from './mixin/textStyle';\nimport { LineStyleMixin } from './mixin/lineStyle';\nimport { ItemStyleMixin } from './mixin/itemStyle';\nimport { mixin, clone, merge } from 'zrender/lib/core/util';\n\nvar Model =\n/** @class */\nfunction () {\n function Model(option, parentModel, ecModel) {\n this.parentModel = parentModel;\n this.ecModel = ecModel;\n this.option = option; // Simple optimization\n // if (this.init) {\n // if (arguments.length <= 4) {\n // this.init(option, parentModel, ecModel, extraOpt);\n // }\n // else {\n // this.init.apply(this, arguments);\n // }\n // }\n }\n\n Model.prototype.init = function (option, parentModel, ecModel) {\n var rest = [];\n\n for (var _i = 3; _i < arguments.length; _i++) {\n rest[_i - 3] = arguments[_i];\n }\n };\n /**\n * Merge the input option to me.\n */\n\n\n Model.prototype.mergeOption = function (option, ecModel) {\n merge(this.option, option, true);\n }; // `path` can be 'xxx.yyy.zzz', so the return value type have to be `ModelOption`\n // TODO: TYPE strict key check?\n // get(path: string | string[], ignoreParent?: boolean): ModelOption;\n\n\n Model.prototype.get = function (path, ignoreParent) {\n if (path == null) {\n return this.option;\n }\n\n return this._doGet(this.parsePath(path), !ignoreParent && this.parentModel);\n };\n\n Model.prototype.getShallow = function (key, ignoreParent) {\n var option = this.option;\n var val = option == null ? option : option[key];\n\n if (val == null && !ignoreParent) {\n var parentModel = this.parentModel;\n\n if (parentModel) {\n // FIXME:TS do not know how to make it works\n val = parentModel.getShallow(key);\n }\n }\n\n return val;\n }; // `path` can be 'xxx.yyy.zzz', so the return value type have to be `Model`\n // getModel(path: string | string[], parentModel?: Model): Model;\n // TODO 'xxx.yyy.zzz' is deprecated\n\n\n Model.prototype.getModel = function (path, parentModel) {\n var hasPath = path != null;\n var pathFinal = hasPath ? this.parsePath(path) : null;\n var obj = hasPath ? this._doGet(pathFinal) : this.option;\n parentModel = parentModel || this.parentModel && this.parentModel.getModel(this.resolveParentPath(pathFinal));\n return new Model(obj, parentModel, this.ecModel);\n };\n /**\n * Squash option stack into one.\n * parentModel will be removed after squashed.\n *\n * NOTE: resolveParentPath will not be applied here for simplicity. DON'T use this function\n * if resolveParentPath is modified.\n *\n * @param deepMerge If do deep merge. Default to be false.\n */\n // squash(\n // deepMerge?: boolean,\n // handleCallback?: (func: () => object) => object\n // ) {\n // const optionStack = [];\n // let model: Model = this;\n // while (model) {\n // if (model.option) {\n // optionStack.push(model.option);\n // }\n // model = model.parentModel;\n // }\n // const newOption = {} as Opt;\n // let option;\n // while (option = optionStack.pop()) { // Top down merge\n // if (isFunction(option) && handleCallback) {\n // option = handleCallback(option);\n // }\n // if (deepMerge) {\n // merge(newOption, option);\n // }\n // else {\n // extend(newOption, option);\n // }\n // }\n // // Remove parentModel\n // this.option = newOption;\n // this.parentModel = null;\n // }\n\n /**\n * If model has option\n */\n\n\n Model.prototype.isEmpty = function () {\n return this.option == null;\n };\n\n Model.prototype.restoreData = function () {}; // Pending\n\n\n Model.prototype.clone = function () {\n var Ctor = this.constructor;\n return new Ctor(clone(this.option));\n }; // setReadOnly(properties): void {\n // clazzUtil.setReadOnly(this, properties);\n // }\n // If path is null/undefined, return null/undefined.\n\n\n Model.prototype.parsePath = function (path) {\n if (typeof path === 'string') {\n return path.split('.');\n }\n\n return path;\n }; // Resolve path for parent. Perhaps useful when parent use a different property.\n // Default to be a identity resolver.\n // Can be modified to a different resolver.\n\n\n Model.prototype.resolveParentPath = function (path) {\n return path;\n }; // FIXME:TS check whether put this method here\n\n\n Model.prototype.isAnimationEnabled = function () {\n if (!env.node && this.option) {\n if (this.option.animation != null) {\n return !!this.option.animation;\n } else if (this.parentModel) {\n return this.parentModel.isAnimationEnabled();\n }\n }\n };\n\n Model.prototype._doGet = function (pathArr, parentModel) {\n var obj = this.option;\n\n if (!pathArr) {\n return obj;\n }\n\n for (var i = 0; i < pathArr.length; i++) {\n // Ignore empty\n if (!pathArr[i]) {\n continue;\n } // obj could be number/string/... (like 0)\n\n\n obj = obj && typeof obj === 'object' ? obj[pathArr[i]] : null;\n\n if (obj == null) {\n break;\n }\n }\n\n if (obj == null && parentModel) {\n obj = parentModel._doGet(this.resolveParentPath(pathArr), parentModel.parentModel);\n }\n\n return obj;\n };\n\n return Model;\n}();\n\n; // Enable Model.extend.\n\nenableClassExtend(Model);\nenableClassCheck(Model);\nmixin(Model, LineStyleMixin);\nmixin(Model, ItemStyleMixin);\nmixin(Model, AreaStyleMixin);\nmixin(Model, TextStyleMixin);\nexport default Model;","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * Language: English.\n */\nexport default {\n time: {\n month: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n monthAbbr: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n dayOfWeek: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n dayOfWeekAbbr: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\n },\n legend: {\n selector: {\n all: 'All',\n inverse: 'Inv'\n }\n },\n toolbox: {\n brush: {\n title: {\n rect: 'Box Select',\n polygon: 'Lasso Select',\n lineX: 'Horizontally Select',\n lineY: 'Vertically Select',\n keep: 'Keep Selections',\n clear: 'Clear Selections'\n }\n },\n dataView: {\n title: 'Data View',\n lang: ['Data View', 'Close', 'Refresh']\n },\n dataZoom: {\n title: {\n zoom: 'Zoom',\n back: 'Zoom Reset'\n }\n },\n magicType: {\n title: {\n line: 'Switch to Line Chart',\n bar: 'Switch to Bar Chart',\n stack: 'Stack',\n tiled: 'Tile'\n }\n },\n restore: {\n title: 'Restore'\n },\n saveAsImage: {\n title: 'Save as Image',\n lang: ['Right Click to Save Image']\n }\n },\n series: {\n typeNames: {\n pie: 'Pie chart',\n bar: 'Bar chart',\n line: 'Line chart',\n scatter: 'Scatter plot',\n effectScatter: 'Ripple scatter plot',\n radar: 'Radar chart',\n tree: 'Tree',\n treemap: 'Treemap',\n boxplot: 'Boxplot',\n candlestick: 'Candlestick',\n k: 'K line chart',\n heatmap: 'Heat map',\n map: 'Map',\n parallel: 'Parallel coordinate map',\n lines: 'Line graph',\n graph: 'Relationship graph',\n sankey: 'Sankey diagram',\n funnel: 'Funnel chart',\n gauge: 'Gauge',\n pictorialBar: 'Pictorial bar',\n themeRiver: 'Theme River Map',\n sunburst: 'Sunburst'\n }\n },\n aria: {\n general: {\n withTitle: 'This is a chart about \"{title}\"',\n withoutTitle: 'This is a chart'\n },\n series: {\n single: {\n prefix: '',\n withName: ' with type {seriesType} named {seriesName}.',\n withoutName: ' with type {seriesType}.'\n },\n multiple: {\n prefix: '. It consists of {seriesCount} series count.',\n withName: ' The {seriesId} series is a {seriesType} representing {seriesName}.',\n withoutName: ' The {seriesId} series is a {seriesType}.',\n separator: {\n middle: '',\n end: ''\n }\n }\n },\n data: {\n allData: 'The data is as follows: ',\n partialData: 'The first {displayCnt} items are: ',\n withName: 'the data for {name} is {value}',\n withoutName: '{value}',\n separator: {\n middle: ', ',\n end: '. '\n }\n }\n }\n};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\nexport default {\n time: {\n month: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],\n monthAbbr: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],\n dayOfWeek: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],\n dayOfWeekAbbr: ['日', '一', '二', '三', '四', '五', '六']\n },\n legend: {\n selector: {\n all: '全选',\n inverse: '反选'\n }\n },\n toolbox: {\n brush: {\n title: {\n rect: '矩形选择',\n polygon: '圈选',\n lineX: '横向选择',\n lineY: '纵向选择',\n keep: '保持选择',\n clear: '清除选择'\n }\n },\n dataView: {\n title: '数据视图',\n lang: ['数据视图', '关闭', '刷新']\n },\n dataZoom: {\n title: {\n zoom: '区域缩放',\n back: '区域缩放还原'\n }\n },\n magicType: {\n title: {\n line: '切换为折线图',\n bar: '切换为柱状图',\n stack: '切换为堆叠',\n tiled: '切换为平铺'\n }\n },\n restore: {\n title: '还原'\n },\n saveAsImage: {\n title: '保存为图片',\n lang: ['右键另存为图片']\n }\n },\n series: {\n typeNames: {\n pie: '饼图',\n bar: '柱状图',\n line: '折线图',\n scatter: '散点图',\n effectScatter: '涟漪散点图',\n radar: '雷达图',\n tree: '树图',\n treemap: '矩形树图',\n boxplot: '箱型图',\n candlestick: 'K线图',\n k: 'K线图',\n heatmap: '热力图',\n map: '地图',\n parallel: '平行坐标图',\n lines: '线图',\n graph: '关系图',\n sankey: '桑基图',\n funnel: '漏斗图',\n gauge: '仪表盘图',\n pictorialBar: '象形柱图',\n themeRiver: '主题河流图',\n sunburst: '旭日图'\n }\n },\n aria: {\n general: {\n withTitle: '这是一个关于“{title}”的图表。',\n withoutTitle: '这是一个图表,'\n },\n series: {\n single: {\n prefix: '',\n withName: '图表类型是{seriesType},表示{seriesName}。',\n withoutName: '图表类型是{seriesType}。'\n },\n multiple: {\n prefix: '它由{seriesCount}个图表系列组成。',\n withName: '第{seriesId}个系列是一个表示{seriesName}的{seriesType},',\n withoutName: '第{seriesId}个系列是一个{seriesType},',\n separator: {\n middle: ';',\n end: '。'\n }\n }\n },\n data: {\n allData: '其数据是——',\n partialData: '其中,前{displayCnt}项是——',\n withName: '{name}的数据是{value}',\n withoutName: '{value}',\n separator: {\n middle: ',',\n end: ''\n }\n }\n }\n};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport Model from '../model/Model';\nimport env from 'zrender/lib/core/env'; // default import ZH and EN lang\n\nimport langEN from '../i18n/langEN';\nimport langZH from '../i18n/langZH';\nimport { isString, clone, merge } from 'zrender/lib/core/util';\nvar LOCALE_ZH = 'ZH';\nvar LOCALE_EN = 'EN';\nvar DEFAULT_LOCALE = LOCALE_EN;\nvar localeStorage = {};\nvar localeModels = {};\nexport var SYSTEM_LANG = !env.domSupported ? DEFAULT_LOCALE : function () {\n var langStr = (\n /* eslint-disable-next-line */\n document.documentElement.lang || navigator.language || navigator.browserLanguage).toUpperCase();\n return langStr.indexOf(LOCALE_ZH) > -1 ? LOCALE_ZH : DEFAULT_LOCALE;\n}();\nexport function registerLocale(locale, localeObj) {\n locale = locale.toUpperCase();\n localeModels[locale] = new Model(localeObj);\n localeStorage[locale] = localeObj;\n} // export function getLocale(locale: string) {\n// return localeStorage[locale];\n// }\n\nexport function createLocaleObject(locale) {\n if (isString(locale)) {\n var localeObj = localeStorage[locale.toUpperCase()] || {};\n\n if (locale === LOCALE_ZH || locale === LOCALE_EN) {\n return clone(localeObj);\n } else {\n return merge(clone(localeObj), clone(localeStorage[DEFAULT_LOCALE]), false);\n }\n } else {\n return merge(clone(locale), clone(localeStorage[DEFAULT_LOCALE]), false);\n }\n}\nexport function getLocaleModel(lang) {\n return localeModels[lang];\n}\nexport function getDefaultLocaleModel() {\n return localeModels[DEFAULT_LOCALE];\n} // Default locale\n\nregisterLocale(LOCALE_EN, langEN);\nregisterLocale(LOCALE_ZH, langZH);","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util';\nimport * as numberUtil from './number';\nimport { getDefaultLocaleModel, getLocaleModel, SYSTEM_LANG } from '../core/locale';\nimport Model from '../model/Model';\nexport var ONE_SECOND = 1000;\nexport var ONE_MINUTE = ONE_SECOND * 60;\nexport var ONE_HOUR = ONE_MINUTE * 60;\nexport var ONE_DAY = ONE_HOUR * 24;\nexport var ONE_YEAR = ONE_DAY * 365;\nexport var defaultLeveledFormatter = {\n year: '{yyyy}',\n month: '{MMM}',\n day: '{d}',\n hour: '{HH}:{mm}',\n minute: '{HH}:{mm}',\n second: '{HH}:{mm}:{ss}',\n millisecond: '{hh}:{mm}:{ss} {SSS}',\n none: '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss} {SSS}'\n};\nvar fullDayFormatter = '{yyyy}-{MM}-{dd}';\nexport var fullLeveledFormatter = {\n year: '{yyyy}',\n month: '{yyyy}-{MM}',\n day: fullDayFormatter,\n hour: fullDayFormatter + ' ' + defaultLeveledFormatter.hour,\n minute: fullDayFormatter + ' ' + defaultLeveledFormatter.minute,\n second: fullDayFormatter + ' ' + defaultLeveledFormatter.second,\n millisecond: defaultLeveledFormatter.none\n};\nexport var primaryTimeUnits = ['year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond'];\nexport var timeUnits = ['year', 'half-year', 'quarter', 'month', 'week', 'half-week', 'day', 'half-day', 'quarter-day', 'hour', 'minute', 'second', 'millisecond'];\nexport function pad(str, len) {\n str += '';\n return '0000'.substr(0, len - str.length) + str;\n}\nexport function getPrimaryTimeUnit(timeUnit) {\n switch (timeUnit) {\n case 'half-year':\n case 'quarter':\n return 'month';\n\n case 'week':\n case 'half-week':\n return 'day';\n\n case 'half-day':\n case 'quarter-day':\n return 'hour';\n\n default:\n // year, minutes, second, milliseconds\n return timeUnit;\n }\n}\nexport function isPrimaryTimeUnit(timeUnit) {\n return timeUnit === getPrimaryTimeUnit(timeUnit);\n}\nexport function getDefaultFormatPrecisionOfInterval(timeUnit) {\n switch (timeUnit) {\n case 'year':\n case 'month':\n return 'day';\n\n case 'millisecond':\n return 'millisecond';\n\n default:\n // Also for day, hour, minute, second\n return 'second';\n }\n}\nexport function format( // Note: The result based on `isUTC` are totally different, which can not be just simply\n// substituted by the result without `isUTC`. So we make the param `isUTC` mandatory.\ntime, template, isUTC, lang) {\n var date = numberUtil.parseDate(time);\n var y = date[fullYearGetterName(isUTC)]();\n var M = date[monthGetterName(isUTC)]() + 1;\n var q = Math.floor((M - 1) / 4) + 1;\n var d = date[dateGetterName(isUTC)]();\n var e = date['get' + (isUTC ? 'UTC' : '') + 'Day']();\n var H = date[hoursGetterName(isUTC)]();\n var h = (H - 1) % 12 + 1;\n var m = date[minutesGetterName(isUTC)]();\n var s = date[secondsGetterName(isUTC)]();\n var S = date[millisecondsGetterName(isUTC)]();\n var localeModel = lang instanceof Model ? lang : getLocaleModel(lang || SYSTEM_LANG) || getDefaultLocaleModel();\n var timeModel = localeModel.getModel('time');\n var month = timeModel.get('month');\n var monthAbbr = timeModel.get('monthAbbr');\n var dayOfWeek = timeModel.get('dayOfWeek');\n var dayOfWeekAbbr = timeModel.get('dayOfWeekAbbr');\n return (template || '').replace(/{yyyy}/g, y + '').replace(/{yy}/g, y % 100 + '').replace(/{Q}/g, q + '').replace(/{MMMM}/g, month[M - 1]).replace(/{MMM}/g, monthAbbr[M - 1]).replace(/{MM}/g, pad(M, 2)).replace(/{M}/g, M + '').replace(/{dd}/g, pad(d, 2)).replace(/{d}/g, d + '').replace(/{eeee}/g, dayOfWeek[e]).replace(/{ee}/g, dayOfWeekAbbr[e]).replace(/{e}/g, e + '').replace(/{HH}/g, pad(H, 2)).replace(/{H}/g, H + '').replace(/{hh}/g, pad(h + '', 2)).replace(/{h}/g, h + '').replace(/{mm}/g, pad(m, 2)).replace(/{m}/g, m + '').replace(/{ss}/g, pad(s, 2)).replace(/{s}/g, s + '').replace(/{SSS}/g, pad(S, 3)).replace(/{S}/g, S + '');\n}\nexport function leveledFormat(tick, idx, formatter, lang, isUTC) {\n var template = null;\n\n if (typeof formatter === 'string') {\n // Single formatter for all units at all levels\n template = formatter;\n } else if (typeof formatter === 'function') {\n // Callback formatter\n template = formatter(tick.value, idx, {\n level: tick.level\n });\n } else {\n var defaults = zrUtil.extend({}, defaultLeveledFormatter);\n\n if (tick.level > 0) {\n for (var i = 0; i < primaryTimeUnits.length; ++i) {\n defaults[primaryTimeUnits[i]] = \"{primary|\" + defaults[primaryTimeUnits[i]] + \"}\";\n }\n }\n\n var mergedFormatter = formatter ? formatter.inherit === false ? formatter // Use formatter with bigger units\n : zrUtil.defaults(formatter, defaults) : defaults;\n var unit = getUnitFromValue(tick.value, isUTC);\n\n if (mergedFormatter[unit]) {\n template = mergedFormatter[unit];\n } else if (mergedFormatter.inherit) {\n // Unit formatter is not defined and should inherit from bigger units\n var targetId = timeUnits.indexOf(unit);\n\n for (var i = targetId - 1; i >= 0; --i) {\n if (mergedFormatter[unit]) {\n template = mergedFormatter[unit];\n break;\n }\n }\n\n template = template || defaults.none;\n }\n\n if (zrUtil.isArray(template)) {\n var levelId = tick.level == null ? 0 : tick.level >= 0 ? tick.level : template.length + tick.level;\n levelId = Math.min(levelId, template.length - 1);\n template = template[levelId];\n }\n }\n\n return format(new Date(tick.value), template, isUTC, lang);\n}\nexport function getUnitFromValue(value, isUTC) {\n var date = numberUtil.parseDate(value);\n var M = date[monthGetterName(isUTC)]() + 1;\n var d = date[dateGetterName(isUTC)]();\n var h = date[hoursGetterName(isUTC)]();\n var m = date[minutesGetterName(isUTC)]();\n var s = date[secondsGetterName(isUTC)]();\n var S = date[millisecondsGetterName(isUTC)]();\n var isSecond = S === 0;\n var isMinute = isSecond && s === 0;\n var isHour = isMinute && m === 0;\n var isDay = isHour && h === 0;\n var isMonth = isDay && d === 1;\n var isYear = isMonth && M === 1;\n\n if (isYear) {\n return 'year';\n } else if (isMonth) {\n return 'month';\n } else if (isDay) {\n return 'day';\n } else if (isHour) {\n return 'hour';\n } else if (isMinute) {\n return 'minute';\n } else if (isSecond) {\n return 'second';\n } else {\n return 'millisecond';\n }\n}\nexport function getUnitValue(value, unit, isUTC) {\n var date = typeof value === 'number' ? numberUtil.parseDate(value) : value;\n unit = unit || getUnitFromValue(value, isUTC);\n\n switch (unit) {\n case 'year':\n return date[fullYearGetterName(isUTC)]();\n\n case 'half-year':\n return date[monthGetterName(isUTC)]() >= 6 ? 1 : 0;\n\n case 'quarter':\n return Math.floor((date[monthGetterName(isUTC)]() + 1) / 4);\n\n case 'month':\n return date[monthGetterName(isUTC)]();\n\n case 'day':\n return date[dateGetterName(isUTC)]();\n\n case 'half-day':\n return date[hoursGetterName(isUTC)]() / 24;\n\n case 'hour':\n return date[hoursGetterName(isUTC)]();\n\n case 'minute':\n return date[minutesGetterName(isUTC)]();\n\n case 'second':\n return date[secondsGetterName(isUTC)]();\n\n case 'millisecond':\n return date[millisecondsGetterName(isUTC)]();\n }\n}\nexport function fullYearGetterName(isUTC) {\n return isUTC ? 'getUTCFullYear' : 'getFullYear';\n}\nexport function monthGetterName(isUTC) {\n return isUTC ? 'getUTCMonth' : 'getMonth';\n}\nexport function dateGetterName(isUTC) {\n return isUTC ? 'getUTCDate' : 'getDate';\n}\nexport function hoursGetterName(isUTC) {\n return isUTC ? 'getUTCHours' : 'getHours';\n}\nexport function minutesGetterName(isUTC) {\n return isUTC ? 'getUTCMinutes' : 'getMinutes';\n}\nexport function secondsGetterName(isUTC) {\n return isUTC ? 'getUTCSeconds' : 'getSeconds';\n}\nexport function millisecondsGetterName(isUTC) {\n return isUTC ? 'getUTCSeconds' : 'getSeconds';\n}\nexport function fullYearSetterName(isUTC) {\n return isUTC ? 'setUTCFullYear' : 'setFullYear';\n}\nexport function monthSetterName(isUTC) {\n return isUTC ? 'setUTCMonth' : 'setMonth';\n}\nexport function dateSetterName(isUTC) {\n return isUTC ? 'setUTCDate' : 'setDate';\n}\nexport function hoursSetterName(isUTC) {\n return isUTC ? 'setUTCHours' : 'setHours';\n}\nexport function minutesSetterName(isUTC) {\n return isUTC ? 'setUTCMinutes' : 'setMinutes';\n}\nexport function secondsSetterName(isUTC) {\n return isUTC ? 'setUTCSeconds' : 'setSeconds';\n}\nexport function millisecondsSetterName(isUTC) {\n return isUTC ? 'setUTCSeconds' : 'setSeconds';\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { Text } from '../util/graphic';\nimport { deprecateLog } from '../util/log';\nexport function getTextRect(text, font, align, verticalAlign, padding, rich, truncate, lineHeight) {\n deprecateLog('getTextRect is deprecated.');\n var textEl = new Text({\n style: {\n text: text,\n font: font,\n align: align,\n verticalAlign: verticalAlign,\n padding: padding,\n rich: rich,\n overflow: truncate ? 'truncate' : null,\n lineHeight: lineHeight\n }\n });\n return textEl.getBoundingRect();\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util';\nimport { parseDate, isNumeric, numericToNumber } from './number';\nimport { format as timeFormat, pad } from './time';\nimport { deprecateReplaceLog } from './log';\n/**\n * Add a comma each three digit.\n */\n\nexport function addCommas(x) {\n if (!isNumeric(x)) {\n return zrUtil.isString(x) ? x : '-';\n }\n\n var parts = (x + '').split('.');\n return parts[0].replace(/(\\d{1,3})(?=(?:\\d{3})+(?!\\d))/g, '$1,') + (parts.length > 1 ? '.' + parts[1] : '');\n}\nexport function toCamelCase(str, upperCaseFirst) {\n str = (str || '').toLowerCase().replace(/-(.)/g, function (match, group1) {\n return group1.toUpperCase();\n });\n\n if (upperCaseFirst && str) {\n str = str.charAt(0).toUpperCase() + str.slice(1);\n }\n\n return str;\n}\nexport var normalizeCssArray = zrUtil.normalizeCssArray;\nvar replaceReg = /([&<>\"'])/g;\nvar replaceMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n '\\'': '''\n};\nexport function encodeHTML(source) {\n return source == null ? '' : (source + '').replace(replaceReg, function (str, c) {\n return replaceMap[c];\n });\n}\n/**\n * Make value user readable for tooltip and label.\n * \"User readable\":\n * Try to not print programmer-specific text like NaN, Infinity, null, undefined.\n * Avoid to display an empty string, which users can not recognize there is\n * a value and it might look like a bug.\n */\n\nexport function makeValueReadable(value, valueType, useUTC) {\n var USER_READABLE_DEFUALT_TIME_PATTERN = '{yyyy}-{MM}-{dd} {hh}:{mm}:{ss}';\n\n function stringToUserReadable(str) {\n return str && zrUtil.trim(str) ? str : '-';\n }\n\n function isNumberUserReadable(num) {\n return !!(num != null && !isNaN(num) && isFinite(num));\n }\n\n var isTypeTime = valueType === 'time';\n var isValueDate = value instanceof Date;\n\n if (isTypeTime || isValueDate) {\n var date = isTypeTime ? parseDate(value) : value;\n\n if (!isNaN(+date)) {\n return timeFormat(date, USER_READABLE_DEFUALT_TIME_PATTERN, useUTC);\n } else if (isValueDate) {\n return '-';\n } // In other cases, continue to try to display the value in the following code.\n\n }\n\n if (valueType === 'ordinal') {\n return zrUtil.isStringSafe(value) ? stringToUserReadable(value) : zrUtil.isNumber(value) ? isNumberUserReadable(value) ? value + '' : '-' : '-';\n } // By default.\n\n\n var numericResult = numericToNumber(value);\n return isNumberUserReadable(numericResult) ? addCommas(numericResult) : zrUtil.isStringSafe(value) ? stringToUserReadable(value) : '-';\n}\nvar TPL_VAR_ALIAS = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];\n\nvar wrapVar = function (varName, seriesIdx) {\n return '{' + varName + (seriesIdx == null ? '' : seriesIdx) + '}';\n};\n/**\n * Template formatter\n * @param {Array.|Object} paramsList\n */\n\n\nexport function formatTpl(tpl, paramsList, encode) {\n if (!zrUtil.isArray(paramsList)) {\n paramsList = [paramsList];\n }\n\n var seriesLen = paramsList.length;\n\n if (!seriesLen) {\n return '';\n }\n\n var $vars = paramsList[0].$vars || [];\n\n for (var i = 0; i < $vars.length; i++) {\n var alias = TPL_VAR_ALIAS[i];\n tpl = tpl.replace(wrapVar(alias), wrapVar(alias, 0));\n }\n\n for (var seriesIdx = 0; seriesIdx < seriesLen; seriesIdx++) {\n for (var k = 0; k < $vars.length; k++) {\n var val = paramsList[seriesIdx][$vars[k]];\n tpl = tpl.replace(wrapVar(TPL_VAR_ALIAS[k], seriesIdx), encode ? encodeHTML(val) : val);\n }\n }\n\n return tpl;\n}\n/**\n * simple Template formatter\n */\n\nexport function formatTplSimple(tpl, param, encode) {\n zrUtil.each(param, function (value, key) {\n tpl = tpl.replace('{' + key + '}', encode ? encodeHTML(value) : value);\n });\n return tpl;\n}\nexport function getTooltipMarker(inOpt, extraCssText) {\n var opt = zrUtil.isString(inOpt) ? {\n color: inOpt,\n extraCssText: extraCssText\n } : inOpt || {};\n var color = opt.color;\n var type = opt.type;\n extraCssText = opt.extraCssText;\n var renderMode = opt.renderMode || 'html';\n\n if (!color) {\n return '';\n }\n\n if (renderMode === 'html') {\n return type === 'subItem' ? '' : '';\n } else {\n // Should better not to auto generate style name by auto-increment number here.\n // Because this util is usually called in tooltip formatter, which is probably\n // called repeatly when mouse move and the auto-increment number increases fast.\n // Users can make their own style name by theirselves, make it unique and readable.\n var markerId = opt.markerId || 'markerX';\n return {\n renderMode: renderMode,\n content: '{' + markerId + '|} ',\n style: type === 'subItem' ? {\n width: 4,\n height: 4,\n borderRadius: 2,\n backgroundColor: color\n } : {\n width: 10,\n height: 10,\n borderRadius: 5,\n backgroundColor: color\n }\n };\n }\n}\n/**\n * @deprecated Use `time/format` instead.\n * ISO Date format\n * @param {string} tpl\n * @param {number} value\n * @param {boolean} [isUTC=false] Default in local time.\n * see `module:echarts/scale/Time`\n * and `module:echarts/util/number#parseDate`.\n * @inner\n */\n\nexport function formatTime(tpl, value, isUTC) {\n if (process.env.NODE_ENV !== 'production') {\n deprecateReplaceLog('echarts.format.formatTime', 'echarts.time.format');\n }\n\n if (tpl === 'week' || tpl === 'month' || tpl === 'quarter' || tpl === 'half-year' || tpl === 'year') {\n tpl = 'MM-dd\\nyyyy';\n }\n\n var date = parseDate(value);\n var utc = isUTC ? 'UTC' : '';\n var y = date['get' + utc + 'FullYear']();\n var M = date['get' + utc + 'Month']() + 1;\n var d = date['get' + utc + 'Date']();\n var h = date['get' + utc + 'Hours']();\n var m = date['get' + utc + 'Minutes']();\n var s = date['get' + utc + 'Seconds']();\n var S = date['get' + utc + 'Milliseconds']();\n tpl = tpl.replace('MM', pad(M, 2)).replace('M', M).replace('yyyy', y).replace('yy', y % 100 + '').replace('dd', pad(d, 2)).replace('d', d).replace('hh', pad(h, 2)).replace('h', h).replace('mm', pad(m, 2)).replace('m', m).replace('ss', pad(s, 2)).replace('s', s).replace('SSS', pad(S, 3));\n return tpl;\n}\n/**\n * Capital first\n * @param {string} str\n * @return {string}\n */\n\nexport function capitalFirst(str) {\n return str ? str.charAt(0).toUpperCase() + str.substr(1) : str;\n}\n/**\n * @return Never be null/undefined.\n */\n\nexport function convertToColorString(color, defaultColor) {\n defaultColor = defaultColor || 'transparent';\n return zrUtil.isString(color) ? color : zrUtil.isObject(color) ? color.colorStops && (color.colorStops[0] || {}).color || defaultColor : defaultColor;\n}\nexport { truncateText } from 'zrender/lib/graphic/helper/parseText';\n/**\n * open new tab\n * @param link url\n * @param target blank or self\n */\n\nexport function windowOpen(link, target) {\n /* global window */\n if (target === '_blank' || target === 'blank') {\n var blank = window.open();\n blank.opener = null;\n blank.location.href = link;\n } else {\n window.open(link, target);\n }\n}\nexport { getTextRect } from '../legacy/getTextRect';","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n// Layout helpers for each component positioning\nimport * as zrUtil from 'zrender/lib/core/util';\nimport BoundingRect from 'zrender/lib/core/BoundingRect';\nimport { parsePercent } from './number';\nimport * as formatUtil from './format';\nvar each = zrUtil.each;\n/**\n * @public\n */\n\nexport var LOCATION_PARAMS = ['left', 'right', 'top', 'bottom', 'width', 'height'];\n/**\n * @public\n */\n\nexport var HV_NAMES = [['width', 'left', 'right'], ['height', 'top', 'bottom']];\n\nfunction boxLayout(orient, group, gap, maxWidth, maxHeight) {\n var x = 0;\n var y = 0;\n\n if (maxWidth == null) {\n maxWidth = Infinity;\n }\n\n if (maxHeight == null) {\n maxHeight = Infinity;\n }\n\n var currentLineMaxSize = 0;\n group.eachChild(function (child, idx) {\n var rect = child.getBoundingRect();\n var nextChild = group.childAt(idx + 1);\n var nextChildRect = nextChild && nextChild.getBoundingRect();\n var nextX;\n var nextY;\n\n if (orient === 'horizontal') {\n var moveX = rect.width + (nextChildRect ? -nextChildRect.x + rect.x : 0);\n nextX = x + moveX; // Wrap when width exceeds maxWidth or meet a `newline` group\n // FIXME compare before adding gap?\n\n if (nextX > maxWidth || child.newline) {\n x = 0;\n nextX = moveX;\n y += currentLineMaxSize + gap;\n currentLineMaxSize = rect.height;\n } else {\n // FIXME: consider rect.y is not `0`?\n currentLineMaxSize = Math.max(currentLineMaxSize, rect.height);\n }\n } else {\n var moveY = rect.height + (nextChildRect ? -nextChildRect.y + rect.y : 0);\n nextY = y + moveY; // Wrap when width exceeds maxHeight or meet a `newline` group\n\n if (nextY > maxHeight || child.newline) {\n x += currentLineMaxSize + gap;\n y = 0;\n nextY = moveY;\n currentLineMaxSize = rect.width;\n } else {\n currentLineMaxSize = Math.max(currentLineMaxSize, rect.width);\n }\n }\n\n if (child.newline) {\n return;\n }\n\n child.x = x;\n child.y = y;\n child.markRedraw();\n orient === 'horizontal' ? x = nextX + gap : y = nextY + gap;\n });\n}\n/**\n * VBox or HBox layouting\n * @param {string} orient\n * @param {module:zrender/graphic/Group} group\n * @param {number} gap\n * @param {number} [width=Infinity]\n * @param {number} [height=Infinity]\n */\n\n\nexport var box = boxLayout;\n/**\n * VBox layouting\n * @param {module:zrender/graphic/Group} group\n * @param {number} gap\n * @param {number} [width=Infinity]\n * @param {number} [height=Infinity]\n */\n\nexport var vbox = zrUtil.curry(boxLayout, 'vertical');\n/**\n * HBox layouting\n * @param {module:zrender/graphic/Group} group\n * @param {number} gap\n * @param {number} [width=Infinity]\n * @param {number} [height=Infinity]\n */\n\nexport var hbox = zrUtil.curry(boxLayout, 'horizontal');\n/**\n * If x or x2 is not specified or 'center' 'left' 'right',\n * the width would be as long as possible.\n * If y or y2 is not specified or 'middle' 'top' 'bottom',\n * the height would be as long as possible.\n */\n\nexport function getAvailableSize(positionInfo, containerRect, margin) {\n var containerWidth = containerRect.width;\n var containerHeight = containerRect.height;\n var x = parsePercent(positionInfo.left, containerWidth);\n var y = parsePercent(positionInfo.top, containerHeight);\n var x2 = parsePercent(positionInfo.right, containerWidth);\n var y2 = parsePercent(positionInfo.bottom, containerHeight);\n (isNaN(x) || isNaN(parseFloat(positionInfo.left))) && (x = 0);\n (isNaN(x2) || isNaN(parseFloat(positionInfo.right))) && (x2 = containerWidth);\n (isNaN(y) || isNaN(parseFloat(positionInfo.top))) && (y = 0);\n (isNaN(y2) || isNaN(parseFloat(positionInfo.bottom))) && (y2 = containerHeight);\n margin = formatUtil.normalizeCssArray(margin || 0);\n return {\n width: Math.max(x2 - x - margin[1] - margin[3], 0),\n height: Math.max(y2 - y - margin[0] - margin[2], 0)\n };\n}\n/**\n * Parse position info.\n */\n\nexport function getLayoutRect(positionInfo, containerRect, margin) {\n margin = formatUtil.normalizeCssArray(margin || 0);\n var containerWidth = containerRect.width;\n var containerHeight = containerRect.height;\n var left = parsePercent(positionInfo.left, containerWidth);\n var top = parsePercent(positionInfo.top, containerHeight);\n var right = parsePercent(positionInfo.right, containerWidth);\n var bottom = parsePercent(positionInfo.bottom, containerHeight);\n var width = parsePercent(positionInfo.width, containerWidth);\n var height = parsePercent(positionInfo.height, containerHeight);\n var verticalMargin = margin[2] + margin[0];\n var horizontalMargin = margin[1] + margin[3];\n var aspect = positionInfo.aspect; // If width is not specified, calculate width from left and right\n\n if (isNaN(width)) {\n width = containerWidth - right - horizontalMargin - left;\n }\n\n if (isNaN(height)) {\n height = containerHeight - bottom - verticalMargin - top;\n }\n\n if (aspect != null) {\n // If width and height are not given\n // 1. Graph should not exceeds the container\n // 2. Aspect must be keeped\n // 3. Graph should take the space as more as possible\n // FIXME\n // Margin is not considered, because there is no case that both\n // using margin and aspect so far.\n if (isNaN(width) && isNaN(height)) {\n if (aspect > containerWidth / containerHeight) {\n width = containerWidth * 0.8;\n } else {\n height = containerHeight * 0.8;\n }\n } // Calculate width or height with given aspect\n\n\n if (isNaN(width)) {\n width = aspect * height;\n }\n\n if (isNaN(height)) {\n height = width / aspect;\n }\n } // If left is not specified, calculate left from right and width\n\n\n if (isNaN(left)) {\n left = containerWidth - right - width - horizontalMargin;\n }\n\n if (isNaN(top)) {\n top = containerHeight - bottom - height - verticalMargin;\n } // Align left and top\n\n\n switch (positionInfo.left || positionInfo.right) {\n case 'center':\n left = containerWidth / 2 - width / 2 - margin[3];\n break;\n\n case 'right':\n left = containerWidth - width - horizontalMargin;\n break;\n }\n\n switch (positionInfo.top || positionInfo.bottom) {\n case 'middle':\n case 'center':\n top = containerHeight / 2 - height / 2 - margin[0];\n break;\n\n case 'bottom':\n top = containerHeight - height - verticalMargin;\n break;\n } // If something is wrong and left, top, width, height are calculated as NaN\n\n\n left = left || 0;\n top = top || 0;\n\n if (isNaN(width)) {\n // Width may be NaN if only one value is given except width\n width = containerWidth - horizontalMargin - left - (right || 0);\n }\n\n if (isNaN(height)) {\n // Height may be NaN if only one value is given except height\n height = containerHeight - verticalMargin - top - (bottom || 0);\n }\n\n var rect = new BoundingRect(left + margin[3], top + margin[0], width, height);\n rect.margin = margin;\n return rect;\n}\n/**\n * Position a zr element in viewport\n * Group position is specified by either\n * {left, top}, {right, bottom}\n * If all properties exists, right and bottom will be igonred.\n *\n * Logic:\n * 1. Scale (against origin point in parent coord)\n * 2. Rotate (against origin point in parent coord)\n * 3. Traslate (with el.position by this method)\n * So this method only fixes the last step 'Traslate', which does not affect\n * scaling and rotating.\n *\n * If be called repeatly with the same input el, the same result will be gotten.\n *\n * @param el Should have `getBoundingRect` method.\n * @param positionInfo\n * @param positionInfo.left\n * @param positionInfo.top\n * @param positionInfo.right\n * @param positionInfo.bottom\n * @param positionInfo.width Only for opt.boundingModel: 'raw'\n * @param positionInfo.height Only for opt.boundingModel: 'raw'\n * @param containerRect\n * @param margin\n * @param opt\n * @param opt.hv Only horizontal or only vertical. Default to be [1, 1]\n * @param opt.boundingMode\n * Specify how to calculate boundingRect when locating.\n * 'all': Position the boundingRect that is transformed and uioned\n * both itself and its descendants.\n * This mode simplies confine the elements in the bounding\n * of their container (e.g., using 'right: 0').\n * 'raw': Position the boundingRect that is not transformed and only itself.\n * This mode is useful when you want a element can overflow its\n * container. (Consider a rotated circle needs to be located in a corner.)\n * In this mode positionInfo.width/height can only be number.\n */\n\nexport function positionElement(el, positionInfo, containerRect, margin, opt) {\n var h = !opt || !opt.hv || opt.hv[0];\n var v = !opt || !opt.hv || opt.hv[1];\n var boundingMode = opt && opt.boundingMode || 'all';\n\n if (!h && !v) {\n return;\n }\n\n var rect;\n\n if (boundingMode === 'raw') {\n rect = el.type === 'group' ? new BoundingRect(0, 0, +positionInfo.width || 0, +positionInfo.height || 0) : el.getBoundingRect();\n } else {\n rect = el.getBoundingRect();\n\n if (el.needLocalTransform()) {\n var transform = el.getLocalTransform(); // Notice: raw rect may be inner object of el,\n // which should not be modified.\n\n rect = rect.clone();\n rect.applyTransform(transform);\n }\n } // The real width and height can not be specified but calculated by the given el.\n\n\n var layoutRect = getLayoutRect(zrUtil.defaults({\n width: rect.width,\n height: rect.height\n }, positionInfo), containerRect, margin); // Because 'tranlate' is the last step in transform\n // (see zrender/core/Transformable#getLocalTransform),\n // we can just only modify el.position to get final result.\n\n var dx = h ? layoutRect.x - rect.x : 0;\n var dy = v ? layoutRect.y - rect.y : 0;\n\n if (boundingMode === 'raw') {\n el.x = dx;\n el.y = dy;\n } else {\n el.x += dx;\n el.y += dy;\n }\n\n el.markRedraw();\n}\n/**\n * @param option Contains some of the properties in HV_NAMES.\n * @param hvIdx 0: horizontal; 1: vertical.\n */\n\nexport function sizeCalculable(option, hvIdx) {\n return option[HV_NAMES[hvIdx][0]] != null || option[HV_NAMES[hvIdx][1]] != null && option[HV_NAMES[hvIdx][2]] != null;\n}\nexport function fetchLayoutMode(ins) {\n var layoutMode = ins.layoutMode || ins.constructor.layoutMode;\n return zrUtil.isObject(layoutMode) ? layoutMode : layoutMode ? {\n type: layoutMode\n } : null;\n}\n/**\n * Consider Case:\n * When default option has {left: 0, width: 100}, and we set {right: 0}\n * through setOption or media query, using normal zrUtil.merge will cause\n * {right: 0} does not take effect.\n *\n * @example\n * ComponentModel.extend({\n * init: function () {\n * ...\n * let inputPositionParams = layout.getLayoutParams(option);\n * this.mergeOption(inputPositionParams);\n * },\n * mergeOption: function (newOption) {\n * newOption && zrUtil.merge(thisOption, newOption, true);\n * layout.mergeLayoutParam(thisOption, newOption);\n * }\n * });\n *\n * @param targetOption\n * @param newOption\n * @param opt\n */\n\nexport function mergeLayoutParam(targetOption, newOption, opt) {\n var ignoreSize = opt && opt.ignoreSize;\n !zrUtil.isArray(ignoreSize) && (ignoreSize = [ignoreSize, ignoreSize]);\n var hResult = merge(HV_NAMES[0], 0);\n var vResult = merge(HV_NAMES[1], 1);\n copy(HV_NAMES[0], targetOption, hResult);\n copy(HV_NAMES[1], targetOption, vResult);\n\n function merge(names, hvIdx) {\n var newParams = {};\n var newValueCount = 0;\n var merged = {};\n var mergedValueCount = 0;\n var enoughParamNumber = 2;\n each(names, function (name) {\n merged[name] = targetOption[name];\n });\n each(names, function (name) {\n // Consider case: newOption.width is null, which is\n // set by user for removing width setting.\n hasProp(newOption, name) && (newParams[name] = merged[name] = newOption[name]);\n hasValue(newParams, name) && newValueCount++;\n hasValue(merged, name) && mergedValueCount++;\n });\n\n if (ignoreSize[hvIdx]) {\n // Only one of left/right is premitted to exist.\n if (hasValue(newOption, names[1])) {\n merged[names[2]] = null;\n } else if (hasValue(newOption, names[2])) {\n merged[names[1]] = null;\n }\n\n return merged;\n } // Case: newOption: {width: ..., right: ...},\n // or targetOption: {right: ...} and newOption: {width: ...},\n // There is no conflict when merged only has params count\n // little than enoughParamNumber.\n\n\n if (mergedValueCount === enoughParamNumber || !newValueCount) {\n return merged;\n } // Case: newOption: {width: ..., right: ...},\n // Than we can make sure user only want those two, and ignore\n // all origin params in targetOption.\n else if (newValueCount >= enoughParamNumber) {\n return newParams;\n } else {\n // Chose another param from targetOption by priority.\n for (var i = 0; i < names.length; i++) {\n var name_1 = names[i];\n\n if (!hasProp(newParams, name_1) && hasProp(targetOption, name_1)) {\n newParams[name_1] = targetOption[name_1];\n break;\n }\n }\n\n return newParams;\n }\n }\n\n function hasProp(obj, name) {\n return obj.hasOwnProperty(name);\n }\n\n function hasValue(obj, name) {\n return obj[name] != null && obj[name] !== 'auto';\n }\n\n function copy(names, target, source) {\n each(names, function (name) {\n target[name] = source[name];\n });\n }\n}\n/**\n * Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object.\n */\n\nexport function getLayoutParams(source) {\n return copyLayoutParams({}, source);\n}\n/**\n * Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object.\n * @param {Object} source\n * @return {Object} Result contains those props.\n */\n\nexport function copyLayoutParams(target, source) {\n source && target && each(LOCATION_PARAMS, function (name) {\n source.hasOwnProperty(name) && (target[name] = source[name]);\n });\n return target;\n}","import Texture2D from '../Texture2D';\nimport glenum from '../core/glenum';\nimport util from '../core/util';\n\nvar TexturePool = function () {\n\n this._pool = {};\n\n this._allocatedTextures = [];\n};\n\nTexturePool.prototype = {\n\n constructor: TexturePool,\n\n get: function (parameters) {\n var key = generateKey(parameters);\n if (!this._pool.hasOwnProperty(key)) {\n this._pool[key] = [];\n }\n var list = this._pool[key];\n if (!list.length) {\n var texture = new Texture2D(parameters);\n this._allocatedTextures.push(texture);\n return texture;\n }\n return list.pop();\n },\n\n put: function (texture) {\n var key = generateKey(texture);\n if (!this._pool.hasOwnProperty(key)) {\n this._pool[key] = [];\n }\n var list = this._pool[key];\n list.push(texture);\n },\n\n clear: function (renderer) {\n for (var i = 0; i < this._allocatedTextures.length; i++) {\n this._allocatedTextures[i].dispose(renderer);\n }\n this._pool = {};\n this._allocatedTextures = [];\n }\n};\n\nvar defaultParams = {\n width: 512,\n height: 512,\n type: glenum.UNSIGNED_BYTE,\n format: glenum.RGBA,\n wrapS: glenum.CLAMP_TO_EDGE,\n wrapT: glenum.CLAMP_TO_EDGE,\n minFilter: glenum.LINEAR_MIPMAP_LINEAR,\n magFilter: glenum.LINEAR,\n useMipmap: true,\n anisotropic: 1,\n flipY: true,\n unpackAlignment: 4,\n premultiplyAlpha: false\n};\n\nvar defaultParamPropList = Object.keys(defaultParams);\n\nfunction generateKey(parameters) {\n util.defaultsWithPropList(parameters, defaultParams, defaultParamPropList);\n fallBack(parameters);\n\n var key = '';\n for (var i = 0; i < defaultParamPropList.length; i++) {\n var name = defaultParamPropList[i];\n var chunk = parameters[name].toString();\n key += chunk;\n }\n return key;\n}\n\nfunction fallBack(target) {\n\n var IPOT = isPowerOfTwo(target.width, target.height);\n\n if (target.format === glenum.DEPTH_COMPONENT) {\n target.useMipmap = false;\n }\n\n if (!IPOT || !target.useMipmap) {\n if (target.minFilter == glenum.NEAREST_MIPMAP_NEAREST ||\n target.minFilter == glenum.NEAREST_MIPMAP_LINEAR) {\n target.minFilter = glenum.NEAREST;\n } else if (\n target.minFilter == glenum.LINEAR_MIPMAP_LINEAR ||\n target.minFilter == glenum.LINEAR_MIPMAP_NEAREST\n ) {\n target.minFilter = glenum.LINEAR;\n }\n }\n if (!IPOT) {\n target.wrapS = glenum.CLAMP_TO_EDGE;\n target.wrapT = glenum.CLAMP_TO_EDGE;\n }\n}\n\nfunction isPowerOfTwo(width, height) {\n return (width & (width-1)) === 0 &&\n (height & (height-1)) === 0;\n}\n\nexport default TexturePool;\n","export default \"@export clay.sm.depth.vertex\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nattribute vec3 position : POSITION;\\nattribute vec2 texcoord : TEXCOORD_0;\\nuniform vec2 uvRepeat = vec2(1.0, 1.0);\\nuniform vec2 uvOffset = vec2(0.0, 0.0);\\n@import clay.chunk.skinning_header\\n@import clay.chunk.instancing_header\\nvarying vec4 v_ViewPosition;\\nvarying vec2 v_Texcoord;\\nvoid main(){\\n vec4 P = vec4(position, 1.0);\\n#ifdef SKINNING\\n @import clay.chunk.skin_matrix\\n P = skinMatrixWS * P;\\n#endif\\n#ifdef INSTANCING\\n @import clay.chunk.instancing_matrix\\n P = instanceMat * P;\\n#endif\\n v_ViewPosition = worldViewProjection * P;\\n gl_Position = v_ViewPosition;\\n v_Texcoord = texcoord * uvRepeat + uvOffset;\\n}\\n@end\\n@export clay.sm.depth.fragment\\nvarying vec4 v_ViewPosition;\\nvarying vec2 v_Texcoord;\\nuniform float bias : 0.001;\\nuniform float slopeScale : 1.0;\\nuniform sampler2D alphaMap;\\nuniform float alphaCutoff: 0.0;\\n@import clay.util.encode_float\\nvoid main(){\\n float depth = v_ViewPosition.z / v_ViewPosition.w;\\n if (alphaCutoff > 0.0) {\\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\\n discard;\\n }\\n }\\n#ifdef USE_VSM\\n depth = depth * 0.5 + 0.5;\\n float moment1 = depth;\\n float moment2 = depth * depth;\\n #ifdef SUPPORT_STANDARD_DERIVATIVES\\n float dx = dFdx(depth);\\n float dy = dFdy(depth);\\n moment2 += 0.25*(dx*dx+dy*dy);\\n #endif\\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\\n#else\\n #ifdef SUPPORT_STANDARD_DERIVATIVES\\n float dx = dFdx(depth);\\n float dy = dFdy(depth);\\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\\n #else\\n depth += bias;\\n #endif\\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\\n#endif\\n}\\n@end\\n@export clay.sm.debug_depth\\nuniform sampler2D depthMap;\\nvarying vec2 v_Texcoord;\\n@import clay.util.decode_float\\nvoid main() {\\n vec4 tex = texture2D(depthMap, v_Texcoord);\\n#ifdef USE_VSM\\n gl_FragColor = vec4(tex.rgb, 1.0);\\n#else\\n float depth = decodeFloat(tex);\\n gl_FragColor = vec4(depth, depth, depth, 1.0);\\n#endif\\n}\\n@end\\n@export clay.sm.distance.vertex\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform mat4 world : WORLD;\\nattribute vec3 position : POSITION;\\n@import clay.chunk.skinning_header\\nvarying vec3 v_WorldPosition;\\nvoid main (){\\n vec4 P = vec4(position, 1.0);\\n#ifdef SKINNING\\n @import clay.chunk.skin_matrix\\n P = skinMatrixWS * P;\\n#endif\\n#ifdef INSTANCING\\n @import clay.chunk.instancing_matrix\\n P = instanceMat * P;\\n#endif\\n gl_Position = worldViewProjection * P;\\n v_WorldPosition = (world * P).xyz;\\n}\\n@end\\n@export clay.sm.distance.fragment\\nuniform vec3 lightPosition;\\nuniform float range : 100;\\nvarying vec3 v_WorldPosition;\\n@import clay.util.encode_float\\nvoid main(){\\n float dist = distance(lightPosition, v_WorldPosition);\\n#ifdef USE_VSM\\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\\n#else\\n dist = dist / range;\\n gl_FragColor = encodeFloat(dist);\\n#endif\\n}\\n@end\\n@export clay.plugin.shadow_map_common\\n@import clay.util.decode_float\\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\\n vec4 tex = texture2D(map, uv);\\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\\n}\\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\\n float shadowContrib = tapShadowMap(map, uv, z);\\n vec2 offset = vec2(1.0 / textureSize) * scale;\\n#ifdef PCF_KERNEL_SIZE\\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\\n }}\\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\\n#else\\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\\n return shadowContrib / 9.0;\\n#endif\\n}\\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\\n return pcf(map, uv, z, textureSize, vec2(1.0));\\n}\\nfloat chebyshevUpperBound(vec2 moments, float z){\\n float p = 0.0;\\n z = z * 0.5 + 0.5;\\n if (z <= moments.x) {\\n p = 1.0;\\n }\\n float variance = moments.y - moments.x * moments.x;\\n variance = max(variance, 0.0000001);\\n float mD = moments.x - z;\\n float pMax = variance / (variance + mD * mD);\\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\\n return max(p, pMax);\\n}\\nfloat computeShadowContrib(\\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\\n) {\\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\\n posInLightSpace.xyz /= posInLightSpace.w;\\n float z = posInLightSpace.z;\\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\\n #ifdef USE_VSM\\n vec2 moments = texture2D(map, uv * scale + offset).xy;\\n return chebyshevUpperBound(moments, z);\\n #else\\n return pcf(map, uv * scale + offset, z, textureSize, scale);\\n #endif\\n }\\n return 1.0;\\n}\\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\\n}\\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\\n{\\n float dist = length(direction);\\n vec4 shadowTex = textureCube(map, direction);\\n#ifdef USE_VSM\\n vec2 moments = shadowTex.xy;\\n float variance = moments.y - moments.x * moments.x;\\n float mD = moments.x - dist;\\n float p = variance / (variance + mD * mD);\\n if(moments.x + 0.001 < dist){\\n return clamp(p, 0.0, 1.0);\\n }else{\\n return 1.0;\\n }\\n#else\\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\\n#endif\\n}\\n@end\\n@export clay.plugin.compute_shadow_map\\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\n#endif\\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\\n#if defined(SHADOW_CASCADE)\\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\\n#else\\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\n#endif\\n#endif\\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\\n#endif\\nuniform bool shadowEnabled : true;\\n#ifdef PCF_KERNEL_SIZE\\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\\n#endif\\n@import clay.plugin.shadow_map_common\\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\\n float shadowContrib;\\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\\n shadowContrib = computeShadowContrib(\\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\\n spotLightShadowMapSizes[_idx_]\\n );\\n shadowContribs[_idx_] = shadowContrib;\\n }}\\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\\n shadowContribs[_idx_] = 1.0;\\n }}\\n}\\n#endif\\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n#ifdef SHADOW_CASCADE\\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\\n / (gl_DepthRange.far - gl_DepthRange.near);\\n float shadowContrib;\\n shadowContribs[0] = 1.0;\\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\\n if (\\n depth >= shadowCascadeClipsNear[_idx_] &&\\n depth <= shadowCascadeClipsFar[_idx_]\\n ) {\\n shadowContrib = computeShadowContrib(\\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\\n directionalLightShadowMapSizes[0],\\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\\n );\\n shadowContribs[0] = shadowContrib;\\n }\\n }}\\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\\n shadowContribs[_idx_] = 1.0;\\n }}\\n}\\n#else\\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\\n float shadowContrib;\\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\\n shadowContrib = computeShadowContrib(\\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\\n directionalLightShadowMapSizes[_idx_]\\n );\\n shadowContribs[_idx_] = shadowContrib;\\n }}\\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\\n shadowContribs[_idx_] = 1.0;\\n }}\\n}\\n#endif\\n#endif\\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\\n vec3 lightPosition;\\n vec3 direction;\\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\\n lightPosition = pointLightPosition[_idx_];\\n direction = position - lightPosition;\\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\\n }}\\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\\n shadowContribs[_idx_] = 1.0;\\n }}\\n}\\n#endif\\n#endif\\n@end\";\n","import Base from '../core/Base';\nimport glenum from '../core/glenum';\nimport Vector3 from '../math/Vector3';\nimport BoundingBox from '../math/BoundingBox';\nimport Frustum from '../math/Frustum';\nimport Matrix4 from '../math/Matrix4';\nimport Renderer from '../Renderer';\nimport Shader from '../Shader';\nimport Material from '../Material';\nimport FrameBuffer from '../FrameBuffer';\nimport Texture from '../Texture';\nimport Texture2D from '../Texture2D';\nimport TextureCube from '../TextureCube';\nimport PerspectiveCamera from '../camera/Perspective';\nimport OrthoCamera from '../camera/Orthographic';\n\nimport Pass from '../compositor/Pass';\nimport TexturePool from '../compositor/TexturePool';\n\nimport mat4 from '../glmatrix/mat4';\n\nvar targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz'];\n\nimport shadowmapEssl from '../shader/source/shadowmap.glsl.js';\nShader['import'](shadowmapEssl);\n\nfunction getDepthMaterialUniform(renderable, depthMaterial, symbol) {\n if (symbol === 'alphaMap') {\n return renderable.material.get('diffuseMap');\n }\n else if (symbol === 'alphaCutoff') {\n if (renderable.material.isDefined('fragment', 'ALPHA_TEST')\n && renderable.material.get('diffuseMap')\n ) {\n var alphaCutoff = renderable.material.get('alphaCutoff');\n return alphaCutoff || 0;\n }\n return 0;\n }\n else if (symbol === 'uvRepeat') {\n return renderable.material.get('uvRepeat');\n }\n else if (symbol === 'uvOffset') {\n return renderable.material.get('uvOffset');\n }\n else {\n return depthMaterial.get(symbol);\n }\n}\n\nfunction isDepthMaterialChanged(renderable, prevRenderable) {\n var matA = renderable.material;\n var matB = prevRenderable.material;\n return matA.get('diffuseMap') !== matB.get('diffuseMap')\n || (matA.get('alphaCutoff') || 0) !== (matB.get('alphaCutoff') || 0);\n}\n\n/**\n * Pass rendering shadow map.\n *\n * @constructor clay.prePass.ShadowMap\n * @extends clay.core.Base\n * @example\n * var shadowMapPass = new clay.prePass.ShadowMap({\n * softShadow: clay.prePass.ShadowMap.VSM\n * });\n * ...\n * animation.on('frame', function (frameTime) {\n * shadowMapPass.render(renderer, scene, camera);\n * renderer.render(scene, camera);\n * });\n */\nvar ShadowMapPass = Base.extend(function () {\n return /** @lends clay.prePass.ShadowMap# */ {\n /**\n * Soft shadow technique.\n * Can be {@link clay.prePass.ShadowMap.PCF} or {@link clay.prePass.ShadowMap.VSM}\n * @type {number}\n */\n softShadow: ShadowMapPass.PCF,\n\n /**\n * Soft shadow blur size\n * @type {number}\n */\n shadowBlur: 1.0,\n\n lightFrustumBias: 'auto',\n\n kernelPCF: new Float32Array([\n 1, 0,\n 1, 1,\n -1, 1,\n 0, 1,\n -1, 0,\n -1, -1,\n 1, -1,\n 0, -1\n ]),\n\n precision: 'highp',\n\n _lastRenderNotCastShadow: false,\n\n _frameBuffer: new FrameBuffer(),\n\n _textures: {},\n _shadowMapNumber: {\n 'POINT_LIGHT': 0,\n 'DIRECTIONAL_LIGHT': 0,\n 'SPOT_LIGHT': 0\n },\n\n _depthMaterials: {},\n _distanceMaterials: {},\n\n _receivers: [],\n _lightsCastShadow: [],\n\n _lightCameras: {},\n _lightMaterials: {},\n\n _texturePool: new TexturePool()\n };\n}, function () {\n // Gaussian filter pass for VSM\n this._gaussianPassH = new Pass({\n fragment: Shader.source('clay.compositor.gaussian_blur')\n });\n this._gaussianPassV = new Pass({\n fragment: Shader.source('clay.compositor.gaussian_blur')\n });\n this._gaussianPassH.setUniform('blurSize', this.shadowBlur);\n this._gaussianPassH.setUniform('blurDir', 0.0);\n this._gaussianPassV.setUniform('blurSize', this.shadowBlur);\n this._gaussianPassV.setUniform('blurDir', 1.0);\n\n this._outputDepthPass = new Pass({\n fragment: Shader.source('clay.sm.debug_depth')\n });\n}, {\n /**\n * Render scene to shadow textures\n * @param {clay.Renderer} renderer\n * @param {clay.Scene} scene\n * @param {clay.Camera} sceneCamera\n * @param {boolean} [notUpdateScene=false]\n * @memberOf clay.prePass.ShadowMap.prototype\n */\n render: function (renderer, scene, sceneCamera, notUpdateScene) {\n if (!sceneCamera) {\n sceneCamera = scene.getMainCamera();\n }\n this.trigger('beforerender', this, renderer, scene, sceneCamera);\n this._renderShadowPass(renderer, scene, sceneCamera, notUpdateScene);\n this.trigger('afterrender', this, renderer, scene, sceneCamera);\n },\n\n /**\n * Debug rendering of shadow textures\n * @param {clay.Renderer} renderer\n * @param {number} size\n * @memberOf clay.prePass.ShadowMap.prototype\n */\n renderDebug: function (renderer, size) {\n renderer.saveClear();\n var viewport = renderer.viewport;\n var x = 0, y = 0;\n var width = size || viewport.width / 4;\n var height = width;\n if (this.softShadow === ShadowMapPass.VSM) {\n this._outputDepthPass.material.define('fragment', 'USE_VSM');\n }\n else {\n this._outputDepthPass.material.undefine('fragment', 'USE_VSM');\n }\n for (var name in this._textures) {\n var texture = this._textures[name];\n renderer.setViewport(x, y, width * texture.width / texture.height, height);\n this._outputDepthPass.setUniform('depthMap', texture);\n this._outputDepthPass.render(renderer);\n x += width * texture.width / texture.height;\n }\n renderer.setViewport(viewport);\n renderer.restoreClear();\n },\n\n _updateReceivers: function (renderer, mesh) {\n if (mesh.receiveShadow) {\n this._receivers.push(mesh);\n mesh.material.set('shadowEnabled', 1);\n\n mesh.material.set('pcfKernel', this.kernelPCF);\n }\n else {\n mesh.material.set('shadowEnabled', 0);\n }\n\n if (this.softShadow === ShadowMapPass.VSM) {\n mesh.material.define('fragment', 'USE_VSM');\n mesh.material.undefine('fragment', 'PCF_KERNEL_SIZE');\n }\n else {\n mesh.material.undefine('fragment', 'USE_VSM');\n var kernelPCF = this.kernelPCF;\n if (kernelPCF && kernelPCF.length) {\n mesh.material.define('fragment', 'PCF_KERNEL_SIZE', kernelPCF.length / 2);\n }\n else {\n mesh.material.undefine('fragment', 'PCF_KERNEL_SIZE');\n }\n }\n },\n\n _update: function (renderer, scene) {\n var self = this;\n scene.traverse(function (renderable) {\n if (renderable.isRenderable()) {\n self._updateReceivers(renderer, renderable);\n }\n });\n\n for (var i = 0; i < scene.lights.length; i++) {\n var light = scene.lights[i];\n if (light.castShadow && !light.invisible) {\n this._lightsCastShadow.push(light);\n }\n }\n },\n\n _renderShadowPass: function (renderer, scene, sceneCamera, notUpdateScene) {\n // reset\n for (var name in this._shadowMapNumber) {\n this._shadowMapNumber[name] = 0;\n }\n this._lightsCastShadow.length = 0;\n this._receivers.length = 0;\n\n var _gl = renderer.gl;\n\n if (!notUpdateScene) {\n scene.update();\n }\n if (sceneCamera) {\n sceneCamera.update();\n }\n\n scene.updateLights();\n this._update(renderer, scene);\n\n // Needs to update the receivers again if shadows come from 1 to 0.\n if (!this._lightsCastShadow.length && this._lastRenderNotCastShadow) {\n return;\n }\n\n this._lastRenderNotCastShadow = this._lightsCastShadow === 0;\n\n _gl.enable(_gl.DEPTH_TEST);\n _gl.depthMask(true);\n _gl.disable(_gl.BLEND);\n\n // Clear with high-z, so the part not rendered will not been shadowed\n // TODO\n // TODO restore\n _gl.clearColor(1.0, 1.0, 1.0, 1.0);\n\n // Shadow uniforms\n var spotLightShadowMaps = [];\n var spotLightMatrices = [];\n var directionalLightShadowMaps = [];\n var directionalLightMatrices = [];\n var shadowCascadeClips = [];\n var pointLightShadowMaps = [];\n\n var dirLightHasCascade;\n // Create textures for shadow map\n for (var i = 0; i < this._lightsCastShadow.length; i++) {\n var light = this._lightsCastShadow[i];\n if (light.type === 'DIRECTIONAL_LIGHT') {\n\n if (dirLightHasCascade) {\n console.warn('Only one direectional light supported with shadow cascade');\n continue;\n }\n if (light.shadowCascade > 4) {\n console.warn('Support at most 4 cascade');\n continue;\n }\n if (light.shadowCascade > 1) {\n dirLightHasCascade = light;\n }\n\n this.renderDirectionalLightShadow(\n renderer,\n scene,\n sceneCamera,\n light,\n shadowCascadeClips,\n directionalLightMatrices,\n directionalLightShadowMaps\n );\n }\n else if (light.type === 'SPOT_LIGHT') {\n this.renderSpotLightShadow(\n renderer,\n scene,\n light,\n spotLightMatrices,\n spotLightShadowMaps\n );\n }\n else if (light.type === 'POINT_LIGHT') {\n this.renderPointLightShadow(\n renderer,\n scene,\n light,\n pointLightShadowMaps\n );\n }\n\n this._shadowMapNumber[light.type]++;\n }\n\n for (var lightType in this._shadowMapNumber) {\n var number = this._shadowMapNumber[lightType];\n var key = lightType + '_SHADOWMAP_COUNT';\n for (var i = 0; i < this._receivers.length; i++) {\n var mesh = this._receivers[i];\n var material = mesh.material;\n if (material.fragmentDefines[key] !== number) {\n if (number > 0) {\n material.define('fragment', key, number);\n }\n else if (material.isDefined('fragment', key)) {\n material.undefine('fragment', key);\n }\n }\n }\n }\n for (var i = 0; i < this._receivers.length; i++) {\n var mesh = this._receivers[i];\n var material = mesh.material;\n if (dirLightHasCascade) {\n material.define('fragment', 'SHADOW_CASCADE', dirLightHasCascade.shadowCascade);\n }\n else {\n material.undefine('fragment', 'SHADOW_CASCADE');\n }\n }\n\n var shadowUniforms = scene.shadowUniforms;\n\n function getSize(texture) {\n return texture.height;\n }\n if (directionalLightShadowMaps.length > 0) {\n var directionalLightShadowMapSizes = directionalLightShadowMaps.map(getSize);\n shadowUniforms.directionalLightShadowMaps = { value: directionalLightShadowMaps, type: 'tv' };\n shadowUniforms.directionalLightMatrices = { value: directionalLightMatrices, type: 'm4v' };\n shadowUniforms.directionalLightShadowMapSizes = { value: directionalLightShadowMapSizes, type: '1fv' };\n if (dirLightHasCascade) {\n var shadowCascadeClipsNear = shadowCascadeClips.slice();\n var shadowCascadeClipsFar = shadowCascadeClips.slice();\n shadowCascadeClipsNear.pop();\n shadowCascadeClipsFar.shift();\n\n // Iterate from far to near\n shadowCascadeClipsNear.reverse();\n shadowCascadeClipsFar.reverse();\n // directionalLightShadowMaps.reverse();\n directionalLightMatrices.reverse();\n shadowUniforms.shadowCascadeClipsNear = { value: shadowCascadeClipsNear, type: '1fv' };\n shadowUniforms.shadowCascadeClipsFar = { value: shadowCascadeClipsFar, type: '1fv' };\n }\n }\n\n if (spotLightShadowMaps.length > 0) {\n var spotLightShadowMapSizes = spotLightShadowMaps.map(getSize);\n var shadowUniforms = scene.shadowUniforms;\n shadowUniforms.spotLightShadowMaps = { value: spotLightShadowMaps, type: 'tv' };\n shadowUniforms.spotLightMatrices = { value: spotLightMatrices, type: 'm4v' };\n shadowUniforms.spotLightShadowMapSizes = { value: spotLightShadowMapSizes, type: '1fv' };\n }\n\n if (pointLightShadowMaps.length > 0) {\n shadowUniforms.pointLightShadowMaps = { value: pointLightShadowMaps, type: 'tv' };\n }\n },\n\n renderDirectionalLightShadow: (function () {\n\n var splitFrustum = new Frustum();\n var splitProjMatrix = new Matrix4();\n var cropBBox = new BoundingBox();\n var cropMatrix = new Matrix4();\n var lightViewMatrix = new Matrix4();\n var lightViewProjMatrix = new Matrix4();\n var lightProjMatrix = new Matrix4();\n\n return function (renderer, scene, sceneCamera, light, shadowCascadeClips, directionalLightMatrices, directionalLightShadowMaps) {\n\n var defaultShadowMaterial = this._getDepthMaterial(light);\n var passConfig = {\n getMaterial: function (renderable) {\n return renderable.shadowDepthMaterial || defaultShadowMaterial;\n },\n isMaterialChanged: isDepthMaterialChanged,\n getUniform: getDepthMaterialUniform,\n ifRender: function (renderable) {\n return renderable.castShadow;\n },\n sortCompare: Renderer.opaqueSortCompare\n };\n\n // First frame\n if (!scene.viewBoundingBoxLastFrame.isFinite()) {\n var boundingBox = scene.getBoundingBox();\n scene.viewBoundingBoxLastFrame\n .copy(boundingBox).applyTransform(sceneCamera.viewMatrix);\n }\n // Considering moving speed since the bounding box is from last frame\n // TODO: add a bias\n var clippedFar = Math.min(-scene.viewBoundingBoxLastFrame.min.z, sceneCamera.far);\n var clippedNear = Math.max(-scene.viewBoundingBoxLastFrame.max.z, sceneCamera.near);\n\n var lightCamera = this._getDirectionalLightCamera(light, scene, sceneCamera);\n\n var lvpMat4Arr = lightViewProjMatrix.array;\n lightProjMatrix.copy(lightCamera.projectionMatrix);\n mat4.invert(lightViewMatrix.array, lightCamera.worldTransform.array);\n mat4.multiply(lightViewMatrix.array, lightViewMatrix.array, sceneCamera.worldTransform.array);\n mat4.multiply(lvpMat4Arr, lightProjMatrix.array, lightViewMatrix.array);\n\n var clipPlanes = [];\n var isPerspective = sceneCamera instanceof PerspectiveCamera;\n\n var scaleZ = (sceneCamera.near + sceneCamera.far) / (sceneCamera.near - sceneCamera.far);\n var offsetZ = 2 * sceneCamera.near * sceneCamera.far / (sceneCamera.near - sceneCamera.far);\n for (var i = 0; i <= light.shadowCascade; i++) {\n var clog = clippedNear * Math.pow(clippedFar / clippedNear, i / light.shadowCascade);\n var cuni = clippedNear + (clippedFar - clippedNear) * i / light.shadowCascade;\n var c = clog * light.cascadeSplitLogFactor + cuni * (1 - light.cascadeSplitLogFactor);\n clipPlanes.push(c);\n shadowCascadeClips.push(-(-c * scaleZ + offsetZ) / -c);\n }\n var texture = this._getTexture(light, light.shadowCascade);\n directionalLightShadowMaps.push(texture);\n\n var viewport = renderer.viewport;\n\n var _gl = renderer.gl;\n this._frameBuffer.attach(texture);\n this._frameBuffer.bind(renderer);\n _gl.clear(_gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT);\n\n for (var i = 0; i < light.shadowCascade; i++) {\n // Get the splitted frustum\n var nearPlane = clipPlanes[i];\n var farPlane = clipPlanes[i + 1];\n if (isPerspective) {\n mat4.perspective(splitProjMatrix.array, sceneCamera.fov / 180 * Math.PI, sceneCamera.aspect, nearPlane, farPlane);\n }\n else {\n mat4.ortho(\n splitProjMatrix.array,\n sceneCamera.left, sceneCamera.right, sceneCamera.bottom, sceneCamera.top,\n nearPlane, farPlane\n );\n }\n splitFrustum.setFromProjection(splitProjMatrix);\n splitFrustum.getTransformedBoundingBox(cropBBox, lightViewMatrix);\n cropBBox.applyProjection(lightProjMatrix);\n var _min = cropBBox.min.array;\n var _max = cropBBox.max.array;\n _min[0] = Math.max(_min[0], -1);\n _min[1] = Math.max(_min[1], -1);\n _max[0] = Math.min(_max[0], 1);\n _max[1] = Math.min(_max[1], 1);\n cropMatrix.ortho(_min[0], _max[0], _min[1], _max[1], 1, -1);\n lightCamera.projectionMatrix.multiplyLeft(cropMatrix);\n\n var shadowSize = light.shadowResolution || 512;\n\n // Reversed, left to right => far to near\n renderer.setViewport((light.shadowCascade - i - 1) * shadowSize, 0, shadowSize, shadowSize, 1);\n\n var renderList = scene.updateRenderList(lightCamera);\n renderer.renderPass(renderList.opaque, lightCamera, passConfig);\n\n // Filter for VSM\n if (this.softShadow === ShadowMapPass.VSM) {\n this._gaussianFilter(renderer, texture, texture.width);\n }\n\n var matrix = new Matrix4();\n matrix.copy(lightCamera.viewMatrix)\n .multiplyLeft(lightCamera.projectionMatrix);\n\n directionalLightMatrices.push(matrix.array);\n\n lightCamera.projectionMatrix.copy(lightProjMatrix);\n }\n\n this._frameBuffer.unbind(renderer);\n\n renderer.setViewport(viewport);\n };\n })(),\n\n renderSpotLightShadow: function (renderer, scene, light, spotLightMatrices, spotLightShadowMaps) {\n\n var texture = this._getTexture(light);\n var lightCamera = this._getSpotLightCamera(light);\n var _gl = renderer.gl;\n\n this._frameBuffer.attach(texture);\n this._frameBuffer.bind(renderer);\n\n _gl.clear(_gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT);\n\n var defaultShadowMaterial = this._getDepthMaterial(light);\n var passConfig = {\n getMaterial: function (renderable) {\n return renderable.shadowDepthMaterial || defaultShadowMaterial;\n },\n isMaterialChanged: isDepthMaterialChanged,\n getUniform: getDepthMaterialUniform,\n ifRender: function (renderable) {\n return renderable.castShadow;\n },\n sortCompare: Renderer.opaqueSortCompare\n };\n\n var renderList = scene.updateRenderList(lightCamera);\n renderer.renderPass(renderList.opaque, lightCamera, passConfig);\n\n this._frameBuffer.unbind(renderer);\n\n // Filter for VSM\n if (this.softShadow === ShadowMapPass.VSM) {\n this._gaussianFilter(renderer, texture, texture.width);\n }\n\n var matrix = new Matrix4();\n matrix.copy(lightCamera.worldTransform)\n .invert()\n .multiplyLeft(lightCamera.projectionMatrix);\n\n spotLightShadowMaps.push(texture);\n spotLightMatrices.push(matrix.array);\n },\n\n renderPointLightShadow: function (renderer, scene, light, pointLightShadowMaps) {\n var texture = this._getTexture(light);\n var _gl = renderer.gl;\n pointLightShadowMaps.push(texture);\n\n var defaultShadowMaterial = this._getDepthMaterial(light);\n var passConfig = {\n getMaterial: function (renderable) {\n return renderable.shadowDepthMaterial || defaultShadowMaterial;\n },\n getUniform: getDepthMaterialUniform,\n sortCompare: Renderer.opaqueSortCompare\n };\n\n var renderListEachSide = {\n px: [], py: [], pz: [], nx: [], ny: [], nz: []\n };\n var bbox = new BoundingBox();\n var lightWorldPosition = light.getWorldPosition().array;\n var lightBBox = new BoundingBox();\n var range = light.range;\n lightBBox.min.setArray(lightWorldPosition);\n lightBBox.max.setArray(lightWorldPosition);\n var extent = new Vector3(range, range, range);\n lightBBox.max.add(extent);\n lightBBox.min.sub(extent);\n\n var targetsNeedRender = { px: false, py: false, pz: false, nx: false, ny: false, nz: false };\n scene.traverse(function (renderable) {\n if (renderable.isRenderable() && renderable.castShadow) {\n var geometry = renderable.geometry;\n if (!geometry.boundingBox) {\n for (var i = 0; i < targets.length; i++) {\n renderListEachSide[targets[i]].push(renderable);\n }\n return;\n }\n bbox.transformFrom(geometry.boundingBox, renderable.worldTransform);\n if (!bbox.intersectBoundingBox(lightBBox)) {\n return;\n }\n\n bbox.updateVertices();\n for (var i = 0; i < targets.length; i++) {\n targetsNeedRender[targets[i]] = false;\n }\n for (var i = 0; i < 8; i++) {\n var vtx = bbox.vertices[i];\n var x = vtx[0] - lightWorldPosition[0];\n var y = vtx[1] - lightWorldPosition[1];\n var z = vtx[2] - lightWorldPosition[2];\n var absx = Math.abs(x);\n var absy = Math.abs(y);\n var absz = Math.abs(z);\n if (absx > absy) {\n if (absx > absz) {\n targetsNeedRender[x > 0 ? 'px' : 'nx'] = true;\n }\n else {\n targetsNeedRender[z > 0 ? 'pz' : 'nz'] = true;\n }\n }\n else {\n if (absy > absz) {\n targetsNeedRender[y > 0 ? 'py' : 'ny'] = true;\n }\n else {\n targetsNeedRender[z > 0 ? 'pz' : 'nz'] = true;\n }\n }\n }\n for (var i = 0; i < targets.length; i++) {\n if (targetsNeedRender[targets[i]]) {\n renderListEachSide[targets[i]].push(renderable);\n }\n }\n }\n });\n\n for (var i = 0; i < 6; i++) {\n var target = targets[i];\n var camera = this._getPointLightCamera(light, target);\n\n this._frameBuffer.attach(texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i);\n this._frameBuffer.bind(renderer);\n _gl.clear(_gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT);\n\n renderer.renderPass(renderListEachSide[target], camera, passConfig);\n }\n\n this._frameBuffer.unbind(renderer);\n },\n\n _getDepthMaterial: function (light) {\n var shadowMaterial = this._lightMaterials[light.__uid__];\n var isPointLight = light.type === 'POINT_LIGHT';\n if (!shadowMaterial) {\n var shaderPrefix = isPointLight ? 'clay.sm.distance.' : 'clay.sm.depth.';\n shadowMaterial = new Material({\n precision: this.precision,\n shader: new Shader(Shader.source(shaderPrefix + 'vertex'), Shader.source(shaderPrefix + 'fragment'))\n });\n\n this._lightMaterials[light.__uid__] = shadowMaterial;\n }\n if (light.shadowSlopeScale != null) {\n shadowMaterial.setUniform('slopeScale', light.shadowSlopeScale);\n }\n if (light.shadowBias != null) {\n shadowMaterial.setUniform('bias', light.shadowBias);\n }\n if (this.softShadow === ShadowMapPass.VSM) {\n shadowMaterial.define('fragment', 'USE_VSM');\n }\n else {\n shadowMaterial.undefine('fragment', 'USE_VSM');\n }\n\n if (isPointLight) {\n shadowMaterial.set('lightPosition', light.getWorldPosition().array);\n shadowMaterial.set('range', light.range);\n }\n\n return shadowMaterial;\n },\n\n _gaussianFilter: function (renderer, texture, size) {\n var parameter = {\n width: size,\n height: size,\n type: Texture.FLOAT\n };\n var tmpTexture = this._texturePool.get(parameter);\n\n this._frameBuffer.attach(tmpTexture);\n this._frameBuffer.bind(renderer);\n this._gaussianPassH.setUniform('texture', texture);\n this._gaussianPassH.setUniform('textureWidth', size);\n this._gaussianPassH.render(renderer);\n\n this._frameBuffer.attach(texture);\n this._gaussianPassV.setUniform('texture', tmpTexture);\n this._gaussianPassV.setUniform('textureHeight', size);\n this._gaussianPassV.render(renderer);\n this._frameBuffer.unbind(renderer);\n\n this._texturePool.put(tmpTexture);\n },\n\n _getTexture: function (light, cascade) {\n var key = light.__uid__;\n var texture = this._textures[key];\n var resolution = light.shadowResolution || 512;\n cascade = cascade || 1;\n if (!texture) {\n if (light.type === 'POINT_LIGHT') {\n texture = new TextureCube();\n }\n else {\n texture = new Texture2D();\n }\n // At most 4 cascade\n // TODO share with height ?\n texture.width = resolution * cascade;\n texture.height = resolution;\n if (this.softShadow === ShadowMapPass.VSM) {\n texture.type = Texture.FLOAT;\n texture.anisotropic = 4;\n }\n else {\n texture.minFilter = glenum.NEAREST;\n texture.magFilter = glenum.NEAREST;\n texture.useMipmap = false;\n }\n this._textures[key] = texture;\n }\n\n return texture;\n },\n\n _getPointLightCamera: function (light, target) {\n if (!this._lightCameras.point) {\n this._lightCameras.point = {\n px: new PerspectiveCamera(),\n nx: new PerspectiveCamera(),\n py: new PerspectiveCamera(),\n ny: new PerspectiveCamera(),\n pz: new PerspectiveCamera(),\n nz: new PerspectiveCamera()\n };\n }\n var camera = this._lightCameras.point[target];\n\n camera.far = light.range;\n camera.fov = 90;\n camera.position.set(0, 0, 0);\n switch (target) {\n case 'px':\n camera.lookAt(Vector3.POSITIVE_X, Vector3.NEGATIVE_Y);\n break;\n case 'nx':\n camera.lookAt(Vector3.NEGATIVE_X, Vector3.NEGATIVE_Y);\n break;\n case 'py':\n camera.lookAt(Vector3.POSITIVE_Y, Vector3.POSITIVE_Z);\n break;\n case 'ny':\n camera.lookAt(Vector3.NEGATIVE_Y, Vector3.NEGATIVE_Z);\n break;\n case 'pz':\n camera.lookAt(Vector3.POSITIVE_Z, Vector3.NEGATIVE_Y);\n break;\n case 'nz':\n camera.lookAt(Vector3.NEGATIVE_Z, Vector3.NEGATIVE_Y);\n break;\n }\n light.getWorldPosition(camera.position);\n camera.update();\n\n return camera;\n },\n\n _getDirectionalLightCamera: (function () {\n var lightViewMatrix = new Matrix4();\n var sceneViewBoundingBox = new BoundingBox();\n var lightViewBBox = new BoundingBox();\n // Camera of directional light will be adjusted\n // to contain the view frustum and scene bounding box as tightly as possible\n return function (light, scene, sceneCamera) {\n if (!this._lightCameras.directional) {\n this._lightCameras.directional = new OrthoCamera();\n }\n var camera = this._lightCameras.directional;\n\n sceneViewBoundingBox.copy(scene.viewBoundingBoxLastFrame);\n sceneViewBoundingBox.intersection(sceneCamera.frustum.boundingBox);\n // Move to the center of frustum(in world space)\n camera.position\n .copy(sceneViewBoundingBox.min)\n .add(sceneViewBoundingBox.max)\n .scale(0.5)\n .transformMat4(sceneCamera.worldTransform);\n camera.rotation.copy(light.rotation);\n camera.scale.copy(light.scale);\n camera.updateWorldTransform();\n\n // Transform to light view space\n Matrix4.invert(lightViewMatrix, camera.worldTransform);\n Matrix4.multiply(lightViewMatrix, lightViewMatrix, sceneCamera.worldTransform);\n\n lightViewBBox.copy(sceneViewBoundingBox).applyTransform(lightViewMatrix);\n\n var min = lightViewBBox.min.array;\n var max = lightViewBBox.max.array;\n\n // Move camera to adjust the near to 0\n camera.position.set((min[0] + max[0]) / 2, (min[1] + max[1]) / 2, max[2])\n .transformMat4(camera.worldTransform);\n camera.near = 0;\n camera.far = -min[2] + max[2];\n // Make sure receivers not in the frustum will stil receive the shadow.\n if (isNaN(this.lightFrustumBias)) {\n camera.far *= 4;\n }\n else {\n camera.far += this.lightFrustumBias;\n }\n camera.left = min[0];\n camera.right = max[0];\n camera.top = max[1];\n camera.bottom = min[1];\n camera.update(true);\n\n return camera;\n };\n })(),\n\n _getSpotLightCamera: function (light) {\n if (!this._lightCameras.spot) {\n this._lightCameras.spot = new PerspectiveCamera();\n }\n var camera = this._lightCameras.spot;\n // Update properties\n camera.fov = light.penumbraAngle * 2;\n camera.far = light.range;\n camera.worldTransform.copy(light.worldTransform);\n camera.updateProjectionMatrix();\n mat4.invert(camera.viewMatrix.array, camera.worldTransform.array);\n\n return camera;\n },\n\n /**\n * @param {clay.Renderer|WebGLRenderingContext} [renderer]\n * @memberOf clay.prePass.ShadowMap.prototype\n */\n // PENDING Renderer or WebGLRenderingContext\n dispose: function (renderer) {\n var _gl = renderer.gl || renderer;\n\n if (this._frameBuffer) {\n this._frameBuffer.dispose(_gl);\n }\n\n for (var name in this._textures) {\n this._textures[name].dispose(_gl);\n }\n\n this._texturePool.clear(renderer.gl);\n\n this._depthMaterials = {};\n this._distanceMaterials = {};\n this._textures = {};\n this._lightCameras = {};\n this._shadowMapNumber = {\n 'POINT_LIGHT': 0,\n 'DIRECTIONAL_LIGHT': 0,\n 'SPOT_LIGHT': 0\n };\n this._meshMaterials = {};\n\n for (var i = 0; i < this._receivers.length; i++) {\n var mesh = this._receivers[i];\n // Mesh may be disposed\n if (mesh.material) {\n var material = mesh.material;\n material.undefine('fragment', 'POINT_LIGHT_SHADOW_COUNT');\n material.undefine('fragment', 'DIRECTIONAL_LIGHT_SHADOW_COUNT');\n material.undefine('fragment', 'AMBIENT_LIGHT_SHADOW_COUNT');\n material.set('shadowEnabled', 0);\n }\n }\n\n this._receivers = [];\n this._lightsCastShadow = [];\n }\n});\n\n/**\n * @name clay.prePass.ShadowMap.VSM\n * @type {number}\n */\nShadowMapPass.VSM = 1;\n\n/**\n * @name clay.prePass.ShadowMap.PCF\n * @type {number}\n */\nShadowMapPass.PCF = 2;\n\nexport default ShadowMapPass;\n","import Base from '../core/Base';\n\n// PENDING\n// Use topological sort ?\n\n/**\n * Node of graph based post processing.\n *\n * @constructor clay.compositor.CompositorNode\n * @extends clay.core.Base\n *\n */\nvar CompositorNode = Base.extend(function () {\n return /** @lends clay.compositor.CompositorNode# */ {\n /**\n * @type {string}\n */\n name: '',\n\n /**\n * Input links, will be updated by the graph\n * @example:\n * inputName: {\n * node: someNode,\n * pin: 'xxxx'\n * }\n * @type {Object}\n */\n inputLinks: {},\n\n /**\n * Output links, will be updated by the graph\n * @example:\n * outputName: {\n * node: someNode,\n * pin: 'xxxx'\n * }\n * @type {Object}\n */\n outputLinks: {},\n\n // Save the output texture of previous frame\n // Will be used when there exist a circular reference\n _prevOutputTextures: {},\n _outputTextures: {},\n\n // Example: { name: 2 }\n _outputReferences: {},\n\n _rendering: false,\n // If rendered in this frame\n _rendered: false,\n\n _compositor: null\n };\n},\n/** @lends clay.compositor.CompositorNode.prototype */\n{\n\n // TODO Remove parameter function callback\n updateParameter: function (outputName, renderer) {\n var outputInfo = this.outputs[outputName];\n var parameters = outputInfo.parameters;\n var parametersCopy = outputInfo._parametersCopy;\n if (!parametersCopy) {\n parametersCopy = outputInfo._parametersCopy = {};\n }\n if (parameters) {\n for (var key in parameters) {\n if (key !== 'width' && key !== 'height') {\n parametersCopy[key] = parameters[key];\n }\n }\n }\n var width, height;\n if (parameters.width instanceof Function) {\n width = parameters.width.call(this, renderer);\n }\n else {\n width = parameters.width;\n }\n if (parameters.height instanceof Function) {\n height = parameters.height.call(this, renderer);\n }\n else {\n height = parameters.height;\n }\n if (\n parametersCopy.width !== width\n || parametersCopy.height !== height\n ) {\n if (this._outputTextures[outputName]) {\n this._outputTextures[outputName].dispose(renderer.gl);\n }\n }\n parametersCopy.width = width;\n parametersCopy.height = height;\n\n return parametersCopy;\n },\n\n /**\n * Set parameter\n * @param {string} name\n * @param {} value\n */\n setParameter: function (name, value) {},\n /**\n * Get parameter value\n * @param {string} name\n * @return {}\n */\n getParameter: function (name) {},\n /**\n * Set parameters\n * @param {Object} obj\n */\n setParameters: function (obj) {\n for (var name in obj) {\n this.setParameter(name, obj[name]);\n }\n },\n\n render: function () {},\n\n getOutput: function (renderer /*optional*/, name) {\n if (name == null) {\n // Return the output texture without rendering\n name = renderer;\n return this._outputTextures[name];\n }\n var outputInfo = this.outputs[name];\n if (!outputInfo) {\n return ;\n }\n\n // Already been rendered in this frame\n if (this._rendered) {\n // Force return texture in last frame\n if (outputInfo.outputLastFrame) {\n return this._prevOutputTextures[name];\n }\n else {\n return this._outputTextures[name];\n }\n }\n else if (\n // TODO\n this._rendering // Solve Circular Reference\n ) {\n if (!this._prevOutputTextures[name]) {\n // Create a blank texture at first pass\n this._prevOutputTextures[name] = this._compositor.allocateTexture(outputInfo.parameters || {});\n }\n return this._prevOutputTextures[name];\n }\n\n this.render(renderer);\n\n return this._outputTextures[name];\n },\n\n removeReference: function (outputName) {\n this._outputReferences[outputName]--;\n if (this._outputReferences[outputName] === 0) {\n var outputInfo = this.outputs[outputName];\n if (outputInfo.keepLastFrame) {\n if (this._prevOutputTextures[outputName]) {\n this._compositor.releaseTexture(this._prevOutputTextures[outputName]);\n }\n this._prevOutputTextures[outputName] = this._outputTextures[outputName];\n }\n else {\n // Output of this node have alreay been used by all other nodes\n // Put the texture back to the pool.\n this._compositor.releaseTexture(this._outputTextures[outputName]);\n }\n }\n },\n\n link: function (inputPinName, fromNode, fromPinName) {\n\n // The relationship from output pin to input pin is one-on-multiple\n this.inputLinks[inputPinName] = {\n node: fromNode,\n pin: fromPinName\n };\n if (!fromNode.outputLinks[fromPinName]) {\n fromNode.outputLinks[fromPinName] = [];\n }\n fromNode.outputLinks[fromPinName].push({\n node: this,\n pin: inputPinName\n });\n\n // Enabled the pin texture in shader\n this.pass.material.enableTexture(inputPinName);\n },\n\n clear: function () {\n this.inputLinks = {};\n this.outputLinks = {};\n },\n\n updateReference: function (outputName) {\n if (!this._rendering) {\n this._rendering = true;\n for (var inputName in this.inputLinks) {\n var link = this.inputLinks[inputName];\n link.node.updateReference(link.pin);\n }\n this._rendering = false;\n }\n if (outputName) {\n this._outputReferences[outputName] ++;\n }\n },\n\n beforeFrame: function () {\n this._rendered = false;\n\n for (var name in this.outputLinks) {\n this._outputReferences[name] = 0;\n }\n },\n\n afterFrame: function () {\n // Put back all the textures to pool\n for (var name in this.outputLinks) {\n if (this._outputReferences[name] > 0) {\n var outputInfo = this.outputs[name];\n if (outputInfo.keepLastFrame) {\n if (this._prevOutputTextures[name]) {\n this._compositor.releaseTexture(this._prevOutputTextures[name]);\n }\n this._prevOutputTextures[name] = this._outputTextures[name];\n }\n else {\n this._compositor.releaseTexture(this._outputTextures[name]);\n }\n }\n }\n }\n});\n\nexport default CompositorNode;\n","import Base from '../core/Base';\nimport GraphNode from './CompositorNode';\n\n/**\n * @constructor clay.compositor.Graph\n * @extends clay.core.Base\n */\nvar Graph = Base.extend(function () {\n return /** @lends clay.compositor.Graph# */ {\n /**\n * @type {Array.}\n */\n nodes: []\n };\n},\n/** @lends clay.compositor.Graph.prototype */\n{\n\n /**\n * Mark to update\n */\n dirty: function () {\n this._dirty = true;\n },\n /**\n * @param {clay.compositor.CompositorNode} node\n */\n addNode: function (node) {\n\n if (this.nodes.indexOf(node) >= 0) {\n return;\n }\n\n this.nodes.push(node);\n\n this._dirty = true;\n },\n /**\n * @param {clay.compositor.CompositorNode|string} node\n */\n removeNode: function (node) {\n if (typeof node === 'string') {\n node = this.getNodeByName(node);\n }\n var idx = this.nodes.indexOf(node);\n if (idx >= 0) {\n this.nodes.splice(idx, 1);\n this._dirty = true;\n }\n },\n /**\n * @param {string} name\n * @return {clay.compositor.CompositorNode}\n */\n getNodeByName: function (name) {\n for (var i = 0; i < this.nodes.length; i++) {\n if (this.nodes[i].name === name) {\n return this.nodes[i];\n }\n }\n },\n /**\n * Update links of graph\n */\n update: function () {\n for (var i = 0; i < this.nodes.length; i++) {\n this.nodes[i].clear();\n }\n // Traverse all the nodes and build the graph\n for (var i = 0; i < this.nodes.length; i++) {\n var node = this.nodes[i];\n\n if (!node.inputs) {\n continue;\n }\n for (var inputName in node.inputs) {\n if (!node.inputs[inputName]) {\n continue;\n }\n if (node.pass && !node.pass.material.isUniformEnabled(inputName)) {\n console.warn('Pin ' + node.name + '.' + inputName + ' not used.');\n continue;\n }\n var fromPinInfo = node.inputs[inputName];\n\n var fromPin = this.findPin(fromPinInfo);\n if (fromPin) {\n node.link(inputName, fromPin.node, fromPin.pin);\n }\n else {\n if (typeof fromPinInfo === 'string') {\n console.warn('Node ' + fromPinInfo + ' not exist');\n }\n else {\n console.warn('Pin of ' + fromPinInfo.node + '.' + fromPinInfo.pin + ' not exist');\n }\n }\n }\n }\n },\n\n findPin: function (input) {\n var node;\n // Try to take input as a directly a node\n if (typeof input === 'string' || input instanceof GraphNode) {\n input = {\n node: input\n };\n }\n\n if (typeof input.node === 'string') {\n for (var i = 0; i < this.nodes.length; i++) {\n var tmp = this.nodes[i];\n if (tmp.name === input.node) {\n node = tmp;\n }\n }\n }\n else {\n node = input.node;\n }\n if (node) {\n var inputPin = input.pin;\n if (!inputPin) {\n // Use first pin defaultly\n if (node.outputs) {\n inputPin = Object.keys(node.outputs)[0];\n }\n }\n if (node.outputs[inputPin]) {\n return {\n node: node,\n pin: inputPin\n };\n }\n }\n }\n});\n\nexport default Graph;\n","import Graph from './Graph';\nimport TexturePool from './TexturePool';\nimport FrameBuffer from '../FrameBuffer';\n\n/**\n * Compositor provide graph based post processing\n *\n * @constructor clay.compositor.Compositor\n * @extends clay.compositor.Graph\n *\n */\nvar Compositor = Graph.extend(function() {\n return {\n // Output node\n _outputs: [],\n\n _texturePool: new TexturePool(),\n\n _frameBuffer: new FrameBuffer({\n depthBuffer: false\n })\n };\n},\n/** @lends clay.compositor.Compositor.prototype */\n{\n addNode: function(node) {\n Graph.prototype.addNode.call(this, node);\n node._compositor = this;\n },\n /**\n * @param {clay.Renderer} renderer\n */\n render: function(renderer, frameBuffer) {\n if (this._dirty) {\n this.update();\n this._dirty = false;\n\n this._outputs.length = 0;\n for (var i = 0; i < this.nodes.length; i++) {\n if (!this.nodes[i].outputs) {\n this._outputs.push(this.nodes[i]);\n }\n }\n }\n\n for (var i = 0; i < this.nodes.length; i++) {\n // Update the reference number of each output texture\n this.nodes[i].beforeFrame();\n }\n\n for (var i = 0; i < this._outputs.length; i++) {\n this._outputs[i].updateReference();\n }\n\n for (var i = 0; i < this._outputs.length; i++) {\n this._outputs[i].render(renderer, frameBuffer);\n }\n\n for (var i = 0; i < this.nodes.length; i++) {\n // Clear up\n this.nodes[i].afterFrame();\n }\n },\n\n allocateTexture: function (parameters) {\n return this._texturePool.get(parameters);\n },\n\n releaseTexture: function (parameters) {\n this._texturePool.put(parameters);\n },\n\n getFrameBuffer: function () {\n return this._frameBuffer;\n },\n\n /**\n * Dispose compositor\n * @param {clay.Renderer} renderer\n */\n dispose: function (renderer) {\n this._texturePool.clear(renderer);\n }\n});\n\nexport default Compositor;\n","import CompositorNode from './CompositorNode';\nimport glenum from '../core/glenum';\nimport FrameBuffer from '../FrameBuffer';\n\n/**\n * @constructor clay.compositor.SceneNode\n * @extends clay.compositor.CompositorNode\n */\nvar SceneNode = CompositorNode.extend(\n/** @lends clay.compositor.SceneNode# */\n{\n name: 'scene',\n /**\n * @type {clay.Scene}\n */\n scene: null,\n /**\n * @type {clay.Camera}\n */\n camera: null,\n /**\n * @type {boolean}\n */\n autoUpdateScene: true,\n /**\n * @type {boolean}\n */\n preZ: false\n\n}, function() {\n this.frameBuffer = new FrameBuffer();\n}, {\n render: function(renderer) {\n\n this._rendering = true;\n var _gl = renderer.gl;\n\n this.trigger('beforerender');\n\n var renderInfo;\n\n if (!this.outputs) {\n\n renderInfo = renderer.render(this.scene, this.camera, !this.autoUpdateScene, this.preZ);\n\n }\n else {\n\n var frameBuffer = this.frameBuffer;\n for (var name in this.outputs) {\n var parameters = this.updateParameter(name, renderer);\n var outputInfo = this.outputs[name];\n var texture = this._compositor.allocateTexture(parameters);\n this._outputTextures[name] = texture;\n\n var attachment = outputInfo.attachment || _gl.COLOR_ATTACHMENT0;\n if (typeof(attachment) == 'string') {\n attachment = _gl[attachment];\n }\n frameBuffer.attach(texture, attachment);\n }\n frameBuffer.bind(renderer);\n\n // MRT Support in chrome\n // https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/ext-draw-buffers.html\n var ext = renderer.getGLExtension('EXT_draw_buffers');\n if (ext) {\n var bufs = [];\n for (var attachment in this.outputs) {\n attachment = parseInt(attachment);\n if (attachment >= _gl.COLOR_ATTACHMENT0 && attachment <= _gl.COLOR_ATTACHMENT0 + 8) {\n bufs.push(attachment);\n }\n }\n ext.drawBuffersEXT(bufs);\n }\n\n // Always clear\n // PENDING\n renderer.saveClear();\n renderer.clearBit = glenum.DEPTH_BUFFER_BIT | glenum.COLOR_BUFFER_BIT;\n renderInfo = renderer.render(this.scene, this.camera, !this.autoUpdateScene, this.preZ);\n renderer.restoreClear();\n\n frameBuffer.unbind(renderer);\n }\n\n this.trigger('afterrender', renderInfo);\n\n this._rendering = false;\n this._rendered = true;\n }\n});\n\nexport default SceneNode;\n","import CompositorNode from './CompositorNode';\n\n/**\n * @constructor clay.compositor.TextureNode\n * @extends clay.compositor.CompositorNode\n */\nvar TextureNode = CompositorNode.extend(function() {\n return /** @lends clay.compositor.TextureNode# */ {\n /**\n * @type {clay.Texture2D}\n */\n texture: null,\n\n // Texture node must have output without parameters\n outputs: {\n color: {}\n }\n };\n}, function () {\n}, {\n\n getOutput: function (renderer, name) {\n return this.texture;\n },\n\n // Do nothing\n beforeFrame: function () {},\n afterFrame: function () {}\n});\n\nexport default TextureNode;\n","// TODO Shader library\nimport Pass from './Pass';\nimport CompositorNode from './CompositorNode';\n\n// TODO curlnoise demo wrong\n\n// PENDING\n// Use topological sort ?\n\n/**\n * Filter node\n *\n * @constructor clay.compositor.FilterNode\n * @extends clay.compositor.CompositorNode\n *\n * @example\n var node = new clay.compositor.FilterNode({\n name: 'fxaa',\n shader: clay.Shader.source('clay.compositor.fxaa'),\n inputs: {\n texture: {\n node: 'scene',\n pin: 'color'\n }\n },\n // Multiple outputs is preserved for MRT support in WebGL2.0\n outputs: {\n color: {\n attachment: clay.FrameBuffer.COLOR_ATTACHMENT0\n parameters: {\n format: clay.Texture.RGBA,\n width: 512,\n height: 512\n },\n // Node will keep the RTT rendered in last frame\n keepLastFrame: true,\n // Force the node output the RTT rendered in last frame\n outputLastFrame: true\n }\n }\n });\n *\n */\nvar FilterNode = CompositorNode.extend(function () {\n return /** @lends clay.compositor.FilterNode# */ {\n /**\n * @type {string}\n */\n name: '',\n\n /**\n * @type {Object}\n */\n inputs: {},\n\n /**\n * @type {Object}\n */\n outputs: null,\n\n /**\n * @type {string}\n */\n shader: '',\n\n /**\n * Input links, will be updated by the graph\n * @example:\n * inputName: {\n * node: someNode,\n * pin: 'xxxx'\n * }\n * @type {Object}\n */\n inputLinks: {},\n\n /**\n * Output links, will be updated by the graph\n * @example:\n * outputName: {\n * node: someNode,\n * pin: 'xxxx'\n * }\n * @type {Object}\n */\n outputLinks: {},\n\n /**\n * @type {clay.compositor.Pass}\n */\n pass: null,\n\n // Save the output texture of previous frame\n // Will be used when there exist a circular reference\n _prevOutputTextures: {},\n _outputTextures: {},\n\n // Example: { name: 2 }\n _outputReferences: {},\n\n _rendering: false,\n // If rendered in this frame\n _rendered: false,\n\n _compositor: null\n };\n}, function () {\n\n var pass = new Pass({\n fragment: this.shader\n });\n this.pass = pass;\n},\n/** @lends clay.compositor.FilterNode.prototype */\n{\n /**\n * @param {clay.Renderer} renderer\n */\n render: function (renderer, frameBuffer) {\n this.trigger('beforerender', renderer);\n\n this._rendering = true;\n\n var _gl = renderer.gl;\n\n for (var inputName in this.inputLinks) {\n var link = this.inputLinks[inputName];\n var inputTexture = link.node.getOutput(renderer, link.pin);\n this.pass.setUniform(inputName, inputTexture);\n }\n // Output\n if (!this.outputs) {\n this.pass.outputs = null;\n\n this._compositor.getFrameBuffer().unbind(renderer);\n\n this.pass.render(renderer, frameBuffer);\n }\n else {\n this.pass.outputs = {};\n\n var attachedTextures = {};\n for (var name in this.outputs) {\n var parameters = this.updateParameter(name, renderer);\n if (isNaN(parameters.width)) {\n this.updateParameter(name, renderer);\n }\n var outputInfo = this.outputs[name];\n var texture = this._compositor.allocateTexture(parameters);\n this._outputTextures[name] = texture;\n var attachment = outputInfo.attachment || _gl.COLOR_ATTACHMENT0;\n if (typeof(attachment) === 'string') {\n attachment = _gl[attachment];\n }\n attachedTextures[attachment] = texture;\n }\n this._compositor.getFrameBuffer().bind(renderer);\n\n for (var attachment in attachedTextures) {\n // FIXME attachment changes in different nodes\n this._compositor.getFrameBuffer().attach(\n attachedTextures[attachment], attachment\n );\n }\n\n this.pass.render(renderer);\n\n // Because the data of texture is changed over time,\n // Here update the mipmaps of texture each time after rendered;\n this._compositor.getFrameBuffer().updateMipmap(renderer);\n }\n\n for (var inputName in this.inputLinks) {\n var link = this.inputLinks[inputName];\n link.node.removeReference(link.pin);\n }\n\n this._rendering = false;\n this._rendered = true;\n\n this.trigger('afterrender', renderer);\n },\n\n // TODO Remove parameter function callback\n updateParameter: function (outputName, renderer) {\n var outputInfo = this.outputs[outputName];\n var parameters = outputInfo.parameters;\n var parametersCopy = outputInfo._parametersCopy;\n if (!parametersCopy) {\n parametersCopy = outputInfo._parametersCopy = {};\n }\n if (parameters) {\n for (var key in parameters) {\n if (key !== 'width' && key !== 'height') {\n parametersCopy[key] = parameters[key];\n }\n }\n }\n var width, height;\n if (typeof parameters.width === 'function') {\n width = parameters.width.call(this, renderer);\n }\n else {\n width = parameters.width;\n }\n if (typeof parameters.height === 'function') {\n height = parameters.height.call(this, renderer);\n }\n else {\n height = parameters.height;\n }\n width = Math.ceil(width);\n height = Math.ceil(height);\n if (\n parametersCopy.width !== width\n || parametersCopy.height !== height\n ) {\n if (this._outputTextures[outputName]) {\n this._outputTextures[outputName].dispose(renderer);\n }\n }\n parametersCopy.width = width;\n parametersCopy.height = height;\n\n return parametersCopy;\n },\n\n /**\n * Set parameter\n * @param {string} name\n * @param {} value\n */\n setParameter: function (name, value) {\n this.pass.setUniform(name, value);\n },\n /**\n * Get parameter value\n * @param {string} name\n * @return {}\n */\n getParameter: function (name) {\n return this.pass.getUniform(name);\n },\n /**\n * Set parameters\n * @param {Object} obj\n */\n setParameters: function (obj) {\n for (var name in obj) {\n this.setParameter(name, obj[name]);\n }\n },\n // /**\n // * Set shader code\n // * @param {string} shaderStr\n // */\n // setShader: function (shaderStr) {\n // var material = this.pass.material;\n // material.shader.setFragment(shaderStr);\n // material.attachShader(material.shader, true);\n // },\n /**\n * Proxy of pass.material.define('fragment', xxx);\n * @param {string} symbol\n * @param {number} [val]\n */\n define: function (symbol, val) {\n this.pass.material.define('fragment', symbol, val);\n },\n\n /**\n * Proxy of pass.material.undefine('fragment', xxx)\n * @param {string} symbol\n */\n undefine: function (symbol) {\n this.pass.material.undefine('fragment', symbol);\n },\n\n removeReference: function (outputName) {\n this._outputReferences[outputName]--;\n if (this._outputReferences[outputName] === 0) {\n var outputInfo = this.outputs[outputName];\n if (outputInfo.keepLastFrame) {\n if (this._prevOutputTextures[outputName]) {\n this._compositor.releaseTexture(this._prevOutputTextures[outputName]);\n }\n this._prevOutputTextures[outputName] = this._outputTextures[outputName];\n }\n else {\n // Output of this node have alreay been used by all other nodes\n // Put the texture back to the pool.\n this._compositor.releaseTexture(this._outputTextures[outputName]);\n }\n }\n },\n\n clear: function () {\n CompositorNode.prototype.clear.call(this);\n\n // Default disable all texture\n this.pass.material.disableTexturesAll();\n }\n});\n\nexport default FilterNode;\n","export default \"@export clay.compositor.coloradjust\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float brightness : 0.0;\\nuniform float contrast : 1.0;\\nuniform float exposure : 0.0;\\nuniform float gamma : 1.0;\\nuniform float saturation : 1.0;\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\nvoid main()\\n{\\n vec4 tex = texture2D( texture, v_Texcoord);\\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\\n float luminance = dot( color, w );\\n color = mix(vec3(luminance), color, saturation);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.brightness\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float brightness : 0.0;\\nvoid main()\\n{\\n vec4 tex = texture2D( texture, v_Texcoord);\\n vec3 color = tex.rgb + vec3(brightness);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.contrast\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float contrast : 1.0;\\nvoid main()\\n{\\n vec4 tex = texture2D( texture, v_Texcoord);\\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.exposure\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float exposure : 0.0;\\nvoid main()\\n{\\n vec4 tex = texture2D(texture, v_Texcoord);\\n vec3 color = tex.rgb * pow(2.0, exposure);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.gamma\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float gamma : 1.0;\\nvoid main()\\n{\\n vec4 tex = texture2D(texture, v_Texcoord);\\n vec3 color = pow(tex.rgb, vec3(gamma));\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\\n@export clay.compositor.saturation\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float saturation : 1.0;\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\nvoid main()\\n{\\n vec4 tex = texture2D(texture, v_Texcoord);\\n vec3 color = tex.rgb;\\n float luminance = dot(color, w);\\n color = mix(vec3(luminance), color, saturation);\\n gl_FragColor = vec4(color, tex.a);\\n}\\n@end\";\n","export default \"@export clay.compositor.kernel.gaussian_9\\nfloat gaussianKernel[9];\\ngaussianKernel[0] = 0.07;\\ngaussianKernel[1] = 0.09;\\ngaussianKernel[2] = 0.12;\\ngaussianKernel[3] = 0.14;\\ngaussianKernel[4] = 0.16;\\ngaussianKernel[5] = 0.14;\\ngaussianKernel[6] = 0.12;\\ngaussianKernel[7] = 0.09;\\ngaussianKernel[8] = 0.07;\\n@end\\n@export clay.compositor.kernel.gaussian_13\\nfloat gaussianKernel[13];\\ngaussianKernel[0] = 0.02;\\ngaussianKernel[1] = 0.03;\\ngaussianKernel[2] = 0.06;\\ngaussianKernel[3] = 0.08;\\ngaussianKernel[4] = 0.11;\\ngaussianKernel[5] = 0.13;\\ngaussianKernel[6] = 0.14;\\ngaussianKernel[7] = 0.13;\\ngaussianKernel[8] = 0.11;\\ngaussianKernel[9] = 0.08;\\ngaussianKernel[10] = 0.06;\\ngaussianKernel[11] = 0.03;\\ngaussianKernel[12] = 0.02;\\n@end\\n@export clay.compositor.gaussian_blur\\n#define SHADER_NAME gaussian_blur\\nuniform sampler2D texture;varying vec2 v_Texcoord;\\nuniform float blurSize : 2.0;\\nuniform vec2 textureSize : [512.0, 512.0];\\nuniform float blurDir : 0.0;\\n@import clay.util.rgbm\\n@import clay.util.clamp_sample\\nvoid main (void)\\n{\\n @import clay.compositor.kernel.gaussian_9\\n vec2 off = blurSize / textureSize;\\n off *= vec2(1.0 - blurDir, blurDir);\\n vec4 sum = vec4(0.0);\\n float weightAll = 0.0;\\n for (int i = 0; i < 9; i++) {\\n float w = gaussianKernel[i];\\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\\n sum += texel * w;\\n weightAll += w;\\n }\\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\\n}\\n@end\\n\";\n","export default \"@export clay.compositor.hdr.log_lum\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\\n float luminance = dot(tex.rgb, w);\\n luminance = log(luminance + 0.001);\\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\\n}\\n@end\\n@export clay.compositor.hdr.lum_adaption\\nvarying vec2 v_Texcoord;\\nuniform sampler2D adaptedLum;\\nuniform sampler2D currentLum;\\nuniform float frameTime : 0.02;\\n@import clay.util.rgbm\\nvoid main()\\n{\\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\\n}\\n@end\\n@export clay.compositor.lum\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\\nvoid main()\\n{\\n vec4 tex = texture2D( texture, v_Texcoord );\\n float luminance = dot(tex.rgb, w);\\n gl_FragColor = vec4(vec3(luminance), 1.0);\\n}\\n@end\";\n","export default \"\\n@export clay.compositor.lut\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform sampler2D lookup;\\nvoid main()\\n{\\n vec4 tex = texture2D(texture, v_Texcoord);\\n float blueColor = tex.b * 63.0;\\n vec2 quad1;\\n quad1.y = floor(floor(blueColor) / 8.0);\\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\\n vec2 quad2;\\n quad2.y = floor(ceil(blueColor) / 8.0);\\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\\n vec2 texPos1;\\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\\n vec2 texPos2;\\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\\n vec4 newColor1 = texture2D(lookup, texPos1);\\n vec4 newColor2 = texture2D(lookup, texPos2);\\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\\n gl_FragColor = vec4(newColor.rgb, tex.w);\\n}\\n@end\";\n","export default \"@export clay.compositor.vignette\\n#define OUTPUT_ALPHA\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\nuniform float darkness: 1;\\nuniform float offset: 1;\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\\n gl_FragColor.rgb = texel.rgb;\\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\\n}\\n@end\";\n","export default \"@export clay.compositor.output\\n#define OUTPUT_ALPHA\\nvarying vec2 v_Texcoord;\\nuniform sampler2D texture;\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\\n gl_FragColor.rgb = tex.rgb;\\n#ifdef OUTPUT_ALPHA\\n gl_FragColor.a = tex.a;\\n#else\\n gl_FragColor.a = 1.0;\\n#endif\\n gl_FragColor = encodeHDR(gl_FragColor);\\n#ifdef PREMULTIPLY_ALPHA\\n gl_FragColor.rgb *= gl_FragColor.a;\\n#endif\\n}\\n@end\";\n","export default \"@export clay.compositor.bright\\nuniform sampler2D texture;\\nuniform float threshold : 1;\\nuniform float scale : 1.0;\\nuniform vec2 textureSize: [512, 512];\\nvarying vec2 v_Texcoord;\\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\\n@import clay.util.rgbm\\nvec4 median(vec4 a, vec4 b, vec4 c)\\n{\\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\\n}\\nvoid main()\\n{\\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\\n#ifdef ANTI_FLICKER\\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\\n texel = median(median(texel, s1, s2), s3, s4);\\n#endif\\n float lum = dot(texel.rgb , lumWeight);\\n vec4 color;\\n if (lum > threshold && texel.a > 0.0)\\n {\\n color = vec4(texel.rgb * scale, texel.a * scale);\\n }\\n else\\n {\\n color = vec4(0.0);\\n }\\n gl_FragColor = encodeHDR(color);\\n}\\n@end\\n\";\n","export default \"@export clay.compositor.downsample\\nuniform sampler2D texture;\\nuniform vec2 textureSize : [512, 512];\\nvarying vec2 v_Texcoord;\\n@import clay.util.rgbm\\nfloat brightness(vec3 c)\\n{\\n return max(max(c.r, c.g), c.b);\\n}\\n@import clay.util.clamp_sample\\nvoid main()\\n{\\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\\n#ifdef ANTI_FLICKER\\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\\n float s1w = 1.0 / (brightness(s1) + 1.0);\\n float s2w = 1.0 / (brightness(s2) + 1.0);\\n float s3w = 1.0 / (brightness(s3) + 1.0);\\n float s4w = 1.0 / (brightness(s4) + 1.0);\\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\\n vec4 color = vec4(\\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\\n 1.0\\n );\\n#else\\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\\n color *= 0.25;\\n#endif\\n gl_FragColor = encodeHDR(color);\\n}\\n@end\";\n","export default \"\\n@export clay.compositor.upsample\\n#define HIGH_QUALITY\\nuniform sampler2D texture;\\nuniform vec2 textureSize : [512, 512];\\nuniform float sampleScale: 0.5;\\nvarying vec2 v_Texcoord;\\n@import clay.util.rgbm\\n@import clay.util.clamp_sample\\nvoid main()\\n{\\n#ifdef HIGH_QUALITY\\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\\n vec4 s;\\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\\n gl_FragColor = encodeHDR(s / 16.0);\\n#else\\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\\n vec4 s;\\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\\n gl_FragColor = encodeHDR(s / 4.0);\\n#endif\\n}\\n@end\";\n","export default \"@export clay.compositor.hdr.composite\\n#define TONEMAPPING\\nuniform sampler2D texture;\\n#ifdef BLOOM_ENABLED\\nuniform sampler2D bloom;\\n#endif\\n#ifdef LENSFLARE_ENABLED\\nuniform sampler2D lensflare;\\nuniform sampler2D lensdirt;\\n#endif\\n#ifdef LUM_ENABLED\\nuniform sampler2D lum;\\n#endif\\n#ifdef LUT_ENABLED\\nuniform sampler2D lut;\\n#endif\\n#ifdef COLOR_CORRECTION\\nuniform float brightness : 0.0;\\nuniform float contrast : 1.0;\\nuniform float saturation : 1.0;\\n#endif\\n#ifdef VIGNETTE\\nuniform float vignetteDarkness: 1.0;\\nuniform float vignetteOffset: 1.0;\\n#endif\\nuniform float exposure : 1.0;\\nuniform float bloomIntensity : 0.25;\\nuniform float lensflareIntensity : 1;\\nvarying vec2 v_Texcoord;\\n@import clay.util.srgb\\nvec3 ACESToneMapping(vec3 color)\\n{\\n const float A = 2.51;\\n const float B = 0.03;\\n const float C = 2.43;\\n const float D = 0.59;\\n const float E = 0.14;\\n return (color * (A * color + B)) / (color * (C * color + D) + E);\\n}\\nfloat eyeAdaption(float fLum)\\n{\\n return mix(0.2, fLum, 0.5);\\n}\\n#ifdef LUT_ENABLED\\nvec3 lutTransform(vec3 color) {\\n float blueColor = color.b * 63.0;\\n vec2 quad1;\\n quad1.y = floor(floor(blueColor) / 8.0);\\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\\n vec2 quad2;\\n quad2.y = floor(ceil(blueColor) / 8.0);\\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\\n vec2 texPos1;\\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\\n vec2 texPos2;\\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\\n vec4 newColor1 = texture2D(lut, texPos1);\\n vec4 newColor2 = texture2D(lut, texPos2);\\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\\n return newColor.rgb;\\n}\\n#endif\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 texel = vec4(0.0);\\n vec4 originalTexel = vec4(0.0);\\n#ifdef TEXTURE_ENABLED\\n texel = decodeHDR(texture2D(texture, v_Texcoord));\\n originalTexel = texel;\\n#endif\\n#ifdef BLOOM_ENABLED\\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\\n texel.rgb += bloomTexel.rgb * bloomIntensity;\\n texel.a += bloomTexel.a * bloomIntensity;\\n#endif\\n#ifdef LENSFLARE_ENABLED\\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\\n#endif\\n texel.a = min(texel.a, 1.0);\\n#ifdef LUM_ENABLED\\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\\n float exposureBias = adaptedLumDest * exposure;\\n#else\\n float exposureBias = exposure;\\n#endif\\n#ifdef TONEMAPPING\\n texel.rgb *= exposureBias;\\n texel.rgb = ACESToneMapping(texel.rgb);\\n#endif\\n texel = linearTosRGB(texel);\\n#ifdef LUT_ENABLED\\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\\n#endif\\n#ifdef COLOR_CORRECTION\\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\\n#endif\\n#ifdef VIGNETTE\\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\\n#endif\\n gl_FragColor = encodeHDR(texel);\\n#ifdef DEBUG\\n #if DEBUG == 1\\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\\n #elif DEBUG == 2\\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\\n #elif DEBUG == 3\\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\\n #endif\\n#endif\\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\\n }\\n#ifdef PREMULTIPLY_ALPHA\\n gl_FragColor.rgb *= gl_FragColor.a;\\n#endif\\n}\\n@end\";\n","export default \"@export clay.compositor.lensflare\\n#define SAMPLE_NUMBER 8\\nuniform sampler2D texture;\\nuniform sampler2D lenscolor;\\nuniform vec2 textureSize : [512, 512];\\nuniform float dispersal : 0.3;\\nuniform float haloWidth : 0.4;\\nuniform float distortion : 1.0;\\nvarying vec2 v_Texcoord;\\n@import clay.util.rgbm\\nvec4 textureDistorted(\\n in vec2 texcoord,\\n in vec2 direction,\\n in vec3 distortion\\n) {\\n return vec4(\\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\\n 1.0\\n );\\n}\\nvoid main()\\n{\\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\\n vec2 haloVec = normalize(ghostVec) * haloWidth;\\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\\n vec4 result = vec4(0.0);\\n for (int i = 0; i < SAMPLE_NUMBER; i++)\\n {\\n vec2 offset = fract(texcoord + ghostVec * float(i));\\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\\n weight = pow(1.0 - weight, 10.0);\\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\\n }\\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\\n weight = pow(1.0 - weight, 10.0);\\n vec2 offset = fract(texcoord + haloVec);\\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\\n gl_FragColor = result;\\n}\\n@end\";\n","export default \"@export clay.compositor.blend\\n#define SHADER_NAME blend\\n#ifdef TEXTURE1_ENABLED\\nuniform sampler2D texture1;\\nuniform float weight1 : 1.0;\\n#endif\\n#ifdef TEXTURE2_ENABLED\\nuniform sampler2D texture2;\\nuniform float weight2 : 1.0;\\n#endif\\n#ifdef TEXTURE3_ENABLED\\nuniform sampler2D texture3;\\nuniform float weight3 : 1.0;\\n#endif\\n#ifdef TEXTURE4_ENABLED\\nuniform sampler2D texture4;\\nuniform float weight4 : 1.0;\\n#endif\\n#ifdef TEXTURE5_ENABLED\\nuniform sampler2D texture5;\\nuniform float weight5 : 1.0;\\n#endif\\n#ifdef TEXTURE6_ENABLED\\nuniform sampler2D texture6;\\nuniform float weight6 : 1.0;\\n#endif\\nvarying vec2 v_Texcoord;\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec4 tex = vec4(0.0);\\n#ifdef TEXTURE1_ENABLED\\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\\n#endif\\n#ifdef TEXTURE2_ENABLED\\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\\n#endif\\n#ifdef TEXTURE3_ENABLED\\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\\n#endif\\n#ifdef TEXTURE4_ENABLED\\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\\n#endif\\n#ifdef TEXTURE5_ENABLED\\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\\n#endif\\n#ifdef TEXTURE6_ENABLED\\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\\n#endif\\n gl_FragColor = encodeHDR(tex);\\n}\\n@end\";\n","export default \"@export clay.compositor.fxaa\\nuniform sampler2D texture;\\nuniform vec4 viewport : VIEWPORT;\\nvarying vec2 v_Texcoord;\\n#define FXAA_REDUCE_MIN (1.0/128.0)\\n#define FXAA_REDUCE_MUL (1.0/8.0)\\n#define FXAA_SPAN_MAX 8.0\\n@import clay.util.rgbm\\nvoid main()\\n{\\n vec2 resolution = 1.0 / viewport.zw;\\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\\n vec3 rgbM = rgbaM.xyz;\\n float opacity = rgbaM.w;\\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\\n float lumaNW = dot( rgbNW, luma );\\n float lumaNE = dot( rgbNE, luma );\\n float lumaSW = dot( rgbSW, luma );\\n float lumaSE = dot( rgbSE, luma );\\n float lumaM = dot( rgbM, luma );\\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\\n vec2 dir;\\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\\n dir * rcpDirMin)) * resolution;\\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\\n rgbA *= 0.5;\\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\\n rgbB *= 0.25;\\n rgbB += rgbA * 0.5;\\n float lumaB = dot( rgbB, luma );\\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\\n {\\n gl_FragColor = vec4( rgbA, opacity );\\n }\\n else {\\n gl_FragColor = vec4( rgbB, opacity );\\n }\\n}\\n@end\";\n","import coloradjustEssl from './source/compositor/coloradjust.glsl.js';\nimport blurEssl from './source/compositor/blur.glsl.js';\nimport lumEssl from './source/compositor/lum.glsl.js';\nimport lutEssl from './source/compositor/lut.glsl.js';\nimport vigentteEssl from './source/compositor/vignette.glsl.js';\nimport outputEssl from './source/compositor/output.glsl.js';\nimport brightEssl from './source/compositor/bright.glsl.js';\nimport downsampleEssl from './source/compositor/downsample.glsl.js';\nimport upsampleEssl from './source/compositor/upsample.glsl.js';\nimport hdrEssl from './source/compositor/hdr.glsl.js';\nimport lensflareEssl from './source/compositor/lensflare.glsl.js';\nimport blendEssl from './source/compositor/blend.glsl.js';\nimport fxaaEssl from './source/compositor/fxaa.glsl.js';\n// import fxaa3Essl from './source/compositor/fxaa3.glsl.js';\n\n// TODO Must export a module and be used in the other modules. Or it will be tree shaked\nexport default function register(Shader) {\n // Some build in shaders\n Shader['import'](coloradjustEssl);\n Shader['import'](blurEssl);\n Shader['import'](lumEssl);\n Shader['import'](lutEssl);\n Shader['import'](vigentteEssl);\n Shader['import'](outputEssl);\n Shader['import'](brightEssl);\n Shader['import'](downsampleEssl);\n Shader['import'](upsampleEssl);\n Shader['import'](hdrEssl);\n Shader['import'](lensflareEssl);\n Shader['import'](blendEssl);\n\n Shader['import'](fxaaEssl);\n\n}","import util from './core/util';\nimport Compositor from './compositor/Compositor';\nimport CompoSceneNode from './compositor/SceneNode';\nimport CompoTextureNode from './compositor/TextureNode';\nimport CompoFilterNode from './compositor/FilterNode';\nimport Shader from './Shader';\nimport Texture from './Texture';\nimport Texture2D from './Texture2D';\nimport TextureCube from './TextureCube';\n\nimport registerBuiltinCompositor from './shader/registerBuiltinCompositor';\n\nregisterBuiltinCompositor(Shader);\n\nvar shaderSourceReg = /^#source\\((.*?)\\)/;\n\n/**\n * @name clay.createCompositor\n * @function\n * @param {Object} json\n * @param {Object} [opts]\n * @return {clay.compositor.Compositor}\n */\nfunction createCompositor(json, opts) {\n var compositor = new Compositor();\n opts = opts || {};\n\n var lib = {\n textures: {},\n parameters: {}\n };\n var afterLoad = function(shaderLib, textureLib) {\n for (var i = 0; i < json.nodes.length; i++) {\n var nodeInfo = json.nodes[i];\n var node = createNode(nodeInfo, lib, opts);\n if (node) {\n compositor.addNode(node);\n }\n }\n };\n\n for (var name in json.parameters) {\n var paramInfo = json.parameters[name];\n lib.parameters[name] = convertParameter(paramInfo);\n }\n // TODO load texture asynchronous\n loadTextures(json, lib, opts, function(textureLib) {\n lib.textures = textureLib;\n afterLoad();\n });\n\n return compositor;\n}\n\nfunction createNode(nodeInfo, lib, opts) {\n var type = nodeInfo.type || 'filter';\n var shaderSource;\n var inputs;\n var outputs;\n\n if (type === 'filter') {\n var shaderExp = nodeInfo.shader.trim();\n var res = shaderSourceReg.exec(shaderExp);\n if (res) {\n shaderSource = Shader.source(res[1].trim());\n }\n else if (shaderExp.charAt(0) === '#') {\n shaderSource = lib.shaders[shaderExp.substr(1)];\n }\n if (!shaderSource) {\n shaderSource = shaderExp;\n }\n if (!shaderSource) {\n return;\n }\n }\n\n if (nodeInfo.inputs) {\n inputs = {};\n for (var name in nodeInfo.inputs) {\n if (typeof nodeInfo.inputs[name] === 'string') {\n inputs[name] = nodeInfo.inputs[name];\n }\n else {\n inputs[name] = {\n node: nodeInfo.inputs[name].node,\n pin: nodeInfo.inputs[name].pin\n };\n }\n }\n }\n if (nodeInfo.outputs) {\n outputs = {};\n for (var name in nodeInfo.outputs) {\n var outputInfo = nodeInfo.outputs[name];\n outputs[name] = {};\n if (outputInfo.attachment != null) {\n outputs[name].attachment = outputInfo.attachment;\n }\n if (outputInfo.keepLastFrame != null) {\n outputs[name].keepLastFrame = outputInfo.keepLastFrame;\n }\n if (outputInfo.outputLastFrame != null) {\n outputs[name].outputLastFrame = outputInfo.outputLastFrame;\n }\n if (outputInfo.parameters) {\n outputs[name].parameters = convertParameter(outputInfo.parameters);\n }\n }\n }\n var node;\n if (type === 'scene') {\n node = new CompoSceneNode({\n name: nodeInfo.name,\n scene: opts.scene,\n camera: opts.camera,\n outputs: outputs\n });\n }\n else if (type === 'texture') {\n node = new CompoTextureNode({\n name: nodeInfo.name,\n outputs: outputs\n });\n }\n // Default is filter\n else {\n node = new CompoFilterNode({\n name: nodeInfo.name,\n shader: shaderSource,\n inputs: inputs,\n outputs: outputs\n });\n }\n if (node) {\n if (nodeInfo.parameters) {\n for (var name in nodeInfo.parameters) {\n var val = nodeInfo.parameters[name];\n if (typeof val === 'string') {\n val = val.trim();\n if (val.charAt(0) === '#') {\n val = lib.textures[val.substr(1)];\n }\n else {\n node.on(\n 'beforerender', createSizeSetHandler(\n name, tryConvertExpr(val)\n )\n );\n }\n }\n else if (typeof val === 'function') {\n node.on('beforerender', val);\n }\n node.setParameter(name, val);\n }\n }\n if (nodeInfo.defines && node.pass) {\n for (var name in nodeInfo.defines) {\n var val = nodeInfo.defines[name];\n node.pass.material.define('fragment', name, val);\n }\n }\n }\n return node;\n}\n\nfunction defaultWidthFunc(width, height) {\n return width;\n}\nfunction defaultHeightFunc(width, height) {\n return height;\n}\n\nfunction convertParameter(paramInfo) {\n var param = {};\n if (!paramInfo) {\n return param;\n }\n ['type', 'minFilter', 'magFilter', 'wrapS', 'wrapT', 'flipY', 'useMipmap']\n .forEach(function(name) {\n var val = paramInfo[name];\n if (val != null) {\n // Convert string to enum\n if (typeof val === 'string') {\n val = Texture[val];\n }\n param[name] = val;\n }\n });\n\n var sizeScale = paramInfo.scale || 1;\n ['width', 'height']\n .forEach(function(name) {\n if (paramInfo[name] != null) {\n var val = paramInfo[name];\n if (typeof val === 'string') {\n val = val.trim();\n param[name] = createSizeParser(\n name, tryConvertExpr(val), sizeScale\n );\n }\n else {\n param[name] = val;\n }\n }\n });\n if (!param.width) {\n param.width = defaultWidthFunc;\n }\n if (!param.height) {\n param.height = defaultHeightFunc;\n }\n\n if (paramInfo.useMipmap != null) {\n param.useMipmap = paramInfo.useMipmap;\n }\n return param;\n}\n\nfunction loadTextures(json, lib, opts, callback) {\n if (!json.textures) {\n callback({});\n return;\n }\n var textures = {};\n var loading = 0;\n\n var cbd = false;\n var textureRootPath = opts.textureRootPath;\n util.each(json.textures, function(textureInfo, name) {\n var texture;\n var path = textureInfo.path;\n var parameters = convertParameter(textureInfo.parameters);\n if (Array.isArray(path) && path.length === 6) {\n if (textureRootPath) {\n path = path.map(function(item) {\n return util.relative2absolute(item, textureRootPath);\n });\n }\n texture = new TextureCube(parameters);\n }\n else if(typeof path === 'string') {\n if (textureRootPath) {\n path = util.relative2absolute(path, textureRootPath);\n }\n texture = new Texture2D(parameters);\n }\n else {\n return;\n }\n\n texture.load(path);\n loading++;\n texture.once('success', function() {\n textures[name] = texture;\n loading--;\n if (loading === 0) {\n callback(textures);\n cbd = true;\n }\n });\n });\n\n if (loading === 0 && !cbd) {\n callback(textures);\n }\n}\n\nfunction createSizeSetHandler(name, exprFunc) {\n return function (renderer) {\n // PENDING viewport size or window size\n var dpr = renderer.getDevicePixelRatio();\n // PENDING If multiply dpr ?\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n var result = exprFunc(width, height, dpr);\n this.setParameter(name, result);\n };\n}\n\nfunction createSizeParser(name, exprFunc, scale) {\n scale = scale || 1;\n return function (renderer) {\n var dpr = renderer.getDevicePixelRatio();\n var width = renderer.getWidth() * scale;\n var height = renderer.getHeight() * scale;\n return exprFunc(width, height, dpr);\n };\n}\n\nfunction tryConvertExpr(string) {\n // PENDING\n var exprRes = /^expr\\((.*)\\)$/.exec(string);\n if (exprRes) {\n try {\n var func = new Function('width', 'height', 'dpr', 'return ' + exprRes[1]);\n // Try run t\n func(1, 1);\n\n return func;\n }\n catch (e) {\n throw new Error('Invalid expression.');\n }\n }\n}\n\nexport default createCompositor;\n","// DEPRECATED\nimport createCompositor from '../createCompositor';\nexport default createCompositor;","\n// Generate halton sequence\n// https://en.wikipedia.org/wiki/Halton_sequence\nfunction halton(index, base) {\n\n var result = 0;\n var f = 1 / base;\n var i = index;\n while (i > 0) {\n result = result + f * (i % base);\n i = Math.floor(i / base);\n f = f / base;\n }\n return result;\n}\n\n\nexport default halton;","export default \"@export ecgl.ssao.estimate\\n\\nuniform sampler2D depthTex;\\n\\nuniform sampler2D normalTex;\\n\\nuniform sampler2D noiseTex;\\n\\nuniform vec2 depthTexSize;\\n\\nuniform vec2 noiseTexSize;\\n\\nuniform mat4 projection;\\n\\nuniform mat4 projectionInv;\\n\\nuniform mat4 viewInverseTranspose;\\n\\nuniform vec3 kernel[KERNEL_SIZE];\\n\\nuniform float radius : 1;\\n\\nuniform float power : 1;\\n\\nuniform float bias: 1e-2;\\n\\nuniform float intensity: 1.0;\\n\\nvarying vec2 v_Texcoord;\\n\\nfloat ssaoEstimator(in vec3 originPos, in mat3 kernelBasis) {\\n float occlusion = 0.0;\\n\\n for (int i = 0; i < KERNEL_SIZE; i++) {\\n vec3 samplePos = kernel[i];\\n#ifdef NORMALTEX_ENABLED\\n samplePos = kernelBasis * samplePos;\\n#endif\\n samplePos = samplePos * radius + originPos;\\n\\n vec4 texCoord = projection * vec4(samplePos, 1.0);\\n texCoord.xy /= texCoord.w;\\n\\n vec4 depthTexel = texture2D(depthTex, texCoord.xy * 0.5 + 0.5);\\n\\n float sampleDepth = depthTexel.r * 2.0 - 1.0;\\n if (projection[3][3] == 0.0) {\\n sampleDepth = projection[3][2] / (sampleDepth * projection[2][3] - projection[2][2]);\\n }\\n else {\\n sampleDepth = (sampleDepth - projection[3][2]) / projection[2][2];\\n }\\n \\n float rangeCheck = smoothstep(0.0, 1.0, radius / abs(originPos.z - sampleDepth));\\n occlusion += rangeCheck * step(samplePos.z, sampleDepth - bias);\\n }\\n#ifdef NORMALTEX_ENABLED\\n occlusion = 1.0 - occlusion / float(KERNEL_SIZE);\\n#else\\n occlusion = 1.0 - clamp((occlusion / float(KERNEL_SIZE) - 0.6) * 2.5, 0.0, 1.0);\\n#endif\\n return pow(occlusion, power);\\n}\\n\\nvoid main()\\n{\\n\\n vec4 depthTexel = texture2D(depthTex, v_Texcoord);\\n\\n#ifdef NORMALTEX_ENABLED\\n vec4 tex = texture2D(normalTex, v_Texcoord);\\n if (dot(tex.rgb, tex.rgb) == 0.0) {\\n gl_FragColor = vec4(1.0);\\n return;\\n }\\n vec3 N = tex.rgb * 2.0 - 1.0;\\n N = (viewInverseTranspose * vec4(N, 0.0)).xyz;\\n\\n vec2 noiseTexCoord = depthTexSize / vec2(noiseTexSize) * v_Texcoord;\\n vec3 rvec = texture2D(noiseTex, noiseTexCoord).rgb * 2.0 - 1.0;\\n vec3 T = normalize(rvec - N * dot(rvec, N));\\n vec3 BT = normalize(cross(N, T));\\n mat3 kernelBasis = mat3(T, BT, N);\\n#else\\n if (depthTexel.r > 0.99999) {\\n gl_FragColor = vec4(1.0);\\n return;\\n }\\n mat3 kernelBasis;\\n#endif\\n\\n float z = depthTexel.r * 2.0 - 1.0;\\n\\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\\n vec4 p4 = projectionInv * projectedPos;\\n\\n vec3 position = p4.xyz / p4.w;\\n\\n float ao = ssaoEstimator(position, kernelBasis);\\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\\n gl_FragColor = vec4(vec3(ao), 1.0);\\n}\\n\\n@end\\n\\n\\n@export ecgl.ssao.blur\\n#define SHADER_NAME SSAO_BLUR\\n\\nuniform sampler2D ssaoTexture;\\n\\n#ifdef NORMALTEX_ENABLED\\nuniform sampler2D normalTex;\\n#endif\\n\\nvarying vec2 v_Texcoord;\\n\\nuniform vec2 textureSize;\\nuniform float blurSize : 1.0;\\n\\nuniform int direction: 0.0;\\n\\n#ifdef DEPTHTEX_ENABLED\\nuniform sampler2D depthTex;\\nuniform mat4 projection;\\nuniform float depthRange : 0.5;\\n\\nfloat getLinearDepth(vec2 coord)\\n{\\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\\n}\\n#endif\\n\\nvoid main()\\n{\\n float kernel[5];\\n kernel[0] = 0.122581;\\n kernel[1] = 0.233062;\\n kernel[2] = 0.288713;\\n kernel[3] = 0.233062;\\n kernel[4] = 0.122581;\\n\\n vec2 off = vec2(0.0);\\n if (direction == 0) {\\n off[0] = blurSize / textureSize.x;\\n }\\n else {\\n off[1] = blurSize / textureSize.y;\\n }\\n\\n vec2 coord = v_Texcoord;\\n\\n float sum = 0.0;\\n float weightAll = 0.0;\\n\\n#ifdef NORMALTEX_ENABLED\\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\\n#endif\\n#if defined(DEPTHTEX_ENABLED)\\n float centerDepth = getLinearDepth(v_Texcoord);\\n#endif\\n\\n for (int i = 0; i < 5; i++) {\\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\\n\\n float w = kernel[i];\\n#ifdef NORMALTEX_ENABLED\\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\\n#endif\\n#ifdef DEPTHTEX_ENABLED\\n float d = getLinearDepth(coord);\\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\\n#endif\\n\\n weightAll += w;\\n sum += texture2D(ssaoTexture, coord).r * w;\\n }\\n\\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\\n}\\n\\n@end\\n\";\n","import Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Pass from 'claygl/src/compositor/Pass';\nimport Shader from 'claygl/src/Shader';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport halton from './halton';\n\nimport SSAOGLSL from './SSAO.glsl.js';\nShader.import(SSAOGLSL);\n\nfunction generateNoiseData(size) {\n var data = new Uint8Array(size * size * 4);\n var n = 0;\n var v3 = new Vector3();\n\n for (var i = 0; i < size; i++) {\n for (var j = 0; j < size; j++) {\n v3.set(Math.random() * 2 - 1, Math.random() * 2 - 1, 0).normalize();\n data[n++] = (v3.x * 0.5 + 0.5) * 255;\n data[n++] = (v3.y * 0.5 + 0.5) * 255;\n data[n++] = 0;\n data[n++] = 255;\n }\n }\n return data;\n}\n\nfunction generateNoiseTexture(size) {\n return new Texture2D({\n pixels: generateNoiseData(size),\n wrapS: Texture.REPEAT,\n wrapT: Texture.REPEAT,\n width: size,\n height: size\n });\n}\n\nfunction generateKernel(size, offset, hemisphere) {\n var kernel = new Float32Array(size * 3);\n offset = offset || 0;\n for (var i = 0; i < size; i++) {\n var phi = halton(i + offset, 2) * (hemisphere ? 1 : 2) * Math.PI;\n var theta = halton(i + offset, 3) * Math.PI;\n var r = Math.random();\n var x = Math.cos(phi) * Math.sin(theta) * r;\n var y = Math.cos(theta) * r;\n var z = Math.sin(phi) * Math.sin(theta) * r;\n\n kernel[i * 3] = x;\n kernel[i * 3 + 1] = y;\n kernel[i * 3 + 2] = z;\n }\n return kernel;\n\n // var kernel = new Float32Array(size * 3);\n // var v3 = new Vector3();\n // for (var i = 0; i < size; i++) {\n // v3.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random())\n // .normalize().scale(Math.random());\n // kernel[i * 3] = v3.x;\n // kernel[i * 3 + 1] = v3.y;\n // kernel[i * 3 + 2] = v3.z;\n // }\n // return kernel;\n}\n\nfunction SSAOPass(opt) {\n opt = opt || {};\n\n this._ssaoPass = new Pass({\n fragment: Shader.source('ecgl.ssao.estimate')\n });\n this._blurPass = new Pass({\n fragment: Shader.source('ecgl.ssao.blur')\n });\n this._framebuffer = new FrameBuffer({\n depthBuffer: false\n });\n\n this._ssaoTexture = new Texture2D();\n this._blurTexture = new Texture2D();\n this._blurTexture2 = new Texture2D();\n\n this._depthTex = opt.depthTexture;\n this._normalTex = opt.normalTexture;\n\n this.setNoiseSize(4);\n this.setKernelSize(opt.kernelSize || 12);\n if (opt.radius != null) {\n this.setParameter('radius', opt.radius);\n }\n if (opt.power != null) {\n this.setParameter('power', opt.power);\n }\n\n if (!this._normalTex) {\n this._ssaoPass.material.disableTexture('normalTex');\n this._blurPass.material.disableTexture('normalTex');\n }\n if (!this._depthTex) {\n this._blurPass.material.disableTexture('depthTex');\n }\n\n this._blurPass.material.setUniform('normalTex', this._normalTex);\n this._blurPass.material.setUniform('depthTex', this._depthTex);\n}\n\nSSAOPass.prototype.setDepthTexture = function (depthTex) {\n this._depthTex = depthTex;\n};\n\nSSAOPass.prototype.setNormalTexture = function (normalTex) {\n this._normalTex = normalTex;\n this._ssaoPass.material[normalTex ? 'enableTexture' : 'disableTexture']('normalTex');\n // Switch between hemisphere and shere kernel.\n this.setKernelSize(this._kernelSize);\n};\n\nSSAOPass.prototype.update = function (renderer, camera, frame) {\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n\n var ssaoPass = this._ssaoPass;\n var blurPass = this._blurPass;\n\n ssaoPass.setUniform('kernel', this._kernels[frame % this._kernels.length]);\n ssaoPass.setUniform('depthTex', this._depthTex);\n if (this._normalTex != null) {\n ssaoPass.setUniform('normalTex', this._normalTex);\n }\n ssaoPass.setUniform('depthTexSize', [this._depthTex.width, this._depthTex.height]);\n\n var viewInverseTranspose = new Matrix4();\n Matrix4.transpose(viewInverseTranspose, camera.worldTransform);\n\n ssaoPass.setUniform('projection', camera.projectionMatrix.array);\n ssaoPass.setUniform('projectionInv', camera.invProjectionMatrix.array);\n ssaoPass.setUniform('viewInverseTranspose', viewInverseTranspose.array);\n\n var ssaoTexture = this._ssaoTexture;\n var blurTexture = this._blurTexture;\n var blurTexture2 = this._blurTexture2;\n\n ssaoTexture.width = width / 2;\n ssaoTexture.height = height / 2;\n blurTexture.width = width;\n blurTexture.height = height;\n blurTexture2.width = width;\n blurTexture2.height = height;\n\n this._framebuffer.attach(ssaoTexture);\n this._framebuffer.bind(renderer);\n renderer.gl.clearColor(1, 1, 1, 1);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT);\n ssaoPass.render(renderer);\n\n blurPass.setUniform('textureSize', [width / 2, height / 2]);\n blurPass.setUniform('projection', camera.projectionMatrix.array);\n this._framebuffer.attach(blurTexture);\n blurPass.setUniform('direction', 0);\n blurPass.setUniform('ssaoTexture', ssaoTexture);\n blurPass.render(renderer);\n\n this._framebuffer.attach(blurTexture2);\n blurPass.setUniform('textureSize', [width, height]);\n blurPass.setUniform('direction', 1);\n blurPass.setUniform('ssaoTexture', blurTexture);\n blurPass.render(renderer);\n\n this._framebuffer.unbind(renderer);\n\n // Restore clear\n var clearColor = renderer.clearColor;\n renderer.gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);\n};\n\nSSAOPass.prototype.getTargetTexture = function () {\n return this._blurTexture2;\n}\n\nSSAOPass.prototype.setParameter = function (name, val) {\n if (name === 'noiseTexSize') {\n this.setNoiseSize(val);\n }\n else if (name === 'kernelSize') {\n this.setKernelSize(val);\n }\n else if (name === 'intensity') {\n this._ssaoPass.material.set('intensity', val);\n }\n else {\n this._ssaoPass.setUniform(name, val);\n }\n};\n\nSSAOPass.prototype.setKernelSize = function (size) {\n this._kernelSize = size;\n this._ssaoPass.material.define('fragment', 'KERNEL_SIZE', size);\n this._kernels = this._kernels || [];\n for (var i = 0; i < 30; i++) {\n this._kernels[i] = generateKernel(size, i * size, !!this._normalTex);\n }\n};\n\nSSAOPass.prototype.setNoiseSize = function (size) {\n var texture = this._ssaoPass.getUniform('noiseTex');\n if (!texture) {\n texture = generateNoiseTexture(size);\n this._ssaoPass.setUniform('noiseTex', generateNoiseTexture(size));\n }\n else {\n texture.data = generateNoiseData(size);\n texture.width = texture.height = size;\n texture.dirty();\n }\n\n this._ssaoPass.setUniform('noiseTexSize', [size, size]);\n};\n\nSSAOPass.prototype.dispose = function (renderer) {\n this._blurTexture.dispose(renderer);\n this._ssaoTexture.dispose(renderer);\n this._blurTexture2.dispose(renderer);\n};\n\nexport default SSAOPass;","export default \"@export ecgl.ssr.main\\n\\n#define SHADER_NAME SSR\\n#define MAX_ITERATION 20;\\n#define SAMPLE_PER_FRAME 5;\\n#define TOTAL_SAMPLES 128;\\n\\nuniform sampler2D sourceTexture;\\nuniform sampler2D gBufferTexture1;\\nuniform sampler2D gBufferTexture2;\\nuniform sampler2D gBufferTexture3;\\nuniform samplerCube specularCubemap;\\nuniform float specularIntensity: 1;\\n\\nuniform mat4 projection;\\nuniform mat4 projectionInv;\\nuniform mat4 toViewSpace;\\nuniform mat4 toWorldSpace;\\n\\nuniform float maxRayDistance: 200;\\n\\nuniform float pixelStride: 16;\\nuniform float pixelStrideZCutoff: 50; \\nuniform float screenEdgeFadeStart: 0.9; \\nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \\nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\\n\\nuniform float nearZ;\\nuniform vec2 viewportSize : VIEWPORT_SIZE;\\n\\nuniform float jitterOffset: 0;\\n\\nvarying vec2 v_Texcoord;\\n\\n#ifdef DEPTH_DECODE\\n@import clay.util.decode_float\\n#endif\\n\\n#ifdef PHYSICALLY_CORRECT\\nuniform sampler2D normalDistribution;\\nuniform float sampleOffset: 0;\\nuniform vec2 normalDistributionSize;\\n\\nvec3 transformNormal(vec3 H, vec3 N) {\\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\\n vec3 tangentX = normalize(cross(N, upVector));\\n vec3 tangentZ = cross(N, tangentX);\\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\\n}\\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\\n return transformNormal(H, N);\\n}\\nfloat G_Smith(float g, float ndv, float ndl) {\\n float roughness = 1.0 - g;\\n float k = roughness * roughness / 2.0;\\n float G1V = ndv / (ndv * (1.0 - k) + k);\\n float G1L = ndl / (ndl * (1.0 - k) + k);\\n return G1L * G1V;\\n}\\nvec3 F_Schlick(float ndv, vec3 spec) {\\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\\n}\\n#endif\\n\\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\\n{\\n vec4 depthTexel = texture2D(depthTexture, uv);\\n return depthTexel.r * 2.0 - 1.0;\\n}\\n\\nfloat linearDepth(float depth)\\n{\\n if (projection[3][3] == 0.0) {\\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\\n }\\n else {\\n return (depth - projection[3][2]) / projection[2][2];\\n }\\n}\\n\\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\\n{\\n if (rayZFar > rayZNear)\\n {\\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\\n }\\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\\n}\\n\\n\\nbool traceScreenSpaceRay(\\n vec3 rayOrigin, vec3 rayDir, float jitter,\\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\\n)\\n{\\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\\n\\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\\n\\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\\n vec4 H1 = projection * vec4(rayEnd, 1.0);\\n\\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\\n\\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\\n\\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\\n\\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\\n vec2 delta = P1 - P0;\\n\\n bool permute = false;\\n if (abs(delta.x) < abs(delta.y)) {\\n permute = true;\\n delta = delta.yx;\\n P0 = P0.yx;\\n P1 = P1.yx;\\n }\\n float stepDir = sign(delta.x);\\n float invdx = stepDir / delta.x;\\n\\n vec3 dQ = (Q1 - Q0) * invdx;\\n float dk = (k1 - k0) * invdx;\\n\\n vec2 dP = vec2(stepDir, delta.y * invdx);\\n\\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\\n float pixStride = 1.0 + strideScaler * pixelStride;\\n\\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\\n\\n vec4 pqk = vec4(P0, Q0.z, k0);\\n vec4 dPQK = vec4(dP, dQ.z, dk);\\n\\n pqk += dPQK * jitter;\\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\\n float rayZNear;\\n\\n bool intersect = false;\\n\\n vec2 texelSize = 1.0 / viewportSize;\\n\\n iterationCount = 0.0;\\n\\n for (int i = 0; i < MAX_ITERATION; i++)\\n {\\n pqk += dPQK;\\n\\n rayZNear = rayZFar;\\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\\n\\n hitPixel = permute ? pqk.yx : pqk.xy;\\n hitPixel *= texelSize;\\n\\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\\n\\n iterationCount += 1.0;\\n\\n dPQK *= 1.2;\\n\\n if (intersect) {\\n break;\\n }\\n }\\n\\n Q0.xy += dQ.xy * iterationCount;\\n Q0.z = pqk.z;\\n hitPoint = Q0 / pqk.w;\\n\\n return intersect;\\n}\\n\\nfloat calculateAlpha(\\n float iterationCount, float reflectivity,\\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\\n)\\n{\\n float alpha = clamp(reflectivity, 0.0, 1.0);\\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\\n\\n float _eyeFadeStart = eyeFadeStart;\\n float _eyeFadeEnd = eyeFadeEnd;\\n if (_eyeFadeStart > _eyeFadeEnd) {\\n float tmp = _eyeFadeEnd;\\n _eyeFadeEnd = _eyeFadeStart;\\n _eyeFadeStart = tmp;\\n }\\n\\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\\n\\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\\n\\n return alpha;\\n}\\n\\n@import clay.util.rand\\n\\n@import clay.util.rgbm\\n\\nvoid main()\\n{\\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\\n\\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\\n discard;\\n }\\n\\n float g = normalAndGloss.a;\\n#if !defined(PHYSICALLY_CORRECT)\\n if (g <= minGlossiness) {\\n discard;\\n }\\n#endif\\n\\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\\n\\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\\n\\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\\n vec4 pos = projectionInv * projectedPos;\\n vec3 rayOrigin = pos.xyz / pos.w;\\n vec3 V = -normalize(rayOrigin);\\n\\n float ndv = clamp(dot(N, V), 0.0, 1.0);\\n float iterationCount;\\n float jitter = rand(fract(v_Texcoord + jitterOffset));\\n\\n#ifdef PHYSICALLY_CORRECT\\n vec4 color = vec4(vec3(0.0), 1.0);\\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\\n vec3 albedo = albedoMetalness.rgb;\\n float m = albedoMetalness.a;\\n vec3 diffuseColor = albedo * (1.0 - m);\\n vec3 spec = mix(vec3(0.04), albedo, m);\\n\\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\\n\\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\\n vec3 rayDir = normalize(reflect(-V, H));\\n#else\\n vec3 rayDir = normalize(reflect(-V, N));\\n#endif\\n vec2 hitPixel;\\n vec3 hitPoint;\\n\\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\\n\\n float dist = distance(rayOrigin, hitPoint);\\n\\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\\n#ifdef PHYSICALLY_CORRECT\\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\\n float vdh = clamp(dot(V, H), 0.0, 1.0);\\n float ndh = clamp(dot(N, H), 0.0, 1.0);\\n vec3 litTexel = vec3(0.0);\\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\\n\\n }\\n else {\\n #ifdef SPECULARCUBEMAP_ENABLED\\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\\n#endif\\n }\\n color.rgb += ndl * litTexel * (\\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\\n );\\n }\\n color.rgb /= float(SAMPLE_PER_FRAME);\\n#else\\n #if !defined(SPECULARCUBEMAP_ENABLED)\\n if (dot(hitNormal, rayDir) >= 0.0) {\\n discard;\\n }\\n if (!intersect) {\\n discard;\\n }\\n#endif\\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\\n vec4 color = texture2D(sourceTexture, hitPixel);\\n color.rgb *= alpha;\\n\\n#ifdef SPECULARCUBEMAP_ENABLED\\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\\n alpha = alpha * (intersect ? 1.0 : 0.0);\\n float bias = (1.0 -g) * 5.0;\\n color.rgb += (1.0 - alpha)\\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\\n * specularIntensity;\\n#endif\\n\\n#endif\\n\\n gl_FragColor = encodeHDR(color);\\n}\\n@end\\n\\n@export ecgl.ssr.blur\\n\\nuniform sampler2D texture;\\nuniform sampler2D gBufferTexture1;\\nuniform sampler2D gBufferTexture2;\\nuniform mat4 projection;\\nuniform float depthRange : 0.05;\\n\\nvarying vec2 v_Texcoord;\\n\\nuniform vec2 textureSize;\\nuniform float blurSize : 1.0;\\n\\n#ifdef BLEND\\n #ifdef SSAOTEX_ENABLED\\nuniform sampler2D ssaoTex;\\n #endif\\nuniform sampler2D sourceTexture;\\n#endif\\n\\nfloat getLinearDepth(vec2 coord)\\n{\\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\\n}\\n\\n@import clay.util.rgbm\\n\\n\\nvoid main()\\n{\\n @import clay.compositor.kernel.gaussian_9\\n\\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\\n float g = centerNTexel.a;\\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\\n#ifdef VERTICAL\\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\\n#else\\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\\n#endif\\n\\n vec2 coord = v_Texcoord;\\n\\n vec4 sum = vec4(0.0);\\n float weightAll = 0.0;\\n\\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\\n float cD = getLinearDepth(v_Texcoord);\\n for (int i = 0; i < 9; i++) {\\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\\n float w = gaussianKernel[i]\\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\\n float d = getLinearDepth(coord);\\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\\n\\n weightAll += w;\\n sum += decodeHDR(texture2D(texture, coord)) * w;\\n }\\n\\n#ifdef BLEND\\n float aoFactor = 1.0;\\n #ifdef SSAOTEX_ENABLED\\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\\n #endif\\n gl_FragColor = encodeHDR(\\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\\n );\\n#else\\n gl_FragColor = encodeHDR(sum / weightAll);\\n#endif\\n}\\n\\n@end\";\n","import Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Pass from 'claygl/src/compositor/Pass';\nimport Shader from 'claygl/src/Shader';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport halton from './halton';\nimport cubemapUtil from 'claygl/src/util/cubemap';\n\nimport SSRGLSLCode from './SSR.glsl.js';\n\nShader.import(SSRGLSLCode);\n\nfunction SSRPass(opt) {\n opt = opt || {};\n\n this._ssrPass = new Pass({\n fragment: Shader.source('ecgl.ssr.main'),\n clearColor: [0, 0, 0, 0]\n });\n this._blurPass1 = new Pass({\n fragment: Shader.source('ecgl.ssr.blur'),\n clearColor: [0, 0, 0, 0]\n });\n this._blurPass2 = new Pass({\n fragment: Shader.source('ecgl.ssr.blur'),\n clearColor: [0, 0, 0, 0]\n });\n this._blendPass = new Pass({\n fragment: Shader.source('clay.compositor.blend')\n });\n this._blendPass.material.disableTexturesAll();\n this._blendPass.material.enableTexture(['texture1', 'texture2']);\n\n this._ssrPass.setUniform('gBufferTexture1', opt.normalTexture);\n this._ssrPass.setUniform('gBufferTexture2', opt.depthTexture);\n // this._ssrPass.setUniform('gBufferTexture3', opt.albedoTexture);\n\n this._blurPass1.setUniform('gBufferTexture1', opt.normalTexture);\n this._blurPass1.setUniform('gBufferTexture2', opt.depthTexture);\n\n this._blurPass2.setUniform('gBufferTexture1', opt.normalTexture);\n this._blurPass2.setUniform('gBufferTexture2', opt.depthTexture);\n\n this._blurPass2.material.define('fragment', 'VERTICAL');\n this._blurPass2.material.define('fragment', 'BLEND');\n\n this._ssrTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._texture2 = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._texture3 = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._prevTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._currentTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n\n this._frameBuffer = new FrameBuffer({\n depthBuffer: false\n });\n\n this._normalDistribution = null;\n\n this._totalSamples = 256;\n this._samplePerFrame = 4;\n\n this._ssrPass.material.define('fragment', 'SAMPLE_PER_FRAME', this._samplePerFrame);\n this._ssrPass.material.define('fragment', 'TOTAL_SAMPLES', this._totalSamples);\n\n this._downScale = 1;\n}\n\nSSRPass.prototype.setAmbientCubemap = function (specularCubemap, specularIntensity) {\n this._ssrPass.material.set('specularCubemap', specularCubemap);\n this._ssrPass.material.set('specularIntensity', specularIntensity);\n\n var enableSpecularMap = specularCubemap && specularIntensity;\n this._ssrPass.material[enableSpecularMap ? 'enableTexture' : 'disableTexture']('specularCubemap');\n};\n\nSSRPass.prototype.update = function (renderer, camera, sourceTexture, frame) {\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n var ssrTexture = this._ssrTexture;\n var texture2 = this._texture2;\n var texture3 = this._texture3;\n ssrTexture.width = this._prevTexture.width = this._currentTexture.width = width / this._downScale;\n ssrTexture.height = this._prevTexture.height = this._currentTexture.height = height / this._downScale;\n\n texture2.width = texture3.width = width;\n texture2.height = texture3.height = height;\n\n var frameBuffer = this._frameBuffer;\n\n var ssrPass = this._ssrPass;\n var blurPass1 = this._blurPass1;\n var blurPass2 = this._blurPass2;\n var blendPass = this._blendPass;\n\n var toViewSpace = new Matrix4();\n var toWorldSpace = new Matrix4();\n Matrix4.transpose(toViewSpace, camera.worldTransform);\n Matrix4.transpose(toWorldSpace, camera.viewMatrix);\n\n ssrPass.setUniform('sourceTexture', sourceTexture);\n ssrPass.setUniform('projection', camera.projectionMatrix.array);\n ssrPass.setUniform('projectionInv', camera.invProjectionMatrix.array);\n ssrPass.setUniform('toViewSpace', toViewSpace.array);\n ssrPass.setUniform('toWorldSpace', toWorldSpace.array);\n ssrPass.setUniform('nearZ', camera.near);\n\n var percent = frame / this._totalSamples * this._samplePerFrame;\n ssrPass.setUniform('jitterOffset', percent);\n ssrPass.setUniform('sampleOffset', frame * this._samplePerFrame);\n\n blurPass1.setUniform('textureSize', [ssrTexture.width, ssrTexture.height]);\n blurPass2.setUniform('textureSize', [width, height]);\n blurPass2.setUniform('sourceTexture', sourceTexture);\n\n blurPass1.setUniform('projection', camera.projectionMatrix.array);\n blurPass2.setUniform('projection', camera.projectionMatrix.array);\n\n frameBuffer.attach(ssrTexture);\n frameBuffer.bind(renderer);\n ssrPass.render(renderer);\n\n if (this._physicallyCorrect) {\n frameBuffer.attach(this._currentTexture);\n blendPass.setUniform('texture1', this._prevTexture);\n blendPass.setUniform('texture2', ssrTexture);\n blendPass.material.set({\n 'weight1': frame >= 1 ? 0.95 : 0,\n 'weight2': frame >= 1 ? 0.05 : 1\n // weight1: frame >= 1 ? 1 : 0,\n // weight2: 1\n });\n blendPass.render(renderer);\n }\n\n frameBuffer.attach(texture2);\n blurPass1.setUniform('texture', this._physicallyCorrect ? this._currentTexture : ssrTexture);\n blurPass1.render(renderer);\n\n frameBuffer.attach(texture3);\n blurPass2.setUniform('texture', texture2);\n blurPass2.render(renderer);\n frameBuffer.unbind(renderer);\n\n if (this._physicallyCorrect) {\n var tmp = this._prevTexture;\n this._prevTexture = this._currentTexture;\n this._currentTexture = tmp;\n }\n};\n\nSSRPass.prototype.getTargetTexture = function () {\n return this._texture3;\n};\n\nSSRPass.prototype.setParameter = function (name, val) {\n if (name === 'maxIteration') {\n this._ssrPass.material.define('fragment', 'MAX_ITERATION', val);\n }\n else {\n this._ssrPass.setUniform(name, val);\n }\n};\n\nSSRPass.prototype.setPhysicallyCorrect = function (isPhysicallyCorrect) {\n if (isPhysicallyCorrect) {\n if (!this._normalDistribution) {\n this._normalDistribution = cubemapUtil.generateNormalDistribution(64, this._totalSamples);\n }\n this._ssrPass.material.define('fragment', 'PHYSICALLY_CORRECT');\n this._ssrPass.material.set('normalDistribution', this._normalDistribution);\n this._ssrPass.material.set('normalDistributionSize', [64, this._totalSamples]);\n }\n else {\n this._ssrPass.material.undefine('fragment', 'PHYSICALLY_CORRECT');\n }\n\n this._physicallyCorrect = isPhysicallyCorrect;\n};\n\nSSRPass.prototype.setSSAOTexture = function (texture) {\n var blendPass = this._blurPass2;\n if (texture) {\n blendPass.material.enableTexture('ssaoTex');\n blendPass.material.set('ssaoTex', texture);\n }\n else {\n blendPass.material.disableTexture('ssaoTex');\n }\n};\n\nSSRPass.prototype.isFinished = function (frame) {\n if (this._physicallyCorrect) {\n return frame > (this._totalSamples / this._samplePerFrame);\n }\n else {\n return true;\n }\n};\n\nSSRPass.prototype.dispose = function (renderer) {\n this._ssrTexture.dispose(renderer);\n this._texture2.dispose(renderer);\n this._texture3.dispose(renderer);\n this._prevTexture.dispose(renderer);\n this._currentTexture.dispose(renderer);\n this._frameBuffer.dispose(renderer);\n};\n\nexport default SSRPass;","// Based on https://bl.ocks.org/mbostock/19168c663618b707158\n\nexport default [\n0.0, 0.0,\n-0.321585265978, -0.154972575841,\n0.458126042375, 0.188473391593,\n0.842080129861, 0.527766490688,\n0.147304551086, -0.659453822776,\n-0.331943915203, -0.940619700594,\n0.0479226680259, 0.54812163202,\n0.701581552186, -0.709825561388,\n-0.295436780218, 0.940589268233,\n-0.901489676764, 0.237713156085,\n0.973570876096, -0.109899459384,\n-0.866792314779, -0.451805525005,\n0.330975007087, 0.800048655954,\n-0.344275183665, 0.381779221166,\n-0.386139432542, -0.437418421534,\n-0.576478634965, -0.0148463392551,\n0.385798197415, -0.262426961053,\n-0.666302061145, 0.682427250835,\n-0.628010632582, -0.732836215494,\n0.10163141741, -0.987658134403,\n0.711995289051, -0.320024291314,\n0.0296005138058, 0.950296523438,\n0.0130612307608, -0.351024443122,\n-0.879596633704, -0.10478487883,\n0.435712737232, 0.504254490347,\n0.779203817497, 0.206477676721,\n0.388264289969, -0.896736162545,\n-0.153106280781, -0.629203242522,\n-0.245517550697, 0.657969239148,\n0.126830499058, 0.26862328493,\n-0.634888119007, -0.302301223431,\n0.617074219636, 0.779817204925\n];","export default \"@export ecgl.normal.vertex\\n\\n@import ecgl.common.transformUniforms\\n\\n@import ecgl.common.uv.header\\n\\n@import ecgl.common.attributes\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\n@import ecgl.common.normalMap.vertexHeader\\n\\n@import ecgl.common.vertexAnimation.header\\n\\nvoid main()\\n{\\n\\n @import ecgl.common.vertexAnimation.main\\n\\n @import ecgl.common.uv.main\\n\\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\\n\\n @import ecgl.common.normalMap.vertexMain\\n\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n\\n}\\n\\n\\n@end\\n\\n\\n@export ecgl.normal.fragment\\n\\n#define ROUGHNESS_CHANEL 0\\n\\nuniform bool useBumpMap;\\nuniform bool useRoughnessMap;\\nuniform bool doubleSide;\\nuniform float roughness;\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform mat4 viewInverse : VIEWINVERSE;\\n\\n@import ecgl.common.normalMap.fragmentHeader\\n@import ecgl.common.bumpMap.header\\n\\nuniform sampler2D roughnessMap;\\n\\nvoid main()\\n{\\n vec3 N = v_Normal;\\n \\n bool flipNormal = false;\\n if (doubleSide) {\\n vec3 eyePos = viewInverse[3].xyz;\\n vec3 V = normalize(eyePos - v_WorldPosition);\\n\\n if (dot(N, V) < 0.0) {\\n flipNormal = true;\\n }\\n }\\n\\n @import ecgl.common.normalMap.fragmentMain\\n\\n if (useBumpMap) {\\n N = bumpNormal(v_WorldPosition, v_Normal, N);\\n }\\n\\n float g = 1.0 - roughness;\\n\\n if (useRoughnessMap) {\\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\\n }\\n\\n if (flipNormal) {\\n N = -N;\\n }\\n\\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\\n gl_FragColor.a = g;\\n}\\n@end\";\n","// NormalPass will generate normal and depth data.\n\n// TODO Animation\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Shader from 'claygl/src/Shader';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport Material from 'claygl/src/Material';\nimport Pass from 'claygl/src/compositor/Pass';\nimport textureUtil from 'claygl/src/util/texture';\n\nimport normalGLSL from '../util/shader/normal.glsl.js';\nShader.import(normalGLSL);\n\nfunction attachTextureToSlot(renderer, program, symbol, texture, slot) {\n var gl = renderer.gl;\n program.setUniform(gl, '1i', symbol, slot);\n\n gl.activeTexture(gl.TEXTURE0 + slot);\n // Maybe texture is not loaded yet;\n if (texture.isRenderable()) {\n texture.bind(renderer);\n }\n else {\n // Bind texture to null\n texture.unbind(renderer);\n }\n}\n\n// TODO Use globalShader insteadof globalMaterial?\nfunction getBeforeRenderHook (renderer, defaultNormalMap, defaultBumpMap, defaultRoughnessMap, normalMaterial) {\n\n var previousNormalMap;\n var previousBumpMap;\n var previousRoughnessMap;\n var previousRenderable;\n var gl = renderer.gl;\n\n return function (renderable, normalMaterial, prevNormalMaterial) {\n // Material not change\n if (previousRenderable && previousRenderable.material === renderable.material) {\n return;\n }\n\n var material = renderable.material;\n var program = renderable.__program;\n\n var roughness = material.get('roughness');\n if (roughness == null) {\n roughness = 1;\n }\n\n var normalMap = material.get('normalMap') || defaultNormalMap;\n var roughnessMap = material.get('roughnessMap');\n var bumpMap = material.get('bumpMap');\n var uvRepeat = material.get('uvRepeat');\n var uvOffset = material.get('uvOffset');\n var detailUvRepeat = material.get('detailUvRepeat');\n var detailUvOffset = material.get('detailUvOffset');\n\n var useBumpMap = !!bumpMap && material.isTextureEnabled('bumpMap');\n var useRoughnessMap = !!roughnessMap && material.isTextureEnabled('roughnessMap');\n var doubleSide = material.isDefined('fragment', 'DOUBLE_SIDED');\n\n bumpMap = bumpMap || defaultBumpMap;\n roughnessMap = roughnessMap || defaultRoughnessMap;\n\n if (prevNormalMaterial !== normalMaterial) {\n normalMaterial.set('normalMap', normalMap);\n normalMaterial.set('bumpMap', bumpMap);\n normalMaterial.set('roughnessMap', roughnessMap);\n normalMaterial.set('useBumpMap', useBumpMap);\n normalMaterial.set('useRoughnessMap', useRoughnessMap);\n normalMaterial.set('doubleSide', doubleSide);\n uvRepeat != null && normalMaterial.set('uvRepeat', uvRepeat);\n uvOffset != null && normalMaterial.set('uvOffset', uvOffset);\n detailUvRepeat != null && normalMaterial.set('detailUvRepeat', detailUvRepeat);\n detailUvOffset != null && normalMaterial.set('detailUvOffset', detailUvOffset);\n\n normalMaterial.set('roughness', roughness);\n }\n else {\n program.setUniform(gl, '1f', 'roughness', roughness);\n\n if (previousNormalMap !== normalMap) {\n attachTextureToSlot(renderer, program, 'normalMap', normalMap, 0);\n }\n if (previousBumpMap !== bumpMap && bumpMap) {\n attachTextureToSlot(renderer, program, 'bumpMap', bumpMap, 1);\n }\n if (previousRoughnessMap !== roughnessMap && roughnessMap) {\n attachTextureToSlot(renderer, program, 'roughnessMap', roughnessMap, 2);\n }\n if (uvRepeat != null) {\n program.setUniform(gl, '2f', 'uvRepeat', uvRepeat);\n }\n if (uvOffset != null) {\n program.setUniform(gl, '2f', 'uvOffset', uvOffset);\n }\n if (detailUvRepeat != null) {\n program.setUniform(gl, '2f', 'detailUvRepeat', detailUvRepeat);\n }\n if (detailUvOffset != null) {\n program.setUniform(gl, '2f', 'detailUvOffset', detailUvOffset);\n }\n program.setUniform(gl, '1i', 'useBumpMap', +useBumpMap);\n program.setUniform(gl, '1i', 'useRoughnessMap', +useRoughnessMap);\n program.setUniform(gl, '1i', 'doubleSide', +doubleSide);\n }\n\n previousNormalMap = normalMap;\n previousBumpMap = bumpMap;\n previousRoughnessMap = roughnessMap;\n\n previousRenderable = renderable;\n };\n}\n\nfunction NormalPass(opt) {\n opt = opt || {};\n\n this._depthTex = new Texture2D({\n format: Texture.DEPTH_COMPONENT,\n type: Texture.UNSIGNED_INT\n });\n this._normalTex = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n\n this._framebuffer = new FrameBuffer();\n this._framebuffer.attach(this._normalTex);\n this._framebuffer.attach(this._depthTex, FrameBuffer.DEPTH_ATTACHMENT);\n\n this._normalMaterial = new Material({\n shader: new Shader(\n Shader.source('ecgl.normal.vertex'),\n Shader.source('ecgl.normal.fragment')\n )\n });\n this._normalMaterial.enableTexture(['normalMap', 'bumpMap', 'roughnessMap']);\n\n this._defaultNormalMap = textureUtil.createBlank('#000');\n this._defaultBumpMap = textureUtil.createBlank('#000');\n this._defaultRoughessMap = textureUtil.createBlank('#000');\n\n\n this._debugPass = new Pass({\n fragment: Shader.source('clay.compositor.output')\n });\n this._debugPass.setUniform('texture', this._normalTex);\n this._debugPass.material.undefine('fragment', 'OUTPUT_ALPHA');\n}\n\nNormalPass.prototype.getDepthTexture = function () {\n return this._depthTex;\n};\n\nNormalPass.prototype.getNormalTexture = function () {\n return this._normalTex;\n};\n\nNormalPass.prototype.update = function (renderer, scene, camera) {\n\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n\n var depthTexture = this._depthTex;\n var normalTexture = this._normalTex;\n var normalMaterial = this._normalMaterial;\n\n depthTexture.width = width;\n depthTexture.height = height;\n normalTexture.width = width;\n normalTexture.height = height;\n\n var opaqueList = scene.getRenderList(camera).opaque;\n\n this._framebuffer.bind(renderer);\n renderer.gl.clearColor(0, 0, 0, 0);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT | renderer.gl.DEPTH_BUFFER_BIT);\n renderer.gl.disable(renderer.gl.BLEND);\n\n renderer.renderPass(opaqueList, camera, {\n getMaterial: function () {\n return normalMaterial;\n },\n ifRender: function (object) {\n return object.renderNormal;\n },\n beforeRender: getBeforeRenderHook(\n renderer, this._defaultNormalMap, this._defaultBumpMap, this._defaultRoughessMap, this._normalMaterial\n ),\n sort: renderer.opaqueSortCompare\n });\n this._framebuffer.unbind(renderer);\n};\n\nNormalPass.prototype.renderDebug = function (renderer) {\n this._debugPass.render(renderer);\n};\n\nNormalPass.prototype.dispose = function (renderer) {\n this._depthTex.dispose(renderer);\n this._normalTex.dispose(renderer);\n}\n\nexport default NormalPass;","import Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport Pass from 'claygl/src/compositor/Pass';\nimport Shader from 'claygl/src/Shader';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\n\nfunction EdgePass(opt) {\n opt = opt || {};\n\n this._edgePass = new Pass({\n fragment: Shader.source('ecgl.edge')\n });\n\n this._edgePass.setUniform('normalTexture', opt.normalTexture);\n this._edgePass.setUniform('depthTexture', opt.depthTexture);\n\n this._targetTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n\n this._frameBuffer = new FrameBuffer();\n this._frameBuffer.attach(this._targetTexture);\n}\n\nEdgePass.prototype.update = function (renderer, camera, sourceTexture, frame) {\n var width = renderer.getWidth();\n var height = renderer.getHeight();\n var texture = this._targetTexture;\n texture.width = width;\n texture.height = height;\n var frameBuffer = this._frameBuffer;\n\n frameBuffer.bind(renderer);\n this._edgePass.setUniform('projectionInv', camera.invProjectionMatrix.array);\n this._edgePass.setUniform('textureSize', [width, height]);\n this._edgePass.setUniform('texture', sourceTexture);\n this._edgePass.render(renderer);\n\n frameBuffer.unbind(renderer);\n};\n\nEdgePass.prototype.getTargetTexture = function () {\n return this._targetTexture;\n};\n\nEdgePass.prototype.setParameter = function (name, val) {\n this._edgePass.setUniform(name, val);\n};\n\nEdgePass.prototype.dispose = function (renderer) {\n this._targetTexture.dispose(renderer);\n this._frameBuffer.dispose(renderer);\n};\n\nexport default EdgePass;","export default {\n 'type' : 'compositor',\n 'nodes' : [\n {\n 'name': 'source',\n 'type': 'texture',\n 'outputs': {\n 'color': {}\n }\n },\n {\n 'name': 'source_half',\n 'shader': '#source(clay.compositor.downsample)',\n 'inputs': {\n 'texture': 'source'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0 / 2)',\n 'height': 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n }\n },\n\n\n {\n 'name' : 'bright',\n 'shader' : '#source(clay.compositor.bright)',\n 'inputs' : {\n 'texture' : 'source_half'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 2)',\n 'height' : 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'threshold' : 2,\n 'scale': 4,\n 'textureSize': 'expr([width * 1.0 / 2, height / 2])'\n }\n },\n\n {\n 'name': 'bright_downsample_4',\n 'shader' : '#source(clay.compositor.downsample)',\n 'inputs' : {\n 'texture' : 'bright'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 4)',\n 'height' : 'expr(height * 1.0 / 4)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0 / 2, height / 2] )'\n }\n },\n {\n 'name': 'bright_downsample_8',\n 'shader' : '#source(clay.compositor.downsample)',\n 'inputs' : {\n 'texture' : 'bright_downsample_4'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 8)',\n 'height' : 'expr(height * 1.0 / 8)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0 / 4, height / 4] )'\n }\n },\n {\n 'name': 'bright_downsample_16',\n 'shader' : '#source(clay.compositor.downsample)',\n 'inputs' : {\n 'texture' : 'bright_downsample_8'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 16)',\n 'height' : 'expr(height * 1.0 / 16)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0 / 8, height / 8] )'\n }\n },\n {\n 'name': 'bright_downsample_32',\n 'shader' : '#source(clay.compositor.downsample)',\n 'inputs' : {\n 'texture' : 'bright_downsample_16'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 32)',\n 'height' : 'expr(height * 1.0 / 32)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'textureSize': 'expr( [width * 1.0 / 16, height / 16] )'\n }\n },\n\n\n {\n 'name' : 'bright_upsample_16_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_downsample_32'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 16)',\n 'height' : 'expr(height * 1.0 / 16)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 32, height / 32] )'\n }\n },\n {\n 'name' : 'bright_upsample_16_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_16_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 16)',\n 'height' : 'expr(height * 1.0 / 16)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0 / 16, height * 1.0 / 16] )'\n }\n },\n\n\n\n {\n 'name' : 'bright_upsample_8_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_downsample_16'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 8)',\n 'height' : 'expr(height * 1.0 / 8)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 16, height * 1.0 / 16] )'\n }\n },\n {\n 'name' : 'bright_upsample_8_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_8_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 8)',\n 'height' : 'expr(height * 1.0 / 8)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0 / 8, height * 1.0 / 8] )'\n }\n },\n {\n 'name' : 'bright_upsample_8_blend',\n 'shader' : '#source(clay.compositor.blend)',\n 'inputs' : {\n 'texture1' : 'bright_upsample_8_blur_v',\n 'texture2' : 'bright_upsample_16_blur_v'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 8)',\n 'height' : 'expr(height * 1.0 / 8)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'weight1' : 0.3,\n 'weight2' : 0.7\n }\n },\n\n\n {\n 'name' : 'bright_upsample_4_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_downsample_8'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 4)',\n 'height' : 'expr(height * 1.0 / 4)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 8, height * 1.0 / 8] )'\n }\n },\n {\n 'name' : 'bright_upsample_4_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_4_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 4)',\n 'height' : 'expr(height * 1.0 / 4)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0 / 4, height * 1.0 / 4] )'\n }\n },\n {\n 'name' : 'bright_upsample_4_blend',\n 'shader' : '#source(clay.compositor.blend)',\n 'inputs' : {\n 'texture1' : 'bright_upsample_4_blur_v',\n 'texture2' : 'bright_upsample_8_blend'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 4)',\n 'height' : 'expr(height * 1.0 / 4)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'weight1' : 0.3,\n 'weight2' : 0.7\n }\n },\n\n\n\n\n\n {\n 'name' : 'bright_upsample_2_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_downsample_4'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 2)',\n 'height' : 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 4, height * 1.0 / 4] )'\n }\n },\n {\n 'name' : 'bright_upsample_2_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_2_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 2)',\n 'height' : 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0 / 2, height * 1.0 / 2] )'\n }\n },\n {\n 'name' : 'bright_upsample_2_blend',\n 'shader' : '#source(clay.compositor.blend)',\n 'inputs' : {\n 'texture1' : 'bright_upsample_2_blur_v',\n 'texture2' : 'bright_upsample_4_blend'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0 / 2)',\n 'height' : 'expr(height * 1.0 / 2)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'weight1' : 0.3,\n 'weight2' : 0.7\n }\n },\n\n\n\n {\n 'name' : 'bright_upsample_full_blur_h',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0)',\n 'height' : 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 0.0,\n 'textureSize': 'expr( [width * 1.0 / 2, height * 1.0 / 2] )'\n }\n },\n {\n 'name' : 'bright_upsample_full_blur_v',\n 'shader' : '#source(clay.compositor.gaussian_blur)',\n 'inputs' : {\n 'texture' : 'bright_upsample_full_blur_h'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0)',\n 'height' : 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'blurSize' : 1,\n 'blurDir': 1.0,\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n }\n },\n {\n 'name' : 'bloom_composite',\n 'shader' : '#source(clay.compositor.blend)',\n 'inputs' : {\n 'texture1' : 'bright_upsample_full_blur_v',\n 'texture2' : 'bright_upsample_2_blend'\n },\n 'outputs' : {\n 'color' : {\n 'parameters' : {\n 'width' : 'expr(width * 1.0)',\n 'height' : 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters' : {\n 'weight1' : 0.3,\n 'weight2' : 0.7\n }\n },\n\n\n {\n 'name': 'coc',\n 'shader': '#source(ecgl.dof.coc)',\n 'outputs': {\n 'color': {\n 'parameters': {\n 'minFilter': 'NEAREST',\n 'magFilter': 'NEAREST',\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)'\n }\n }\n },\n 'parameters': {\n 'focalDist': 50,\n 'focalRange': 30\n }\n },\n\n {\n 'name': 'dof_far_blur',\n 'shader': '#source(ecgl.dof.diskBlur)',\n 'inputs': {\n 'texture': 'source',\n 'coc': 'coc'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters': {\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n }\n },\n {\n 'name': 'dof_near_blur',\n 'shader': '#source(ecgl.dof.diskBlur)',\n 'inputs': {\n 'texture': 'source',\n 'coc': 'coc'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n },\n 'parameters': {\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n },\n 'defines': {\n 'BLUR_NEARFIELD': null\n }\n },\n\n\n {\n 'name': 'dof_coc_blur',\n 'shader': '#source(ecgl.dof.diskBlur)',\n 'inputs': {\n 'texture': 'coc'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'minFilter': 'NEAREST',\n 'magFilter': 'NEAREST',\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)'\n }\n }\n },\n 'parameters': {\n 'textureSize': 'expr( [width * 1.0, height * 1.0] )'\n },\n 'defines': {\n 'BLUR_COC': null\n }\n },\n\n {\n 'name': 'dof_composite',\n 'shader': '#source(ecgl.dof.composite)',\n 'inputs': {\n 'original': 'source',\n 'blurred': 'dof_far_blur',\n 'nearfield': 'dof_near_blur',\n 'coc': 'coc',\n 'nearcoc': 'dof_coc_blur'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)',\n 'type': 'HALF_FLOAT'\n }\n }\n }\n },\n {\n 'name' : 'composite',\n 'shader' : '#source(clay.compositor.hdr.composite)',\n 'inputs' : {\n 'texture': 'source',\n 'bloom' : 'bloom_composite'\n },\n 'outputs': {\n 'color': {\n 'parameters': {\n 'width': 'expr(width * 1.0)',\n 'height': 'expr(height * 1.0)'\n }\n }\n },\n 'defines': {\n // Images are all premultiplied alpha before composite because of blending.\n // 'PREMULTIPLY_ALPHA': null,\n // 'DEBUG': 2\n }\n },\n {\n 'name' : 'FXAA',\n 'shader' : '#source(clay.compositor.fxaa)',\n 'inputs' : {\n 'texture' : 'composite'\n }\n }\n ]\n};","export default \"@export ecgl.dof.coc\\n\\nuniform sampler2D depth;\\n\\nuniform float zNear: 0.1;\\nuniform float zFar: 2000;\\n\\nuniform float focalDistance: 3;\\nuniform float focalRange: 1;\\nuniform float focalLength: 30;\\nuniform float fstop: 2.8;\\n\\nvarying vec2 v_Texcoord;\\n\\n@import clay.util.encode_float\\n\\nvoid main()\\n{\\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\\n\\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\\n\\n float aperture = focalLength / fstop;\\n\\n float coc;\\n\\n float uppper = focalDistance + focalRange;\\n float lower = focalDistance - focalRange;\\n if (dist <= uppper && dist >= lower) {\\n coc = 0.5;\\n }\\n else {\\n float focalAdjusted = dist > uppper ? uppper : lower;\\n\\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\\n\\n if (dist < lower) {\\n coc = -coc;\\n }\\n coc = coc * 0.5 + 0.5;\\n }\\n\\n gl_FragColor = encodeFloat(coc);\\n}\\n@end\\n\\n\\n@export ecgl.dof.composite\\n\\n#define DEBUG 0\\n\\nuniform sampler2D original;\\nuniform sampler2D blurred;\\nuniform sampler2D nearfield;\\nuniform sampler2D coc;\\nuniform sampler2D nearcoc;\\nvarying vec2 v_Texcoord;\\n\\n@import clay.util.rgbm\\n@import clay.util.float\\n\\nvoid main()\\n{\\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\\n vec4 originalColor = texture2D(original, v_Texcoord);\\n\\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\\n\\n fCoc = abs(fCoc * 2.0 - 1.0);\\n\\n float weight = smoothstep(0.0, 1.0, fCoc);\\n \\n#ifdef NEARFIELD_ENABLED\\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\\n\\n gl_FragColor = encodeHDR(\\n mix(\\n nearfieldColor, mix(originalColor, blurredColor, weight),\\n pow(1.0 - fNearCoc, 4.0)\\n )\\n );\\n#else\\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\\n#endif\\n\\n}\\n\\n@end\\n\\n\\n\\n@export ecgl.dof.diskBlur\\n\\n#define POISSON_KERNEL_SIZE 16;\\n\\nuniform sampler2D texture;\\nuniform sampler2D coc;\\nvarying vec2 v_Texcoord;\\n\\nuniform float blurRadius : 10.0;\\nuniform vec2 textureSize : [512.0, 512.0];\\n\\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\\n\\nuniform float percent;\\n\\nfloat nrand(const in vec2 n) {\\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\\n}\\n\\n@import clay.util.rgbm\\n@import clay.util.float\\n\\n\\nvoid main()\\n{\\n vec2 offset = blurRadius / textureSize;\\n\\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\\n float cosa = cos(rnd);\\n float sina = sin(rnd);\\n vec4 basis = vec4(cosa, -sina, sina, cosa);\\n\\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\\n#endif\\n\\n#ifdef BLUR_COC\\n float cocSum = 0.0;\\n#else\\n vec4 color = vec4(0.0);\\n#endif\\n\\n\\n float weightSum = 0.0;\\n\\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\\n vec2 ofs = poissonKernel[i];\\n\\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\\n\\n vec2 uv = v_Texcoord + ofs * offset;\\n vec4 texel = texture2D(texture, uv);\\n\\n float w = 1.0;\\n#ifdef BLUR_COC\\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\\n#else\\n texel = texel;\\n #if !defined(BLUR_NEARFIELD)\\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\\n w *= abs(fCoc);\\n #endif\\n texel.rgb *= texel.a;\\n color += texel * w;\\n#endif\\n\\n weightSum += w;\\n }\\n\\n#ifdef BLUR_COC\\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\\n#else\\n color /= weightSum;\\n color.rgb /= (color.a + 0.0001);\\n gl_FragColor = color;\\n#endif\\n}\\n\\n@end\";\n","export default \"@export ecgl.edge\\n\\nuniform sampler2D texture;\\n\\nuniform sampler2D normalTexture;\\nuniform sampler2D depthTexture;\\n\\nuniform mat4 projectionInv;\\n\\nuniform vec2 textureSize;\\n\\nuniform vec4 edgeColor: [0,0,0,0.8];\\n\\nvarying vec2 v_Texcoord;\\n\\nvec3 packColor(vec2 coord) {\\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\\n vec4 p4 = projectionInv * p;\\n\\n return vec3(\\n texture2D(normalTexture, coord).rg,\\n -p4.z / p4.w / 5.0\\n );\\n}\\n\\nvoid main() {\\n vec2 cc = v_Texcoord;\\n vec3 center = packColor(cc);\\n\\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\\n float dx = size / textureSize.x;\\n float dy = size / textureSize.y;\\n\\n vec2 coord;\\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\\n vec3 top = packColor(cc+vec2(0.0, -dy));\\n vec3 topRight = packColor(cc+vec2(dx, -dy));\\n vec3 left = packColor(cc+vec2(-dx, 0.0));\\n vec3 right = packColor(cc+vec2(dx, 0.0));\\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\\n vec3 bottom = packColor(cc+vec2(0.0, dy));\\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\\n\\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\\n\\n float edge = sqrt(dot(h, h) + dot(v, v));\\n\\n edge = smoothstep(0.8, 1.0, edge);\\n\\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\\n}\\n@end\";\n","import Shader from 'claygl/src/Shader';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport createCompositor from 'claygl/src/compositor/createCompositor';\nimport SSAOPass from './SSAOPass';\nimport SSRPass from './SSRPass';\nimport poissonKernel from './poissonKernel';\nimport graphicGL from '../util/graphicGL';\nimport NormalPass from './NormalPass';\nimport EdgePass from './EdgePass';\n\nimport effectJson from './composite.js';\n\nimport blurCode from 'claygl/src/shader/source/compositor/blur.glsl.js';\nimport lutCode from 'claygl/src/shader/source/compositor/lut.glsl.js';\nimport outputCode from 'claygl/src/shader/source/compositor/output.glsl.js';\nimport brightCode from 'claygl/src/shader/source/compositor/bright.glsl.js';\nimport downsampleCode from 'claygl/src/shader/source/compositor/downsample.glsl.js';\nimport upsampleCode from 'claygl/src/shader/source/compositor/upsample.glsl.js';\nimport hdrCode from 'claygl/src/shader/source/compositor/hdr.glsl.js';\nimport blendCode from 'claygl/src/shader/source/compositor/blend.glsl.js';\nimport fxaaCode from 'claygl/src/shader/source/compositor/fxaa.glsl.js';\nimport DOFCode from './DOF.glsl.js';\nimport edgeCode from './edge.glsl.js';\n\nShader['import'](blurCode);\nShader['import'](lutCode);\nShader['import'](outputCode);\nShader['import'](brightCode);\nShader['import'](downsampleCode);\nShader['import'](upsampleCode);\nShader['import'](hdrCode);\nShader['import'](blendCode);\nShader['import'](fxaaCode);\nShader['import'](DOFCode);\nShader['import'](edgeCode);\n\n\nfunction makeCommonOutputs(getWidth, getHeight) {\n return {\n color: {\n parameters: {\n width: getWidth,\n height: getHeight\n }\n }\n };\n}\n\nvar FINAL_NODES_CHAIN = ['composite', 'FXAA'];\n\nfunction EffectCompositor() {\n this._width;\n this._height;\n this._dpr;\n\n\n this._sourceTexture = new Texture2D({\n type: Texture.HALF_FLOAT\n });\n this._depthTexture = new Texture2D({\n format: Texture.DEPTH_COMPONENT,\n type: Texture.UNSIGNED_INT\n });\n\n this._framebuffer = new FrameBuffer();\n this._framebuffer.attach(this._sourceTexture);\n this._framebuffer.attach(this._depthTexture, FrameBuffer.DEPTH_ATTACHMENT);\n\n this._normalPass = new NormalPass();\n\n this._compositor = createCompositor(effectJson);\n\n var sourceNode = this._compositor.getNodeByName('source');\n sourceNode.texture = this._sourceTexture;\n var cocNode = this._compositor.getNodeByName('coc');\n\n this._sourceNode = sourceNode;\n this._cocNode = cocNode;\n this._compositeNode = this._compositor.getNodeByName('composite');\n this._fxaaNode = this._compositor.getNodeByName('FXAA');\n\n this._dofBlurNodes = ['dof_far_blur', 'dof_near_blur', 'dof_coc_blur'].map(function (name) {\n return this._compositor.getNodeByName(name);\n }, this);\n\n this._dofBlurKernel = 0;\n this._dofBlurKernelSize = new Float32Array(0);\n\n this._finalNodesChain = FINAL_NODES_CHAIN.map(function (name) {\n return this._compositor.getNodeByName(name);\n }, this);\n\n var gBufferObj = {\n normalTexture: this._normalPass.getNormalTexture(),\n depthTexture: this._normalPass.getDepthTexture()\n };\n this._ssaoPass = new SSAOPass(gBufferObj);\n this._ssrPass = new SSRPass(gBufferObj);\n this._edgePass = new EdgePass(gBufferObj);\n}\n\nEffectCompositor.prototype.resize = function (width, height, dpr) {\n dpr = dpr || 1;\n var width = width * dpr;\n var height = height * dpr;\n var sourceTexture = this._sourceTexture;\n var depthTexture = this._depthTexture;\n\n sourceTexture.width = width;\n sourceTexture.height = height;\n depthTexture.width = width;\n depthTexture.height = height;\n\n var rendererMock = {\n getWidth: function () {\n return width;\n },\n getHeight: function () {\n return height;\n },\n getDevicePixelRatio: function () {\n return dpr;\n }\n };\n function wrapCallback(obj, key) {\n if (typeof obj[key] === 'function') {\n var oldFunc = obj[key].__original || obj[key];\n // Use viewport width/height instead of renderer width/height\n obj[key] = function (renderer) {\n return oldFunc.call(this, rendererMock);\n };\n obj[key].__original = oldFunc;\n }\n }\n this._compositor.nodes.forEach(function (node) {\n for (var outKey in node.outputs) {\n var parameters = node.outputs[outKey].parameters;\n if (parameters) {\n wrapCallback(parameters, 'width');\n wrapCallback(parameters, 'height');\n }\n }\n for (var paramKey in node.parameters) {\n wrapCallback(node.parameters, paramKey);\n }\n });\n\n this._width = width;\n this._height = height;\n this._dpr = dpr;\n};\n\nEffectCompositor.prototype.getWidth = function () {\n return this._width;\n};\nEffectCompositor.prototype.getHeight = function () {\n return this._height;\n};\n\nEffectCompositor.prototype._ifRenderNormalPass = function () {\n return this._enableSSAO || this._enableEdge || this._enableSSR;\n};\n\nEffectCompositor.prototype._getPrevNode = function (node) {\n var idx = FINAL_NODES_CHAIN.indexOf(node.name) - 1;\n var prevNode = this._finalNodesChain[idx];\n while (prevNode && !this._compositor.getNodeByName(prevNode.name)) {\n idx -= 1;\n prevNode = this._finalNodesChain[idx];\n }\n return prevNode;\n};\nEffectCompositor.prototype._getNextNode = function (node) {\n var idx = FINAL_NODES_CHAIN.indexOf(node.name) + 1;\n var nextNode = this._finalNodesChain[idx];\n while (nextNode && !this._compositor.getNodeByName(nextNode.name)) {\n idx += 1;\n nextNode = this._finalNodesChain[idx];\n }\n return nextNode;\n};\nEffectCompositor.prototype._addChainNode = function (node) {\n var prevNode = this._getPrevNode(node);\n var nextNode = this._getNextNode(node);\n if (!prevNode) {\n return;\n }\n\n node.inputs.texture = prevNode.name;\n if (nextNode) {\n node.outputs = makeCommonOutputs(this.getWidth.bind(this), this.getHeight.bind(this));\n nextNode.inputs.texture = node.name;\n }\n else {\n node.outputs = null;\n }\n this._compositor.addNode(node);\n};\nEffectCompositor.prototype._removeChainNode = function (node) {\n var prevNode = this._getPrevNode(node);\n var nextNode = this._getNextNode(node);\n if (!prevNode) {\n return;\n }\n\n if (nextNode) {\n prevNode.outputs = makeCommonOutputs(this.getWidth.bind(this), this.getHeight.bind(this));\n nextNode.inputs.texture = prevNode.name;\n }\n else {\n prevNode.outputs = null;\n }\n this._compositor.removeNode(node);\n};\n/**\n * Update normal\n */\nEffectCompositor.prototype.updateNormal = function (renderer, scene, camera, frame) {\n if (this._ifRenderNormalPass()) {\n this._normalPass.update(renderer, scene, camera);\n }\n};\n\n/**\n * Render SSAO after render the scene, before compositing\n */\nEffectCompositor.prototype.updateSSAO = function (renderer, scene, camera, frame) {\n this._ssaoPass.update(renderer, camera, frame);\n};\n\n/**\n * Enable SSAO effect\n */\nEffectCompositor.prototype.enableSSAO = function () {\n this._enableSSAO = true;\n};\n\n/**\n * Disable SSAO effect\n */\nEffectCompositor.prototype.disableSSAO = function () {\n this._enableSSAO = false;\n};\n\n/**\n * Enable SSR effect\n */\nEffectCompositor.prototype.enableSSR = function () {\n this._enableSSR = true;\n // this._normalPass.enableTargetTexture3 = true;\n};\n/**\n * Disable SSR effect\n */\nEffectCompositor.prototype.disableSSR = function () {\n this._enableSSR = false;\n // this._normalPass.enableTargetTexture3 = false;\n};\n\n/**\n * Render SSAO after render the scene, before compositing\n */\nEffectCompositor.prototype.getSSAOTexture = function () {\n return this._ssaoPass.getTargetTexture();\n};\n\n/**\n * @return {clay.FrameBuffer}\n */\nEffectCompositor.prototype.getSourceFrameBuffer = function () {\n return this._framebuffer;\n};\n\n/**\n * @return {clay.Texture2D}\n */\nEffectCompositor.prototype.getSourceTexture = function () {\n return this._sourceTexture;\n};\n\n/**\n * Disable fxaa effect\n */\nEffectCompositor.prototype.disableFXAA = function () {\n this._removeChainNode(this._fxaaNode);\n};\n\n/**\n * Enable fxaa effect\n */\nEffectCompositor.prototype.enableFXAA = function () {\n this._addChainNode(this._fxaaNode);\n};\n\n/**\n * Enable bloom effect\n */\nEffectCompositor.prototype.enableBloom = function () {\n this._compositeNode.inputs.bloom = 'bloom_composite';\n this._compositor.dirty();\n};\n\n/**\n * Disable bloom effect\n */\nEffectCompositor.prototype.disableBloom = function () {\n this._compositeNode.inputs.bloom = null;\n this._compositor.dirty();\n};\n\n/**\n * Enable depth of field effect\n */\nEffectCompositor.prototype.enableDOF = function () {\n this._compositeNode.inputs.texture = 'dof_composite';\n this._compositor.dirty();\n};\n/**\n * Disable depth of field effect\n */\nEffectCompositor.prototype.disableDOF = function () {\n this._compositeNode.inputs.texture = 'source';\n this._compositor.dirty();\n};\n\n/**\n * Enable color correction\n */\nEffectCompositor.prototype.enableColorCorrection = function () {\n this._compositeNode.define('COLOR_CORRECTION');\n this._enableColorCorrection = true;\n};\n/**\n * Disable color correction\n */\nEffectCompositor.prototype.disableColorCorrection = function () {\n this._compositeNode.undefine('COLOR_CORRECTION');\n this._enableColorCorrection = false;\n};\n\n/**\n * Enable edge detection\n */\nEffectCompositor.prototype.enableEdge = function () {\n this._enableEdge = true;\n};\n\n/**\n * Disable edge detection\n */\nEffectCompositor.prototype.disableEdge = function () {\n this._enableEdge = false;\n};\n\n/**\n * Set bloom intensity\n * @param {number} value\n */\nEffectCompositor.prototype.setBloomIntensity = function (value) {\n this._compositeNode.setParameter('bloomIntensity', value);\n};\n\nEffectCompositor.prototype.setSSAOParameter = function (name, value) {\n switch (name) {\n case 'quality':\n // PENDING\n var kernelSize = ({\n low: 6,\n medium: 12,\n high: 32,\n ultra: 62\n })[value] || 12;\n this._ssaoPass.setParameter('kernelSize', kernelSize);\n break;\n case 'radius':\n this._ssaoPass.setParameter(name, value);\n this._ssaoPass.setParameter('bias', value / 200);\n break;\n case 'intensity':\n this._ssaoPass.setParameter(name, value);\n break;\n default:\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown SSAO parameter ' + name);\n }\n }\n};\n\nEffectCompositor.prototype.setDOFParameter = function (name, value) {\n switch (name) {\n case 'focalDistance':\n case 'focalRange':\n case 'fstop':\n this._cocNode.setParameter(name, value);\n break;\n case 'blurRadius':\n for (var i = 0; i < this._dofBlurNodes.length; i++) {\n this._dofBlurNodes[i].setParameter('blurRadius', value);\n }\n break;\n case 'quality':\n var kernelSize = ({\n low: 4, medium: 8, high: 16, ultra: 32\n })[value] || 8;\n this._dofBlurKernelSize = kernelSize;\n for (var i = 0; i < this._dofBlurNodes.length; i++) {\n this._dofBlurNodes[i].pass.material.define('POISSON_KERNEL_SIZE', kernelSize);\n }\n this._dofBlurKernel = new Float32Array(kernelSize * 2);\n break;\n default:\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown DOF parameter ' + name);\n }\n }\n};\n\nEffectCompositor.prototype.setSSRParameter = function (name, value) {\n if (value == null) {\n return;\n }\n switch (name) {\n case 'quality':\n // PENDING\n var maxIteration = ({\n low: 10,\n medium: 15,\n high: 30,\n ultra: 80\n })[value] || 20;\n var pixelStride = ({\n low: 32,\n medium: 16,\n high: 8,\n ultra: 4\n })[value] || 16;\n this._ssrPass.setParameter('maxIteration', maxIteration);\n this._ssrPass.setParameter('pixelStride', pixelStride);\n break;\n case 'maxRoughness':\n this._ssrPass.setParameter('minGlossiness', Math.max(Math.min(1.0 - value, 1.0), 0.0));\n break;\n case 'physical':\n this.setPhysicallyCorrectSSR(value);\n break;\n default:\n console.warn('Unkown SSR parameter ' + name);\n }\n};\n\nEffectCompositor.prototype.setPhysicallyCorrectSSR = function (physical) {\n this._ssrPass.setPhysicallyCorrect(physical);\n};\n\n/**\n * Set color of edge\n */\nEffectCompositor.prototype.setEdgeColor = function (value) {\n var color = graphicGL.parseColor(value);\n this._edgePass.setParameter('edgeColor', color);\n};\n\nEffectCompositor.prototype.setExposure = function (value) {\n this._compositeNode.setParameter('exposure', Math.pow(2, value));\n};\n\nEffectCompositor.prototype.setColorLookupTexture = function (image, api) {\n this._compositeNode.pass.material.setTextureImage('lut', this._enableColorCorrection ? image : 'none', api, {\n minFilter: graphicGL.Texture.NEAREST,\n magFilter: graphicGL.Texture.NEAREST,\n flipY: false\n });\n};\nEffectCompositor.prototype.setColorCorrection = function (type, value) {\n this._compositeNode.setParameter(type, value);\n};\n\nEffectCompositor.prototype.isSSREnabled = function () {\n return this._enableSSR;\n};\n\nEffectCompositor.prototype.composite = function (renderer, scene, camera, framebuffer, frame) {\n\n var sourceTexture = this._sourceTexture;\n var targetTexture = sourceTexture;\n if (this._enableEdge) {\n this._edgePass.update(renderer, camera, sourceTexture, frame);\n sourceTexture = targetTexture = this._edgePass.getTargetTexture();\n }\n if (this._enableSSR) {\n this._ssrPass.update(renderer, camera, sourceTexture, frame);\n targetTexture = this._ssrPass.getTargetTexture();\n\n this._ssrPass.setSSAOTexture(\n this._enableSSAO ? this._ssaoPass.getTargetTexture() : null\n );\n // var lights = scene.getLights();\n // for (var i = 0; i < lights.length; i++) {\n // if (lights[i].cubemap) {\n // this._ssrPass.setAmbientCubemap(lights[i].cubemap, lights[i].intensity);\n // }\n // }\n }\n this._sourceNode.texture = targetTexture;\n\n this._cocNode.setParameter('depth', this._depthTexture);\n\n var blurKernel = this._dofBlurKernel;\n var blurKernelSize = this._dofBlurKernelSize;\n var frameAll = Math.floor(poissonKernel.length / 2 / blurKernelSize);\n var kernelOffset = frame % frameAll;\n\n for (var i = 0; i < blurKernelSize * 2; i++) {\n blurKernel[i] = poissonKernel[i + kernelOffset * blurKernelSize * 2];\n }\n\n for (var i = 0; i < this._dofBlurNodes.length; i++) {\n this._dofBlurNodes[i].setParameter('percent', frame / 30.0);\n this._dofBlurNodes[i].setParameter('poissonKernel', blurKernel);\n }\n\n this._cocNode.setParameter('zNear', camera.near);\n this._cocNode.setParameter('zFar', camera.far);\n\n this._compositor.render(renderer, framebuffer);\n};\n\nEffectCompositor.prototype.dispose = function (renderer) {\n this._sourceTexture.dispose(renderer);\n this._depthTexture.dispose(renderer);\n this._framebuffer.dispose(renderer);\n this._compositor.dispose(renderer);\n\n this._normalPass.dispose(renderer);\n this._ssaoPass.dispose(renderer);\n};\n\nexport default EffectCompositor;","// Temporal Super Sample for static Scene\nimport halton from './halton';\nimport Pass from 'claygl/src/compositor/Pass';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Shader from 'claygl/src/Shader';\nimport Matrix4 from 'claygl/src/math/Matrix4';\n\nfunction TemporalSuperSampling (frames) {\n var haltonSequence = [];\n\n for (var i = 0; i < 30; i++) {\n haltonSequence.push([halton(i, 2), halton(i, 3)]);\n }\n\n this._haltonSequence = haltonSequence;\n\n this._frame = 0;\n\n this._sourceTex = new Texture2D();\n this._sourceFb = new FrameBuffer();\n this._sourceFb.attach(this._sourceTex);\n\n // Frame texture before temporal supersampling\n this._prevFrameTex = new Texture2D();\n this._outputTex = new Texture2D();\n\n var blendPass = this._blendPass = new Pass({\n fragment: Shader.source('clay.compositor.blend')\n });\n blendPass.material.disableTexturesAll();\n blendPass.material.enableTexture(['texture1', 'texture2']);\n\n this._blendFb = new FrameBuffer({\n depthBuffer: false\n });\n\n this._outputPass = new Pass({\n fragment: Shader.source('clay.compositor.output'),\n // TODO, alpha is premultiplied?\n blendWithPrevious: true\n });\n this._outputPass.material.define('fragment', 'OUTPUT_ALPHA');\n this._outputPass.material.blend = function (_gl) {\n // FIXME.\n // Output is premultiplied alpha when BLEND is enabled ?\n // http://stackoverflow.com/questions/2171085/opengl-blending-with-previous-contents-of-framebuffer\n _gl.blendEquationSeparate(_gl.FUNC_ADD, _gl.FUNC_ADD);\n _gl.blendFuncSeparate(_gl.ONE, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA);\n };\n}\n\nTemporalSuperSampling.prototype = {\n\n constructor: TemporalSuperSampling,\n\n /**\n * Jitter camera projectionMatrix\n * @parma {clay.Renderer} renderer\n * @param {clay.Camera} camera\n */\n jitterProjection: function (renderer, camera) {\n var viewport = renderer.viewport;\n var dpr = viewport.devicePixelRatio || renderer.getDevicePixelRatio();\n var width = viewport.width * dpr;\n var height = viewport.height * dpr;\n\n var offset = this._haltonSequence[this._frame % this._haltonSequence.length];\n\n var translationMat = new Matrix4();\n translationMat.array[12] = (offset[0] * 2.0 - 1.0) / width;\n translationMat.array[13] = (offset[1] * 2.0 - 1.0) / height;\n\n Matrix4.mul(camera.projectionMatrix, translationMat, camera.projectionMatrix);\n\n Matrix4.invert(camera.invProjectionMatrix, camera.projectionMatrix);\n },\n\n /**\n * Reset accumulating frame\n */\n resetFrame: function () {\n this._frame = 0;\n },\n\n /**\n * Return current frame\n */\n getFrame: function () {\n return this._frame;\n },\n\n /**\n * Get source framebuffer for usage\n */\n getSourceFrameBuffer: function () {\n return this._sourceFb;\n },\n\n getOutputTexture: function () {\n return this._outputTex;\n },\n\n resize: function (width, height) {\n this._prevFrameTex.width = width;\n this._prevFrameTex.height = height;\n\n this._outputTex.width = width;\n this._outputTex.height = height;\n\n this._sourceTex.width = width;\n this._sourceTex.height = height;\n\n this._prevFrameTex.dirty();\n this._outputTex.dirty();\n this._sourceTex.dirty();\n },\n\n isFinished: function () {\n return this._frame >= this._haltonSequence.length;\n },\n\n render: function (renderer, sourceTex, notOutput) {\n var blendPass = this._blendPass;\n if (this._frame === 0) {\n // Direct output\n blendPass.setUniform('weight1', 0);\n blendPass.setUniform('weight2', 1);\n }\n else {\n blendPass.setUniform('weight1', 0.9);\n blendPass.setUniform('weight2', 0.1);\n }\n blendPass.setUniform('texture1', this._prevFrameTex);\n blendPass.setUniform('texture2', sourceTex || this._sourceTex);\n\n this._blendFb.attach(this._outputTex);\n this._blendFb.bind(renderer);\n blendPass.render(renderer);\n this._blendFb.unbind(renderer);\n\n if (!notOutput) {\n this._outputPass.setUniform('texture', this._outputTex);\n this._outputPass.render(renderer);\n }\n\n // Swap texture\n var tmp = this._prevFrameTex;\n this._prevFrameTex = this._outputTex;\n this._outputTex = tmp;\n\n this._frame++;\n },\n\n dispose: function (renderer) {\n this._sourceFb.dispose(renderer);\n this._blendFb.dispose(renderer);\n this._prevFrameTex.dispose(renderer);\n this._outputTex.dispose(renderer);\n this._sourceTex.dispose(renderer);\n this._outputPass.dispose(renderer);\n this._blendPass.dispose(renderer);\n }\n};\n\nexport default TemporalSuperSampling;","/*\n * @module echarts-gl/core/ViewGL\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport * as echarts from 'echarts/lib/echarts';\n\nimport Scene from 'claygl/src/Scene';\nimport ShadowMapPass from 'claygl/src/prePass/ShadowMap';\nimport PerspectiveCamera from 'claygl/src/camera/Perspective';\nimport OrthographicCamera from 'claygl/src/camera/Orthographic';\nimport Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport Vector2 from 'claygl/src/math/Vector2';\n\nimport notifier from 'claygl/src/core/mixin/notifier';\n\nimport EffectCompositor from '../effect/EffectCompositor';\nimport TemporalSuperSampling from '../effect/TemporalSuperSampling';\nimport halton from '../effect/halton';\n\n/**\n * @constructor\n * @alias module:echarts-gl/core/ViewGL\n * @param {string} [projection='perspective']\n */\nfunction ViewGL(projection) {\n\n projection = projection || 'perspective';\n\n /**\n * @type {module:echarts-gl/core/LayerGL}\n */\n this.layer = null;\n /**\n * @type {clay.Scene}\n */\n this.scene = new Scene();\n\n /**\n * @type {clay.Node}\n */\n this.rootNode = this.scene;\n\n this.viewport = {\n x: 0, y: 0, width: 0, height: 0\n };\n\n this.setProjection(projection);\n\n this._compositor = new EffectCompositor();\n\n this._temporalSS = new TemporalSuperSampling();\n\n this._shadowMapPass = new ShadowMapPass();\n\n var pcfKernels = [];\n var off = 0;\n for (var i = 0; i < 30; i++) {\n var pcfKernel = [];\n for (var k = 0; k < 6; k++) {\n pcfKernel.push(halton(off, 2) * 4.0 - 2.0);\n pcfKernel.push(halton(off, 3) * 4.0 - 2.0);\n off++;\n }\n pcfKernels.push(pcfKernel);\n }\n this._pcfKernels = pcfKernels;\n\n this.scene.on('beforerender', function (renderer, scene, camera) {\n if (this.needsTemporalSS()) {\n this._temporalSS.jitterProjection(renderer, camera);\n }\n }, this);\n}\n\n/**\n * Set camera type of group\n * @param {string} cameraType 'perspective' | 'orthographic'\n */\nViewGL.prototype.setProjection = function (projection) {\n var oldCamera = this.camera;\n oldCamera && oldCamera.update();\n if (projection === 'perspective') {\n if (!(this.camera instanceof PerspectiveCamera)) {\n this.camera = new PerspectiveCamera();\n if (oldCamera) {\n this.camera.setLocalTransform(oldCamera.localTransform);\n }\n }\n }\n else {\n if (!(this.camera instanceof OrthographicCamera)) {\n this.camera = new OrthographicCamera();\n if (oldCamera) {\n this.camera.setLocalTransform(oldCamera.localTransform);\n }\n }\n }\n // PENDING\n this.camera.near = 0.1;\n this.camera.far = 2000;\n};\n\n/**\n * Set viewport of group\n * @param {number} x Viewport left bottom x\n * @param {number} y Viewport left bottom y\n * @param {number} width Viewport height\n * @param {number} height Viewport height\n * @param {number} [dpr=1]\n */\nViewGL.prototype.setViewport = function (x, y, width, height, dpr) {\n if (this.camera instanceof PerspectiveCamera) {\n this.camera.aspect = width / height;\n }\n dpr = dpr || 1;\n\n this.viewport.x = x;\n this.viewport.y = y;\n this.viewport.width = width;\n this.viewport.height = height;\n this.viewport.devicePixelRatio = dpr;\n\n // Source and output of compositor use high dpr texture.\n // But the intermediate texture of bloom, dof effects use fixed 1.0 dpr\n this._compositor.resize(width * dpr, height * dpr);\n this._temporalSS.resize(width * dpr, height * dpr);\n};\n\n/**\n * If contain screen point x, y\n * @param {number} x offsetX\n * @param {number} y offsetY\n * @return {boolean}\n */\nViewGL.prototype.containPoint = function (x, y) {\n var viewport = this.viewport;\n var height = this.layer.renderer.getHeight();\n // Flip y;\n y = height - y;\n return x >= viewport.x && y >= viewport.y\n && x <= viewport.x + viewport.width && y <= viewport.y + viewport.height;\n};\n\n/**\n * Cast a ray\n * @param {number} x offsetX\n * @param {number} y offsetY\n * @param {clay.math.Ray} out\n * @return {clay.math.Ray}\n */\nvar ndc = new Vector2();\nViewGL.prototype.castRay = function (x, y, out) {\n var renderer = this.layer.renderer;\n\n var oldViewport = renderer.viewport;\n renderer.viewport = this.viewport;\n renderer.screenToNDC(x, y, ndc);\n this.camera.castRay(ndc, out);\n renderer.viewport = oldViewport;\n\n return out;\n};\n\n/**\n * Prepare and update scene before render\n */\nViewGL.prototype.prepareRender = function () {\n this.scene.update();\n this.camera.update();\n this.scene.updateLights();\n var renderList = this.scene.updateRenderList(this.camera);\n\n this._needsSortProgressively = false;\n // If has any transparent mesh needs sort triangles progressively.\n for (var i = 0; i < renderList.transparent.length; i++) {\n var renderable = renderList.transparent[i];\n var geometry = renderable.geometry;\n if (geometry.needsSortVerticesProgressively && geometry.needsSortVerticesProgressively()) {\n this._needsSortProgressively = true;\n }\n if (geometry.needsSortTrianglesProgressively && geometry.needsSortTrianglesProgressively()) {\n this._needsSortProgressively = true;\n }\n }\n\n this._frame = 0;\n this._temporalSS.resetFrame();\n\n // var lights = this.scene.getLights();\n // for (var i = 0; i < lights.length; i++) {\n // if (lights[i].cubemap) {\n // if (this._compositor && this._compositor.isSSREnabled()) {\n // lights[i].invisible = true;\n // }\n // else {\n // lights[i].invisible = false;\n // }\n // }\n // }\n};\n\nViewGL.prototype.render = function (renderer, accumulating) {\n this._doRender(renderer, accumulating, this._frame);\n this._frame++;\n};\n\nViewGL.prototype.needsAccumulate = function () {\n return this.needsTemporalSS() || this._needsSortProgressively;\n};\n\nViewGL.prototype.needsTemporalSS = function () {\n var enableTemporalSS = this._enableTemporalSS;\n if (enableTemporalSS === 'auto') {\n enableTemporalSS = this._enablePostEffect;\n }\n return enableTemporalSS;\n};\n\nViewGL.prototype.hasDOF = function () {\n return this._enableDOF;\n};\n\nViewGL.prototype.isAccumulateFinished = function () {\n return this.needsTemporalSS() ? this._temporalSS.isFinished()\n : (this._frame > 30);\n};\n\nViewGL.prototype._doRender = function (renderer, accumulating, accumFrame) {\n\n var scene = this.scene;\n var camera = this.camera;\n\n accumFrame = accumFrame || 0;\n\n this._updateTransparent(renderer, scene, camera, accumFrame);\n\n if (!accumulating) {\n this._shadowMapPass.kernelPCF = this._pcfKernels[0];\n // Not render shadowmap pass in accumulating frame.\n this._shadowMapPass.render(renderer, scene, camera, true);\n }\n\n this._updateShadowPCFKernel(accumFrame);\n\n // Shadowmap will set clear color.\n var bgColor = renderer.clearColor;\n renderer.gl.clearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]);\n\n if (this._enablePostEffect) {\n // normal render also needs to be jittered when have edge pass.\n if (this.needsTemporalSS()) {\n this._temporalSS.jitterProjection(renderer, camera);\n }\n this._compositor.updateNormal(renderer, scene, camera, this._temporalSS.getFrame());\n }\n\n // Always update SSAO to make sure have correct ssaoMap status\n this._updateSSAO(renderer, scene, camera, this._temporalSS.getFrame());\n\n if (this._enablePostEffect) {\n\n var frameBuffer = this._compositor.getSourceFrameBuffer();\n frameBuffer.bind(renderer);\n renderer.gl.clear(renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT);\n renderer.render(scene, camera, true, true);\n frameBuffer.unbind(renderer);\n\n if (this.needsTemporalSS() && accumulating) {\n this._compositor.composite(renderer, scene, camera, this._temporalSS.getSourceFrameBuffer(), this._temporalSS.getFrame());\n renderer.setViewport(this.viewport);\n this._temporalSS.render(renderer);\n }\n else {\n renderer.setViewport(this.viewport);\n this._compositor.composite(renderer, scene, camera, null, 0);\n }\n }\n else {\n if (this.needsTemporalSS() && accumulating) {\n var frameBuffer = this._temporalSS.getSourceFrameBuffer();\n frameBuffer.bind(renderer);\n renderer.saveClear();\n renderer.clearBit = renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT;\n renderer.render(scene, camera, true, true);\n renderer.restoreClear();\n frameBuffer.unbind(renderer);\n\n renderer.setViewport(this.viewport);\n this._temporalSS.render(renderer);\n }\n else {\n renderer.setViewport(this.viewport);\n renderer.render(scene, camera, true, true);\n }\n }\n\n // this._shadowMapPass.renderDebug(renderer);\n // this._compositor._normalPass.renderDebug(renderer);\n};\n\nViewGL.prototype._updateTransparent = function (renderer, scene, camera, frame) {\n\n var v3 = new Vector3();\n var invWorldTransform = new Matrix4();\n var cameraWorldPosition = camera.getWorldPosition();\n var transparentList = scene.getRenderList(camera).transparent;\n\n // Sort transparent object.\n for (var i = 0; i < transparentList.length; i++) {\n var renderable = transparentList[i];\n var geometry = renderable.geometry;\n Matrix4.invert(invWorldTransform, renderable.worldTransform);\n Vector3.transformMat4(v3, cameraWorldPosition, invWorldTransform);\n if (geometry.needsSortTriangles && geometry.needsSortTriangles()) {\n geometry.doSortTriangles(v3, frame);\n }\n if (geometry.needsSortVertices && geometry.needsSortVertices()) {\n geometry.doSortVertices(v3, frame);\n }\n }\n};\n\nViewGL.prototype._updateSSAO = function (renderer, scene, camera) {\n var ifEnableSSAO = this._enableSSAO && this._enablePostEffect;\n if (ifEnableSSAO) {\n this._compositor.updateSSAO(renderer, scene, camera, this._temporalSS.getFrame());\n }\n var renderList = scene.getRenderList(camera);\n\n for (var i = 0; i < renderList.opaque.length; i++) {\n var renderable = renderList.opaque[i];\n // PENDING\n if (renderable.renderNormal) {\n renderable.material[ifEnableSSAO ? 'enableTexture' : 'disableTexture']('ssaoMap');\n }\n if (ifEnableSSAO) {\n renderable.material.set('ssaoMap', this._compositor.getSSAOTexture());\n }\n }\n};\n\nViewGL.prototype._updateShadowPCFKernel = function (frame) {\n var pcfKernel = this._pcfKernels[frame % this._pcfKernels.length];\n var renderList = this.scene.getRenderList(this.camera);\n var opaqueList = renderList.opaque;\n for (var i = 0; i < opaqueList.length; i++) {\n if (opaqueList[i].receiveShadow) {\n opaqueList[i].material.set('pcfKernel', pcfKernel);\n opaqueList[i].material.define('fragment', 'PCF_KERNEL_SIZE', pcfKernel.length / 2);\n }\n }\n};\n\nViewGL.prototype.dispose = function (renderer) {\n this._compositor.dispose(renderer.gl);\n this._temporalSS.dispose(renderer.gl);\n this._shadowMapPass.dispose(renderer);\n};\n/**\n * @param {module:echarts/Model} Post effect model\n */\nViewGL.prototype.setPostEffect = function (postEffectModel, api) {\n var compositor = this._compositor;\n this._enablePostEffect = postEffectModel.get('enable');\n var bloomModel = postEffectModel.getModel('bloom');\n var edgeModel = postEffectModel.getModel('edge');\n var dofModel = postEffectModel.getModel('DOF', postEffectModel.getModel('depthOfField'));\n var ssaoModel = postEffectModel.getModel('SSAO', postEffectModel.getModel('screenSpaceAmbientOcclusion'));\n var ssrModel = postEffectModel.getModel('SSR', postEffectModel.getModel('screenSpaceReflection'));\n var fxaaModel = postEffectModel.getModel('FXAA');\n var colorCorrModel = postEffectModel.getModel('colorCorrection');\n bloomModel.get('enable') ? compositor.enableBloom() : compositor.disableBloom();\n dofModel.get('enable') ? compositor.enableDOF() : compositor.disableDOF();\n ssrModel.get('enable') ? compositor.enableSSR() : compositor.disableSSR();\n colorCorrModel.get('enable') ? compositor.enableColorCorrection() : compositor.disableColorCorrection();\n edgeModel.get('enable') ? compositor.enableEdge() : compositor.disableEdge();\n fxaaModel.get('enable') ? compositor.enableFXAA() : compositor.disableFXAA();\n\n this._enableDOF = dofModel.get('enable');\n this._enableSSAO = ssaoModel.get('enable');\n\n this._enableSSAO ? compositor.enableSSAO() : compositor.disableSSAO();\n\n compositor.setBloomIntensity(bloomModel.get('intensity'));\n compositor.setEdgeColor(edgeModel.get('color'));\n compositor.setColorLookupTexture(colorCorrModel.get('lookupTexture'), api);\n compositor.setExposure(colorCorrModel.get('exposure'));\n\n ['radius', 'quality', 'intensity'].forEach(function (name) {\n compositor.setSSAOParameter(name, ssaoModel.get(name));\n });\n ['quality', 'maxRoughness', 'physical'].forEach(function (name) {\n compositor.setSSRParameter(name, ssrModel.get(name));\n });\n ['quality', 'focalDistance', 'focalRange', 'blurRadius', 'fstop'].forEach(function (name) {\n compositor.setDOFParameter(name, dofModel.get(name));\n });\n ['brightness', 'contrast', 'saturation'].forEach(function (name) {\n compositor.setColorCorrection(name, colorCorrModel.get(name));\n });\n\n};\n\nViewGL.prototype.setDOFFocusOnPoint = function (depth) {\n if (this._enablePostEffect) {\n\n if (depth > this.camera.far || depth < this.camera.near) {\n return;\n }\n\n this._compositor.setDOFParameter('focalDistance', depth);\n return true;\n }\n};\n\nViewGL.prototype.setTemporalSuperSampling = function (temporalSuperSamplingModel) {\n this._enableTemporalSS = temporalSuperSamplingModel.get('enable');\n};\n\nViewGL.prototype.isLinearSpace = function () {\n return this._enablePostEffect;\n};\n\nViewGL.prototype.setRootNode = function (rootNode) {\n if (this.rootNode === rootNode) {\n return;\n }\n var children = this.rootNode.children();\n for (var i = 0; i < children.length; i++) {\n rootNode.add(children[i]);\n }\n if (rootNode !== this.scene) {\n this.scene.add(rootNode);\n }\n\n this.rootNode = rootNode;\n};\n// Proxies\nViewGL.prototype.add = function (node3D) {\n this.rootNode.add(node3D);\n};\nViewGL.prototype.remove = function (node3D) {\n this.rootNode.remove(node3D);\n};\nViewGL.prototype.removeAll = function (node3D) {\n this.rootNode.removeAll(node3D);\n};\n\nObject.assign(ViewGL.prototype, notifier);\n\nexport default ViewGL;","import Cartesian3D from './grid3D/Cartesian3D';\nimport Axis3D from './grid3D/Axis3D';\nimport * as echarts from 'echarts/lib/echarts';\nimport {getLayoutRect} from 'echarts/lib/util/layout';\nimport ViewGL from '../core/ViewGL';\nimport retrieve from '../util/retrieve';\n\nfunction resizeCartesian3D(grid3DModel, api) {\n // Use left/top/width/height\n var boxLayoutOption = grid3DModel.getBoxLayoutParams();\n\n var viewport = getLayoutRect(boxLayoutOption, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n\n // Flip Y\n viewport.y = api.getHeight() - viewport.y - viewport.height;\n\n this.viewGL.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, api.getDevicePixelRatio());\n\n var boxWidth = grid3DModel.get('boxWidth');\n var boxHeight = grid3DModel.get('boxHeight');\n var boxDepth = grid3DModel.get('boxDepth');\n\n if (process.env.NODE_ENV !== 'production') {\n ['x', 'y', 'z'].forEach(function (dim) {\n if (!this.getAxis(dim)) {\n throw new Error('Grid' + grid3DModel.id + ' don\\'t have ' + dim + 'Axis');\n }\n }, this);\n }\n this.getAxis('x').setExtent(-boxWidth / 2, boxWidth / 2);\n // From near to far\n this.getAxis('y').setExtent(boxDepth / 2, -boxDepth / 2);\n this.getAxis('z').setExtent(-boxHeight / 2, boxHeight / 2);\n\n this.size = [boxWidth, boxHeight, boxDepth];\n}\n\nfunction updateCartesian3D(ecModel, api) {\n var dataExtents = {};\n function unionDataExtents(dim, extent) {\n dataExtents[dim] = dataExtents[dim] || [Infinity, -Infinity];\n dataExtents[dim][0] = Math.min(extent[0], dataExtents[dim][0]);\n dataExtents[dim][1] = Math.max(extent[1], dataExtents[dim][1]);\n }\n // Get data extents for scale.\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.coordinateSystem !== this) {\n return;\n }\n var data = seriesModel.getData();\n ['x', 'y', 'z'].forEach(function (coordDim) {\n data.mapDimensionsAll(coordDim, true).forEach(function (dataDim) {\n unionDataExtents(\n coordDim, data.getDataExtent(dataDim, true)\n );\n });\n });\n }, this);\n\n ['xAxis3D', 'yAxis3D', 'zAxis3D'].forEach(function (axisType) {\n ecModel.eachComponent(axisType, function (axisModel) {\n var dim = axisType.charAt(0);\n var grid3DModel = axisModel.getReferringComponents('grid3D').models[0];\n\n var cartesian3D = grid3DModel.coordinateSystem;\n if (cartesian3D !== this) {\n return;\n }\n\n var axis = cartesian3D.getAxis(dim);\n if (axis) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Can\\'t have two %s in one grid3D', axisType);\n }\n return;\n }\n var scale = echarts.helper.createScale(\n dataExtents[dim] || [Infinity, -Infinity], axisModel\n );\n axis = new Axis3D(dim, scale);\n axis.type = axisModel.get('type');\n var isCategory = axis.type === 'category';\n axis.onBand = isCategory && axisModel.get('boundaryGap');\n axis.inverse = axisModel.get('inverse');\n\n axisModel.axis = axis;\n axis.model = axisModel;\n\n // override `echarts/coord/Axis#getLabelModel`\n axis.getLabelModel = function () {\n return axisModel.getModel('axisLabel', grid3DModel.getModel('axisLabel'));\n };\n // override `echarts/coord/Axis#getTickModel`\n axis.getTickModel = function () {\n return axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));\n };\n\n cartesian3D.addAxis(axis);\n }, this);\n }, this);\n\n this.resize(this.model, api);\n}\n\nvar grid3DCreator = {\n\n dimensions: Cartesian3D.prototype.dimensions,\n\n create: function (ecModel, api) {\n\n var cartesian3DList = [];\n\n ecModel.eachComponent('grid3D', function (grid3DModel) {\n // FIXME\n grid3DModel.__viewGL = grid3DModel.__viewGL || new ViewGL();\n\n var cartesian3D = new Cartesian3D();\n cartesian3D.model = grid3DModel;\n cartesian3D.viewGL = grid3DModel.__viewGL;\n\n grid3DModel.coordinateSystem = cartesian3D;\n cartesian3DList.push(cartesian3D);\n\n // Inject resize and update\n cartesian3D.resize = resizeCartesian3D;\n\n cartesian3D.update = updateCartesian3D;\n });\n\n var axesTypes = ['xAxis3D', 'yAxis3D', 'zAxis3D'];\n function findAxesModels(seriesModel, ecModel) {\n return axesTypes.map(function (axisType) {\n var axisModel = seriesModel.getReferringComponents(axisType).models[0];\n if (axisModel == null) {\n axisModel = ecModel.getComponent(axisType);\n }\n if (process.env.NODE_ENV !== 'production') {\n if (!axisModel) {\n throw new Error(axisType + ' \"' + retrieve.firstNotNull(\n seriesModel.get(axisType + 'Index'),\n seriesModel.get(axisType + 'Id'),\n 0\n ) + '\" not found');\n }\n }\n return axisModel;\n });\n }\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') !== 'cartesian3D') {\n return;\n }\n var firstGridModel = seriesModel.getReferringComponents('grid3D').models[0];\n\n if (firstGridModel == null) {\n var axesModels = findAxesModels(seriesModel, ecModel);\n var firstGridModel = axesModels[0].getCoordSysModel();\n axesModels.forEach(function (axisModel) {\n var grid3DModel = axisModel.getCoordSysModel();\n if (process.env.NODE_ENV !== 'production') {\n if (!grid3DModel) {\n throw new Error(\n 'grid3D \"' + retrieve.firstNotNull(\n axisModel.get('gridIndex'),\n axisModel.get('gridId'),\n 0\n ) + '\" not found'\n );\n }\n if (grid3DModel !== firstGridModel) {\n throw new Error('xAxis3D, yAxis3D, zAxis3D must use the same grid');\n }\n }\n });\n }\n\n var coordSys = firstGridModel.coordinateSystem;\n seriesModel.coordinateSystem = coordSys;\n });\n\n return cartesian3DList;\n }\n};\n\nexport default grid3DCreator;","import * as echarts from 'echarts/lib/echarts';\n\nvar Axis3DModel = echarts.ComponentModel.extend({\n\n type: 'cartesian3DAxis',\n\n axis: null,\n\n /**\n * @override\n */\n getCoordSysModel: function () {\n return this.ecModel.queryComponents({\n mainType: 'grid3D',\n index: this.option.gridIndex,\n id: this.option.gridId\n })[0];\n }\n});\n\necharts.helper.mixinAxisModelCommonMethods(Axis3DModel);\n\nexport default Axis3DModel;","import * as echarts from 'echarts/lib/echarts';\n\nvar defaultOption = {\n show: true,\n\n grid3DIndex: 0,\n // 反向坐标轴\n inverse: false,\n\n // 坐标轴名字\n name: '',\n // 坐标轴名字位置\n nameLocation: 'middle',\n\n nameTextStyle: {\n fontSize: 16\n },\n // 文字与轴线距离\n nameGap: 20,\n\n axisPointer: {},\n\n axisLine: {},\n // 坐标轴小标记\n axisTick: {},\n axisLabel: {},\n // 分隔区域\n splitArea: {}\n};\n\nvar categoryAxis = echarts.util.merge({\n // 类目起始和结束两端空白策略\n boundaryGap: true,\n // splitArea: {\n // show: false\n // },\n // 坐标轴小标记\n axisTick: {\n // If tick is align with label when boundaryGap is true\n // Default with axisTick\n alignWithLabel: false,\n interval: 'auto'\n },\n // 坐标轴文本标签,详见axis.axisLabel\n axisLabel: {\n interval: 'auto'\n },\n axisPointer: {\n label: {\n show: false\n }\n }\n}, defaultOption);\n\nvar valueAxis = echarts.util.merge({\n // 数值起始和结束两端空白策略\n boundaryGap: [0, 0],\n // 最小值, 设置成 'dataMin' 则从数据中计算最小值\n // min: null,\n // 最大值,设置成 'dataMax' 则从数据中计算最大值\n // max: null,\n // 脱离0值比例,放大聚焦到最终_min,_max区间\n // scale: false,\n // 分割段数,默认为5\n splitNumber: 5,\n // Minimum interval\n // minInterval: null\n\n axisPointer: {\n label: {\n }\n }\n}, defaultOption);\n\n// FIXME\nvar timeAxis = echarts.util.defaults({\n scale: true,\n min: 'dataMin',\n max: 'dataMax'\n}, valueAxis);\nvar logAxis = echarts.util.defaults({\n logBase: 10\n}, valueAxis);\nlogAxis.scale = true;\n\nexport default {\n categoryAxis3D: categoryAxis,\n valueAxis3D: valueAxis,\n timeAxis3D: timeAxis,\n logAxis3D: logAxis\n};","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport { createHashMap, isObject, map } from 'zrender/lib/core/util';\n\nvar OrdinalMeta =\n/** @class */\nfunction () {\n function OrdinalMeta(opt) {\n this.categories = opt.categories || [];\n this._needCollect = opt.needCollect;\n this._deduplication = opt.deduplication;\n }\n\n OrdinalMeta.createByAxisModel = function (axisModel) {\n var option = axisModel.option;\n var data = option.data;\n var categories = data && map(data, getName);\n return new OrdinalMeta({\n categories: categories,\n needCollect: !categories,\n // deduplication is default in axis.\n deduplication: option.dedplication !== false\n });\n };\n\n ;\n\n OrdinalMeta.prototype.getOrdinal = function (category) {\n // @ts-ignore\n return this._getOrCreateMap().get(category);\n };\n /**\n * @return The ordinal. If not found, return NaN.\n */\n\n\n OrdinalMeta.prototype.parseAndCollect = function (category) {\n var index;\n var needCollect = this._needCollect; // The value of category dim can be the index of the given category set.\n // This feature is only supported when !needCollect, because we should\n // consider a common case: a value is 2017, which is a number but is\n // expected to be tread as a category. This case usually happen in dataset,\n // where it happent to be no need of the index feature.\n\n if (typeof category !== 'string' && !needCollect) {\n return category;\n } // Optimize for the scenario:\n // category is ['2012-01-01', '2012-01-02', ...], where the input\n // data has been ensured not duplicate and is large data.\n // Notice, if a dataset dimension provide categroies, usually echarts\n // should remove duplication except user tell echarts dont do that\n // (set axis.deduplication = false), because echarts do not know whether\n // the values in the category dimension has duplication (consider the\n // parallel-aqi example)\n\n\n if (needCollect && !this._deduplication) {\n index = this.categories.length;\n this.categories[index] = category;\n return index;\n }\n\n var map = this._getOrCreateMap(); // @ts-ignore\n\n\n index = map.get(category);\n\n if (index == null) {\n if (needCollect) {\n index = this.categories.length;\n this.categories[index] = category; // @ts-ignore\n\n map.set(category, index);\n } else {\n index = NaN;\n }\n }\n\n return index;\n }; // Consider big data, do not create map until needed.\n\n\n OrdinalMeta.prototype._getOrCreateMap = function () {\n return this._map || (this._map = createHashMap(this.categories));\n };\n\n return OrdinalMeta;\n}();\n\nfunction getName(obj) {\n if (isObject(obj) && obj.value != null) {\n return obj.value;\n } else {\n return obj + '';\n }\n}\n\nexport default OrdinalMeta;","import * as echarts from 'echarts/lib/echarts';\nimport axisDefault from './axis3DDefault';\n\nimport OrdinalMeta from 'echarts/lib/data/OrdinalMeta';\n\nvar AXIS_TYPES = ['value', 'category', 'time', 'log'];\n/**\n * Generate sub axis model class\n * @param {} registers\n * @param {string} dim 'x' 'y' 'radius' 'angle' 'parallel'\n * @param {module:echarts/model/Component} BaseAxisModelClass\n * @param {Function} axisTypeDefaulter\n * @param {Object} [extraDefaultOption]\n */\nexport default function (registers, dim, BaseAxisModelClass, axisTypeDefaulter, extraDefaultOption) {\n\n AXIS_TYPES.forEach(function (axisType) {\n\n var AxisModel = BaseAxisModelClass.extend({\n\n type: dim + 'Axis3D.' + axisType,\n\n /**\n * @type readOnly\n */\n __ordinalMeta: null,\n\n mergeDefaultAndTheme: function (option, ecModel) {\n\n var themeModel = ecModel.getTheme();\n echarts.util.merge(option, themeModel.get(axisType + 'Axis3D'));\n echarts.util.merge(option, this.getDefaultOption());\n\n option.type = axisTypeDefaulter(dim, option);\n },\n\n /**\n * @override\n */\n optionUpdated: function () {\n var thisOption = this.option;\n\n if (thisOption.type === 'category') {\n this.__ordinalMeta = OrdinalMeta.createByAxisModel(this);\n }\n },\n\n getCategories: function () {\n if (this.option.type === 'category') {\n return this.__ordinalMeta.categories;\n }\n },\n\n getOrdinalMeta: function () {\n return this.__ordinalMeta;\n },\n\n defaultOption: echarts.util.merge(\n echarts.util.clone(axisDefault[axisType + 'Axis3D']),\n extraDefaultOption || {},\n true\n )\n });\n\n registers.registerComponentModel(AxisModel);\n });\n\n // TODO\n registers.registerSubTypeDefaulter(\n dim + 'Axis3D',\n echarts.util.curry(axisTypeDefaulter, dim)\n );\n};","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Grid3DModel from './Grid3DModel';\nimport Grid3DView from './Grid3DView';\nimport grid3DCreator from '../../coord/grid3DCreator';\nimport Axis3DModel from './Axis3DModel';\nimport createAxis3DModel from './createAxis3DModel';\n\n\nfunction getAxisType(axisDim, option) {\n // Default axis with data is category axis\n return option.type || (option.data ? 'category' : 'value');\n}\nexport function install(registers) {\n registers.registerComponentModel(Grid3DModel);\n registers.registerComponentView(Grid3DView);\n\n registers.registerCoordinateSystem('grid3D', grid3DCreator);\n\n\n ['x', 'y', 'z'].forEach(function (dim) {\n createAxis3DModel(registers, dim, Axis3DModel, getAxisType, {\n name: dim.toUpperCase()\n });\n const AxisView = registers.ComponentView.extend({\n type: dim + 'Axis3D'\n });\n registers.registerComponentView(AxisView);\n });\n\n\n registers.registerAction({\n type: 'grid3DChangeCamera',\n event: 'grid3dcamerachanged',\n update: 'series:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'grid3D', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n\n registers.registerAction({\n type: 'grid3DShowAxisPointer',\n event: 'grid3dshowaxispointer',\n update: 'grid3D:showAxisPointer'\n }, function (payload, ecModel) {\n });\n\n registers.registerAction({\n type: 'grid3DHideAxisPointer',\n event: 'grid3dhideaxispointer',\n update: 'grid3D:hideAxisPointer'\n }, function (payload, ecModel) {\n });\n}\n\n","import { use } from 'echarts/lib/echarts';\nimport { install } from './grid3D/install';\nuse(install);","export default {\n defaultOption: {\n shading: null,\n\n realisticMaterial: {\n textureTiling: 1,\n textureOffset: 0,\n\n detailTexture: null\n },\n\n lambertMaterial: {\n textureTiling: 1,\n textureOffset: 0,\n\n detailTexture: null\n },\n\n colorMaterial: {\n textureTiling: 1,\n textureOffset: 0,\n\n detailTexture: null\n },\n\n hatchingMaterial: {\n textureTiling: 1,\n textureOffset: 0,\n\n paperColor: '#fff'\n }\n }\n};","import * as echarts from 'echarts/lib/echarts';\n\nexport default {\n\n getFilledRegions: function (regions, mapData) {\n var regionsArr = (regions || []).slice();\n\n var geoJson;\n if (typeof mapData === 'string') {\n mapData = echarts.getMap(mapData);\n geoJson = mapData && mapData.geoJson;\n }\n else {\n if (mapData && mapData.features) {\n geoJson = mapData;\n }\n }\n if (!geoJson) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Map ' + mapData + ' not exists. You can download map file on http://echarts.baidu.com/download-map.html');\n if (!geoJson.features) {\n console.error('Invalid GeoJSON for map3D');\n }\n }\n return [];\n }\n\n var dataNameMap = {};\n var features = geoJson.features;\n for (var i = 0; i < regionsArr.length; i++) {\n dataNameMap[regionsArr[i].name] = regionsArr[i];\n }\n\n for (var i = 0; i < features.length; i++) {\n var name = features[i].properties.name;\n if (!dataNameMap[name]) {\n regionsArr.push({\n name: name\n });\n }\n }\n\n return regionsArr;\n },\n\n defaultOption: {\n show: true,\n\n zlevel: -10,\n\n // geoJson used by geo3D\n map: '',\n\n // Layout used for viewport\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n\n boxWidth: 100,\n boxHeight: 10,\n boxDepth: 'auto',\n\n regionHeight: 3,\n\n environment: 'auto',\n\n groundPlane: {\n show: false,\n color: '#aaa'\n },\n\n shading: 'lambert',\n\n light: {\n main: {\n alpha: 40,\n beta: 30\n }\n },\n\n viewControl: {\n alpha: 40,\n beta: 0,\n distance: 100,\n orthographicSize: 60,\n\n minAlpha: 5,\n minBeta: -80,\n maxBeta: 80\n },\n\n label: {\n show: false,\n // Distance in 3d space.\n distance: 2,\n\n textStyle: {\n fontSize: 20,\n color: '#000',\n backgroundColor: 'rgba(255,255,255,0.7)',\n padding: 3,\n borderRadius: 4\n }\n },\n\n // TODO\n // altitude: {\n // min: 'auto',\n // max: 'auto',\n\n // height: []\n // },\n\n\n // labelLine\n\n // light\n // postEffect\n // temporalSuperSampling\n\n itemStyle: {\n color: '#fff',\n borderWidth: 0,\n borderColor: '#333'\n },\n\n emphasis: {\n itemStyle: {\n // color: '#f94b59'\n color: '#639fc0'\n },\n label: {\n show: true\n }\n }\n }\n};","import * as echarts from 'echarts/lib/echarts';\nimport componentViewControlMixin from '../common/componentViewControlMixin';\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\nimport componentShadingMixin from '../common/componentShadingMixin';\nimport geo3DModelMixin from '../../coord/geo3D/geo3DModelMixin';\n\nvar Geo3DModel = echarts.ComponentModel.extend({\n\n type: 'geo3D',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n optionUpdated: function () {\n var option = this.option;\n\n option.regions = this.getFilledRegions(option.regions, option.map);\n\n var dimensions = echarts.helper.createDimensions(option.data || [], {\n coordDimensions: ['value'],\n encodeDefine: this.get('encode'),\n dimensionsDefine: this.get('dimensions')\n });\n var list = new echarts.List(dimensions, this);\n list.initData(option.regions);\n\n var regionModelMap = {};\n list.each(function (idx) {\n var name = list.getName(idx);\n var itemModel = list.getItemModel(idx);\n regionModelMap[name] = itemModel;\n });\n\n this._regionModelMap = regionModelMap;\n\n this._data = list;\n },\n\n getData: function () {\n return this._data;\n },\n\n getRegionModel: function (idx) {\n var name = this.getData().getName(idx);\n return this._regionModelMap[name] || new echarts.Model(null, this);\n },\n\n getRegionPolygonCoords: function (idx) {\n var name = this.getData().getName(idx);\n var region = this.coordinateSystem.getRegion(name);\n\n return region ? region.geometries : [];\n },\n\n /**\n * Format label\n * @param {string} name Region name\n * @param {string} [status='normal'] 'normal' or 'emphasis'\n * @return {string}\n */\n getFormattedLabel: function (dataIndex, status) {\n var name = this._data.getName(dataIndex);\n var regionModel = this.getRegionModel(dataIndex);\n var formatter = regionModel.get(status === 'normal' ? ['label', 'formatter'] : ['emphasis', 'label', 'formatter']);\n if (formatter == null) {\n formatter = regionModel.get(['label', 'formatter']);\n }\n var params = {\n name: name\n };\n if (typeof formatter === 'function') {\n params.status = status;\n return formatter(params);\n }\n else if (typeof formatter === 'string') {\n var serName = params.seriesName;\n return formatter.replace('{a}', serName != null ? serName : '');\n }\n else {\n return name;\n }\n },\n\n defaultOption: {\n\n // itemStyle: {},\n // height,\n // label: {}\n // realisticMaterial\n regions: []\n }\n});\n\necharts.util.merge(Geo3DModel.prototype, geo3DModelMixin);\n\necharts.util.merge(Geo3DModel.prototype, componentViewControlMixin);\necharts.util.merge(Geo3DModel.prototype, componentPostEffectMixin);\necharts.util.merge(Geo3DModel.prototype, componentLightMixin);\necharts.util.merge(Geo3DModel.prototype, componentShadingMixin);\n\nexport default Geo3DModel;","// https://github.com/mapbox/earcut/blob/master/src/earcut.js\n\nexport default earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode) return triangles;\n\n var minX, minY, maxX, maxY, x, y, size;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and size are later used to transform coords into integers for z-order calculation\n size = Math.max(maxX - minX, maxY - minY);\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, size);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) return null;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, size, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && size) indexCurve(ear, minX, minY, size);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertice leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(ear, triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, size, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, size);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, size) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, size),\n maxZ = zOrder(maxTX, maxTY, minX, minY, size);\n\n // first look for points inside the triangle in increasing z-order\n var p = ear.nextZ;\n\n while (p && p.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.nextZ;\n }\n\n // then look for points in decreasing z-order\n p = ear.prevZ;\n\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return p;\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, size) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, size);\n earcutLinked(c, triangles, dim, minX, minY, size);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n outerNode = findHoleBridge(hole, outerNode);\n if (outerNode) {\n var b = splitPolygon(outerNode, hole);\n filterPoints(b, b.next);\n }\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m.next;\n\n while (p !== stop) {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n }\n\n return m;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, size) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and size of the data bounding box\nfunction zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) &&\n locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b);\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n if ((equals(p1, q1) && equals(p2, q2)) ||\n (equals(p1, q2) && equals(p2, q1))) return true;\n return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 &&\n area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertice index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertice nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}","\nfunction swap(arr, a, b) {\n var tmp = arr[a];\n arr[a] = arr[b];\n arr[b] = tmp;\n}\nfunction partition(arr, pivot, left, right, compare) {\n var storeIndex = left;\n var pivotValue = arr[pivot];\n\n // put the pivot on the right\n swap(arr, pivot, right);\n\n // go through the rest\n for(var v = left; v < right; v++) {\n if(compare(arr[v], pivotValue) < 0) {\n swap(arr, v, storeIndex);\n storeIndex++;\n }\n }\n\n // finally put the pivot in the correct place\n swap(arr, right, storeIndex);\n\n return storeIndex;\n}\n\nfunction quickSort(array, compare, left, right) {\n if(left < right) {\n var pivot = Math.floor((left + right) / 2);\n var newPivot = partition(array, pivot, left, right, compare);\n quickSort(array, compare, left, newPivot - 1);\n quickSort(array, compare, newPivot + 1, right);\n }\n}\n\n\n// TODO Test.\nfunction ProgressiveQuickSort() {\n\n // this._pivotList = new LinkedList();\n this._parts = [];\n}\n\nProgressiveQuickSort.prototype.step = function (arr, compare, frame) {\n\n var len = arr.length;\n if (frame === 0) {\n this._parts = [];\n this._sorted = false;\n\n // Pick a start pivot;\n var pivot = Math.floor(len / 2);\n this._parts.push({\n pivot: pivot,\n left: 0,\n right: len - 1\n });\n\n this._currentSortPartIdx = 0;\n }\n\n if (this._sorted) {\n return;\n }\n\n var parts = this._parts;\n if (parts.length === 0) {\n this._sorted = true;\n // Already finished.\n return true;\n }\n else if (parts.length < 512) {\n // Sort large parts in about 10 frames.\n for (var i = 0; i < parts.length; i++) {\n // Partition and Modify the pivot index.\n parts[i].pivot = partition(\n arr, parts[i].pivot, parts[i].left, parts[i].right, compare\n );\n }\n\n var subdividedParts = [];\n for (var i = 0; i < parts.length; i++) {\n // Subdivide left\n var left = parts[i].left;\n var right = parts[i].pivot - 1;\n if (right > left) {\n subdividedParts.push({\n pivot: Math.floor((right + left) / 2),\n left: left, right: right\n });\n }\n // Subdivide right\n var left = parts[i].pivot + 1;\n var right = parts[i].right;\n if (right > left) {\n subdividedParts.push({\n pivot: Math.floor((right + left) / 2),\n left: left, right: right\n });\n }\n }\n parts = this._parts = subdividedParts;\n }\n else {\n // console.time('sort');\n // Finally quick sort each parts in 10 frames.\n for (var i = 0; i < Math.floor(parts.length / 10); i++) {\n // Sort near parts first.\n var idx = parts.length - 1 - this._currentSortPartIdx;\n quickSort(arr, compare, parts[idx].left, parts[idx].right);\n this._currentSortPartIdx++;\n\n // Finish sort\n if (this._currentSortPartIdx === parts.length) {\n this._sorted = true;\n return true;\n }\n }\n // console.timeEnd('sort');\n\n }\n\n return false;\n};\n\nProgressiveQuickSort.sort = quickSort;\n\nexport default ProgressiveQuickSort;","import ProgressiveQuickSort from '../ProgressiveQuickSort';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\nvar p0 = vec3.create();\nvar p1 = vec3.create();\nvar p2 = vec3.create();\n// var cp = vec3.create();\n\nexport default {\n\n needsSortTriangles: function () {\n return this.indices && this.sortTriangles;\n },\n\n needsSortTrianglesProgressively: function () {\n return this.needsSortTriangles() && this.triangleCount >= 2e4;\n },\n\n doSortTriangles: function (cameraPos, frame) {\n var indices = this.indices;\n // Do progressive quick sort.\n if (frame === 0) {\n var posAttr = this.attributes.position;\n var cameraPos = cameraPos.array;\n\n if (!this._triangleZList || this._triangleZList.length !== this.triangleCount) {\n this._triangleZList = new Float32Array(this.triangleCount);\n this._sortedTriangleIndices = new Uint32Array(this.triangleCount);\n\n this._indicesTmp = new indices.constructor(indices.length);\n this._triangleZListTmp = new Float32Array(this.triangleCount);\n }\n\n var cursor = 0;\n var firstZ;\n for (var i = 0; i < indices.length;) {\n posAttr.get(indices[i++], p0);\n posAttr.get(indices[i++], p1);\n posAttr.get(indices[i++], p2);\n\n // FIXME If use center ?\n // cp[0] = (p0[0] + p1[0] + p2[0]) / 3;\n // cp[1] = (p0[1] + p1[1] + p2[1]) / 3;\n // cp[2] = (p0[2] + p1[2] + p2[2]) / 3;\n // Camera position is in object space\n\n // Use max of three points, PENDING\n var z0 = vec3.sqrDist(p0, cameraPos);\n var z1 = vec3.sqrDist(p1, cameraPos);\n var z2 = vec3.sqrDist(p2, cameraPos);\n var zMax = Math.min(z0, z1);\n zMax = Math.min(zMax, z2);\n if (i === 3) {\n firstZ = zMax;\n zMax = 0;\n }\n else {\n // Only store the difference to avoid the precision issue.\n zMax = zMax - firstZ;\n }\n this._triangleZList[cursor++] = zMax;\n }\n }\n\n\n var sortedTriangleIndices = this._sortedTriangleIndices;\n for (var i = 0; i < sortedTriangleIndices.length; i++) {\n sortedTriangleIndices[i] = i;\n }\n\n if (this.triangleCount < 2e4) {\n // Use simple timsort for simple geometries.\n if (frame === 0) {\n // Use native sort temporary.\n this._simpleSort(true);\n }\n }\n else {\n for (var i = 0; i < 3; i++) {\n this._progressiveQuickSort(frame * 3 + i);\n }\n }\n\n var targetIndices = this._indicesTmp;\n var targetTriangleZList = this._triangleZListTmp;\n var faceZList = this._triangleZList;\n for (var i = 0; i < this.triangleCount; i++) {\n var fromIdx3 = sortedTriangleIndices[i] * 3;\n var toIdx3 = i * 3;\n targetIndices[toIdx3++] = indices[fromIdx3++];\n targetIndices[toIdx3++] = indices[fromIdx3++];\n targetIndices[toIdx3] = indices[fromIdx3];\n\n targetTriangleZList[i] = faceZList[sortedTriangleIndices[i]];\n }\n\n // Swap indices.\n var tmp = this._indicesTmp;\n this._indicesTmp = this.indices;\n this.indices = tmp;\n var tmp = this._triangleZListTmp;\n this._triangleZListTmp = this._triangleZList;\n this._triangleZList = tmp;\n\n this.dirtyIndices();\n },\n\n _simpleSort: function (useNativeQuickSort) {\n var faceZList = this._triangleZList;\n var sortedTriangleIndices = this._sortedTriangleIndices;\n\n function compare(a, b) {\n // Sort from far to near. which is descending order\n return faceZList[b] - faceZList[a];\n }\n if (useNativeQuickSort) {\n Array.prototype.sort.call(sortedTriangleIndices, compare);\n }\n else {\n ProgressiveQuickSort.sort(sortedTriangleIndices, compare, 0, sortedTriangleIndices.length - 1);\n }\n },\n\n _progressiveQuickSort: function (frame) {\n var faceZList = this._triangleZList;\n var sortedTriangleIndices = this._sortedTriangleIndices;\n\n this._quickSort = this._quickSort || new ProgressiveQuickSort();\n\n this._quickSort.step(sortedTriangleIndices, function (a, b) {\n return faceZList[b] - faceZList[a];\n }, frame);\n }\n};","export function getVisualColor(data) {\n const style = data.getVisual('style');\n if (style) {\n const drawType = data.getVisual('drawType');\n return style[drawType];\n }\n}\nexport function getVisualOpacity(data) {\n const style = data.getVisual('style');\n return style.opacity;\n}\nexport function getItemVisualColor(data, idx) {\n const style = data.getItemVisual(idx, 'style');\n if (style) {\n const drawType = data.getVisual('drawType');\n return style[drawType];\n }\n}\nexport function getItemVisualOpacity(data, idx) {\n const style = data.getItemVisual(idx, 'style');\n return style && style.opacity;\n}","import * as echarts from 'echarts/lib/echarts';\nimport ZRTextureAtlasSurface from '../../util/ZRTextureAtlasSurface';\nimport LabelsMesh from '../../util/mesh/LabelsMesh';\nimport retrieve from '../../util/retrieve';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nimport {createTextStyle} from 'echarts/lib/label/labelStyle';\n\nvar LABEL_NORMAL_SHOW_BIT = 1;\nvar LABEL_EMPHASIS_SHOW_BIT = 2;\n\nfunction LabelsBuilder(width, height, api) {\n\n this._labelsMesh = new LabelsMesh();\n\n this._labelTextureSurface = new ZRTextureAtlasSurface({\n width: 512,\n height: 512,\n devicePixelRatio: api.getDevicePixelRatio(),\n onupdate: function () {\n api.getZr().refresh();\n }\n });\n this._api = api;\n\n this._labelsMesh.material.set('textureAtlas', this._labelTextureSurface.getTexture());\n}\n\nLabelsBuilder.prototype.getLabelPosition = function (dataIndex, positionDesc, distance) {\n return [0, 0, 0];\n};\n\nLabelsBuilder.prototype.getLabelDistance = function (dataIndex, positionDesc, distance) {\n return 0;\n};\n\nLabelsBuilder.prototype.getMesh = function () {\n return this._labelsMesh;\n};\n\nLabelsBuilder.prototype.updateData = function (data, start, end) {\n if (start == null) {\n start = 0;\n }\n if (end == null) {\n end = data.count();\n }\n\n if (!this._labelsVisibilitiesBits || this._labelsVisibilitiesBits.length !== (end - start)) {\n this._labelsVisibilitiesBits = new Uint8Array(end - start);\n }\n var normalLabelVisibilityQuery = ['label', 'show'];\n var emphasisLabelVisibilityQuery = ['emphasis', 'label', 'show'];\n\n for (var idx = start; idx < end; idx++) {\n var itemModel = data.getItemModel(idx);\n var normalVisibility = itemModel.get(normalLabelVisibilityQuery);\n var emphasisVisibility = itemModel.get(emphasisLabelVisibilityQuery);\n if (emphasisVisibility == null) {\n emphasisVisibility = normalVisibility;\n }\n var bit = (normalVisibility ? LABEL_NORMAL_SHOW_BIT : 0)\n | (emphasisVisibility ? LABEL_EMPHASIS_SHOW_BIT : 0);\n this._labelsVisibilitiesBits[idx - start] = bit;\n }\n\n this._start = start;\n this._end = end;\n\n this._data = data;\n};\n\nLabelsBuilder.prototype.updateLabels = function (highlightDataIndices) {\n\n if (!this._data) {\n return;\n }\n\n highlightDataIndices = highlightDataIndices || [];\n\n var hasHighlightData = highlightDataIndices.length > 0;\n var highlightDataIndicesMap = {};\n for (var i = 0; i < highlightDataIndices.length; i++) {\n highlightDataIndicesMap[highlightDataIndices[i]] = true;\n }\n\n this._labelsMesh.geometry.convertToDynamicArray(true);\n this._labelTextureSurface.clear();\n\n var normalLabelQuery = ['label'];\n var emphasisLabelQuery = ['emphasis', 'label'];\n var seriesModel = this._data.hostModel;\n var data = this._data;\n\n var seriesLabelModel = seriesModel.getModel(normalLabelQuery);\n var seriesLabelEmphasisModel = seriesModel.getModel(emphasisLabelQuery, seriesLabelModel);\n\n var textAlignMap = {\n left: 'right',\n right: 'left',\n top: 'center',\n bottom: 'center'\n };\n var textVerticalAlignMap = {\n left: 'middle',\n right: 'middle',\n top: 'bottom',\n bottom: 'top'\n };\n\n for (var dataIndex = this._start; dataIndex < this._end; dataIndex++) {\n var isEmphasis = false;\n if (hasHighlightData && highlightDataIndicesMap[dataIndex]) {\n isEmphasis = true;\n }\n var ifShow = this._labelsVisibilitiesBits[dataIndex - this._start]\n & (isEmphasis ? LABEL_EMPHASIS_SHOW_BIT : LABEL_NORMAL_SHOW_BIT);\n if (!ifShow) {\n continue;\n }\n\n var itemModel = data.getItemModel(dataIndex);\n var labelModel = itemModel.getModel(\n isEmphasis ? emphasisLabelQuery : normalLabelQuery,\n isEmphasis ? seriesLabelEmphasisModel : seriesLabelModel\n );\n var distance = labelModel.get('distance') || 0;\n var position = labelModel.get('position');\n\n var dpr = this._api.getDevicePixelRatio();\n var text = seriesModel.getFormattedLabel(dataIndex, isEmphasis ? 'emphasis' : 'normal');\n if (text == null || text === '') {\n return;\n }\n\n // TODO Background.\n var textEl = new echarts.graphic.Text({\n style: createTextStyle(labelModel, {\n text: text,\n fill: labelModel.get('color') || getItemVisualColor(data, dataIndex) || '#000',\n align: 'left',\n verticalAlign: 'top',\n opacity: retrieve.firstNotNull(labelModel.get('opacity'), getItemVisualOpacity(data, dataIndex), 1)\n })\n });\n\n var rect = textEl.getBoundingRect();\n var lineHeight = 1.2;\n rect.height *= lineHeight;\n\n var coords = this._labelTextureSurface.add(textEl);\n\n var textAlign = textAlignMap[position] || 'center';\n var textVerticalAlign = textVerticalAlignMap[position] || 'bottom';\n\n this._labelsMesh.geometry.addSprite(\n this.getLabelPosition(dataIndex, position, distance),\n [rect.width * dpr, rect.height * dpr], coords,\n textAlign, textVerticalAlign,\n this.getLabelDistance(dataIndex, position, distance) * dpr\n );\n }\n\n this._labelsMesh.material.set('uvScale', this._labelTextureSurface.getCoordsScale());\n\n // var canvas = this._labelTextureSurface.getTexture().image;\n // document.body.appendChild(canvas);\n // canvas.style.cssText = 'position:absolute;z-index: 1000';\n\n // Update image.\n this._labelTextureSurface.getZr().refreshImmediately();\n this._labelsMesh.geometry.convertToTypedArray();\n this._labelsMesh.geometry.dirty();\n};\n\nLabelsBuilder.prototype.dispose = function () {\n this._labelTextureSurface.dispose();\n}\n\nexport default LabelsBuilder;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport earcut from '../../util/earcut';\nimport LinesGeo from '../../util/geometry/Lines3D';\nimport retrieve from '../../util/retrieve';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport trianglesSortMixin from '../../util/geometry/trianglesSortMixin';\nimport LabelsBuilder from './LabelsBuilder';\nimport lines3DGLSL from '../../util/shader/lines3D.glsl.js';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nvar vec3 = glmatrix.vec3;\n\ngraphicGL.Shader.import(lines3DGLSL);\n\nfunction Geo3DBuilder(api) {\n\n this.rootNode = new graphicGL.Node();\n\n // Cache triangulation result\n this._triangulationResults = {};\n\n this._shadersMap = graphicGL.COMMON_SHADERS.filter(function (shaderName) {\n return shaderName !== 'shadow';\n }).reduce(function (obj, shaderName) {\n obj[shaderName] = graphicGL.createShader('ecgl.' + shaderName);\n return obj;\n }, {});\n\n this._linesShader = graphicGL.createShader('ecgl.meshLines3D');\n\n var groundMaterials = {};\n graphicGL.COMMON_SHADERS.forEach(function (shading) {\n groundMaterials[shading] = new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.' + shading)\n });\n });\n this._groundMaterials = groundMaterials;\n\n this._groundMesh = new graphicGL.Mesh({\n geometry: new graphicGL.PlaneGeometry({ dynamic: true }),\n castShadow: false,\n renderNormal: true,\n $ignorePicking: true\n });\n this._groundMesh.rotation.rotateX(-Math.PI / 2);\n\n this._labelsBuilder = new LabelsBuilder(512, 512, api);\n\n // Give a large render order.\n this._labelsBuilder.getMesh().renderOrder = 100;\n this._labelsBuilder.getMesh().material.depthTest = false;\n\n this.rootNode.add(this._labelsBuilder.getMesh());\n\n this._initMeshes();\n\n this._api = api;\n}\n\nGeo3DBuilder.prototype = {\n\n constructor: Geo3DBuilder,\n\n // Which dimension to extrude. Y or Z\n extrudeY: true,\n\n update: function (componentModel, ecModel, api, start, end) {\n\n var data = componentModel.getData();\n\n if (start == null) {\n start = 0;\n }\n if (end == null) {\n end = data.count();\n }\n\n this._startIndex = start;\n this._endIndex = end - 1;\n\n this._triangulation(componentModel, start, end);\n\n var shader = this._getShader(componentModel.get('shading'));\n\n this._prepareMesh(componentModel, shader, api, start, end);\n\n this.rootNode.updateWorldTransform();\n\n this._updateRegionMesh(componentModel, api, start, end);\n\n var coordSys = componentModel.coordinateSystem;\n // PENDING\n if (coordSys.type === 'geo3D') {\n this._updateGroundPlane(componentModel, coordSys, api);\n }\n\n var self = this;\n this._labelsBuilder.updateData(data, start, end);\n this._labelsBuilder.getLabelPosition = function (dataIndex, positionDesc, distance) {\n var name = data.getName(dataIndex);\n\n var center;\n var height = distance;\n if (coordSys.type === 'geo3D') {\n var region = coordSys.getRegion(name);\n if (!region) {\n return [NaN, NaN, NaN];\n }\n center = region.getCenter();\n var pos = coordSys.dataToPoint([center[0], center[1], height]);\n return pos;\n }\n else {\n var tmp = self._triangulationResults[dataIndex - self._startIndex];\n var center = self.extrudeY ? [\n (tmp.max[0] + tmp.min[0]) / 2,\n tmp.max[1] + height,\n (tmp.max[2] + tmp.min[2]) / 2\n ] : [\n (tmp.max[0] + tmp.min[0]) / 2,\n (tmp.max[1] + tmp.min[1]) / 2,\n tmp.max[2] + height\n ];\n }\n };\n\n this._data = data;\n\n this._labelsBuilder.updateLabels();\n\n this._updateDebugWireframe(componentModel);\n\n // Reset some state.\n this._lastHoverDataIndex = 0;\n },\n\n _initMeshes: function () {\n var self = this;\n function createPolygonMesh() {\n var mesh = new graphicGL.Mesh({\n name: 'Polygon',\n material: new graphicGL.Material({\n shader: self._shadersMap.lambert\n }),\n geometry: new graphicGL.Geometry({\n sortTriangles: true,\n dynamic: true\n }),\n // TODO Disable culling\n culling: false,\n ignorePicking: true,\n // Render normal in normal pass\n renderNormal: true\n });\n Object.assign(mesh.geometry, trianglesSortMixin);\n return mesh;\n }\n\n var polygonMesh = createPolygonMesh();\n\n var linesMesh = new graphicGL.Mesh({\n material: new graphicGL.Material({\n shader: this._linesShader\n }),\n castShadow: false,\n ignorePicking: true,\n $ignorePicking: true,\n geometry: new LinesGeo({\n useNativeLine: false\n })\n });\n\n this.rootNode.add(polygonMesh);\n this.rootNode.add(linesMesh);\n\n polygonMesh.material.define('both', 'VERTEX_COLOR');\n polygonMesh.material.define('fragment', 'DOUBLE_SIDED');\n\n this._polygonMesh = polygonMesh;\n this._linesMesh = linesMesh;\n\n this.rootNode.add(this._groundMesh);\n },\n\n _getShader: function (shading) {\n var shader = this._shadersMap[shading];\n if (!shader) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown shading ' + shading);\n }\n // Default use lambert shader.\n shader = this._shadersMap.lambert;\n }\n shader.__shading = shading;\n return shader;\n },\n\n _prepareMesh: function (componentModel, shader, api, start, end) {\n var polygonVertexCount = 0;\n var polygonTriangleCount = 0;\n var linesVertexCount = 0;\n var linesTriangleCount = 0;\n // TODO Lines\n for (var idx = start; idx < end; idx++) {\n var polyInfo = this._getRegionPolygonInfo(idx);\n var lineInfo = this._getRegionLinesInfo(idx, componentModel, this._linesMesh.geometry);\n polygonVertexCount += polyInfo.vertexCount;\n polygonTriangleCount += polyInfo.triangleCount;\n linesVertexCount += lineInfo.vertexCount;\n linesTriangleCount += lineInfo.triangleCount;\n }\n\n var polygonMesh = this._polygonMesh;\n var polygonGeo = polygonMesh.geometry;\n ['position', 'normal', 'texcoord0', 'color'].forEach(function (attrName) {\n polygonGeo.attributes[attrName].init(polygonVertexCount);\n });\n polygonGeo.indices = polygonVertexCount > 0xffff ? new Uint32Array(polygonTriangleCount * 3) : new Uint16Array(polygonTriangleCount * 3);\n\n if (polygonMesh.material.shader !== shader) {\n polygonMesh.material.attachShader(shader, true);\n }\n graphicGL.setMaterialFromModel(shader.__shading, polygonMesh.material, componentModel, api);\n\n if (linesVertexCount > 0) {\n this._linesMesh.geometry.resetOffset();\n this._linesMesh.geometry.setVertexCount(linesVertexCount);\n this._linesMesh.geometry.setTriangleCount(linesTriangleCount);\n }\n\n // Indexing data index from vertex index.\n this._dataIndexOfVertex = new Uint32Array(polygonVertexCount);\n // Indexing vertex index range from data index\n this._vertexRangeOfDataIndex = new Uint32Array((end - start) * 2);\n },\n\n _updateRegionMesh: function (componentModel, api, start, end) {\n\n var data = componentModel.getData();\n\n var vertexOffset = 0;\n var triangleOffset = 0;\n\n // Materials configurations.\n var hasTranparentRegion = false;\n\n var polygonMesh = this._polygonMesh;\n var linesMesh = this._linesMesh;\n\n for (var dataIndex = start; dataIndex < end; dataIndex++) {\n // Get bunch of visual properties.\n var regionModel = componentModel.getRegionModel(dataIndex);\n var itemStyleModel = regionModel.getModel('itemStyle');\n\n var color = retrieve.firstNotNull(\n getItemVisualColor(data, dataIndex),\n itemStyleModel.get('color'),\n '#fff'\n );\n var opacity = retrieve.firstNotNull(getItemVisualOpacity(data, dataIndex), 1);\n\n var colorArr = graphicGL.parseColor(color);\n var borderColorArr = graphicGL.parseColor(itemStyleModel.get('borderColor'));\n\n colorArr[3] *= opacity;\n borderColorArr[3] *= opacity;\n\n var isTransparent = colorArr[3] < 0.99;\n\n polygonMesh.material.set('color', [1, 1, 1, 1]);\n hasTranparentRegion = hasTranparentRegion || isTransparent;\n\n var regionHeight = retrieve.firstNotNull(regionModel.get('height', true), componentModel.get('regionHeight'));\n\n var newOffsets = this._updatePolygonGeometry(\n componentModel, polygonMesh.geometry, dataIndex, regionHeight,\n vertexOffset, triangleOffset, colorArr\n );\n\n for (var i = vertexOffset; i < newOffsets.vertexOffset; i++) {\n this._dataIndexOfVertex[i] = dataIndex;\n }\n this._vertexRangeOfDataIndex[(dataIndex - start) * 2] = vertexOffset;\n this._vertexRangeOfDataIndex[(dataIndex - start) * 2 + 1] = newOffsets.vertexOffset;\n\n vertexOffset = newOffsets.vertexOffset;\n triangleOffset = newOffsets.triangleOffset;\n\n // Update lines.\n var lineWidth = itemStyleModel.get('borderWidth');\n var hasLine = lineWidth > 0;\n if (hasLine) {\n lineWidth *= api.getDevicePixelRatio();\n this._updateLinesGeometry(\n linesMesh.geometry, componentModel, dataIndex, regionHeight, lineWidth,\n componentModel.coordinateSystem.transform\n );\n }\n linesMesh.invisible = !hasLine;\n linesMesh.material.set({\n color: borderColorArr\n });\n }\n\n var polygonMesh = this._polygonMesh;\n polygonMesh.material.transparent = hasTranparentRegion;\n polygonMesh.material.depthMask = !hasTranparentRegion;\n polygonMesh.geometry.updateBoundingBox();\n\n polygonMesh.frontFace = this.extrudeY ? graphicGL.Mesh.CCW : graphicGL.Mesh.CW;\n\n // Update tangents\n if (polygonMesh.material.get('normalMap')) {\n polygonMesh.geometry.generateTangents();\n }\n\n polygonMesh.seriesIndex = componentModel.seriesIndex;\n\n polygonMesh.on('mousemove', this._onmousemove, this);\n polygonMesh.on('mouseout', this._onmouseout, this);\n },\n\n _updateDebugWireframe: function (componentModel) {\n var debugWireframeModel = componentModel.getModel('debug.wireframe');\n\n // TODO Unshow\n if (debugWireframeModel.get('show')) {\n var color = graphicGL.parseColor(\n debugWireframeModel.get('lineStyle.color') || 'rgba(0,0,0,0.5)'\n );\n var width = retrieve.firstNotNull(\n debugWireframeModel.get('lineStyle.width'), 1\n );\n\n // TODO Will cause highlight wrong\n var mesh = this._polygonMesh;\n mesh.geometry.generateBarycentric();\n mesh.material.define('both', 'WIREFRAME_TRIANGLE');\n mesh.material.set('wireframeLineColor', color);\n mesh.material.set('wireframeLineWidth', width);\n }\n },\n\n _onmousemove: function (e) {\n var dataIndex = this._dataIndexOfVertex[e.triangle[0]];\n if (dataIndex == null) {\n dataIndex = -1;\n }\n if (dataIndex !== this._lastHoverDataIndex) {\n this.downplay(this._lastHoverDataIndex);\n this.highlight(dataIndex);\n this._labelsBuilder.updateLabels([dataIndex]);\n }\n this._lastHoverDataIndex = dataIndex;\n this._polygonMesh.dataIndex = dataIndex;\n },\n\n _onmouseout: function (e) {\n if (e.target) {\n this.downplay(this._lastHoverDataIndex);\n this._lastHoverDataIndex = -1;\n this._polygonMesh.dataIndex = -1;\n }\n\n this._labelsBuilder.updateLabels([]);\n },\n\n _updateGroundPlane: function (componentModel, geo3D, api) {\n var groundModel = componentModel.getModel('groundPlane', componentModel);\n this._groundMesh.invisible = !groundModel.get('show', true);\n if (this._groundMesh.invisible) {\n return;\n }\n\n var shading = componentModel.get('shading');\n var material = this._groundMaterials[shading];\n if (!material) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown shading ' + shading);\n }\n material = this._groundMaterials.lambert;\n }\n\n graphicGL.setMaterialFromModel(shading, material, groundModel, api);\n if (material.get('normalMap')) {\n this._groundMesh.geometry.generateTangents();\n }\n\n this._groundMesh.material = material;\n this._groundMesh.material.set('color', graphicGL.parseColor(groundModel.get('color')));\n\n this._groundMesh.scale.set(geo3D.size[0], geo3D.size[2], 1);\n },\n\n _triangulation: function (componentModel, start, end) {\n this._triangulationResults = [];\n\n var minAll = [Infinity, Infinity, Infinity];\n var maxAll = [-Infinity, -Infinity, -Infinity];\n\n var coordSys = componentModel.coordinateSystem;\n\n for (var idx = start; idx < end; idx++) {\n var polygons = [];\n var polygonCoords = componentModel.getRegionPolygonCoords(idx);\n for (var i = 0; i < polygonCoords.length; i++) {\n var exterior = polygonCoords[i].exterior;\n var interiors = polygonCoords[i].interiors;\n var points = [];\n var holes = [];\n if (exterior.length < 3) {\n continue;\n }\n var offset = 0;\n for (var j = 0; j < exterior.length; j++) {\n var p = exterior[j];\n points[offset++] = p[0];\n points[offset++] = p[1];\n }\n\n for (var j = 0; j < interiors.length; j++) {\n if (interiors[j].length < 3) {\n continue;\n }\n var startIdx = points.length / 2;\n for (var k = 0; k < interiors[j].length; k++) {\n var p = interiors[j][k];\n points.push(p[0]);\n points.push(p[1]);\n }\n\n holes.push(startIdx);\n }\n var triangles = earcut(points, holes);\n\n var points3 = new Float64Array(points.length / 2 * 3);\n var pos = [];\n var min = [Infinity, Infinity, Infinity];\n var max = [-Infinity, -Infinity, -Infinity];\n var off3 = 0;\n for (var j = 0; j < points.length;) {\n vec3.set(pos, points[j++], 0, points[j++]);\n if (coordSys && coordSys.transform) {\n vec3.transformMat4(pos, pos, coordSys.transform);\n }\n vec3.min(min, min, pos);\n vec3.max(max, max, pos);\n points3[off3++] = pos[0];\n points3[off3++] = pos[1];\n points3[off3++] = pos[2];\n }\n vec3.min(minAll, minAll, min);\n vec3.max(maxAll, maxAll, max);\n polygons.push({\n points: points3,\n indices: triangles,\n min: min,\n max: max\n });\n }\n this._triangulationResults.push(polygons);\n }\n\n this._geoBoundingBox = [minAll, maxAll];\n },\n\n /**\n * Get region vertex and triangle count\n */\n _getRegionPolygonInfo: function (idx) {\n\n var polygons = this._triangulationResults[idx - this._startIndex];\n\n var sideVertexCount = 0;\n var sideTriangleCount = 0;\n\n for (var i = 0; i < polygons.length; i++) {\n sideVertexCount += polygons[i].points.length / 3;\n sideTriangleCount += polygons[i].indices.length / 3;\n }\n\n var vertexCount = sideVertexCount * 2 + sideVertexCount * 4;\n var triangleCount = sideTriangleCount * 2 + sideVertexCount * 2;\n\n return {\n vertexCount: vertexCount,\n triangleCount: triangleCount\n };\n },\n\n _updatePolygonGeometry: function (\n componentModel, geometry, dataIndex, regionHeight,\n vertexOffset, triangleOffset, color\n ) {\n // FIXME\n var projectUVOnGround = componentModel.get('projectUVOnGround');\n\n var positionAttr = geometry.attributes.position;\n var normalAttr = geometry.attributes.normal;\n var texcoordAttr = geometry.attributes.texcoord0;\n var colorAttr = geometry.attributes.color;\n var polygons = this._triangulationResults[dataIndex - this._startIndex];\n\n var hasColor = colorAttr.value && color;\n\n var indices = geometry.indices;\n\n var extrudeCoordIndex = this.extrudeY ? 1 : 2;\n var sideCoordIndex = this.extrudeY ? 2 : 1;\n\n var scale = [\n this.rootNode.worldTransform.x.len(),\n this.rootNode.worldTransform.y.len(),\n this.rootNode.worldTransform.z.len()\n ];\n\n var min = vec3.mul([], this._geoBoundingBox[0], scale);\n var max = vec3.mul([], this._geoBoundingBox[1], scale);\n var maxDimSize = Math.max(max[0] - min[0], max[2] - min[2]);\n\n function addVertices(polygon, y, insideOffset) {\n var points = polygon.points;\n\n var pointsLen = points.length;\n var currentPosition = [];\n var uv = [];\n\n for (var k = 0; k < pointsLen; k += 3) {\n currentPosition[0] = points[k];\n currentPosition[extrudeCoordIndex] = y;\n currentPosition[sideCoordIndex] = points[k + 2];\n\n uv[0] = (points[k] * scale[0] - min[0]) / maxDimSize;\n uv[1] = (points[k + 2] * scale[sideCoordIndex] - min[2]) / maxDimSize;\n\n positionAttr.set(vertexOffset, currentPosition);\n if (hasColor) {\n colorAttr.set(vertexOffset, color);\n }\n texcoordAttr.set(vertexOffset++, uv);\n }\n }\n\n function buildTopBottom(polygon, y, insideOffset) {\n\n var startVertexOffset = vertexOffset;\n\n addVertices(polygon, y, insideOffset);\n\n var len = polygon.indices.length;\n for (var k = 0; k < len; k++) {\n indices[triangleOffset * 3 + k] = polygon.indices[k] + startVertexOffset;\n }\n triangleOffset += polygon.indices.length / 3;\n }\n\n var normalTop = this.extrudeY ? [0, 1, 0] : [0, 0, 1];\n var normalBottom = vec3.negate([], normalTop);\n for (var p = 0; p < polygons.length; p++) {\n var startVertexOffset = vertexOffset;\n var polygon = polygons[p];\n // BOTTOM\n buildTopBottom(polygon, 0, 0);\n // TOP\n buildTopBottom(polygon, regionHeight, 0);\n\n var ringVertexCount = polygon.points.length / 3;\n for (var v = 0; v < ringVertexCount; v++) {\n normalAttr.set(startVertexOffset + v, normalBottom);\n normalAttr.set(startVertexOffset + v + ringVertexCount, normalTop);\n }\n\n var quadToTriangle = [0, 3, 1, 1, 3, 2];\n\n var quadPos = [[], [], [], []];\n var a = [];\n var b = [];\n var normal = [];\n var uv = [];\n var len = 0;\n for (var v = 0; v < ringVertexCount; v++) {\n var next = (v + 1) % ringVertexCount;\n\n var dx = (polygon.points[next * 3] - polygon.points[v * 3]) * scale[0];\n var dy = (polygon.points[next * 3 + 2] - polygon.points[v * 3 + 2]) * scale[sideCoordIndex];\n var sideLen = Math.sqrt(dx * dx + dy * dy);\n\n // 0----1\n // 3----2\n for (var k = 0; k < 4; k++) {\n var isCurrent = (k === 0 || k === 3);\n var idx3 = (isCurrent ? v : next) * 3;\n quadPos[k][0] = polygon.points[idx3];\n quadPos[k][extrudeCoordIndex] = k > 1 ? regionHeight : 0;\n quadPos[k][sideCoordIndex] = polygon.points[idx3 + 2];\n\n positionAttr.set(vertexOffset + k, quadPos[k]);\n\n if (projectUVOnGround) {\n uv[0] = (polygon.points[idx3] * scale[0] - min[0]) / maxDimSize;\n uv[1] = (polygon.points[idx3 + 2] * scale[sideCoordIndex] - min[sideCoordIndex]) / maxDimSize;\n }\n else {\n uv[0] = (isCurrent ? len : (len + sideLen)) / maxDimSize;\n uv[1] = (quadPos[k][extrudeCoordIndex] * scale[extrudeCoordIndex] - min[extrudeCoordIndex]) / maxDimSize;\n }\n texcoordAttr.set(vertexOffset + k, uv);\n }\n vec3.sub(a, quadPos[1], quadPos[0]);\n vec3.sub(b, quadPos[3], quadPos[0]);\n vec3.cross(normal, a, b);\n vec3.normalize(normal, normal);\n\n for (var k = 0; k < 4; k++) {\n normalAttr.set(vertexOffset + k, normal);\n if (hasColor) {\n colorAttr.set(vertexOffset + k, color);\n }\n }\n\n for (var k = 0; k < 6; k++) {\n indices[triangleOffset * 3 + k] = quadToTriangle[k] + vertexOffset;\n }\n\n vertexOffset += 4;\n triangleOffset += 2;\n\n len += sideLen;\n }\n }\n\n geometry.dirty();\n\n return {\n vertexOffset: vertexOffset,\n triangleOffset: triangleOffset\n };\n },\n\n _getRegionLinesInfo: function (idx, componentModel, geometry) {\n var vertexCount = 0;\n var triangleCount = 0;\n\n var regionModel = componentModel.getRegionModel(idx);\n var itemStyleModel = regionModel.getModel('itemStyle');\n\n var lineWidth = itemStyleModel.get('borderWidth');\n if (lineWidth > 0) {\n var polygonCoords = componentModel.getRegionPolygonCoords(idx);\n polygonCoords.forEach(function (coords) {\n var exterior = coords.exterior;\n var interiors = coords.interiors;\n vertexCount += geometry.getPolylineVertexCount(exterior);\n triangleCount += geometry.getPolylineTriangleCount(exterior);\n for (var i = 0; i < interiors.length; i++) {\n vertexCount += geometry.getPolylineVertexCount(interiors[i]);\n triangleCount += geometry.getPolylineTriangleCount(interiors[i]);\n }\n }, this);\n }\n\n return {\n vertexCount: vertexCount,\n triangleCount: triangleCount\n };\n\n },\n\n _updateLinesGeometry: function (geometry, componentModel, dataIndex, regionHeight, lineWidth, transform) {\n function convertToPoints3(polygon) {\n var points = new Float64Array(polygon.length * 3);\n var offset = 0;\n var pos = [];\n for (var i = 0; i < polygon.length; i++) {\n pos[0] = polygon[i][0];\n // Add a offset to avoid z-fighting\n pos[1] = regionHeight + 0.1;\n pos[2] = polygon[i][1];\n\n if (transform) {\n vec3.transformMat4(pos, pos, transform);\n }\n\n points[offset++] = pos[0];\n points[offset++] = pos[1];\n points[offset++] = pos[2];\n }\n return points;\n }\n\n var whiteColor = [1, 1, 1, 1];\n var coords = componentModel.getRegionPolygonCoords(dataIndex);\n coords.forEach(function (geo) {\n var exterior = geo.exterior;\n var interiors = geo.interiors;\n\n geometry.addPolyline(convertToPoints3(exterior), whiteColor, lineWidth);\n\n for (var i = 0; i < interiors.length; i++) {\n geometry.addPolyline(convertToPoints3(interiors[i]), whiteColor, lineWidth);\n }\n });\n },\n\n highlight: function (dataIndex) {\n var data = this._data;\n if (!data) {\n return;\n }\n\n var itemModel = data.getItemModel(dataIndex);\n var emphasisItemStyleModel = itemModel.getModel(['emphasis', 'itemStyle']);\n var emphasisColor = emphasisItemStyleModel.get('color');\n var emphasisOpacity = retrieve.firstNotNull(\n emphasisItemStyleModel.get('opacity'),\n getItemVisualOpacity(data, dataIndex),\n 1\n );\n if (emphasisColor == null) {\n var color = getItemVisualColor(data, dataIndex);\n emphasisColor = echarts.color.lift(color, -0.4);\n }\n if (emphasisOpacity == null) {\n emphasisOpacity = getItemVisualOpacity(data, dataIndex);\n }\n var colorArr = graphicGL.parseColor(emphasisColor);\n colorArr[3] *= emphasisOpacity;\n\n this._setColorOfDataIndex(data, dataIndex, colorArr);\n },\n\n downplay: function (dataIndex) {\n\n var data = this._data;\n if (!data) {\n return;\n }\n\n var color = retrieve.firstNotNull(\n getItemVisualColor(data, dataIndex),\n data.getItemModel(dataIndex).get(['itemStyle', 'color']),\n '#fff'\n );\n var opacity = retrieve.firstNotNull(getItemVisualOpacity(data, dataIndex), 1);\n\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= opacity;\n\n this._setColorOfDataIndex(data, dataIndex, colorArr);\n },\n\n dispose: function () {\n this._labelsBuilder.dispose();\n },\n\n _setColorOfDataIndex: function (data, dataIndex, colorArr) {\n if (dataIndex < this._startIndex && dataIndex > this._endIndex) {\n return;\n }\n dataIndex -= this._startIndex;\n for (var i = this._vertexRangeOfDataIndex[dataIndex * 2]; i < this._vertexRangeOfDataIndex[dataIndex * 2 + 1]; i++) {\n this._polygonMesh.geometry.attributes.color.set(i, colorArr);\n }\n this._polygonMesh.geometry.dirty();\n this._api.getZr().refresh();\n }\n};\n\nexport default Geo3DBuilder;","import Geo3DBuilder from '../common/Geo3DBuilder';\nimport * as echarts from 'echarts/lib/echarts';\n\nimport graphicGL from '../../util/graphicGL';\nimport OrbitControl from '../../util/OrbitControl';\nimport SceneHelper from '../common/SceneHelper';\n\nexport default echarts.ComponentView.extend({\n\n type: 'geo3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this._geo3DBuilder = new Geo3DBuilder(api);\n this.groupGL = new graphicGL.Node();\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper(this._lightRoot);\n this._sceneHelper.initLight(this._lightRoot);\n\n this._control = new OrbitControl({\n zr: api.getZr()\n });\n this._control.init();\n },\n\n render: function (geo3DModel, ecModel, api) {\n this.groupGL.add(this._geo3DBuilder.rootNode);\n\n var geo3D = geo3DModel.coordinateSystem;\n\n if (!geo3D || !geo3D.viewGL) {\n return;\n }\n\n // Always have light.\n geo3D.viewGL.add(this._lightRoot);\n\n if (geo3DModel.get('show')) {\n geo3D.viewGL.add(this.groupGL);\n }\n else {\n geo3D.viewGL.remove(this.groupGL);\n }\n\n var control = this._control;\n control.setViewGL(geo3D.viewGL);\n\n var viewControlModel = geo3DModel.getModel('viewControl');\n control.setFromViewControlModel(viewControlModel, 0);\n\n this._sceneHelper.setScene(geo3D.viewGL.scene);\n this._sceneHelper.updateLight(geo3DModel);\n\n // Set post effect\n geo3D.viewGL.setPostEffect(geo3DModel.getModel('postEffect'), api);\n geo3D.viewGL.setTemporalSuperSampling(geo3DModel.getModel('temporalSuperSampling'));\n\n // Must update after geo3D.viewGL.setPostEffect\n this._geo3DBuilder.update(geo3DModel, ecModel, api, 0, geo3DModel.getData().count());\n var srgbDefineMethod = geo3D.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._geo3DBuilder.rootNode.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material[srgbDefineMethod]('fragment', 'SRGB_DECODE');\n }\n });\n\n control.off('update');\n control.on('update', function () {\n api.dispatchAction({\n type: 'geo3DChangeCamera',\n alpha: control.getAlpha(),\n beta: control.getBeta(),\n distance: control.getDistance(),\n center: control.getCenter(),\n from: this.uid,\n geo3DId: geo3DModel.id\n });\n });\n control.update();\n },\n\n afterRender: function (geo3DModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n this._sceneHelper.updateAmbientCubemap(renderer, geo3DModel, api);\n\n this._sceneHelper.updateSkybox(renderer, geo3DModel, api);\n },\n\n dispose: function () {\n this._control.dispose();\n this._geo3DBuilder.dispose();\n }\n});","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nvar coordsOffsetMap = {\n '南海诸岛': [32, 80],\n // 全国\n '广东': [0, -10],\n '香港': [10, 5],\n '澳门': [-10, 10],\n //'北京': [-10, 0],\n '天津': [5, 5]\n};\nexport default function fixTextCoords(mapType, region) {\n if (mapType === 'china') {\n var coordFix = coordsOffsetMap[region.name];\n\n if (coordFix) {\n var cp = region.getCenter();\n cp[0] += coordFix[0] / 10.5;\n cp[1] += -coordFix[1] / (10.5 / 0.75);\n region.setCenter(cp);\n }\n }\n}","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nvar geoCoordMap = {\n 'Russia': [100, 60],\n 'United States': [-99, 38],\n 'United States of America': [-99, 38]\n};\nexport default function fixGeoCoords(mapType, region) {\n if (mapType === 'world') {\n var geoCoord = geoCoordMap[region.name];\n\n if (geoCoord) {\n var cp = [geoCoord[0], geoCoord[1]];\n region.setCenter(cp);\n }\n }\n}","import * as echarts from 'echarts/lib/echarts';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\nvar mat4 = glmatrix.mat4;\n\nimport textCoord from 'echarts/lib/coord/geo/fix/textCoord';\nimport geoCoord from 'echarts/lib/coord/geo/fix/geoCoord';\n// Geo fix functions\nvar geoFixFuncs = [textCoord, geoCoord];\n\nfunction Geo3D(name, map, geoJson, specialAreas, nameMap) {\n\n this.name = name;\n\n this.map = map;\n\n this.regionHeight = 0;\n\n this.regions = [];\n\n this._nameCoordMap = {};\n\n this.loadGeoJson(geoJson, specialAreas, nameMap);\n\n this.transform = mat4.identity(new Float64Array(16));\n\n this.invTransform = mat4.identity(new Float64Array(16));\n\n // Which dimension to extrude. Y or Z\n this.extrudeY = true;\n\n this.altitudeAxis;\n}\n\nGeo3D.prototype = {\n\n constructor: Geo3D,\n\n type: 'geo3D',\n\n dimensions: ['lng', 'lat', 'alt'],\n\n containPoint: function () {},\n\n loadGeoJson: function (geoJson, specialAreas, nameMap) {\n var parseGeoJSON = echarts.parseGeoJSON || echarts.parseGeoJson;\n try {\n this.regions = geoJson ? parseGeoJSON(geoJson) : [];\n }\n catch (e) {\n throw 'Invalid geoJson format\\n' + e;\n }\n specialAreas = specialAreas || {};\n nameMap = nameMap || {};\n var regions = this.regions;\n var regionsMap = {};\n for (var i = 0; i < regions.length; i++) {\n var regionName = regions[i].name;\n // Try use the alias in nameMap\n regionName = nameMap[regionName] || regionName;\n regions[i].name = regionName;\n\n regionsMap[regionName] = regions[i];\n // Add geoJson\n this.addGeoCoord(regionName, regions[i].getCenter());\n\n // Some area like Alaska in USA map needs to be tansformed\n // to look better\n var specialArea = specialAreas[regionName];\n if (specialArea) {\n regions[i].transformTo(\n specialArea.left, specialArea.top, specialArea.width, specialArea.height\n );\n }\n }\n\n this._regionsMap = regionsMap;\n\n this._geoRect = null;\n\n geoFixFuncs.forEach(function (fixFunc) {\n fixFunc(this);\n }, this);\n },\n\n getGeoBoundingRect: function () {\n if (this._geoRect) {\n return this._geoRect;\n }\n var rect;\n\n var regions = this.regions;\n for (var i = 0; i < regions.length; i++) {\n var regionRect = regions[i].getBoundingRect();\n rect = rect || regionRect.clone();\n rect.union(regionRect);\n }\n // FIXME Always return new ?\n return (this._geoRect = rect || new echarts.graphic.BoundingRect(0, 0, 0, 0));\n },\n\n /**\n * Add geoCoord for indexing by name\n * @param {string} name\n * @param {Array.} geoCoord\n */\n addGeoCoord: function (name, geoCoord) {\n this._nameCoordMap[name] = geoCoord;\n },\n\n /**\n * @param {string} name\n * @return {module:echarts/coord/geo/Region}\n */\n getRegion: function (name) {\n return this._regionsMap[name];\n },\n\n getRegionByCoord: function (coord) {\n var regions = this.regions;\n for (var i = 0; i < regions.length; i++) {\n if (regions[i].contain(coord)) {\n return regions[i];\n }\n }\n },\n\n setSize: function (width, height, depth) {\n this.size = [width, height, depth];\n\n var rect = this.getGeoBoundingRect();\n\n var scaleX = width / rect.width;\n var scaleZ = -depth / rect.height;\n var translateX = -width / 2 - rect.x * scaleX;\n var translateZ = depth / 2 - rect.y * scaleZ;\n\n var position = this.extrudeY ? [translateX, 0, translateZ] : [translateX, translateZ, 0];\n var scale = this.extrudeY ? [scaleX, 1, scaleZ] : [scaleX, scaleZ, 1];\n\n var m = this.transform;\n mat4.identity(m);\n mat4.translate(m, m, position);\n mat4.scale(m, m, scale);\n\n mat4.invert(this.invTransform, m);\n },\n\n dataToPoint: function (data, out) {\n out = out || [];\n\n var extrudeCoordIndex = this.extrudeY ? 1 : 2;\n var sideCoordIndex = this.extrudeY ? 2 : 1;\n\n var altitudeVal = data[2];\n // PENDING.\n if (isNaN(altitudeVal)) {\n altitudeVal = 0;\n }\n // lng\n out[0] = data[0];\n // lat\n out[sideCoordIndex] = data[1];\n\n if (this.altitudeAxis) {\n out[extrudeCoordIndex] = this.altitudeAxis.dataToCoord(altitudeVal);\n }\n else {\n out[extrudeCoordIndex] = 0;\n }\n // PENDING different region height.\n out[extrudeCoordIndex] += this.regionHeight;\n\n vec3.transformMat4(out, out, this.transform);\n\n return out;\n },\n\n pointToData: function (point, out) {\n // TODO\n }\n};\n\nexport default Geo3D;","import Geo3D from './geo3D/Geo3D';\nimport * as echarts from 'echarts/lib/echarts';\nimport {getLayoutRect} from 'echarts/lib/util/layout';\nimport ViewGL from '../core/ViewGL';\nimport retrieve from '../util/retrieve';\n\nfunction resizeGeo3D(geo3DModel, api) {\n // Use left/top/width/height\n var boxLayoutOption = geo3DModel.getBoxLayoutParams();\n\n var viewport = getLayoutRect(boxLayoutOption, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n\n // Flip Y\n viewport.y = api.getHeight() - viewport.y - viewport.height;\n\n this.viewGL.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, api.getDevicePixelRatio());\n\n var geoRect = this.getGeoBoundingRect();\n var aspect = geoRect.width / geoRect.height * (geo3DModel.get('aspectScale') || 0.75);\n\n var width = geo3DModel.get('boxWidth');\n var depth = geo3DModel.get('boxDepth');\n var height = geo3DModel.get('boxHeight');\n if (height == null) {\n height = 5;\n }\n if (isNaN(width) && isNaN(depth)) {\n // Default to have 100 width\n width = 100;\n }\n if (isNaN(depth)) {\n depth = width / aspect;\n }\n else if (isNaN(width)) {\n width = depth / aspect;\n }\n\n this.setSize(width, height, depth);\n\n this.regionHeight = geo3DModel.get('regionHeight');\n\n if (this.altitudeAxis) {\n this.altitudeAxis.setExtent(0, Math.max(height - this.regionHeight, 0));\n }\n}\n\nfunction updateGeo3D(ecModel, api) {\n\n var altitudeDataExtent = [Infinity, -Infinity];\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.coordinateSystem !== this) {\n return;\n }\n if (seriesModel.type === 'series.map3D') {\n return;\n }\n // Get altitude data extent.\n var data = seriesModel.getData();\n var altDims = seriesModel.coordDimToDataDim('alt');\n var altDim = altDims && altDims[0];\n if (altDim) {\n // TODO altitiude is in coords of lines.\n var dataExtent = data.getDataExtent(altDim, true);\n altitudeDataExtent[0] = Math.min(\n altitudeDataExtent[0], dataExtent[0]\n );\n altitudeDataExtent[1] = Math.max(\n altitudeDataExtent[1], dataExtent[1]\n );\n }\n }, this);\n // Create altitude axis\n if (altitudeDataExtent && isFinite(altitudeDataExtent[1] - altitudeDataExtent[0])) {\n var scale = echarts.helper.createScale(\n altitudeDataExtent, {\n type: 'value',\n // PENDING\n min: 'dataMin',\n max: 'dataMax'\n }\n );\n this.altitudeAxis = new echarts.Axis('altitude', scale);\n // Resize again\n this.resize(this.model, api);\n }\n}\n\n\nif (process.env.NODE_ENV !== 'production') {\n var mapNotExistsError = function (name) {\n console.error('Map ' + name + ' not exists. You can download map file on http://echarts.baidu.com/download-map.html');\n };\n}\n\n\nvar idStart = 0;\n\nvar geo3DCreator = {\n\n dimensions: Geo3D.prototype.dimensions,\n\n create: function (ecModel, api) {\n\n var geo3DList = [];\n\n if (!echarts.getMap) {\n throw new Error('geo3D component depends on geo component');\n }\n\n function createGeo3D(componentModel, idx) {\n\n var geo3D = geo3DCreator.createGeo3D(componentModel);\n\n // FIXME\n componentModel.__viewGL = componentModel.__viewGL || new ViewGL();\n\n geo3D.viewGL = componentModel.__viewGL;\n\n componentModel.coordinateSystem = geo3D;\n geo3D.model = componentModel;\n\n geo3DList.push(geo3D);\n\n // Inject resize\n geo3D.resize = resizeGeo3D;\n geo3D.resize(componentModel, api);\n\n geo3D.update = updateGeo3D;\n }\n\n ecModel.eachComponent('geo3D', function (geo3DModel, idx) {\n createGeo3D(geo3DModel, idx);\n });\n\n ecModel.eachSeriesByType('map3D', function (map3DModel, idx) {\n var coordSys = map3DModel.get('coordinateSystem');\n if (coordSys == null) {\n coordSys = 'geo3D';\n }\n if (coordSys === 'geo3D') {\n createGeo3D(map3DModel, idx);\n }\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === 'geo3D') {\n if (seriesModel.type === 'series.map3D') {\n return;\n }\n var geo3DModel = seriesModel.getReferringComponents('geo3D').models[0];\n if (!geo3DModel) {\n geo3DModel = ecModel.getComponent('geo3D');\n }\n\n if (!geo3DModel) {\n throw new Error('geo \"' + retrieve.firstNotNull(\n seriesModel.get('geo3DIndex'),\n seriesModel.get('geo3DId'),\n 0\n ) + '\" not found');\n }\n\n seriesModel.coordinateSystem = geo3DModel.coordinateSystem;\n }\n });\n\n return geo3DList;\n },\n\n createGeo3D: function (componentModel) {\n\n var mapData = componentModel.get('map');\n var name;\n if (typeof mapData === 'string') {\n name = mapData;\n mapData = echarts.getMap(mapData);\n }\n else {\n if (mapData && mapData.features) {\n mapData = {\n geoJson: mapData\n };\n }\n }\n if (process.env.NODE_ENV !== 'production') {\n if (!mapData) {\n mapNotExistsError(mapData);\n }\n if (!mapData.geoJson.features) {\n throw new Error('Invalid GeoJSON for map3D');\n }\n }\n if (name == null) {\n name = 'GEO_ANONYMOUS_' + idStart++;\n }\n\n return new Geo3D(\n name + idStart++, name,\n mapData && mapData.geoJson, mapData && mapData.specialAreas,\n componentModel.get('nameMap')\n );\n }\n};\n\nexport default geo3DCreator;","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Geo3DModel from './Geo3DModel';\nimport Geo3DView from './Geo3DView';\nimport geo3DCreator from '../../coord/geo3DCreator';\n\nexport function install(registers) {\n registers.registerComponentModel(Geo3DModel);\n registers.registerComponentView(Geo3DView);\n\n registers.registerAction({\n type: 'geo3DChangeCamera',\n event: 'geo3dcamerachanged',\n update: 'series:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'geo3D', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n\n registers.registerCoordinateSystem('geo3D', geo3DCreator);\n\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './geo3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport componentViewControlMixin from '../common/componentViewControlMixin';\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\nimport componentShadingMixin from '../common/componentShadingMixin';\n\n\nfunction defaultId(option, idx) {\n option.id = option.id || option.name || (idx + '');\n}\nvar GlobeModel = echarts.ComponentModel.extend({\n\n type: 'globe',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n init: function () {\n GlobeModel.superApply(this, 'init', arguments);\n\n echarts.util.each(this.option.layers, function (layerOption, idx) {\n echarts.util.merge(layerOption, this.defaultLayerOption);\n defaultId(layerOption, idx);\n }, this);\n },\n\n mergeOption: function (option) {\n // TODO test\n var oldLayers = this.option.layers;\n this.option.layers = null;\n GlobeModel.superApply(this, 'mergeOption', arguments);\n\n function createLayerMap(layers) {\n return echarts.util.reduce(layers, function (obj, layerOption, idx) {\n defaultId(layerOption, idx);\n obj[layerOption.id] = layerOption;\n return obj;\n }, {});\n }\n if (oldLayers && oldLayers.length) {\n var newLayerMap = createLayerMap(option.layers);\n var oldLayerMap = createLayerMap(oldLayers);\n for (var id in newLayerMap) {\n if (oldLayerMap[id]) {\n echarts.util.merge(oldLayerMap[id], newLayerMap[id], true);\n }\n else {\n oldLayers.push(option.layers[id]);\n }\n }\n // Copy back\n this.option.layers = oldLayers;\n }\n // else overwrite\n\n // Set default\n echarts.util.each(this.option.layers, function (layerOption) {\n echarts.util.merge(layerOption, this.defaultLayerOption);\n }, this);\n },\n\n optionUpdated: function () {\n this.updateDisplacementHash();\n },\n\n defaultLayerOption: {\n show: true,\n type: 'overlay'\n },\n\n defaultOption: {\n\n show: true,\n\n zlevel: -10,\n\n // Layout used for viewport\n left: 0,\n top: 0,\n width: '100%',\n height: '100%',\n\n environment: 'auto',\n\n baseColor: '#fff',\n\n // Base albedo texture\n baseTexture: '',\n\n // Height texture for bump mapping and vertex displacement\n heightTexture: '',\n\n // Texture for vertex displacement, default use heightTexture\n displacementTexture: '',\n // Scale of vertex displacement, available only if displacementTexture is set.\n displacementScale: 0,\n\n // Detail of displacement. 'low', 'medium', 'high', 'ultra'\n displacementQuality: 'medium',\n\n // Globe radius\n globeRadius: 100,\n\n // Globe outer radius. Which is max of altitude.\n globeOuterRadius: 150,\n\n // Shading of globe\n shading: 'lambert',\n\n // Extend light\n light: {\n // Main sun light\n main: {\n // Time, default it will use system time\n time: ''\n }\n },\n\n // atmosphere\n atmosphere: {\n show: false,\n offset: 5,\n color: '#ffffff',\n glowPower: 6.0,\n innerGlowPower: 2.0\n },\n\n // light\n // postEffect\n // temporalSuperSampling\n\n viewControl: {\n autoRotate: true,\n\n panSensitivity: 0,\n\n targetCoord: null\n },\n\n\n // {\n // show: true,\n // name: 'cloud',\n // type: 'overlay',\n // shading: 'lambert',\n // distance: 10,\n // texture: ''\n // }\n // {\n // type: 'blend',\n // blendTo: 'albedo'\n // blendType: 'source-over'\n // }\n\n layers: []\n },\n\n setDisplacementData: function (data, width, height) {\n this.displacementData = data;\n this.displacementWidth = width;\n this.displacementHeight = height;\n },\n\n getDisplacementTexture: function () {\n return this.get('displacementTexture') || this.get('heightTexture');\n },\n\n getDisplacemenScale: function () {\n var displacementTexture = this.getDisplacementTexture();\n var displacementScale = this.get('displacementScale');\n if (!displacementTexture || displacementTexture === 'none') {\n displacementScale = 0;\n }\n return displacementScale;\n },\n\n hasDisplacement: function () {\n return this.getDisplacemenScale() > 0;\n },\n\n _displacementChanged: true,\n\n _displacementScale: 0,\n\n updateDisplacementHash: function () {\n var displacementTexture = this.getDisplacementTexture();\n var displacementScale = this.getDisplacemenScale();\n\n this._displacementChanged =\n this._displacementTexture !== displacementTexture\n || this._displacementScale !== displacementScale;\n\n this._displacementTexture = displacementTexture;\n this._displacementScale = displacementScale;\n },\n\n isDisplacementChanged: function () {\n return this._displacementChanged;\n }\n});\n\necharts.util.merge(GlobeModel.prototype, componentViewControlMixin);\necharts.util.merge(GlobeModel.prototype, componentPostEffectMixin);\necharts.util.merge(GlobeModel.prototype, componentLightMixin);\necharts.util.merge(GlobeModel.prototype, componentShadingMixin);\n\nexport default GlobeModel;","/*\n (c) 2011-2014, Vladimir Agafonkin\n SunCalc is a JavaScript library for calculating sun/mooon position and light phases.\n https://github.com/mourner/suncalc\n*/\n\n// shortcuts for easier to read formulas\n\nvar PI = Math.PI,\n sin = Math.sin,\n cos = Math.cos,\n tan = Math.tan,\n asin = Math.asin,\n atan = Math.atan2,\n rad = PI / 180;\n\n// sun calculations are based on http://aa.quae.nl/en/reken/zonpositie.html formulas\n\n\n// date/time constants and conversions\n\nvar dayMs = 1000 * 60 * 60 * 24,\n J1970 = 2440588,\n J2000 = 2451545;\n\nfunction toJulian (date) { return date.valueOf() / dayMs - 0.5 + J1970; }\nfunction toDays (date) { return toJulian(date) - J2000; }\n\n\n// general calculations for position\n\nvar e = rad * 23.4397; // obliquity of the Earth\n\nfunction rightAscension(l, b) { return atan(sin(l) * cos(e) - tan(b) * sin(e), cos(l)); }\nfunction declination(l, b) { return asin(sin(b) * cos(e) + cos(b) * sin(e) * sin(l)); }\n\nfunction azimuth(H, phi, dec) { return atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi)); }\nfunction altitude(H, phi, dec) { return asin(sin(phi) * sin(dec) + cos(phi) * cos(dec) * cos(H)); }\n\nfunction siderealTime(d, lw) { return rad * (280.16 + 360.9856235 * d) - lw; }\n\n\n// general sun calculations\n\nfunction solarMeanAnomaly(d) { return rad * (357.5291 + 0.98560028 * d); }\n\nfunction eclipticLongitude(M) {\n\n var C = rad * (1.9148 * sin(M) + 0.02 * sin(2 * M) + 0.0003 * sin(3 * M)), // equation of center\n P = rad * 102.9372; // perihelion of the Earth\n\n return M + C + P + PI;\n}\n\nfunction sunCoords(d) {\n\n var M = solarMeanAnomaly(d),\n L = eclipticLongitude(M);\n\n return {\n dec: declination(L, 0),\n ra: rightAscension(L, 0)\n };\n}\n\nvar SunCalc = {};\n\n// calculates sun position for a given date and latitude/longitude\n\nSunCalc.getPosition = function (date, lat, lng) {\n\n var lw = rad * -lng,\n phi = rad * lat,\n d = toDays(date),\n\n c = sunCoords(d),\n H = siderealTime(d, lw) - c.ra;\n\n return {\n azimuth: azimuth(H, phi, c.dec),\n altitude: altitude(H, phi, c.dec)\n };\n};\n\nexport default SunCalc;","export default \"@export ecgl.atmosphere.vertex\\nattribute vec3 position: POSITION;\\nattribute vec3 normal : NORMAL;\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\\n\\nvarying vec3 v_Normal;\\n\\nvoid main() {\\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n}\\n@end\\n\\n\\n@export ecgl.atmosphere.fragment\\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\\nuniform float glowPower;\\nuniform vec3 glowColor;\\n\\nvarying vec3 v_Normal;\\n\\nvoid main() {\\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\\n gl_FragColor = vec4(glowColor, intensity * intensity);\\n}\\n@end\";\n","import * as echarts from 'echarts/lib/echarts';\n\nimport graphicGL from '../../util/graphicGL';\nimport OrbitControl from '../../util/OrbitControl';\nimport SceneHelper from '../common/SceneHelper';\n\nimport sunCalc from '../../util/sunCalc';\nimport retrieve from '../../util/retrieve';\n\nimport utilShaderCode from 'claygl/src/shader/source/util.glsl.js';\nimport atmosphereShaderCode from './atmosphere.glsl.js';\n\ngraphicGL.Shader['import'](utilShaderCode);\ngraphicGL.Shader['import'](atmosphereShaderCode);\n\nexport default echarts.ComponentView.extend({\n\n type: 'globe',\n\n __ecgl__: true,\n\n _displacementScale: 0,\n\n init: function (ecModel, api) {\n this.groupGL = new graphicGL.Node();\n\n /**\n * @type {clay.geometry.Sphere}\n * @private\n */\n this._sphereGeometry = new graphicGL.SphereGeometry({\n widthSegments: 200,\n heightSegments: 100,\n dynamic: true\n });\n this._overlayGeometry = new graphicGL.SphereGeometry({\n widthSegments: 80,\n heightSegments: 40\n });\n\n /**\n * @type {clay.geometry.Plane}\n */\n this._planeGeometry = new graphicGL.PlaneGeometry();\n\n /**\n * @type {clay.geometry.Mesh}\n */\n this._earthMesh = new graphicGL.Mesh({\n renderNormal: true\n });\n\n /**\n * @type {clay.geometry.Mesh}\n */\n this._atmosphereMesh = new graphicGL.Mesh();\n this._atmosphereGeometry = new graphicGL.SphereGeometry({\n widthSegments: 80,\n heightSegments: 40\n });\n this._atmosphereMaterial = new graphicGL.Material({\n shader: new graphicGL.Shader(\n graphicGL.Shader.source('ecgl.atmosphere.vertex'),\n graphicGL.Shader.source('ecgl.atmosphere.fragment')\n ),\n transparent: true\n });\n this._atmosphereMesh.geometry = this._atmosphereGeometry;\n this._atmosphereMesh.material = this._atmosphereMaterial;\n this._atmosphereMesh.frontFace = graphicGL.Mesh.CW;\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper();\n this._sceneHelper.initLight(this._lightRoot);\n\n this.groupGL.add(this._atmosphereMesh);\n this.groupGL.add(this._earthMesh);\n\n this._control = new OrbitControl({\n zr: api.getZr()\n });\n\n this._control.init();\n\n this._layerMeshes = {};\n },\n\n render: function (globeModel, ecModel, api) {\n var coordSys = globeModel.coordinateSystem;\n var shading = globeModel.get('shading');\n\n // Always have light.\n coordSys.viewGL.add(this._lightRoot);\n\n if (globeModel.get('show')) {\n // Add self to scene;\n coordSys.viewGL.add(this.groupGL);\n }\n else {\n coordSys.viewGL.remove(this.groupGL);\n }\n\n this._sceneHelper.setScene(coordSys.viewGL.scene);\n\n // Set post effect\n coordSys.viewGL.setPostEffect(globeModel.getModel('postEffect'), api);\n coordSys.viewGL.setTemporalSuperSampling(globeModel.getModel('temporalSuperSampling'));\n\n var earthMesh = this._earthMesh;\n\n earthMesh.geometry = this._sphereGeometry;\n\n var shadingPrefix = 'ecgl.' + shading;\n if (!earthMesh.material || earthMesh.material.shader.name !== shadingPrefix) {\n earthMesh.material = graphicGL.createMaterial(shadingPrefix);\n }\n\n graphicGL.setMaterialFromModel(\n shading, earthMesh.material, globeModel, api\n );\n ['roughnessMap', 'metalnessMap', 'detailMap', 'normalMap'].forEach(function (texName) {\n var texture = earthMesh.material.get(texName);\n if (texture) {\n texture.flipY = false;\n }\n });\n\n earthMesh.material.set('color', graphicGL.parseColor(\n globeModel.get('baseColor')\n ));\n\n // shrink a little\n var scale = coordSys.radius * 0.99;\n earthMesh.scale.set(scale, scale, scale);\n\n if (globeModel.get('atmosphere.show')) {\n earthMesh.material.define('both', 'ATMOSPHERE_ENABLED');\n this._atmosphereMesh.invisible = false;\n this._atmosphereMaterial.setUniforms({\n glowPower: globeModel.get('atmosphere.glowPower') || 6.0,\n glowColor: globeModel.get('atmosphere.color') || '#ffffff'\n });\n earthMesh.material.setUniforms({\n glowPower: globeModel.get('atmosphere.innerGlowPower') || 2.0,\n glowColor: globeModel.get('atmosphere.color') || '#ffffff'\n });\n var offset = globeModel.get('atmosphere.offset') || 5;\n this._atmosphereMesh.scale.set(scale + offset, scale + offset, scale + offset);\n }\n else {\n earthMesh.material.undefine('both', 'ATMOSPHERE_ENABLED');\n this._atmosphereMesh.invisible = true;\n }\n\n var diffuseTexture = earthMesh.material.setTextureImage('diffuseMap', globeModel.get('baseTexture'), api, {\n flipY: false,\n anisotropic: 8\n });\n if (diffuseTexture && diffuseTexture.surface) {\n diffuseTexture.surface.attachToMesh(earthMesh);\n }\n\n // Update bump map\n var bumpTexture = earthMesh.material.setTextureImage('bumpMap', globeModel.get('heightTexture'), api, {\n flipY: false,\n anisotropic: 8\n });\n if (bumpTexture && bumpTexture.surface) {\n bumpTexture.surface.attachToMesh(earthMesh);\n }\n\n earthMesh.material[globeModel.get('postEffect.enable') ? 'define' : 'undefine']('fragment', 'SRGB_DECODE');\n\n this._updateLight(globeModel, api);\n\n this._displaceVertices(globeModel, api);\n\n this._updateViewControl(globeModel, api);\n\n this._updateLayers(globeModel, api);\n },\n\n afterRender: function (globeModel, ecModel, api, layerGL) {\n // Create ambient cubemap after render because we need to know the renderer.\n // TODO\n var renderer = layerGL.renderer;\n\n this._sceneHelper.updateAmbientCubemap(renderer, globeModel, api);\n\n this._sceneHelper.updateSkybox(renderer, globeModel, api);\n },\n\n\n _updateLayers: function (globeModel, api) {\n var coordSys = globeModel.coordinateSystem;\n var layers = globeModel.get('layers');\n\n var lastDistance = coordSys.radius;\n var layerDiffuseTextures = [];\n var layerDiffuseIntensity = [];\n\n var layerEmissiveTextures = [];\n var layerEmissionIntensity = [];\n echarts.util.each(layers, function (layerOption) {\n var layerModel = new echarts.Model(layerOption);\n var layerType = layerModel.get('type');\n\n var texture = graphicGL.loadTexture(layerModel.get('texture'), api, {\n flipY: false,\n anisotropic: 8\n });\n if (texture.surface) {\n texture.surface.attachToMesh(this._earthMesh);\n }\n\n if (layerType === 'blend') {\n var blendTo = layerModel.get('blendTo');\n var intensity = retrieve.firstNotNull(layerModel.get('intensity'), 1.0);\n if (blendTo === 'emission') {\n layerEmissiveTextures.push(texture);\n layerEmissionIntensity.push(intensity);\n }\n else { // Default is albedo\n layerDiffuseTextures.push(texture);\n layerDiffuseIntensity.push(intensity);\n }\n }\n else { // Default use overlay\n var id = layerModel.get('id');\n var overlayMesh = this._layerMeshes[id];\n if (!overlayMesh) {\n overlayMesh = this._layerMeshes[id] = new graphicGL.Mesh({\n geometry: this._overlayGeometry,\n castShadow: false,\n ignorePicking: true\n });\n }\n var shading = layerModel.get('shading');\n\n if (shading === 'lambert') {\n overlayMesh.material = overlayMesh.__lambertMaterial || new graphicGL.Material({\n autoUpdateTextureStatus: false,\n shader: graphicGL.createShader('ecgl.lambert'),\n transparent: true,\n depthMask: false\n });\n overlayMesh.__lambertMaterial = overlayMesh.material;\n }\n else { // color\n overlayMesh.material = overlayMesh.__colorMaterial || new graphicGL.Material({\n autoUpdateTextureStatus: false,\n shader: graphicGL.createShader('ecgl.color'),\n transparent: true,\n depthMask: false\n });\n overlayMesh.__colorMaterial = overlayMesh.material;\n }\n // overlay should be transparent if texture is not loaded yet.\n overlayMesh.material.enableTexture('diffuseMap');\n\n var distance = layerModel.get('distance');\n // Based on distance of last layer\n var radius = lastDistance + (distance == null ? coordSys.radius / 100 : distance);\n overlayMesh.scale.set(radius, radius, radius);\n\n lastDistance = radius;\n\n // FIXME Exists blink.\n var blankTexture = this._blankTexture || (this._blankTexture = graphicGL.createBlankTexture('rgba(255, 255, 255, 0)'));\n overlayMesh.material.set('diffuseMap', blankTexture);\n\n graphicGL.loadTexture(layerModel.get('texture'), api, {\n flipY: false,\n anisotropic: 8\n }, function (texture) {\n if (texture.surface) {\n texture.surface.attachToMesh(overlayMesh);\n }\n overlayMesh.material.set('diffuseMap', texture);\n api.getZr().refresh();\n });\n\n layerModel.get('show') ? this.groupGL.add(overlayMesh) : this.groupGL.remove(overlayMesh);\n }\n }, this);\n\n var earthMaterial = this._earthMesh.material;\n earthMaterial.define('fragment', 'LAYER_DIFFUSEMAP_COUNT', layerDiffuseTextures.length);\n earthMaterial.define('fragment', 'LAYER_EMISSIVEMAP_COUNT', layerEmissiveTextures.length);\n\n earthMaterial.set('layerDiffuseMap', layerDiffuseTextures);\n earthMaterial.set('layerDiffuseIntensity', layerDiffuseIntensity);\n earthMaterial.set('layerEmissiveMap', layerEmissiveTextures);\n earthMaterial.set('layerEmissionIntensity', layerEmissionIntensity);\n\n var debugWireframeModel = globeModel.getModel('debug.wireframe');\n if (debugWireframeModel.get('show')) {\n earthMaterial.define('both', 'WIREFRAME_TRIANGLE');\n var color = graphicGL.parseColor(\n debugWireframeModel.get('lineStyle.color') || 'rgba(0,0,0,0.5)'\n );\n var width = retrieve.firstNotNull(\n debugWireframeModel.get('lineStyle.width'), 1\n );\n earthMaterial.set('wireframeLineWidth', width);\n earthMaterial.set('wireframeLineColor', color);\n }\n else {\n earthMaterial.undefine('both', 'WIREFRAME_TRIANGLE');\n }\n },\n\n _updateViewControl: function (globeModel, api) {\n var coordSys = globeModel.coordinateSystem;\n // Update camera\n var viewControlModel = globeModel.getModel('viewControl');\n\n var camera = coordSys.viewGL.camera;\n var self = this;\n\n function makeAction() {\n return {\n type: 'globeChangeCamera',\n alpha: control.getAlpha(),\n beta: control.getBeta(),\n distance: control.getDistance() - coordSys.radius,\n center: control.getCenter(),\n from: self.uid,\n globeId: globeModel.id\n };\n }\n\n // Update control\n var control = this._control;\n control.setViewGL(coordSys.viewGL);\n\n var coord = viewControlModel.get('targetCoord');\n var alpha, beta;\n if (coord != null) {\n beta = coord[0] + 90;\n alpha = coord[1];\n }\n\n control.setFromViewControlModel(viewControlModel, {\n baseDistance: coordSys.radius,\n alpha: alpha,\n beta: beta\n });\n\n control.off('update');\n control.on('update', function () {\n api.dispatchAction(makeAction());\n });\n },\n\n _displaceVertices: function (globeModel, api) {\n var displacementQuality = globeModel.get('displacementQuality');\n var showDebugWireframe = globeModel.get('debug.wireframe.show');\n var globe = globeModel.coordinateSystem;\n\n if (!globeModel.isDisplacementChanged()\n && displacementQuality === this._displacementQuality\n && showDebugWireframe === this._showDebugWireframe\n ) {\n return;\n }\n\n this._displacementQuality = displacementQuality;\n this._showDebugWireframe = showDebugWireframe;\n\n var geometry = this._sphereGeometry;\n\n var widthSegments = ({\n low: 100,\n medium: 200,\n high: 400,\n ultra: 800\n })[displacementQuality] || 200;\n var heightSegments = widthSegments / 2;\n if (geometry.widthSegments !== widthSegments || showDebugWireframe) {\n geometry.widthSegments = widthSegments;\n geometry.heightSegments = heightSegments;\n geometry.build();\n }\n\n this._doDisplaceVertices(geometry, globe);\n\n if (showDebugWireframe) {\n geometry.generateBarycentric();\n }\n },\n\n _doDisplaceVertices: function (geometry, globe) {\n var positionArr = geometry.attributes.position.value;\n var uvArr = geometry.attributes.texcoord0.value;\n\n var originalPositionArr = geometry.__originalPosition;\n if (!originalPositionArr || originalPositionArr.length !== positionArr.length) {\n originalPositionArr = new Float32Array(positionArr.length);\n originalPositionArr.set(positionArr);\n geometry.__originalPosition = originalPositionArr;\n }\n\n var width = globe.displacementWidth;\n var height = globe.displacementHeight;\n var data = globe.displacementData;\n\n for (var i = 0; i < geometry.vertexCount; i++) {\n var i3 = i * 3;\n var i2 = i * 2;\n var x = originalPositionArr[i3 + 1];\n var y = originalPositionArr[i3 + 2];\n var z = originalPositionArr[i3 + 3];\n\n var u = uvArr[i2++];\n var v = uvArr[i2++];\n\n var j = Math.round(u * (width - 1));\n var k = Math.round(v * (height - 1));\n var idx = k * width + j;\n var scale = data ? data[idx] : 0;\n\n positionArr[i3 + 1] = x + x * scale;\n positionArr[i3 + 2] = y + y * scale;\n positionArr[i3 + 3] = z + z * scale;\n }\n\n geometry.generateVertexNormals();\n geometry.dirty();\n\n geometry.updateBoundingBox();\n },\n\n _updateLight: function (globeModel, api) {\n var earthMesh = this._earthMesh;\n\n this._sceneHelper.updateLight(globeModel);\n var mainLight = this._sceneHelper.mainLight;\n\n // Put sun in the right position\n var time = globeModel.get('light.main.time') || new Date();\n\n // http://en.wikipedia.org/wiki/Azimuth\n var pos = sunCalc.getPosition(echarts.number.parseDate(time), 0, 0);\n var r0 = Math.cos(pos.altitude);\n // FIXME How to calculate the y ?\n mainLight.position.y = -r0 * Math.cos(pos.azimuth);\n mainLight.position.x = Math.sin(pos.altitude);\n mainLight.position.z = r0 * Math.sin(pos.azimuth);\n mainLight.lookAt(earthMesh.getWorldPosition());\n },\n\n dispose: function (ecModel, api) {\n this.groupGL.removeAll();\n this._control.dispose();\n }\n});","import glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\n\nfunction Globe(radius) {\n\n this.radius = radius;\n\n this.viewGL = null;\n\n this.altitudeAxis;\n\n // Displacement data provided by texture.\n this.displacementData = null;\n this.displacementWidth;\n this.displacementHeight;\n}\n\nGlobe.prototype = {\n\n constructor: Globe,\n\n dimensions: ['lng', 'lat', 'alt'],\n\n type: 'globe',\n\n containPoint: function () {},\n\n setDisplacementData: function (data, width, height) {\n this.displacementData = data;\n this.displacementWidth = width;\n this.displacementHeight = height;\n },\n\n _getDisplacementScale: function (lng, lat) {\n var i = (lng + 180) / 360 * (this.displacementWidth - 1);\n var j = (90 - lat) / 180 * (this.displacementHeight - 1);\n // NEAREST SAMPLING\n // TODO Better bilinear sampling\n var idx = Math.round(i) + Math.round(j) * this.displacementWidth;\n return this.displacementData[idx];\n },\n\n dataToPoint: function (data, out) {\n var lng = data[0];\n var lat = data[1];\n // Default have 0 altitude\n var altVal = data[2] || 0;\n\n var r = this.radius;\n if (this.displacementData) {\n r *= 1 + this._getDisplacementScale(lng, lat);\n }\n if (this.altitudeAxis) {\n r += this.altitudeAxis.dataToCoord(altVal);\n }\n\n lng = lng * Math.PI / 180;\n lat = lat * Math.PI / 180;\n\n var r0 = Math.cos(lat) * r;\n\n out = out || [];\n // PENDING\n out[0] = -r0 * Math.cos(lng + Math.PI);\n out[1] = Math.sin(lat) * r;\n out[2] = r0 * Math.sin(lng + Math.PI);\n\n return out;\n },\n\n pointToData: function (point, out) {\n var x = point[0];\n var y = point[1];\n var z = point[2];\n var len = vec3.len(point);\n x /= len;\n y /= len;\n z /= len;\n\n var theta = Math.asin(y);\n var phi = Math.atan2(z, -x);\n if (phi < 0) {\n phi = Math.PI * 2 + phi;\n }\n\n var lat = theta * 180 / Math.PI;\n var lng = phi * 180 / Math.PI - 180;\n\n out = out || [];\n out[0] = lng;\n out[1] = lat;\n out[2] = len - this.radius;\n if (this.altitudeAxis) {\n out[2] = this.altitudeAxis.coordToData(out[2]);\n }\n\n return out;\n }\n};\n\nexport default Globe;","import Globe from './globe/Globe';\nimport * as echarts from 'echarts/lib/echarts';\nimport {getLayoutRect} from 'echarts/lib/util/layout';\nimport ViewGL from '../core/ViewGL';\nimport retrieve from '../util/retrieve';\nimport graphicGL from '../util/graphicGL';\n\nfunction getDisplacementData(img, displacementScale) {\n var canvas = document.createElement('canvas');\n var ctx = canvas.getContext('2d');\n var width = img.width;\n var height = img.height;\n canvas.width = width;\n canvas.height = height;\n ctx.drawImage(img, 0, 0, width, height);\n var rgbaArr = ctx.getImageData(0, 0, width, height).data;\n\n var displacementArr = new Float32Array(rgbaArr.length / 4);\n for (var i = 0; i < rgbaArr.length / 4; i++) {\n var x = rgbaArr[i * 4];\n displacementArr[i] = x / 255 * displacementScale;\n }\n return {\n data: displacementArr,\n width: width,\n height: height\n };\n}\n\nfunction resizeGlobe(globeModel, api) {\n // Use left/top/width/height\n var boxLayoutOption = globeModel.getBoxLayoutParams();\n\n var viewport = getLayoutRect(boxLayoutOption, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n\n // Flip Y\n viewport.y = api.getHeight() - viewport.y - viewport.height;\n\n this.viewGL.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, api.getDevicePixelRatio());\n\n this.radius = globeModel.get('globeRadius');\n\n var outerRadius = globeModel.get('globeOuterRadius');\n if (this.altitudeAxis) {\n this.altitudeAxis.setExtent(0, outerRadius - this.radius);\n }\n}\n\nfunction updateGlobe(ecModel, api) {\n\n var altitudeDataExtent = [Infinity, -Infinity];\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.coordinateSystem !== this) {\n return;\n }\n\n // Get altitude data extent.\n var data = seriesModel.getData();\n var altDims = seriesModel.coordDimToDataDim('alt');\n var altDim = altDims && altDims[0];\n if (altDim) {\n // TODO altitiude is in coords of lines.\n var dataExtent = data.getDataExtent(altDim, true);\n altitudeDataExtent[0] = Math.min(\n altitudeDataExtent[0], dataExtent[0]\n );\n altitudeDataExtent[1] = Math.max(\n altitudeDataExtent[1], dataExtent[1]\n );\n }\n }, this);\n // Create altitude axis\n if (altitudeDataExtent && isFinite(altitudeDataExtent[1] - altitudeDataExtent[0])) {\n var scale = echarts.helper.createScale(\n altitudeDataExtent, {\n type: 'value',\n // PENDING\n min: 'dataMin',\n max: 'dataMax'\n }\n );\n this.altitudeAxis = new echarts.Axis('altitude', scale);\n // Resize again\n this.resize(this.model, api);\n }\n}\n\nvar globeCreator = {\n\n dimensions: Globe.prototype.dimensions,\n\n create: function (ecModel, api) {\n\n var globeList = [];\n\n ecModel.eachComponent('globe', function (globeModel) {\n\n // FIXME\n globeModel.__viewGL = globeModel.__viewGL || new ViewGL();\n\n var globe = new Globe();\n globe.viewGL = globeModel.__viewGL;\n\n globeModel.coordinateSystem = globe;\n globe.model = globeModel;\n globeList.push(globe);\n\n // Inject resize\n globe.resize = resizeGlobe;\n globe.resize(globeModel, api);\n\n globe.update = updateGlobe;\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === 'globe') {\n var globeModel = seriesModel.getReferringComponents('globe').models[0];\n if (!globeModel) {\n globeModel = ecModel.getComponent('globe');\n }\n\n if (!globeModel) {\n throw new Error('globe \"' + retrieve.firstNotNull(\n seriesModel.get('globe3DIndex'),\n seriesModel.get('globe3DId'),\n 0\n ) + '\" not found');\n }\n\n var coordSys = globeModel.coordinateSystem;\n\n seriesModel.coordinateSystem = coordSys;\n }\n });\n\n ecModel.eachComponent('globe', function (globeModel, idx) {\n var globe = globeModel.coordinateSystem;\n\n // Update displacement data\n var displacementTextureValue = globeModel.getDisplacementTexture();\n var displacementScale = globeModel.getDisplacemenScale();\n\n if (globeModel.isDisplacementChanged()) {\n if (globeModel.hasDisplacement()) {\n var immediateLoaded = true;\n graphicGL.loadTexture(displacementTextureValue, api, function (texture) {\n var img = texture.image;\n var displacementData = getDisplacementData(img, displacementScale);\n globeModel.setDisplacementData(displacementData.data, displacementData.width, displacementData.height);\n if (!immediateLoaded) {\n // Update layouts\n api.dispatchAction({\n type: 'globeUpdateDisplacment'\n });\n }\n });\n immediateLoaded = false;\n }\n else {\n globe.setDisplacementData(null, 0, 0);\n }\n\n globe.setDisplacementData(\n globeModel.displacementData, globeModel.displacementWidth, globeModel.displacementHeight\n );\n }\n });\n\n return globeList;\n }\n};\n\nexport default globeCreator;","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport GlobeModel from './GlobeModel';\nimport GlobeView from './GlobeView';\nimport globeCreator from '../../coord/globeCreator';\n\nexport function install(registers) {\n registers.registerComponentModel(GlobeModel);\n registers.registerComponentView(GlobeView);\n\n registers.registerCoordinateSystem('globe', globeCreator);\n\n registers.registerAction({\n type: 'globeChangeCamera',\n event: 'globecamerachanged',\n update: 'series:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'globe', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n\n registers.registerAction({\n type: 'globeUpdateDisplacment',\n event: 'globedisplacementupdated',\n update: 'update'\n }, function (payload, ecModel) {\n // Noop\n });\n\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './globe/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\n\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\n\nvar MAPBOX_CAMERA_OPTION = ['zoom', 'center', 'pitch', 'bearing'];\n\nvar Mapbox3DModel = echarts.ComponentModel.extend({\n\n type: 'mapbox3D',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n defaultOption: {\n zlevel: -10,\n\n style: 'mapbox://styles/mapbox/light-v9',\n\n center: [0, 0],\n\n zoom: 0,\n\n pitch: 0,\n\n bearing: 0,\n\n light: {\n main: {\n alpha: 20,\n beta: 30\n }\n },\n\n altitudeScale: 1,\n // Default depend on altitudeScale\n boxHeight: 'auto'\n },\n\n getMapboxCameraOption: function () {\n var self = this;\n return MAPBOX_CAMERA_OPTION.reduce(function (obj, key) {\n obj[key] = self.get(key);\n return obj;\n }, {});\n },\n\n setMapboxCameraOption: function (option) {\n if (option != null) {\n MAPBOX_CAMERA_OPTION.forEach(function (key) {\n if (option[key] != null) {\n this.option[key] = option[key];\n }\n }, this);\n }\n },\n\n /**\n * Get mapbox instance\n */\n getMapbox: function () {\n return this._mapbox;\n },\n\n setMapbox: function (mapbox) {\n this._mapbox = mapbox;\n }\n});\n\necharts.util.merge(Mapbox3DModel.prototype, componentPostEffectMixin);\necharts.util.merge(Mapbox3DModel.prototype, componentLightMixin);\n\nexport default Mapbox3DModel;","/**\n * @constructor\n * @alias module:echarts-gl/component/mapbox3D/Mapbox3DLayer\n * @param {string} id Layer ID\n * @param {module:zrender/ZRender} zr\n */\nfunction Mapbox3DLayer (id, zr) {\n this.id = id;\n this.zr = zr;\n\n this.dom = document.createElement('div');\n this.dom.style.cssText = 'position:absolute;left:0;right:0;top:0;bottom:0;';\n\n // FIXME If in module environment.\n if (!mapboxgl) {\n throw new Error('Mapbox GL library must be included. See https://www.mapbox.com/mapbox-gl-js/api/');\n }\n\n this._mapbox = new mapboxgl.Map({\n container: this.dom\n });\n\n // Proxy events\n this._initEvents();\n\n}\n\nMapbox3DLayer.prototype.setUnpainted = function () {};\nMapbox3DLayer.prototype.resize = function () {\n this._mapbox.resize();\n};\n\nMapbox3DLayer.prototype.getMapbox = function () {\n return this._mapbox;\n};\n\nMapbox3DLayer.prototype.clear = function () {};\nMapbox3DLayer.prototype.refresh = function () {\n this._mapbox.resize();\n};\n\nvar EVENTS = ['mousedown', 'mouseup', 'click', 'dblclick', 'mousemove',\n 'mousewheel', 'wheel',\n 'touchstart', 'touchend', 'touchmove', 'touchcancel'\n];\nMapbox3DLayer.prototype._initEvents = function () {\n // Event is bound on canvas container.\n var mapboxRoot = this._mapbox.getCanvasContainer();\n this._handlers = this._handlers || {\n contextmenu: function (e) {\n e.preventDefault();\n return false;\n }\n };\n EVENTS.forEach(function (eName) {\n this._handlers[eName] = function (e) {\n var obj = {};\n for (var name in e) {\n obj[name] = e[name];\n }\n obj.bubbles = false;\n var newE = new e.constructor(e.type, obj);\n mapboxRoot.dispatchEvent(newE);\n };\n this.zr.dom.addEventListener(eName, this._handlers[eName]);\n }, this);\n\n // PENDING\n this.zr.dom.addEventListener('contextmenu', this._handlers.contextmenu);\n};\n\nMapbox3DLayer.prototype.dispose = function () {\n EVENTS.forEach(function (eName) {\n this.zr.dom.removeEventListener(eName, this._handlers[eName]);\n }, this);\n};\n\nexport default Mapbox3DLayer;","export default \"\\n@export ecgl.displayShadow.vertex\\n\\n@import ecgl.common.transformUniforms\\n\\n@import ecgl.common.uv.header\\n\\n@import ecgl.common.attributes\\n\\nvarying vec3 v_WorldPosition;\\n\\nvarying vec3 v_Normal;\\n\\nvoid main()\\n{\\n @import ecgl.common.uv.main\\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\\n\\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\\n gl_Position = worldViewProjection * vec4(position, 1.0);\\n}\\n\\n@end\\n\\n\\n@export ecgl.displayShadow.fragment\\n\\n@import ecgl.common.uv.fragmentHeader\\n\\nvarying vec3 v_Normal;\\nvarying vec3 v_WorldPosition;\\n\\nuniform float roughness: 0.2;\\n\\n#ifdef DIRECTIONAL_LIGHT_COUNT\\n@import clay.header.directional_light\\n#endif\\n\\n@import ecgl.common.ssaoMap.header\\n\\n@import clay.plugin.compute_shadow_map\\n\\nvoid main()\\n{\\n float shadow = 1.0;\\n\\n @import ecgl.common.ssaoMap.main\\n\\n#if defined(DIRECTIONAL_LIGHT_COUNT) && defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\\n if(shadowEnabled)\\n {\\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\\n }\\n for (int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++) {\\n shadow = min(shadow, shadowContribsDir[i] * 0.5 + 0.5);\\n }\\n#endif\\n\\n shadow *= 0.5 + ao * 0.5;\\n shadow = clamp(shadow, 0.0, 1.0);\\n\\n gl_FragColor = vec4(vec3(0.0), 1.0 - shadow);\\n}\\n\\n@end\";\n","import * as echarts from 'echarts/lib/echarts';\nimport Mapbox3DLayer from './Mapbox3DLayer';\nimport SceneHelper from '../common/SceneHelper';\nimport graphicGL from '../../util/graphicGL';\n\nimport displayShadowGLSL from '../../util/shader/displayShadow.glsl.js';\n\ngraphicGL.Shader.import(displayShadowGLSL);\n\nvar TILE_SIZE = 512;\n\nexport default echarts.ComponentView.extend({\n\n type: 'mapbox3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n var zr = api.getZr();\n this._zrLayer = new Mapbox3DLayer('mapbox3D', zr);\n zr.painter.insertLayer(-1000, this._zrLayer);\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper(this._lightRoot);\n this._sceneHelper.initLight(this._lightRoot);\n\n var mapbox = this._zrLayer.getMapbox();\n var dispatchInteractAction = this._dispatchInteractAction.bind(this, api, mapbox);\n\n // PENDING\n ['zoom', 'rotate', 'drag', 'pitch', 'rotate', 'move'].forEach(function (eName) {\n mapbox.on(eName, dispatchInteractAction);\n });\n\n this._groundMesh = new graphicGL.Mesh({\n geometry: new graphicGL.PlaneGeometry(),\n material: new graphicGL.Material({\n shader: new graphicGL.Shader({\n vertex: graphicGL.Shader.source('ecgl.displayShadow.vertex'),\n fragment: graphicGL.Shader.source('ecgl.displayShadow.fragment')\n }),\n depthMask: false\n }),\n // Render first\n renderOrder: -100,\n culling: false,\n castShadow: false,\n $ignorePicking: true,\n renderNormal: true\n });\n },\n\n render: function (mapbox3DModel, ecModel, api) {\n var mapbox = this._zrLayer.getMapbox();\n var styleDesc = mapbox3DModel.get('style');\n\n var styleStr = JSON.stringify(styleDesc);\n if (styleStr !== this._oldStyleStr) {\n if (styleDesc) {\n mapbox.setStyle(styleDesc);\n }\n }\n this._oldStyleStr = styleStr;\n\n mapbox.setCenter(mapbox3DModel.get('center'));\n mapbox.setZoom(mapbox3DModel.get('zoom'));\n mapbox.setPitch(mapbox3DModel.get('pitch'));\n mapbox.setBearing(mapbox3DModel.get('bearing'));\n\n mapbox3DModel.setMapbox(mapbox);\n\n var coordSys = mapbox3DModel.coordinateSystem;\n\n // Not add to rootNode. Or light direction will be stretched by rootNode scale\n coordSys.viewGL.scene.add(this._lightRoot);\n coordSys.viewGL.add(this._groundMesh);\n\n this._updateGroundMesh();\n\n // Update lights\n this._sceneHelper.setScene(coordSys.viewGL.scene);\n this._sceneHelper.updateLight(mapbox3DModel);\n\n // Update post effects\n coordSys.viewGL.setPostEffect(mapbox3DModel.getModel('postEffect'), api);\n coordSys.viewGL.setTemporalSuperSampling(mapbox3DModel.getModel('temporalSuperSampling'));\n\n this._mapbox3DModel = mapbox3DModel;\n },\n\n afterRender: function (mapbox3DModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n this._sceneHelper.updateAmbientCubemap(renderer, mapbox3DModel, api);\n this._sceneHelper.updateSkybox(renderer, mapbox3DModel, api);\n\n // FIXME If other series changes coordinate system.\n // FIXME When doing progressive rendering.\n mapbox3DModel.coordinateSystem.viewGL.scene.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material.define('fragment', 'NORMAL_UP_AXIS', 2);\n mesh.material.define('fragment', 'NORMAL_FRONT_AXIS', 1);\n }\n });\n },\n\n updateCamera: function (mapbox3DModel, ecModel, api, payload) {\n mapbox3DModel.coordinateSystem.setCameraOption(payload);\n\n this._updateGroundMesh();\n\n api.getZr().refresh();\n },\n\n _dispatchInteractAction: function (api, mapbox, mapbox3DModel) {\n api.dispatchAction({\n type: 'mapbox3DChangeCamera',\n pitch: mapbox.getPitch(),\n zoom: mapbox.getZoom(),\n center: mapbox.getCenter().toArray(),\n bearing: mapbox.getBearing(),\n mapbox3DId: this._mapbox3DModel && this._mapbox3DModel.id\n });\n },\n\n _updateGroundMesh: function () {\n if (this._mapbox3DModel) {\n var coordSys = this._mapbox3DModel.coordinateSystem;\n var pt = coordSys.dataToPoint(coordSys.center);\n this._groundMesh.position.set(pt[0], pt[1], -0.001);\n\n var plane = new graphicGL.Plane(new graphicGL.Vector3(0, 0, 1), 0);\n var ray1 = coordSys.viewGL.camera.castRay(new graphicGL.Vector2(-1, -1));\n var ray2 = coordSys.viewGL.camera.castRay(new graphicGL.Vector2(1, 1));\n var pos0 = ray1.intersectPlane(plane);\n var pos1 = ray2.intersectPlane(plane);\n var scale = pos0.dist(pos1) / coordSys.viewGL.rootNode.scale.x;\n this._groundMesh.scale.set(scale, scale, 1);\n }\n },\n\n dispose: function (ecModel, api) {\n if (this._zrLayer) {\n this._zrLayer.dispose();\n }\n api.getZr().painter.delLayer(-1000);\n }\n});","import glmatrix from 'claygl/src/dep/glmatrix';\nvar mat4 = glmatrix.mat4;\n\nvar TILE_SIZE = 512;\nvar FOV = 0.6435011087932844;\nvar PI = Math.PI;\n\nvar WORLD_SCALE = 1 / 10;\n\nfunction MapServiceCoordSys3D() {\n /**\n * Width of mapbox viewport\n */\n this.width = 0;\n /**\n * Height of mapbox viewport\n */\n this.height = 0;\n\n this.altitudeScale = 1;\n\n // TODO Change boxHeight won't have animation.\n this.boxHeight = 'auto';\n\n // Set by mapbox creator\n this.altitudeExtent;\n\n this.bearing = 0;\n this.pitch = 0;\n this.center = [0, 0];\n\n this._origin;\n\n this.zoom = 0;\n this._initialZoom;\n\n // Some parameters for different map services.\n this.maxPitch = 60;\n this.zoomOffset = 0;\n}\n\nMapServiceCoordSys3D.prototype = {\n\n constructor: MapServiceCoordSys3D,\n\n dimensions: ['lng', 'lat', 'alt'],\n\n containPoint: function () {},\n\n setCameraOption: function (option) {\n this.bearing = option.bearing;\n this.pitch = option.pitch;\n\n this.center = option.center;\n this.zoom = option.zoom;\n\n if (!this._origin) {\n this._origin = this.projectOnTileWithScale(this.center, TILE_SIZE);\n }\n if (this._initialZoom == null) {\n this._initialZoom = this.zoom;\n }\n\n this.updateTransform();\n },\n\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/geo/transform.js#L479\n updateTransform: function () {\n if (!this.height) { return; }\n\n var cameraToCenterDistance = 0.5 / Math.tan(FOV / 2) * this.height * WORLD_SCALE;\n // Convert to radian.\n var pitch = Math.max(Math.min(this.pitch, this.maxPitch), 0) / 180 * Math.PI;\n\n // Find the distance from the center point [width/2, height/2] to the\n // center top point [width/2, 0] in Z units, using the law of sines.\n // 1 Z unit is equivalent to 1 horizontal px at the center of the map\n // (the distance between[width/2, height/2] and [width/2 + 1, height/2])\n var halfFov = FOV / 2;\n var groundAngle = Math.PI / 2 + pitch;\n var topHalfSurfaceDistance = Math.sin(halfFov) * cameraToCenterDistance / Math.sin(Math.PI - groundAngle - halfFov);\n\n // Calculate z distance of the farthest fragment that should be rendered.\n var furthestDistance = Math.cos(Math.PI / 2 - pitch) * topHalfSurfaceDistance + cameraToCenterDistance;\n // Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance`\n var farZ = furthestDistance * 1.1;\n // Forced to be 1000\n if (this.pitch > 50) {\n farZ = 1000;\n }\n\n // matrix for conversion from location to GL coordinates (-1 .. 1)\n var m = [];\n mat4.perspective(m, FOV, this.width / this.height, 1, farZ);\n this.viewGL.camera.projectionMatrix.setArray(m);\n this.viewGL.camera.decomposeProjectionMatrix();\n\n var m = mat4.identity([]);\n var pt = this.dataToPoint(this.center);\n // Inverse\n mat4.scale(m, m, [1, -1, 1]);\n // Translate to altitude\n mat4.translate(m, m, [0, 0, -cameraToCenterDistance]);\n mat4.rotateX(m, m, pitch);\n mat4.rotateZ(m, m, -this.bearing / 180 * Math.PI);\n // Translate to center.\n mat4.translate(m, m, [-pt[0] * this.getScale() * WORLD_SCALE, -pt[1] * this.getScale() * WORLD_SCALE, 0]);\n\n this.viewGL.camera.viewMatrix.array = m;\n var invertM = [];\n mat4.invert(invertM, m);\n this.viewGL.camera.worldTransform.array = invertM;\n this.viewGL.camera.decomposeWorldTransform();\n\n // scale vertically to meters per pixel (inverse of ground resolution):\n // worldSize / (circumferenceOfEarth * cos(lat * π / 180))\n var worldSize = TILE_SIZE * this.getScale();\n var verticalScale;\n\n if (this.altitudeExtent && !isNaN(this.boxHeight)) {\n var range = this.altitudeExtent[1] - this.altitudeExtent[0];\n verticalScale = this.boxHeight / range * this.getScale() / Math.pow(2, this._initialZoom - this.zoomOffset);\n }\n else {\n verticalScale = worldSize / (2 * Math.PI * 6378000 * Math.abs(Math.cos(this.center[1] * (Math.PI / 180))))\n * this.altitudeScale * WORLD_SCALE;\n }\n // Include scale to avoid relayout when zooming\n // FIXME Camera scale may have problem in shadow\n this.viewGL.rootNode.scale.set(\n this.getScale() * WORLD_SCALE, this.getScale() * WORLD_SCALE, verticalScale\n );\n },\n\n getScale: function () {\n return Math.pow(2, this.zoom - this.zoomOffset);\n },\n\n projectOnTile: function (data, out) {\n return this.projectOnTileWithScale(data, this.getScale() * TILE_SIZE, out);\n },\n\n projectOnTileWithScale: function (data, scale, out) {\n var lng = data[0];\n var lat = data[1];\n var lambda2 = lng * PI / 180;\n var phi2 = lat * PI / 180;\n var x = scale * (lambda2 + PI) / (2 * PI);\n var y = scale * (PI - Math.log(Math.tan(PI / 4 + phi2 * 0.5))) / (2 * PI);\n out = out || [];\n out[0] = x;\n out[1] = y;\n return out;\n },\n\n unprojectFromTile: function (point, out) {\n return this.unprojectOnTileWithScale(point, this.getScale() * TILE_SIZE, out);\n },\n\n unprojectOnTileWithScale: function (point, scale, out) {\n var x = point[0];\n var y = point[1];\n var lambda2 = (x / scale) * (2 * PI) - PI;\n var phi2 = 2 * (Math.atan(Math.exp(PI - (y / scale) * (2 * PI))) - PI / 4);\n out = out || [];\n out[0] = lambda2 * 180 / PI;\n out[1] = phi2 * 180 / PI;\n return out;\n },\n\n dataToPoint: function (data, out) {\n out = this.projectOnTileWithScale(data, TILE_SIZE, out);\n // Add a origin to avoid precision issue in WebGL.\n out[0] -= this._origin[0];\n out[1] -= this._origin[1];\n // PENDING\n out[2] = !isNaN(data[2]) ? data[2] : 0;\n if (!isNaN(data[2])) {\n out[2] = data[2];\n if (this.altitudeExtent) {\n out[2] -= this.altitudeExtent[0];\n }\n }\n return out;\n }\n};\n\nexport default MapServiceCoordSys3D;","import MapService3D from '../mapServiceCommon/MapService3D';\n\nfunction Mapbox3D() {\n MapService3D.apply(this, arguments);\n}\n\nMapbox3D.prototype = new MapService3D();\nMapbox3D.prototype.constructor = Mapbox3D;\nMapbox3D.prototype.type = 'mapbox3D';\n\nexport default Mapbox3D;","import retrieve from '../../util/retrieve';\nimport graphicGL from '../../util/graphicGL';\nimport ViewGL from '../../core/ViewGL';\n\nexport default function (serviceComponentType, ServiceCtor, afterCreate) {\n\n function resizeMapService3D(mapService3DModel, api) {\n var width = api.getWidth();\n var height = api.getHeight();\n var dpr = api.getDevicePixelRatio();\n this.viewGL.setViewport(0, 0, width, height, dpr);\n\n this.width = width;\n this.height = height;\n\n this.altitudeScale = mapService3DModel.get('altitudeScale');\n\n this.boxHeight = mapService3DModel.get('boxHeight');\n // this.updateTransform();\n }\n\n\n function updateService3D(ecModel, api) {\n\n if (this.model.get('boxHeight') === 'auto') {\n return;\n }\n\n var altitudeDataExtent = [Infinity, -Infinity]\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.coordinateSystem !== this) {\n return;\n }\n\n // Get altitude data extent.\n var data = seriesModel.getData();\n var altDim = seriesModel.coordDimToDataDim('alt')[0];\n if (altDim) {\n // TODO altitiude is in coords of lines.\n var dataExtent = data.getDataExtent(altDim, true);\n altitudeDataExtent[0] = Math.min(\n altitudeDataExtent[0], dataExtent[0]\n );\n altitudeDataExtent[1] = Math.max(\n altitudeDataExtent[1], dataExtent[1]\n );\n }\n }, this);\n if (altitudeDataExtent && isFinite(altitudeDataExtent[1] - altitudeDataExtent[0])) {\n this.altitudeExtent = altitudeDataExtent;\n }\n }\n\n return {\n\n\n dimensions: ServiceCtor.prototype.dimensions,\n\n create: function (ecModel, api) {\n var mapService3DList = [];\n\n ecModel.eachComponent(serviceComponentType, function (mapService3DModel) {\n var viewGL = mapService3DModel.__viewGL;\n if (!viewGL) {\n viewGL = mapService3DModel.__viewGL = new ViewGL();\n viewGL.setRootNode(new graphicGL.Node());\n }\n\n var mapService3DCoordSys = new ServiceCtor();\n mapService3DCoordSys.viewGL = mapService3DModel.__viewGL;\n // Inject resize\n mapService3DCoordSys.resize = resizeMapService3D;\n mapService3DCoordSys.resize(mapService3DModel, api);\n\n mapService3DList.push(mapService3DCoordSys);\n\n mapService3DModel.coordinateSystem = mapService3DCoordSys;\n mapService3DCoordSys.model = mapService3DModel;\n\n mapService3DCoordSys.update = updateService3D;\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === serviceComponentType) {\n var mapService3DModel = seriesModel.getReferringComponents(serviceComponentType).models[0];\n if (!mapService3DModel) {\n mapService3DModel = ecModel.getComponent(serviceComponentType);\n }\n\n if (!mapService3DModel) {\n throw new Error(serviceComponentType + ' \"' + retrieve.firstNotNull(\n seriesModel.get(serviceComponentType + 'Index'),\n seriesModel.get(serviceComponentType + 'Id'),\n 0\n ) + '\" not found');\n }\n\n seriesModel.coordinateSystem = mapService3DModel.coordinateSystem;\n }\n });\n\n afterCreate && afterCreate(mapService3DList, ecModel, api);\n\n return mapService3DList;\n }\n };\n}\n","import Mapbox3D from './mapbox3D/Mapbox3D';\nimport createMapService3DCreator from './mapServiceCommon/createMapService3DCreator';\n\nvar mapbox3DCreator = createMapService3DCreator('mapbox3D', Mapbox3D, function (mapbox3DList) {\n mapbox3DList.forEach(function (mapbox3D) {\n mapbox3D.setCameraOption(mapbox3D.model.getMapboxCameraOption());\n });\n});\n\nexport default mapbox3DCreator;","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Mapbox3DModel from './Mapbox3DModel';\nimport Mapbox3DView from './Mapbox3DView';\nimport mapbox3DCreator from '../../coord/mapbox3DCreator';\n\nexport function install(registers) {\n registers.registerComponentModel(Mapbox3DModel);\n registers.registerComponentView(Mapbox3DView);\n\n registers.registerCoordinateSystem('mapbox3D', mapbox3DCreator);\n\n registers.registerAction({\n type: 'mapbox3DChangeCamera',\n event: 'mapbox3dcamerachanged',\n update: 'mapbox3D:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'mapbox3D', query: payload\n }, function (componentModel) {\n componentModel.setMapboxCameraOption(payload);\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './mapbox3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\n\nimport componentPostEffectMixin from '../common/componentPostEffectMixin';\nimport componentLightMixin from '../common/componentLightMixin';\n\nvar MAPTALKS_CAMERA_OPTION = ['zoom', 'center', 'pitch', 'bearing'];\n\nvar Maptalks3DModel = echarts.ComponentModel.extend({\n\n type: 'maptalks3D',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n defaultOption: {\n zlevel: -10,\n\n urlTemplate: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',\n attribution: '© OpenStreetMap contributors, © CARTO',\n\n center: [0, 0],\n\n zoom: 0,\n\n pitch: 0,\n\n bearing: 0,\n\n light: {\n main: {\n alpha: 20,\n beta: 30\n }\n },\n\n altitudeScale: 1,\n // Default depend on altitudeScale\n boxHeight: 'auto'\n },\n\n getMaptalksCameraOption: function () {\n var self = this;\n return MAPTALKS_CAMERA_OPTION.reduce(function (obj, key) {\n obj[key] = self.get(key);\n return obj;\n }, {});\n },\n\n setMaptalksCameraOption: function (option) {\n if (option != null) {\n MAPTALKS_CAMERA_OPTION.forEach(function (key) {\n if (option[key] != null) {\n this.option[key] = option[key];\n }\n }, this);\n }\n },\n\n /**\n * Get maptalks instance\n */\n getMaptalks: function () {\n return this._maptalks;\n },\n\n setMaptalks: function (maptalks) {\n this._maptalks = maptalks;\n }\n});\n\necharts.util.merge(Maptalks3DModel.prototype, componentPostEffectMixin);\necharts.util.merge(Maptalks3DModel.prototype, componentLightMixin);\n\nexport default Maptalks3DModel;","/**\n * @constructor\n * @alias module:echarts-gl/component/maptalks/Maptalks3DLayer\n * @param {string} id Layer ID\n * @param {module:zrender/ZRender} zr\n */\nfunction Maptalks3DLayer (id, zr, defaultCenter, defaultZoom) {\n this.id = id;\n this.zr = zr;\n\n this.dom = document.createElement('div');\n this.dom.style.cssText = 'position:absolute;left:0;right:0;top:0;bottom:0;';\n\n // FIXME If in module environment.\n if (!maptalks) {\n throw new Error('Maptalks library must be included. See https://maptalks.org');\n }\n\n this._maptalks = new maptalks.Map(this.dom, {\n center: defaultCenter,\n zoom: defaultZoom,\n doubleClickZoom:false,\n fog: false\n // fogColor: [0, 0, 0]\n });\n\n // Proxy events\n this._initEvents();\n\n}\n\nMaptalks3DLayer.prototype.setUnpainted = function () {};\nMaptalks3DLayer.prototype.resize = function () {\n this._maptalks.checkSize();\n};\n\nMaptalks3DLayer.prototype.getMaptalks = function () {\n return this._maptalks;\n};\n\nMaptalks3DLayer.prototype.clear = function () {};\nMaptalks3DLayer.prototype.refresh = function () {\n this._maptalks.checkSize();\n};\n\nvar EVENTS = ['mousedown', 'mouseup', 'click', 'dblclick', 'mousemove',\n 'mousewheel', 'DOMMouseScroll',\n 'touchstart', 'touchend', 'touchmove', 'touchcancel'\n];\nMaptalks3DLayer.prototype._initEvents = function () {\n // Event is bound on canvas container.\n var maptalksRoot = this.dom;\n this._handlers = this._handlers || {\n contextmenu: function (e) {\n e.preventDefault();\n return false;\n }\n };\n EVENTS.forEach(function (eName) {\n this._handlers[eName] = function (e) {\n var obj = {};\n for (var name in e) {\n obj[name] = e[name];\n }\n obj.bubbles = false;\n var newE = new e.constructor(e.type, obj);\n if (eName === 'mousewheel' || eName === 'DOMMouseScroll') {\n // maptalks listens events to different elements?\n maptalksRoot.dispatchEvent(newE);\n }\n else {\n maptalksRoot.firstElementChild.dispatchEvent(newE);\n }\n };\n this.zr.dom.addEventListener(eName, this._handlers[eName]);\n }, this);\n\n // PENDING\n this.zr.dom.addEventListener('contextmenu', this._handlers.contextmenu);\n};\n\nMaptalks3DLayer.prototype.dispose = function () {\n EVENTS.forEach(function (eName) {\n this.zr.dom.removeEventListener(eName, this._handlers[eName]);\n }, this);\n this._maptalks.remove();\n};\n\nexport default Maptalks3DLayer;\n","import * as echarts from 'echarts/lib/echarts';\nimport Maptalks3DLayer from './Maptalks3DLayer';\nimport SceneHelper from '../common/SceneHelper';\nimport graphicGL from '../../util/graphicGL';\n\nimport displayShadowGLSL from '../../util/shader/displayShadow.glsl.js';\n\ngraphicGL.Shader.import(displayShadowGLSL);\n\nexport default echarts.ComponentView.extend({\n\n type: 'maptalks3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this._groundMesh = new graphicGL.Mesh({\n geometry: new graphicGL.PlaneGeometry(),\n material: new graphicGL.Material({\n shader: new graphicGL.Shader({\n vertex: graphicGL.Shader.source('ecgl.displayShadow.vertex'),\n fragment: graphicGL.Shader.source('ecgl.displayShadow.fragment')\n }),\n depthMask: false\n }),\n // Render first\n renderOrder: -100,\n culling: false,\n castShadow: false,\n $ignorePicking: true,\n renderNormal: true\n });\n },\n\n _initMaptalksLayer: function (mapbox3DModel, api) {\n var zr = api.getZr();\n this._zrLayer = new Maptalks3DLayer('maptalks3D', zr, mapbox3DModel.get('center'), mapbox3DModel.get('zoom'));\n zr.painter.insertLayer(-1000, this._zrLayer);\n\n this._lightRoot = new graphicGL.Node();\n this._sceneHelper = new SceneHelper(this._lightRoot);\n this._sceneHelper.initLight(this._lightRoot);\n\n var maptalks = this._zrLayer.getMaptalks();\n var dispatchInteractAction = this._dispatchInteractAction.bind(this, api, maptalks);\n\n // PENDING\n ['zoomend', 'zooming', 'zoomstart', 'dragrotating', 'pitch', 'pitchend', 'movestart',\n 'moving', 'moveend', 'resize', 'touchstart', 'touchmove', 'touchend','animating'].forEach(function (eName) {\n maptalks.on(eName, dispatchInteractAction);\n });\n\n },\n\n render: function (maptalks3DModel, ecModel, api) {\n if (!this._zrLayer) {\n this._initMaptalksLayer(maptalks3DModel, api);\n }\n\n var mtks = this._zrLayer.getMaptalks();\n var urlTemplate = maptalks3DModel.get('urlTemplate');\n\n var baseLayer = mtks.getBaseLayer();\n if (urlTemplate !== this._oldUrlTemplate) {\n if (!baseLayer) {\n baseLayer = new maptalks.TileLayer('maptalks-echarts-gl-baselayer', {\n urlTemplate: urlTemplate,\n // used sequentially to help with browser parallel requests per domain limitation\n subdomains: ['a', 'b', 'c'],\n attribution: maptalks3DModel.get('attribution')\n });\n mtks.setBaseLayer(baseLayer);\n }\n else {\n // PENDING setOptions may not work?\n baseLayer.setOptions({\n urlTemplate: urlTemplate,\n attribution: maptalks3DModel.get('attribution')\n });\n }\n }\n this._oldUrlTemplate = urlTemplate;\n\n mtks.setCenter(maptalks3DModel.get('center'));\n mtks.setZoom(maptalks3DModel.get('zoom'),{ animation: false });\n mtks.setPitch(maptalks3DModel.get('pitch'));\n mtks.setBearing(maptalks3DModel.get('bearing'));\n\n maptalks3DModel.setMaptalks(mtks);\n\n var coordSys = maptalks3DModel.coordinateSystem;\n\n // Not add to rootNode. Or light direction will be stretched by rootNode scale\n coordSys.viewGL.scene.add(this._lightRoot);\n coordSys.viewGL.add(this._groundMesh);\n\n this._updateGroundMesh();\n\n // Update lights\n this._sceneHelper.setScene(coordSys.viewGL.scene);\n this._sceneHelper.updateLight(maptalks3DModel);\n\n // Update post effects\n coordSys.viewGL.setPostEffect(maptalks3DModel.getModel('postEffect'), api);\n coordSys.viewGL.setTemporalSuperSampling(maptalks3DModel.getModel('temporalSuperSampling'));\n\n this._maptalks3DModel = maptalks3DModel;\n },\n\n afterRender: function (maptalks3DModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n this._sceneHelper.updateAmbientCubemap(renderer, maptalks3DModel, api);\n this._sceneHelper.updateSkybox(renderer, maptalks3DModel, api);\n\n // FIXME If other series changes coordinate system.\n // FIXME When doing progressive rendering.\n maptalks3DModel.coordinateSystem.viewGL.scene.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material.define('fragment', 'NORMAL_UP_AXIS', 2);\n mesh.material.define('fragment', 'NORMAL_FRONT_AXIS', 1);\n }\n });\n },\n\n updateCamera: function (maptalks3DModel, ecModel, api, payload) {\n maptalks3DModel.coordinateSystem.setCameraOption(payload);\n\n this._updateGroundMesh();\n\n api.getZr().refresh();\n },\n\n _dispatchInteractAction: function (api, maptalks, maptalks3DModel) {\n api.dispatchAction({\n type: 'maptalks3DChangeCamera',\n pitch: maptalks.getPitch(),\n zoom: getMapboxZoom(maptalks.getResolution()) + 1,\n center: maptalks.getCenter().toArray(),\n bearing: maptalks.getBearing(),\n maptalks3DId: this._maptalks3DModel && this._maptalks3DModel.id\n });\n },\n\n _updateGroundMesh: function () {\n if (this._maptalks3DModel) {\n var coordSys = this._maptalks3DModel.coordinateSystem;\n var pt = coordSys.dataToPoint(coordSys.center);\n this._groundMesh.position.set(pt[0], pt[1], -0.001);\n\n var plane = new graphicGL.Plane(new graphicGL.Vector3(0, 0, 1), 0);\n var ray1 = coordSys.viewGL.camera.castRay(new graphicGL.Vector2(-1, -1));\n var ray2 = coordSys.viewGL.camera.castRay(new graphicGL.Vector2(1, 1));\n var pos0 = ray1.intersectPlane(plane);\n var pos1 = ray2.intersectPlane(plane);\n var scale = pos0.dist(pos1) / coordSys.viewGL.rootNode.scale.x;\n this._groundMesh.scale.set(scale, scale, 1);\n }\n },\n\n dispose: function (ecModel, api) {\n if (this._zrLayer) {\n this._zrLayer.dispose();\n }\n api.getZr().painter.delLayer(-1000);\n }\n});\n\nconst MAX_RES = 2 * 6378137 * Math.PI / (256 * Math.pow(2, 20));\nfunction getMapboxZoom(res) {\n return 19 - Math.log(res / MAX_RES) / Math.LN2;\n}\n","import MapService3D from '../mapServiceCommon/MapService3D';\n\nfunction Maptalks3D() {\n MapService3D.apply(this, arguments);\n\n this.maxPitch = 85;\n this.zoomOffset = 1;\n}\n\nMaptalks3D.prototype = new MapService3D();\nMaptalks3D.prototype.constructor = Maptalks3D;\nMaptalks3D.prototype.type = 'maptalks3D';\n\nexport default Maptalks3D;","import Maptalks3D from './maptalks3D/Maptalks3D';\nimport createMapService3DCreator from './mapServiceCommon/createMapService3DCreator';\n\nvar maptalks3DCreator = createMapService3DCreator('maptalks3D', Maptalks3D, function (maptalks3DList) {\n maptalks3DList.forEach(function (maptalks3D) {\n maptalks3D.setCameraOption(maptalks3D.model.getMaptalksCameraOption());\n });\n});\n\nexport default maptalks3DCreator;","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Maptalks3DModel from './Maptalks3DModel';\nimport Maptalks3DView from './Maptalks3DView';\nimport maptalks3DCreator from '../../coord/maptalks3DCreator';\n\nexport function install(registers) {\n registers.registerComponentModel(Maptalks3DModel);\n registers.registerComponentView(Maptalks3DView);\n\n registers.registerCoordinateSystem('maptalks3D', maptalks3DCreator);\n\n registers.registerAction({\n type: 'maptalks3DChangeCamera',\n event: 'maptalks3dcamerachanged',\n update: 'maptalks3D:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'maptalks3D', query: payload\n }, function (componentModel) {\n componentModel.setMaptalksCameraOption(payload);\n });\n });\n}","// Thanks to https://gitee.com/iverson_hu/maptalks-echarts-gl\nimport { use } from 'echarts/lib/echarts';\nimport { install } from './maptalks3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\nvar isDimensionStacked = echarts.helper.dataStack.isDimensionStacked;\n\nfunction ifCrossZero(extent) {\n var min = extent[0];\n var max = extent[1];\n return !((min > 0 && max > 0) || (min < 0 && max < 0));\n};\n\nfunction cartesian3DLayout(seriesModel, coordSys) {\n\n var data = seriesModel.getData();\n // var barOnPlane = seriesModel.get('onGridPlane');\n\n var barSize = seriesModel.get('barSize');\n if (barSize == null) {\n var size = coordSys.size;\n var barWidth;\n var barDepth;\n var xAxis = coordSys.getAxis('x');\n var yAxis = coordSys.getAxis('y');\n\n if (xAxis.type === 'category') {\n barWidth = xAxis.getBandWidth() * 0.7;\n }\n else {\n // PENDING\n barWidth = Math.round(size[0] / Math.sqrt(data.count())) * 0.6;\n }\n if (yAxis.type === 'category') {\n barDepth = yAxis.getBandWidth() * 0.7;\n }\n else {\n barDepth = Math.round(size[1] / Math.sqrt(data.count())) * 0.6;\n }\n barSize = [barWidth, barDepth];\n }\n else if (!echarts.util.isArray(barSize)) {\n barSize = [barSize, barSize];\n }\n\n var zAxisExtent = coordSys.getAxis('z').scale.getExtent();\n var ifZAxisCrossZero = ifCrossZero(zAxisExtent);\n\n var dims = ['x', 'y', 'z'].map(function (coordDimName) {\n return seriesModel.coordDimToDataDim(coordDimName)[0];\n });\n\n var isStacked = isDimensionStacked(data, dims[2]);\n var valueDim = isStacked\n ? data.getCalculationInfo('stackResultDimension')\n : dims[2];\n\n data.each(dims, function (x, y, z, idx) {\n // TODO zAxis is inversed\n // TODO On different plane.\n var stackedValue = data.get(valueDim, idx);\n\n var baseValue = isStacked ? (stackedValue - z)\n : (ifZAxisCrossZero ? 0 : zAxisExtent[0]);\n\n var start = coordSys.dataToPoint([x, y, baseValue]);\n var end = coordSys.dataToPoint([x, y, stackedValue]);\n var height = vec3.dist(start, end);\n // PENDING When zAxis is not cross zero.\n var dir = [0, end[1] < start[1] ? -1 : 1, 0];\n if (Math.abs(height) === 0) {\n // TODO\n height = 0.1;\n }\n var size = [barSize[0], height, barSize[1]];\n data.setItemLayout(idx, [start, dir, size]);\n });\n\n data.setLayout('orient', [1, 0, 0]);\n}\n\nexport default cartesian3DLayout;","export default function (data, dimX, dimY) {\n var xExtent = data.getDataExtent(dimX);\n var yExtent = data.getDataExtent(dimY);\n\n // TODO Handle one data situation\n var xSpan = (xExtent[1] - xExtent[0]) || xExtent[0];\n var ySpan = (yExtent[1] - yExtent[0]) || yExtent[0];\n var dimSize = 50;\n var tmp = new Uint8Array(dimSize * dimSize);\n for (var i = 0; i < data.count(); i++) {\n var x = data.get(dimX, i);\n var y = data.get(dimY, i);\n var xIdx = Math.floor((x - xExtent[0]) / xSpan * (dimSize - 1));\n var yIdx = Math.floor((y - yExtent[0]) / ySpan * (dimSize - 1));\n var idx = yIdx * dimSize + xIdx;\n tmp[idx] = tmp[idx] || 1;\n }\n var filledCount = 0;\n for (var i = 0; i < tmp.length; i++) {\n if (tmp[i]) {\n filledCount++;\n }\n }\n return filledCount / tmp.length;\n};","import * as echarts from 'echarts/lib/echarts';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport cartesian3DLayout from './cartesian3DLayout';\nimport evaluateBarSparseness from './evaluateBarSparseness';\n\nvar vec3 = glmatrix.vec3;\nvar isDimensionStacked = echarts.helper.dataStack.isDimensionStacked;\n\nfunction globeLayout(seriesModel, coordSys) {\n var data = seriesModel.getData();\n var barMinHeight = seriesModel.get('minHeight') || 0;\n var barSize = seriesModel.get('barSize');\n var dims = ['lng', 'lat', 'alt'].map(function (coordDimName) {\n return seriesModel.coordDimToDataDim(coordDimName)[0];\n });\n if (barSize == null) {\n var perimeter = coordSys.radius * Math.PI;\n var fillRatio = evaluateBarSparseness(data, dims[0], dims[1]);\n barSize = [\n perimeter / Math.sqrt(data.count() / fillRatio),\n perimeter / Math.sqrt(data.count() / fillRatio)\n ];\n }\n else if (!echarts.util.isArray(barSize)) {\n barSize = [barSize, barSize];\n }\n\n var valueDim = getValueDimension(data, dims);\n\n data.each(dims, function (lng, lat, val, idx) {\n var stackedValue = data.get(valueDim.dimension, idx);\n var baseValue = valueDim.isStacked ? (stackedValue - val) : coordSys.altitudeAxis.scale.getExtent()[0];\n // TODO Stacked with minHeight.\n var height = Math.max(coordSys.altitudeAxis.dataToCoord(val), barMinHeight);\n var start = coordSys.dataToPoint([lng, lat, baseValue]);\n var end = coordSys.dataToPoint([lng, lat, stackedValue]);\n var dir = vec3.sub([], end, start);\n vec3.normalize(dir, dir);\n var size = [barSize[0], height, barSize[1]];\n data.setItemLayout(idx, [start, dir, size]);\n });\n\n data.setLayout('orient', Vector3.UP.array);\n}\n\nfunction geo3DLayout(seriesModel, coordSys) {\n var data = seriesModel.getData();\n var barSize = seriesModel.get('barSize');\n var barMinHeight = seriesModel.get('minHeight') || 0;\n var dims = ['lng', 'lat', 'alt'].map(function (coordDimName) {\n return seriesModel.coordDimToDataDim(coordDimName)[0];\n });\n if (barSize == null) {\n var size = Math.min(coordSys.size[0], coordSys.size[2]);\n\n var fillRatio = evaluateBarSparseness(data, dims[0], dims[1]);\n barSize = [\n size / Math.sqrt(data.count() / fillRatio),\n size / Math.sqrt(data.count() / fillRatio)\n ];\n }\n else if (!echarts.util.isArray(barSize)) {\n barSize = [barSize, barSize];\n }\n var dir = [0, 1, 0];\n\n var valueDim = getValueDimension(data, dims);\n\n data.each(dims, function (lng, lat, val, idx) {\n var stackedValue = data.get(valueDim.dimension, idx);\n var baseValue = valueDim.isStacked ? (stackedValue - val) : coordSys.altitudeAxis.scale.getExtent()[0];\n\n var height = Math.max(coordSys.altitudeAxis.dataToCoord(val), barMinHeight);\n var start = coordSys.dataToPoint([lng, lat, baseValue]);\n var size = [barSize[0], height, barSize[1]];\n data.setItemLayout(idx, [start, dir, size]);\n });\n\n data.setLayout('orient', [1, 0, 0]);\n}\n\nfunction mapService3DLayout(seriesModel, coordSys) {\n var data = seriesModel.getData();\n var dimLng = seriesModel.coordDimToDataDim('lng')[0];\n var dimLat = seriesModel.coordDimToDataDim('lat')[0];\n var dimAlt = seriesModel.coordDimToDataDim('alt')[0];\n var barSize = seriesModel.get('barSize');\n var barMinHeight = seriesModel.get('minHeight') || 0;\n\n if (barSize == null) {\n var xExtent = data.getDataExtent(dimLng);\n var yExtent = data.getDataExtent(dimLat);\n var corner0 = coordSys.dataToPoint([xExtent[0], yExtent[0]]);\n var corner1 = coordSys.dataToPoint([xExtent[1], yExtent[1]]);\n\n var size = Math.min(\n Math.abs(corner0[0] - corner1[0]),\n Math.abs(corner0[1] - corner1[1])\n ) || 1;\n\n var fillRatio = evaluateBarSparseness(data, dimLng, dimLat);\n // PENDING, data density\n barSize = [\n size / Math.sqrt(data.count() / fillRatio),\n size / Math.sqrt(data.count() / fillRatio)\n ];\n }\n else {\n if (!echarts.util.isArray(barSize)) {\n barSize = [barSize, barSize];\n }\n barSize[0] /= coordSys.getScale() / 16;\n barSize[1] /= coordSys.getScale() / 16;\n }\n\n var dir = [0, 0, 1];\n var dims = [dimLng, dimLat, dimAlt];\n\n var valueDim = getValueDimension(data, dims);\n\n data.each(dims, function (lng, lat, val, idx) {\n var stackedValue = data.get(valueDim.dimension, idx);\n var baseValue = valueDim.isStacked ? (stackedValue - val) : 0;\n\n var start = coordSys.dataToPoint([lng, lat, baseValue]);\n var end = coordSys.dataToPoint([lng, lat, stackedValue]);\n var height = Math.max(end[2] - start[2], barMinHeight);\n var size = [barSize[0], height, barSize[1]];\n data.setItemLayout(idx, [start, dir, size]);\n });\n\n data.setLayout('orient', [1, 0, 0]);\n}\n\nfunction getValueDimension(data, dataDims) {\n var isStacked = isDimensionStacked(data, dataDims[2]);\n return {\n dimension: isStacked\n ? data.getCalculationInfo('stackResultDimension')\n : dataDims[2],\n isStacked: isStacked\n };\n}\n\n\nexport default function registerBarLayout(registers) {\n registers.registerLayout(function (ecModel, api) {\n ecModel.eachSeriesByType('bar3D', function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n var coordSysType = coordSys && coordSys.type;\n if (coordSysType === 'globe') {\n globeLayout(seriesModel, coordSys);\n }\n else if (coordSysType === 'cartesian3D') {\n cartesian3DLayout(seriesModel, coordSys);\n }\n else if (coordSysType === 'geo3D') {\n geo3DLayout(seriesModel, coordSys);\n }\n else if (coordSysType === 'mapbox3D' || coordSysType === 'maptalks3D') {\n mapService3DLayout(seriesModel, coordSys);\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n if (!coordSys) {\n throw new Error('bar3D doesn\\'t have coordinate system.');\n }\n else {\n throw new Error('bar3D doesn\\'t support coordinate system ' + coordSys.type);\n }\n }\n }\n });\n });\n}","import * as echarts from 'echarts/lib/echarts';\n\nvar formatUtil = {};\nformatUtil.getFormattedLabel = function (seriesModel, dataIndex, status, dataType, dimIndex) {\n status = status || 'normal';\n var data = seriesModel.getData(dataType);\n var itemModel = data.getItemModel(dataIndex);\n\n var params = seriesModel.getDataParams(dataIndex, dataType);\n if (dimIndex != null && (params.value instanceof Array)) {\n params.value = params.value[dimIndex];\n }\n\n var formatter = itemModel.get(status === 'normal' ? ['label', 'formatter'] : ['emphasis', 'label', 'formatter']);\n if (formatter == null) {\n formatter = itemModel.get(['label', 'formatter']);\n }\n var text;\n if (typeof formatter === 'function') {\n params.status = status;\n text = formatter(params);\n }\n else if (typeof formatter === 'string') {\n text = echarts.format.formatTpl(formatter, params);\n }\n return text;\n};\n\n/**\n * If value is not array, then convert it to array.\n * @param {*} value\n * @return {Array} [value] or value\n */\nformatUtil.normalizeToArray = function (value) {\n return value instanceof Array\n ? value\n : value == null\n ? []\n : [value];\n};\n\nexport default formatUtil;","import * as echarts from 'echarts/lib/echarts';\nimport { getItemVisualColor } from '../../util/visual';\n\nfunction otherDimToDataDim (data, otherDim) {\n var dataDim = [];\n echarts.util.each(data.dimensions, function (dimName) {\n var dimItem = data.getDimensionInfo(dimName);\n var otherDims = dimItem.otherDims;\n var dimIndex = otherDims[otherDim];\n if (dimIndex != null && dimIndex !== false) {\n dataDim[dimIndex] = dimItem.name;\n }\n });\n return dataDim;\n}\n\nexport default function (seriesModel, dataIndex, multipleSeries) {\n function formatArrayValue(value) {\n var vertially = true;\n\n var result = [];\n var tooltipDims = otherDimToDataDim(data, 'tooltip');\n\n tooltipDims.length\n ? echarts.util.each(tooltipDims, function (dimIdx) {\n setEachItem(data.get(dimIdx, dataIndex), dimIdx);\n })\n // By default, all dims is used on tooltip.\n : echarts.util.each(value, setEachItem);\n\n function setEachItem(val, dimIdx) {\n var dimInfo = data.getDimensionInfo(dimIdx);\n // If `dimInfo.tooltip` is not set, show tooltip.\n if (!dimInfo || dimInfo.otherDims.tooltip === false) {\n return;\n }\n var dimType = dimInfo.type;\n var valStr = (vertially ? '- ' + (dimInfo.tooltipName || dimInfo.name) + ': ' : '')\n + (dimType === 'ordinal'\n ? val + ''\n : dimType === 'time'\n ? (multipleSeries ? '' : echarts.format.formatTime('yyyy/MM/dd hh:mm:ss', val))\n : echarts.format.addCommas(val)\n );\n valStr && result.push(echarts.format.encodeHTML(valStr));\n }\n\n return (vertially ? '
' : '') + result.join(vertially ? '
' : ', ');\n }\n\n var data = seriesModel.getData();\n\n var value = seriesModel.getRawValue(dataIndex);\n var formattedValue = echarts.util.isArray(value)\n ? formatArrayValue(value) : echarts.format.encodeHTML(echarts.format.addCommas(value));\n var name = data.getName(dataIndex);\n\n var color = getItemVisualColor(data, dataIndex);\n if (echarts.util.isObject(color) && color.colorStops) {\n color = (color.colorStops[0] || {}).color;\n }\n color = color || 'transparent';\n\n var colorEl = echarts.format.getTooltipMarker(color);\n\n var seriesName = seriesModel.name;\n // FIXME\n if (seriesName === '\\0-') {\n // Not show '-'\n seriesName = '';\n }\n seriesName = seriesName\n ? echarts.format.encodeHTML(seriesName) + (!multipleSeries ? '
' : ': ')\n : '';\n return !multipleSeries\n ? seriesName + colorEl\n + (name\n ? echarts.format.encodeHTML(name) + ': ' + formattedValue\n : formattedValue\n )\n : colorEl + seriesName + formattedValue;\n};","import * as echarts from 'echarts/lib/echarts';\n\nexport default function (seriesModel, dims, source) {\n source = source || seriesModel.getSource();\n\n var coordSysDimensions = dims || echarts.getCoordinateSystemDimensions(seriesModel.get('coordinateSystem')) || ['x', 'y', 'z'];\n\n var dimensions = echarts.helper.createDimensions(source, {\n dimensionsDefine: source.dimensionsDefine || seriesModel.get('dimensions'),\n encodeDefine: source.encodeDefine || seriesModel.get('encode'),\n coordDimensions: coordSysDimensions.map(function (dim) {\n var axis3DModel = seriesModel.getReferringComponents(dim + 'Axis3D').models[0];\n return {\n type: (axis3DModel && axis3DModel.get('type') === 'category') ? 'ordinal' : 'float',\n name: dim\n // Find stackable dimension. Which will represent value.\n // stackable: dim === 'z'\n };\n })\n });\n if (seriesModel.get('coordinateSystem') === 'cartesian3D') {\n dimensions.forEach(function (dimInfo) {\n if (coordSysDimensions.indexOf(dimInfo.coordDim) >= 0) {\n var axis3DModel = seriesModel.getReferringComponents(dimInfo.coordDim + 'Axis3D').models[0];\n if (axis3DModel && axis3DModel.get('type') === 'category') {\n dimInfo.ordinalMeta = axis3DModel.getOrdinalMeta();\n }\n }\n });\n }\n\n var stackCalculationInfo = echarts.helper.dataStack.enableDataStack(\n // Only support 'z' and `byIndex` now.\n seriesModel, dimensions, {byIndex: true, stackedCoordDimension: 'z'}\n );\n\n var data = new echarts.List(dimensions, seriesModel);\n\n data.setCalculationInfo(stackCalculationInfo);\n\n data.initData(source);\n\n return data;\n}","import * as echarts from 'echarts/lib/echarts';\nimport componentShadingMixin from '../../component/common/componentShadingMixin';\nimport formatUtil from '../../util/format';\nimport formatTooltip from '../common/formatTooltip';\nimport createList from '../common/createList';\n\nvar Bar3DSeries = echarts.SeriesModel.extend({\n\n type: 'series.bar3D',\n\n dependencies: ['globe'],\n\n visualStyleAccessPathvisu: 'itemStyle',\n\n getInitialData: function (option, ecModel) {\n return createList(this);\n },\n\n getFormattedLabel: function (dataIndex, status, dataType, dimIndex) {\n var text = formatUtil.getFormattedLabel(this, dataIndex, status, dataType, dimIndex);\n if (text == null) {\n text = this.getData().get('z', dataIndex);\n }\n return text;\n },\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n defaultOption: {\n\n coordinateSystem: 'cartesian3D',\n\n globeIndex: 0,\n\n grid3DIndex: 0,\n\n zlevel: -10,\n\n // bevelSize, 0 has no bevel\n bevelSize: 0,\n // higher is smoother\n bevelSmoothness: 2,\n\n // Bar width and depth\n // barSize: [1, 1],\n\n // On grid plane when coordinateSystem is cartesian3D\n onGridPlane: 'xy',\n\n // Shading of globe\n shading: 'color',\n\n minHeight: 0,\n\n itemStyle: {\n opacity: 1\n },\n\n label: {\n show: false,\n distance: 2,\n textStyle: {\n fontSize: 14,\n color: '#000',\n backgroundColor: 'rgba(255,255,255,0.7)',\n padding: 3,\n borderRadius: 3\n }\n },\n\n emphasis: {\n label: {\n show: true\n }\n },\n\n animationDurationUpdate: 500\n }\n});\n\necharts.util.merge(Bar3DSeries.prototype, componentShadingMixin);\n\nexport default Bar3DSeries;","/**\n * Geometry collecting bars data\n *\n * @module echarts-gl/chart/bars/BarsGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport * as echarts from 'echarts/lib/echarts';\nimport dynamicConvertMixin from './dynamicConvertMixin';\nimport trianglesSortMixin from './trianglesSortMixin';\nimport Geometry from 'claygl/src/Geometry';\n\nimport glMatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glMatrix.vec3;\nvar mat3 = glMatrix.mat3;\n\n/**\n * @constructor\n * @alias module:echarts-gl/chart/bars/BarsGeometry\n * @extends clay.Geometry\n */\nvar BarsGeometry = Geometry.extend(function () {\n return {\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION'),\n normal: new Geometry.Attribute('normal', 'float', 3, 'NORMAL'),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR'),\n\n prevPosition: new Geometry.Attribute('prevPosition', 'float', 3),\n prevNormal: new Geometry.Attribute('prevNormal', 'float', 3)\n },\n\n dynamic: true,\n\n enableNormal: false,\n\n bevelSize: 1,\n bevelSegments: 0,\n\n // Map from vertexIndex to dataIndex.\n _dataIndices: null,\n\n _vertexOffset: 0,\n _triangleOffset: 0\n };\n},\n/** @lends module:echarts-gl/chart/bars/BarsGeometry.prototype */\n{\n\n resetOffset: function () {\n this._vertexOffset = 0;\n this._triangleOffset = 0;\n },\n\n setBarCount: function (barCount) {\n var enableNormal = this.enableNormal;\n var vertexCount = this.getBarVertexCount() * barCount;\n var triangleCount = this.getBarTriangleCount() * barCount;\n\n if (this.vertexCount !== vertexCount) {\n this.attributes.position.init(vertexCount);\n if (enableNormal) {\n this.attributes.normal.init(vertexCount);\n }\n else {\n this.attributes.normal.value = null;\n }\n this.attributes.color.init(vertexCount);\n }\n\n if (this.triangleCount !== triangleCount) {\n this.indices = vertexCount > 0xffff ? new Uint32Array(triangleCount * 3) : new Uint16Array(triangleCount * 3);\n\n this._dataIndices = new Uint32Array(vertexCount);\n }\n },\n\n getBarVertexCount: function () {\n var bevelSegments = this.bevelSize > 0 ? this.bevelSegments : 0;\n return bevelSegments > 0 ? this._getBevelBarVertexCount(bevelSegments)\n : (this.enableNormal ? 24 : 8);\n },\n\n getBarTriangleCount: function () {\n var bevelSegments = this.bevelSize > 0 ? this.bevelSegments : 0;\n return bevelSegments > 0 ? this._getBevelBarTriangleCount(bevelSegments)\n : 12;\n },\n\n _getBevelBarVertexCount: function (bevelSegments) {\n return (bevelSegments + 1) * 4 * (bevelSegments + 1) * 2;\n },\n\n _getBevelBarTriangleCount: function (bevelSegments) {\n var widthSegments = bevelSegments * 4 + 3;\n var heightSegments = bevelSegments * 2 + 1;\n return (widthSegments + 1) * heightSegments * 2 + 4;\n },\n\n setColor: function (idx, color) {\n var vertexCount = this.getBarVertexCount();\n var start = vertexCount * idx;\n var end = vertexCount * (idx + 1);\n for (var i = start; i < end; i++) {\n this.attributes.color.set(i, color);\n }\n this.dirtyAttribute('color');\n },\n\n /**\n * Get dataIndex of vertex.\n * @param {number} vertexIndex\n */\n getDataIndexOfVertex: function (vertexIndex) {\n return this._dataIndices ? this._dataIndices[vertexIndex] : null;\n },\n\n /**\n * Add a bar\n * @param {Array.} start\n * @param {Array.} end\n * @param {Array.} orient right direction\n * @param {Array.} size size on x and z\n * @param {Array.} color\n */\n addBar: (function () {\n var v3Create = vec3.create;\n var v3ScaleAndAdd = vec3.scaleAndAdd;\n\n var end = v3Create();\n var px = v3Create();\n var py = v3Create();\n var pz = v3Create();\n var nx = v3Create();\n var ny = v3Create();\n var nz = v3Create();\n\n var pts = [];\n var normals = [];\n for (var i = 0; i < 8; i++) {\n pts[i] = v3Create();\n }\n\n var cubeFaces4 = [\n // PX\n [0, 1, 5, 4],\n // NX\n [2, 3, 7, 6],\n // PY\n [4, 5, 6, 7],\n // NY\n [3, 2, 1, 0],\n // PZ\n [0, 4, 7, 3],\n // NZ\n [1, 2, 6, 5]\n ];\n var face4To3 = [\n 0, 1, 2, 0, 2, 3\n ];\n var cubeFaces3 = [];\n for (var i = 0; i < cubeFaces4.length; i++) {\n var face4 = cubeFaces4[i];\n for (var j = 0; j < 2; j++) {\n var face = [];\n for (var k = 0; k < 3; k++) {\n face.push(face4[face4To3[j * 3 + k]]);\n }\n cubeFaces3.push(face);\n }\n }\n return function (start, dir, leftDir, size, color, dataIndex) {\n\n // Use vertex, triangle maybe sorted.\n var startVertex = this._vertexOffset;\n\n if (this.bevelSize > 0 && this.bevelSegments > 0) {\n this._addBevelBar(start, dir, leftDir, size, this.bevelSize, this.bevelSegments, color);\n }\n else {\n vec3.copy(py, dir);\n vec3.normalize(py, py);\n // x * y => z\n vec3.cross(pz, leftDir, py);\n vec3.normalize(pz, pz);\n // y * z => x\n vec3.cross(px, py, pz);\n vec3.normalize(pz, pz);\n\n vec3.negate(nx, px);\n vec3.negate(ny, py);\n vec3.negate(nz, pz);\n\n v3ScaleAndAdd(pts[0], start, px, size[0] / 2);\n v3ScaleAndAdd(pts[0], pts[0], pz, size[2] / 2);\n v3ScaleAndAdd(pts[1], start, px, size[0] / 2);\n v3ScaleAndAdd(pts[1], pts[1], nz, size[2] / 2);\n v3ScaleAndAdd(pts[2], start, nx, size[0] / 2);\n v3ScaleAndAdd(pts[2], pts[2], nz, size[2] / 2);\n v3ScaleAndAdd(pts[3], start, nx, size[0] / 2);\n v3ScaleAndAdd(pts[3], pts[3], pz, size[2] / 2);\n\n v3ScaleAndAdd(end, start, py, size[1]);\n\n v3ScaleAndAdd(pts[4], end, px, size[0] / 2);\n v3ScaleAndAdd(pts[4], pts[4], pz, size[2] / 2);\n v3ScaleAndAdd(pts[5], end, px, size[0] / 2);\n v3ScaleAndAdd(pts[5], pts[5], nz, size[2] / 2);\n v3ScaleAndAdd(pts[6], end, nx, size[0] / 2);\n v3ScaleAndAdd(pts[6], pts[6], nz, size[2] / 2);\n v3ScaleAndAdd(pts[7], end, nx, size[0] / 2);\n v3ScaleAndAdd(pts[7], pts[7], pz, size[2] / 2);\n\n var attributes = this.attributes;\n if (this.enableNormal) {\n normals[0] = px;\n normals[1] = nx;\n normals[2] = py;\n normals[3] = ny;\n normals[4] = pz;\n normals[5] = nz;\n\n var vertexOffset = this._vertexOffset;\n for (var i = 0; i < cubeFaces4.length; i++) {\n var idx3 = this._triangleOffset * 3;\n for (var k = 0; k < 6; k++) {\n this.indices[idx3++] = vertexOffset + face4To3[k];\n }\n vertexOffset += 4;\n this._triangleOffset += 2;\n }\n\n for (var i = 0; i < cubeFaces4.length; i++) {\n var normal = normals[i];\n for (var k = 0; k < 4; k++) {\n var idx = cubeFaces4[i][k];\n attributes.position.set(this._vertexOffset, pts[idx]);\n attributes.normal.set(this._vertexOffset, normal);\n attributes.color.set(this._vertexOffset++, color);\n }\n }\n }\n else {\n for (var i = 0; i < cubeFaces3.length; i++) {\n var idx3 = this._triangleOffset * 3;\n for (var k = 0; k < 3; k++) {\n this.indices[idx3 + k] = cubeFaces3[i][k] + this._vertexOffset;\n }\n this._triangleOffset++;\n }\n\n for (var i = 0; i < pts.length; i++) {\n attributes.position.set(this._vertexOffset, pts[i]);\n attributes.color.set(this._vertexOffset++, color);\n }\n }\n }\n\n var endVerex = this._vertexOffset;\n\n for (var i = startVertex; i < endVerex; i++) {\n this._dataIndices[i] = dataIndex;\n }\n };\n })(),\n\n /**\n * Add a bar with bevel\n * @param {Array.} start\n * @param {Array.} end\n * @param {Array.} orient right direction\n * @param {Array.} size size on x and z\n * @param {number} bevelSize\n * @param {number} bevelSegments\n * @param {Array.} color\n */\n _addBevelBar: (function () {\n var px = vec3.create();\n var py = vec3.create();\n var pz = vec3.create();\n\n var rotateMat = mat3.create();\n\n var bevelStartSize = [];\n\n var xOffsets = [1, -1, -1, 1];\n var zOffsets = [1, 1, -1, -1];\n var yOffsets = [2, 0];\n\n return function (start, dir, leftDir, size, bevelSize, bevelSegments, color) {\n vec3.copy(py, dir);\n vec3.normalize(py, py);\n // x * y => z\n vec3.cross(pz, leftDir, py);\n vec3.normalize(pz, pz);\n // y * z => x\n vec3.cross(px, py, pz);\n vec3.normalize(pz, pz);\n\n rotateMat[0] = px[0]; rotateMat[1] = px[1]; rotateMat[2] = px[2];\n rotateMat[3] = py[0]; rotateMat[4] = py[1]; rotateMat[5] = py[2];\n rotateMat[6] = pz[0]; rotateMat[7] = pz[1]; rotateMat[8] = pz[2];\n\n bevelSize = Math.min(size[0], size[2]) / 2 * bevelSize;\n\n for (var i = 0; i < 3; i++) {\n bevelStartSize[i] = Math.max(size[i] - bevelSize * 2, 0);\n }\n var rx = (size[0] - bevelStartSize[0]) / 2;\n var ry = (size[1] - bevelStartSize[1]) / 2;\n var rz = (size[2] - bevelStartSize[2]) / 2;\n\n var pos = [];\n var normal = [];\n var vertexOffset = this._vertexOffset;\n\n var endIndices = [];\n for (var i = 0; i < 2; i++) {\n endIndices[i] = endIndices[i] = [];\n\n for (var m = 0; m <= bevelSegments; m++) {\n for (var j = 0; j < 4; j++) {\n if ((m === 0 && i === 0) || (i === 1 && m === bevelSegments)) {\n endIndices[i].push(vertexOffset);\n }\n for (var n = 0; n <= bevelSegments; n++) {\n\n var phi = n / bevelSegments * Math.PI / 2 + Math.PI / 2 * j;\n var theta = m / bevelSegments * Math.PI / 2 + Math.PI / 2 * i;\n // var r = rx < ry ? (rz < rx ? rz : rx) : (rz < ry ? rz : ry);\n normal[0] = rx * Math.cos(phi) * Math.sin(theta);\n normal[1] = ry * Math.cos(theta);\n normal[2] = rz * Math.sin(phi) * Math.sin(theta);\n pos[0] = normal[0] + xOffsets[j] * bevelStartSize[0] / 2;\n pos[1] = (normal[1] + ry) + yOffsets[i] * bevelStartSize[1] / 2;\n pos[2] = normal[2] + zOffsets[j] * bevelStartSize[2] / 2;\n\n // Normal is not right if rx, ry, rz not equal.\n if (!(Math.abs(rx - ry) < 1e-6 && Math.abs(ry - rz) < 1e-6)) {\n normal[0] /= rx * rx;\n normal[1] /= ry * ry;\n normal[2] /= rz * rz;\n }\n vec3.normalize(normal, normal);\n\n vec3.transformMat3(pos, pos, rotateMat);\n vec3.transformMat3(normal, normal, rotateMat);\n vec3.add(pos, pos, start);\n\n this.attributes.position.set(vertexOffset, pos);\n if (this.enableNormal) {\n this.attributes.normal.set(vertexOffset, normal);\n }\n this.attributes.color.set(vertexOffset, color);\n vertexOffset++;\n }\n }\n }\n }\n\n var widthSegments = bevelSegments * 4 + 3;\n var heightSegments = bevelSegments * 2 + 1;\n\n var len = widthSegments + 1;\n\n for (var j = 0; j < heightSegments; j ++) {\n for (var i = 0; i <= widthSegments; i ++) {\n var i2 = j * len + i + this._vertexOffset;\n var i1 = (j * len + (i + 1) % len) + this._vertexOffset;\n var i4 = (j + 1) * len + (i + 1) % len + this._vertexOffset;\n var i3 = (j + 1) * len + i + this._vertexOffset;\n\n this.setTriangleIndices(this._triangleOffset++, [i4, i2, i1]);\n this.setTriangleIndices(this._triangleOffset++, [i4, i3, i2]);\n }\n }\n\n // Close top and bottom\n this.setTriangleIndices(this._triangleOffset++, [endIndices[0][0], endIndices[0][2], endIndices[0][1]]);\n this.setTriangleIndices(this._triangleOffset++, [endIndices[0][0], endIndices[0][3], endIndices[0][2]]);\n this.setTriangleIndices(this._triangleOffset++, [endIndices[1][0], endIndices[1][1], endIndices[1][2]]);\n this.setTriangleIndices(this._triangleOffset++, [endIndices[1][0], endIndices[1][2], endIndices[1][3]]);\n\n this._vertexOffset = vertexOffset;\n };\n })()\n});\n\necharts.util.defaults(BarsGeometry.prototype, dynamicConvertMixin);\necharts.util.defaults(BarsGeometry.prototype, trianglesSortMixin);\n\nexport default BarsGeometry;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport format from '../../util/format';\nimport BarsGeometry from '../../util/geometry/Bars3DGeometry';\nimport LabelsBuilder from '../../component/common/LabelsBuilder';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport {getItemVisualColor, getItemVisualOpacity} from '../../util/visual';\n\nvar vec3 = glmatrix.vec3;\n\nexport default echarts.ChartView.extend({\n\n type: 'bar3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n\n this._api = api;\n\n this._labelsBuilder = new LabelsBuilder(256, 256, api);\n var self = this;\n this._labelsBuilder.getLabelPosition = function (dataIndex, position, distance) {\n if (self._data) {\n var layout = self._data.getItemLayout(dataIndex);\n var start = layout[0];\n var dir = layout[1];\n var height = layout[2][1];\n return vec3.scaleAndAdd([], start, dir, distance + height);\n }\n else {\n return [0, 0];\n }\n };\n\n // Give a large render order.\n this._labelsBuilder.getMesh().renderOrder = 100;\n },\n\n render: function (seriesModel, ecModel, api) {\n\n // Swap barMesh\n var tmp = this._prevBarMesh;\n this._prevBarMesh = this._barMesh;\n this._barMesh = tmp;\n\n if (!this._barMesh) {\n this._barMesh = new graphicGL.Mesh({\n geometry: new BarsGeometry(),\n shadowDepthMaterial: new graphicGL.Material({\n shader: new graphicGL.Shader(\n graphicGL.Shader.source('ecgl.sm.depth.vertex'),\n graphicGL.Shader.source('ecgl.sm.depth.fragment')\n )\n }),\n // Only cartesian3D enable culling\n // FIXME Performance\n culling: seriesModel.coordinateSystem.type === 'cartesian3D',\n // Render after axes\n renderOrder: 10,\n // Render normal in normal pass\n renderNormal: true\n });\n }\n\n this.groupGL.remove(this._prevBarMesh);\n this.groupGL.add(this._barMesh);\n this.groupGL.add(this._labelsBuilder.getMesh());\n\n var coordSys = seriesModel.coordinateSystem;\n this._doRender(seriesModel, api);\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._barMesh.material[methodName]('fragment', 'SRGB_DECODE');\n }\n\n this._data = seriesModel.getData();\n\n this._labelsBuilder.updateData(this._data);\n\n this._labelsBuilder.updateLabels();\n\n this._updateAnimation(seriesModel);\n },\n\n _updateAnimation: function (seriesModel) {\n graphicGL.updateVertexAnimation(\n [['prevPosition', 'position'],\n ['prevNormal', 'normal']],\n this._prevBarMesh,\n this._barMesh,\n seriesModel\n );\n },\n\n _doRender: function (seriesModel, api) {\n var data = seriesModel.getData();\n var shading = seriesModel.get('shading');\n var enableNormal = shading !== 'color';\n var self = this;\n var barMesh = this._barMesh;\n\n var shadingPrefix = 'ecgl.' + shading;\n if (!barMesh.material || barMesh.material.shader.name !== shadingPrefix) {\n barMesh.material = graphicGL.createMaterial(shadingPrefix, ['VERTEX_COLOR']);\n }\n\n graphicGL.setMaterialFromModel(\n shading, barMesh.material, seriesModel, api\n );\n\n barMesh.geometry.enableNormal = enableNormal;\n\n barMesh.geometry.resetOffset();\n\n // Bevel settings\n var bevelSize = seriesModel.get('bevelSize');\n var bevelSegments = seriesModel.get('bevelSmoothness');\n barMesh.geometry.bevelSegments = bevelSegments;\n\n barMesh.geometry.bevelSize = bevelSize;\n\n var colorArr = [];\n var vertexColors = new Float32Array(data.count() * 4);\n var colorOffset = 0;\n var barCount = 0;\n var hasTransparent = false;\n\n data.each(function (idx) {\n if (!data.hasValue(idx)) {\n return;\n }\n var color = getItemVisualColor(data, idx);\n\n var opacity = getItemVisualOpacity(data, idx);\n if (opacity == null) {\n opacity = 1;\n }\n\n graphicGL.parseColor(color, colorArr);\n colorArr[3] *= opacity;\n vertexColors[colorOffset++] = colorArr[0];\n vertexColors[colorOffset++] = colorArr[1];\n vertexColors[colorOffset++] = colorArr[2];\n vertexColors[colorOffset++] = colorArr[3];\n\n if (colorArr[3] > 0) {\n barCount++;\n if (colorArr[3] < 0.99) {\n hasTransparent = true;\n }\n }\n });\n\n barMesh.geometry.setBarCount(barCount);\n\n var orient = data.getLayout('orient');\n\n // Map of dataIndex and barIndex.\n var barIndexOfData = this._barIndexOfData = new Int32Array(data.count());\n var barCount = 0;\n data.each(function (idx) {\n if (!data.hasValue(idx)) {\n barIndexOfData[idx] = -1;\n return;\n }\n var layout = data.getItemLayout(idx);\n var start = layout[0];\n var dir = layout[1];\n var size = layout[2];\n\n var idx4 = idx * 4;\n colorArr[0] = vertexColors[idx4++];\n colorArr[1] = vertexColors[idx4++];\n colorArr[2] = vertexColors[idx4++];\n colorArr[3] = vertexColors[idx4++];\n if (colorArr[3] > 0) {\n self._barMesh.geometry.addBar(start, dir, orient, size, colorArr, idx);\n barIndexOfData[idx] = barCount++;\n }\n });\n\n barMesh.geometry.dirty();\n barMesh.geometry.updateBoundingBox();\n\n var material = barMesh.material;\n material.transparent = hasTransparent;\n material.depthMask = !hasTransparent;\n barMesh.geometry.sortTriangles = hasTransparent;\n\n this._initHandler(seriesModel, api);\n },\n\n _initHandler: function (seriesModel, api) {\n var data = seriesModel.getData();\n var barMesh = this._barMesh;\n var isCartesian3D = seriesModel.coordinateSystem.type === 'cartesian3D';\n\n barMesh.seriesIndex = seriesModel.seriesIndex;\n\n var lastDataIndex = -1;\n barMesh.off('mousemove');\n barMesh.off('mouseout');\n barMesh.on('mousemove', function (e) {\n var dataIndex = barMesh.geometry.getDataIndexOfVertex(e.triangle[0]);\n if (dataIndex !== lastDataIndex) {\n this._downplay(lastDataIndex);\n this._highlight(dataIndex);\n this._labelsBuilder.updateLabels([dataIndex]);\n\n if (isCartesian3D) {\n api.dispatchAction({\n type: 'grid3DShowAxisPointer',\n value: [data.get('x', dataIndex), data.get('y', dataIndex), data.get('z', dataIndex, true)]\n });\n }\n }\n\n lastDataIndex = dataIndex;\n barMesh.dataIndex = dataIndex;\n }, this);\n barMesh.on('mouseout', function (e) {\n this._downplay(lastDataIndex);\n this._labelsBuilder.updateLabels();\n lastDataIndex = -1;\n barMesh.dataIndex = -1;\n\n if (isCartesian3D) {\n api.dispatchAction({\n type: 'grid3DHideAxisPointer'\n });\n }\n }, this);\n },\n\n _highlight: function (dataIndex) {\n var data = this._data;\n if (!data) {\n return;\n }\n var barIndex = this._barIndexOfData[dataIndex];\n if (barIndex < 0) {\n return;\n }\n\n var itemModel = data.getItemModel(dataIndex);\n var emphasisItemStyleModel = itemModel.getModel('emphasis.itemStyle');\n var emphasisColor = emphasisItemStyleModel.get('color');\n var emphasisOpacity = emphasisItemStyleModel.get('opacity');\n if (emphasisColor == null) {\n var color = getItemVisualColor(data, dataIndex);\n emphasisColor = echarts.color.lift(color, -0.4);\n }\n if (emphasisOpacity == null) {\n emphasisOpacity = getItemVisualOpacity(data, dataIndex);\n }\n var colorArr = graphicGL.parseColor(emphasisColor);\n colorArr[3] *= emphasisOpacity;\n\n this._barMesh.geometry.setColor(barIndex, colorArr);\n\n this._api.getZr().refresh();\n },\n\n _downplay: function (dataIndex) {\n var data = this._data;\n if (!data) {\n return;\n }\n var barIndex = this._barIndexOfData[dataIndex];\n if (barIndex < 0) {\n return;\n }\n\n var color = getItemVisualColor(data, dataIndex);\n var opacity = getItemVisualOpacity(data, dataIndex);\n\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= opacity;\n\n this._barMesh.geometry.setColor(barIndex, colorArr);\n\n this._api.getZr().refresh();\n },\n\n highlight: function (seriesModel, ecModel, api, payload) {\n this._toggleStatus('highlight', seriesModel, ecModel, api, payload);\n },\n\n downplay: function (seriesModel, ecModel, api, payload) {\n this._toggleStatus('downplay', seriesModel, ecModel, api, payload);\n },\n\n _toggleStatus: function (status, seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData();\n var dataIndex = retrieve.queryDataIndex(data, payload);\n\n var self = this;\n if (dataIndex != null) {\n echarts.util.each(format.normalizeToArray(dataIndex), function (dataIdx) {\n status === 'highlight' ? this._highlight(dataIdx) : this._downplay(dataIdx);\n }, this);\n }\n else {\n data.each(function (dataIdx) {\n status === 'highlight' ? self._highlight(dataIdx) : self._downplay(dataIdx);\n });\n }\n },\n\n remove: function () {\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n this._labelsBuilder.dispose();\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\n\nimport registerBarLayout from './bar3DLayout';\nimport Bar3DSeries from './Bar3DSeries';\nimport Bar3DView from './Bar3DView';\n\nexport function install(registers) {\n registers.registerChartView(Bar3DView);\n registers.registerSeriesModel(Bar3DSeries);\n\n registerBarLayout(registers);\n\n registers.registerProcessor(function (ecModel, api) {\n ecModel.eachSeriesByType('bar3d', function (seriesModel) {\n var data = seriesModel.getData();\n data.filterSelf(function (idx) {\n return data.hasValue(idx);\n });\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './bar3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport formatTooltip from '../common/formatTooltip';\nimport createList from '../common/createList';\n\nvar Line3DSeries = echarts.SeriesModel.extend({\n\n type: 'series.line3D',\n\n dependencies: ['grid3D'],\n\n visualStyleAccessPath: 'lineStyle',\n visualDrawType: 'stroke',\n\n getInitialData: function (option, ecModel) {\n return createList(this);\n },\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian3D',\n zlevel: -10,\n\n // Cartesian coordinate system\n grid3DIndex: 0,\n\n lineStyle: {\n width: 2\n },\n\n animationDurationUpdate: 500\n }\n});\n\nexport default Line3DSeries;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport Matrix4 from 'claygl/src/math/Matrix4';\nimport Vector3 from 'claygl/src/math/Vector3';\nimport * as lineContain from 'zrender/lib/contain/line';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nimport lines3DGLSL from '../../util/shader/lines3D.glsl.js';\n\nvar vec3 = glmatrix.vec3;\n\ngraphicGL.Shader.import(lines3DGLSL);\n\nexport default echarts.ChartView.extend({\n\n type: 'line3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n\n this._api = api;\n },\n\n render: function (seriesModel, ecModel, api) {\n var tmp = this._prevLine3DMesh;\n this._prevLine3DMesh = this._line3DMesh;\n this._line3DMesh = tmp;\n\n if (!this._line3DMesh) {\n this._line3DMesh = new graphicGL.Mesh({\n geometry: new Lines3DGeometry({\n useNativeLine: false,\n sortTriangles: true\n }),\n material: new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.meshLines3D')\n }),\n // Render after axes\n renderOrder: 10\n });\n this._line3DMesh.geometry.pick = this._pick.bind(this);\n }\n\n this.groupGL.remove(this._prevLine3DMesh);\n this.groupGL.add(this._line3DMesh);\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n // TODO\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._line3DMesh.material[methodName]('fragment', 'SRGB_DECODE');\n }\n this._doRender(seriesModel, api);\n\n this._data = seriesModel.getData();\n\n this._camera = coordSys.viewGL.camera;\n\n this.updateCamera();\n\n this._updateAnimation(seriesModel);\n },\n\n updateCamera: function () {\n this._updateNDCPosition();\n },\n\n _doRender: function (seriesModel, api) {\n var data = seriesModel.getData();\n var lineMesh = this._line3DMesh;\n\n lineMesh.geometry.resetOffset();\n\n var points = data.getLayout('points');\n\n var colorArr = [];\n var vertexColors = new Float32Array(points.length / 3 * 4);\n var colorOffset = 0;\n var hasTransparent = false;\n\n data.each(function (idx) {\n var color = getItemVisualColor(data, idx);\n var opacity = getItemVisualOpacity(data, idx);\n if (opacity == null) {\n opacity = 1;\n }\n\n graphicGL.parseColor(color, colorArr);\n colorArr[3] *= opacity;\n vertexColors[colorOffset++] = colorArr[0];\n vertexColors[colorOffset++] = colorArr[1];\n vertexColors[colorOffset++] = colorArr[2];\n vertexColors[colorOffset++] = colorArr[3];\n\n if (colorArr[3] < 0.99) {\n hasTransparent = true;\n }\n });\n\n lineMesh.geometry.setVertexCount(\n lineMesh.geometry.getPolylineVertexCount(points)\n );\n lineMesh.geometry.setTriangleCount(\n lineMesh.geometry.getPolylineTriangleCount(points)\n );\n\n lineMesh.geometry.addPolyline(\n points, vertexColors,\n retrieve.firstNotNull(seriesModel.get('lineStyle.width'), 1)\n );\n\n lineMesh.geometry.dirty();\n lineMesh.geometry.updateBoundingBox();\n\n var material = lineMesh.material;\n material.transparent = hasTransparent;\n material.depthMask = !hasTransparent;\n\n var debugWireframeModel = seriesModel.getModel('debug.wireframe');\n if (debugWireframeModel.get('show')) {\n lineMesh.geometry.createAttribute('barycentric', 'float', 3);\n lineMesh.geometry.generateBarycentric();\n lineMesh.material.set('both', 'WIREFRAME_TRIANGLE');\n lineMesh.material.set(\n 'wireframeLineColor', graphicGL.parseColor(\n debugWireframeModel.get('lineStyle.color') || 'rgba(0,0,0,0.5)'\n )\n );\n lineMesh.material.set(\n 'wireframeLineWidth', retrieve.firstNotNull(\n debugWireframeModel.get('lineStyle.width'), 1\n )\n );\n }\n else {\n lineMesh.material.set('both', 'WIREFRAME_TRIANGLE');\n }\n\n this._points = points;\n\n this._initHandler(seriesModel, api);\n },\n\n _updateAnimation: function (seriesModel) {\n graphicGL.updateVertexAnimation(\n [['prevPosition', 'position'],\n ['prevPositionPrev', 'positionPrev'],\n ['prevPositionNext', 'positionNext']],\n this._prevLine3DMesh,\n this._line3DMesh,\n seriesModel\n );\n },\n\n _initHandler: function (seriesModel, api) {\n var data = seriesModel.getData();\n var coordSys = seriesModel.coordinateSystem;\n var lineMesh = this._line3DMesh;\n\n var lastDataIndex = -1;\n\n lineMesh.seriesIndex = seriesModel.seriesIndex;\n\n lineMesh.off('mousemove');\n lineMesh.off('mouseout');\n lineMesh.on('mousemove', function (e) {\n var value = coordSys.pointToData(e.point.array);\n var dataIndex = data.indicesOfNearest('x', value[0])[0];\n if (dataIndex !== lastDataIndex) {\n // this._downplay(lastDataIndex);\n // this._highlight(dataIndex);\n\n api.dispatchAction({\n type: 'grid3DShowAxisPointer',\n value: [data.get('x', dataIndex), data.get('y', dataIndex), data.get('z', dataIndex)]\n });\n\n lineMesh.dataIndex = dataIndex;\n }\n\n\n lastDataIndex = dataIndex;\n }, this);\n lineMesh.on('mouseout', function (e) {\n // this._downplay(lastDataIndex);\n lastDataIndex = -1;\n lineMesh.dataIndex = -1;\n api.dispatchAction({\n type: 'grid3DHideAxisPointer'\n });\n }, this);\n },\n\n // _highlight: function (dataIndex) {\n // var data = this._data;\n // if (!data) {\n // return;\n // }\n\n // },\n\n // _downplay: function (dataIndex) {\n // var data = this._data;\n // if (!data) {\n // return;\n // }\n // },\n\n _updateNDCPosition: function () {\n\n var worldViewProjection = new Matrix4();\n var camera = this._camera;\n Matrix4.multiply(worldViewProjection, camera.projectionMatrix, camera.viewMatrix);\n\n var positionNDC = this._positionNDC;\n var points = this._points;\n var nPoints = points.length / 3;\n if (!positionNDC || positionNDC.length / 2 !== nPoints) {\n positionNDC = this._positionNDC = new Float32Array(nPoints * 2);\n }\n var pos = [];\n for (var i = 0; i < nPoints; i++) {\n var i3 = i * 3;\n var i2 = i * 2;\n pos[0] = points[i3];\n pos[1] = points[i3 + 1];\n pos[2] = points[i3 + 2];\n pos[3] = 1;\n\n vec3.transformMat4(pos, pos, worldViewProjection.array);\n positionNDC[i2] = pos[0] / pos[3];\n positionNDC[i2 + 1] = pos[1] / pos[3];\n }\n },\n\n _pick: function (x, y, renderer, camera, renderable, out) {\n var positionNDC = this._positionNDC;\n var seriesModel = this._data.hostModel;\n var lineWidth = seriesModel.get('lineStyle.width');\n\n var dataIndex = -1;\n var width = renderer.viewport.width;\n var height = renderer.viewport.height;\n\n var halfWidth = width * 0.5;\n var halfHeight = height * 0.5;\n x = (x + 1) * halfWidth;\n y = (y + 1) * halfHeight;\n\n for (var i = 1; i < positionNDC.length / 2; i++) {\n var x0 = (positionNDC[(i - 1) * 2] + 1) * halfWidth;\n var y0 = (positionNDC[(i - 1) * 2 + 1] + 1) * halfHeight;\n var x1 = (positionNDC[i * 2] + 1) * halfWidth;\n var y1 = (positionNDC[i * 2 + 1] + 1) * halfHeight;\n\n if (lineContain.containStroke(x0, y0, x1, y1, lineWidth, x, y)) {\n var dist0 = (x0 - x) * (x0 - x) + (y0 - y) * (y0 - y);\n var dist1 = (x1 - x) * (x1 - x) + (y1 - y) * (y1 - y);\n // Nearest point.\n dataIndex = dist0 < dist1 ? (i - 1) : i;\n }\n }\n\n if (dataIndex >= 0) {\n var i3 = dataIndex * 3;\n var point = new Vector3(\n this._points[i3],\n this._points[i3 + 1],\n this._points[i3 + 2]\n );\n\n out.push({\n dataIndex: dataIndex,\n point: point,\n pointWorld: point.clone(),\n target: this._line3DMesh,\n distance: this._camera.getWorldPosition().dist(point)\n });\n }\n },\n\n remove: function () {\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Line3DSeries from './Line3DSeries';\nimport Line3DView from './Line3DView';\n\nexport function install(registers) {\n registers.registerChartView(Line3DView);\n registers.registerSeriesModel(Line3DSeries);\n\n registers.registerLayout(function (ecModel, api) {\n ecModel.eachSeriesByType('line3D', function (seriesModel) {\n var data = seriesModel.getData();\n var coordSys = seriesModel.coordinateSystem;\n\n if (coordSys) {\n if (coordSys.type !== 'cartesian3D') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('line3D needs cartesian3D coordinateSystem');\n }\n return;\n }\n var points = new Float32Array(data.count() * 3);\n\n var item = [];\n var out = [];\n\n var coordDims = coordSys.dimensions;\n var dims = coordDims.map(function (coordDim) {\n return seriesModel.coordDimToDataDim(coordDim)[0];\n });\n\n if (coordSys) {\n data.each(dims, function (x, y, z, idx) {\n item[0] = x;\n item[1] = y;\n item[2] = z;\n\n coordSys.dataToPoint(item, out);\n points[idx * 3] = out[0];\n points[idx * 3 + 1] = out[1];\n points[idx * 3 + 2] = out[2];\n });\n }\n data.setLayout('points', points);\n }\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './line3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport formatUtil from '../../util/format';\nimport formatTooltip from '../common/formatTooltip';\nimport createList from '../common/createList';\n\nexport default echarts.SeriesModel.extend({\n\n type: 'series.scatter3D',\n\n dependencies: ['globe', 'grid3D', 'geo3D'],\n\n visualStyleAccessPath: 'itemStyle',\n\n hasSymbolVisual: true,\n\n getInitialData: function (option, ecModel) {\n return createList(this);\n },\n\n getFormattedLabel: function (dataIndex, status, dataType, dimIndex) {\n var text = formatUtil.getFormattedLabel(this, dataIndex, status, dataType, dimIndex);\n if (text == null) {\n var data = this.getData();\n var lastDim = data.dimensions[data.dimensions.length - 1];\n text = data.get(lastDim, dataIndex);\n }\n return text;\n },\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian3D',\n zlevel: -10,\n\n progressive: 1e5,\n progressiveThreshold: 1e5,\n\n // Cartesian coordinate system\n grid3DIndex: 0,\n\n globeIndex: 0,\n\n symbol: 'circle',\n symbolSize: 10,\n\n // Support source-over, lighter\n blendMode: 'source-over',\n\n label: {\n show: false,\n position: 'right',\n // Screen space distance\n distance: 5,\n\n textStyle: {\n fontSize: 14,\n color: '#000',\n backgroundColor: 'rgba(255,255,255,0.7)',\n padding: 3,\n borderRadius: 3\n }\n },\n\n itemStyle: {\n opacity: 0.8\n },\n\n emphasis: {\n label: {\n show: true\n }\n },\n\n animationDurationUpdate: 500\n }\n});","import * as echarts from 'echarts/lib/echarts';\n\nfunction makeSprite(size, canvas, draw) {\n // http://simonsarris.com/blog/346-how-you-clear-your-canvas-matters\n // http://jsperf.com/canvasclear\n // Set width and height is fast\n // And use the exist canvas if possible\n // http://jsperf.com/create-canvas-vs-set-width-height/2\n var canvas = canvas || document.createElement('canvas');\n canvas.width = size;\n canvas.height = size;\n var ctx = canvas.getContext('2d');\n\n draw && draw(ctx);\n\n return canvas;\n}\n\nfunction makePath(symbol, symbolSize, style, marginBias) {\n if (!echarts.util.isArray(symbolSize)) {\n symbolSize = [symbolSize, symbolSize];\n }\n var margin = spriteUtil.getMarginByStyle(style, marginBias);\n var width = symbolSize[0] + margin.left + margin.right;\n var height = symbolSize[1] + margin.top + margin.bottom;\n var path = echarts.helper.createSymbol(symbol, 0, 0, symbolSize[0], symbolSize[1]);\n\n var size = Math.max(width, height);\n\n path.x = margin.left;\n path.y = margin.top;\n if (width > height) {\n path.y += (size - height) / 2;\n }\n else {\n path.x += (size - width) / 2;\n }\n\n var rect = path.getBoundingRect();\n path.x -= rect.x;\n path.y -= rect.y;\n\n path.setStyle(style);\n\n path.update();\n\n path.__size = size;\n\n return path;\n}\n\n // http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf\nfunction generateSDF(ctx, sourceImageData, range) {\n\n var sourceWidth = sourceImageData.width;\n var sourceHeight = sourceImageData.height;\n\n var width = ctx.canvas.width;\n var height = ctx.canvas.height;\n\n var scaleX = sourceWidth / width;\n var scaleY = sourceHeight / height;\n\n function sign(r) {\n return r < 128 ? 1 : -1;\n }\n function searchMinDistance(x, y) {\n var minDistSqr = Infinity;\n x = Math.floor(x * scaleX);\n y = Math.floor(y * scaleY);\n var i = y * sourceWidth + x;\n var r = sourceImageData.data[i * 4];\n var a = sign(r);\n // Search for min distance\n for (var y2 = Math.max(y - range, 0); y2 < Math.min(y + range, sourceHeight); y2++) {\n for (var x2 = Math.max(x - range, 0); x2 < Math.min(x + range, sourceWidth); x2++) {\n var i = y2 * sourceWidth + x2;\n var r2 = sourceImageData.data[i * 4];\n var b = sign(r2);\n var dx = x2 - x;\n var dy = y2 - y;\n if (a !== b) {\n var distSqr = dx * dx + dy * dy;\n if (distSqr < minDistSqr) {\n minDistSqr = distSqr;\n }\n }\n }\n }\n return a * Math.sqrt(minDistSqr);\n }\n\n var sdfImageData = ctx.createImageData(width, height);\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width; x++) {\n var dist = searchMinDistance(x, y);\n\n var normalized = dist / range * 0.5 + 0.5;\n var i = (y * width + x) * 4;\n sdfImageData.data[i++] = (1.0 - normalized) * 255;\n sdfImageData.data[i++] = (1.0 - normalized) * 255;\n sdfImageData.data[i++] = (1.0 - normalized) * 255;\n sdfImageData.data[i++] = 255;\n }\n }\n\n return sdfImageData;\n}\n\nvar spriteUtil = {\n\n getMarginByStyle: function (style) {\n var minMargin = style.minMargin || 0;\n\n var lineWidth = 0;\n if (style.stroke && style.stroke !== 'none') {\n lineWidth = style.lineWidth == null ? 1 : style.lineWidth;\n }\n var shadowBlurSize = style.shadowBlur || 0;\n var shadowOffsetX = style.shadowOffsetX || 0;\n var shadowOffsetY = style.shadowOffsetY || 0;\n\n var margin = {};\n margin.left = Math.max(lineWidth / 2, -shadowOffsetX + shadowBlurSize, minMargin);\n margin.right = Math.max(lineWidth / 2, shadowOffsetX + shadowBlurSize, minMargin);\n margin.top = Math.max(lineWidth / 2, -shadowOffsetY + shadowBlurSize, minMargin);\n margin.bottom = Math.max(lineWidth / 2, shadowOffsetY + shadowBlurSize, minMargin);\n\n return margin;\n },\n\n // TODO Not consider shadowOffsetX, shadowOffsetY.\n /**\n * @param {string} symbol\n * @param {number | Array.} symbolSize\n * @param {Object} style\n */\n createSymbolSprite: function (symbol, symbolSize, style, canvas) {\n var path = makePath(symbol, symbolSize, style);\n\n var margin = spriteUtil.getMarginByStyle(style);\n\n return {\n image: makeSprite(path.__size, canvas, function (ctx) {\n echarts.innerDrawElementOnCanvas(ctx, path);\n }),\n margin: margin\n };\n },\n\n createSDFFromCanvas: function (canvas, size, range, outCanvas) {\n // TODO Create a low resolution SDF from high resolution image.\n return makeSprite(size, outCanvas, function (outCtx) {\n var ctx = canvas.getContext('2d');\n var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height);\n\n outCtx.putImageData(generateSDF(outCtx, imgData, range), 0, 0);\n });\n },\n\n createSimpleSprite: function (size, canvas) {\n return makeSprite(size, canvas, function (ctx) {\n var halfSize = size / 2;\n ctx.beginPath();\n ctx.arc(halfSize, halfSize, 60, 0, Math.PI * 2, false) ;\n ctx.closePath();\n\n var gradient = ctx.createRadialGradient(\n halfSize, halfSize, 0, halfSize, halfSize, halfSize\n );\n gradient.addColorStop(0, 'rgba(255, 255, 255, 1)');\n gradient.addColorStop(0.5, 'rgba(255, 255, 255, 0.5)');\n gradient.addColorStop(1, 'rgba(255, 255, 255, 0)');\n ctx.fillStyle = gradient;\n ctx.fill();\n });\n }\n};\n\nexport default spriteUtil;","import ProgressiveQuickSort from '../ProgressiveQuickSort';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\n\nexport default {\n\n needsSortVertices: function () {\n return this.sortVertices;\n },\n\n needsSortVerticesProgressively: function () {\n return this.needsSortVertices() && this.vertexCount >= 2e4;\n },\n\n doSortVertices: function (cameraPos, frame) {\n var indices = this.indices;\n var p = vec3.create();\n\n if (!indices) {\n indices = this.indices = this.vertexCount > 0xffff ? new Uint32Array(this.vertexCount) : new Uint16Array(this.vertexCount);\n for (var i = 0; i < indices.length; i++) {\n indices[i] = i;\n }\n }\n // Do progressive quick sort.\n if (frame === 0) {\n var posAttr = this.attributes.position;\n var cameraPos = cameraPos.array;\n var noneCount = 0;\n if (!this._zList || this._zList.length !== this.vertexCount) {\n this._zList = new Float32Array(this.vertexCount);\n }\n\n var firstZ;\n for (var i = 0; i < this.vertexCount; i++) {\n posAttr.get(i, p);\n // Camera position is in object space\n var z = vec3.sqrDist(p, cameraPos);\n if (isNaN(z)) {\n // Put far away, NaN value may cause sort slow\n z = 1e7;\n noneCount++;\n }\n if (i === 0) {\n firstZ = z;\n z = 0;\n }\n else {\n // Only store the difference to avoid the precision issue.\n z = z - firstZ;\n }\n this._zList[i] = z;\n }\n\n this._noneCount = noneCount;\n }\n\n if (this.vertexCount < 2e4) {\n // Use simple native sort for simple geometries.\n if (frame === 0) {\n this._simpleSort(this._noneCount / this.vertexCount > 0.05);\n }\n }\n else {\n for (var i = 0; i < 3; i++) {\n this._progressiveQuickSort(frame * 3 + i);\n }\n }\n\n this.dirtyIndices();\n },\n\n _simpleSort: function (useNativeQuickSort) {\n var zList = this._zList;\n var indices = this.indices;\n function compare(a, b) {\n // Sort from far to near. which is descending order\n return zList[b] - zList[a];\n }\n\n // When too much value are equal, using native quick sort with three partition..\n // or the simple quick sort will be nearly O(n*n)\n // http://stackoverflow.com/questions/5126586/quicksort-complexity-when-all-the-elements-are-same\n\n // Otherwise simple quicksort is more effecient than v8 native quick sort when data all different.\n if (useNativeQuickSort) {\n Array.prototype.sort.call(indices, compare);\n }\n else {\n ProgressiveQuickSort.sort(indices, compare, 0, indices.length - 1);\n }\n },\n\n _progressiveQuickSort: function (frame) {\n var zList = this._zList;\n var indices = this.indices;\n\n this._quickSort = this._quickSort || new ProgressiveQuickSort();\n\n this._quickSort.step(indices, function (a, b) {\n return zList[b] - zList[a];\n }, frame);\n }\n};","export default \"@export ecgl.sdfSprite.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform float elapsedTime : 0;\\n\\nattribute vec3 position : POSITION;\\n\\n#ifdef VERTEX_SIZE\\nattribute float size;\\n#else\\nuniform float u_Size;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\nattribute vec4 a_FillColor: COLOR;\\nvarying vec4 v_Color;\\n#endif\\n\\n#ifdef VERTEX_ANIMATION\\nattribute vec3 prevPosition;\\nattribute float prevSize;\\nuniform float percent : 1.0;\\n#endif\\n\\n\\n#ifdef POSITIONTEXTURE_ENABLED\\nuniform sampler2D positionTexture;\\n#endif\\n\\nvarying float v_Size;\\n\\nvoid main()\\n{\\n\\n#ifdef POSITIONTEXTURE_ENABLED\\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\\n#else\\n\\n #ifdef VERTEX_ANIMATION\\n vec3 pos = mix(prevPosition, position, percent);\\n #else\\n vec3 pos = position;\\n #endif\\n gl_Position = worldViewProjection * vec4(pos, 1.0);\\n#endif\\n\\n#ifdef VERTEX_SIZE\\n#ifdef VERTEX_ANIMATION\\n v_Size = mix(prevSize, size, percent);\\n#else\\n v_Size = size;\\n#endif\\n#else\\n v_Size = u_Size;\\n#endif\\n\\n#ifdef VERTEX_COLOR\\n v_Color = a_FillColor;\\n #endif\\n\\n gl_PointSize = v_Size;\\n}\\n\\n@end\\n\\n@export ecgl.sdfSprite.fragment\\n\\nuniform vec4 color: [1, 1, 1, 1];\\nuniform vec4 strokeColor: [1, 1, 1, 1];\\nuniform float smoothing: 0.07;\\n\\nuniform float lineWidth: 0.0;\\n\\n#ifdef VERTEX_COLOR\\nvarying vec4 v_Color;\\n#endif\\n\\nvarying float v_Size;\\n\\nuniform sampler2D sprite;\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n gl_FragColor = color;\\n\\n vec4 _strokeColor = strokeColor;\\n\\n#ifdef VERTEX_COLOR\\n gl_FragColor *= v_Color;\\n #endif\\n\\n#ifdef SPRITE_ENABLED\\n float d = texture2D(sprite, gl_PointCoord).r;\\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\\n\\n if (lineWidth > 0.0) {\\n float sLineWidth = lineWidth / 2.0;\\n\\n float outlineMaxValue0 = 0.5 + sLineWidth;\\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\\n float outlineMinValue1 = 0.5 - sLineWidth;\\n\\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\\n float a = _strokeColor.a;\\n if (d <= outlineMinValue1) {\\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\\n }\\n else {\\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\\n }\\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\\n }\\n }\\n#endif\\n\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(gl_FragColor);\\n#endif\\n}\\n@end\";\n","import graphicGL from '../../util/graphicGL';\nimport verticesSortMixin from '../../util/geometry/verticesSortMixin';\nimport * as echarts from 'echarts/lib/echarts';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec4 = glmatrix.vec4;\n\nimport sdfSpriteGLSL from './sdfSprite.glsl.js';\ngraphicGL.Shader.import(sdfSpriteGLSL);\n\nvar PointsMesh = graphicGL.Mesh.extend(function () {\n var geometry = new graphicGL.Geometry({\n dynamic: true,\n attributes: {\n color: new graphicGL.Geometry.Attribute('color', 'float', 4, 'COLOR'),\n position: new graphicGL.Geometry.Attribute('position', 'float', 3, 'POSITION'),\n size: new graphicGL.Geometry.Attribute('size', 'float', 1),\n prevPosition: new graphicGL.Geometry.Attribute('prevPosition', 'float', 3),\n prevSize: new graphicGL.Geometry.Attribute('prevSize', 'float', 1)\n }\n });\n Object.assign(geometry, verticesSortMixin);\n\n var material = new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.sdfSprite'),\n transparent: true,\n depthMask: false\n });\n material.enableTexture('sprite');\n material.define('both', 'VERTEX_COLOR');\n material.define('both', 'VERTEX_SIZE');\n\n var sdfTexture = new graphicGL.Texture2D({\n image: document.createElement('canvas'),\n flipY: false\n });\n\n material.set('sprite', sdfTexture);\n\n // Custom pick methods.\n geometry.pick = this._pick.bind(this);\n\n return {\n geometry: geometry,\n material: material,\n mode: graphicGL.Mesh.POINTS,\n\n sizeScale: 1\n };\n}, {\n\n _pick: function (x, y, renderer, camera, renderable, out) {\n var positionNDC = this._positionNDC;\n if (!positionNDC) {\n return;\n }\n\n var viewport = renderer.viewport;\n var ndcScaleX = 2 / viewport.width;\n var ndcScaleY = 2 / viewport.height;\n // From near to far. indices have been sorted.\n for (var i = this.geometry.vertexCount - 1; i >= 0; i--) {\n var idx;\n if (!this.geometry.indices) {\n idx = i;\n }\n else {\n idx = this.geometry.indices[i];\n }\n\n var cx = positionNDC[idx * 2];\n var cy = positionNDC[idx * 2 + 1];\n\n var size = this.geometry.attributes.size.get(idx) / this.sizeScale;\n var halfSize = size / 2;\n\n if (\n x > (cx - halfSize * ndcScaleX) && x < (cx + halfSize * ndcScaleX)\n && y > (cy - halfSize * ndcScaleY) && y < (cy + halfSize * ndcScaleY)\n ) {\n var point = new graphicGL.Vector3();\n var pointWorld = new graphicGL.Vector3();\n this.geometry.attributes.position.get(idx, point.array);\n graphicGL.Vector3.transformMat4(pointWorld, point, this.worldTransform);\n out.push({\n vertexIndex: idx,\n point: point,\n pointWorld: pointWorld,\n target: this,\n distance: pointWorld.distance(camera.getWorldPosition())\n });\n }\n }\n },\n\n updateNDCPosition: function (worldViewProjection, is2D, api) {\n var positionNDC = this._positionNDC;\n var geometry = this.geometry;\n if (!positionNDC || positionNDC.length / 2 !== geometry.vertexCount) {\n positionNDC = this._positionNDC = new Float32Array(geometry.vertexCount * 2);\n }\n\n var pos = vec4.create();\n for (var i = 0; i < geometry.vertexCount; i++) {\n geometry.attributes.position.get(i, pos);\n pos[3] = 1;\n vec4.transformMat4(pos, pos, worldViewProjection.array);\n vec4.scale(pos, pos, 1 / pos[3]);\n\n positionNDC[i * 2] = pos[0];\n positionNDC[i * 2 + 1] = pos[1];\n }\n }\n});\n\nexport default PointsMesh;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport spriteUtil from '../../util/sprite';\nimport PointsMesh from './PointsMesh';\nimport LabelsBuilder from '../../component/common/LabelsBuilder';\nimport Matrix4 from 'claygl/src/math/Matrix4';\nimport retrieve from '../../util/retrieve';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\nimport { getVisualColor, getVisualOpacity } from '../../util/visual';\n\nvar SDF_RANGE = 20;\n\nvar Z_2D = -10;\n\nfunction isSymbolSizeSame(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1];\n}\n// TODO gl_PointSize has max value.\nfunction PointsBuilder(is2D, api) {\n this.rootNode = new graphicGL.Node();\n\n /**\n * @type {boolean}\n */\n this.is2D = is2D;\n\n this._labelsBuilder = new LabelsBuilder(256, 256, api);\n\n // Give a large render order.\n this._labelsBuilder.getMesh().renderOrder = 100;\n this.rootNode.add(this._labelsBuilder.getMesh());\n\n this._api = api;\n\n this._spriteImageCanvas = document.createElement('canvas');\n\n this._startDataIndex = 0;\n this._endDataIndex = 0;\n\n this._sizeScale = 1;\n}\n\nPointsBuilder.prototype = {\n\n constructor: PointsBuilder,\n\n /**\n * If highlight on over\n */\n highlightOnMouseover: true,\n\n update: function (seriesModel, ecModel, api, start, end) {\n // Swap barMesh\n var tmp = this._prevMesh;\n this._prevMesh = this._mesh;\n this._mesh = tmp;\n\n var data = seriesModel.getData();\n\n if (start == null) {\n start = 0;\n }\n if (end == null) {\n end = data.count();\n }\n this._startDataIndex = start;\n this._endDataIndex = end - 1;\n\n if (!this._mesh) {\n var material = this._prevMesh && this._prevMesh.material;\n this._mesh = new PointsMesh({\n // Render after axes\n renderOrder: 10,\n // FIXME\n frustumCulling: false\n });\n if (material) {\n this._mesh.material = material;\n }\n }\n var material = this._mesh.material;\n var geometry = this._mesh.geometry;\n var attributes = geometry.attributes;\n\n this.rootNode.remove(this._prevMesh);\n this.rootNode.add(this._mesh);\n\n this._setPositionTextureToMesh(this._mesh, this._positionTexture);\n\n var symbolInfo = this._getSymbolInfo(seriesModel, start, end);\n var dpr = api.getDevicePixelRatio();\n\n // TODO image symbol\n var itemStyle = seriesModel.getModel('itemStyle').getItemStyle();\n var largeMode = seriesModel.get('large');\n\n var pointSizeScale = 1;\n if (symbolInfo.maxSize > 2) {\n pointSizeScale = this._updateSymbolSprite(seriesModel, itemStyle, symbolInfo, dpr);\n material.enableTexture('sprite');\n }\n else {\n material.disableTexture('sprite');\n }\n\n attributes.position.init(end - start);\n var rgbaArr = [];\n if (largeMode) {\n material.undefine('VERTEX_SIZE');\n material.undefine('VERTEX_COLOR');\n\n var color = getVisualColor(data);\n var opacity = getVisualOpacity(data);\n graphicGL.parseColor(color, rgbaArr);\n rgbaArr[3] *= opacity;\n\n material.set({\n color: rgbaArr,\n 'u_Size': symbolInfo.maxSize * this._sizeScale\n });\n }\n else {\n material.set({\n color: [1, 1, 1, 1]\n });\n material.define('VERTEX_SIZE');\n material.define('VERTEX_COLOR');\n attributes.size.init(end - start);\n attributes.color.init(end - start);\n this._originalOpacity = new Float32Array(end - start);\n }\n\n var points = data.getLayout('points');\n\n var positionArr = attributes.position.value;\n\n var hasTransparentPoint = false;\n\n for (var i = 0; i < end - start; i++) {\n var i3 = i * 3;\n var i2 = i * 2;\n if (this.is2D) {\n positionArr[i3] = points[i2];\n positionArr[i3 + 1] = points[i2 + 1];\n positionArr[i3 + 2] = Z_2D;\n }\n else {\n positionArr[i3] = points[i3];\n positionArr[i3 + 1] = points[i3 + 1];\n positionArr[i3 + 2] = points[i3 + 2];\n }\n\n if (!largeMode) {\n var color = getItemVisualColor(data, i);\n var opacity = getItemVisualOpacity(data, i);\n graphicGL.parseColor(color, rgbaArr);\n rgbaArr[3] *= opacity;\n attributes.color.set(i, rgbaArr);\n if (rgbaArr[3] < 0.99) {\n hasTransparentPoint = true;\n }\n var symbolSize = data.getItemVisual(i, 'symbolSize');\n symbolSize = (symbolSize instanceof Array\n ? Math.max(symbolSize[0], symbolSize[1]) : symbolSize);\n\n // NaN pointSize may have strange result.\n if (isNaN(symbolSize)) {\n symbolSize = 0;\n }\n // Scale point size because canvas has margin.\n attributes.size.value[i] = symbolSize * pointSizeScale * this._sizeScale;\n\n // Save the original opacity for recover from fadeIn.\n this._originalOpacity[i] = rgbaArr[3];\n }\n\n }\n\n this._mesh.sizeScale = pointSizeScale;\n\n geometry.updateBoundingBox();\n geometry.dirty();\n\n // Update material.\n this._updateMaterial(seriesModel, itemStyle);\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n material[methodName]('fragment', 'SRGB_DECODE');\n }\n\n if (!largeMode) {\n this._updateLabelBuilder(seriesModel, start, end);\n }\n\n this._updateHandler(seriesModel, ecModel, api);\n\n this._updateAnimation(seriesModel);\n\n this._api = api;\n },\n\n getPointsMesh: function () {\n return this._mesh;\n },\n\n updateLabels: function (highlightDataIndices) {\n this._labelsBuilder.updateLabels(highlightDataIndices);\n },\n\n hideLabels: function () {\n this.rootNode.remove(this._labelsBuilder.getMesh());\n },\n\n showLabels: function () {\n this.rootNode.add(this._labelsBuilder.getMesh());\n },\n\n dispose: function () {\n this._labelsBuilder.dispose();\n },\n\n _updateSymbolSprite: function (seriesModel, itemStyle, symbolInfo, dpr) {\n symbolInfo.maxSize = Math.min(symbolInfo.maxSize * 2, 200);\n var symbolSize = [];\n if (symbolInfo.aspect > 1) {\n symbolSize[0] = symbolInfo.maxSize;\n symbolSize[1] = symbolInfo.maxSize / symbolInfo.aspect;\n }\n else {\n symbolSize[1] = symbolInfo.maxSize;\n symbolSize[0] = symbolInfo.maxSize * symbolInfo.aspect;\n }\n\n // In case invalid data.\n symbolSize[0] = symbolSize[0] || 1;\n symbolSize[1] = symbolSize[1] || 1;\n\n if (this._symbolType !== symbolInfo.type\n || !isSymbolSizeSame(this._symbolSize, symbolSize)\n || this._lineWidth !== itemStyle.lineWidth\n ) {\n spriteUtil.createSymbolSprite(symbolInfo.type, symbolSize, {\n fill: '#fff',\n lineWidth: itemStyle.lineWidth,\n stroke: 'transparent',\n shadowColor: 'transparent',\n minMargin: Math.min(symbolSize[0] / 2, 10)\n }, this._spriteImageCanvas);\n\n spriteUtil.createSDFFromCanvas(\n this._spriteImageCanvas, Math.min(this._spriteImageCanvas.width, 32), SDF_RANGE,\n this._mesh.material.get('sprite').image\n );\n\n this._symbolType = symbolInfo.type;\n this._symbolSize = symbolSize;\n this._lineWidth = itemStyle.lineWidth;\n }\n return this._spriteImageCanvas.width / symbolInfo.maxSize * dpr;\n\n },\n\n _updateMaterial: function (seriesModel, itemStyle) {\n var blendFunc = seriesModel.get('blendMode') === 'lighter'\n ? graphicGL.additiveBlend : null;\n var material = this._mesh.material;\n material.blend = blendFunc;\n\n material.set('lineWidth', itemStyle.lineWidth / SDF_RANGE);\n\n var strokeColor = graphicGL.parseColor(itemStyle.stroke);\n material.set('strokeColor', strokeColor);\n\n // Because of symbol texture, we always needs it be transparent.\n material.transparent = true;\n material.depthMask = false;\n material.depthTest = !this.is2D;\n material.sortVertices = !this.is2D;\n },\n\n _updateLabelBuilder: function (seriesModel, start, end) {\n var data =seriesModel.getData();\n var geometry = this._mesh.geometry;\n var positionArr = geometry.attributes.position.value;\n var start = this._startDataIndex;\n var pointSizeScale = this._mesh.sizeScale;\n this._labelsBuilder.updateData(data, start, end);\n\n this._labelsBuilder.getLabelPosition = function (dataIndex, positionDesc, distance) {\n var idx3 = (dataIndex - start) * 3;\n return [positionArr[idx3], positionArr[idx3 + 1], positionArr[idx3 + 2]];\n };\n\n this._labelsBuilder.getLabelDistance = function (dataIndex, positionDesc, distance) {\n var size = geometry.attributes.size.get(dataIndex - start) / pointSizeScale;\n return size / 2 + distance;\n };\n this._labelsBuilder.updateLabels();\n\n },\n\n _updateAnimation: function (seriesModel) {\n graphicGL.updateVertexAnimation(\n [['prevPosition', 'position'],\n ['prevSize', 'size']],\n this._prevMesh,\n this._mesh,\n seriesModel\n );\n },\n\n _updateHandler: function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n var pointsMesh = this._mesh;\n var self = this;\n\n var lastDataIndex = -1;\n var isCartesian3D = seriesModel.coordinateSystem\n && seriesModel.coordinateSystem.type === 'cartesian3D';\n\n var grid3DModel;\n if (isCartesian3D) {\n grid3DModel = seriesModel.coordinateSystem.model;\n }\n\n pointsMesh.seriesIndex = seriesModel.seriesIndex;\n\n pointsMesh.off('mousemove');\n pointsMesh.off('mouseout');\n\n pointsMesh.on('mousemove', function (e) {\n var dataIndex = e.vertexIndex + self._startDataIndex;\n if (dataIndex !== lastDataIndex) {\n if (this.highlightOnMouseover) {\n this.downplay(data, lastDataIndex);\n this.highlight(data, dataIndex);\n this._labelsBuilder.updateLabels([dataIndex]);\n }\n\n if (isCartesian3D) {\n api.dispatchAction({\n type: 'grid3DShowAxisPointer',\n value: [\n data.get(seriesModel.coordDimToDataDim('x')[0], dataIndex),\n data.get(seriesModel.coordDimToDataDim('y')[0], dataIndex),\n data.get(seriesModel.coordDimToDataDim('z')[0], dataIndex)\n ],\n grid3DIndex: grid3DModel.componentIndex\n });\n }\n }\n\n pointsMesh.dataIndex = dataIndex;\n lastDataIndex = dataIndex;\n }, this);\n pointsMesh.on('mouseout', function (e) {\n var dataIndex = e.vertexIndex + self._startDataIndex;\n if (this.highlightOnMouseover) {\n this.downplay(data, dataIndex);\n this._labelsBuilder.updateLabels();\n }\n lastDataIndex = -1;\n pointsMesh.dataIndex = -1;\n\n if (isCartesian3D) {\n api.dispatchAction({\n type: 'grid3DHideAxisPointer',\n grid3DIndex: grid3DModel.componentIndex\n });\n }\n }, this);\n },\n\n updateLayout: function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n if (!this._mesh) {\n return;\n }\n\n var positionArr = this._mesh.geometry.attributes.position.value;\n var points = data.getLayout('points');\n if (this.is2D) {\n for (var i = 0; i < points.length / 2; i++) {\n var i3 = i * 3;\n var i2 = i * 2;\n positionArr[i3] = points[i2];\n positionArr[i3 + 1] = points[i2 + 1];\n positionArr[i3 + 2] = Z_2D;\n }\n }\n else {\n for (var i = 0; i < points.length; i++) {\n positionArr[i] = points[i];\n }\n }\n this._mesh.geometry.dirty();\n\n api.getZr().refresh();\n },\n\n updateView: function (camera) {\n if (!this._mesh) {\n return;\n }\n\n var worldViewProjection = new Matrix4();\n Matrix4.mul(worldViewProjection, camera.viewMatrix, this._mesh.worldTransform);\n Matrix4.mul(worldViewProjection, camera.projectionMatrix, worldViewProjection);\n\n this._mesh.updateNDCPosition(worldViewProjection, this.is2D, this._api);\n },\n\n highlight: function (data, dataIndex) {\n if (dataIndex > this._endDataIndex || dataIndex < this._startDataIndex) {\n return;\n }\n var itemModel = data.getItemModel(dataIndex);\n var emphasisItemStyleModel = itemModel.getModel('emphasis.itemStyle');\n var emphasisColor = emphasisItemStyleModel.get('color');\n var emphasisOpacity = emphasisItemStyleModel.get('opacity');\n if (emphasisColor == null) {\n var color = getItemVisualColor(data, dataIndex);\n emphasisColor = echarts.color.lift(color, -0.4);\n }\n if (emphasisOpacity == null) {\n emphasisOpacity = getItemVisualOpacity(data, dataIndex);\n }\n var colorArr = graphicGL.parseColor(emphasisColor);\n colorArr[3] *= emphasisOpacity;\n\n this._mesh.geometry.attributes.color.set(dataIndex - this._startDataIndex, colorArr);\n this._mesh.geometry.dirtyAttribute('color');\n\n this._api.getZr().refresh();\n },\n\n downplay: function (data, dataIndex) {\n if (dataIndex > this._endDataIndex || dataIndex < this._startDataIndex) {\n return;\n }\n var color = getItemVisualColor(data, dataIndex);\n var opacity = getItemVisualOpacity(data, dataIndex);\n\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= opacity;\n\n this._mesh.geometry.attributes.color.set(dataIndex - this._startDataIndex, colorArr);\n this._mesh.geometry.dirtyAttribute('color');\n\n this._api.getZr().refresh();\n },\n\n fadeOutAll: function (fadeOutPercent) {\n if (this._originalOpacity) {\n var geo = this._mesh.geometry;\n for (var i = 0; i < geo.vertexCount; i++) {\n var fadeOutOpacity = this._originalOpacity[i] * fadeOutPercent;\n geo.attributes.color.value[i * 4 + 3] = fadeOutOpacity;\n }\n geo.dirtyAttribute('color');\n\n this._api.getZr().refresh();\n }\n },\n\n fadeInAll: function () {\n this.fadeOutAll(1);\n },\n\n setPositionTexture: function (texture) {\n if (this._mesh) {\n this._setPositionTextureToMesh(this._mesh, texture);\n }\n\n this._positionTexture = texture;\n },\n\n removePositionTexture: function () {\n this._positionTexture = null;\n if (this._mesh) {\n this._setPositionTextureToMesh(this._mesh, null);\n }\n },\n\n setSizeScale: function (sizeScale) {\n if (sizeScale !== this._sizeScale) {\n if (this._mesh) {\n var originalSize = this._mesh.material.get('u_Size');\n this._mesh.material.set('u_Size', originalSize / this._sizeScale * sizeScale);\n\n var attributes = this._mesh.geometry.attributes;\n if (attributes.size.value) {\n for (var i = 0; i < attributes.size.value.length; i++) {\n attributes.size.value[i] = attributes.size.value[i] / this._sizeScale * sizeScale;\n }\n }\n }\n this._sizeScale = sizeScale;\n }\n },\n\n _setPositionTextureToMesh: function (mesh, texture) {\n if (texture) {\n mesh.material.set('positionTexture', texture);\n }\n mesh.material[\n texture ? 'enableTexture' : 'disableTexture'\n ]('positionTexture');\n },\n\n _getSymbolInfo: function (seriesModel, start, end) {\n if (seriesModel.get('large')) {\n var symbolSize = retrieve.firstNotNull(seriesModel.get('symbolSize'), 1);\n var maxSymbolSize;\n var symbolAspect;\n if (symbolSize instanceof Array) {\n maxSymbolSize = Math.max(symbolSize[0], symbolSize[1]);\n symbolAspect = symbolSize[0] / symbolSize[1];\n }\n else {\n maxSymbolSize = symbolSize;\n symbolAspect = 1;\n }\n return {\n maxSize: symbolSize,\n type: seriesModel.get('symbol'),\n aspect: symbolAspect\n }\n }\n var data = seriesModel.getData();\n var symbolAspect;\n var differentSymbolAspect = false;\n var symbolType = data.getItemVisual(0, 'symbol') || 'circle';\n var differentSymbolType = false;\n var maxSymbolSize = 0;\n\n for (var idx = start; idx < end; idx++) {\n var symbolSize = data.getItemVisual(idx, 'symbolSize');\n var currentSymbolType = data.getItemVisual(idx, 'symbol');\n var currentSymbolAspect;\n if (!(symbolSize instanceof Array)) {\n // Ignore NaN value.\n if (isNaN(symbolSize)) {\n continue;\n }\n\n currentSymbolAspect = 1;\n maxSymbolSize = Math.max(symbolSize, maxSymbolSize);\n }\n else {\n currentSymbolAspect = symbolSize[0] / symbolSize[1];\n maxSymbolSize = Math.max(Math.max(symbolSize[0], symbolSize[1]), maxSymbolSize);\n }\n if (process.env.NODE_ENV !== 'production') {\n if (symbolAspect != null && Math.abs(currentSymbolAspect - symbolAspect) > 0.05) {\n differentSymbolAspect = true;\n }\n if (currentSymbolType !== symbolType) {\n differentSymbolType = true;\n }\n }\n symbolType = currentSymbolType;\n symbolAspect = currentSymbolAspect;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (differentSymbolAspect) {\n console.warn('Different symbol width / height ratio will be ignored.');\n }\n if (differentSymbolType) {\n console.warn('Different symbol type will be ignored.');\n }\n }\n\n return {\n maxSize: maxSymbolSize,\n type: symbolType,\n aspect: symbolAspect\n };\n }\n};\n\nexport default PointsBuilder;\n","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport format from '../../util/format';\n\nimport PointsBuilder from '../common/PointsBuilder';\n\nexport default echarts.ChartView.extend({\n\n type: 'scatter3D',\n\n hasSymbolVisual: true,\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n\n this._pointsBuilderList = [];\n this._currentStep = 0;\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n if (!seriesModel.getData().count()) {\n return;\n }\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n this._camera = coordSys.viewGL.camera;\n\n var pointsBuilder = this._pointsBuilderList[0];\n if (!pointsBuilder) {\n pointsBuilder = this._pointsBuilderList[0] = new PointsBuilder(false, api);\n }\n this._pointsBuilderList.length = 1;\n\n this.groupGL.add(pointsBuilder.rootNode);\n pointsBuilder.update(seriesModel, ecModel, api);\n pointsBuilder.updateView(coordSys.viewGL.camera);\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invalid coordinate system');\n }\n }\n },\n\n incrementalPrepareRender: function (seriesModel, ecModel, api) {\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n this._camera = coordSys.viewGL.camera;\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invalid coordinate system');\n }\n }\n\n this.groupGL.removeAll();\n this._currentStep = 0;\n },\n\n incrementalRender: function (params, seriesModel, ecModel, api) {\n // TODO Sort transparency.\n if (params.end <= params.start) {\n return;\n }\n var pointsBuilder = this._pointsBuilderList[this._currentStep];\n if (!pointsBuilder) {\n pointsBuilder = new PointsBuilder(false, api);\n this._pointsBuilderList[this._currentStep] = pointsBuilder;\n }\n this.groupGL.add(pointsBuilder.rootNode);\n\n pointsBuilder.update(seriesModel, ecModel, api, params.start, params.end);\n pointsBuilder.updateView(seriesModel.coordinateSystem.viewGL.camera);\n\n this._currentStep++;\n },\n\n updateCamera: function () {\n this._pointsBuilderList.forEach(function (pointsBuilder) {\n pointsBuilder.updateView(this._camera);\n }, this);\n },\n\n highlight: function (seriesModel, ecModel, api, payload) {\n this._toggleStatus('highlight', seriesModel, ecModel, api, payload);\n },\n\n downplay: function (seriesModel, ecModel, api, payload) {\n this._toggleStatus('downplay', seriesModel, ecModel, api, payload);\n },\n\n _toggleStatus: function (status, seriesModel, ecModel, api, payload) {\n var data = seriesModel.getData();\n var dataIndex = retrieve.queryDataIndex(data, payload);\n\n var isHighlight = status === 'highlight';\n if (dataIndex != null) {\n echarts.util.each(format.normalizeToArray(dataIndex), function (dataIdx) {\n for (var i = 0; i < this._pointsBuilderList.length; i++) {\n var pointsBuilder = this._pointsBuilderList[i];\n isHighlight ? pointsBuilder.highlight(data, dataIdx) : pointsBuilder.downplay(data, dataIdx);\n }\n }, this);\n }\n else {\n // PENDING, OPTIMIZE\n data.each(function (dataIdx) {\n for (var i = 0; i < this._pointsBuilderList.length; i++) {\n var pointsBuilder = this._pointsBuilderList[i];\n isHighlight ? pointsBuilder.highlight(data, dataIdx) : pointsBuilder.downplay(data, dataIdx);\n }\n });\n }\n },\n\n dispose: function () {\n this._pointsBuilderList.forEach(function (pointsBuilder) {\n pointsBuilder.dispose();\n });\n this.groupGL.removeAll();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Scatter3DSeries from './Scatter3DSeries';\nimport Scatter3DView from './Scatter3DView';\n\nexport function install(registers) {\n registers.registerChartView(Scatter3DView);\n registers.registerSeriesModel(Scatter3DSeries);\n\n registers.registerLayout({\n seriesType: 'scatter3D',\n reset: function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n\n if (coordSys) {\n var coordDims = coordSys.dimensions;\n if (coordDims.length < 3) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('scatter3D needs 3D coordinateSystem');\n }\n return;\n }\n var dims = coordDims.map(function (coordDim) {\n return seriesModel.coordDimToDataDim(coordDim)[0];\n });\n\n var item = [];\n var out = [];\n\n return {\n progress: function (params, data) {\n var points = new Float32Array((params.end - params.start) * 3);\n for (var idx = params.start; idx < params.end; idx++) {\n var idx3 = (idx - params.start) * 3;\n item[0] = data.get(dims[0], idx);\n item[1] = data.get(dims[1], idx);\n item[2] = data.get(dims[2], idx);\n coordSys.dataToPoint(item, out);\n points[idx3] = out[0];\n points[idx3 + 1] = out[1];\n points[idx3 + 2] = out[2];\n }\n data.setLayout('points', points);\n }\n };\n }\n }\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './scatter3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec3 = glmatrix.vec3;\nvar vec2 = glmatrix.vec2;\nvar normalize = vec3.normalize;\nvar cross = vec3.cross;\nvar sub = vec3.sub;\nvar add = vec3.add;\nvar create = vec3.create;\n\nvar normal = create();\nvar tangent = create();\nvar bitangent = create();\nvar halfVector = create();\n\nvar coord0 = [];\nvar coord1 = [];\n\nfunction getCubicPointsOnGlobe(coords, coordSys) {\n vec2.copy(coord0, coords[0]);\n vec2.copy(coord1, coords[1]);\n\n var pts = [];\n var p0 = pts[0] = create();\n var p1 = pts[1] = create();\n var p2 = pts[2] = create();\n var p3 = pts[3] = create();\n coordSys.dataToPoint(coord0, p0);\n coordSys.dataToPoint(coord1, p3);\n // Get p1\n normalize(normal, p0);\n // TODO p0-p3 is parallel with normal\n sub(tangent, p3, p0);\n normalize(tangent, tangent);\n cross(bitangent, tangent, normal);\n normalize(bitangent, bitangent);\n cross(tangent, normal, bitangent);\n // p1 is half vector of p0 and tangent on p0\n add(p1, normal, tangent);\n normalize(p1, p1);\n\n // Get p2\n normalize(normal, p3);\n sub(tangent, p0, p3);\n normalize(tangent, tangent);\n cross(bitangent, tangent, normal);\n normalize(bitangent, bitangent);\n cross(tangent, normal, bitangent);\n // p2 is half vector of p3 and tangent on p3\n add(p2, normal, tangent);\n normalize(p2, p2);\n\n // Project distance of p0 on halfVector\n add(halfVector, p0, p3);\n normalize(halfVector, halfVector);\n var projDist = vec3.dot(p0, halfVector);\n // Angle of halfVector and p1\n var cosTheta = vec3.dot(halfVector, p1);\n\n var len = (Math.max(vec3.len(p0), vec3.len(p3)) - projDist) / cosTheta * 2;\n\n vec3.scaleAndAdd(p1, p0, p1, len);\n vec3.scaleAndAdd(p2, p3, p2, len);\n\n return pts;\n}\n\nfunction getCubicPointsOnPlane(coords, coordSys, up) {\n var pts = [];\n var p0 = pts[0] = vec3.create();\n var p1 = pts[1] = vec3.create();\n var p2 = pts[2] = vec3.create();\n var p3 = pts[3] = vec3.create();\n\n coordSys.dataToPoint(coords[0], p0);\n coordSys.dataToPoint(coords[1], p3);\n\n var len = vec3.dist(p0, p3);\n vec3.lerp(p1, p0, p3, 0.3);\n vec3.lerp(p2, p0, p3, 0.3);\n\n vec3.scaleAndAdd(p1, p1, up, Math.min(len * 0.1, 10));\n vec3.scaleAndAdd(p2, p2, up, Math.min(len * 0.1, 10));\n\n return pts;\n}\n\nfunction getPolylinePoints(coords, coordSys) {\n var pts = new Float32Array(coords.length * 3);\n var off = 0;\n var pt = [];\n for (var i = 0; i < coords.length; i++) {\n coordSys.dataToPoint(coords[i], pt);\n pts[off++] = pt[0];\n pts[off++] = pt[1];\n pts[off++] = pt[2];\n }\n return pts;\n}\n\nfunction prepareCoords(data) {\n var coordsList = [];\n\n data.each(function (idx) {\n var itemModel = data.getItemModel(idx);\n var coords = (itemModel.option instanceof Array) ?\n itemModel.option : itemModel.getShallow('coords', true);\n\n if (process.env.NODE_ENV !== 'production') {\n if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) {\n throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.');\n }\n }\n coordsList.push(coords);\n });\n\n return {\n coordsList: coordsList\n };\n}\n\nfunction layoutGlobe(seriesModel, coordSys) {\n var data = seriesModel.getData();\n var isPolyline = seriesModel.get('polyline');\n\n data.setLayout('lineType', isPolyline ? 'polyline' : 'cubicBezier');\n\n var res = prepareCoords(data);\n\n data.each(function (idx) {\n var coords = res.coordsList[idx];\n var getPointsMethod = isPolyline ? getPolylinePoints : getCubicPointsOnGlobe;\n data.setItemLayout(idx, getPointsMethod(coords, coordSys));\n });\n}\n\nfunction layoutOnPlane(seriesModel, coordSys, normal) {\n var data = seriesModel.getData();\n var isPolyline = seriesModel.get('polyline');\n\n var res = prepareCoords(data);\n\n data.setLayout('lineType', isPolyline ? 'polyline' : 'cubicBezier');\n\n data.each(function (idx) {\n var coords = res.coordsList[idx];\n var pts = isPolyline ? getPolylinePoints(coords, coordSys)\n : getCubicPointsOnPlane(coords, coordSys, normal);\n data.setItemLayout(idx, pts);\n });\n}\n\nexport default function lines3DLayout(ecModel, api) {\n ecModel.eachSeriesByType('lines3D', function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys.type === 'globe') {\n layoutGlobe(seriesModel, coordSys);\n }\n else if (coordSys.type === 'geo3D') {\n layoutOnPlane(seriesModel, coordSys, [0, 1, 0]);\n }\n else if (coordSys.type === 'mapbox3D' || coordSys.type === 'maptalks3D') {\n layoutOnPlane(seriesModel, coordSys, [0, 0, 1]);\n }\n });\n};","import * as echarts from 'echarts/lib/echarts';\n\nexport default echarts.SeriesModel.extend({\n\n type: 'series.lines3D',\n\n dependencies: ['globe'],\n\n visualStyleAccessPath: 'lineStyle',\n visualDrawType: 'stroke',\n\n getInitialData: function (option, ecModel) {\n var lineData = new echarts.List(['value'], this);\n lineData.hasItemOption = false;\n lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {\n // dataItem is simply coords\n if (dataItem instanceof Array) {\n return NaN;\n }\n else {\n lineData.hasItemOption = true;\n var value = dataItem.value;\n if (value != null) {\n return value instanceof Array ? value[dimIndex] : value;\n }\n }\n });\n\n return lineData;\n },\n\n defaultOption: {\n\n coordinateSystem: 'globe',\n\n globeIndex: 0,\n\n geo3DIndex: 0,\n\n zlevel: -10,\n\n polyline: false,\n\n effect: {\n show: false,\n period: 4,\n // Trail width\n trailWidth: 4,\n trailLength: 0.2,\n\n spotIntensity: 6\n },\n\n silent: true,\n\n // Support source-over, lighter\n blendMode: 'source-over',\n\n lineStyle: {\n width: 1,\n opacity: 0.5\n // color\n }\n }\n});","export default \"@export ecgl.trail2.vertex\\nattribute vec3 position: POSITION;\\nattribute vec3 positionPrev;\\nattribute vec3 positionNext;\\nattribute float offset;\\nattribute float dist;\\nattribute float distAll;\\nattribute float start;\\n\\nattribute vec4 a_Color : COLOR;\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform vec4 viewport : VIEWPORT;\\nuniform float near : NEAR;\\n\\nuniform float speed : 0;\\nuniform float trailLength: 0.3;\\nuniform float time;\\nuniform float period: 1000;\\n\\nuniform float spotSize: 1;\\n\\nvarying vec4 v_Color;\\nvarying float v_Percent;\\nvarying float v_SpotPercent;\\n\\n@import ecgl.common.wireframe.vertexHeader\\n\\n@import ecgl.lines3D.clipNear\\n\\nvoid main()\\n{\\n @import ecgl.lines3D.expandLine\\n\\n gl_Position = currProj;\\n\\n v_Color = a_Color;\\n\\n @import ecgl.common.wireframe.vertexMain\\n\\n#ifdef CONSTANT_SPEED\\n float t = mod((speed * time + start) / distAll, 1. + trailLength) - trailLength;\\n#else\\n float t = mod((time + start) / period, 1. + trailLength) - trailLength;\\n#endif\\n\\n float trailLen = distAll * trailLength;\\n\\n v_Percent = (dist - t * distAll) / trailLen;\\n\\n v_SpotPercent = spotSize / distAll;\\n\\n }\\n@end\\n\\n\\n@export ecgl.trail2.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\nuniform float spotIntensity: 5;\\n\\nvarying vec4 v_Color;\\nvarying float v_Percent;\\nvarying float v_SpotPercent;\\n\\n@import ecgl.common.wireframe.fragmentHeader\\n\\n@import clay.util.srgb\\n\\nvoid main()\\n{\\n if (v_Percent > 1.0 || v_Percent < 0.0) {\\n discard;\\n }\\n\\n float fade = v_Percent;\\n\\n#ifdef SRGB_DECODE\\n gl_FragColor = sRGBToLinear(color * v_Color);\\n#else\\n gl_FragColor = color * v_Color;\\n#endif\\n\\n @import ecgl.common.wireframe.fragmentMain\\n\\n if (v_Percent > (1.0 - v_SpotPercent)) {\\n gl_FragColor.rgb *= spotIntensity;\\n }\\n\\n gl_FragColor.a *= fade;\\n}\\n\\n@end\";\n","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport glmatrix from 'claygl/src/dep/glmatrix';\n\nimport Lines3DGeometry from '../../util/geometry/Lines3D';\nimport trail2GLSL from './shader/trail2.glsl.js';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nvar vec3 = glmatrix.vec3;\n\nfunction sign(a) {\n return a > 0 ? 1 : -1;\n}\n\ngraphicGL.Shader.import(trail2GLSL);\n\nexport default graphicGL.Mesh.extend(function () {\n\n var material = new graphicGL.Material({\n shader: new graphicGL.Shader(\n graphicGL.Shader.source('ecgl.trail2.vertex'),\n graphicGL.Shader.source('ecgl.trail2.fragment')\n ),\n transparent: true,\n depthMask: false\n });\n\n var geometry = new Lines3DGeometry({\n dynamic: true\n });\n geometry.createAttribute('dist', 'float', 1);\n geometry.createAttribute('distAll', 'float', 1);\n geometry.createAttribute('start', 'float', 1);\n\n return {\n geometry: geometry,\n material: material,\n culling: false,\n $ignorePicking: true\n };\n}, {\n\n updateData: function (data, api, lines3DGeometry) {\n var seriesModel = data.hostModel;\n var geometry = this.geometry;\n\n var effectModel = seriesModel.getModel('effect');\n var size = effectModel.get('trailWidth') * api.getDevicePixelRatio();\n var trailLength = effectModel.get('trailLength');\n\n var speed = seriesModel.get('effect.constantSpeed');\n var period = seriesModel.get('effect.period') * 1000;\n var useConstantSpeed = speed != null;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!this.getScene()) {\n console.error('TrailMesh must been add to scene before updateData');\n }\n }\n\n useConstantSpeed\n ? this.material.set('speed', speed / 1000)\n : this.material.set('period', period);\n\n this.material[useConstantSpeed ? 'define' : 'undefine']('vertex', 'CONSTANT_SPEED');\n\n var isPolyline = seriesModel.get('polyline');\n\n geometry.trailLength = trailLength;\n this.material.set('trailLength', trailLength);\n\n geometry.resetOffset();\n\n ['position', 'positionPrev', 'positionNext'].forEach(function (attrName) {\n geometry.attributes[attrName].value = lines3DGeometry.attributes[attrName].value;\n });\n\n var extraAttrs = ['dist', 'distAll', 'start', 'offset', 'color'];\n\n extraAttrs.forEach(function (attrName) {\n geometry.attributes[attrName].init(geometry.vertexCount);\n });\n geometry.indices = lines3DGeometry.indices;\n\n var colorArr = [];\n var effectColor = effectModel.get('trailColor');\n var effectOpacity = effectModel.get('trailOpacity');\n var hasEffectColor = effectColor != null;\n var hasEffectOpacity = effectOpacity != null;\n\n this.updateWorldTransform();\n var xScale = this.worldTransform.x.len();\n var yScale = this.worldTransform.y.len();\n var zScale = this.worldTransform.z.len();\n\n var vertexOffset = 0;\n\n var maxDistance = 0;\n\n data.each(function (idx) {\n var pts = data.getItemLayout(idx);\n var opacity = hasEffectOpacity ? effectOpacity : getItemVisualOpacity(data, idx);\n var color = getItemVisualColor(data, idx);\n\n if (opacity == null) {\n opacity = 1;\n }\n colorArr = graphicGL.parseColor(hasEffectColor ? effectColor : color, colorArr);\n colorArr[3] *= opacity;\n\n var vertexCount = isPolyline\n ? lines3DGeometry.getPolylineVertexCount(pts)\n : lines3DGeometry.getCubicCurveVertexCount(pts[0], pts[1], pts[2], pts[3])\n\n var dist = 0;\n var pos = [];\n var posPrev = [];\n for (var i = vertexOffset; i < vertexOffset + vertexCount; i++) {\n geometry.attributes.position.get(i, pos);\n pos[0] *= xScale;\n pos[1] *= yScale;\n pos[2] *= zScale;\n if (i > vertexOffset) {\n dist += vec3.dist(pos, posPrev);\n }\n geometry.attributes.dist.set(i, dist);\n vec3.copy(posPrev, pos);\n }\n\n maxDistance = Math.max(maxDistance, dist);\n\n var randomStart = Math.random() * (useConstantSpeed ? dist : period);\n for (var i = vertexOffset; i < vertexOffset + vertexCount; i++) {\n geometry.attributes.distAll.set(i, dist);\n geometry.attributes.start.set(i, randomStart);\n\n geometry.attributes.offset.set(\n i, sign(lines3DGeometry.attributes.offset.get(i)) * size / 2\n );\n geometry.attributes.color.set(i, colorArr);\n }\n\n vertexOffset += vertexCount;\n });\n\n this.material.set('spotSize', maxDistance * 0.1 * trailLength);\n this.material.set('spotIntensity', effectModel.get('spotIntensity'));\n\n geometry.dirty();\n },\n\n setAnimationTime: function (time) {\n this.material.set('time', time);\n }\n});","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport LinesGeometry from '../../util/geometry/Lines3D';\n// import TrailMesh from './TrailMesh';\nimport TrailMesh2 from './TrailMesh2';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nimport lines3DGLSL from '../../util/shader/lines3D.glsl.js';\ngraphicGL.Shader.import(lines3DGLSL);\n\nfunction getCoordSysSize(coordSys) {\n if (coordSys.radius != null) {\n return coordSys.radius;\n }\n if (coordSys.size != null) {\n return Math.max(coordSys.size[0], coordSys.size[1], coordSys.size[2]);\n }\n else {\n return 100;\n }\n}\n\nexport default echarts.ChartView.extend({\n\n type: 'lines3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this.groupGL = new graphicGL.Node();\n\n this._meshLinesMaterial = new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.meshLines3D'),\n transparent: true,\n depthMask: false\n });\n this._linesMesh = new graphicGL.Mesh({\n geometry: new LinesGeometry(),\n material: this._meshLinesMaterial,\n $ignorePicking: true\n });\n\n // this._trailMesh = new TrailMesh();\n this._trailMesh = new TrailMesh2();\n },\n\n render: function (seriesModel, ecModel, api) {\n\n this.groupGL.add(this._linesMesh);\n\n var coordSys = seriesModel.coordinateSystem;\n var data = seriesModel.getData();\n\n if (coordSys && coordSys.viewGL) {\n var viewGL = coordSys.viewGL;\n viewGL.add(this.groupGL);\n\n this._updateLines(seriesModel, ecModel, api);\n\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._linesMesh.material[methodName]('fragment', 'SRGB_DECODE');\n this._trailMesh.material[methodName]('fragment', 'SRGB_DECODE');\n }\n\n var trailMesh = this._trailMesh;\n trailMesh.stopAnimation();\n\n if (seriesModel.get('effect.show')) {\n this.groupGL.add(trailMesh);\n\n trailMesh.updateData(data, api, this._linesMesh.geometry);\n\n trailMesh.__time = trailMesh.__time || 0;\n var time = 3600 * 1000; // 1hour\n this._curveEffectsAnimator = trailMesh.animate('', { loop: true })\n .when(time, {\n __time: time\n })\n .during(function () {\n trailMesh.setAnimationTime(trailMesh.__time);\n })\n .start();\n }\n else {\n this.groupGL.remove(trailMesh);\n this._curveEffectsAnimator = null;\n }\n\n this._linesMesh.material.blend = this._trailMesh.material.blend\n = seriesModel.get('blendMode') === 'lighter'\n ? graphicGL.additiveBlend : null;\n },\n\n pauseEffect: function () {\n if (this._curveEffectsAnimator) {\n this._curveEffectsAnimator.pause();\n }\n },\n\n resumeEffect: function () {\n if (this._curveEffectsAnimator) {\n this._curveEffectsAnimator.resume();\n }\n },\n\n toggleEffect: function () {\n var animator = this._curveEffectsAnimator;\n if (animator) {\n animator.isPaused() ? animator.resume() : animator.pause();\n }\n },\n\n _updateLines: function (seriesModel, ecModel, api) {\n var data = seriesModel.getData();\n var coordSys = seriesModel.coordinateSystem;\n var geometry = this._linesMesh.geometry;\n var isPolyline = seriesModel.get('polyline');\n\n geometry.expandLine = true;\n\n var size = getCoordSysSize(coordSys);\n geometry.segmentScale = size / 20;\n\n var lineWidthQueryPath = 'lineStyle.width'.split('.');\n var dpr = api.getDevicePixelRatio();\n var maxLineWidth = 0;\n data.each(function (idx) {\n var itemModel = data.getItemModel(idx);\n var lineWidth = itemModel.get(lineWidthQueryPath);\n if (lineWidth == null) {\n lineWidth = 1;\n }\n data.setItemVisual(idx, 'lineWidth', lineWidth);\n maxLineWidth = Math.max(lineWidth, maxLineWidth);\n });\n\n // Must set useNativeLine before calling any other methods\n geometry.useNativeLine = false;\n\n var nVertex = 0;\n var nTriangle = 0;\n data.each(function (idx) {\n var pts = data.getItemLayout(idx);\n if (isPolyline) {\n nVertex += geometry.getPolylineVertexCount(pts);\n nTriangle += geometry.getPolylineTriangleCount(pts);\n }\n else {\n nVertex += geometry.getCubicCurveVertexCount(pts[0], pts[1], pts[2], pts[3]);\n nTriangle += geometry.getCubicCurveTriangleCount(pts[0], pts[1], pts[2], pts[3]);\n }\n });\n\n geometry.setVertexCount(nVertex);\n geometry.setTriangleCount(nTriangle);\n geometry.resetOffset();\n\n var colorArr = [];\n data.each(function (idx) {\n var pts = data.getItemLayout(idx);\n var color = getItemVisualColor(data, idx);\n var opacity = getItemVisualOpacity(data, idx);\n var lineWidth = data.getItemVisual(idx, 'lineWidth') * dpr;\n if (opacity == null) {\n opacity = 1;\n }\n\n colorArr = graphicGL.parseColor(color, colorArr);\n colorArr[3] *= opacity;\n if (isPolyline) {\n geometry.addPolyline(pts, colorArr, lineWidth);\n }\n else {\n geometry.addCubicCurve(pts[0], pts[1], pts[2], pts[3], colorArr, lineWidth);\n }\n });\n\n geometry.dirty();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport lines3DLayout from './lines3DLayout';\nimport Lines3DSeries from './Lines3DSeries';\nimport Lines3DView from './Lines3DView';\n\nexport function install(registers) {\n registers.registerChartView(Lines3DView);\n registers.registerSeriesModel(Lines3DSeries);\n\n registers.registerLayout(lines3DLayout);\n\n registers.registerAction({\n type: 'lines3DPauseEffect',\n event: 'lines3deffectpaused',\n update: 'series.lines3D:pauseEffect'\n }, function () {});\n\n registers.registerAction({\n type: 'lines3DResumeEffect',\n event: 'lines3deffectresumed',\n update: 'series.lines3D:resumeEffect'\n }, function () {});\n\n registers.registerAction({\n type: 'lines3DToggleEffect',\n event: 'lines3deffectchanged',\n update: 'series.lines3D:toggleEffect'\n }, function () {});\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './lines3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport componentShadingMixin from '../../component/common/componentShadingMixin';\n\nfunction transformPolygon(coordSys, poly) {\n var ret = [];\n for (var i = 0; i < poly.length; i++) {\n ret.push(coordSys.dataToPoint(poly[i]));\n }\n return ret;\n}\n\nvar Polygons3DSeries = echarts.SeriesModel.extend({\n\n type: 'series.polygons3D',\n\n getRegionModel: function (idx) {\n return this.getData().getItemModel(idx);\n },\n\n getRegionPolygonCoords: function (idx) {\n var coordSys = this.coordinateSystem;\n var itemModel = this.getData().getItemModel(idx);\n var coords = itemModel.option instanceof Array\n ? itemModel.option : itemModel.getShallow('coords');\n if (!itemModel.get('multiPolygon')) {\n coords = [coords];\n }\n // TODO Validate\n var out = [];\n for (var i = 0; i < coords.length; i++) {\n // TODO Convert here ?\n var interiors = [];\n for (var k = 1; k < coords[i].length; k++) {\n interiors.push(transformPolygon(coordSys, coords[i][k]));\n }\n out.push({\n exterior: transformPolygon(coordSys, coords[i][0]),\n interiors: interiors\n });\n }\n return out;\n },\n\n getInitialData: function (option) {\n var polygonsData = new echarts.List(['value'], this);\n polygonsData.hasItemOption = false;\n polygonsData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {\n // dataItem is simply coords\n if (dataItem instanceof Array) {\n return NaN;\n }\n else {\n polygonsData.hasItemOption = true;\n var value = dataItem.value;\n if (value != null) {\n return value instanceof Array ? value[dimIndex] : value;\n }\n }\n });\n\n return polygonsData;\n },\n\n defaultOption: {\n\n show: true,\n\n data: null,\n\n multiPolygon: false,\n\n progressiveThreshold: 1e3,\n progressive: 1e3,\n\n zlevel: -10,\n\n label: {\n show: false,\n // Distance in 3d space.\n distance: 2,\n\n textStyle: {\n fontSize: 20,\n color: '#000',\n backgroundColor: 'rgba(255,255,255,0.7)',\n padding: 3,\n borderRadius: 4\n }\n },\n\n itemStyle: {\n color: '#fff',\n borderWidth: 0,\n borderColor: '#333'\n },\n\n emphasis: {\n itemStyle: {\n color: '#639fc0'\n },\n label: {\n show: true\n }\n }\n }\n});\n\necharts.util.merge(Polygons3DSeries.prototype, componentShadingMixin);\n\nexport default Polygons3DSeries;","import * as echarts from 'echarts/lib/echarts';\nimport Geo3DBuilder from '../../component/common/Geo3DBuilder';\nimport graphicGL from '../../util/graphicGL';\n\nexport default echarts.ChartView.extend({\n\n type: 'polygons3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this.groupGL = new graphicGL.Node();\n\n this._geo3DBuilderList = [];\n\n this._currentStep = 0;\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n }\n\n var geo3DBuilder = this._geo3DBuilderList[0];\n if (!geo3DBuilder) {\n geo3DBuilder = new Geo3DBuilder(api);\n geo3DBuilder.extrudeY = coordSys.type !== 'mapbox3D'\n && coordSys.type !== 'maptalks3D';\n this._geo3DBuilderList[0] = geo3DBuilder;\n }\n this._updateShaderDefines(coordSys, geo3DBuilder);\n\n geo3DBuilder.update(seriesModel, ecModel, api);\n this._geo3DBuilderList.length = 1;\n\n this.groupGL.add(geo3DBuilder.rootNode);\n },\n\n incrementalPrepareRender: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n\n var coordSys = seriesModel.coordinateSystem;\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n }\n\n this._currentStep = 0;\n },\n\n incrementalRender: function (params, seriesModel, ecModel, api) {\n var geo3DBuilder = this._geo3DBuilderList[this._currentStep];\n var coordSys = seriesModel.coordinateSystem;\n if (!geo3DBuilder) {\n geo3DBuilder = new Geo3DBuilder(api);\n geo3DBuilder.extrudeY = coordSys.type !== 'mapbox3D'\n && coordSys.type !== 'maptalks3D';\n this._geo3DBuilderList[this._currentStep] = geo3DBuilder;\n }\n geo3DBuilder.update(seriesModel, ecModel, api, params.start, params.end);\n this.groupGL.add(geo3DBuilder.rootNode);\n\n this._updateShaderDefines(coordSys, geo3DBuilder);\n\n this._currentStep++;\n },\n\n _updateShaderDefines: function (coordSys, geo3DBuilder) {\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n geo3DBuilder.rootNode.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material[methodName]('fragment', 'SRGB_DECODE');\n\n // FIXME\n if (coordSys.type === 'mapbox3D' || coordSys.type === 'maptalks3D') {\n mesh.material.define('fragment', 'NORMAL_UP_AXIS', 2);\n mesh.material.define('fragment', 'NORMAL_FRONT_AXIS', 1);\n }\n }\n });\n },\n\n remove: function () {\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n this._geo3DBuilderList.forEach(function (geo3DBuilder) {\n geo3DBuilder.dispose();\n })\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Polygons3DSeries from './Polygons3DSeries';\nimport Polygons3DView from './Polygons3DView';\n\nexport function install(registers) {\n registers.registerChartView(Polygons3DView);\n registers.registerSeriesModel(Polygons3DSeries);\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './polygons3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport componentShadingMixin from '../../component/common/componentShadingMixin';\nimport formatTooltip from '../common/formatTooltip';\nimport createList from '../common/createList';\n\nvar SurfaceSeries = echarts.SeriesModel.extend({\n\n type: 'series.surface',\n\n dependencies: ['globe', 'grid3D', 'geo3D'],\n\n visualStyleAccessPath: 'itemStyle',\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n getInitialData: function (option, ecModel) {\n var data = option.data;\n\n function validateDimension(dimOpts) {\n return !(isNaN(dimOpts.min) || isNaN(dimOpts.max) || isNaN(dimOpts.step));\n }\n\n function getPrecision(dimOpts) {\n var getPrecision = echarts.number.getPrecisionSafe;\n return Math.max(\n getPrecision(dimOpts.min), getPrecision(dimOpts.max), getPrecision(dimOpts.step)\n ) + 1;\n }\n\n if (!data) {\n if (!option.parametric) {\n // From surface equation\n var equation = option.equation || {};\n var xOpts = equation.x || {};\n var yOpts = equation.y || {};\n\n ['x', 'y'].forEach(function (dim) {\n if (!validateDimension(equation[dim])) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Invalid equation.%s', dim);\n }\n return;\n }\n });\n if (typeof equation.z !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('equation.z needs to be function');\n }\n return;\n }\n var xCount = Math.floor((xOpts.max + xOpts.step - xOpts.min) / xOpts.step);\n var yCount = Math.floor((yOpts.max + yOpts.step - yOpts.min) / yOpts.step);\n data = new Float32Array(xCount * yCount * 3);\n\n var xPrecision = getPrecision(xOpts);\n var yPrecision = getPrecision(yOpts);\n\n var off = 0;\n for (var j = 0; j < yCount; j++) {\n for (var i = 0; i < xCount; i++) {\n var x = i * xOpts.step + xOpts.min;\n var y = j * yOpts.step + yOpts.min;\n var x2 = echarts.number.round(Math.min(x, xOpts.max), xPrecision);\n var y2 = echarts.number.round(Math.min(y, yOpts.max), yPrecision);\n var z = equation.z(x2, y2);\n data[off++] = x2;\n data[off++] = y2;\n data[off++] = z;\n }\n }\n }\n else {\n var parametricEquation = option.parametricEquation || {};\n var uOpts = parametricEquation.u || {};\n var vOpts = parametricEquation.v || {};\n\n ['u', 'v'].forEach(function (dim) {\n if (!validateDimension(parametricEquation[dim])) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Invalid parametricEquation.%s', dim);\n }\n return;\n }\n });\n ['x', 'y', 'z'].forEach(function (dim) {\n if (typeof parametricEquation[dim] !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('parametricEquation.%s needs to be function', dim);\n }\n return;\n }\n });\n\n var uCount = Math.floor((uOpts.max + uOpts.step - uOpts.min) / uOpts.step);\n var vCount = Math.floor((vOpts.max + vOpts.step - vOpts.min) / vOpts.step);\n data = new Float32Array(uCount * vCount * 5);\n\n\n var uPrecision = getPrecision(uOpts);\n var vPrecision = getPrecision(vOpts);\n var off = 0;\n for (var j = 0; j < vCount; j++) {\n for (var i = 0; i < uCount; i++) {\n var u = i * uOpts.step + uOpts.min;\n var v = j * vOpts.step + vOpts.min;\n var u2 = echarts.number.round(Math.min(u, uOpts.max), uPrecision);\n var v2 = echarts.number.round(Math.min(v, vOpts.max), vPrecision);\n var x = parametricEquation.x(u2, v2);\n var y = parametricEquation.y(u2, v2);\n var z = parametricEquation.z(u2, v2);\n data[off++] = x;\n data[off++] = y;\n data[off++] = z;\n data[off++] = u2;\n data[off++] = v2;\n }\n }\n }\n }\n\n var dims = ['x', 'y', 'z'];\n if (option.parametric) {\n dims.push('u', 'v');\n }\n // PENDING getSource?\n var list = createList(this, dims, data);\n return list;\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian3D',\n zlevel: -10,\n\n // Cartesian coordinate system\n grid3DIndex: 0,\n\n // Surface needs lambert shading to show the difference\n shading: 'lambert',\n\n // If parametric surface\n parametric: false,\n\n wireframe: {\n show: true,\n\n lineStyle: {\n color: 'rgba(0,0,0,0.5)',\n width: 1\n }\n },\n /**\n * Generate surface data from z = f(x, y) equation\n */\n equation: {\n // [min, max, step]\n x: {\n min: -1,\n max: 1,\n step: 0.1\n },\n y: {\n min: -1,\n max: 1,\n step: 0.1\n },\n z: null\n },\n\n parametricEquation: {\n // [min, max, step]\n u: {\n min: -1,\n max: 1,\n step: 0.1\n },\n v: {\n min: -1,\n max: 1,\n step: 0.1\n },\n // [x, y, z] = f(x, y)\n x: null,\n y: null,\n z: null\n },\n\n // Shape of give data\n // It is an array to specify rows and columns.\n // For example [30, 30]\n dataShape: null,\n\n itemStyle: {\n // Color\n },\n\n animationDurationUpdate: 500\n }\n});\n\necharts.util.merge(SurfaceSeries.prototype, componentShadingMixin);\n\nexport default SurfaceSeries;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport trianglesSortMixin from '../../util/geometry/trianglesSortMixin';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nvar vec3 = glmatrix.vec3;\n\nfunction isPointsNaN(pt) {\n return isNaN(pt[0]) || isNaN(pt[1]) || isNaN(pt[2]);\n}\n\nexport default echarts.ChartView.extend({\n\n type: 'surface',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n },\n\n render: function (seriesModel, ecModel, api) {\n // Swap surfaceMesh\n var tmp = this._prevSurfaceMesh;\n this._prevSurfaceMesh = this._surfaceMesh;\n this._surfaceMesh = tmp;\n\n if (!this._surfaceMesh) {\n this._surfaceMesh = this._createSurfaceMesh();\n }\n\n this.groupGL.remove(this._prevSurfaceMesh);\n this.groupGL.add(this._surfaceMesh);\n\n var coordSys = seriesModel.coordinateSystem;\n var shading = seriesModel.get('shading');\n var data = seriesModel.getData();\n\n var shadingPrefix = 'ecgl.' + shading;\n if (!this._surfaceMesh.material || this._surfaceMesh.material.shader.name !== shadingPrefix) {\n this._surfaceMesh.material = graphicGL.createMaterial(shadingPrefix, ['VERTEX_COLOR', 'DOUBLE_SIDED']);\n }\n\n graphicGL.setMaterialFromModel(\n shading, this._surfaceMesh.material, seriesModel, api\n );\n\n if (coordSys && coordSys.viewGL) {\n coordSys.viewGL.add(this.groupGL);\n var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._surfaceMesh.material[methodName]('fragment', 'SRGB_DECODE');\n }\n\n var isParametric = seriesModel.get('parametric');\n\n var dataShape = seriesModel.get('dataShape');\n if (!dataShape) {\n dataShape = this._getDataShape(data, isParametric);\n if (process.env.NODE_ENV !== 'production') {\n if (seriesModel.get('data')) {\n console.warn('dataShape is not provided. Guess it is ', dataShape);\n }\n }\n }\n\n var wireframeModel = seriesModel.getModel('wireframe');\n var wireframeLineWidth = wireframeModel.get('lineStyle.width');\n var showWireframe = wireframeModel.get('show') && wireframeLineWidth > 0;\n this._updateSurfaceMesh(this._surfaceMesh, seriesModel, dataShape, showWireframe);\n\n var material = this._surfaceMesh.material;\n if (showWireframe) {\n material.define('WIREFRAME_QUAD');\n material.set('wireframeLineWidth', wireframeLineWidth);\n material.set('wireframeLineColor', graphicGL.parseColor(wireframeModel.get('lineStyle.color')));\n }\n else {\n material.undefine('WIREFRAME_QUAD');\n }\n\n this._initHandler(seriesModel, api);\n\n this._updateAnimation(seriesModel);\n },\n\n _updateAnimation: function (seriesModel) {\n graphicGL.updateVertexAnimation(\n [\n ['prevPosition', 'position'],\n ['prevNormal', 'normal']\n ],\n this._prevSurfaceMesh,\n this._surfaceMesh,\n seriesModel\n );\n },\n\n _createSurfaceMesh: function () {\n var mesh = new graphicGL.Mesh({\n geometry: new graphicGL.Geometry({\n dynamic: true,\n sortTriangles: true\n }),\n shadowDepthMaterial: new graphicGL.Material({\n shader: new graphicGL.Shader(graphicGL.Shader.source('ecgl.sm.depth.vertex'), graphicGL.Shader.source('ecgl.sm.depth.fragment'))\n }),\n culling: false,\n // Render after axes\n renderOrder: 10,\n // Render normal in normal pass\n renderNormal: true\n });\n mesh.geometry.createAttribute('barycentric', 'float', 4);\n mesh.geometry.createAttribute('prevPosition', 'float', 3);\n mesh.geometry.createAttribute('prevNormal', 'float', 3);\n\n Object.assign(mesh.geometry, trianglesSortMixin);\n\n return mesh;\n },\n\n _initHandler: function (seriesModel, api) {\n var data = seriesModel.getData();\n var surfaceMesh = this._surfaceMesh;\n\n var coordSys = seriesModel.coordinateSystem;\n\n function getNearestPointIdx(triangle, point) {\n var nearestDist = Infinity;\n var nearestIdx = -1;\n var pos = [];\n for (var i = 0; i < triangle.length; i++) {\n surfaceMesh.geometry.attributes.position.get(triangle[i], pos);\n var dist = vec3.dist(point.array, pos);\n if (dist < nearestDist) {\n nearestDist = dist;\n nearestIdx = triangle[i];\n }\n }\n return nearestIdx;\n }\n\n surfaceMesh.seriesIndex = seriesModel.seriesIndex;\n\n var lastDataIndex = -1;\n\n surfaceMesh.off('mousemove');\n surfaceMesh.off('mouseout');\n surfaceMesh.on('mousemove', function (e) {\n var idx = getNearestPointIdx(e.triangle, e.point);\n if (idx >= 0) {\n var point = [];\n surfaceMesh.geometry.attributes.position.get(idx, point);\n var value = coordSys.pointToData(point);\n\n var minDist = Infinity;\n var dataIndex = -1;\n var item = [];\n for (var i = 0; i < data.count(); i++) {\n item[0] = data.get('x', i);\n item[1] = data.get('y', i);\n item[2] = data.get('z', i);\n var dist = vec3.squaredDistance(item, value);\n if (dist < minDist) {\n dataIndex = i;\n minDist = dist;\n }\n }\n\n if (dataIndex !== lastDataIndex) {\n api.dispatchAction({\n type: 'grid3DShowAxisPointer',\n value: value\n });\n }\n\n lastDataIndex = dataIndex;\n surfaceMesh.dataIndex = dataIndex;\n }\n else {\n surfaceMesh.dataIndex = -1;\n }\n }, this);\n surfaceMesh.on('mouseout', function (e) {\n lastDataIndex = -1;\n surfaceMesh.dataIndex = -1;\n\n api.dispatchAction({\n type: 'grid3DHideAxisPointer'\n });\n }, this);\n },\n\n _updateSurfaceMesh: function (surfaceMesh, seriesModel, dataShape, showWireframe) {\n\n var geometry = surfaceMesh.geometry;\n var data = seriesModel.getData();\n var pointsArr = data.getLayout('points');\n\n var invalidDataCount = 0;\n data.each(function (idx) {\n if (!data.hasValue(idx)) {\n invalidDataCount++;\n }\n });\n var needsSplitQuad = invalidDataCount || showWireframe;\n\n var positionAttr = geometry.attributes.position;\n var normalAttr = geometry.attributes.normal;\n var texcoordAttr = geometry.attributes.texcoord0;\n var barycentricAttr = geometry.attributes.barycentric;\n var colorAttr = geometry.attributes.color;\n var row = dataShape[0];\n var column = dataShape[1];\n var shading = seriesModel.get('shading');\n var needsNormal = shading !== 'color';\n\n if (needsSplitQuad) {\n // TODO, If needs remove the invalid points, or set color transparent.\n var vertexCount = (row - 1) * (column - 1) * 4;\n positionAttr.init(vertexCount);\n if (showWireframe) {\n barycentricAttr.init(vertexCount);\n }\n }\n else {\n positionAttr.value = new Float32Array(pointsArr);\n }\n colorAttr.init(geometry.vertexCount);\n texcoordAttr.init(geometry.vertexCount);\n\n var quadToTriangle = [0, 3, 1, 1, 3, 2];\n // 3----2\n // 0----1\n // Make sure pixels on 1---3 edge will not have channel 0.\n // And pixels on four edges have at least one channel 0.\n var quadBarycentric = [\n [1, 1, 0, 0],\n [0, 1, 0, 1],\n [1, 0, 0, 1],\n [1, 0, 1, 0]\n ];\n\n var indices = geometry.indices = new (geometry.vertexCount > 0xffff ? Uint32Array : Uint16Array)((row - 1) * (column - 1) * 6);\n var getQuadIndices = function (i, j, out) {\n out[1] = i * column + j;\n out[0] = i * column + j + 1;\n out[3] = (i + 1) * column + j + 1;\n out[2] = (i + 1) * column + j;\n };\n\n var isTransparent = false;\n\n if (needsSplitQuad) {\n var quadIndices = [];\n var pos = [];\n var faceOffset = 0;\n\n if (needsNormal) {\n normalAttr.init(geometry.vertexCount);\n }\n else {\n normalAttr.value = null;\n }\n\n var pts = [[], [], []];\n var v21 = [], v32 = [];\n var normal = vec3.create();\n\n var getFromArray = function (arr, idx, out) {\n var idx3 = idx * 3;\n out[0] = arr[idx3];\n out[1] = arr[idx3 + 1];\n out[2] = arr[idx3 + 2];\n return out;\n };\n var vertexNormals = new Float32Array(pointsArr.length);\n var vertexColors = new Float32Array(pointsArr.length / 3 * 4);\n\n for (var i = 0; i < data.count(); i++) {\n if (data.hasValue(i)) {\n var rgbaArr = graphicGL.parseColor(getItemVisualColor(data, i));\n var opacity = getItemVisualOpacity(data, i);\n opacity != null && (rgbaArr[3] *= opacity);\n if (rgbaArr[3] < 0.99) {\n isTransparent = true;\n }\n for (var k = 0; k < 4; k++) {\n vertexColors[i * 4 + k] = rgbaArr[k];\n }\n }\n }\n var farPoints = [1e7, 1e7, 1e7];\n for (var i = 0; i < row - 1; i++) {\n for (var j = 0; j < column - 1; j++) {\n var dataIndex = i * (column - 1) + j;\n var vertexOffset = dataIndex * 4;\n\n getQuadIndices(i, j, quadIndices);\n\n var invisibleQuad = false;\n for (var k = 0; k < 4; k++) {\n getFromArray(pointsArr, quadIndices[k], pos);\n if (isPointsNaN(pos)) {\n // Quad is invisible if any point is NaN\n invisibleQuad = true;\n }\n }\n\n for (var k = 0; k < 4; k++) {\n if (invisibleQuad) {\n // Move point far away\n positionAttr.set(vertexOffset + k, farPoints);\n }\n else {\n getFromArray(pointsArr, quadIndices[k], pos);\n positionAttr.set(vertexOffset + k, pos);\n }\n if (showWireframe) {\n barycentricAttr.set(vertexOffset + k, quadBarycentric[k]);\n }\n }\n for (var k = 0; k < 6; k++) {\n indices[faceOffset++] = quadToTriangle[k] + vertexOffset;\n }\n // Vertex normals\n if (needsNormal && !invisibleQuad) {\n for (var k = 0; k < 2; k++) {\n var k3 = k * 3;\n\n for (var m = 0; m < 3; m++) {\n var idx = quadIndices[quadToTriangle[k3] + m];\n getFromArray(pointsArr, idx, pts[m]);\n }\n\n vec3.sub(v21, pts[0], pts[1]);\n vec3.sub(v32, pts[1], pts[2]);\n vec3.cross(normal, v21, v32);\n // Weighted by the triangle area\n for (var m = 0; m < 3; m++) {\n var idx3 = quadIndices[quadToTriangle[k3] + m] * 3;\n vertexNormals[idx3] = vertexNormals[idx3] + normal[0];\n vertexNormals[idx3 + 1] = vertexNormals[idx3 + 1] + normal[1];\n vertexNormals[idx3 + 2] = vertexNormals[idx3 + 2] + normal[2];\n }\n }\n }\n\n }\n }\n if (needsNormal) {\n for (var i = 0; i < vertexNormals.length / 3; i++) {\n getFromArray(vertexNormals, i, normal);\n vec3.normalize(normal, normal);\n vertexNormals[i * 3] = normal[0];\n vertexNormals[i * 3 + 1] = normal[1];\n vertexNormals[i * 3 + 2] = normal[2];\n }\n }\n // Split normal and colors, write to the attributes.\n var rgbaArr = [];\n var uvArr = [];\n for (var i = 0; i < row - 1; i++) {\n for (var j = 0; j < column - 1; j++) {\n var dataIndex = i * (column - 1) + j;\n var vertexOffset = dataIndex * 4;\n\n getQuadIndices(i, j, quadIndices);\n for (var k = 0; k < 4; k++) {\n for (var m = 0; m < 4; m++) {\n rgbaArr[m] = vertexColors[quadIndices[k] * 4 + m];\n }\n colorAttr.set(vertexOffset + k, rgbaArr);\n\n if (needsNormal) {\n getFromArray(vertexNormals, quadIndices[k], normal);\n normalAttr.set(vertexOffset + k, normal);\n }\n\n var idx = quadIndices[k];\n uvArr[0] = (idx % column) / (column - 1);\n uvArr[1] = Math.floor(idx / column) / (row - 1);\n texcoordAttr.set(vertexOffset + k, uvArr);\n }\n dataIndex++;\n }\n }\n }\n else {\n var uvArr = [];\n for (var i = 0; i < data.count(); i++) {\n uvArr[0] = (i % column) / (column - 1);\n uvArr[1] = Math.floor(i / column) / (row - 1);\n var rgbaArr = graphicGL.parseColor(getItemVisualColor(data, i));\n var opacity = getItemVisualOpacity(data, i);\n opacity != null && (rgbaArr[3] *= opacity);\n if (rgbaArr[3] < 0.99) {\n isTransparent = true;\n }\n colorAttr.set(i, rgbaArr);\n texcoordAttr.set(i, uvArr);\n }\n var quadIndices = [];\n // Triangles\n var cursor = 0;\n for (var i = 0; i < row - 1; i++) {\n for (var j = 0; j < column - 1; j++) {\n\n getQuadIndices(i, j, quadIndices);\n\n for (var k = 0; k < 6; k++) {\n indices[cursor++] = quadIndices[quadToTriangle[k]];\n }\n }\n }\n if (needsNormal) {\n geometry.generateVertexNormals();\n }\n else {\n normalAttr.value = null;\n }\n }\n if (surfaceMesh.material.get('normalMap')) {\n geometry.generateTangents();\n }\n\n\n geometry.updateBoundingBox();\n geometry.dirty();\n\n surfaceMesh.material.transparent = isTransparent;\n surfaceMesh.material.depthMask = !isTransparent;\n },\n\n _getDataShape: function (data, isParametric) {\n\n var prevX = -Infinity;\n var rowCount = 0;\n var columnCount = 0;\n var prevColumnCount = 0;\n\n var mayInvalid = false;\n\n var rowDim = isParametric ? 'u' : 'x';\n var dataCount = data.count();\n // Check data format\n for (var i = 0; i < dataCount; i++) {\n var x = data.get(rowDim, i);\n if (x < prevX) {\n if (prevColumnCount && prevColumnCount !== columnCount) {\n if (process.env.NODE_ENV !== 'production') {\n mayInvalid = true;\n }\n }\n // A new row.\n prevColumnCount = columnCount;\n columnCount = 0;\n rowCount++;\n }\n prevX = x;\n columnCount++;\n }\n if (!rowCount || columnCount === 1) {\n mayInvalid = true;\n }\n if (!mayInvalid) {\n return [rowCount + 1, columnCount];\n }\n\n var rows = Math.floor(Math.sqrt(dataCount));\n while (rows > 0) {\n if (Math.floor(dataCount / rows) === dataCount / rows) { // Can be divided\n return [rows, dataCount / rows];\n }\n rows--;\n }\n\n // Bailout\n rows = Math.floor(Math.sqrt(dataCount));\n return [rows, rows];\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport SurfaceSeries from './SurfaceSeries';\nimport SurfaceView from './SurfaceView';\n\nexport function install(registers) {\n registers.registerChartView(SurfaceView);\n registers.registerSeriesModel(SurfaceSeries);\n\n registers.registerLayout(function (ecModel, api) {\n ecModel.eachSeriesByType('surface', function (surfaceModel) {\n var cartesian = surfaceModel.coordinateSystem;\n if (!cartesian || cartesian.type !== 'cartesian3D') {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Surface chart only support cartesian3D coordinateSystem');\n }\n }\n var data = surfaceModel.getData();\n var points = new Float32Array(3 * data.count());\n var nanPoint = [NaN, NaN, NaN];\n\n if (cartesian && cartesian.type === 'cartesian3D') {\n var coordDims = cartesian.dimensions;\n var dims = coordDims.map(function (coordDim) {\n return surfaceModel.coordDimToDataDim(coordDim)[0];\n });\n data.each(dims, function (x, y, z, idx) {\n var pt;\n if (!data.hasValue(idx)) {\n pt = nanPoint;\n }\n else {\n pt = cartesian.dataToPoint([x, y, z]);\n }\n points[idx * 3] = pt[0];\n points[idx * 3 + 1] = pt[1];\n points[idx * 3 + 2] = pt[2];\n });\n }\n data.setLayout('points', points);\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './surface/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport componentViewControlMixin from '../../component/common/componentViewControlMixin';\nimport componentPostEffectMixin from '../../component/common/componentPostEffectMixin';\nimport componentLightMixin from '../../component/common/componentLightMixin';\nimport componentShadingMixin from '../../component/common/componentShadingMixin';\nimport geo3DModelMixin from '../../coord/geo3D/geo3DModelMixin';\nimport formatUtil from '../../util/format';\nimport formatTooltip from '../common/formatTooltip';\nimport geo3DCreator from '../../coord/geo3DCreator';\n\nfunction transformPolygon(mapbox3DCoordSys, poly) {\n var newPoly = [];\n for (var k = 0; k < poly.length; k++) {\n newPoly.push(mapbox3DCoordSys.dataToPoint(poly[k]));\n }\n return newPoly;\n}\n\nvar Map3DSeries = echarts.SeriesModel.extend({\n\n type: 'series.map3D',\n\n layoutMode: 'box',\n\n coordinateSystem: null,\n\n visualStyleAccessPath: 'itemStyle',\n\n optionUpdated: function (newOpt) {\n newOpt = newOpt || {};\n var coordSysType = this.get('coordinateSystem');\n if (coordSysType == null || coordSysType === 'geo3D') {\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var propsNeedToCheck = [\n 'left', 'top', 'width', 'height',\n 'boxWidth', 'boxDepth', 'boxHeight',\n 'light', 'viewControl', 'postEffect', 'temporalSuperSampling',\n 'environment', 'groundPlane'\n ];\n var ignoredProperties = [];\n propsNeedToCheck.forEach(function (propName) {\n if (newOpt[propName] != null) {\n ignoredProperties.push(propName);\n }\n });\n if (ignoredProperties.length) {\n console.warn(\n 'Property %s in map3D series will be ignored if coordinate system is %s',\n ignoredProperties.join(', '), coordSysType\n );\n }\n }\n\n if (this.get('groundPlane.show')) {\n // Force disable groundPlane if map3D has other coordinate systems.\n this.option.groundPlane.show = false;\n }\n\n // Reset geo.\n this._geo = null;\n },\n\n getInitialData: function (option) {\n option.data = this.getFilledRegions(option.data, option.map);\n\n var dimensions = echarts.helper.createDimensions(option.data, {\n coordDimensions: ['value']\n });\n var list = new echarts.List(dimensions, this);\n list.initData(option.data);\n\n var regionModelMap = {};\n list.each(function (idx) {\n var name = list.getName(idx);\n var itemModel = list.getItemModel(idx);\n regionModelMap[name] = itemModel;\n });\n\n this._regionModelMap = regionModelMap;\n\n return list;\n },\n\n formatTooltip: function (dataIndex) {\n return formatTooltip(this, dataIndex);\n },\n\n getRegionModel: function (idx) {\n var name = this.getData().getName(idx);\n return this._regionModelMap[name] || new echarts.Model(null, this);\n },\n\n getRegionPolygonCoords: function (idx) {\n var coordSys = this.coordinateSystem;\n var name = this.getData().getName(idx);\n if (coordSys.transform) {\n var region = coordSys.getRegion(name);\n return region ? region.geometries : [];\n }\n else {\n if (!this._geo) {\n this._geo = geo3DCreator.createGeo3D(this);\n }\n var region = this._geo.getRegion(name);\n var ret = [];\n for (var k = 0; k < region.geometries.length; k++) {\n var geo = region.geometries[k];\n var interiors = [];\n var exterior = transformPolygon(coordSys, geo.exterior);\n if (interiors && interiors.length) {\n for (var m = 0; m < geo.interiors.length; m++) {\n interiors.push(transformPolygon(coordSys, interiors[m]));\n }\n }\n ret.push({\n interiors: interiors,\n exterior: exterior\n });\n }\n return ret;\n }\n },\n\n /**\n * Format label\n * @param {string} name Region name\n * @param {string} [status='normal'] 'normal' or 'emphasis'\n * @return {string}\n */\n getFormattedLabel: function (dataIndex, status) {\n var text = formatUtil.getFormattedLabel(this, dataIndex, status);\n if (text == null) {\n text = this.getData().getName(dataIndex);\n }\n return text;\n },\n\n defaultOption: {\n // Support geo3D, mapbox, maptalks3D\n coordinateSystem: 'geo3D',\n // itemStyle: {},\n // height,\n // label: {}\n data: null\n }\n});\n\necharts.util.merge(Map3DSeries.prototype, geo3DModelMixin);\n\necharts.util.merge(Map3DSeries.prototype, componentViewControlMixin);\necharts.util.merge(Map3DSeries.prototype, componentPostEffectMixin);\necharts.util.merge(Map3DSeries.prototype, componentLightMixin);\necharts.util.merge(Map3DSeries.prototype, componentShadingMixin);\n\nexport default Map3DSeries;","import * as echarts from 'echarts/lib/echarts';\n\nimport graphicGL from '../../util/graphicGL';\nimport OrbitControl from '../../util/OrbitControl';\nimport SceneHelper from '../../component/common/SceneHelper';\nimport Geo3DBuilder from '../../component/common/Geo3DBuilder';\n\nexport default echarts.ChartView.extend({\n\n type: 'map3D',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this._geo3DBuilder = new Geo3DBuilder(api);\n this.groupGL = new graphicGL.Node();\n },\n\n render: function (map3DModel, ecModel, api) {\n\n var coordSys = map3DModel.coordinateSystem;\n\n if (!coordSys || !coordSys.viewGL) {\n return;\n }\n\n this.groupGL.add(this._geo3DBuilder.rootNode);\n coordSys.viewGL.add(this.groupGL);\n\n var geo3D;\n if (coordSys.type === 'geo3D') {\n geo3D = coordSys;\n\n if (!this._sceneHelper) {\n this._sceneHelper = new SceneHelper();\n this._sceneHelper.initLight(this.groupGL);\n }\n\n this._sceneHelper.setScene(coordSys.viewGL.scene);\n this._sceneHelper.updateLight(map3DModel);\n\n // Set post effect\n coordSys.viewGL.setPostEffect(map3DModel.getModel('postEffect'), api);\n coordSys.viewGL.setTemporalSuperSampling(map3DModel.getModel('temporalSuperSampling'));\n\n var control = this._control;\n if (!control) {\n control = this._control = new OrbitControl({\n zr: api.getZr()\n });\n this._control.init();\n }\n var viewControlModel = map3DModel.getModel('viewControl');\n control.setViewGL(coordSys.viewGL);\n control.setFromViewControlModel(viewControlModel, 0);\n\n control.off('update');\n control.on('update', function () {\n api.dispatchAction({\n type: 'map3DChangeCamera',\n alpha: control.getAlpha(),\n beta: control.getBeta(),\n distance: control.getDistance(),\n from: this.uid,\n map3DId: map3DModel.id\n });\n });\n\n this._geo3DBuilder.extrudeY = true;\n }\n else {\n if (this._control) {\n this._control.dispose();\n this._control = null;\n }\n if (this._sceneHelper) {\n this._sceneHelper.dispose();\n this._sceneHelper = null;\n }\n geo3D = map3DModel.getData().getLayout('geo3D');\n\n this._geo3DBuilder.extrudeY = false;\n }\n\n this._geo3DBuilder.update(map3DModel, ecModel, api, 0, map3DModel.getData().count());\n\n\n // Must update after geo3D.viewGL.setPostEffect to determine linear space\n var srgbDefineMethod = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine';\n this._geo3DBuilder.rootNode.traverse(function (mesh) {\n if (mesh.material) {\n mesh.material[srgbDefineMethod]('fragment', 'SRGB_DECODE');\n }\n });\n },\n\n afterRender: function (map3DModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n var coordSys = map3DModel.coordinateSystem;\n if (coordSys && coordSys.type === 'geo3D') {\n this._sceneHelper.updateAmbientCubemap(renderer, map3DModel, api);\n this._sceneHelper.updateSkybox(renderer, map3DModel, api);\n }\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n this._control.dispose();\n this._geo3DBuilder.dispose();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport Map3DSeries from './Map3DSeries';\nimport Map3DView from './Map3DView';\n\nimport {install as installGeo3D} from '../../component/geo3D/install';\n\nexport function install(registers) {\n // Depends on geo3d\n installGeo3D(registers);\n\n registers.registerChartView(Map3DView);\n registers.registerSeriesModel(Map3DSeries);\n registers.registerAction({\n type: 'map3DChangeCamera',\n event: 'map3dcamerachanged',\n update: 'series:updateCamera'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series', subType: 'map3D', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './map3D/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\n\nexport default echarts.SeriesModel.extend({\n\n type: 'series.scatterGL',\n\n dependencies: ['grid', 'polar', 'geo', 'singleAxis'],\n\n visualStyleAccessPath: 'itemStyle',\n\n hasSymbolVisual: true,\n\n getInitialData: function () {\n return echarts.helper.createList(this);\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian2d',\n zlevel: 10,\n\n progressive: 1e5,\n progressiveThreshold: 1e5,\n\n // Cartesian coordinate system\n // xAxisIndex: 0,\n // yAxisIndex: 0,\n\n // Polar coordinate system\n // polarIndex: 0,\n\n // Geo coordinate system\n // geoIndex: 0,\n\n large: false,\n\n symbol: 'circle',\n symbolSize: 10,\n\n // symbolSize scale when zooming.\n zoomScale: 0,\n\n // Support source-over, lighter\n blendMode: 'source-over',\n\n itemStyle: {\n opacity: 0.8\n },\n\n\n postEffect: {\n enable: false,\n colorCorrection: {\n exposure: 0,\n brightness: 0,\n contrast: 1,\n saturation: 1,\n enable: true\n }\n }\n\n }\n});","\nimport * as matrix from 'zrender/lib/core/matrix';\nimport * as vector from 'zrender/lib/core/vector';\n\nfunction GLViewHelper(viewGL) {\n this.viewGL = viewGL;\n}\n\nGLViewHelper.prototype.reset = function (seriesModel, api) {\n this._updateCamera(api.getWidth(), api.getHeight(), api.getDevicePixelRatio());\n this._viewTransform = matrix.create();\n this.updateTransform(seriesModel, api);\n};\n\nGLViewHelper.prototype.updateTransform = function (seriesModel, api) {\n var coordinateSystem = seriesModel.coordinateSystem;\n\n if (coordinateSystem.getRoamTransform) {\n\n matrix.invert(this._viewTransform, coordinateSystem.getRoamTransform());\n\n this._setCameraTransform(this._viewTransform);\n\n api.getZr().refresh();\n }\n};\n\n// Reimplement the dataToPoint of coordinate system.\n// Remove the effect of pan/zoom transform\nGLViewHelper.prototype.dataToPoint = function (coordSys, data, pt) {\n pt = coordSys.dataToPoint(data, null, pt);\n var viewTransform = this._viewTransform;\n if (viewTransform) {\n vector.applyTransform(pt, pt, viewTransform);\n }\n};\n\n/**\n * Remove transform info in point.\n */\nGLViewHelper.prototype.removeTransformInPoint = function (pt) {\n if (this._viewTransform) {\n vector.applyTransform(pt, pt, this._viewTransform);\n }\n return pt;\n};\n\n/**\n * Return number\n */\nGLViewHelper.prototype.getZoom = function () {\n if (this._viewTransform) {\n var m = this._viewTransform;\n return 1 / Math.max(\n Math.sqrt(m[0] * m[0] + m[1] * m[1]),\n Math.sqrt(m[2] * m[2] + m[3] * m[3])\n );\n }\n return 1;\n};\n\nGLViewHelper.prototype._setCameraTransform = function (m) {\n var camera = this.viewGL.camera;\n camera.position.set(m[4], m[5], 0);\n camera.scale.set(\n Math.sqrt(m[0] * m[0] + m[1] * m[1]),\n Math.sqrt(m[2] * m[2] + m[3] * m[3]),\n 1\n );\n};\n\nGLViewHelper.prototype._updateCamera = function (width, height, dpr) {\n // TODO, left, top, right, bottom\n this.viewGL.setViewport(0, 0, width, height, dpr);\n var camera = this.viewGL.camera;\n camera.left = camera.top = 0;\n camera.bottom = height;\n camera.right = width;\n camera.near = 0;\n camera.far = 100;\n};\n\nexport default GLViewHelper;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport ViewGL from '../../core/ViewGL';\nimport PointsBuilder from '../common/PointsBuilder';\n\nimport GLViewHelper from '../common/GLViewHelper';\n\nexport default echarts.ChartView.extend({\n\n type: 'scatterGL',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n this.viewGL = new ViewGL('orthographic');\n\n this.viewGL.add(this.groupGL);\n\n this._pointsBuilderList = [];\n this._currentStep = 0;\n\n this._sizeScale = 1;\n\n this._glViewHelper = new GLViewHelper(this.viewGL);\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n this._glViewHelper.reset(seriesModel, api);\n\n if (!seriesModel.getData().count()) {\n return;\n }\n\n var pointsBuilder = this._pointsBuilderList[0];\n if (!pointsBuilder) {\n pointsBuilder = this._pointsBuilderList[0] = new PointsBuilder(true, api);\n }\n this._pointsBuilderList.length = 1;\n\n this.groupGL.add(pointsBuilder.rootNode);\n\n this._removeTransformInPoints(seriesModel.getData().getLayout('points'));\n pointsBuilder.update(seriesModel, ecModel, api);\n\n this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api);\n },\n\n incrementalPrepareRender: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n this._glViewHelper.reset(seriesModel, api);\n\n this._currentStep = 0;\n\n this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api);\n },\n\n incrementalRender: function (params, seriesModel, ecModel, api) {\n if (params.end <= params.start) {\n return;\n }\n\n var pointsBuilder = this._pointsBuilderList[this._currentStep];\n if (!pointsBuilder) {\n pointsBuilder = new PointsBuilder(true, api);\n this._pointsBuilderList[this._currentStep] = pointsBuilder;\n }\n this.groupGL.add(pointsBuilder.rootNode);\n\n this._removeTransformInPoints(seriesModel.getData().getLayout('points'));\n\n pointsBuilder.setSizeScale(this._sizeScale);\n pointsBuilder.update(seriesModel, ecModel, api, params.start, params.end);\n\n api.getZr().refresh();\n\n this._currentStep++;\n },\n\n updateTransform: function (seriesModel, ecModel, api) {\n if (seriesModel.coordinateSystem.getRoamTransform) {\n this._glViewHelper.updateTransform(seriesModel, api);\n\n var zoom = this._glViewHelper.getZoom();\n var sizeScale = Math.max((seriesModel.get('zoomScale') || 0) * (zoom - 1) + 1, 0);\n this._sizeScale = sizeScale;\n\n this._pointsBuilderList.forEach(function (pointsBuilder) {\n pointsBuilder.setSizeScale(sizeScale);\n });\n }\n },\n\n _removeTransformInPoints: function (points) {\n if (!points) {\n return;\n }\n var pt = [];\n for (var i = 0; i < points.length; i += 2) {\n pt[0] = points[i];\n pt[1] = points[i + 1];\n this._glViewHelper.removeTransformInPoint(pt);\n points[i] = pt[0];\n points[i + 1] = pt[1];\n }\n },\n\n\n dispose: function () {\n this.groupGL.removeAll();\n this._pointsBuilderList.forEach(function (pointsBuilder) {\n pointsBuilder.dispose();\n });\n },\n\n remove: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport ScatterGLSeries from './ScatterGLSeries';\nimport ScatterGLView from './ScatterGLView';\n\nexport function install(registers) {\n registers.registerChartView(ScatterGLView);\n registers.registerSeriesModel(ScatterGLSeries);\n\n registers.registerLayout({\n seriesType: 'scatterGL',\n reset: function (seriesModel) {\n var coordSys = seriesModel.coordinateSystem;\n var data = seriesModel.getData();\n\n var progress;\n if (coordSys) {\n var dims = coordSys.dimensions.map(function (dim) {\n return data.mapDimension(dim);\n }).slice(0, 2);\n var pt = [];\n if (dims.length === 1) {\n progress = function (params) {\n var points = new Float32Array((params.end - params.start) * 2);\n for (var idx = params.start; idx < params.end; idx++) {\n var offset = (idx - params.start) * 2;\n var x = data.get(dims[0], idx);\n var pt = coordSys.dataToPoint(x);\n points[offset] = pt[0];\n points[offset + 1] = pt[1];\n }\n data.setLayout('points', points);\n };\n }\n else if (dims.length === 2) {\n progress = function (params) {\n var points = new Float32Array((params.end - params.start) * 2);\n for (var idx = params.start; idx < params.end; idx++) {\n var offset = (idx - params.start) * 2;\n var x = data.get(dims[0], idx);\n var y = data.get(dims[1], idx);\n pt[0] = x;\n pt[1] = y;\n\n pt = coordSys.dataToPoint(pt);\n points[offset] = pt[0];\n points[offset + 1] = pt[1];\n }\n data.setLayout('points', points);\n };\n }\n }\n\n return { progress: progress };\n }\n });\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './scatterGL/install';\nuse(install);","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\nimport * as zrUtil from 'zrender/lib/core/util'; // id may be function name of Object, add a prefix to avoid this problem.\n\nfunction generateNodeKey(id) {\n return '_EC_' + id;\n}\n\nvar Graph =\n/** @class */\nfunction () {\n function Graph(directed) {\n this.type = 'graph';\n this.nodes = [];\n this.edges = [];\n this._nodesMap = {};\n /**\n * @type {Object.}\n * @private\n */\n\n this._edgesMap = {};\n this._directed = directed || false;\n }\n /**\n * If is directed graph\n */\n\n\n Graph.prototype.isDirected = function () {\n return this._directed;\n };\n\n ;\n /**\n * Add a new node\n */\n\n Graph.prototype.addNode = function (id, dataIndex) {\n id = id == null ? '' + dataIndex : '' + id;\n var nodesMap = this._nodesMap;\n\n if (nodesMap[generateNodeKey(id)]) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('Graph nodes have duplicate name or id');\n }\n\n return;\n }\n\n var node = new GraphNode(id, dataIndex);\n node.hostGraph = this;\n this.nodes.push(node);\n nodesMap[generateNodeKey(id)] = node;\n return node;\n };\n\n ;\n /**\n * Get node by data index\n */\n\n Graph.prototype.getNodeByIndex = function (dataIndex) {\n var rawIdx = this.data.getRawIndex(dataIndex);\n return this.nodes[rawIdx];\n };\n\n ;\n /**\n * Get node by id\n */\n\n Graph.prototype.getNodeById = function (id) {\n return this._nodesMap[generateNodeKey(id)];\n };\n\n ;\n /**\n * Add a new edge\n */\n\n Graph.prototype.addEdge = function (n1, n2, dataIndex) {\n var nodesMap = this._nodesMap;\n var edgesMap = this._edgesMap; // PNEDING\n\n if (typeof n1 === 'number') {\n n1 = this.nodes[n1];\n }\n\n if (typeof n2 === 'number') {\n n2 = this.nodes[n2];\n }\n\n if (!(n1 instanceof GraphNode)) {\n n1 = nodesMap[generateNodeKey(n1)];\n }\n\n if (!(n2 instanceof GraphNode)) {\n n2 = nodesMap[generateNodeKey(n2)];\n }\n\n if (!n1 || !n2) {\n return;\n }\n\n var key = n1.id + '-' + n2.id;\n var edge = new GraphEdge(n1, n2, dataIndex);\n edge.hostGraph = this;\n\n if (this._directed) {\n n1.outEdges.push(edge);\n n2.inEdges.push(edge);\n }\n\n n1.edges.push(edge);\n\n if (n1 !== n2) {\n n2.edges.push(edge);\n }\n\n this.edges.push(edge);\n edgesMap[key] = edge;\n return edge;\n };\n\n ;\n /**\n * Get edge by data index\n */\n\n Graph.prototype.getEdgeByIndex = function (dataIndex) {\n var rawIdx = this.edgeData.getRawIndex(dataIndex);\n return this.edges[rawIdx];\n };\n\n ;\n /**\n * Get edge by two linked nodes\n */\n\n Graph.prototype.getEdge = function (n1, n2) {\n if (n1 instanceof GraphNode) {\n n1 = n1.id;\n }\n\n if (n2 instanceof GraphNode) {\n n2 = n2.id;\n }\n\n var edgesMap = this._edgesMap;\n\n if (this._directed) {\n return edgesMap[n1 + '-' + n2];\n } else {\n return edgesMap[n1 + '-' + n2] || edgesMap[n2 + '-' + n1];\n }\n };\n\n ;\n /**\n * Iterate all nodes\n */\n\n Graph.prototype.eachNode = function (cb, context) {\n var nodes = this.nodes;\n var len = nodes.length;\n\n for (var i = 0; i < len; i++) {\n if (nodes[i].dataIndex >= 0) {\n cb.call(context, nodes[i], i);\n }\n }\n };\n\n ;\n /**\n * Iterate all edges\n */\n\n Graph.prototype.eachEdge = function (cb, context) {\n var edges = this.edges;\n var len = edges.length;\n\n for (var i = 0; i < len; i++) {\n if (edges[i].dataIndex >= 0 && edges[i].node1.dataIndex >= 0 && edges[i].node2.dataIndex >= 0) {\n cb.call(context, edges[i], i);\n }\n }\n };\n\n ;\n /**\n * Breadth first traverse\n * Return true to stop traversing\n */\n\n Graph.prototype.breadthFirstTraverse = function (cb, startNode, direction, context) {\n if (!(startNode instanceof GraphNode)) {\n startNode = this._nodesMap[generateNodeKey(startNode)];\n }\n\n if (!startNode) {\n return;\n }\n\n var edgeType = direction === 'out' ? 'outEdges' : direction === 'in' ? 'inEdges' : 'edges';\n\n for (var i = 0; i < this.nodes.length; i++) {\n this.nodes[i].__visited = false;\n }\n\n if (cb.call(context, startNode, null)) {\n return;\n }\n\n var queue = [startNode];\n\n while (queue.length) {\n var currentNode = queue.shift();\n var edges = currentNode[edgeType];\n\n for (var i = 0; i < edges.length; i++) {\n var e = edges[i];\n var otherNode = e.node1 === currentNode ? e.node2 : e.node1;\n\n if (!otherNode.__visited) {\n if (cb.call(context, otherNode, currentNode)) {\n // Stop traversing\n return;\n }\n\n queue.push(otherNode);\n otherNode.__visited = true;\n }\n }\n }\n };\n\n ; // TODO\n // depthFirstTraverse(\n // cb, startNode, direction, context\n // ) {\n // };\n // Filter update\n\n Graph.prototype.update = function () {\n var data = this.data;\n var edgeData = this.edgeData;\n var nodes = this.nodes;\n var edges = this.edges;\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n nodes[i].dataIndex = -1;\n }\n\n for (var i = 0, len = data.count(); i < len; i++) {\n nodes[data.getRawIndex(i)].dataIndex = i;\n }\n\n edgeData.filterSelf(function (idx) {\n var edge = edges[edgeData.getRawIndex(idx)];\n return edge.node1.dataIndex >= 0 && edge.node2.dataIndex >= 0;\n }); // Update edge\n\n for (var i = 0, len = edges.length; i < len; i++) {\n edges[i].dataIndex = -1;\n }\n\n for (var i = 0, len = edgeData.count(); i < len; i++) {\n edges[edgeData.getRawIndex(i)].dataIndex = i;\n }\n };\n\n ;\n /**\n * @return {module:echarts/data/Graph}\n */\n\n Graph.prototype.clone = function () {\n var graph = new Graph(this._directed);\n var nodes = this.nodes;\n var edges = this.edges;\n\n for (var i = 0; i < nodes.length; i++) {\n graph.addNode(nodes[i].id, nodes[i].dataIndex);\n }\n\n for (var i = 0; i < edges.length; i++) {\n var e = edges[i];\n graph.addEdge(e.node1.id, e.node2.id, e.dataIndex);\n }\n\n return graph;\n };\n\n ;\n return Graph;\n}();\n\nvar GraphNode =\n/** @class */\nfunction () {\n function GraphNode(id, dataIndex) {\n this.inEdges = [];\n this.outEdges = [];\n this.edges = [];\n this.dataIndex = -1;\n this.id = id == null ? '' : id;\n this.dataIndex = dataIndex == null ? -1 : dataIndex;\n }\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.degree = function () {\n return this.edges.length;\n };\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.inDegree = function () {\n return this.inEdges.length;\n };\n /**\n * @return {number}\n */\n\n\n GraphNode.prototype.outDegree = function () {\n return this.outEdges.length;\n };\n\n GraphNode.prototype.getModel = function (path) {\n if (this.dataIndex < 0) {\n return;\n }\n\n var graph = this.hostGraph;\n var itemModel = graph.data.getItemModel(this.dataIndex);\n return itemModel.getModel(path);\n };\n\n GraphNode.prototype.getAdjacentDataIndices = function () {\n var dataIndices = {\n edge: [],\n node: []\n };\n\n for (var i = 0; i < this.edges.length; i++) {\n var adjacentEdge = this.edges[i];\n\n if (adjacentEdge.dataIndex < 0) {\n continue;\n }\n\n dataIndices.edge.push(adjacentEdge.dataIndex);\n dataIndices.node.push(adjacentEdge.node1.dataIndex, adjacentEdge.node2.dataIndex);\n }\n\n return dataIndices;\n };\n\n return GraphNode;\n}();\n\nvar GraphEdge =\n/** @class */\nfunction () {\n function GraphEdge(n1, n2, dataIndex) {\n this.dataIndex = -1;\n this.node1 = n1;\n this.node2 = n2;\n this.dataIndex = dataIndex == null ? -1 : dataIndex;\n }\n\n GraphEdge.prototype.getModel = function (path) {\n if (this.dataIndex < 0) {\n return;\n }\n\n var graph = this.hostGraph;\n var itemModel = graph.edgeData.getItemModel(this.dataIndex);\n return itemModel.getModel(path);\n };\n\n GraphEdge.prototype.getAdjacentDataIndices = function () {\n return {\n edge: [this.dataIndex],\n node: [this.node1.dataIndex, this.node2.dataIndex]\n };\n };\n\n return GraphEdge;\n}();\n\nfunction createGraphDataProxyMixin(hostName, dataName) {\n return {\n /**\n * @param Default 'value'. can be 'a', 'b', 'c', 'd', 'e'.\n */\n getValue: function (dimension) {\n var data = this[hostName][dataName];\n return data.get(data.getDimension(dimension || 'value'), this.dataIndex);\n },\n // TODO: TYPE stricter type.\n setVisual: function (key, value) {\n this.dataIndex >= 0 && this[hostName][dataName].setItemVisual(this.dataIndex, key, value);\n },\n getVisual: function (key) {\n return this[hostName][dataName].getItemVisual(this.dataIndex, key);\n },\n setLayout: function (layout, merge) {\n this.dataIndex >= 0 && this[hostName][dataName].setItemLayout(this.dataIndex, layout, merge);\n },\n getLayout: function () {\n return this[hostName][dataName].getItemLayout(this.dataIndex);\n },\n getGraphicEl: function () {\n return this[hostName][dataName].getItemGraphicEl(this.dataIndex);\n },\n getRawIndex: function () {\n return this[hostName][dataName].getRawIndex(this.dataIndex);\n }\n };\n}\n\n;\n;\n;\nzrUtil.mixin(GraphNode, createGraphDataProxyMixin('hostGraph', 'data'));\nzrUtil.mixin(GraphEdge, createGraphDataProxyMixin('hostGraph', 'edgeData'));\nexport default Graph;\nexport { GraphNode, GraphEdge };","\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n\n/**\n * AUTO-GENERATED FILE. DO NOT MODIFY.\n */\n\n/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * Link lists and struct (graph or tree)\n */\nimport { curry, each, assert, extend, map, keys } from 'zrender/lib/core/util';\nimport { makeInner } from '../../util/model';\nvar inner = makeInner();\n\nfunction linkList(opt) {\n var mainData = opt.mainData;\n var datas = opt.datas;\n\n if (!datas) {\n datas = {\n main: mainData\n };\n opt.datasAttr = {\n main: 'data'\n };\n }\n\n opt.datas = opt.mainData = null;\n linkAll(mainData, datas, opt); // Porxy data original methods.\n\n each(datas, function (data) {\n each(mainData.TRANSFERABLE_METHODS, function (methodName) {\n data.wrapMethod(methodName, curry(transferInjection, opt));\n });\n }); // Beyond transfer, additional features should be added to `cloneShallow`.\n\n mainData.wrapMethod('cloneShallow', curry(cloneShallowInjection, opt)); // Only mainData trigger change, because struct.update may trigger\n // another changable methods, which may bring about dead lock.\n\n each(mainData.CHANGABLE_METHODS, function (methodName) {\n mainData.wrapMethod(methodName, curry(changeInjection, opt));\n }); // Make sure datas contains mainData.\n\n assert(datas[mainData.dataType] === mainData);\n}\n\nfunction transferInjection(opt, res) {\n if (isMainData(this)) {\n // Transfer datas to new main data.\n var datas = extend({}, inner(this).datas);\n datas[this.dataType] = res;\n linkAll(res, datas, opt);\n } else {\n // Modify the reference in main data to point newData.\n linkSingle(res, this.dataType, inner(this).mainData, opt);\n }\n\n return res;\n}\n\nfunction changeInjection(opt, res) {\n opt.struct && opt.struct.update();\n return res;\n}\n\nfunction cloneShallowInjection(opt, res) {\n // cloneShallow, which brings about some fragilities, may be inappropriate\n // to be exposed as an API. So for implementation simplicity we can make\n // the restriction that cloneShallow of not-mainData should not be invoked\n // outside, but only be invoked here.\n each(inner(res).datas, function (data, dataType) {\n data !== res && linkSingle(data.cloneShallow(), dataType, res, opt);\n });\n return res;\n}\n/**\n * Supplement method to List.\n *\n * @public\n * @param [dataType] If not specified, return mainData.\n */\n\n\nfunction getLinkedData(dataType) {\n var mainData = inner(this).mainData;\n return dataType == null || mainData == null ? mainData : inner(mainData).datas[dataType];\n}\n/**\n * Get list of all linked data\n */\n\n\nfunction getLinkedDataAll() {\n var mainData = inner(this).mainData;\n return mainData == null ? [{\n data: mainData\n }] : map(keys(inner(mainData).datas), function (type) {\n return {\n type: type,\n data: inner(mainData).datas[type]\n };\n });\n}\n\nfunction isMainData(data) {\n return inner(data).mainData === data;\n}\n\nfunction linkAll(mainData, datas, opt) {\n inner(mainData).datas = {};\n each(datas, function (data, dataType) {\n linkSingle(data, dataType, mainData, opt);\n });\n}\n\nfunction linkSingle(data, dataType, mainData, opt) {\n inner(mainData).datas[dataType] = data;\n inner(data).mainData = mainData;\n data.dataType = dataType;\n\n if (opt.struct) {\n data[opt.structAttr] = opt.struct;\n opt.struct[opt.datasAttr[dataType]] = data;\n } // Supplement method.\n\n\n data.getLinkedData = getLinkedData;\n data.getLinkedDataAll = getLinkedDataAll;\n}\n\nexport default linkList;","import * as echarts from 'echarts/lib/echarts';\nimport Graph from 'echarts/lib/data/Graph';\nimport linkList from 'echarts/lib/data/helper/linkList';\nimport retrieve from '../../util/retrieve';\n\nexport default function (nodes, edges, hostModel, directed, beforeLink) {\n var graph = new Graph(directed);\n for (var i = 0; i < nodes.length; i++) {\n graph.addNode(retrieve.firstNotNull(\n // Id, name, dataIndex\n nodes[i].id, nodes[i].name, i\n ), i);\n }\n\n var linkNameList = [];\n var validEdges = [];\n var linkCount = 0;\n for (var i = 0; i < edges.length; i++) {\n var link = edges[i];\n var source = link.source;\n var target = link.target;\n // addEdge may fail when source or target not exists\n if (graph.addEdge(source, target, linkCount)) {\n validEdges.push(link);\n linkNameList.push(retrieve.firstNotNull(link.id, source + ' > ' + target));\n linkCount++;\n }\n }\n\n var nodeData;\n\n // FIXME, support more coordinate systems.\n var dimensionNames = echarts.helper.createDimensions(\n nodes, {\n coordDimensions: ['value']\n }\n );\n nodeData = new echarts.List(dimensionNames, hostModel);\n nodeData.initData(nodes);\n\n var edgeData = new echarts.List(['value'], hostModel);\n edgeData.initData(validEdges, linkNameList);\n\n beforeLink && beforeLink(nodeData, edgeData);\n\n linkList({\n mainData: nodeData,\n struct: graph,\n structAttr: 'graph',\n datas: {node: nodeData, edge: edgeData},\n datasAttr: {node: 'data', edge: 'edgeData'}\n });\n\n // Update dataIndex of nodes and edges because invalid edge may be removed\n graph.update();\n\n return graph;\n};","import * as echarts from 'echarts/lib/echarts';\nimport createGraphFromNodeEdge from './createGraphFromNodeEdge';\nimport formatUtil from '../../util/format';\n\nvar GraphSeries = echarts.SeriesModel.extend({\n\n type: 'series.graphGL',\n\n visualStyleAccessPath: 'itemStyle',\n\n hasSymbolVisual: true,\n\n init: function (option) {\n GraphSeries.superApply(this, 'init', arguments);\n\n // Provide data for legend select\n this.legendDataProvider = function () {\n return this._categoriesData;\n };\n\n this._updateCategoriesData();\n },\n\n mergeOption: function (option) {\n GraphSeries.superApply(this, 'mergeOption', arguments);\n\n this._updateCategoriesData();\n },\n\n getFormattedLabel: function (dataIndex, status, dataType, dimIndex) {\n var text = formatUtil.getFormattedLabel(this, dataIndex, status, dataType, dimIndex);\n if (text == null) {\n var data = this.getData();\n var lastDim = data.dimensions[data.dimensions.length - 1];\n text = data.get(lastDim, dataIndex);\n }\n return text;\n },\n\n getInitialData: function (option, ecModel) {\n var edges = option.edges || option.links || [];\n var nodes = option.data || option.nodes || [];\n var self = this;\n\n if (nodes && edges) {\n return createGraphFromNodeEdge(nodes, edges, this, true, beforeLink).data;\n }\n\n function beforeLink(nodeData, edgeData) {\n // Overwrite nodeData.getItemModel to\n nodeData.wrapMethod('getItemModel', function (model) {\n const categoriesModels = self._categoriesModels;\n const categoryIdx = model.getShallow('category');\n const categoryModel = categoriesModels[categoryIdx];\n if (categoryModel) {\n categoryModel.parentModel = model.parentModel;\n model.parentModel = categoryModel;\n }\n return model;\n });\n\n // TODO Inherit resolveParentPath by default in Model#getModel?\n const oldGetModel = ecModel.getModel([]).getModel;\n function newGetModel(path, parentModel) {\n const model = oldGetModel.call(this, path, parentModel);\n model.resolveParentPath = resolveParentPath;\n return model;\n }\n\n edgeData.wrapMethod('getItemModel', function (model) {\n model.resolveParentPath = resolveParentPath;\n model.getModel = newGetModel;\n return model;\n });\n\n function resolveParentPath(pathArr) {\n if (pathArr && (pathArr[0] === 'label' || pathArr[1] === 'label')) {\n const newPathArr = pathArr.slice();\n if (pathArr[0] === 'label') {\n newPathArr[0] = 'edgeLabel';\n }\n else if (pathArr[1] === 'label') {\n newPathArr[1] = 'edgeLabel';\n }\n return newPathArr;\n }\n return pathArr;\n }\n }\n },\n\n /**\n * @return {module:echarts/data/Graph}\n */\n getGraph: function () {\n return this.getData().graph;\n },\n\n /**\n * @return {module:echarts/data/List}\n */\n getEdgeData: function () {\n return this.getGraph().edgeData;\n },\n\n /**\n * @return {module:echarts/data/List}\n */\n getCategoriesData: function () {\n return this._categoriesData;\n },\n\n /**\n * @override\n */\n formatTooltip: function (dataIndex, multipleSeries, dataType) {\n if (dataType === 'edge') {\n var nodeData = this.getData();\n var params = this.getDataParams(dataIndex, dataType);\n var edge = nodeData.graph.getEdgeByIndex(dataIndex);\n var sourceName = nodeData.getName(edge.node1.dataIndex);\n var targetName = nodeData.getName(edge.node2.dataIndex);\n\n var html = [];\n sourceName != null && html.push(sourceName);\n targetName != null && html.push(targetName);\n html = echarts.format.encodeHTML(html.join(' > '));\n\n if (params.value) {\n html += ' : ' + echarts.format.encodeHTML(params.value);\n }\n return html;\n }\n else { // dataType === 'node' or empty\n return GraphSeries.superApply(this, 'formatTooltip', arguments);\n }\n },\n\n _updateCategoriesData: function () {\n var categories = (this.option.categories || []).map(function (category) {\n // Data must has value\n return category.value != null ? category : Object.assign({\n value: 0\n }, category);\n });\n var categoriesData = new echarts.List(['value'], this);\n categoriesData.initData(categories);\n\n this._categoriesData = categoriesData;\n\n this._categoriesModels = categoriesData.mapArray(function (idx) {\n return categoriesData.getItemModel(idx, true);\n });\n },\n\n setView: function (payload) {\n if (payload.zoom != null) {\n this.option.zoom = payload.zoom;\n }\n if (payload.offset != null) {\n this.option.offset = payload.offset;\n }\n },\n\n setNodePosition: function (points) {\n for (var i = 0; i < points.length / 2; i++) {\n var x = points[i * 2];\n var y = points[i * 2 + 1];\n\n var opt = this.getData().getRawDataItem(i);\n opt.x = x;\n opt.y = y;\n }\n },\n\n isAnimationEnabled: function () {\n return GraphSeries.superCall(this, 'isAnimationEnabled')\n // Not enable animation when do force layout\n && !(this.get('layout') === 'force' && this.get('force.layoutAnimation'));\n },\n\n defaultOption: {\n zlevel: 10,\n z: 2,\n\n legendHoverLink: true,\n\n // Only support forceAtlas2\n layout: 'forceAtlas2',\n\n // Configuration of force directed layout\n forceAtlas2: {\n initLayout: null,\n\n GPU: true,\n\n steps: 1,\n\n // barnesHutOptimize\n\n // Maxp layout steps.\n maxSteps: 1000,\n\n repulsionByDegree: true,\n linLogMode: false,\n strongGravityMode: false,\n gravity: 1.0,\n // scaling: 1.0,\n\n edgeWeightInfluence: 1.0,\n\n // Edge weight range.\n edgeWeight: [1, 4],\n // Node weight range.\n nodeWeight: [1, 4],\n\n // jitterTolerence: 0.1,\n preventOverlap: false,\n gravityCenter: null\n },\n\n focusNodeAdjacency: true,\n\n focusNodeAdjacencyOn: 'mouseover',\n\n left: 'center',\n top: 'center',\n // right: null,\n // bottom: null,\n // width: '80%',\n // height: '80%',\n\n symbol: 'circle',\n symbolSize: 5,\n\n roam: false,\n\n // Default on center of graph\n center: null,\n\n zoom: 1,\n\n // categories: [],\n\n // data: []\n // Or\n // nodes: []\n //\n // links: []\n // Or\n // edges: []\n\n label: {\n show: false,\n formatter: '{b}',\n position: 'right',\n distance: 5,\n textStyle: {\n fontSize: 14\n }\n },\n\n itemStyle: {},\n\n lineStyle: {\n color: '#aaa',\n width: 1,\n opacity: 0.5\n },\n\n emphasis: {\n label: {\n show: true\n }\n },\n\n animation: false\n }\n});\n\nexport default GraphSeries;","/**\n * Lines geometry\n * Use screen space projected lines lineWidth > MAX_LINE_WIDTH\n * https://mattdesl.svbtle.com/drawing-lines-is-hard\n * @module echarts-gl/util/geometry/LinesGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\nimport dynamicConvertMixin from './dynamicConvertMixin';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nvar vec2 = glmatrix.vec2;\n\n// var CURVE_RECURSION_LIMIT = 8;\n// var CURVE_COLLINEAR_EPSILON = 40;\n\nvar sampleLinePoints = [[0, 0], [1, 1]];\n/**\n * @constructor\n * @alias module:echarts-gl/util/geometry/LinesGeometry\n * @extends clay.Geometry\n */\n\nvar LinesGeometry = Geometry.extend(function () {\n return {\n\n segmentScale: 4,\n\n dynamic: true,\n /**\n * Need to use mesh to expand lines if lineWidth > MAX_LINE_WIDTH\n */\n useNativeLine: true,\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 2, 'POSITION'),\n normal: new Geometry.Attribute('normal', 'float', 2),\n offset: new Geometry.Attribute('offset', 'float', 1),\n color: new Geometry.Attribute('color', 'float', 4, 'COLOR')\n }\n };\n},\n/** @lends module: echarts-gl/util/geometry/LinesGeometry.prototype */\n{\n\n /**\n * Reset offset\n */\n resetOffset: function () {\n this._vertexOffset = 0;\n this._faceOffset = 0;\n\n this._itemVertexOffsets = [];\n },\n\n /**\n * @param {number} nVertex\n */\n setVertexCount: function (nVertex) {\n var attributes = this.attributes;\n if (this.vertexCount !== nVertex) {\n attributes.position.init(nVertex);\n attributes.color.init(nVertex);\n\n if (!this.useNativeLine) {\n attributes.offset.init(nVertex);\n attributes.normal.init(nVertex);\n }\n\n if (nVertex > 0xffff) {\n if (this.indices instanceof Uint16Array) {\n this.indices = new Uint32Array(this.indices);\n }\n }\n else {\n if (this.indices instanceof Uint32Array) {\n this.indices = new Uint16Array(this.indices);\n }\n }\n }\n },\n\n /**\n * @param {number} nTriangle\n */\n setTriangleCount: function (nTriangle) {\n if (this.triangleCount !== nTriangle) {\n if (nTriangle === 0) {\n this.indices = null;\n }\n else {\n this.indices = this.vertexCount > 0xffff ? new Uint32Array(nTriangle * 3) : new Uint16Array(nTriangle * 3);\n }\n }\n },\n\n _getCubicCurveApproxStep: function (p0, p1, p2, p3) {\n var len = vec2.dist(p0, p1) + vec2.dist(p2, p1) + vec2.dist(p3, p2);\n var step = 1 / (len + 1) * this.segmentScale;\n return step;\n },\n\n /**\n * Get vertex count of cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @return number\n */\n getCubicCurveVertexCount: function (p0, p1, p2, p3) {\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n var segCount = Math.ceil(1 / step);\n if (!this.useNativeLine) {\n return segCount * 2 + 2;\n }\n else {\n return segCount * 2;\n }\n },\n\n /**\n * Get face count of cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @return number\n */\n getCubicCurveTriangleCount: function (p0, p1, p2, p3) {\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n var segCount = Math.ceil(1 / step);\n if (!this.useNativeLine) {\n return segCount * 2;\n }\n else {\n return 0;\n }\n },\n\n /**\n * Get vertex count of line\n * @return {number}\n */\n getLineVertexCount: function () {\n return this.getPolylineVertexCount(sampleLinePoints);\n },\n\n /**\n * Get face count of line\n * @return {number}\n */\n getLineTriangleCount: function () {\n return this.getPolylineTriangleCount(sampleLinePoints);\n },\n\n /**\n * Get how many vertices will polyline take.\n * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount.\n * @return {number}\n */\n getPolylineVertexCount: function (points) {\n var pointsLen;\n if (typeof points === 'number') {\n pointsLen = points;\n }\n else {\n var is2DArray = typeof points[0] !== 'number';\n pointsLen = is2DArray ? points.length : (points.length / 2);\n }\n return !this.useNativeLine ? ((pointsLen - 1) * 2 + 2) : (pointsLen - 1) * 2;\n },\n\n /**\n * Get how many triangles will polyline take.\n * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount.\n * @return {number}\n */\n getPolylineTriangleCount: function (points) {\n var pointsLen;\n if (typeof points === 'number') {\n pointsLen = points;\n }\n else {\n var is2DArray = typeof points[0] !== 'number';\n pointsLen = is2DArray ? points.length : (points.length / 2);\n }\n return !this.useNativeLine ? (pointsLen - 1) * 2 : 0;\n },\n\n /**\n * Add a cubic curve\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} p2\n * @param {Array.} p3\n * @param {Array.} color\n * @param {number} [lineWidth=1]\n */\n addCubicCurve: function (p0, p1, p2, p3, color, lineWidth) {\n if (lineWidth == null) {\n lineWidth = 1;\n }\n // incremental interpolation\n // http://antigrain.com/research/bezier_interpolation/index.html#PAGE_BEZIER_INTERPOLATION\n var x0 = p0[0], y0 = p0[1];\n var x1 = p1[0], y1 = p1[1];\n var x2 = p2[0], y2 = p2[1];\n var x3 = p3[0], y3 = p3[1];\n\n var step = this._getCubicCurveApproxStep(p0, p1, p2, p3);\n\n var step2 = step * step;\n var step3 = step2 * step;\n\n var pre1 = 3.0 * step;\n var pre2 = 3.0 * step2;\n var pre4 = 6.0 * step2;\n var pre5 = 6.0 * step3;\n\n var tmp1x = x0 - x1 * 2.0 + x2;\n var tmp1y = y0 - y1 * 2.0 + y2;\n\n var tmp2x = (x1 - x2) * 3.0 - x0 + x3;\n var tmp2y = (y1 - y2) * 3.0 - y0 + y3;\n\n var fx = x0;\n var fy = y0;\n\n var dfx = (x1 - x0) * pre1 + tmp1x * pre2 + tmp2x * step3;\n var dfy = (y1 - y0) * pre1 + tmp1y * pre2 + tmp2y * step3;\n\n var ddfx = tmp1x * pre4 + tmp2x * pre5;\n var ddfy = tmp1y * pre4 + tmp2y * pre5;\n\n var dddfx = tmp2x * pre5;\n var dddfy = tmp2y * pre5;\n\n var t = 0;\n\n var k = 0;\n var segCount = Math.ceil(1 / step);\n\n var points = new Float32Array((segCount + 1) * 3);\n var points = [];\n var offset = 0;\n for (var k = 0; k < segCount + 1; k++) {\n points[offset++] = fx;\n points[offset++] = fy;\n\n fx += dfx; fy += dfy;\n dfx += ddfx; dfy += ddfy;\n ddfx += dddfx; ddfy += dddfy;\n t += step;\n\n if (t > 1) {\n fx = dfx > 0 ? Math.min(fx, x3) : Math.max(fx, x3);\n fy = dfy > 0 ? Math.min(fy, y3) : Math.max(fy, y3);\n }\n }\n\n this.addPolyline(points, color, lineWidth);\n },\n\n /**\n * Add a straight line\n * @param {Array.} p0\n * @param {Array.} p1\n * @param {Array.} color\n * @param {number} [lineWidth=1]\n */\n addLine: function (p0, p1, color, lineWidth) {\n this.addPolyline([p0, p1], color, lineWidth);\n },\n\n /**\n * Add a straight line\n * @param {Array. | Array.} points\n * @param {Array. | Array.} color\n * @param {number} [lineWidth=1]\n * @param {number} [arrayOffset=0]\n * @param {number} [pointsCount] Default to be amount of points in the first argument\n */\n addPolyline: (function () {\n var dirA = vec2.create();\n var dirB = vec2.create();\n var normal = vec2.create();\n var tangent = vec2.create();\n var point = [], nextPoint = [], prevPoint = [];\n return function (points, color, lineWidth, arrayOffset, pointsCount) {\n if (!points.length) {\n return;\n }\n var is2DArray = typeof points[0] !== 'number';\n if (pointsCount == null) {\n pointsCount = is2DArray ? points.length : points.length / 2;\n }\n if (pointsCount < 2) {\n return;\n }\n if (arrayOffset == null) {\n arrayOffset = 0;\n }\n if (lineWidth == null) {\n lineWidth = 1;\n }\n\n this._itemVertexOffsets.push(this._vertexOffset);\n\n var notSharingColor = is2DArray\n ? typeof color[0] !== 'number'\n : color.length / 4 === pointsCount;\n\n var positionAttr = this.attributes.position;\n var colorAttr = this.attributes.color;\n var offsetAttr = this.attributes.offset;\n var normalAttr = this.attributes.normal;\n var indices = this.indices;\n\n var vertexOffset = this._vertexOffset;\n var pointColor;\n for (var k = 0; k < pointsCount; k++) {\n if (is2DArray) {\n point = points[k + arrayOffset];\n if (notSharingColor) {\n pointColor = color[k + arrayOffset];\n }\n else {\n pointColor = color;\n }\n }\n else {\n var k2 = k * 2 + arrayOffset;\n point = point || [];\n point[0] = points[k2];\n point[1] = points[k2 + 1];\n\n if (notSharingColor) {\n var k4 = k * 4 + arrayOffset;\n pointColor = pointColor || [];\n pointColor[0] = color[k4];\n pointColor[1] = color[k4 + 1];\n pointColor[2] = color[k4 + 2];\n pointColor[3] = color[k4 + 3];\n }\n else {\n pointColor = color;\n }\n }\n if (!this.useNativeLine) {\n var offset;\n if (k < pointsCount - 1) {\n if (is2DArray) {\n vec2.copy(nextPoint, points[k + 1]);\n }\n else {\n var k2 = (k + 1) * 2 + arrayOffset;\n nextPoint = nextPoint || [];\n nextPoint[0] = points[k2];\n nextPoint[1] = points[k2 + 1];\n }\n // TODO In case dir is (0, 0)\n // TODO miterLimit\n if (k > 0) {\n vec2.sub(dirA, point, prevPoint);\n vec2.sub(dirB, nextPoint, point);\n vec2.normalize(dirA, dirA);\n vec2.normalize(dirB, dirB);\n vec2.add(tangent, dirA, dirB);\n vec2.normalize(tangent, tangent);\n var miter = lineWidth / 2 * Math.min(1 / vec2.dot(dirA, tangent), 2);\n normal[0] = -tangent[1];\n normal[1] = tangent[0];\n\n offset = miter;\n }\n else {\n vec2.sub(dirA, nextPoint, point);\n vec2.normalize(dirA, dirA);\n\n normal[0] = -dirA[1];\n normal[1] = dirA[0];\n\n offset = lineWidth / 2;\n }\n\n }\n else {\n vec2.sub(dirA, point, prevPoint);\n vec2.normalize(dirA, dirA);\n\n normal[0] = -dirA[1];\n normal[1] = dirA[0];\n\n offset = lineWidth / 2;\n }\n normalAttr.set(vertexOffset, normal);\n normalAttr.set(vertexOffset + 1, normal);\n offsetAttr.set(vertexOffset, offset);\n offsetAttr.set(vertexOffset + 1, -offset);\n\n vec2.copy(prevPoint, point);\n\n positionAttr.set(vertexOffset, point);\n positionAttr.set(vertexOffset + 1, point);\n\n colorAttr.set(vertexOffset, pointColor);\n colorAttr.set(vertexOffset + 1, pointColor);\n\n vertexOffset += 2;\n }\n else {\n if (k > 1) {\n positionAttr.copy(vertexOffset, vertexOffset - 1);\n colorAttr.copy(vertexOffset, vertexOffset - 1);\n vertexOffset++;\n }\n }\n\n if (!this.useNativeLine) {\n if (k > 0) {\n var idx3 = this._faceOffset * 3;\n var indices = this.indices;\n // 0-----2\n // 1-----3\n // 0->1->2, 1->3->2\n indices[idx3] = vertexOffset - 4;\n indices[idx3 + 1] = vertexOffset - 3;\n indices[idx3 + 2] = vertexOffset - 2;\n\n indices[idx3 + 3] = vertexOffset - 3;\n indices[idx3 + 4] = vertexOffset - 1;\n indices[idx3 + 5] = vertexOffset - 2;\n\n this._faceOffset += 2;\n }\n }\n else {\n colorAttr.set(vertexOffset, pointColor);\n positionAttr.set(vertexOffset, point);\n vertexOffset++;\n }\n }\n\n this._vertexOffset = vertexOffset;\n };\n })(),\n\n /**\n * Set color of single line.\n */\n setItemColor: function (idx, color) {\n var startOffset = this._itemVertexOffsets[idx];\n var endOffset = idx < this._itemVertexOffsets.length - 1 ? this._itemVertexOffsets[idx + 1] : this._vertexOffset;\n\n for (var i = startOffset; i < endOffset; i++) {\n this.attributes.color.set(i, color);\n }\n this.dirty('color');\n }\n});\n\necharts.util.defaults(LinesGeometry.prototype, dynamicConvertMixin);\n\nexport default LinesGeometry;","export default \"@export ecgl.forceAtlas2.updateNodeRepulsion\\n\\n#define NODE_COUNT 0\\n\\nuniform sampler2D positionTex;\\n\\nuniform vec2 textureSize;\\nuniform float gravity;\\nuniform float scaling;\\nuniform vec2 gravityCenter;\\n\\nuniform bool strongGravityMode;\\nuniform bool preventOverlap;\\n\\nvarying vec2 v_Texcoord;\\n\\nvoid main() {\\n\\n vec4 n0 = texture2D(positionTex, v_Texcoord);\\n\\n vec2 force = vec2(0.0);\\n for (int i = 0; i < NODE_COUNT; i++) {\\n vec2 uv = vec2(\\n mod(float(i), textureSize.x) / (textureSize.x - 1.0),\\n floor(float(i) / textureSize.x) / (textureSize.y - 1.0)\\n );\\n vec4 n1 = texture2D(positionTex, uv);\\n\\n vec2 dir = n0.xy - n1.xy;\\n float d2 = dot(dir, dir);\\n\\n if (d2 > 0.0) {\\n float factor = 0.0;\\n if (preventOverlap) {\\n float d = sqrt(d2);\\n d = d - n0.w - n1.w;\\n if (d > 0.0) {\\n factor = scaling * n0.z * n1.z / (d * d);\\n }\\n else if (d < 0.0) {\\n factor = scaling * 100.0 * n0.z * n1.z;\\n }\\n }\\n else {\\n factor = scaling * n0.z * n1.z / d2;\\n }\\n force += dir * factor;\\n }\\n }\\n\\n vec2 dir = gravityCenter - n0.xy;\\n float d = 1.0;\\n if (!strongGravityMode) {\\n d = length(dir);\\n }\\n\\n force += dir * n0.z * gravity / (d + 1.0);\\n\\n gl_FragColor = vec4(force, 0.0, 1.0);\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\\n\\nattribute vec2 node1;\\nattribute vec2 node2;\\nattribute float weight;\\n\\nuniform sampler2D positionTex;\\nuniform float edgeWeightInfluence;\\nuniform bool preventOverlap;\\nuniform bool linLogMode;\\n\\nuniform vec2 windowSize: WINDOW_SIZE;\\n\\nvarying vec2 v_Force;\\n\\nvoid main() {\\n\\n vec4 n0 = texture2D(positionTex, node1);\\n vec4 n1 = texture2D(positionTex, node2);\\n\\n vec2 dir = n1.xy - n0.xy;\\n float d = length(dir);\\n float w;\\n if (edgeWeightInfluence == 0.0) {\\n w = 1.0;\\n }\\n else if (edgeWeightInfluence == 1.0) {\\n w = weight;\\n }\\n else {\\n w = pow(weight, edgeWeightInfluence);\\n }\\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\\n vec2 pos = node1 * scale * 2.0 - 1.0;\\n gl_Position = vec4(pos + offset, 0.0, 1.0);\\n gl_PointSize = 1.0;\\n\\n float factor;\\n if (preventOverlap) {\\n d = d - n1.w - n0.w;\\n }\\n if (d <= 0.0) {\\n v_Force = vec2(0.0);\\n return;\\n }\\n\\n if (linLogMode) {\\n factor = w * log(d) / d;\\n }\\n else {\\n factor = w;\\n }\\n v_Force = dir * factor;\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\\n\\nvarying vec2 v_Force;\\n\\nvoid main() {\\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\\n\\nattribute vec2 node;\\n\\nvarying vec2 v_NodeUv;\\n\\nvoid main() {\\n\\n v_NodeUv = node;\\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\\n gl_PointSize = 1.0;\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\\n\\nvarying vec2 v_NodeUv;\\n\\nuniform sampler2D positionTex;\\nuniform sampler2D forceTex;\\nuniform sampler2D forcePrevTex;\\n\\nvoid main() {\\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\\n\\n float mass = texture2D(positionTex, v_NodeUv).z;\\n float swing = length(force - forcePrev) * mass;\\n float traction = length(force + forcePrev) * 0.5 * mass;\\n\\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.calcGlobalSpeed\\n\\nuniform sampler2D globalSpeedPrevTex;\\nuniform sampler2D weightedSumTex;\\nuniform float jitterTolerence;\\n\\nvoid main() {\\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\\n float globalSpeed = jitterTolerence * jitterTolerence\\n * weightedSum.y / weightedSum.x;\\n if (prevGlobalSpeed > 0.0) {\\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\\n }\\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.updatePosition\\n\\nuniform sampler2D forceTex;\\nuniform sampler2D forcePrevTex;\\nuniform sampler2D positionTex;\\nuniform sampler2D globalSpeedTex;\\n\\nvarying vec2 v_Texcoord;\\n\\nvoid main() {\\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\\n vec4 node = texture2D(positionTex, v_Texcoord);\\n\\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\\n float swing = length(force - forcePrev);\\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\\n\\n float df = length(force);\\n if (df > 0.0) {\\n speed = min(df * speed, 10.0) / df;\\n\\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\\n }\\n else {\\n gl_FragColor = node;\\n }\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.edges.vertex\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nattribute vec2 node;\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n\\nuniform sampler2D positionTex;\\n\\nvoid main()\\n{\\n gl_Position = worldViewProjection * vec4(\\n texture2D(positionTex, node).xy, -10.0, 1.0\\n );\\n v_Color = a_Color;\\n}\\n@end\\n\\n@export ecgl.forceAtlas2.edges.fragment\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\nvarying vec4 v_Color;\\nvoid main() {\\n gl_FragColor = color * v_Color;\\n}\\n@end\";\n","import graphicGL from '../../util/graphicGL';\nimport Pass from 'claygl/src/compositor/Pass';\nimport FrameBuffer from 'claygl/src/FrameBuffer';\n\nimport forceAtlas2Code from './forceAtlas2.glsl.js';\ngraphicGL.Shader.import(forceAtlas2Code);\n\nvar defaultConfigs = {\n repulsionByDegree: true,\n linLogMode: false,\n\n strongGravityMode: false,\n gravity: 1.0,\n\n scaling: 1.0,\n\n edgeWeightInfluence: 1.0,\n\n jitterTolerence: 0.1,\n\n preventOverlap: false,\n\n dissuadeHubs: false,\n\n gravityCenter: null\n};\n\nfunction ForceAtlas2GPU(options) {\n\n var textureOpt = {\n type: graphicGL.Texture.FLOAT,\n minFilter: graphicGL.Texture.NEAREST,\n magFilter: graphicGL.Texture.NEAREST\n };\n\n this._positionSourceTex = new graphicGL.Texture2D(textureOpt);\n this._positionSourceTex.flipY = false;\n\n this._positionTex = new graphicGL.Texture2D(textureOpt);\n this._positionPrevTex = new graphicGL.Texture2D(textureOpt);\n this._forceTex = new graphicGL.Texture2D(textureOpt);\n this._forcePrevTex = new graphicGL.Texture2D(textureOpt);\n\n this._weightedSumTex = new graphicGL.Texture2D(textureOpt);\n this._weightedSumTex.width = this._weightedSumTex.height = 1;\n\n this._globalSpeedTex = new graphicGL.Texture2D(textureOpt);\n this._globalSpeedPrevTex = new graphicGL.Texture2D(textureOpt);\n this._globalSpeedTex.width = this._globalSpeedTex.height = 1;\n this._globalSpeedPrevTex.width = this._globalSpeedPrevTex.height = 1;\n\n this._nodeRepulsionPass = new Pass({\n fragment: graphicGL.Shader.source('ecgl.forceAtlas2.updateNodeRepulsion')\n });\n this._positionPass = new Pass({\n fragment: graphicGL.Shader.source('ecgl.forceAtlas2.updatePosition')\n });\n this._globalSpeedPass = new Pass({\n fragment: graphicGL.Shader.source('ecgl.forceAtlas2.calcGlobalSpeed')\n });\n this._copyPass = new Pass({\n fragment: graphicGL.Shader.source('clay.compositor.output')\n });\n\n var additiveBlend = function (gl) {\n gl.blendEquation(gl.FUNC_ADD);\n gl.blendFunc(gl.ONE, gl.ONE);\n };\n this._edgeForceMesh = new graphicGL.Mesh({\n geometry: new graphicGL.Geometry({\n attributes: {\n node1: new graphicGL.Geometry.Attribute('node1', 'float', 2),\n node2: new graphicGL.Geometry.Attribute('node2', 'float', 2),\n weight: new graphicGL.Geometry.Attribute('weight', 'float', 1)\n },\n dynamic: true,\n mainAttribute: 'node1'\n }),\n material: new graphicGL.Material({\n transparent: true,\n shader: graphicGL.createShader('ecgl.forceAtlas2.updateEdgeAttraction'),\n blend: additiveBlend,\n depthMask: false,\n depthText: false\n }),\n mode: graphicGL.Mesh.POINTS\n });\n this._weightedSumMesh = new graphicGL.Mesh({\n geometry: new graphicGL.Geometry({\n attributes: {\n node: new graphicGL.Geometry.Attribute('node', 'float', 2)\n },\n dynamic: true,\n mainAttribute: 'node'\n }),\n material: new graphicGL.Material({\n transparent: true,\n shader: graphicGL.createShader('ecgl.forceAtlas2.calcWeightedSum'),\n blend: additiveBlend,\n depthMask: false,\n depthText: false\n }),\n mode: graphicGL.Mesh.POINTS\n });\n\n this._framebuffer = new FrameBuffer({\n depthBuffer: false\n });\n\n this._dummyCamera = new graphicGL.OrthographicCamera({\n left: -1, right: 1,\n top: 1, bottom: -1,\n near: 0, far: 100\n });\n\n this._globalSpeed = 0;\n}\n\nForceAtlas2GPU.prototype.updateOption = function (options) {\n\n // Default config\n for (var name in defaultConfigs) {\n this[name] = defaultConfigs[name];\n }\n\n // Config according to data scale\n var nNodes = this._nodes.length;\n if (nNodes > 50000) {\n this.jitterTolerence = 10;\n }\n else if (nNodes > 5000) {\n this.jitterTolerence = 1;\n }\n else {\n this.jitterTolerence = 0.1;\n }\n\n if (nNodes > 100) {\n this.scaling = 2.0;\n }\n else {\n this.scaling = 10.0;\n }\n\n // this.edgeWeightInfluence = 1;\n // this.gravity = 1;\n // this.strongGravityMode = false;\n if (options) {\n for (var name in defaultConfigs) {\n if (options[name] != null) {\n this[name] = options[name];\n }\n }\n }\n\n if (this.repulsionByDegree) {\n var positionBuffer = this._positionSourceTex.pixels;\n\n for (var i = 0; i < this._nodes.length; i++) {\n positionBuffer[i * 4 + 2] = (this._nodes[i].degree || 0) + 1;\n }\n }\n};\n\nForceAtlas2GPU.prototype._updateGravityCenter = function (options) {\n var nodes = this._nodes;\n var edges = this._edges;\n\n if (!this.gravityCenter) {\n var min = [Infinity, Infinity];\n var max = [-Infinity, -Infinity];\n for (var i = 0; i < nodes.length; i++) {\n min[0] = Math.min(nodes[i].x, min[0]);\n min[1] = Math.min(nodes[i].y, min[1]);\n max[0] = Math.max(nodes[i].x, max[0]);\n max[1] = Math.max(nodes[i].y, max[1]);\n }\n\n this._gravityCenter = [(min[0] + max[0]) * 0.5, (min[1] + max[1]) * 0.5];\n }\n else {\n this._gravityCenter = this.gravityCenter;\n }\n // Update inDegree, outDegree\n for (var i = 0; i < edges.length; i++) {\n var node1 = edges[i].node1;\n var node2 = edges[i].node2;\n\n nodes[node1].degree = (nodes[node1].degree || 0) + 1;\n nodes[node2].degree = (nodes[node2].degree || 0) + 1;\n }\n};\n/**\n * @param {Array.} [{ x, y, mass }] nodes\n * @param {Array.} [{ node1, node2, weight }] edges\n */\nForceAtlas2GPU.prototype.initData = function (nodes, edges) {\n\n this._nodes = nodes;\n this._edges = edges;\n\n this._updateGravityCenter();\n\n var textureWidth = Math.ceil(Math.sqrt(nodes.length));\n var textureHeight = textureWidth;\n var positionBuffer = new Float32Array(textureWidth * textureHeight * 4);\n\n this._resize(textureWidth, textureHeight);\n\n var offset = 0;\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n positionBuffer[offset++] = node.x || 0;\n positionBuffer[offset++] = node.y || 0;\n positionBuffer[offset++] = node.mass || 1;\n positionBuffer[offset++] = node.size || 1;\n }\n this._positionSourceTex.pixels = positionBuffer;\n\n var edgeGeometry = this._edgeForceMesh.geometry;\n var edgeLen = edges.length;\n edgeGeometry.attributes.node1.init(edgeLen * 2);\n edgeGeometry.attributes.node2.init(edgeLen * 2);\n edgeGeometry.attributes.weight.init(edgeLen * 2);\n\n var uv = [];\n\n for (var i = 0; i < edges.length; i++) {\n var attributes = edgeGeometry.attributes;\n var weight = edges[i].weight;\n if (weight == null) {\n weight = 1;\n }\n // Two way.\n attributes.node1.set(i, this.getNodeUV(edges[i].node1, uv));\n attributes.node2.set(i, this.getNodeUV(edges[i].node2, uv));\n attributes.weight.set(i, weight);\n\n attributes.node1.set(i + edgeLen, this.getNodeUV(edges[i].node2, uv));\n attributes.node2.set(i + edgeLen, this.getNodeUV(edges[i].node1, uv));\n attributes.weight.set(i + edgeLen, weight);\n }\n\n var weigtedSumGeo = this._weightedSumMesh.geometry;\n weigtedSumGeo.attributes.node.init(nodes.length);\n for (var i = 0; i < nodes.length; i++) {\n weigtedSumGeo.attributes.node.set(i, this.getNodeUV(i, uv));\n }\n\n edgeGeometry.dirty();\n weigtedSumGeo.dirty();\n\n this._nodeRepulsionPass.material.define('fragment', 'NODE_COUNT', nodes.length);\n this._nodeRepulsionPass.material.setUniform('textureSize', [textureWidth, textureHeight]);\n\n this._inited = false;\n\n this._frame = 0;\n};\n\nForceAtlas2GPU.prototype.getNodes = function () {\n return this._nodes;\n};\nForceAtlas2GPU.prototype.getEdges = function () {\n return this._edges;\n};\n\nForceAtlas2GPU.prototype.step = function (renderer) {\n if (!this._inited) {\n this._initFromSource(renderer);\n this._inited = true;\n }\n\n this._frame++;\n\n this._framebuffer.attach(this._forceTex);\n this._framebuffer.bind(renderer);\n var nodeRepulsionPass = this._nodeRepulsionPass;\n // Calc node repulsion, gravity\n nodeRepulsionPass.setUniform('strongGravityMode', this.strongGravityMode);\n nodeRepulsionPass.setUniform('gravity', this.gravity);\n nodeRepulsionPass.setUniform('gravityCenter', this._gravityCenter);\n nodeRepulsionPass.setUniform('scaling', this.scaling);\n nodeRepulsionPass.setUniform('preventOverlap', this.preventOverlap);\n nodeRepulsionPass.setUniform('positionTex', this._positionPrevTex);\n nodeRepulsionPass.render(renderer);\n\n // Calc edge attraction force\n var edgeForceMesh = this._edgeForceMesh;\n edgeForceMesh.material.set('linLogMode', this.linLogMode);\n edgeForceMesh.material.set('edgeWeightInfluence', this.edgeWeightInfluence);\n edgeForceMesh.material.set('preventOverlap', this.preventOverlap);\n edgeForceMesh.material.set('positionTex', this._positionPrevTex);\n renderer.gl.enable(renderer.gl.BLEND);\n renderer.renderPass([edgeForceMesh], this._dummyCamera);\n\n // Calc weighted sum.\n this._framebuffer.attach(this._weightedSumTex);\n renderer.gl.clearColor(0, 0, 0, 0);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT);\n renderer.gl.enable(renderer.gl.BLEND);\n var weightedSumMesh = this._weightedSumMesh;\n weightedSumMesh.material.set('positionTex', this._positionPrevTex);\n weightedSumMesh.material.set('forceTex', this._forceTex);\n weightedSumMesh.material.set('forcePrevTex', this._forcePrevTex);\n renderer.renderPass([weightedSumMesh], this._dummyCamera);\n\n // Calc global speed.\n this._framebuffer.attach(this._globalSpeedTex);\n var globalSpeedPass = this._globalSpeedPass;\n globalSpeedPass.setUniform('globalSpeedPrevTex', this._globalSpeedPrevTex);\n globalSpeedPass.setUniform('weightedSumTex', this._weightedSumTex);\n globalSpeedPass.setUniform('jitterTolerence', this.jitterTolerence);\n renderer.gl.disable(renderer.gl.BLEND);\n globalSpeedPass.render(renderer);\n\n // Update position.\n var positionPass = this._positionPass;\n this._framebuffer.attach(this._positionTex);\n positionPass.setUniform('globalSpeedTex', this._globalSpeedTex);\n positionPass.setUniform('positionTex', this._positionPrevTex);\n positionPass.setUniform('forceTex', this._forceTex);\n positionPass.setUniform('forcePrevTex', this._forcePrevTex);\n positionPass.render(renderer);\n\n this._framebuffer.unbind(renderer);\n\n this._swapTexture();\n};\n\nForceAtlas2GPU.prototype.update = function (renderer, steps, cb) {\n if (steps == null) {\n steps = 1;\n }\n steps = Math.max(steps, 1);\n\n for (var i = 0; i < steps; i++) {\n this.step(renderer);\n }\n\n cb && cb();\n};\n\nForceAtlas2GPU.prototype.getNodePositionTexture = function () {\n return this._inited\n // Texture already been swapped.\n ? this._positionPrevTex\n : this._positionSourceTex;\n};\n\nForceAtlas2GPU.prototype.getNodeUV = function (nodeIndex, uv) {\n uv = uv || [];\n var textureWidth = this._positionTex.width;\n var textureHeight = this._positionTex.height;\n uv[0] = (nodeIndex % textureWidth) / (textureWidth - 1);\n uv[1] = Math.floor(nodeIndex / textureWidth) / (textureHeight - 1) || 0;\n return uv;\n};\n\nForceAtlas2GPU.prototype.getNodePosition = function (renderer, out) {\n var positionArr = this._positionArr;\n var width = this._positionTex.width;\n var height = this._positionTex.height;\n var size = width * height;\n if (!positionArr || positionArr.length !== size * 4) {\n positionArr = this._positionArr = new Float32Array(size * 4);\n }\n this._framebuffer.bind(renderer);\n this._framebuffer.attach(this._positionPrevTex);\n renderer.gl.readPixels(\n 0, 0, width, height,\n renderer.gl.RGBA, renderer.gl.FLOAT,\n positionArr\n );\n this._framebuffer.unbind(renderer);\n if (!out) {\n out = new Float32Array(this._nodes.length * 2);\n }\n for (var i = 0; i < this._nodes.length; i++) {\n out[i * 2] = positionArr[i * 4];\n out[i * 2 + 1] = positionArr[i * 4 + 1];\n }\n return out;\n};\n\nForceAtlas2GPU.prototype.getTextureData = function (renderer, textureName) {\n var tex = this['_' + textureName + 'Tex'];\n var width = tex.width;\n var height = tex.height;\n this._framebuffer.bind(renderer);\n this._framebuffer.attach(tex);\n var arr = new Float32Array(width * height * 4);\n renderer.gl.readPixels(0, 0, width, height, renderer.gl.RGBA, renderer.gl.FLOAT, arr);\n this._framebuffer.unbind(renderer);\n return arr;\n};\n\nForceAtlas2GPU.prototype.getTextureSize = function () {\n return {\n width: this._positionTex.width,\n height: this._positionTex.height\n };\n};\n\nForceAtlas2GPU.prototype.isFinished = function (maxSteps) {\n return this._frame > maxSteps;\n};\n\nForceAtlas2GPU.prototype._swapTexture = function () {\n var tmp = this._positionPrevTex;\n this._positionPrevTex = this._positionTex;\n this._positionTex = tmp;\n\n var tmp = this._forcePrevTex;\n this._forcePrevTex = this._forceTex;\n this._forceTex = tmp;\n\n var tmp = this._globalSpeedPrevTex;\n this._globalSpeedPrevTex = this._globalSpeedTex;\n this._globalSpeedTex = tmp;\n};\n\nForceAtlas2GPU.prototype._initFromSource = function (renderer) {\n this._framebuffer.attach(this._positionPrevTex);\n this._framebuffer.bind(renderer);\n this._copyPass.setUniform('texture', this._positionSourceTex);\n this._copyPass.render(renderer);\n\n renderer.gl.clearColor(0, 0, 0, 0);\n this._framebuffer.attach(this._forcePrevTex);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT);\n this._framebuffer.attach(this._globalSpeedPrevTex);\n renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT);\n\n this._framebuffer.unbind(renderer);\n};\n\nForceAtlas2GPU.prototype._resize = function (width, height) {\n ['_positionSourceTex', '_positionTex', '_positionPrevTex', '_forceTex', '_forcePrevTex'].forEach(function (texName) {\n this[texName].width = width;\n this[texName].height = height;\n this[texName].dirty();\n }, this);\n};\n\nForceAtlas2GPU.prototype.dispose = function (renderer) {\n this._framebuffer.dispose(renderer);\n\n this._copyPass.dispose(renderer);\n this._nodeRepulsionPass.dispose(renderer);\n this._positionPass.dispose(renderer);\n this._globalSpeedPass.dispose(renderer);\n\n this._edgeForceMesh.geometry.dispose(renderer);\n this._weightedSumMesh.geometry.dispose(renderer);\n\n this._positionSourceTex.dispose(renderer);\n this._positionTex.dispose(renderer);\n this._positionPrevTex.dispose(renderer);\n this._forceTex.dispose(renderer);\n this._forcePrevTex.dispose(renderer);\n this._weightedSumTex.dispose(renderer);\n this._globalSpeedTex.dispose(renderer);\n this._globalSpeedPrevTex.dispose(renderer);\n};\n\nexport default ForceAtlas2GPU;","/****************************\n * Vector2 math functions\n ***************************/\n\nfunction forceAtlas2Worker() {\n var vec2 = {\n create: function() {\n return new Float32Array(2);\n },\n dist: function(a, b) {\n var x = b[0] - a[0];\n var y = b[1] - a[1];\n return Math.sqrt(x*x + y*y);\n },\n len: function(a) {\n var x = a[0];\n var y = a[1];\n return Math.sqrt(x*x + y*y);\n },\n scaleAndAdd: function(out, a, b, scale) {\n out[0] = a[0] + b[0] * scale;\n out[1] = a[1] + b[1] * scale;\n return out;\n },\n scale: function(out, a, b) {\n out[0] = a[0] * b;\n out[1] = a[1] * b;\n return out;\n },\n add: function(out, a, b) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n return out;\n },\n sub: function(out, a, b) {\n out[0] = a[0] - b[0];\n out[1] = a[1] - b[1];\n return out;\n },\n normalize: function(out, a) {\n var x = a[0];\n var y = a[1];\n var len = x*x + y*y;\n if (len > 0) {\n //TODO: evaluate use of glm_invsqrt here?\n len = 1 / Math.sqrt(len);\n out[0] = a[0] * len;\n out[1] = a[1] * len;\n }\n return out;\n },\n negate: function(out, a) {\n out[0] = -a[0];\n out[1] = -a[1];\n return out;\n },\n copy: function(out, a) {\n out[0] = a[0];\n out[1] = a[1];\n return out;\n },\n set: function(out, x, y) {\n out[0] = x;\n out[1] = y;\n return out;\n }\n }\n\n /****************************\n * Class: Region\n ***************************/\n\n function Region() {\n\n this.subRegions = [];\n\n this.nSubRegions = 0;\n\n this.node = null;\n\n this.mass = 0;\n\n this.centerOfMass = null;\n\n this.bbox = new Float32Array(4);\n\n this.size = 0;\n }\n\n var regionProto = Region.prototype;\n\n // Reset before update\n regionProto.beforeUpdate = function() {\n for (var i = 0; i < this.nSubRegions; i++) {\n this.subRegions[i].beforeUpdate();\n }\n this.mass = 0;\n if (this.centerOfMass) {\n this.centerOfMass[0] = 0;\n this.centerOfMass[1] = 0;\n }\n this.nSubRegions = 0;\n this.node = null;\n };\n // Clear after update\n regionProto.afterUpdate = function() {\n this.subRegions.length = this.nSubRegions;\n for (var i = 0; i < this.nSubRegions; i++) {\n this.subRegions[i].afterUpdate();\n }\n };\n\n regionProto.addNode = function(node) {\n if (this.nSubRegions === 0) {\n if (this.node == null) {\n this.node = node;\n return;\n }\n // Already have node, subdivide self.\n else {\n this._addNodeToSubRegion(this.node);\n this.node = null;\n }\n }\n this._addNodeToSubRegion(node);\n\n this._updateCenterOfMass(node);\n };\n\n regionProto.findSubRegion = function(x, y) {\n for (var i = 0; i < this.nSubRegions; i++) {\n var region = this.subRegions[i];\n if (region.contain(x, y)) {\n return region;\n }\n }\n };\n\n regionProto.contain = function(x, y) {\n return this.bbox[0] <= x\n && this.bbox[2] >= x\n && this.bbox[1] <= y\n && this.bbox[3] >= y;\n };\n\n regionProto.setBBox = function(minX, minY, maxX, maxY) {\n // Min\n this.bbox[0] = minX;\n this.bbox[1] = minY;\n // Max\n this.bbox[2] = maxX;\n this.bbox[3] = maxY;\n\n this.size = (maxX - minX + maxY - minY) / 2;\n };\n\n regionProto._newSubRegion = function() {\n var subRegion = this.subRegions[this.nSubRegions];\n if (!subRegion) {\n subRegion = new Region();\n this.subRegions[this.nSubRegions] = subRegion;\n }\n this.nSubRegions++;\n return subRegion;\n };\n\n regionProto._addNodeToSubRegion = function(node) {\n var subRegion = this.findSubRegion(node.position[0], node.position[1]);\n var bbox = this.bbox;\n if (!subRegion) {\n var cx = (bbox[0] + bbox[2]) / 2;\n var cy = (bbox[1] + bbox[3]) / 2;\n var w = (bbox[2] - bbox[0]) / 2;\n var h = (bbox[3] - bbox[1]) / 2;\n\n var xi = node.position[0] >= cx ? 1 : 0;\n var yi = node.position[1] >= cy ? 1 : 0;\n\n var subRegion = this._newSubRegion();\n // Min\n subRegion.setBBox(\n // Min\n xi * w + bbox[0],\n yi * h + bbox[1],\n // Max\n (xi + 1) * w + bbox[0],\n (yi + 1) * h + bbox[1]\n );\n }\n\n subRegion.addNode(node);\n };\n\n regionProto._updateCenterOfMass = function(node) {\n // Incrementally update\n if (this.centerOfMass == null) {\n this.centerOfMass = new Float32Array(2);\n }\n var x = this.centerOfMass[0] * this.mass;\n var y = this.centerOfMass[1] * this.mass;\n x += node.position[0] * node.mass;\n y += node.position[1] * node.mass;\n this.mass += node.mass;\n this.centerOfMass[0] = x / this.mass;\n this.centerOfMass[1] = y / this.mass;\n };\n\n /****************************\n * Class: Graph Node\n ***************************/\n function GraphNode() {\n this.position = new Float32Array(2);\n\n this.force = vec2.create();\n this.forcePrev = vec2.create();\n\n // If repulsionByDegree is true\n // mass = inDegree + outDegree + 1\n // Else\n // mass is manually set\n this.mass = 1;\n\n this.inDegree = 0;\n this.outDegree = 0;\n\n // Optional\n // this.size = 1;\n }\n\n /****************************\n * Class: Graph Edge\n ***************************/\n function GraphEdge(source, target) {\n this.source = source;\n this.target = target;\n\n this.weight = 1;\n }\n\n /****************************\n * Class: ForceStlas2\n ***************************/\n function ForceAtlas2() {\n //-------------\n // Configs\n\n // If auto settings is true\n // barnesHutOptimize,\n // barnesHutTheta,\n // scaling,\n // jitterTolerence\n // Will be set by the system automatically\n // preventOverlap will be set false\n // if node size is not given\n this.autoSettings = true;\n\n // Barnes Hut\n // http://arborjs.org/docs/barnes-hut\n this.barnesHutOptimize = true;\n this.barnesHutTheta = 1.5;\n\n // Force Atlas2 Configs\n this.repulsionByDegree = true;\n\n this.linLogMode = false;\n\n this.strongGravityMode = false;\n this.gravity = 1.0;\n\n this.scaling = 1.0;\n\n this.edgeWeightInfluence = 1.0;\n this.jitterTolerence = 0.1;\n\n // TODO\n this.preventOverlap = false;\n this.dissuadeHubs = false;\n\n //\n this.rootRegion = new Region();\n this.rootRegion.centerOfMass = vec2.create();\n\n this.nodes = [];\n\n this.edges = [];\n\n this.bbox = new Float32Array(4);\n\n this.gravityCenter = null;\n\n this._massArr = null;\n\n this._swingingArr = null;\n\n this._sizeArr = null;\n\n this._globalSpeed = 0;\n }\n\n var forceAtlas2Proto = ForceAtlas2.prototype;\n\n forceAtlas2Proto.initNodes = function(positionArr, massArr, sizeArr) {\n var nNodes = massArr.length;\n this.nodes.length = 0;\n var haveSize = typeof(sizeArr) != 'undefined';\n for (var i = 0; i < nNodes; i++) {\n var node = new GraphNode();\n node.position[0] = positionArr[i * 2];\n node.position[1] = positionArr[i * 2 + 1];\n node.mass = massArr[i];\n if (haveSize) {\n node.size = sizeArr[i];\n }\n this.nodes.push(node);\n }\n\n this._massArr = massArr;\n this._swingingArr = new Float32Array(nNodes);\n\n if (haveSize) {\n this._sizeArr = sizeArr;\n }\n };\n\n forceAtlas2Proto.initEdges = function(edgeArr, edgeWeightArr) {\n var nEdges = edgeArr.length / 2;\n this.edges.length = 0;\n for (var i = 0; i < nEdges; i++) {\n var sIdx = edgeArr[i * 2];\n var tIdx = edgeArr[i * 2 + 1];\n var sNode = this.nodes[sIdx];\n var tNode = this.nodes[tIdx];\n\n if (!sNode || !tNode) {\n console.error('Node not exists, try initNodes before initEdges');\n return;\n }\n sNode.outDegree++;\n tNode.inDegree++;\n var edge = new GraphEdge(sNode, tNode);\n\n if (edgeWeightArr) {\n edge.weight = edgeWeightArr[i];\n }\n\n this.edges.push(edge);\n }\n }\n\n forceAtlas2Proto.updateSettings = function() {\n if (this.repulsionByDegree) {\n for (var i = 0; i < this.nodes.length; i++) {\n var node = this.nodes[i];\n node.mass = node.inDegree + node.outDegree + 1;\n }\n }\n else {\n for (var i = 0; i < this.nodes.length; i++) {\n var node = this.nodes[i];\n node.mass = this._massArr[i];\n }\n }\n };\n\n forceAtlas2Proto.update = function() {\n var nNodes = this.nodes.length;\n\n this.updateSettings();\n\n this.updateBBox();\n\n // Update region\n if (this.barnesHutOptimize) {\n this.rootRegion.setBBox(\n this.bbox[0], this.bbox[1],\n this.bbox[2], this.bbox[3]\n );\n\n this.rootRegion.beforeUpdate();\n for (var i = 0; i < nNodes; i++) {\n this.rootRegion.addNode(this.nodes[i]);\n }\n this.rootRegion.afterUpdate();\n }\n\n // Reset forces\n for (var i = 0; i < nNodes; i++) {\n var node = this.nodes[i];\n vec2.copy(node.forcePrev, node.force);\n vec2.set(node.force, 0, 0);\n }\n\n // Compute forces\n // Repulsion\n for (var i = 0; i < nNodes; i++) {\n var na = this.nodes[i];\n if (this.barnesHutOptimize) {\n this.applyRegionToNodeRepulsion(this.rootRegion, na);\n }\n else {\n for (var j = i + 1; j < nNodes; j++) {\n var nb = this.nodes[j];\n this.applyNodeToNodeRepulsion(na, nb, false);\n }\n }\n\n // Gravity\n if (this.gravity > 0) {\n if (this.strongGravityMode) {\n this.applyNodeStrongGravity(na);\n }\n else {\n this.applyNodeGravity(na);\n }\n }\n }\n\n // Attraction\n for (var i = 0; i < this.edges.length; i++) {\n this.applyEdgeAttraction(this.edges[i]);\n }\n\n // Handle swinging\n var swingWeightedSum = 0;\n var tractionWeightedSum = 0;\n var tmp = vec2.create();\n for (var i = 0; i < nNodes; i++) {\n var node = this.nodes[i];\n var swing = vec2.dist(node.force, node.forcePrev);\n swingWeightedSum += swing * node.mass;\n\n vec2.add(tmp, node.force, node.forcePrev);\n var traction = vec2.len(tmp) * 0.5;\n tractionWeightedSum += traction * node.mass;\n\n // Save the value for using later\n this._swingingArr[i] = swing;\n }\n var globalSpeed = this.jitterTolerence * this.jitterTolerence\n * tractionWeightedSum / swingWeightedSum;\n // NB: During our tests we observed that an excessive rise of the global speed could have a negative impact.\n // That’s why we limited the increase of global speed s(t)(G) to 50% of the previous step s(t−1)(G).\n if (this._globalSpeed > 0) {\n globalSpeed = Math.min(globalSpeed / this._globalSpeed, 1.5) * this._globalSpeed;\n }\n this._globalSpeed = globalSpeed;\n\n // Apply forces\n for (var i = 0; i < nNodes; i++) {\n var node = this.nodes[i];\n var swing = this._swingingArr[i];\n\n var speed = 0.1 * globalSpeed / (1 + globalSpeed * Math.sqrt(swing));\n\n // Additional constraint to prevent local speed gets too high\n var df = vec2.len(node.force);\n if (df > 0) {\n speed = Math.min(df * speed, 10) / df;\n vec2.scaleAndAdd(node.position, node.position, node.force, speed);\n }\n }\n };\n\n forceAtlas2Proto.applyRegionToNodeRepulsion = (function() {\n var v = vec2.create();\n return function applyRegionToNodeRepulsion(region, node) {\n if (region.node) { // Region is a leaf\n this.applyNodeToNodeRepulsion(region.node, node, true);\n }\n else {\n vec2.sub(v, node.position, region.centerOfMass);\n var d2 = v[0] * v[0] + v[1] * v[1];\n if (d2 > this.barnesHutTheta * region.size * region.size) {\n var factor = this.scaling * node.mass * region.mass / d2;\n vec2.scaleAndAdd(node.force, node.force, v, factor);\n }\n else {\n for (var i = 0; i < region.nSubRegions; i++) {\n this.applyRegionToNodeRepulsion(region.subRegions[i], node);\n }\n }\n }\n }\n })();\n\n forceAtlas2Proto.applyNodeToNodeRepulsion = (function() {\n var v = vec2.create();\n return function applyNodeToNodeRepulsion(na, nb, oneWay) {\n if (na == nb) {\n return;\n }\n vec2.sub(v, na.position, nb.position);\n var d2 = v[0] * v[0] + v[1] * v[1];\n\n // PENDING\n if (d2 === 0) {\n return;\n }\n\n var factor;\n if (this.preventOverlap) {\n var d = Math.sqrt(d2);\n d = d - na.size - nb.size;\n if (d > 0) {\n factor = this.scaling * na.mass * nb.mass / (d * d);\n }\n else if (d < 0) {\n // A stronger repulsion if overlap\n factor = this.scaling * 100 * na.mass * nb.mass;\n }\n else {\n // No repulsion\n return;\n }\n }\n else {\n // Divide factor by an extra `d` to normalize the `v`\n factor = this.scaling * na.mass * nb.mass / d2;\n }\n\n vec2.scaleAndAdd(na.force, na.force, v, factor);\n vec2.scaleAndAdd(nb.force, nb.force, v, -factor);\n }\n })();\n\n forceAtlas2Proto.applyEdgeAttraction = (function() {\n var v = vec2.create();\n return function applyEdgeAttraction(edge) {\n var na = edge.source;\n var nb = edge.target;\n\n vec2.sub(v, na.position, nb.position);\n var d = vec2.len(v);\n\n var w;\n if (this.edgeWeightInfluence === 0) {\n w = 1;\n }\n else if (this.edgeWeightInfluence === 1) {\n w = edge.weight;\n }\n else {\n w = Math.pow(edge.weight, this.edgeWeightInfluence);\n }\n\n var factor;\n\n if (this.preventOverlap) {\n d = d - na.size - nb.size;\n if (d <= 0) {\n // No attraction\n return;\n }\n }\n\n if (this.linLogMode) {\n // Divide factor by an extra `d` to normalize the `v`\n factor = - w * Math.log(d + 1) / (d + 1);\n }\n else {\n factor = - w;\n }\n vec2.scaleAndAdd(na.force, na.force, v, factor);\n vec2.scaleAndAdd(nb.force, nb.force, v, -factor);\n }\n })();\n\n forceAtlas2Proto.applyNodeGravity = (function() {\n var v = vec2.create();\n return function(node) {\n vec2.sub(v, this.gravityCenter, node.position);\n var d = vec2.len(v);\n vec2.scaleAndAdd(node.force, node.force, v, this.gravity * node.mass / (d + 1));\n }\n })();\n\n forceAtlas2Proto.applyNodeStrongGravity = (function() {\n var v = vec2.create();\n return function(node) {\n vec2.sub(v, this.gravityCenter, node.position);\n vec2.scaleAndAdd(node.force, node.force, v, this.gravity * node.mass);\n }\n })();\n\n forceAtlas2Proto.updateBBox = function() {\n var minX = Infinity;\n var minY = Infinity;\n var maxX = -Infinity;\n var maxY = -Infinity;\n for (var i = 0; i < this.nodes.length; i++) {\n var pos = this.nodes[i].position;\n minX = Math.min(minX, pos[0]);\n minY = Math.min(minY, pos[1]);\n maxX = Math.max(maxX, pos[0]);\n maxY = Math.max(maxY, pos[1]);\n }\n this.bbox[0] = minX;\n this.bbox[1] = minY;\n this.bbox[2] = maxX;\n this.bbox[3] = maxY;\n };\n\n forceAtlas2Proto.getGlobalSpeed = function () {\n return this._globalSpeed;\n }\n\n /****************************\n * Main process\n ***************************/\n\n var forceAtlas2 = null;\n\n self.onmessage = function(e) {\n switch(e.data.cmd) {\n case 'init':\n forceAtlas2 = new ForceAtlas2();\n forceAtlas2.initNodes(e.data.nodesPosition, e.data.nodesMass, e.data.nodesSize);\n forceAtlas2.initEdges(e.data.edges, e.data.edgesWeight);\n break;\n case 'updateConfig':\n if (forceAtlas2) {\n for (var name in e.data.config) {\n forceAtlas2[name] = e.data.config[name];\n }\n }\n break;\n case 'update':\n var steps = e.data.steps;\n if (forceAtlas2) {\n for (var i = 0; i < steps; i++) {\n forceAtlas2.update();\n }\n\n var nNodes = forceAtlas2.nodes.length;\n var positionArr = new Float32Array(nNodes * 2);\n // Callback\n for (var i = 0; i < nNodes; i++) {\n var node = forceAtlas2.nodes[i];\n positionArr[i * 2] = node.position[0];\n positionArr[i * 2 + 1] = node.position[1];\n }\n self.postMessage({\n buffer: positionArr.buffer,\n globalSpeed: forceAtlas2.getGlobalSpeed()\n }, [positionArr.buffer]);\n }\n else {\n // Not initialzied yet\n var emptyArr = new Float32Array();\n // Post transfer object\n self.postMessage({\n buffer: emptyArr.buffer,\n globalSpeed: forceAtlas2.getGlobalSpeed()\n }, [emptyArr.buffer]);\n }\n break;\n }\n }\n}\n\nexport default forceAtlas2Worker;","import Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport workerFunc from './forceAtlas2Worker.js';\nvar workerUrl = workerFunc.toString();\nworkerUrl = workerUrl.slice(workerUrl.indexOf('{') + 1, workerUrl.lastIndexOf('}'));\n\nvar defaultConfigs = {\n\n barnesHutOptimize: true,\n barnesHutTheta: 1.5,\n\n repulsionByDegree: true,\n linLogMode: false,\n\n strongGravityMode: false,\n gravity: 1.0,\n\n scaling: 1.0,\n\n edgeWeightInfluence: 1.0,\n\n jitterTolerence: 0.1,\n\n preventOverlap: false,\n\n dissuadeHubs: false,\n\n gravityCenter: null\n};\n\nvar ForceAtlas2 = function (options) {\n\n for (var name in defaultConfigs) {\n this[name] = defaultConfigs[name];\n }\n\n if (options) {\n for (var name in options) {\n this[name] = options[name];\n }\n }\n\n this._nodes = [];\n this._edges = [];\n\n this._disposed = false;\n\n this._positionTex = new Texture2D({\n type: Texture.FLOAT,\n flipY: false,\n minFilter: Texture.NEAREST,\n magFilter: Texture.NEAREST\n });\n};\n\nForceAtlas2.prototype.initData = function (nodes, edges) {\n\n var bb = new Blob([workerUrl]);\n var blobURL = window.URL.createObjectURL(bb);\n\n this._worker = new Worker(blobURL);\n\n this._worker.onmessage = this._$onupdate.bind(this);\n\n this._nodes = nodes;\n this._edges = edges;\n this._frame = 0;\n\n var nNodes = nodes.length;\n var nEdges = edges.length;\n\n var positionArr = new Float32Array(nNodes * 2);\n var massArr = new Float32Array(nNodes);\n var sizeArr = new Float32Array(nNodes);\n\n var edgeArr = new Float32Array(nEdges * 2);\n var edgeWeightArr = new Float32Array(nEdges);\n\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n\n positionArr[i * 2] = node.x;\n positionArr[i * 2 + 1] = node.y;\n\n massArr[i] = node.mass == null ? 1 : node.mass;\n sizeArr[i] = node.size == null ? 1 : node.size;\n }\n\n for (var i = 0; i < edges.length; i++) {\n var edge = edges[i];\n\n var source = edge.node1;\n var target = edge.node2;\n\n edgeArr[i * 2] = source;\n edgeArr[i * 2 + 1] = target;\n\n edgeWeightArr[i] = edge.weight == null ? 1 : edge.weight;\n }\n\n\n var textureWidth = Math.ceil(Math.sqrt(nodes.length));\n var textureHeight = textureWidth;\n var pixels = new Float32Array(textureWidth * textureHeight * 4);\n var positionTex = this._positionTex;\n positionTex.width = textureWidth;\n positionTex.height = textureHeight;\n positionTex.pixels = pixels;\n\n this._worker.postMessage({\n cmd: 'init',\n nodesPosition: positionArr,\n nodesMass: massArr,\n nodesSize: sizeArr,\n edges: edgeArr,\n edgesWeight: edgeWeightArr\n });\n\n this._globalSpeed = Infinity;\n};\n\nForceAtlas2.prototype.updateOption = function (options) {\n var config = {};\n // Default config\n for (var name in defaultConfigs) {\n config[name] = defaultConfigs[name];\n }\n\n var nodes = this._nodes;\n var edges = this._edges;\n\n // Config according to data scale\n var nNodes = nodes.length;\n if (nNodes > 50000) {\n config.jitterTolerence = 10;\n }\n else if (nNodes > 5000) {\n config.jitterTolerence = 1;\n }\n else {\n config.jitterTolerence = 0.1;\n }\n\n if (nNodes > 100) {\n config.scaling = 2.0;\n }\n else {\n config.scaling = 10.0;\n }\n if (nNodes > 1000) {\n config.barnesHutOptimize = true;\n }\n else {\n config.barnesHutOptimize = false;\n }\n\n if (options) {\n for (var name in defaultConfigs) {\n if (options[name] != null) {\n config[name] = options[name];\n }\n }\n }\n\n if (!config.gravityCenter) {\n var min = [Infinity, Infinity];\n var max = [-Infinity, -Infinity];\n for (var i = 0; i < nodes.length; i++) {\n min[0] = Math.min(nodes[i].x, min[0]);\n min[1] = Math.min(nodes[i].y, min[1]);\n max[0] = Math.max(nodes[i].x, max[0]);\n max[1] = Math.max(nodes[i].y, max[1]);\n }\n\n config.gravityCenter = [(min[0] + max[0]) * 0.5, (min[1] + max[1]) * 0.5];\n }\n\n // Update inDegree, outDegree\n for (var i = 0; i < edges.length; i++) {\n var node1 = edges[i].node1;\n var node2 = edges[i].node2;\n\n nodes[node1].degree = (nodes[node1].degree || 0) + 1;\n nodes[node2].degree = (nodes[node2].degree || 0) + 1;\n }\n\n if (this._worker) {\n this._worker.postMessage({\n cmd: 'updateConfig',\n config: config\n });\n }\n};\n\n// Steps per call, to keep sync with rendering\nForceAtlas2.prototype.update = function (renderer, steps, cb) {\n if (steps == null) {\n steps = 1;\n }\n steps = Math.max(steps, 1);\n\n this._frame += steps;\n this._onupdate = cb;\n\n if (this._worker) {\n this._worker.postMessage({\n cmd: 'update',\n steps: Math.round(steps)\n });\n }\n};\n\nForceAtlas2.prototype._$onupdate = function (e) {\n // Incase the worker keep postMessage of last frame after it is disposed\n if (this._disposed) {\n return;\n }\n\n var positionArr = new Float32Array(e.data.buffer);\n this._globalSpeed = e.data.globalSpeed;\n\n this._positionArr = positionArr;\n\n this._updateTexture(positionArr);\n\n this._onupdate && this._onupdate();\n};\n\nForceAtlas2.prototype.getNodePositionTexture = function () {\n return this._positionTex;\n};\n\nForceAtlas2.prototype.getNodeUV = function (nodeIndex, uv) {\n uv = uv || [];\n var textureWidth = this._positionTex.width;\n var textureHeight = this._positionTex.height;\n uv[0] = (nodeIndex % textureWidth) / (textureWidth - 1);\n uv[1] = Math.floor(nodeIndex / textureWidth) / (textureHeight - 1);\n return uv;\n};\n\nForceAtlas2.prototype.getNodes = function () {\n return this._nodes;\n};\nForceAtlas2.prototype.getEdges = function () {\n return this._edges;\n};\nForceAtlas2.prototype.isFinished = function (maxSteps) {\n return this._frame > maxSteps;\n};\n\nForceAtlas2.prototype.getNodePosition = function (renderer, out) {\n if (!out) {\n out = new Float32Array(this._nodes.length * 2);\n }\n if (this._positionArr) {\n for (var i = 0; i < this._positionArr.length; i++) {\n out[i] = this._positionArr[i];\n }\n }\n return out;\n};\n\nForceAtlas2.prototype._updateTexture = function (positionArr) {\n var pixels = this._positionTex.pixels;\n var offset = 0;\n for (var i = 0; i < positionArr.length;){\n pixels[offset++] = positionArr[i++];\n pixels[offset++] = positionArr[i++];\n pixels[offset++] = 1;\n pixels[offset++] = 1;\n }\n this._positionTex.dirty();\n};\n\nForceAtlas2.prototype.dispose = function (renderer) {\n this._disposed = true;\n this._worker = null;\n};\n\nexport default ForceAtlas2;","\nimport Base from 'claygl/src/core/Base';\nimport retrieve from './retrieve';\n\n/**\n * @alias module:echarts-gl/util/Roam2DControl\n */\nvar Roam2DControl = Base.extend(function () {\n\n return {\n /**\n * @type {module:zrender~ZRender}\n */\n zr: null,\n\n /**\n * @type {module:echarts-gl/core/ViewGL}\n */\n viewGL: null,\n\n minZoom: 0.2,\n\n maxZoom: 5,\n\n _needsUpdate: false,\n\n _dx: 0,\n _dy: 0,\n\n _zoom: 1\n };\n}, function () {\n // Each Roam2DControl has it's own handler\n this._mouseDownHandler = this._mouseDownHandler.bind(this);\n this._mouseWheelHandler = this._mouseWheelHandler.bind(this);\n this._mouseMoveHandler = this._mouseMoveHandler.bind(this);\n this._mouseUpHandler = this._mouseUpHandler.bind(this);\n this._update = this._update.bind(this);\n}, {\n\n init: function () {\n var zr = this.zr;\n\n zr.on('mousedown', this._mouseDownHandler);\n zr.on('mousewheel', this._mouseWheelHandler);\n zr.on('globalout', this._mouseUpHandler);\n\n zr.animation.on('frame', this._update);\n },\n\n setTarget: function (target) {\n this._target = target;\n },\n\n setZoom: function (zoom) {\n this._zoom = Math.max(Math.min(\n zoom, this.maxZoom\n ), this.minZoom);\n this._needsUpdate = true;\n },\n\n setOffset: function (offset) {\n this._dx = offset[0];\n this._dy = offset[1];\n\n this._needsUpdate = true;\n },\n\n getZoom: function () {\n return this._zoom;\n },\n\n getOffset: function () {\n return [this._dx, this._dy];\n },\n\n _update: function () {\n if (!this._target) {\n return;\n }\n if (!this._needsUpdate) {\n return;\n }\n\n var target = this._target;\n\n var scale = this._zoom;\n\n target.position.x = this._dx;\n target.position.y = this._dy;\n\n target.scale.set(scale, scale, scale);\n\n this.zr.refresh();\n\n this._needsUpdate = false;\n\n this.trigger('update');\n },\n\n _mouseDownHandler: function (e) {\n if (e.target) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY;\n if (this.viewGL && !this.viewGL.containPoint(x, y)) {\n return;\n }\n\n this.zr.on('mousemove', this._mouseMoveHandler);\n this.zr.on('mouseup', this._mouseUpHandler);\n\n var pos = this._convertPos(x, y);\n\n this._x = pos.x;\n this._y = pos.y;\n },\n\n // Convert pos from screen space to viewspace.\n _convertPos: function (x, y) {\n\n var camera = this.viewGL.camera;\n var viewport = this.viewGL.viewport;\n // PENDING\n return {\n x: (x - viewport.x) / viewport.width * (camera.right - camera.left) + camera.left,\n y: (y - viewport.y) / viewport.height * (camera.bottom - camera.top) + camera.top\n };\n },\n\n _mouseMoveHandler: function (e) {\n\n var pos = this._convertPos(e.offsetX, e.offsetY);\n\n this._dx += pos.x - this._x;\n this._dy += pos.y - this._y;\n\n this._x = pos.x;\n this._y = pos.y;\n\n this._needsUpdate = true;\n },\n\n _mouseUpHandler: function (e) {\n this.zr.off('mousemove', this._mouseMoveHandler);\n this.zr.off('mouseup', this._mouseUpHandler);\n },\n\n _mouseWheelHandler: function (e) {\n e = e.event;\n var delta = e.wheelDelta // Webkit\n || -e.detail; // Firefox\n if (delta === 0) {\n return;\n }\n\n var x = e.offsetX;\n var y = e.offsetY;\n if (this.viewGL && !this.viewGL.containPoint(x, y)) {\n return;\n }\n\n var zoomScale = delta > 0 ? 1.1 : 0.9;\n var newZoom = Math.max(Math.min(\n this._zoom * zoomScale, this.maxZoom\n ), this.minZoom);\n zoomScale = newZoom / this._zoom;\n\n var pos = this._convertPos(x, y);\n\n var fixX = (pos.x - this._dx) * (zoomScale - 1);\n var fixY = (pos.y - this._dy) * (zoomScale - 1);\n\n this._dx -= fixX;\n this._dy -= fixY;\n\n this._zoom = newZoom;\n\n this._needsUpdate = true;\n },\n\n dispose: function () {\n\n var zr = this.zr;\n zr.off('mousedown', this._mouseDownHandler);\n zr.off('mousemove', this._mouseMoveHandler);\n zr.off('mouseup', this._mouseUpHandler);\n zr.off('mousewheel', this._mouseWheelHandler);\n zr.off('globalout', this._mouseUpHandler);\n\n zr.animation.off('frame', this._update);\n }\n});\n\nexport default Roam2DControl;","export default \"@export ecgl.lines2D.vertex\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nattribute vec2 position: POSITION;\\nattribute vec4 a_Color : COLOR;\\nvarying vec4 v_Color;\\n\\n#ifdef POSITIONTEXTURE_ENABLED\\nuniform sampler2D positionTexture;\\n#endif\\n\\nvoid main()\\n{\\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\\n\\n v_Color = a_Color;\\n}\\n\\n@end\\n\\n@export ecgl.lines2D.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nvarying vec4 v_Color;\\n\\nvoid main()\\n{\\n gl_FragColor = color * v_Color;\\n}\\n@end\\n\\n\\n@export ecgl.meshLines2D.vertex\\n\\nattribute vec2 position: POSITION;\\nattribute vec2 normal;\\nattribute float offset;\\nattribute vec4 a_Color : COLOR;\\n\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\nuniform vec4 viewport : VIEWPORT;\\n\\nvarying vec4 v_Color;\\nvarying float v_Miter;\\n\\nvoid main()\\n{\\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\\n\\n p2.xy /= p2.w;\\n gl_Position.xy /= gl_Position.w;\\n\\n vec2 N = normalize(p2.xy - gl_Position.xy);\\n gl_Position.xy += N * offset / viewport.zw * 2.0;\\n\\n gl_Position.xy *= gl_Position.w;\\n\\n v_Color = a_Color;\\n}\\n@end\\n\\n\\n@export ecgl.meshLines2D.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\n\\nvarying vec4 v_Color;\\nvarying float v_Miter;\\n\\nvoid main()\\n{\\n gl_FragColor = color * v_Color;\\n}\\n\\n@end\";\n","import * as echarts from 'echarts/lib/echarts';\nimport {getLayoutRect} from 'echarts/lib/util/layout';\nimport graphicGL from '../../util/graphicGL';\nimport ViewGL from '../../core/ViewGL';\nimport Lines2DGeometry from '../../util/geometry/Lines2D';\nimport retrieve from '../../util/retrieve';\nimport ForceAtlas2GPU from './ForceAtlas2GPU';\nimport ForceAtlas2 from './ForceAtlas2';\nimport requestAnimationFrame from 'zrender/lib/animation/requestAnimationFrame';\nimport glmatrix from 'claygl/src/dep/glmatrix';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nvar vec2 = glmatrix.vec2;\n\nimport Roam2DControl from '../../util/Roam2DControl';\n\nimport PointsBuilder from '../common/PointsBuilder';\n\nimport lines2DGLSL from '../../util/shader/lines2D.glsl.js';\ngraphicGL.Shader.import(lines2DGLSL);\n\nvar globalLayoutId = 1;\n\nexport default echarts.ChartView.extend({\n\n type: 'graphGL',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n\n this.groupGL = new graphicGL.Node();\n this.viewGL = new ViewGL('orthographic');\n this.viewGL.camera.left = this.viewGL.camera.right = 0;\n\n this.viewGL.add(this.groupGL);\n\n this._pointsBuilder = new PointsBuilder(true, api);\n\n // Mesh used during force directed layout.\n this._forceEdgesMesh = new graphicGL.Mesh({\n material: new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.forceAtlas2.edges'),\n transparent: true,\n depthMask: false,\n depthTest: false\n }),\n $ignorePicking: true,\n geometry: new graphicGL.Geometry({\n attributes: {\n node: new graphicGL.Geometry.Attribute('node', 'float', 2),\n color: new graphicGL.Geometry.Attribute('color', 'float', 4, 'COLOR')\n },\n dynamic: true,\n mainAttribute: 'node'\n }),\n renderOrder: -1,\n mode: graphicGL.Mesh.LINES\n });\n\n // Mesh used after force directed layout.\n this._edgesMesh = new graphicGL.Mesh({\n material: new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.meshLines2D'),\n transparent: true,\n depthMask: false,\n depthTest: false\n }),\n $ignorePicking: true,\n geometry: new Lines2DGeometry({\n useNativeLine: false,\n dynamic: true\n }),\n renderOrder: -1,\n culling: false\n });\n\n this._layoutId = 0;\n\n this._control = new Roam2DControl({\n zr: api.getZr(),\n viewGL: this.viewGL\n });\n this._control.setTarget(this.groupGL);\n this._control.init();\n\n\n this._clickHandler = this._clickHandler.bind(this);\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.add(this._pointsBuilder.rootNode);\n\n this._model = seriesModel;\n this._api = api;\n\n this._initLayout(seriesModel, ecModel, api);\n\n this._pointsBuilder.update(seriesModel, ecModel, api);\n\n if (!(this._forceLayoutInstance instanceof ForceAtlas2GPU)) {\n this.groupGL.remove(this._forceEdgesMesh);\n }\n\n this._updateCamera(seriesModel, api);\n\n this._control.off('update');\n this._control.on('update', function () {\n api.dispatchAction({\n type: 'graphGLRoam',\n seriesId: seriesModel.id,\n zoom: this._control.getZoom(),\n offset: this._control.getOffset()\n });\n\n this._pointsBuilder.updateView(this.viewGL.camera);\n }, this);\n\n this._control.setZoom(retrieve.firstNotNull(seriesModel.get('zoom'), 1));\n this._control.setOffset(seriesModel.get('offset') || [0, 0]);\n\n var mesh = this._pointsBuilder.getPointsMesh();\n mesh.off('mousemove', this._mousemoveHandler);\n mesh.off('mouseout', this._mouseOutHandler, this);\n api.getZr().off('click', this._clickHandler);\n\n this._pointsBuilder.highlightOnMouseover = true;\n if (seriesModel.get('focusNodeAdjacency')) {\n var focusNodeAdjacencyOn = seriesModel.get('focusNodeAdjacencyOn');\n if (focusNodeAdjacencyOn === 'click') {\n // Remove default emphasis effect\n api.getZr().on('click', this._clickHandler);\n }\n else if (focusNodeAdjacencyOn === 'mouseover') {\n mesh.on('mousemove', this._mousemoveHandler, this);\n mesh.on('mouseout', this._mouseOutHandler, this);\n\n this._pointsBuilder.highlightOnMouseover = false;\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Unkown focusNodeAdjacencyOn value \\s' + focusNodeAdjacencyOn);\n }\n }\n }\n\n // Reset\n this._lastMouseOverDataIndex = -1;\n },\n\n _clickHandler: function (e) {\n if (this._layouting) {\n return;\n }\n var dataIndex = this._pointsBuilder.getPointsMesh().dataIndex;\n if (dataIndex >= 0) {\n this._api.dispatchAction({\n type: 'graphGLFocusNodeAdjacency',\n seriesId: this._model.id,\n dataIndex: dataIndex\n });\n }\n else {\n this._api.dispatchAction({\n type: 'graphGLUnfocusNodeAdjacency',\n seriesId: this._model.id\n });\n }\n },\n\n _mousemoveHandler: function (e) {\n if (this._layouting) {\n return;\n }\n var dataIndex = this._pointsBuilder.getPointsMesh().dataIndex;\n if (dataIndex >= 0) {\n if (dataIndex !== this._lastMouseOverDataIndex) {\n this._api.dispatchAction({\n type: 'graphGLFocusNodeAdjacency',\n seriesId: this._model.id,\n dataIndex: dataIndex\n });\n }\n }\n else {\n this._mouseOutHandler(e);\n }\n\n this._lastMouseOverDataIndex = dataIndex;\n },\n\n _mouseOutHandler: function (e) {\n if (this._layouting) {\n return;\n }\n\n this._api.dispatchAction({\n type: 'graphGLUnfocusNodeAdjacency',\n seriesId: this._model.id\n });\n\n this._lastMouseOverDataIndex = -1;\n },\n\n _updateForceEdgesGeometry: function (edges, seriesModel) {\n var geometry = this._forceEdgesMesh.geometry;\n\n var edgeData = seriesModel.getEdgeData();\n var offset = 0;\n var layoutInstance = this._forceLayoutInstance;\n var vertexCount = edgeData.count() * 2;\n geometry.attributes.node.init(vertexCount);\n geometry.attributes.color.init(vertexCount);\n edgeData.each(function (idx) {\n var edge = edges[idx];\n geometry.attributes.node.set(offset, layoutInstance.getNodeUV(edge.node1));\n geometry.attributes.node.set(offset + 1, layoutInstance.getNodeUV(edge.node2));\n\n var color = getItemVisualColor(edgeData, edge.dataIndex);\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= retrieve.firstNotNull(\n getItemVisualOpacity(edgeData, edge.dataIndex), 1\n );\n geometry.attributes.color.set(offset, colorArr);\n geometry.attributes.color.set(offset + 1, colorArr);\n\n offset += 2;\n });\n geometry.dirty();\n },\n\n _updateMeshLinesGeometry: function () {\n var edgeData = this._model.getEdgeData();\n var geometry = this._edgesMesh.geometry;\n var edgeData = this._model.getEdgeData();\n var points = this._model.getData().getLayout('points');\n\n geometry.resetOffset();\n geometry.setVertexCount(edgeData.count() * geometry.getLineVertexCount());\n geometry.setTriangleCount(edgeData.count() * geometry.getLineTriangleCount());\n\n var p0 = [];\n var p1 = [];\n\n var lineWidthQuery = ['lineStyle', 'width'];\n\n this._originalEdgeColors = new Float32Array(edgeData.count() * 4);\n this._edgeIndicesMap = new Float32Array(edgeData.count());\n edgeData.each(function (idx) {\n var edge = edgeData.graph.getEdgeByIndex(idx);\n var idx1 = edge.node1.dataIndex * 2;\n var idx2 = edge.node2.dataIndex * 2;\n p0[0] = points[idx1];\n p0[1] = points[idx1 + 1];\n p1[0] = points[idx2];\n p1[1] = points[idx2 + 1];\n\n var color = getItemVisualColor(edgeData, edge.dataIndex);\n var colorArr = graphicGL.parseColor(color);\n colorArr[3] *= retrieve.firstNotNull(getItemVisualOpacity(edgeData, edge.dataIndex), 1);\n var itemModel = edgeData.getItemModel(edge.dataIndex);\n var lineWidth = retrieve.firstNotNull(itemModel.get(lineWidthQuery), 1) * this._api.getDevicePixelRatio();\n\n geometry.addLine(p0, p1, colorArr, lineWidth);\n\n for (var k = 0; k < 4; k++) {\n this._originalEdgeColors[edge.dataIndex * 4 + k] = colorArr[k];\n }\n this._edgeIndicesMap[edge.dataIndex] = idx;\n }, this);\n\n geometry.dirty();\n },\n\n _updateForceNodesGeometry: function (nodeData) {\n var pointsMesh = this._pointsBuilder.getPointsMesh();\n var pos = [];\n for (var i = 0; i < nodeData.count(); i++) {\n this._forceLayoutInstance.getNodeUV(i, pos);\n pointsMesh.geometry.attributes.position.set(i, pos);\n }\n pointsMesh.geometry.dirty('position');\n },\n\n _initLayout: function (seriesModel, ecModel, api) {\n var layout = seriesModel.get('layout');\n var graph = seriesModel.getGraph();\n\n var boxLayoutOption = seriesModel.getBoxLayoutParams();\n var viewport = getLayoutRect(boxLayoutOption, {\n width: api.getWidth(),\n height: api.getHeight()\n });\n\n if (layout === 'force') {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('Currently only forceAtlas2 layout supported.');\n }\n layout = 'forceAtlas2';\n }\n // Stop previous layout\n this.stopLayout(seriesModel, ecModel, api, {\n beforeLayout: true\n });\n\n var nodeData = seriesModel.getData();\n var edgeData = seriesModel.getData();\n if (layout === 'forceAtlas2') {\n var layoutModel = seriesModel.getModel('forceAtlas2');\n var layoutInstance = this._forceLayoutInstance;\n var nodes = [];\n var edges = [];\n\n var nodeDataExtent = nodeData.getDataExtent('value');\n var edgeDataExtent = edgeData.getDataExtent('value');\n\n var edgeWeightRange = retrieve.firstNotNull(layoutModel.get('edgeWeight'), 1.0);\n var nodeWeightRange = retrieve.firstNotNull(layoutModel.get('nodeWeight'), 1.0);\n if (typeof edgeWeightRange === 'number') {\n edgeWeightRange = [edgeWeightRange, edgeWeightRange];\n }\n if (typeof nodeWeightRange === 'number') {\n nodeWeightRange = [nodeWeightRange, nodeWeightRange];\n }\n\n var offset = 0;\n var nodesIndicesMap = {};\n\n var layoutPoints = new Float32Array(nodeData.count() * 2);\n graph.eachNode(function (node) {\n var dataIndex = node.dataIndex;\n var value = nodeData.get('value', dataIndex);\n var x;\n var y;\n if (nodeData.hasItemOption) {\n var itemModel = nodeData.getItemModel(dataIndex);\n x = itemModel.get('x');\n y = itemModel.get('y');\n }\n if (x == null) {\n // Random in rectangle\n x = viewport.x + Math.random() * viewport.width;\n y = viewport.y + Math.random() * viewport.height;\n }\n layoutPoints[offset * 2] = x;\n layoutPoints[offset * 2 + 1] = y;\n\n nodesIndicesMap[node.id] = offset++;\n var mass = echarts.number.linearMap(value, nodeDataExtent, nodeWeightRange);\n if (isNaN(mass)) {\n if (!isNaN(nodeWeightRange[0])) {\n mass = nodeWeightRange[0];\n }\n else {\n mass = 1;\n }\n }\n nodes.push({\n x: x, y: y, mass: mass, size: nodeData.getItemVisual(dataIndex, 'symbolSize')\n });\n });\n nodeData.setLayout('points', layoutPoints);\n\n graph.eachEdge(function (edge) {\n var dataIndex = edge.dataIndex;\n var value = nodeData.get('value', dataIndex);\n var weight = echarts.number.linearMap(value, edgeDataExtent, edgeWeightRange);\n if (isNaN(weight)) {\n if (!isNaN(edgeWeightRange[0])) {\n weight = edgeWeightRange[0];\n }\n else {\n weight = 1;\n }\n }\n edges.push({\n node1: nodesIndicesMap[edge.node1.id],\n node2: nodesIndicesMap[edge.node2.id],\n weight: weight,\n dataIndex: dataIndex\n });\n });\n if (!layoutInstance) {\n var isGPU = layoutModel.get('GPU');\n if (this._forceLayoutInstance) {\n if ((isGPU && !(this._forceLayoutInstance instanceof ForceAtlas2GPU))\n || (!isGPU && !(this._forceLayoutInstance instanceof ForceAtlas2))\n ) {\n // Mark to dispose\n this._forceLayoutInstanceToDispose = this._forceLayoutInstance;\n }\n }\n layoutInstance = this._forceLayoutInstance = isGPU\n ? new ForceAtlas2GPU()\n : new ForceAtlas2();\n }\n layoutInstance.initData(nodes, edges);\n layoutInstance.updateOption(layoutModel.option);\n\n // Update lines geometry after first layout;\n this._updateForceEdgesGeometry(layoutInstance.getEdges(), seriesModel);\n this._updatePositionTexture();\n\n api.dispatchAction({\n type: 'graphGLStartLayout',\n from: this.uid\n });\n }\n else {\n var layoutPoints = new Float32Array(nodeData.count() * 2);\n var offset = 0;\n graph.eachNode(function (node) {\n var dataIndex = node.dataIndex;\n var x;\n var y;\n if (nodeData.hasItemOption) {\n var itemModel = nodeData.getItemModel(dataIndex);\n x = itemModel.get('x');\n y = itemModel.get('y');\n }\n layoutPoints[offset++] = x;\n layoutPoints[offset++] = y;\n });\n nodeData.setLayout('points', layoutPoints);\n\n this._updateAfterLayout(seriesModel, ecModel, api);\n }\n },\n\n _updatePositionTexture: function () {\n var positionTex = this._forceLayoutInstance.getNodePositionTexture();\n this._pointsBuilder.setPositionTexture(positionTex);\n this._forceEdgesMesh.material.set('positionTex', positionTex);\n },\n\n startLayout: function (seriesModel, ecModel, api, payload) {\n if (payload && payload.from != null && payload.from !== this.uid) {\n return;\n }\n\n var viewGL = this.viewGL;\n var api = this._api;\n var layoutInstance = this._forceLayoutInstance;\n var data = this._model.getData();\n var layoutModel = this._model.getModel('forceAtlas2');\n\n if (!layoutInstance) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('None layout don\\'t have startLayout action');\n }\n return;\n }\n\n this.groupGL.remove(this._edgesMesh);\n this.groupGL.add(this._forceEdgesMesh);\n\n if (!this._forceLayoutInstance) {\n return;\n }\n\n this._updateForceNodesGeometry(seriesModel.getData());\n this._pointsBuilder.hideLabels();\n\n var self = this;\n var layoutId = this._layoutId = globalLayoutId++;\n var maxSteps = layoutModel.getShallow('maxSteps');\n var steps = layoutModel.getShallow('steps');\n var stepsCount = 0;\n var syncStepCount = Math.max(steps * 2, 20);\n var doLayout = function (layoutId) {\n if (layoutId !== self._layoutId) {\n return;\n }\n if (layoutInstance.isFinished(maxSteps)) {\n api.dispatchAction({\n type: 'graphGLStopLayout',\n from: self.uid\n });\n api.dispatchAction({\n type: 'graphGLFinishLayout',\n points: data.getLayout('points'),\n from: self.uid\n });\n return;\n }\n\n layoutInstance.update(viewGL.layer.renderer, steps, function () {\n self._updatePositionTexture();\n // PENDING Performance.\n stepsCount += steps;\n // Sync posiiton every 20 steps.\n if (stepsCount >= syncStepCount) {\n self._syncNodePosition(seriesModel);\n stepsCount = 0;\n }\n // Position texture will been swapped. set every time.\n api.getZr().refresh();\n\n requestAnimationFrame(function () {\n doLayout(layoutId);\n });\n });\n };\n\n requestAnimationFrame(function () {\n if (self._forceLayoutInstanceToDispose) {\n self._forceLayoutInstanceToDispose.dispose(viewGL.layer.renderer);\n self._forceLayoutInstanceToDispose = null;\n }\n doLayout(layoutId);\n });\n\n this._layouting = true;\n },\n\n stopLayout: function (seriesModel, ecModel, api, payload) {\n if (payload && payload.from != null && payload.from !== this.uid) {\n return;\n }\n\n this._layoutId = 0;\n this.groupGL.remove(this._forceEdgesMesh);\n this.groupGL.add(this._edgesMesh);\n\n if (!this._forceLayoutInstance) {\n return;\n }\n\n if (!this.viewGL.layer) {\n return;\n }\n\n if (!(payload && payload.beforeLayout)) {\n this._syncNodePosition(seriesModel);\n this._updateAfterLayout(seriesModel, ecModel, api);\n }\n\n this._api.getZr().refresh();\n\n this._layouting = false;\n },\n\n _syncNodePosition: function (seriesModel) {\n var points = this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);\n seriesModel.getData().setLayout('points', points);\n\n seriesModel.setNodePosition(points);\n },\n\n _updateAfterLayout: function (seriesModel, ecModel, api) {\n this._updateMeshLinesGeometry();\n\n this._pointsBuilder.removePositionTexture();\n\n this._pointsBuilder.updateLayout(seriesModel, ecModel, api);\n\n this._pointsBuilder.updateView(this.viewGL.camera);\n\n this._pointsBuilder.updateLabels();\n\n this._pointsBuilder.showLabels();\n\n },\n\n focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {\n\n var data = this._model.getData();\n\n this._downplayAll();\n\n var dataIndex = payload.dataIndex;\n\n var graph = data.graph;\n\n var focusNodes = [];\n var node = graph.getNodeByIndex(dataIndex);\n focusNodes.push(node);\n node.edges.forEach(function (edge) {\n if (edge.dataIndex < 0) {\n return;\n }\n edge.node1 !== node && focusNodes.push(edge.node1);\n edge.node2 !== node && focusNodes.push(edge.node2);\n }, this);\n\n this._pointsBuilder.fadeOutAll(0.05);\n this._fadeOutEdgesAll(0.05);\n\n focusNodes.forEach(function (node) {\n this._pointsBuilder.highlight(data, node.dataIndex);\n }, this);\n\n this._pointsBuilder.updateLabels(focusNodes.map(function (node) {\n return node.dataIndex;\n }));\n\n var focusEdges = [];\n node.edges.forEach(function (edge) {\n if (edge.dataIndex >= 0) {\n this._highlightEdge(edge.dataIndex);\n focusEdges.push(edge);\n }\n }, this);\n\n this._focusNodes = focusNodes;\n this._focusEdges = focusEdges;\n },\n\n unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {\n\n this._downplayAll();\n\n this._pointsBuilder.fadeInAll();\n this._fadeInEdgesAll();\n\n this._pointsBuilder.updateLabels();\n },\n\n _highlightEdge: function (dataIndex) {\n var itemModel = this._model.getEdgeData().getItemModel(dataIndex);\n var emphasisColor = graphicGL.parseColor(itemModel.get('emphasis.lineStyle.color') || itemModel.get('lineStyle.color'));\n var emphasisOpacity = retrieve.firstNotNull(itemModel.get('emphasis.lineStyle.opacity'), itemModel.get('lineStyle.opacity'), 1);\n emphasisColor[3] *= emphasisOpacity;\n\n this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[dataIndex], emphasisColor);\n },\n\n _downplayAll: function () {\n if (this._focusNodes) {\n this._focusNodes.forEach(function (node) {\n this._pointsBuilder.downplay(this._model.getData(), node.dataIndex);\n }, this);\n }\n if (this._focusEdges) {\n this._focusEdges.forEach(function (edge) {\n this._downplayEdge(edge.dataIndex);\n }, this);\n }\n },\n\n _downplayEdge: function (dataIndex) {\n var color = this._getColor(dataIndex, []);\n this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[dataIndex], color);\n },\n\n _setEdgeFade: (function () {\n var color = [];\n return function (dataIndex, percent) {\n this._getColor(dataIndex, color);\n color[3] *= percent;\n this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[dataIndex], color);\n };\n })(),\n\n _getColor: function (dataIndex, out) {\n for (var i = 0; i < 4; i++) {\n out[i] = this._originalEdgeColors[dataIndex * 4 + i];\n }\n return out;\n },\n\n _fadeOutEdgesAll: function (percent) {\n var graph = this._model.getData().graph;\n\n graph.eachEdge(function (edge) {\n this._setEdgeFade(edge.dataIndex, percent);\n }, this);\n },\n\n _fadeInEdgesAll: function () {\n this._fadeOutEdgesAll(1);\n },\n\n _updateCamera: function (seriesModel, api) {\n this.viewGL.setViewport(0, 0, api.getWidth(), api.getHeight(), api.getDevicePixelRatio());\n var camera = this.viewGL.camera;\n var nodeData = seriesModel.getData();\n var points = nodeData.getLayout('points');\n var min = vec2.create(Infinity, Infinity);\n var max = vec2.create(-Infinity, -Infinity);\n var pt = [];\n for (var i = 0; i < points.length;) {\n pt[0] = points[i++];\n pt[1] = points[i++];\n vec2.min(min, min, pt);\n vec2.max(max, max, pt);\n }\n var cy = (max[1] + min[1]) / 2;\n var cx = (max[0] + min[0]) / 2;\n // Only fit the camera when graph is not in the center.\n // PENDING\n if (cx > camera.left && cx < camera.right\n && cy < camera.bottom && cy > camera.top\n ) {\n return;\n }\n\n // Scale a bit\n var width = Math.max(max[0] - min[0], 10);\n // Keep aspect\n var height = width / api.getWidth() * api.getHeight();\n width *= 1.4;\n height *= 1.4;\n min[0] -= width * 0.2;\n\n camera.left = min[0];\n camera.top = cy - height / 2;\n camera.bottom = cy + height / 2;\n camera.right = width + min[0];\n camera.near = 0;\n camera.far = 100;\n },\n\n dispose: function () {\n var renderer = this.viewGL.layer.renderer;\n if (this._forceLayoutInstance) {\n this._forceLayoutInstance.dispose(renderer);\n }\n this.groupGL.removeAll();\n\n // Stop layout.\n this._layoutId = -1;\n\n this._pointsBuilder.dispose();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n this._control.dispose();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport * as echarts from 'echarts/lib/echarts';\n\nimport GraphGLSeries from './GraphGLSeries';\nimport GraphGLView from './GraphGLView';\n\nfunction normalize(a) {\n if (!(a instanceof Array)) {\n a = [a, a];\n }\n return a;\n}\nexport function install(registers) {\n\n registers.registerChartView(GraphGLView);\n registers.registerSeriesModel(GraphGLSeries);\n\n registers.registerVisual(function (ecModel) {\n const paletteScope = {};\n ecModel.eachSeriesByType('graphGL', function (seriesModel) {\n var categoriesData = seriesModel.getCategoriesData();\n var data = seriesModel.getData();\n\n var categoryNameIdxMap = {};\n\n categoriesData.each(function (idx) {\n var name = categoriesData.getName(idx);\n // Add prefix to avoid conflict with Object.prototype.\n categoryNameIdxMap['ec-' + name] = idx;\n var itemModel = categoriesData.getItemModel(idx);\n\n var style = itemModel.getModel('itemStyle').getItemStyle();\n if (!style.fill) {\n // Get color from palette.\n style.fill = seriesModel.getColorFromPalette(name, paletteScope);\n }\n categoriesData.setItemVisual(idx, 'style', style);\n\n var symbolVisualList = ['symbol', 'symbolSize', 'symbolKeepAspect'];\n\n for (let i = 0; i < symbolVisualList.length; i++) {\n var symbolVisual = itemModel.getShallow(symbolVisualList[i], true);\n if (symbolVisual != null) {\n categoriesData.setItemVisual(idx, symbolVisualList[i], symbolVisual);\n }\n }\n });\n\n // Assign category color to visual\n if (categoriesData.count()) {\n data.each(function (idx) {\n var model = data.getItemModel(idx);\n let categoryIdx = model.getShallow('category');\n if (categoryIdx != null) {\n if (typeof categoryIdx === 'string') {\n categoryIdx = categoryNameIdxMap['ec-' + categoryIdx];\n }\n\n var categoryStyle = categoriesData.getItemVisual(categoryIdx, 'style');\n var style = data.ensureUniqueItemVisual(idx, 'style');\n echarts.util.extend(style, categoryStyle);\n\n var visualList = ['symbol', 'symbolSize', 'symbolKeepAspect'];\n\n for (let i = 0; i < visualList.length; i++) {\n data.setItemVisual(\n idx, visualList[i],\n categoriesData.getItemVisual(categoryIdx, visualList[i])\n );\n }\n }\n });\n }\n });\n });\n\n registers.registerVisual(function (ecModel) {\n\n ecModel.eachSeriesByType('graphGL', function (seriesModel) {\n var graph = seriesModel.getGraph();\n var edgeData = seriesModel.getEdgeData();\n var symbolType = normalize(seriesModel.get('edgeSymbol'));\n var symbolSize = normalize(seriesModel.get('edgeSymbolSize'));\n\n edgeData.setVisual('drawType', 'stroke');\n\n // var colorQuery = ['lineStyle', 'color'];\n // var opacityQuery = ['lineStyle', 'opacity'];\n\n edgeData.setVisual('fromSymbol', symbolType && symbolType[0]);\n edgeData.setVisual('toSymbol', symbolType && symbolType[1]);\n edgeData.setVisual('fromSymbolSize', symbolSize && symbolSize[0]);\n edgeData.setVisual('toSymbolSize', symbolSize && symbolSize[1]);\n\n edgeData.setVisual('style', seriesModel.getModel('lineStyle').getLineStyle());\n\n edgeData.each(function (idx) {\n var itemModel = edgeData.getItemModel(idx);\n var edge = graph.getEdgeByIndex(idx);\n var symbolType = normalize(itemModel.getShallow('symbol', true));\n var symbolSize = normalize(itemModel.getShallow('symbolSize', true));\n // Edge visual must after node visual\n var style = itemModel.getModel('lineStyle').getLineStyle();\n\n var existsStyle = edgeData.ensureUniqueItemVisual(idx, 'style');\n echarts.util.extend(existsStyle, style);\n\n switch (existsStyle.stroke) {\n case 'source': {\n var nodeStyle = edge.node1.getVisual('style');\n existsStyle.stroke = nodeStyle && nodeStyle.fill;\n break;\n }\n case 'target': {\n var nodeStyle = edge.node2.getVisual('style');\n existsStyle.stroke = nodeStyle && nodeStyle.fill;\n break;\n }\n }\n\n symbolType[0] && edge.setVisual('fromSymbol', symbolType[0]);\n symbolType[1] && edge.setVisual('toSymbol', symbolType[1]);\n symbolSize[0] && edge.setVisual('fromSymbolSize', symbolSize[0]);\n symbolSize[1] && edge.setVisual('toSymbolSize', symbolSize[1]);\n });\n });\n });\n\n registers.registerAction({\n type: 'graphGLRoam',\n event: 'graphglroam',\n update: 'series.graphGL:roam'\n }, function (payload, ecModel) {\n ecModel.eachComponent({\n mainType: 'series', query: payload\n }, function (componentModel) {\n componentModel.setView(payload);\n });\n });\n\n function noop() {}\n\n registers.registerAction({\n type: 'graphGLStartLayout',\n event: 'graphgllayoutstarted',\n update: 'series.graphGL:startLayout'\n }, noop);\n\n registers.registerAction({\n type: 'graphGLStopLayout',\n event: 'graphgllayoutstopped',\n update: 'series.graphGL:stopLayout'\n }, noop);\n\n registers.registerAction({\n type: 'graphGLFocusNodeAdjacency',\n event: 'graphGLFocusNodeAdjacency',\n update: 'series.graphGL:focusNodeAdjacency'\n }, noop);\n\n\n registers.registerAction({\n type: 'graphGLUnfocusNodeAdjacency',\n event: 'graphGLUnfocusNodeAdjacency',\n update: 'series.graphGL:unfocusNodeAdjacency'\n }, noop);\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './graphGL/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\n\nexport default echarts.SeriesModel.extend({\n\n type: 'series.flowGL',\n\n dependencies: ['geo', 'grid', 'bmap'],\n\n visualStyleAccessPath: 'itemStyle',\n\n getInitialData: function (option, ecModel) {\n var coordType = this.get('coordinateSystem');\n // TODO hotfix for the bug in echarts that get coord dimensions is undefined.\n var coordSysDimensions = coordType === 'geo' ? ['lng', 'lat']\n : (echarts.getCoordinateSystemDimensions(coordType) || ['x', 'y']);\n if (process.env.NODE_ENV !== 'production') {\n if (coordSysDimensions.length > 2) {\n throw new Error('flowGL can only be used on 2d coordinate systems.');\n }\n }\n coordSysDimensions.push('vx', 'vy');\n var dimensions = echarts.helper.createDimensions(this.getSource(), {\n coordDimensions: coordSysDimensions,\n encodeDefine: this.get('encode'),\n dimensionsDefine: this.get('dimensions')\n });\n var data = new echarts.List(dimensions, this);\n data.initData(this.getSource());\n return data;\n },\n\n defaultOption: {\n coordinateSystem: 'cartesian2d',\n zlevel: 10,\n\n supersampling: 1,\n // 128x128 particles\n particleType: 'point',\n\n particleDensity: 128,\n particleSize: 1,\n particleSpeed: 1,\n\n particleTrail: 2,\n\n colorTexture: null,\n\n gridWidth: 'auto',\n gridHeight: 'auto',\n\n itemStyle: {\n color: '#fff',\n opacity: 0.8\n }\n }\n});","/**\n * Lines geometry\n * Use screen space projected lines lineWidth > MAX_LINE_WIDTH\n * https://mattdesl.svbtle.com/drawing-lines-is-hard\n * @module echarts-gl/util/geometry/LinesGeometry\n * @author Yi Shen(http://github.com/pissang)\n */\n\nimport Geometry from 'claygl/src/Geometry';\nimport * as echarts from 'echarts/lib/echarts';\n\n/**\n * @constructor\n * @alias module:echarts-gl/chart/flowGL/Line2D\n * @extends clay.Geometry\n */\n\nvar LinesGeometry = Geometry.extend(function () {\n return {\n\n dynamic: true,\n\n attributes: {\n position: new Geometry.Attribute('position', 'float', 3, 'POSITION')\n }\n };\n},\n/** @lends module: echarts-gl/util/geometry/LinesGeometry.prototype */\n{\n\n /**\n * Reset offset\n */\n resetOffset: function () {\n this._vertexOffset = 0;\n this._faceOffset = 0;\n },\n\n /**\n * @param {number} nVertex\n */\n setLineCount: function (nLine) {\n var attributes = this.attributes;\n var nVertex = 4 * nLine;\n var nTriangle = 2 * nLine;\n if (this.vertexCount !== nVertex) {\n attributes.position.init(nVertex);\n }\n if (this.triangleCount !== nTriangle) {\n if (nTriangle === 0) {\n this.indices = null;\n }\n else {\n this.indices = this.vertexCount > 0xffff ? new Uint32Array(nTriangle * 3) : new Uint16Array(nTriangle * 3);\n }\n }\n },\n\n addLine: function (p) {\n var vertexOffset = this._vertexOffset;\n this.attributes.position.set(vertexOffset, [p[0], p[1], 1]);\n this.attributes.position.set(vertexOffset + 1, [p[0], p[1], -1]);\n this.attributes.position.set(vertexOffset + 2, [p[0], p[1], 2]);\n this.attributes.position.set(vertexOffset + 3, [p[0], p[1], -2]);\n\n this.setTriangleIndices(\n this._faceOffset++, [\n vertexOffset, vertexOffset + 1, vertexOffset + 2\n ]\n );\n this.setTriangleIndices(\n this._faceOffset++, [\n vertexOffset + 1, vertexOffset + 2, vertexOffset + 3\n ]\n );\n\n this._vertexOffset += 4;\n }\n});\n\nexport default LinesGeometry;","export default \"@export ecgl.vfParticle.particle.fragment\\n\\nuniform sampler2D particleTexture;\\nuniform sampler2D spawnTexture;\\nuniform sampler2D velocityTexture;\\n\\nuniform float deltaTime;\\nuniform float elapsedTime;\\n\\nuniform float speedScaling : 1.0;\\n\\nuniform vec2 textureSize;\\nuniform vec4 region : [0, 0, 1, 1];\\nuniform float firstFrameTime;\\n\\nvarying vec2 v_Texcoord;\\n\\n\\nvoid main()\\n{\\n vec4 p = texture2D(particleTexture, v_Texcoord);\\n bool spawn = false;\\n if (p.w <= 0.0) {\\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\\n p.w -= firstFrameTime;\\n spawn = true;\\n }\\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\\n v = (v - 0.5) * 2.0;\\n p.z = length(v);\\n p.xy += v * deltaTime / 10.0 * speedScaling;\\n p.w -= deltaTime;\\n\\n if (spawn || p.xy != fract(p.xy)) {\\n p.z = 0.0;\\n }\\n p.xy = fract(p.xy);\\n\\n gl_FragColor = p;\\n}\\n@end\\n\\n@export ecgl.vfParticle.renderPoints.vertex\\n\\n#define PI 3.1415926\\n\\nattribute vec2 texcoord : TEXCOORD_0;\\n\\nuniform sampler2D particleTexture;\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nuniform float size : 1.0;\\n\\nvarying float v_Mag;\\nvarying vec2 v_Uv;\\n\\nvoid main()\\n{\\n vec4 p = texture2D(particleTexture, texcoord);\\n\\n if (p.w > 0.0 && p.z > 1e-5) {\\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\\n }\\n else {\\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\\n }\\n\\n v_Mag = p.z;\\n v_Uv = p.xy;\\n\\n gl_PointSize = size;\\n}\\n\\n@end\\n\\n@export ecgl.vfParticle.renderPoints.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\nuniform sampler2D gradientTexture;\\nuniform sampler2D colorTexture;\\nuniform sampler2D spriteTexture;\\n\\nvarying float v_Mag;\\nvarying vec2 v_Uv;\\n\\nvoid main()\\n{\\n gl_FragColor = color;\\n#ifdef SPRITETEXTURE_ENABLED\\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\\n if (color.a == 0.0) {\\n discard;\\n }\\n#endif\\n#ifdef GRADIENTTEXTURE_ENABLED\\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\\n#endif\\n#ifdef COLORTEXTURE_ENABLED\\n gl_FragColor *= texture2D(colorTexture, v_Uv);\\n#endif\\n}\\n\\n@end\\n\\n@export ecgl.vfParticle.renderLines.vertex\\n\\n#define PI 3.1415926\\n\\nattribute vec3 position : POSITION;\\n\\nuniform sampler2D particleTexture;\\nuniform sampler2D prevParticleTexture;\\n\\nuniform float size : 1.0;\\nuniform vec4 vp: VIEWPORT;\\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\\n\\nvarying float v_Mag;\\nvarying vec2 v_Uv;\\n\\n@import clay.util.rand\\n\\nvoid main()\\n{\\n vec4 p = texture2D(particleTexture, position.xy);\\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\\n\\n p.xy = p.xy * 2.0 - 1.0;\\n p2.xy = p2.xy * 2.0 - 1.0;\\n\\n if (p.w > 0.0 && p.z > 1e-5) {\\n vec2 dir = normalize(p.xy - p2.xy);\\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\\n if (abs(position.z) == 2.0) {\\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\\n v_Uv = p.xy;\\n v_Mag = p.z;\\n }\\n else {\\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\\n v_Mag = p2.z;\\n v_Uv = p2.xy;\\n }\\n gl_Position = worldViewProjection * gl_Position;\\n }\\n else {\\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\\n }\\n}\\n\\n@end\\n\\n@export ecgl.vfParticle.renderLines.fragment\\n\\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\\nuniform sampler2D gradientTexture;\\nuniform sampler2D colorTexture;\\n\\nvarying float v_Mag;\\nvarying vec2 v_Uv;\\n\\nvoid main()\\n{\\n gl_FragColor = color;\\n #ifdef GRADIENTTEXTURE_ENABLED\\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\\n#endif\\n#ifdef COLORTEXTURE_ENABLED\\n gl_FragColor *= texture2D(colorTexture, v_Uv);\\n#endif\\n}\\n\\n@end\\n\";\n","import Pass from 'claygl/src/compositor/Pass';\nimport Geometry from 'claygl/src/Geometry';\nimport Mesh from 'claygl/src/Mesh';\nimport Material from 'claygl/src/Material';\nimport Shader from 'claygl/src/Shader';\nimport Texture2D from 'claygl/src/Texture2D';\nimport Texture from 'claygl/src/Texture';\nimport OrthoCamera from 'claygl/src/camera/Orthographic';\nimport PlaneGeometry from 'claygl/src/geometry/Plane';\n\nimport FrameBuffer from 'claygl/src/FrameBuffer';\nimport Line2DGeometry from './Line2D';\n// import TemporalSS from '../../effect/TemporalSuperSampling';\n\nimport vectorFieldParticleGLSL from './vectorFieldParticle.glsl.js';\n\nShader['import'](vectorFieldParticleGLSL);\n\nfunction createSpriteCanvas(size) {\n var canvas = document.createElement('canvas');\n canvas.width = canvas.height = size;\n var ctx = canvas.getContext('2d');\n ctx.fillStyle = '#fff';\n ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2);\n ctx.fill();\n return canvas;\n}\n\n// import spriteUtil from '../../util/sprite';\n\nvar VectorFieldParticleSurface = function () {\n\n /**\n * @type {number}\n */\n this.motionBlurFactor = 0.99;\n /**\n * Vector field lookup image\n * @type {clay.Texture2D}\n */\n this.vectorFieldTexture = new Texture2D({\n type: Texture.FLOAT,\n // minFilter: Texture.NEAREST,\n // magFilter: Texture.NEAREST,\n flipY: false\n });\n\n /**\n * Particle life range\n * @type {Array.}\n */\n this.particleLife = [5, 20];\n\n this._particleType = 'point';\n\n /**\n * @type {number}\n */\n this._particleSize = 1;\n\n /**\n * @type {Array.}\n */\n this.particleColor = [1, 1, 1, 1];\n\n /**\n * @type {number}\n */\n this.particleSpeedScaling = 1.0;\n\n /**\n * @type {clay.Texture2D}\n */\n this._thisFrameTexture = null;\n\n this._particlePass = null;\n this._spawnTexture = null;\n this._particleTexture0 = null;\n this._particleTexture1 = null;\n\n this._particlePointsMesh = null;\n\n this._surfaceFrameBuffer = null;\n\n this._elapsedTime = 0.0;\n\n this._scene = null;\n this._camera = null;\n\n this._lastFrameTexture = null;\n\n // this._temporalSS = new TemporalSS(50);\n\n // this._antialising = false;\n\n this._supersampling = 1;\n\n this._downsampleTextures = [];\n\n this._width = 512;\n this._height = 512;\n\n this.init();\n};\n\nVectorFieldParticleSurface.prototype = {\n\n constructor: VectorFieldParticleSurface,\n\n init: function () {\n var parameters = {\n type: Texture.FLOAT,\n minFilter: Texture.NEAREST,\n magFilter: Texture.NEAREST,\n useMipmap: false\n };\n this._spawnTexture = new Texture2D(parameters);\n\n this._particleTexture0 = new Texture2D(parameters);\n this._particleTexture1 = new Texture2D(parameters);\n\n this._frameBuffer = new FrameBuffer({\n depthBuffer: false\n });\n this._particlePass = new Pass({\n fragment: Shader.source('ecgl.vfParticle.particle.fragment')\n });\n this._particlePass.setUniform('velocityTexture', this.vectorFieldTexture);\n this._particlePass.setUniform('spawnTexture', this._spawnTexture);\n\n this._downsamplePass = new Pass({\n fragment: Shader.source('clay.compositor.downsample')\n });\n\n var particlePointsMesh = new Mesh({\n // Render after last frame full quad\n renderOrder: 10,\n material: new Material({\n shader: new Shader(\n Shader.source('ecgl.vfParticle.renderPoints.vertex'),\n Shader.source('ecgl.vfParticle.renderPoints.fragment')\n )\n }),\n mode: Mesh.POINTS,\n geometry: new Geometry({\n dynamic: true,\n mainAttribute: 'texcoord0'\n })\n });\n var particleLinesMesh = new Mesh({\n // Render after last frame full quad\n renderOrder: 10,\n material: new Material({\n shader: new Shader(\n Shader.source('ecgl.vfParticle.renderLines.vertex'),\n Shader.source('ecgl.vfParticle.renderLines.fragment')\n )\n }),\n geometry: new Line2DGeometry(),\n culling: false\n });\n var lastFrameFullQuad = new Mesh({\n material: new Material({\n shader: new Shader(\n Shader.source('ecgl.color.vertex'),\n Shader.source('ecgl.color.fragment')\n )\n // DO NOT BLEND Blend will multiply alpha\n // transparent: true\n }),\n geometry: new PlaneGeometry()\n });\n lastFrameFullQuad.material.enableTexture('diffuseMap');\n\n this._particlePointsMesh = particlePointsMesh;\n this._particleLinesMesh = particleLinesMesh;\n this._lastFrameFullQuadMesh = lastFrameFullQuad;\n\n this._camera = new OrthoCamera();\n this._thisFrameTexture = new Texture2D();\n this._lastFrameTexture = new Texture2D();\n },\n\n setParticleDensity: function (width, height) {\n var nVertex = width * height;\n\n var spawnTextureData = new Float32Array(nVertex * 4);\n var off = 0;\n var lifeRange = this.particleLife;\n for (var i = 0; i < width; i++) {\n for (var j = 0; j < height; j++, off++) {\n // x position, range [0 - 1]\n spawnTextureData[off * 4] = Math.random();\n // y position, range [0 - 1]\n spawnTextureData[off * 4 + 1] = Math.random();\n // Some property\n spawnTextureData[off * 4 + 2] = Math.random();\n var life = (lifeRange[1] - lifeRange[0]) * Math.random() + lifeRange[0];\n // Particle life\n spawnTextureData[off * 4 + 3] = life;\n }\n }\n\n if (this._particleType === 'line') {\n this._setLineGeometry(width, height);\n }\n else {\n this._setPointsGeometry(width, height);\n }\n\n this._spawnTexture.width = width;\n this._spawnTexture.height = height;\n this._spawnTexture.pixels = spawnTextureData;\n\n this._particleTexture0.width = this._particleTexture1.width = width;\n this._particleTexture0.height = this._particleTexture1.height = height;\n\n this._particlePass.setUniform('textureSize', [width, height]);\n },\n\n _setPointsGeometry: function (width, height) {\n var nVertex = width * height;\n var geometry = this._particlePointsMesh.geometry;\n var attributes = geometry.attributes;\n attributes.texcoord0.init(nVertex);\n\n var off = 0;\n for (var i = 0; i < width; i++) {\n for (var j = 0; j < height; j++, off++) {\n attributes.texcoord0.value[off * 2] = i / width;\n attributes.texcoord0.value[off * 2 + 1] = j / height;\n }\n }\n geometry.dirty();\n },\n\n _setLineGeometry: function (width, height) {\n var nLine = width * height;\n var geometry = this._getParticleMesh().geometry;\n geometry.setLineCount(nLine);\n geometry.resetOffset();\n for (var i = 0; i < width; i++) {\n for (var j = 0; j < height; j++) {\n geometry.addLine([i / width, j / height]);\n }\n }\n geometry.dirty();\n },\n\n _getParticleMesh: function () {\n return this._particleType === 'line' ? this._particleLinesMesh : this._particlePointsMesh;\n },\n\n update: function (renderer, api, deltaTime, firstFrame) {\n var particleMesh = this._getParticleMesh();\n var frameBuffer = this._frameBuffer;\n var particlePass = this._particlePass;\n\n if (firstFrame) {\n this._updateDownsampleTextures(renderer, api);\n }\n\n particleMesh.material.set('size', this._particleSize * this._supersampling);\n particleMesh.material.set('color', this.particleColor);\n particlePass.setUniform('speedScaling', this.particleSpeedScaling);\n\n frameBuffer.attach(this._particleTexture1);\n particlePass.setUniform('firstFrameTime', firstFrame ? (this.particleLife[1] + this.particleLife[0]) / 2 : 0);\n particlePass.setUniform('particleTexture', this._particleTexture0);\n particlePass.setUniform('deltaTime', deltaTime);\n particlePass.setUniform('elapsedTime', this._elapsedTime);\n particlePass.render(renderer, frameBuffer);\n\n particleMesh.material.set('particleTexture', this._particleTexture1);\n particleMesh.material.set('prevParticleTexture', this._particleTexture0);\n\n frameBuffer.attach(this._thisFrameTexture);\n frameBuffer.bind(renderer);\n renderer.gl.clear(renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT);\n var lastFrameFullQuad = this._lastFrameFullQuadMesh;\n lastFrameFullQuad.material.set('diffuseMap', this._lastFrameTexture);\n lastFrameFullQuad.material.set('color', [1, 1, 1, this.motionBlurFactor]);\n\n this._camera.update(true);\n renderer.renderPass([lastFrameFullQuad, particleMesh], this._camera);\n frameBuffer.unbind(renderer);\n\n this._downsample(renderer);\n\n this._swapTexture();\n\n this._elapsedTime += deltaTime;\n },\n\n _downsample: function (renderer) {\n var downsampleTextures = this._downsampleTextures;\n if (downsampleTextures.length === 0) {\n return;\n }\n var current = 0;\n var sourceTexture = this._thisFrameTexture;\n var targetTexture = downsampleTextures[current];\n\n while (targetTexture) {\n this._frameBuffer.attach(targetTexture);\n this._downsamplePass.setUniform('texture', sourceTexture);\n this._downsamplePass.setUniform('textureSize', [sourceTexture.width, sourceTexture.height]);\n this._downsamplePass.render(renderer, this._frameBuffer);\n\n sourceTexture = targetTexture;\n targetTexture = downsampleTextures[++current];\n }\n },\n\n getSurfaceTexture: function () {\n var downsampleTextures = this._downsampleTextures;\n return downsampleTextures.length > 0\n ? downsampleTextures[downsampleTextures.length - 1]\n : this._lastFrameTexture;\n },\n\n setRegion: function (region) {\n this._particlePass.setUniform('region', region);\n },\n\n resize: function (width, height) {\n this._lastFrameTexture.width = width * this._supersampling;\n this._lastFrameTexture.height = height * this._supersampling;\n this._thisFrameTexture.width = width * this._supersampling;\n this._thisFrameTexture.height = height * this._supersampling;\n\n this._width = width;\n this._height = height;\n },\n\n setParticleSize: function (size) {\n var particleMesh = this._getParticleMesh();\n if (size <= 2) {\n particleMesh.material.disableTexture('spriteTexture');\n particleMesh.material.transparent = false;\n return;\n }\n if (!this._spriteTexture) {\n this._spriteTexture = new Texture2D();\n }\n if (!this._spriteTexture.image || this._spriteTexture.image.width !== size) {\n this._spriteTexture.image = createSpriteCanvas(size);\n this._spriteTexture.dirty();\n }\n particleMesh.material.transparent = true;\n particleMesh.material.enableTexture('spriteTexture');\n particleMesh.material.set('spriteTexture', this._spriteTexture);\n\n this._particleSize = size;\n },\n\n setGradientTexture: function (gradientTexture) {\n var material = this._getParticleMesh().material;\n material[gradientTexture ? 'enableTexture' : 'disableTexture']('gradientTexture');\n material.setUniform('gradientTexture', gradientTexture);\n },\n\n setColorTextureImage: function (colorTextureImg, api) {\n var material = this._getParticleMesh().material;\n material.setTextureImage('colorTexture', colorTextureImg, api, {\n flipY: true\n });\n },\n\n setParticleType: function (type) {\n this._particleType = type;\n },\n\n clearFrame: function (renderer) {\n var frameBuffer = this._frameBuffer;\n frameBuffer.attach(this._lastFrameTexture);\n frameBuffer.bind(renderer);\n renderer.gl.clear(renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT);\n frameBuffer.unbind(renderer);\n },\n\n setSupersampling: function (supersampling) {\n this._supersampling = supersampling;\n this.resize(this._width, this._height);\n },\n\n _updateDownsampleTextures: function (renderer, api) {\n var downsampleTextures = this._downsampleTextures;\n var upScale = Math.max(Math.floor(Math.log(this._supersampling / api.getDevicePixelRatio()) / Math.log(2)), 0);\n var scale = 2;\n var width = this._width * this._supersampling;\n var height = this._height * this._supersampling;\n for (var i = 0; i < upScale; i++) {\n downsampleTextures[i] = downsampleTextures[i] || new Texture2D();\n downsampleTextures[i].width = width / scale;\n downsampleTextures[i].height = height / scale;\n scale *= 2;\n }\n for (;i < downsampleTextures.length; i++) {\n downsampleTextures[i].dispose(renderer);\n }\n downsampleTextures.length = upScale;\n },\n\n _swapTexture: function () {\n var tmp = this._particleTexture0;\n this._particleTexture0 = this._particleTexture1;\n this._particleTexture1 = tmp;\n\n var tmp = this._thisFrameTexture;\n this._thisFrameTexture = this._lastFrameTexture;\n this._lastFrameTexture = tmp;\n },\n\n dispose: function (renderer) {\n renderer.disposeFrameBuffer(this._frameBuffer);\n // Dispose textures\n renderer.disposeTexture(this.vectorFieldTexture);\n renderer.disposeTexture(this._spawnTexture);\n renderer.disposeTexture(this._particleTexture0);\n renderer.disposeTexture(this._particleTexture1);\n renderer.disposeTexture(this._thisFrameTexture);\n renderer.disposeTexture(this._lastFrameTexture);\n\n renderer.disposeGeometry(this._particleLinesMesh.geometry);\n renderer.disposeGeometry(this._particlePointsMesh.geometry);\n renderer.disposeGeometry(this._lastFrameFullQuadMesh.geometry);\n\n if (this._spriteTexture) {\n renderer.disposeTexture(this._spriteTexture);\n }\n\n this._particlePass.dispose(renderer);\n this._downsamplePass.dispose(renderer);\n\n this._downsampleTextures.forEach(function (texture) {\n texture.dispose(renderer);\n });\n }\n};\n\nexport default VectorFieldParticleSurface;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport retrieve from '../../util/retrieve';\nimport ViewGL from '../../core/ViewGL';\n\nimport VectorFieldParticleSurface from './VectorFieldParticleSurface';\n\n\n// TODO 百度地图不是 linear 的\nexport default echarts.ChartView.extend({\n\n type: 'flowGL',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this.viewGL = new ViewGL('orthographic');\n this.groupGL = new graphicGL.Node();\n this.viewGL.add(this.groupGL);\n\n this._particleSurface = new VectorFieldParticleSurface();\n\n var planeMesh = new graphicGL.Mesh({\n geometry: new graphicGL.PlaneGeometry(),\n material: new graphicGL.Material({\n shader: new graphicGL.Shader({\n vertex: graphicGL.Shader.source('ecgl.color.vertex'),\n fragment: graphicGL.Shader.source('ecgl.color.fragment')\n }),\n // Must enable blending and multiply alpha.\n // Or premultipliedAlpha will let the alpha useless.\n transparent: true\n })\n });\n planeMesh.material.enableTexture('diffuseMap');\n\n this.groupGL.add(planeMesh);\n\n this._planeMesh = planeMesh;\n\n },\n\n render: function (seriesModel, ecModel, api) {\n var particleSurface = this._particleSurface;\n // Set particleType before set others.\n particleSurface.setParticleType(seriesModel.get('particleType'));\n particleSurface.setSupersampling(seriesModel.get('supersampling'));\n\n this._updateData(seriesModel, api);\n this._updateCamera(api.getWidth(), api.getHeight(), api.getDevicePixelRatio());\n\n var particleDensity = retrieve.firstNotNull(seriesModel.get('particleDensity'), 128);\n particleSurface.setParticleDensity(particleDensity, particleDensity);\n\n var planeMesh = this._planeMesh;\n\n var time = +(new Date());\n var self = this;\n var firstFrame = true;\n planeMesh.__percent = 0;\n planeMesh.stopAnimation();\n planeMesh.animate('', { loop: true })\n .when(100000, {\n __percent: 1\n })\n .during(function () {\n var timeNow = + (new Date());\n var dTime = Math.min(timeNow - time, 20);\n time = time + dTime;\n if (self._renderer) {\n particleSurface.update(self._renderer, api, dTime / 1000, firstFrame);\n planeMesh.material.set('diffuseMap', particleSurface.getSurfaceTexture());\n // planeMesh.material.set('diffuseMap', self._particleSurface.vectorFieldTexture);\n }\n firstFrame = false;\n })\n .start();\n\n var itemStyleModel = seriesModel.getModel('itemStyle');\n var color = graphicGL.parseColor(itemStyleModel.get('color'));\n color[3] *= retrieve.firstNotNull(itemStyleModel.get('opacity'), 1);\n planeMesh.material.set('color', color);\n\n particleSurface.setColorTextureImage(seriesModel.get('colorTexture'), api);\n particleSurface.setParticleSize(seriesModel.get('particleSize'));\n particleSurface.particleSpeedScaling = seriesModel.get('particleSpeed');\n particleSurface.motionBlurFactor = 1.0 - Math.pow(0.1, seriesModel.get('particleTrail'));\n },\n\n updateTransform: function (seriesModel, ecModel, api) {\n this._updateData(seriesModel, api);\n },\n\n afterRender: function (globeModel, ecModel, api, layerGL) {\n var renderer = layerGL.renderer;\n this._renderer = renderer;\n },\n\n _updateData: function (seriesModel, api) {\n var coordSys = seriesModel.coordinateSystem;\n var dims = coordSys.dimensions.map(function (coordDim) {\n return seriesModel.coordDimToDataDim(coordDim)[0];\n });\n\n var data = seriesModel.getData();\n var xExtent = data.getDataExtent(dims[0]);\n var yExtent = data.getDataExtent(dims[1]);\n\n var gridWidth = seriesModel.get('gridWidth');\n var gridHeight = seriesModel.get('gridHeight');\n\n if (gridWidth == null || gridWidth === 'auto') {\n // TODO not accurate.\n var aspect = (xExtent[1] - xExtent[0]) / (yExtent[1] - yExtent[0]);\n gridWidth = Math.round(Math.sqrt(aspect * data.count()));\n }\n if (gridHeight == null || gridHeight === 'auto') {\n gridHeight = Math.ceil(data.count() / gridWidth);\n }\n\n var vectorFieldTexture = this._particleSurface.vectorFieldTexture;\n\n // Half Float needs Uint16Array\n var pixels = vectorFieldTexture.pixels;\n if (!pixels || pixels.length !== gridHeight * gridWidth * 4) {\n pixels = vectorFieldTexture.pixels = new Float32Array(gridWidth * gridHeight * 4);\n }\n else {\n for (var i = 0; i < pixels.length; i++) {\n pixels[i] = 0;\n }\n }\n\n var maxMag = 0;\n var minMag = Infinity;\n\n var points = new Float32Array(data.count() * 2);\n var offset = 0;\n var bbox = [[Infinity, Infinity], [-Infinity, -Infinity]];\n\n data.each([dims[0], dims[1], 'vx', 'vy'], function (x, y, vx, vy) {\n var pt = coordSys.dataToPoint([x, y]);\n points[offset++] = pt[0];\n points[offset++] = pt[1];\n bbox[0][0] = Math.min(pt[0], bbox[0][0]);\n bbox[0][1] = Math.min(pt[1], bbox[0][1]);\n bbox[1][0] = Math.max(pt[0], bbox[1][0]);\n bbox[1][1] = Math.max(pt[1], bbox[1][1]);\n\n var mag = Math.sqrt(vx * vx + vy * vy);\n maxMag = Math.max(maxMag, mag);\n minMag = Math.min(minMag, mag);\n });\n\n data.each(['vx', 'vy'], function (vx, vy, i) {\n var xPix = Math.round((points[i * 2] - bbox[0][0]) / (bbox[1][0] - bbox[0][0]) * (gridWidth - 1));\n var yPix = gridHeight - 1 - Math.round((points[i * 2 + 1] - bbox[0][1]) / (bbox[1][1] - bbox[0][1]) * (gridHeight - 1));\n\n var idx = (yPix * gridWidth + xPix) * 4;\n\n pixels[idx] = (vx / maxMag * 0.5 + 0.5);\n pixels[idx + 1] = (vy / maxMag * 0.5 + 0.5);\n pixels[idx + 3] = 1;\n });\n\n vectorFieldTexture.width = gridWidth;\n vectorFieldTexture.height = gridHeight;\n\n if (seriesModel.get('coordinateSystem') === 'bmap') {\n this._fillEmptyPixels(vectorFieldTexture);\n }\n\n vectorFieldTexture.dirty();\n\n this._updatePlanePosition(bbox[0], bbox[1], seriesModel,api);\n this._updateGradientTexture(data.getVisual('visualMeta'), [minMag, maxMag]);\n\n },\n // PENDING Use grid mesh ? or delaunay triangulation?\n _fillEmptyPixels: function (texture) {\n var pixels = texture.pixels;\n var width = texture.width;\n var height = texture.height;\n\n function fetchPixel(x, y, rg) {\n x = Math.max(Math.min(x, width - 1), 0);\n y = Math.max(Math.min(y, height - 1), 0);\n var idx = (y * (width - 1) + x) * 4;\n if (pixels[idx + 3] === 0) {\n return false;\n }\n rg[0] = pixels[idx];\n rg[1] = pixels[idx + 1];\n return true;\n }\n\n function addPixel(a, b, out) {\n out[0] = a[0] + b[0];\n out[1] = a[1] + b[1];\n }\n\n var center = [], left = [], right = [], top = [], bottom = [];\n var weight = 0;\n for (var y = 0; y < height; y++) {\n for (var x = 0; x < width; x++) {\n var idx = (y * (width - 1) + x) * 4;\n if (pixels[idx + 3] === 0) {\n weight = center[0] = center[1] = 0;\n if (fetchPixel(x - 1, y, left)) {\n weight++; addPixel(left, center, center);\n }\n if (fetchPixel(x + 1, y, right)) {\n weight++; addPixel(right, center, center);\n }\n if (fetchPixel(x, y - 1, top)) {\n weight++; addPixel(top, center, center);\n }\n if (fetchPixel(x, y + 1, bottom)) {\n weight++; addPixel(bottom, center, center);\n }\n center[0] /= weight;\n center[1] /= weight;\n // PENDING If overwrite. bilinear interpolation.\n pixels[idx] = center[0];\n pixels[idx + 1] = center[1];\n }\n pixels[idx + 3] = 1;\n }\n }\n },\n\n _updateGradientTexture: function (visualMeta, magExtent) {\n if (!visualMeta || !visualMeta.length) {\n this._particleSurface.setGradientTexture(null);\n return;\n }\n // TODO Different dimensions\n this._gradientTexture = this._gradientTexture || new graphicGL.Texture2D({\n image: document.createElement('canvas')\n });\n var gradientTexture = this._gradientTexture;\n var canvas = gradientTexture.image;\n canvas.width = 200;\n canvas.height = 1;\n var ctx = canvas.getContext('2d');\n var gradient = ctx.createLinearGradient(0, 0.5, canvas.width, 0.5);\n visualMeta[0].stops.forEach(function (stop) {\n var offset;\n if (magExtent[1] === magExtent[0]) {\n offset = 0;\n }\n else {\n offset = stop.value / magExtent[1];\n offset = Math.min(Math.max(offset, 0), 1);\n }\n\n gradient.addColorStop(offset, stop.color);\n });\n ctx.fillStyle = gradient;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n gradientTexture.dirty();\n\n this._particleSurface.setGradientTexture(this._gradientTexture);\n },\n\n _updatePlanePosition: function (leftTop, rightBottom, seriesModel, api) {\n var limitedResult = this._limitInViewportAndFullFill(leftTop, rightBottom, seriesModel, api);\n leftTop = limitedResult.leftTop;\n rightBottom = limitedResult.rightBottom;\n this._particleSurface.setRegion(limitedResult.region);\n\n this._planeMesh.position.set(\n (leftTop[0] + rightBottom[0]) / 2,\n api.getHeight() - (leftTop[1] + rightBottom[1]) / 2,\n 0\n );\n\n var width = rightBottom[0] - leftTop[0];\n var height = rightBottom[1] - leftTop[1];\n this._planeMesh.scale.set(width / 2, height / 2, 1);\n\n this._particleSurface.resize(\n Math.max(Math.min(width, 2048), 1),\n Math.max(Math.min(height, 2048), 1)\n );\n\n if (this._renderer) {\n this._particleSurface.clearFrame(this._renderer);\n }\n },\n\n _limitInViewportAndFullFill: function (leftTop, rightBottom, seriesModel, api) {\n var newLeftTop = [\n Math.max(leftTop[0], 0),\n Math.max(leftTop[1], 0)\n ];\n var newRightBottom = [\n Math.min(rightBottom[0], api.getWidth()),\n Math.min(rightBottom[1], api.getHeight())\n ];\n // Tiliing in lng orientation.\n if (seriesModel.get('coordinateSystem') === 'bmap') {\n var lngRange = seriesModel.getData().getDataExtent(seriesModel.coordDimToDataDim('lng')[0]);\n // PENDING, consider grid density\n var isContinuous = Math.floor(lngRange[1] - lngRange[0]) >= 359;\n if (isContinuous) {\n if (newLeftTop[0] > 0) {\n newLeftTop[0] = 0;\n }\n if (newRightBottom[0] < api.getWidth()) {\n newRightBottom[0] = api.getWidth();\n }\n }\n }\n\n var width = rightBottom[0] - leftTop[0];\n var height = rightBottom[1] - leftTop[1];\n var newWidth = newRightBottom[0] - newLeftTop[0];\n var newHeight = newRightBottom[1] - newLeftTop[1];\n\n var region = [\n (newLeftTop[0] - leftTop[0]) / width,\n 1.0 - newHeight / height - (newLeftTop[1] - leftTop[1]) / height,\n newWidth / width,\n newHeight / height\n ];\n\n return {\n leftTop: newLeftTop,\n rightBottom: newRightBottom,\n region: region\n };\n },\n\n _updateCamera: function (width, height, dpr) {\n this.viewGL.setViewport(0, 0, width, height, dpr);\n var camera = this.viewGL.camera;\n // FIXME bottom can't be larger than top\n camera.left = camera.bottom = 0;\n camera.top = height;\n camera.right = width;\n camera.near = 0;\n camera.far = 100;\n camera.position.z = 10;\n },\n\n remove: function () {\n this._planeMesh.stopAnimation();\n this.groupGL.removeAll();\n },\n\n dispose: function () {\n if (this._renderer) {\n this._particleSurface.dispose(this._renderer);\n }\n this.groupGL.removeAll();\n }\n});\n","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport FlowGLSeries from './FlowGLSeries';\nimport FlowGLView from './FlowGLView';\n\nexport function install(registers) {\n registers.registerChartView(FlowGLView);\n registers.registerSeriesModel(FlowGLSeries);\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './flowGL/install';\nuse(install);","import * as echarts from 'echarts/lib/echarts';\nimport { concatArray } from 'zrender/lib/core/util';\n\nvar LinesGLSeries = echarts.SeriesModel.extend({\n\n type: 'series.linesGL',\n\n dependencies: ['grid', 'geo'],\n\n visualStyleAccessPath: 'lineStyle',\n visualDrawType: 'stroke',\n\n streamEnabled: true,\n\n init: function (option) {\n var result = this._processFlatCoordsArray(option.data);\n this._flatCoords = result.flatCoords;\n this._flatCoordsOffset = result.flatCoordsOffset;\n if (result.flatCoords) {\n option.data = new Float32Array(result.count);\n }\n\n LinesGLSeries.superApply(this, 'init', arguments);\n },\n\n mergeOption: function (option) {\n var result = this._processFlatCoordsArray(option.data);\n this._flatCoords = result.flatCoords;\n this._flatCoordsOffset = result.flatCoordsOffset;\n if (result.flatCoords) {\n option.data = new Float32Array(result.count);\n }\n\n LinesGLSeries.superApply(this, 'mergeOption', arguments);\n },\n\n appendData: function (params) {\n var result = this._processFlatCoordsArray(params.data);\n if (result.flatCoords) {\n if (!this._flatCoords) {\n this._flatCoords = result.flatCoords;\n this._flatCoordsOffset = result.flatCoordsOffset;\n }\n else {\n this._flatCoords = concatArray(this._flatCoords, result.flatCoords);\n this._flatCoordsOffset = concatArray(this._flatCoordsOffset, result.flatCoordsOffset);\n }\n params.data = new Float32Array(result.count);\n }\n\n this.getRawData().appendData(params.data);\n },\n\n _getCoordsFromItemModel: function (idx) {\n var itemModel = this.getData().getItemModel(idx);\n var coords = (itemModel.option instanceof Array)\n ? itemModel.option : itemModel.getShallow('coords');\n\n if (process.env.NODE_ENV !== 'production') {\n if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) {\n throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.');\n }\n }\n return coords;\n },\n\n getLineCoordsCount: function (idx) {\n if (this._flatCoordsOffset) {\n return this._flatCoordsOffset[idx * 2 + 1];\n }\n else {\n return this._getCoordsFromItemModel(idx).length;\n }\n },\n\n getLineCoords: function (idx, out) {\n if (this._flatCoordsOffset) {\n var offset = this._flatCoordsOffset[idx * 2];\n var len = this._flatCoordsOffset[idx * 2 + 1];\n for (var i = 0; i < len; i++) {\n out[i] = out[i] || [];\n out[i][0] = this._flatCoords[offset + i * 2];\n out[i][1] = this._flatCoords[offset + i * 2 + 1];\n }\n return len;\n }\n else {\n var coords = this._getCoordsFromItemModel(idx);\n for (var i = 0; i < coords.length; i++) {\n out[i] = out[i] || [];\n out[i][0] = coords[i][0];\n out[i][1] = coords[i][1];\n }\n return coords.length;\n }\n },\n\n _processFlatCoordsArray: function (data) {\n var startOffset = 0;\n if (this._flatCoords) {\n startOffset = this._flatCoords.length;\n }\n // Stored as a typed array. In format\n // Points Count(2) | x | y | x | y | Points Count(3) | x | y | x | y | x | y |\n if (typeof data[0] === 'number') {\n var len = data.length;\n // Store offset and len of each segment\n var coordsOffsetAndLenStorage = new Uint32Array(len);\n var coordsStorage = new Float64Array(len);\n var coordsCursor = 0;\n var offsetCursor = 0;\n var dataCount = 0;\n for (var i = 0; i < len;) {\n dataCount++;\n var count = data[i++];\n // Offset\n coordsOffsetAndLenStorage[offsetCursor++] = coordsCursor + startOffset;\n // Len\n coordsOffsetAndLenStorage[offsetCursor++] = count;\n for (var k = 0; k < count; k++) {\n var x = data[i++];\n var y = data[i++];\n coordsStorage[coordsCursor++] = x;\n coordsStorage[coordsCursor++] = y;\n\n if (i > len) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Invalid data format.');\n }\n }\n }\n }\n\n return {\n flatCoordsOffset: new Uint32Array(coordsOffsetAndLenStorage.buffer, 0, offsetCursor),\n flatCoords: coordsStorage,\n count: dataCount\n };\n }\n\n return {\n flatCoordsOffset: null,\n flatCoords: null,\n count: data.length\n };\n },\n\n getInitialData: function (option, ecModel) {\n var lineData = new echarts.List(['value'], this);\n lineData.hasItemOption = false;\n\n lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) {\n // dataItem is simply coords\n if (dataItem instanceof Array) {\n return NaN;\n }\n else {\n lineData.hasItemOption = true;\n var value = dataItem.value;\n if (value != null) {\n return value instanceof Array ? value[dimIndex] : value;\n }\n }\n });\n\n return lineData;\n },\n\n defaultOption: {\n coordinateSystem: 'geo',\n zlevel: 10,\n\n progressive: 1e4,\n progressiveThreshold: 5e4,\n\n // Cartesian coordinate system\n // xAxisIndex: 0,\n // yAxisIndex: 0,\n\n // Geo coordinate system\n // geoIndex: 0,\n\n // Support source-over, lighter\n blendMode: 'source-over',\n\n lineStyle: {\n opacity: 0.8\n },\n\n postEffect: {\n enable: false,\n colorCorrection: {\n exposure: 0,\n brightness: 0,\n contrast: 1,\n saturation: 1,\n enable: true\n }\n }\n }\n});\n\nexport default LinesGLSeries;","import * as echarts from 'echarts/lib/echarts';\nimport graphicGL from '../../util/graphicGL';\nimport ViewGL from '../../core/ViewGL';\nimport Lines2DGeometry from '../../util/geometry/Lines2D';\nimport GLViewHelper from '../common/GLViewHelper';\nimport { getItemVisualColor, getItemVisualOpacity } from '../../util/visual';\n\nimport retrieve from '../../util/retrieve';\n\nexport default echarts.ChartView.extend({\n\n type: 'linesGL',\n\n __ecgl__: true,\n\n init: function (ecModel, api) {\n this.groupGL = new graphicGL.Node();\n this.viewGL = new ViewGL('orthographic');\n this.viewGL.add(this.groupGL);\n\n this._glViewHelper = new GLViewHelper(this.viewGL);\n\n this._nativeLinesShader = graphicGL.createShader('ecgl.lines3D');\n this._meshLinesShader = graphicGL.createShader('ecgl.meshLines3D');\n\n this._linesMeshes = [];\n this._currentStep = 0;\n },\n\n render: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n this._glViewHelper.reset(seriesModel, api);\n\n var linesMesh = this._linesMeshes[0];\n if (!linesMesh) {\n linesMesh = this._linesMeshes[0] = this._createLinesMesh(seriesModel);\n }\n this._linesMeshes.length = 1;\n\n this.groupGL.add(linesMesh);\n this._updateLinesMesh(seriesModel, linesMesh, 0, seriesModel.getData().count());\n\n this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api);\n },\n\n incrementalPrepareRender: function (seriesModel, ecModel, api) {\n this.groupGL.removeAll();\n this._glViewHelper.reset(seriesModel, api);\n\n this._currentStep = 0;\n\n this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api);\n },\n\n incrementalRender: function (params, seriesModel, ecModel, api) {\n var linesMesh = this._linesMeshes[this._currentStep];\n if (!linesMesh) {\n linesMesh = this._createLinesMesh(seriesModel);\n this._linesMeshes[this._currentStep] = linesMesh;\n }\n this._updateLinesMesh(seriesModel, linesMesh, params.start, params.end);\n this.groupGL.add(linesMesh);\n api.getZr().refresh();\n\n this._currentStep++;\n },\n\n updateTransform: function (seriesModel, ecModel, api) {\n if (seriesModel.coordinateSystem.getRoamTransform) {\n this._glViewHelper.updateTransform(seriesModel, api);\n }\n },\n\n _createLinesMesh: function (seriesModel) {\n var linesMesh = new graphicGL.Mesh({\n $ignorePicking: true,\n material: new graphicGL.Material({\n shader: graphicGL.createShader('ecgl.lines3D'),\n transparent: true,\n depthMask: false,\n depthTest: false\n }),\n geometry: new Lines2DGeometry({\n segmentScale: 10,\n useNativeLine: true,\n dynamic: false\n }),\n mode: graphicGL.Mesh.LINES,\n culling: false\n });\n\n return linesMesh;\n },\n\n _updateLinesMesh: function (seriesModel, linesMesh, start, end) {\n var data = seriesModel.getData();\n linesMesh.material.blend = seriesModel.get('blendMode') === 'lighter'\n ? graphicGL.additiveBlend : null;\n var curveness = seriesModel.get('lineStyle.curveness') || 0;\n var isPolyline = seriesModel.get('polyline');\n var geometry = linesMesh.geometry;\n var coordSys = seriesModel.coordinateSystem;\n\n var lineWidth = retrieve.firstNotNull(seriesModel.get('lineStyle.width'), 1);\n\n if (lineWidth > 1) {\n if (linesMesh.material.shader !== this._meshLinesShader) {\n linesMesh.material.attachShader(this._meshLinesShader);\n }\n linesMesh.mode = graphicGL.Mesh.TRIANGLES;\n }\n else {\n if (linesMesh.material.shader !== this._nativeLinesShader) {\n linesMesh.material.attachShader(this._nativeLinesShader);\n }\n linesMesh.mode = graphicGL.Mesh.LINES;\n }\n\n start = start || 0;\n end = end || data.count();\n\n geometry.resetOffset();\n var vertexCount = 0;\n var triangleCount = 0;\n var p0 = [];\n var p1 = [];\n var p2 = [];\n var p3 = [];\n\n var lineCoords = [];\n\n var t = 0.3;\n var t2 = 0.7;\n\n function updateBezierControlPoints() {\n p1[0] = (p0[0] * t2 + p3[0] * t) - (p0[1] - p3[1]) * curveness;\n p1[1] = (p0[1] * t2 + p3[1] * t) - (p3[0] - p0[0]) * curveness;\n p2[0] = (p0[0] * t + p3[0] * t2) - (p0[1] - p3[1]) * curveness;\n p2[1] = (p0[1] * t + p3[1] * t2) - (p3[0] - p0[0]) * curveness;\n }\n if (isPolyline || curveness !== 0) {\n for (var idx = start; idx < end; idx++) {\n if (isPolyline) {\n var count = seriesModel.getLineCoordsCount(idx);\n vertexCount += geometry.getPolylineVertexCount(count);\n triangleCount += geometry.getPolylineTriangleCount(count);\n }\n else {\n seriesModel.getLineCoords(idx, lineCoords);\n this._glViewHelper.dataToPoint(coordSys, lineCoords[0], p0);\n this._glViewHelper.dataToPoint(coordSys, lineCoords[1], p3);\n updateBezierControlPoints();\n\n vertexCount += geometry.getCubicCurveVertexCount(p0, p1, p2, p3);\n triangleCount += geometry.getCubicCurveTriangleCount(p0, p1, p2, p3);\n }\n }\n }\n else {\n var lineCount = end - start;\n vertexCount += lineCount * geometry.getLineVertexCount();\n triangleCount += lineCount * geometry.getLineVertexCount();\n }\n geometry.setVertexCount(vertexCount);\n geometry.setTriangleCount(triangleCount);\n\n var dataIndex = start;\n var colorArr = [];\n for (var idx = start; idx < end; idx++) {\n graphicGL.parseColor(getItemVisualColor(data, dataIndex), colorArr);\n var opacity = retrieve.firstNotNull(getItemVisualOpacity(data, dataIndex), 1);\n colorArr[3] *= opacity;\n\n var count = seriesModel.getLineCoords(idx, lineCoords);\n for (var k = 0; k < count; k++) {\n this._glViewHelper.dataToPoint(coordSys, lineCoords[k], lineCoords[k]);\n }\n\n if (isPolyline) {\n geometry.addPolyline(lineCoords, colorArr, lineWidth, 0, count);\n }\n else if (curveness !== 0) {\n p0 = lineCoords[0];\n p3 = lineCoords[1];\n updateBezierControlPoints();\n geometry.addCubicCurve(p0, p1, p2, p3, colorArr, lineWidth);\n }\n else {\n geometry.addPolyline(lineCoords, colorArr, lineWidth, 0, 2);\n }\n dataIndex++;\n }\n },\n\n dispose: function () {\n this.groupGL.removeAll();\n },\n\n remove: function () {\n this.groupGL.removeAll();\n }\n});","// TODO ECharts GL must be imported whatever component,charts is imported.\nimport '../../echarts-gl';\n\nimport LinesGLSeries from './LinesGLSeries';\nimport LinesGLView from './LinesGLView';\n\nexport function install(registers) {\n registers.registerChartView(LinesGLView);\n registers.registerSeriesModel(LinesGLSeries);\n}","import { use } from 'echarts/lib/echarts';\nimport { install } from './linesGL/install';\nuse(install);","import '../echarts-gl';\n\nimport '../component/grid3D';\nimport '../component/geo3D';\nimport '../component/globe';\nimport '../component/mapbox3D';\nimport '../component/maptalks3D';\n\nimport '../chart/bar3D';\nimport '../chart/line3D';\nimport '../chart/scatter3D';\nimport '../chart/lines3D';\nimport '../chart/polygons3D';\nimport '../chart/surface';\nimport '../chart/map3D';\n\nimport '../chart/scatterGL';\nimport '../chart/graphGL';\nimport '../chart/flowGL';\nimport '../chart/linesGL';","module.exports = __WEBPACK_EXTERNAL_MODULE_echarts_lib_echarts__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(\"./src/export/all.js\");\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/echarts-gl.min.js b/dist/echarts-gl.min.js index 3d3ba386..ef77609f 100644 --- a/dist/echarts-gl.min.js +++ b/dist/echarts-gl.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],t):"object"==typeof exports?exports["echarts-gl"]=t(require("echarts")):e["echarts-gl"]=t(e.echarts)}(self,(function(e){return(()=>{"use strict";var t={468:(e,t,r)=>{r.r(t);var i=r(83);function n(e,t,r){"object"==typeof t&&(r=t,t=null);var i,n=this;if(!(e instanceof Function))for(var s in i=[],e)e.hasOwnProperty(s)&&i.push(s);var l=function(t){if(n.apply(this,arguments),e instanceof Function?a(this,e.call(this,t)):o(this,e,i),this.constructor===l)for(var r=l.__initializers__,s=0;s=400?e.onerror&&e.onerror():e.onload&&e.onload(t.response)},e.onerror&&(t.onerror=e.onerror),t.send(null)}};var F,z={supportWebGL:function(){if(null==F)try{var e=document.createElement("canvas");if(!e.getContext("webgl")&&!e.getContext("experimental-webgl"))throw new Error}catch(e){F=!1}return F}};z.Int8Array="undefined"==typeof Int8Array?Array:Int8Array,z.Uint8Array="undefined"==typeof Uint8Array?Array:Uint8Array,z.Uint16Array="undefined"==typeof Uint16Array?Array:Uint16Array,z.Uint32Array="undefined"==typeof Uint32Array?Array:Uint32Array,z.Int16Array="undefined"==typeof Int16Array?Array:Int16Array,z.Float32Array="undefined"==typeof Float32Array?Array:Float32Array,z.Float64Array="undefined"==typeof Float64Array?Array:Float64Array;var G={};"undefined"!=typeof window?G=window:void 0!==r.g&&(G=r.g),z.requestAnimationFrame=G.requestAnimationFrame||G.msRequestAnimationFrame||G.mozRequestAnimationFrame||G.webkitRequestAnimationFrame||function(e){setTimeout(e,16)},z.createCanvas=function(){return document.createElement("canvas")},z.createImage=function(){return new G.Image},z.request={get:B.get},z.addEventListener=function(e,t,r,i){e.addEventListener(t,r,i)},z.removeEventListener=function(e,t,r){e.removeEventListener(t,r)};const U=z;var k=function(){this.head=null,this.tail=null,this._length=0};k.prototype.insert=function(e){var t=new k.Entry(e);return this.insertEntry(t),t},k.prototype.insertAt=function(e,t){if(!(e<0)){for(var r=this.head,i=0;r&&i!=e;)r=r.next,i++;if(r){var n=new k.Entry(t),a=r.prev;a?(a.next=n,n.prev=a):this.head=n,n.next=r,r.prev=n}else this.insert(t)}},k.prototype.insertBeforeEntry=function(e,t){var r=new k.Entry(e),i=t.prev;i?(i.next=r,r.prev=i):this.head=r,r.next=t,t.prev=r,this._length++},k.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e,this._length++},k.prototype.remove=function(e){var t=e.prev,r=e.next;t?t.next=r:this.head=r,r?r.prev=t:this.tail=t,e.next=e.prev=null,this._length--},k.prototype.removeAt=function(e){if(!(e<0)){for(var t=this.head,r=0;t&&r!=e;)t=t.next,r++;return t?(this.remove(t),t.value):void 0}},k.prototype.getHead=function(){if(this.head)return this.head.value},k.prototype.getTail=function(){if(this.tail)return this.tail.value},k.prototype.getAt=function(e){if(!(e<0)){for(var t=this.head,r=0;t&&r!=e;)t=t.next,r++;return t.value}},k.prototype.indexOf=function(e){for(var t=this.head,r=0;t;){if(t.value===e)return r;t=t.next,r++}},k.prototype.length=function(){return this._length},k.prototype.isEmpty=function(){return 0===this._length},k.prototype.forEach=function(e,t){for(var r=this.head,i=0,n=void 0!==t;r;)n?e.call(t,r.value,i):e(r.value,i),r=r.next,i++},k.prototype.clear=function(){this.tail=this.head=null,this._length=0},k.Entry=function(e){this.value=e,this.next=null,this.prev=null};const V=k;var H=function(e){this._list=new V,this._map={},this._maxSize=e||10};H.prototype.setMaxSize=function(e){this._maxSize=e},H.prototype.put=function(e,t){if(!this._map.hasOwnProperty(e)){var r=this._list.length();if(r>=this._maxSize&&r>0){var i=this._list.head;this._list.remove(i),delete this._map[i.key]}var n=this._list.insert(t);n.key=e,this._map[e]=n}},H.prototype.get=function(e){var t=this._map[e];if(this._map.hasOwnProperty(e))return t!==this._list.tail&&(this._list.remove(t),this._list.insertEntry(t)),t.value},H.prototype.remove=function(e){var t=this._map[e];void 0!==t&&(delete this._map[e],this._list.remove(t))},H.prototype.clear=function(){this._list.clear(),this._map={}};const W=H;var j={},X={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function q(e){return(e=Math.round(e))<0?0:e>255?255:e}function Z(e){return e<0?0:e>1?1:e}function Y(e){return e.length&&"%"===e.charAt(e.length-1)?q(parseFloat(e)/100*255):q(parseInt(e,10))}function K(e){return e.length&&"%"===e.charAt(e.length-1)?Z(parseFloat(e)/100):Z(parseFloat(e))}function Q(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function J(e,t,r){return e+(t-e)*r}function $(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e}function ee(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var te=new W(20),re=null;function ie(e,t){re&&ee(re,t),re=te.put(e,re||t.slice())}function ne(e,t){var r=(parseFloat(e[0])%360+360)%360/360,i=K(e[1]),n=K(e[2]),a=n<=.5?n*(i+1):n+i-n*i,o=2*n-a;return $(t=t||[],q(255*Q(o,a,r+1/3)),q(255*Q(o,a,r)),q(255*Q(o,a,r-1/3)),1),4===e.length&&(t[3]=e[3]),t}j.parse=function(e,t){if(e){t=t||[];var r=te.get(e);if(r)return ee(t,r);var i,n=(e+="").replace(/ /g,"").toLowerCase();if(n in X)return ee(t,X[n]),ie(e,t),t;if("#"===n.charAt(0))return 4===n.length?(i=parseInt(n.substr(1),16))>=0&&i<=4095?($(t,(3840&i)>>4|(3840&i)>>8,240&i|(240&i)>>4,15&i|(15&i)<<4,1),ie(e,t),t):void $(t,0,0,0,1):7===n.length?(i=parseInt(n.substr(1),16))>=0&&i<=16777215?($(t,(16711680&i)>>16,(65280&i)>>8,255&i,1),ie(e,t),t):void $(t,0,0,0,1):void 0;var a=n.indexOf("("),o=n.indexOf(")");if(-1!==a&&o+1===n.length){var s=n.substr(0,a),l=n.substr(a+1,o-(a+1)).split(","),h=1;switch(s){case"rgba":if(4!==l.length)return void $(t,0,0,0,1);h=K(l.pop());case"rgb":return 3!==l.length?void $(t,0,0,0,1):($(t,Y(l[0]),Y(l[1]),Y(l[2]),h),ie(e,t),t);case"hsla":return 4!==l.length?void $(t,0,0,0,1):(l[3]=K(l[3]),ne(l,t),ie(e,t),t);case"hsl":return 3!==l.length?void $(t,0,0,0,1):(ne(l,t),ie(e,t),t);default:return}}$(t,0,0,0,1)}},j.parseToFloat=function(e,t){if(t=j.parse(e,t))return t[0]/=255,t[1]/=255,t[2]/=255,t},j.lift=function(e,t){var r=j.parse(e);if(r){for(var i=0;i<3;i++)r[i]=t<0?r[i]*(1-t)|0:(255-r[i])*t+r[i]|0;return j.stringify(r,4===r.length?"rgba":"rgb")}},j.toHex=function(e){var t=j.parse(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)},j.fastLerp=function(e,t,r){if(t&&t.length&&e>=0&&e<=1){r=r||[];var i=e*(t.length-1),n=Math.floor(i),a=Math.ceil(i),o=t[n],s=t[a],l=i-n;return r[0]=q(J(o[0],s[0],l)),r[1]=q(J(o[1],s[1],l)),r[2]=q(J(o[2],s[2],l)),r[3]=Z(J(o[3],s[3],l)),r}},j.fastMapToColor=j.fastLerp,j.lerp=function(e,t,r){if(t&&t.length&&e>=0&&e<=1){var i=e*(t.length-1),n=Math.floor(i),a=Math.ceil(i),o=j.parse(t[n]),s=j.parse(t[a]),l=i-n,h=j.stringify([q(J(o[0],s[0],l)),q(J(o[1],s[1],l)),q(J(o[2],s[2],l)),Z(J(o[3],s[3],l))],"rgba");return r?{color:h,leftIndex:n,rightIndex:a,value:i}:h}},j.mapToColor=j.lerp,j.modifyHSL=function(e,t,r,i){if(e=j.parse(e))return e=function(e){if(e){var t,r,i=e[0]/255,n=e[1]/255,a=e[2]/255,o=Math.min(i,n,a),s=Math.max(i,n,a),l=s-o,h=(s+o)/2;if(0===l)t=0,r=0;else{r=h<.5?l/(s+o):l/(2-s-o);var u=((s-i)/6+l/2)/l,c=((s-n)/6+l/2)/l,d=((s-a)/6+l/2)/l;i===s?t=d-c:n===s?t=1/3+u-d:a===s&&(t=2/3+c-u),t<0&&(t+=1),t>1&&(t-=1)}var f=[360*t,r,h];return null!=e[3]&&f.push(e[3]),f}}(e),null!=t&&(e[0]=(n=t,(n=Math.round(n))<0?0:n>360?360:n)),null!=r&&(e[1]=K(r)),null!=i&&(e[2]=K(i)),j.stringify(ne(e),"rgba");var n},j.modifyAlpha=function(e,t){if((e=j.parse(e))&&null!=t)return e[3]=Z(t),j.stringify(e,"rgba")},j.stringify=function(e,t){if(e&&e.length){var r=e[0]+","+e[1]+","+e[2];return"rgba"!==t&&"hsva"!==t&&"hsla"!==t||(r+=","+e[3]),t+"("+r+")"}};var ae=j.parseToFloat,oe={};function se(e){var t=Object.keys(e);t.sort();for(var r=[],i=0;i=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(e,t){if("object"==typeof e)for(var r in e){var i=e[r];this.setUniform(r,i)}else this.setUniform(e,t)},get:function(e){var t=this.uniforms[e];if(t)return t.value},attachShader:function(e,t){var r=this.uniforms;this.uniforms=e.createUniforms(),this.shader=e;var i=this.uniforms;this._enabledUniforms=Object.keys(i),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter((function(e){var t=this.uniforms[e].type;return"t"===t||"tv"===t}),this);var n=this.vertexDefines,a=this.fragmentDefines;if(this.vertexDefines=f.clone(e.vertexDefines),this.fragmentDefines=f.clone(e.fragmentDefines),t){for(var o in r)i[o]&&(i[o].value=r[o].value);f.defaults(this.vertexDefines,n),f.defaults(this.fragmentDefines,a)}var s={};for(var l in e.textures)s[l]={shaderType:e.textures[l].shaderType,type:e.textures[l].type,enabled:!(!t||!this._textureStatus[l])&&this._textureStatus[l].enabled};this._textureStatus=s,this._programKey=""},clone:function(){var e=new this.constructor({name:this.name,shader:this.shader});for(var t in this.uniforms)e.uniforms[t].value=this.uniforms[t].value;return e.depthTest=this.depthTest,e.depthMask=this.depthMask,e.transparent=this.transparent,e.blend=this.blend,e.vertexDefines=f.clone(this.vertexDefines),e.fragmentDefines=f.clone(this.fragmentDefines),e.enableTexture(this.getEnabledTextures()),e.precision=this.precision,e},define:function(e,t,r){var i=this.vertexDefines,n=this.fragmentDefines;"vertex"!==e&&"fragment"!==e&&"both"!==e&&arguments.length<3&&(r=t,t=e,e="both"),r=null!=r?r:null,"vertex"!==e&&"both"!==e||i[t]!==r&&(i[t]=r,this._programKey=""),"fragment"!==e&&"both"!==e||n[t]!==r&&(n[t]=r,"both"!==e&&(this._programKey=""))},undefine:function(e,t){"vertex"!==e&&"fragment"!==e&&"both"!==e&&arguments.length<2&&(t=e,e="both"),"vertex"!==e&&"both"!==e||this.isDefined("vertex",t)&&(delete this.vertexDefines[t],this._programKey=""),"fragment"!==e&&"both"!==e||this.isDefined("fragment",t)&&(delete this.fragmentDefines[t],"both"!==e&&(this._programKey=""))},isDefined:function(e,t){switch(e){case"vertex":return void 0!==this.vertexDefines[t];case"fragment":return void 0!==this.fragmentDefines[t]}},getDefine:function(e,t){switch(e){case"vertex":return this.vertexDefines[t];case"fragment":return this.fragmentDefines[t]}},enableTexture:function(e){if(Array.isArray(e))for(var t=0;t0&&(n=1/Math.sqrt(n),e[0]=t[0]*n,e[1]=t[1]*n),e},fe.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},fe.cross=function(e,t,r){var i=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=i,e},fe.lerp=function(e,t,r,i){var n=t[0],a=t[1];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e},fe.random=function(e,t){t=t||1;var r=2*GLMAT_RANDOM()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e},fe.transformMat2=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n,e[1]=r[1]*i+r[3]*n,e},fe.transformMat2d=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n+r[4],e[1]=r[1]*i+r[3]*n+r[5],e},fe.transformMat3=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[3]*n+r[6],e[1]=r[1]*i+r[4]*n+r[7],e},fe.transformMat4=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e},fe.forEach=(he=fe.create(),function(e,t,r,i,n,a){var o,s;for(t||(t=2),r||(r=0),s=i?Math.min(i*t+r,e.length):e.length,o=r;o0&&i.push("#define "+n.toUpperCase()+"_COUNT "+a)}if(r)for(var o=0;ol.getMaxJointNumber()&&(d.USE_SKIN_MATRICES_TEXTURE=null),c+="\n"+Me(d)+"\n"}a&&(c+="\n#define INSTANCING\n");var f=c+Me(t.vertexDefines,s,u),p=c+Me(t.fragmentDefines,s,u),m=f+"\n"+t.shader.vertex,g=["OES_standard_derivatives","EXT_shader_texture_lod"].filter((function(e){return null!=l.getGLExtension(e)}));g.indexOf("EXT_shader_texture_lod")>=0&&(p+="\n#define SUPPORT_TEXTURE_LOD"),g.indexOf("OES_standard_derivatives")>=0&&(p+="\n#define SUPPORT_STANDARD_DERIVATIVES");var _,v,y=function(e){for(var t=[],r=0;r=0){if(1!==s&&4!==s){ke();break}s=2,h=[]}else if(1!==s)if(4!==s)u(c),s=0;else{var d=c;Ie.indexOf(d)>=0||Re.indexOf(d)>=0||Be.indexOf(d)>=0?l[o].semantic=d:"ignore"===d||"unconfigurable"===d?l[o].ignore=!0:l[o].value="bool"===e?"true"===d:parseFloat(d)}else l[o].value="bool"===e?"true"===c:parseFloat(c),h=null;else{if(2!==s){ke();break}if(!(h instanceof Array)){ke();break}h.push(+i[++a])}else l[o].value=new U.Float32Array(h),h=null,s=5;else if(2===s){if(!(h instanceof Array)){ke();break}h.push(+i[++a])}else s=5;else s=4;else{if(0!==s&&3!==s){ke();break}s=1}}return l}function He(e,t){"object"==typeof e&&(t=e.fragment,e=e.vertex),e=Ue(e),t=Ue(t),this._shaderID=function(e,t){var r="vertex:"+e+"fragment:"+t;if(ze[r])return ze[r];var i=f.genGUID();return ze[r]=i,Ge[i]={vertex:e,fragment:t},i}(e,t),this._vertexCode=He.parseImport(e),this._fragmentCode=He.parseImport(t),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}He.prototype={constructor:He,createUniforms:function(){var e={};for(var t in this.uniformTemplates){var r=this.uniformTemplates[t];e[t]={type:r.type,value:r.value()}}return e},_parseImport:function(){this._vertexCode=He.parseImport(this.vertex),this._fragmentCode=He.parseImport(this.fragment)},_addSemanticUniform:function(e,t,r){if(Ie.indexOf(r)>=0)this.attributeSemantics[r]={symbol:e,type:t};else if(Be.indexOf(r)>=0){var i=!1,n=r;r.match(/TRANSPOSE$/)&&(i=!0,n=r.slice(0,-9)),this.matrixSemantics[r]={symbol:e,type:t,isTranspose:i,semanticNoTranspose:n}}else Re.indexOf(r)>=0&&(this.uniformSemantics[r]={symbol:e,type:t})},_addMaterialUniform:function(e,t,r,i,n,a){a[e]={type:r,value:n?Ne.array:i||Ne[t],semantic:null}},_parseUniforms:function(){var e={},t=this;function r(e){return null!=e?function(){return e}:null}function i(i,n,a){var o=Ve(n,a),s=[];for(var l in o){var h=o[l],u=h.semantic,c=l,d=Pe[n],f=r(o[l].value);o[l].isArray&&(c+="["+o[l].arraySize+"]",d+="v"),s.push(c),t._uniformList.push(l),h.ignore||("sampler2D"!==n&&"samplerCube"!==n||(t.textures[l]={shaderType:"fragment",type:n}),u?t._addSemanticUniform(l,d,u):t._addMaterialUniform(l,n,d,f,o[l].isArray,e))}return s.length>0?"uniform "+n+" "+s.join(",")+";\n":""}this._uniformList=[],this._vertexCode=this._vertexCode.replace(Ce,i),this._fragmentCode=this._fragmentCode.replace(Ce,i),t.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=e},_parseAttributes:function(){var e={},t=this;this._vertexCode=this._vertexCode.replace(De,(function(r,i,n){var a=Ve(i,n),o=Fe[i]||1,s=[];for(var l in a){var h=a[l].semantic;if(e[l]={type:"float",size:o,semantic:h||null},h){if(Ie.indexOf(h)<0)throw new Error('Unkown semantic "'+h+'"');t.attributeSemantics[h]={symbol:l,type:i}}s.push(l)}return"attribute "+i+" "+s.join(",")+";\n"})),this.attributes=e},_parseDefines:function(){var e=this;function t(t,r,i){var n=e.fragmentDefines;return n[r]||(n[r]="false"!==i&&("true"===i||(i?isNaN(parseFloat(i))?i.trim():parseFloat(i):null))),""}this._vertexCode=this._vertexCode.replace(Le,t),this._fragmentCode=this._fragmentCode.replace(Le,t)},clone:function(){var e=Ge[this._shaderID];return new He(e.vertex,e.fragment)}},Object.defineProperty&&(Object.defineProperty(He.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty(He.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty(He.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty(He.prototype,"uniforms",{get:function(){return this._uniformList}}));var We=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;He.parseImport=function(e){return e.replace(We,(function(e,t,r){return(e=He.source(r))?He.parseImport(e):(console.error('Shader chunk "'+r+'" not existed in library'),"")}))};var je=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;He.import=function(e){e.replace(je,(function(e,t,r,i){if(i=i.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"")){for(var n,a=r.split("."),o=He.codes,s=0;s 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n}\n@end";var Ze={create:function(){var e=new ce(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},clone:function(e){var t=new ce(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},transpose:function(e,t){if(e===t){var r=t[1],i=t[2],n=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=a,e[11]=t[14],e[12]=n,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},invert:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],h=t[7],u=t[8],c=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],_=t[15],v=r*s-i*o,y=r*l-n*o,x=r*h-a*o,b=i*l-n*s,w=i*h-a*s,T=n*h-a*l,S=u*m-c*p,M=u*g-d*p,A=u*_-f*p,E=c*g-d*m,C=c*_-f*m,D=d*_-f*g,L=v*D-y*C+x*E+b*A-w*M+T*S;return L?(L=1/L,e[0]=(s*D-l*C+h*E)*L,e[1]=(n*C-i*D-a*E)*L,e[2]=(m*T-g*w+_*b)*L,e[3]=(d*w-c*T-f*b)*L,e[4]=(l*A-o*D-h*M)*L,e[5]=(r*D-n*A+a*M)*L,e[6]=(g*x-p*T-_*y)*L,e[7]=(u*T-d*x+f*y)*L,e[8]=(o*C-s*A+h*S)*L,e[9]=(i*A-r*C-a*S)*L,e[10]=(p*w-m*x+_*v)*L,e[11]=(c*x-u*w-f*v)*L,e[12]=(s*M-o*E-l*S)*L,e[13]=(r*E-i*M+n*S)*L,e[14]=(m*y-p*b-g*v)*L,e[15]=(u*b-c*y+d*v)*L,e):null},adjoint:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],h=t[7],u=t[8],c=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],_=t[15];return e[0]=s*(d*_-f*g)-c*(l*_-h*g)+m*(l*f-h*d),e[1]=-(i*(d*_-f*g)-c*(n*_-a*g)+m*(n*f-a*d)),e[2]=i*(l*_-h*g)-s*(n*_-a*g)+m*(n*h-a*l),e[3]=-(i*(l*f-h*d)-s*(n*f-a*d)+c*(n*h-a*l)),e[4]=-(o*(d*_-f*g)-u*(l*_-h*g)+p*(l*f-h*d)),e[5]=r*(d*_-f*g)-u*(n*_-a*g)+p*(n*f-a*d),e[6]=-(r*(l*_-h*g)-o*(n*_-a*g)+p*(n*h-a*l)),e[7]=r*(l*f-h*d)-o*(n*f-a*d)+u*(n*h-a*l),e[8]=o*(c*_-f*m)-u*(s*_-h*m)+p*(s*f-h*c),e[9]=-(r*(c*_-f*m)-u*(i*_-a*m)+p*(i*f-a*c)),e[10]=r*(s*_-h*m)-o*(i*_-a*m)+p*(i*h-a*s),e[11]=-(r*(s*f-h*c)-o*(i*f-a*c)+u*(i*h-a*s)),e[12]=-(o*(c*g-d*m)-u*(s*g-l*m)+p*(s*d-l*c)),e[13]=r*(c*g-d*m)-u*(i*g-n*m)+p*(i*d-n*c),e[14]=-(r*(s*g-l*m)-o*(i*g-n*m)+p*(i*l-n*s)),e[15]=r*(s*d-l*c)-o*(i*d-n*c)+u*(i*l-n*s),e},determinant:function(e){var t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],h=e[8],u=e[9],c=e[10],d=e[11],f=e[12],p=e[13],m=e[14],g=e[15];return(t*o-r*a)*(c*g-d*m)-(t*s-i*a)*(u*g-d*p)+(t*l-n*a)*(u*m-c*p)+(r*s-i*o)*(h*g-d*f)-(r*l-n*o)*(h*m-c*f)+(i*l-n*s)*(h*p-u*f)},multiply:function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],f=t[10],p=t[11],m=t[12],g=t[13],_=t[14],v=t[15],y=r[0],x=r[1],b=r[2],w=r[3];return e[0]=y*i+x*s+b*c+w*m,e[1]=y*n+x*l+b*d+w*g,e[2]=y*a+x*h+b*f+w*_,e[3]=y*o+x*u+b*p+w*v,y=r[4],x=r[5],b=r[6],w=r[7],e[4]=y*i+x*s+b*c+w*m,e[5]=y*n+x*l+b*d+w*g,e[6]=y*a+x*h+b*f+w*_,e[7]=y*o+x*u+b*p+w*v,y=r[8],x=r[9],b=r[10],w=r[11],e[8]=y*i+x*s+b*c+w*m,e[9]=y*n+x*l+b*d+w*g,e[10]=y*a+x*h+b*f+w*_,e[11]=y*o+x*u+b*p+w*v,y=r[12],x=r[13],b=r[14],w=r[15],e[12]=y*i+x*s+b*c+w*m,e[13]=y*n+x*l+b*d+w*g,e[14]=y*a+x*h+b*f+w*_,e[15]=y*o+x*u+b*p+w*v,e},multiplyAffine:function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[4],s=t[5],l=t[6],h=t[8],u=t[9],c=t[10],d=t[12],f=t[13],p=t[14],m=r[0],g=r[1],_=r[2];return e[0]=m*i+g*o+_*h,e[1]=m*n+g*s+_*u,e[2]=m*a+g*l+_*c,m=r[4],g=r[5],_=r[6],e[4]=m*i+g*o+_*h,e[5]=m*n+g*s+_*u,e[6]=m*a+g*l+_*c,m=r[8],g=r[9],_=r[10],e[8]=m*i+g*o+_*h,e[9]=m*n+g*s+_*u,e[10]=m*a+g*l+_*c,m=r[12],g=r[13],_=r[14],e[12]=m*i+g*o+_*h+d,e[13]=m*n+g*s+_*u+f,e[14]=m*a+g*l+_*c+p,e}};Ze.mul=Ze.multiply,Ze.mulAffine=Ze.multiplyAffine,Ze.translate=function(e,t,r){var i,n,a,o,s,l,h,u,c,d,f,p,m=r[0],g=r[1],_=r[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*_+t[12],e[13]=t[1]*m+t[5]*g+t[9]*_+t[13],e[14]=t[2]*m+t[6]*g+t[10]*_+t[14],e[15]=t[3]*m+t[7]*g+t[11]*_+t[15]):(i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],f=t[10],p=t[11],e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=h,e[7]=u,e[8]=c,e[9]=d,e[10]=f,e[11]=p,e[12]=i*m+s*g+c*_+t[12],e[13]=n*m+l*g+d*_+t[13],e[14]=a*m+h*g+f*_+t[14],e[15]=o*m+u*g+p*_+t[15]),e},Ze.scale=function(e,t,r){var i=r[0],n=r[1],a=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},Ze.rotate=function(e,t,r,i){var n,a,o,s,l,h,u,c,d,f,p,m,g,_,v,y,x,b,w,T,S,M,A,E,C=i[0],D=i[1],L=i[2],P=Math.sqrt(C*C+D*D+L*L);return Math.abs(P)0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e},Ke.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},Ke.cross=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2];return e[0]=n*l-a*s,e[1]=a*o-i*l,e[2]=i*s-n*o,e},Ke.lerp=function(e,t,r,i){var n=t[0],a=t[1],o=t[2];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e},Ke.random=function(e,t){t=t||1;var r=2*de()*Math.PI,i=2*de()-1,n=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*n,e[1]=Math.sin(r)*n,e[2]=i*t,e},Ke.transformMat4=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[3]*i+r[7]*n+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*n+r[8]*a+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*a+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*a+r[14])/o,e},Ke.transformMat3=function(e,t,r){var i=t[0],n=t[1],a=t[2];return e[0]=i*r[0]+n*r[3]+a*r[6],e[1]=i*r[1]+n*r[4]+a*r[7],e[2]=i*r[2]+n*r[5]+a*r[8],e},Ke.transformQuat=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2],h=r[3],u=h*i+s*a-l*n,c=h*n+l*i-o*a,d=h*a+o*n-s*i,f=-o*i-s*n-l*a;return e[0]=u*h+f*-o+c*-l-d*-s,e[1]=c*h+f*-s+d*-o-u*-l,e[2]=d*h+f*-l+u*-s-c*-o,e},Ke.rotateX=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0],a[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),a[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},Ke.rotateY=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),a[1]=n[1],a[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},Ke.rotateZ=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),a[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),a[2]=n[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},Ke.forEach=function(){var e=Ke.create();return function(t,r,i,n,a,o){var s,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s1?0:Math.acos(n)};const Qe=Ke;Xe.import(qe);var Je=Ye.create,$e={};function et(e){return e.material}function tt(e,t,r){return t.uniforms[r].value}function rt(e,t,r,i){return r!==i}function it(e){return!0}function nt(){}var at={float:S,byte:5120,ubyte:T,short:5122,ushort:5123};function ot(e,t,r){this.availableAttributes=e,this.availableAttributeSymbols=t,this.indicesBuffer=r,this.vao=null}function st(e){var t,r;this.bind=function(e){t||((t=U.createCanvas()).width=t.height=1,t.getContext("2d"));var i=e.gl,n=!r;n&&(r=i.createTexture()),i.bindTexture(i.TEXTURE_2D,r),n&&i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t)},this.unbind=function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var lt=m.extend((function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},maxJointNumber:20,__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}}),(function(){this.canvas||(this.canvas=U.createCanvas());var e=this.canvas;try{var t={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!this.gl)throw new Error;this._glinfo=new v(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(e){throw"Error creating WebGL Context "+e}this._programMgr=new Ee(this),this._placeholderTexture=new st(this)}),{resize:function(e,t){var r=this.canvas,i=this.devicePixelRatio;null!=e?(r.style&&(r.style.width=e+"px",r.style.height=t+"px"),r.width=e*i,r.height=t*i,this._width=e,this._height=t):(this._width=r.width/i,this._height=r.height/i),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var e=this.viewport;return e.width/e.height},setDevicePixelRatio:function(e){this.devicePixelRatio=e,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(e){return this._glinfo.getExtension(e)},getGLParameter:function(e){return this._glinfo.getParameter(e)},setViewport:function(e,t,r,i,n){if("object"==typeof e){var a=e;e=a.x,t=a.y,r=a.width,i=a.height,n=a.devicePixelRatio}n=n||this.devicePixelRatio,this.gl.viewport(e*n,t*n,r*n,i*n),this.viewport={x:e,y:t,width:r,height:i,devicePixelRatio:n}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var e=this._clearStack.pop();this.clearColor=e.clearColor,this.clearBit=e.clearBit}},bindSceneRendering:function(e){this._sceneRendering=e},render:function(e,t,r,i){var n=this.gl,a=this.clearColor;if(this.clearBit){n.colorMask(!0,!0,!0,!0),n.depthMask(!0);var o=this.viewport,s=!1,l=o.devicePixelRatio;(o.width!==this._width||o.height!==this._height||l&&l!==this.devicePixelRatio||o.x||o.y)&&(s=!0,n.enable(n.SCISSOR_TEST),n.scissor(o.x*l,o.y*l,o.width*l,o.height*l)),n.clearColor(a[0],a[1],a[2],a[3]),n.clear(this.clearBit),s&&n.disable(n.SCISSOR_TEST)}if(r||e.update(!1),e.updateLights(),t=t||e.getMainCamera()){t.update();var h=e.updateRenderList(t,!0);this._sceneRendering=e;var u=h.opaque,c=h.transparent,d=e.material;e.trigger("beforerender",this,e,t,h),i?(this.renderPreZ(u,e,t),n.depthFunc(n.LEQUAL)):n.depthFunc(n.LESS);for(var f=Je(),p=Qe.create(),m=0;m0){var s=e[n-1],l=s.joints?s.joints.length:0;if((a.joints?a.joints.length:0)===l&&a.material===s.material&&a.lightGroup===s.lightGroup){a.__program=s.__program;continue}}var h=this._programMgr.getProgram(a,o,t);this.validateProgram(h),a.__program=h}},renderPass:function(e,t,r){this.trigger("beforerenderpass",this,e,t,r),(r=r||{}).getMaterial=r.getMaterial||et,r.getUniform=r.getUniform||tt,r.isMaterialChanged=r.isMaterialChanged||rt,r.beforeRender=r.beforeRender||nt,r.afterRender=r.afterRender||nt;var i=r.ifRender||it;this.updatePrograms(e,this._sceneRendering,r),r.sortCompare&&e.sort(r.sortCompare);var n=this.viewport,a=n.devicePixelRatio,o=[n.x*a,n.y*a,n.width*a,n.height*a],s=this.devicePixelRatio,l=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*s,this._height*s],h=[o[2],o[3]],u=Date.now();t?(Ye.copy(ht.VIEW,t.viewMatrix.array),Ye.copy(ht.PROJECTION,t.projectionMatrix.array),Ye.copy(ht.VIEWINVERSE,t.worldTransform.array)):(Ye.identity(ht.VIEW),Ye.identity(ht.PROJECTION),Ye.identity(ht.VIEWINVERSE)),Ye.multiply(ht.VIEWPROJECTION,ht.PROJECTION,ht.VIEW),Ye.invert(ht.PROJECTIONINVERSE,ht.PROJECTION),Ye.invert(ht.VIEWPROJECTIONINVERSE,ht.VIEWPROJECTION);for(var c,d,f,p,m,g,_,v,y,x,b,w,T=this.gl,S=this._sceneRendering,M=0;Mthis.getMaxJointNumber()){var a=n.getSubSkinMatricesTexture(e.__uid__,e.joints);t.useTextureSlot(this,a,r),t.setUniform(i,"1i","skinMatricesTexture",r),t.setUniform(i,"1f","skinMatricesTextureSize",a.width)}else{var o=n.getSubSkinMatrices(e.__uid__,e.joints);t.setUniformOfSemantic(i,"SKIN_MATRIX",o)}},_renderObject:function(e,t,r){var i=this.gl,n=e.geometry,a=e.mode;null==a&&(a=4);var o=null,s=e.isInstancedMesh&&e.isInstancedMesh();if(!s||(o=this.getGLExtension("ANGLE_instanced_arrays"))){var l;if(s&&(l=this._bindInstancedAttributes(e,r,o)),t.indicesBuffer){var h=this.getGLExtension("OES_element_index_uint")&&n.indices instanceof Uint32Array?i.UNSIGNED_INT:i.UNSIGNED_SHORT;s?o.drawElementsInstancedANGLE(a,t.indicesBuffer.count,h,0,e.getInstanceCount()):i.drawElements(a,t.indicesBuffer.count,h,0)}else s?o.drawArraysInstancedANGLE(a,0,n.vertexCount,e.getInstanceCount()):i.drawArrays(a,0,n.vertexCount);if(s)for(var u=0;ur?r:e}ct.add=function(e,t,r){return Qe.add(e.array,t.array,r.array),e._dirty=!0,e},ct.set=function(e,t,r,i){Qe.set(e.array,t,r,i),e._dirty=!0},ct.copy=function(e,t){return Qe.copy(e.array,t.array),e._dirty=!0,e},ct.cross=function(e,t,r){return Qe.cross(e.array,t.array,r.array),e._dirty=!0,e},ct.distance=ct.dist=function(e,t){return Qe.distance(e.array,t.array)},ct.divide=ct.div=function(e,t,r){return Qe.divide(e.array,t.array,r.array),e._dirty=!0,e},ct.dot=function(e,t){return Qe.dot(e.array,t.array)},ct.len=function(e){return Qe.length(e.array)},ct.lerp=function(e,t,r,i){return Qe.lerp(e.array,t.array,r.array,i),e._dirty=!0,e},ct.min=function(e,t,r){return Qe.min(e.array,t.array,r.array),e._dirty=!0,e},ct.max=function(e,t,r){return Qe.max(e.array,t.array,r.array),e._dirty=!0,e},ct.multiply=ct.mul=function(e,t,r){return Qe.multiply(e.array,t.array,r.array),e._dirty=!0,e},ct.negate=function(e,t){return Qe.negate(e.array,t.array),e._dirty=!0,e},ct.normalize=function(e,t){return Qe.normalize(e.array,t.array),e._dirty=!0,e},ct.random=function(e,t){return Qe.random(e.array,t),e._dirty=!0,e},ct.scale=function(e,t,r){return Qe.scale(e.array,t.array,r),e._dirty=!0,e},ct.scaleAndAdd=function(e,t,r,i){return Qe.scaleAndAdd(e.array,t.array,r.array,i),e._dirty=!0,e},ct.squaredDistance=ct.sqrDist=function(e,t){return Qe.sqrDist(e.array,t.array)},ct.squaredLength=ct.sqrLen=function(e){return Qe.sqrLen(e.array)},ct.subtract=ct.sub=function(e,t,r){return Qe.subtract(e.array,t.array,r.array),e._dirty=!0,e},ct.transformMat3=function(e,t,r){return Qe.transformMat3(e.array,t.array,r.array),e._dirty=!0,e},ct.transformMat4=function(e,t,r){return Qe.transformMat4(e.array,t.array,r.array),e._dirty=!0,e},ct.transformQuat=function(e,t,r){return Qe.transformQuat(e.array,t.array,r.array),e._dirty=!0,e};var mt=Math.atan2,gt=Math.asin,_t=Math.abs;ct.eulerFromQuat=function(e,t,r){e._dirty=!0,t=t.array;var i=e.array,n=t[0],a=t[1],o=t[2],s=t[3],l=n*n,h=a*a,u=o*o,c=s*s;switch(r=(r||"XYZ").toUpperCase()){case"XYZ":i[0]=mt(2*(n*s-a*o),c-l-h+u),i[1]=gt(pt(2*(n*o+a*s),-1,1)),i[2]=mt(2*(o*s-n*a),c+l-h-u);break;case"YXZ":i[0]=gt(pt(2*(n*s-a*o),-1,1)),i[1]=mt(2*(n*o+a*s),c-l-h+u),i[2]=mt(2*(n*a+o*s),c-l+h-u);break;case"ZXY":i[0]=gt(pt(2*(n*s+a*o),-1,1)),i[1]=mt(2*(a*s-o*n),c-l-h+u),i[2]=mt(2*(o*s-n*a),c-l+h-u);break;case"ZYX":i[0]=mt(2*(n*s+o*a),c-l-h+u),i[1]=gt(pt(2*(a*s-n*o),-1,1)),i[2]=mt(2*(n*a+o*s),c+l-h-u);break;case"YZX":i[0]=mt(2*(n*s-o*a),c-l+h-u),i[1]=mt(2*(a*s-n*o),c+l-h-u),i[2]=gt(pt(2*(n*a+o*s),-1,1));break;case"XZY":i[0]=mt(2*(n*s+a*o),c-l+h-u),i[1]=mt(2*(n*o+a*s),c+l-h-u),i[2]=gt(pt(2*(o*s-n*a),-1,1));break;default:console.warn("Unkown order: "+r)}return e},ct.eulerFromMat3=function(e,t,r){var i=t.array,n=i[0],a=i[3],o=i[6],s=i[1],l=i[4],h=i[7],u=i[2],c=i[5],d=i[8],f=e.array;switch(r=(r||"XYZ").toUpperCase()){case"XYZ":f[1]=gt(pt(o,-1,1)),_t(o)<.99999?(f[0]=mt(-h,d),f[2]=mt(-a,n)):(f[0]=mt(c,l),f[2]=0);break;case"YXZ":f[0]=gt(-pt(h,-1,1)),_t(h)<.99999?(f[1]=mt(o,d),f[2]=mt(s,l)):(f[1]=mt(-u,n),f[2]=0);break;case"ZXY":f[0]=gt(pt(c,-1,1)),_t(c)<.99999?(f[1]=mt(-u,d),f[2]=mt(-a,l)):(f[1]=0,f[2]=mt(s,n));break;case"ZYX":f[1]=gt(-pt(u,-1,1)),_t(u)<.99999?(f[0]=mt(c,d),f[2]=mt(s,n)):(f[0]=0,f[2]=mt(-a,l));break;case"YZX":f[2]=gt(pt(s,-1,1)),_t(s)<.99999?(f[0]=mt(-h,l),f[1]=mt(-u,n)):(f[0]=0,f[1]=mt(o,d));break;case"XZY":f[2]=gt(-pt(a,-1,1)),_t(a)<.99999?(f[0]=mt(c,l),f[1]=mt(o,n)):(f[0]=mt(-h,d),f[1]=0);break;default:console.warn("Unkown order: "+r)}return e._dirty=!0,e},Object.defineProperties(ct,{POSITIVE_X:{get:function(){return new ct(1,0,0)}},NEGATIVE_X:{get:function(){return new ct(-1,0,0)}},POSITIVE_Y:{get:function(){return new ct(0,1,0)}},NEGATIVE_Y:{get:function(){return new ct(0,-1,0)}},POSITIVE_Z:{get:function(){return new ct(0,0,1)}},NEGATIVE_Z:{get:function(){return new ct(0,0,-1)}},UP:{get:function(){return new ct(0,1,0)}},ZERO:{get:function(){return new ct}}});const vt=ct;var yt,xt,bt,wt,Tt,St=function(e,t){this.origin=e||new vt,this.direction=t||new vt};St.prototype={constructor:St,intersectPlane:function(e,t){var r=e.normal.array,i=e.distance,n=this.origin.array,a=this.direction.array,o=Qe.dot(r,a);if(0===o)return null;t||(t=new vt);var s=(Qe.dot(r,n)-i)/o;return Qe.scaleAndAdd(t.array,n,a,-s),t._dirty=!0,t},mirrorAgainstPlane:function(e){var t=Qe.dot(e.normal.array,this.direction.array);Qe.scaleAndAdd(this.direction.array,this.direction.array,e.normal.array,2*-t),this.direction._dirty=!0},distanceToPoint:(Tt=Qe.create(),function(e){Qe.sub(Tt,e,this.origin.array);var t=Qe.dot(Tt,this.direction.array);if(t<0)return Qe.distance(this.origin.array,e);var r=Qe.lenSquared(Tt);return Math.sqrt(r-t*t)}),intersectSphere:function(){var e=Qe.create();return function(t,r,i){var n=this.origin.array,a=this.direction.array;t=t.array,Qe.sub(e,t,n);var o=Qe.dot(e,a),s=Qe.squaredLength(e)-o*o,l=r*r;if(!(s>l)){var h=Math.sqrt(l-s),u=o-h,c=o+h;return i||(i=new vt),u<0?c<0?null:(Qe.scaleAndAdd(i.array,n,a,c),i):(Qe.scaleAndAdd(i.array,n,a,u),i)}}}(),intersectBoundingBox:function(e,t){var r,i,n,a,o,s,l=this.direction.array,h=this.origin.array,u=e.min.array,c=e.max.array,d=1/l[0],f=1/l[1],p=1/l[2];if(d>=0?(r=(u[0]-h[0])*d,i=(c[0]-h[0])*d):(i=(u[0]-h[0])*d,r=(c[0]-h[0])*d),f>=0?(n=(u[1]-h[1])*f,a=(c[1]-h[1])*f):(a=(u[1]-h[1])*f,n=(c[1]-h[1])*f),r>a||n>i)return null;if((n>r||r!=r)&&(r=n),(a=0?(o=(u[2]-h[2])*p,s=(c[2]-h[2])*p):(s=(u[2]-h[2])*p,o=(c[2]-h[2])*p),r>s||o>i)return null;if((o>r||r!=r)&&(r=o),(s=0?r:i;return t||(t=new vt),Qe.scaleAndAdd(t.array,h,l,m),t},intersectTriangle:(yt=Qe.create(),xt=Qe.create(),bt=Qe.create(),wt=Qe.create(),function(e,t,r,i,n,a){var o=this.direction.array,s=this.origin.array;e=e.array,t=t.array,r=r.array,Qe.sub(yt,t,e),Qe.sub(xt,r,e),Qe.cross(wt,xt,o);var l=Qe.dot(yt,wt);if(i){if(l>-1e-5)return null}else if(l>-1e-5&&l<1e-5)return null;Qe.sub(bt,s,e);var h=Qe.dot(wt,bt)/l;if(h<0||h>1)return null;Qe.cross(wt,yt,bt);var u=Qe.dot(o,wt)/l;if(u<0||u>1||h+u>1)return null;Qe.cross(wt,yt,xt);var c=-Qe.dot(bt,wt)/l;return c<0?null:(n||(n=new vt),a&&vt.set(a,1-h-u,h,u),Qe.scaleAndAdd(n.array,s,o,c),n)}),applyTransform:function(e){vt.add(this.direction,this.direction,this.origin),vt.transformMat4(this.origin,this.origin,e),vt.transformMat4(this.direction,this.direction,e),vt.sub(this.direction,this.direction,this.origin),vt.normalize(this.direction,this.direction)},copy:function(e){vt.copy(this.origin,e.origin),vt.copy(this.direction,e.direction)},clone:function(){var e=new St;return e.copy(this),e}};const Mt=St;var At={create:function(){var e=new ce(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},clone:function(e){var t=new ce(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},fromValues:function(e,t,r,i){var n=new ce(4);return n[0]=e,n[1]=t,n[2]=r,n[3]=i,n},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},set:function(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},subtract:function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}};At.sub=At.subtract,At.multiply=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e},At.mul=At.multiply,At.divide=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e},At.div=At.divide,At.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e},At.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e},At.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},At.scaleAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e},At.distance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(r*r+i*i+n*n+a*a)},At.dist=At.distance,At.squaredDistance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return r*r+i*i+n*n+a*a},At.sqrDist=At.squaredDistance,At.length=function(e){var t=e[0],r=e[1],i=e[2],n=e[3];return Math.sqrt(t*t+r*r+i*i+n*n)},At.len=At.length,At.squaredLength=function(e){var t=e[0],r=e[1],i=e[2],n=e[3];return t*t+r*r+i*i+n*n},At.sqrLen=At.squaredLength,At.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},At.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},At.normalize=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e[3]=t[3]*o),e},At.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},At.lerp=function(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=t[3];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e[3]=s+i*(r[3]-s),e},At.random=function(e,t){return t=t||1,e[0]=de(),e[1]=de(),e[2]=de(),e[3]=de(),At.normalize(e,e),At.scale(e,e,t),e},At.transformMat4=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*o,e[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*o,e[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*o,e[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*o,e},At.transformQuat=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2],h=r[3],u=h*i+s*a-l*n,c=h*n+l*i-o*a,d=h*a+o*n-s*i,f=-o*i-s*n-l*a;return e[0]=u*h+f*-o+c*-l-d*-s,e[1]=c*h+f*-s+d*-o-u*-l,e[2]=d*h+f*-l+u*-s-c*-o,e},At.forEach=function(){var e=At.create();return function(t,r,i,n,a,o){var s,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Qe.cross(Lt,t,r),e[0]=Lt[0],e[1]=Lt[1],e[2]=Lt[2],e[3]=1+i,It.normalize(e,e))}),It.setAxes=(Nt=Dt.create(),function(e,t,r,i){return Nt[0]=r[0],Nt[3]=r[1],Nt[6]=r[2],Nt[1]=i[0],Nt[4]=i[1],Nt[7]=i[2],Nt[2]=-t[0],Nt[5]=-t[1],Nt[8]=-t[2],It.normalize(e,It.fromMat3(e,Nt))}),It.clone=Et.clone,It.fromValues=Et.fromValues,It.copy=Et.copy,It.set=Et.set,It.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},It.setAxisAngle=function(e,t,r){r*=.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e},It.add=Et.add,It.multiply=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],h=r[2],u=r[3];return e[0]=i*u+o*s+n*h-a*l,e[1]=n*u+o*l+a*s-i*h,e[2]=a*u+o*h+i*l-n*s,e[3]=o*u-i*s-n*l-a*h,e},It.mul=It.multiply,It.scale=Et.scale,It.rotateX=function(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-i*s,e},It.rotateY=function(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l-a*s,e[1]=n*l+o*s,e[2]=a*l+i*s,e[3]=o*l-n*s,e},It.rotateZ=function(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*s,e[1]=n*l-i*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e},It.calculateW=function(e,t){var r=t[0],i=t[1],n=t[2];return e[0]=r,e[1]=i,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),e},It.dot=Et.dot,It.lerp=Et.lerp,It.slerp=function(e,t,r,i){var n,a,o,s,l,h=t[0],u=t[1],c=t[2],d=t[3],f=r[0],p=r[1],m=r[2],g=r[3];return(a=h*f+u*p+c*m+d*g)<0&&(a=-a,f=-f,p=-p,m=-m,g=-g),1-a>1e-6?(n=Math.acos(a),o=Math.sin(n),s=Math.sin((1-i)*n)/o,l=Math.sin(i*n)/o):(s=1-i,l=i),e[0]=s*h+l*f,e[1]=s*u+l*p,e[2]=s*c+l*m,e[3]=s*d+l*g,e},It.invert=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-i*s,e[2]=-n*s,e[3]=a*s,e},It.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},It.length=Et.length,It.len=It.length,It.squaredLength=Et.squaredLength,It.sqrLen=It.squaredLength,It.normalize=Et.normalize,It.fromMat3=function(e,t){var r,i=t[0]+t[4]+t[8];if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[3*n+n]&&(n=2);var a=(n+1)%3,o=(n+2)%3;r=Math.sqrt(t[3*n+n]-t[3*a+a]-t[3*o+o]+1),e[n]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+n]+t[3*n+a])*r,e[o]=(t[3*o+n]+t[3*n+o])*r}return e};const Rt=It;var Bt,Ft,zt,Gt,Ut=function(){this._axisX=new vt,this._axisY=new vt,this._axisZ=new vt,this.array=Ye.create(),this._dirty=!0};Ut.prototype={constructor:Ut,setArray:function(e){for(var t=0;t0){var t=this.min,r=this.max,i=t.array,n=r.array;tr(i,e[0]),tr(n,e[0]);for(var a=1;an[0]&&(n[0]=o[0]),o[1]>n[1]&&(n[1]=o[1]),o[2]>n[2]&&(n[2]=o[2])}t._dirty=!0,r._dirty=!0}},union:function(e){var t=this.min,r=this.max;return Qe.min(t.array,t.array,e.min.array),Qe.max(r.array,r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},intersection:function(e){var t=this.min,r=this.max;return Qe.max(t.array,t.array,e.min.array),Qe.min(r.array,r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},intersectBoundingBox:function(e){var t=this.min.array,r=this.max.array,i=e.min.array,n=e.max.array;return!(t[0]>n[0]||t[1]>n[1]||t[2]>n[2]||r[0]=n[0]&&r[1]>=n[1]&&r[2]>=n[2]},containPoint:function(e){var t=this.min.array,r=this.max.array,i=e.array;return t[0]<=i[0]&&t[1]<=i[1]&&t[2]<=i[2]&&r[0]>=i[0]&&r[1]>=i[1]&&r[2]>=i[2]},isFinite:function(){var e=this.min.array,t=this.max.array;return isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])&&isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])},applyTransform:function(e){this.transformFrom(this,e)},transformFrom:(Zt=Qe.create(),Yt=Qe.create(),Kt=Qe.create(),Qt=Qe.create(),Jt=Qe.create(),$t=Qe.create(),function(e,t){var r=e.min.array,i=e.max.array,n=t.array;return Zt[0]=n[0]*r[0],Zt[1]=n[1]*r[0],Zt[2]=n[2]*r[0],Yt[0]=n[0]*i[0],Yt[1]=n[1]*i[0],Yt[2]=n[2]*i[0],Kt[0]=n[4]*r[1],Kt[1]=n[5]*r[1],Kt[2]=n[6]*r[1],Qt[0]=n[4]*i[1],Qt[1]=n[5]*i[1],Qt[2]=n[6]*i[1],Jt[0]=n[8]*r[2],Jt[1]=n[9]*r[2],Jt[2]=n[10]*r[2],$t[0]=n[8]*i[2],$t[1]=n[9]*i[2],$t[2]=n[10]*i[2],r=this.min.array,i=this.max.array,r[0]=Math.min(Zt[0],Yt[0])+Math.min(Kt[0],Qt[0])+Math.min(Jt[0],$t[0])+n[12],r[1]=Math.min(Zt[1],Yt[1])+Math.min(Kt[1],Qt[1])+Math.min(Jt[1],$t[1])+n[13],r[2]=Math.min(Zt[2],Yt[2])+Math.min(Kt[2],Qt[2])+Math.min(Jt[2],$t[2])+n[14],i[0]=Math.max(Zt[0],Yt[0])+Math.max(Kt[0],Qt[0])+Math.max(Jt[0],$t[0])+n[12],i[1]=Math.max(Zt[1],Yt[1])+Math.max(Kt[1],Qt[1])+Math.max(Jt[1],$t[1])+n[13],i[2]=Math.max(Zt[2],Yt[2])+Math.max(Kt[2],Qt[2])+Math.max(Jt[2],$t[2])+n[14],this.min._dirty=!0,this.max._dirty=!0,this}),applyProjection:function(e){var t=this.min.array,r=this.max.array,i=e.array,n=t[0],a=t[1],o=t[2],s=r[0],l=r[1],h=t[2],u=r[0],c=r[1],d=r[2];if(1===i[15])t[0]=i[0]*n+i[12],t[1]=i[5]*a+i[13],r[2]=i[10]*o+i[14],r[0]=i[0]*u+i[12],r[1]=i[5]*c+i[13],t[2]=i[10]*d+i[14];else{var f=-1/o;t[0]=i[0]*n*f,t[1]=i[5]*a*f,r[2]=(i[10]*o+i[14])*f,f=-1/h,r[0]=i[0]*s*f,r[1]=i[5]*l*f,f=-1/d,t[2]=(i[10]*d+i[14])*f}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var e=this.vertices;if(!e){e=[];for(var t=0;t<8;t++)e[t]=Qe.fromValues(0,0,0);this.vertices=e}var r=this.min.array,i=this.max.array;return er(e[0],r[0],r[1],r[2]),er(e[1],r[0],i[1],r[2]),er(e[2],i[0],r[1],r[2]),er(e[3],i[0],i[1],r[2]),er(e[4],r[0],r[1],i[2]),er(e[5],r[0],i[1],i[2]),er(e[6],i[0],r[1],i[2]),er(e[7],i[0],i[1],i[2]),this},copy:function(e){var t=this.min,r=this.max;return tr(t.array,e.min.array),tr(r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},clone:function(){var e=new rr;return e.copy(this),e}};const ir=rr;var nr,ar,or=0;const sr=m.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},(function(){this.name||(this.name=(this.type||"NODE")+"_"+or++),this.position||(this.position=new vt),this.rotation||(this.rotation=new qt),this.scale||(this.scale=new vt(1,1,1)),this.worldTransform=new Ht,this.localTransform=new Ht,this._children=[]}),{target:null,invisible:!1,isSkinnedMesh:function(){return!1},isRenderable:function(){return!1},setName:function(e){var t=this._scene;if(t){var r=t._nodeRepository;delete r[this.name],r[e]=this}this.name=e},add:function(e){var t=e._parent;if(t!==this){t&&t.remove(e),e._parent=this,this._children.push(e);var r=this._scene;r&&r!==e.scene&&e.traverse(this._addSelfToScene,this),e._needsUpdateWorldTransform=!0}},remove:function(e){var t=this._children,r=t.indexOf(e);r<0||(t.splice(r,1),e._parent=null,this._scene&&e.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var e=this._children,t=0;t0},beforeRender:function(e){},afterRender:function(e,t){},getBoundingBox:function(e,t){return t=sr.prototype.getBoundingBox.call(this,e,t),this.geometry&&this.geometry.boundingBox&&t.union(this.geometry.boundingBox),t},clone:(lr=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"],function(){var e=sr.prototype.clone.call(this);e.geometry=this.geometry,e.material=this.material;for(var t=0;t=0&&g[p]>1e-4&&(Qe.transformMat4(T,m,d[_[p]]),Qe.scaleAndAdd(v,v,T,g[p]));S.set(f,v)}}for(f=0;f>t;return e+1},dispose:function(e){var t=this._cache;t.use(e.__uid__);var r=t.get("webgl_texture");r&&e.gl.deleteTexture(r),t.deleteContext(e.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty(br.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e}}),Object.defineProperty(br.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e}}),br.BYTE=5120,br.UNSIGNED_BYTE=T,br.SHORT=5122,br.UNSIGNED_SHORT=5123,br.INT=5124,br.UNSIGNED_INT=5125,br.FLOAT=S,br.HALF_FLOAT=36193,br.UNSIGNED_INT_24_8_WEBGL=34042,br.DEPTH_COMPONENT=M,br.DEPTH_STENCIL=34041,br.ALPHA=6406,br.RGB=6407,br.RGBA=A,br.LUMINANCE=6409,br.LUMINANCE_ALPHA=6410,br.SRGB=35904,br.SRGB_ALPHA=35906,br.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,br.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,br.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,br.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,br.NEAREST=E,br.LINEAR=C,br.NEAREST_MIPMAP_NEAREST=D,br.LINEAR_MIPMAP_NEAREST=L,br.NEAREST_MIPMAP_LINEAR=P,br.LINEAR_MIPMAP_LINEAR=O,br.REPEAT=N,br.CLAMP_TO_EDGE=I,br.MIRRORED_REPEAT=33648;const wr=br;var Tr=ur.extend({skeleton:null,joints:null},(function(){this.joints||(this.joints=[])}),{offsetMatrix:null,isInstancedMesh:function(){return!1},isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var e=ur.prototype.clone.call(this);return e.skeleton=this.skeleton,this.joints&&(e.joints=this.joints.slice()),e}});Tr.POINTS=0,Tr.LINES=1,Tr.LINE_LOOP=2,Tr.LINE_STRIP=3,Tr.TRIANGLES=4,Tr.TRIANGLE_STRIP=5,Tr.TRIANGLE_FAN=6,Tr.BACK=x,Tr.FRONT=y,Tr.FRONT_AND_BACK=1032,Tr.CW=b,Tr.CCW=w;const Sr=Tr;const Mr={isPowerOfTwo:function(e){return 0==(e&e-1)},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}};var Ar=Mr.isPowerOfTwo;function Er(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}var Cr=wr.extend((function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}}),{textureType:"texture2D",update:function(e){var t=e.gl;t.bindTexture(t.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(e);var r=this.format,i=this.type,n=!(!this.convertToPOT||this.mipmaps.length||!this.image||this.wrapS!==wr.REPEAT&&this.wrapT!==wr.REPEAT||!this.NPOT);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,n?this.wrapS:this.getAvailableWrapS()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,n?this.wrapT:this.getAvailableWrapT()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n?this.magFilter:this.getAvailableMagFilter()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n?this.minFilter:this.getAvailableMinFilter());var a=e.getGLExtension("EXT_texture_filter_anisotropic");if(a&&this.anisotropic>1&&t.texParameterf(t.TEXTURE_2D,a.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i&&(e.getGLExtension("OES_texture_half_float")||(i=S)),this.mipmaps.length)for(var o=this.width,s=this.height,l=0;l=wr.COMPRESSED_RGB_S3TC_DXT1_EXT?e.compressedTexImage2D(e.TEXTURE_2D,r,a,i,n,0,t.pixels):e.texImage2D(e.TEXTURE_2D,r,a,i,n,0,a,o,t.pixels)},generateMipmap:function(e){var t=e.gl;this.useMipmap&&!this.NPOT&&(t.bindTexture(t.TEXTURE_2D,this._cache.get("webgl_texture")),t.generateMipmap(t.TEXTURE_2D))},isPowerOfTwo:function(){return Ar(this.width)&&Ar(this.height)},isRenderable:function(){return this.image?this.image.width>0&&this.image.height>0:!(!this.width||!this.height)},bind:function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,this.getWebGLTexture(e))},unbind:function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,null)},load:function(e,t){var r=U.createImage();t&&(r.crossOrigin=t);var i=this;return r.onload=function(){i.dirty(),i.trigger("success",i)},r.onerror=function(){i.trigger("error",i)},r.src=e,this.image=r,this}});Object.defineProperty(Cr.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(e){this.image?console.warn("Texture from image can't set width"):(this._width!==e&&this.dirty(),this._width=e)}}),Object.defineProperty(Cr.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(e){this.image?console.warn("Texture from image can't set height"):(this._height!==e&&this.dirty(),this._height=e)}});const Dr=Cr;function Lr(e){return{byte:U.Int8Array,ubyte:U.Uint8Array,short:U.Int16Array,ushort:U.Uint16Array}[e]||U.Float32Array}function Pr(e){return"attr_"+e}function Or(e,t,r,i){switch(this.name=e,this.type=t,this.size=r,this.semantic=i||"",this.value=null,r){case 1:this.get=function(e){return this.value[e]},this.set=function(e,t){this.value[e]=t},this.copy=function(e,t){this.value[e]=this.value[e]};break;case 2:this.get=function(e,t){var r=this.value;return t[0]=r[2*e],t[1]=r[2*e+1],t},this.set=function(e,t){var r=this.value;r[2*e]=t[0],r[2*e+1]=t[1]},this.copy=function(e,t){var r=this.value;t*=2,r[e*=2]=r[t],r[e+1]=r[t+1]};break;case 3:this.get=function(e,t){var r=3*e,i=this.value;return t[0]=i[r],t[1]=i[r+1],t[2]=i[r+2],t},this.set=function(e,t){var r=3*e,i=this.value;i[r]=t[0],i[r+1]=t[1],i[r+2]=t[2]},this.copy=function(e,t){var r=this.value;t*=3,r[e*=3]=r[t],r[e+1]=r[t+1],r[e+2]=r[t+2]};break;case 4:this.get=function(e,t){var r=this.value,i=4*e;return t[0]=r[i],t[1]=r[i+1],t[2]=r[i+2],t[3]=r[i+3],t},this.set=function(e,t){var r=this.value,i=4*e;r[i]=t[0],r[i+1]=t[1],r[i+2]=t[2],r[i+3]=t[3]},this.copy=function(e,t){var r=this.value;t*=4,r[e*=4]=r[t],r[e+1]=r[t+1],r[e+2]=r[t+2],r[e+3]=r[t+3]}}}function Nr(e,t,r,i,n){this.name=e,this.type=t,this.buffer=r,this.size=i,this.semantic=n,this.symbol="",this.needsRemove=!1}function Ir(e){this.buffer=e,this.count=0}Or.prototype.init=function(e){if(!this.value||this.value.length!==e*this.size){var t=Lr(this.type);this.value=new t(e*this.size)}},Or.prototype.fromArray=function(e){var t,r=Lr(this.type);if(e[0]&&e[0].length){var i=0,n=this.size;t=new r(e.length*n);for(var a=0;a=0){t||(t=[]);var r=this.indices;return t[0]=r[3*e],t[1]=r[3*e+1],t[2]=r[3*e+2],t}},setTriangleIndices:function(e,t){var r=this.indices;r[3*e]=t[0],r[3*e+1]=t[1],r[3*e+2]=t[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(e){var t,r=this.vertexCount>65535?U.Uint32Array:U.Uint16Array;if(e[0]&&e[0].length){var i=0;t=new r(3*e.length);for(var n=0;n=0&&(t.splice(r,1),delete this.attributes[e],!0)},getAttribute:function(e){return this.attributes[e]},getEnabledAttributes:function(){var e=this._enabledAttributes,t=this._attributeList;if(e)return e;for(var r=[],i=this.vertexCount,n=0;na[0]&&(a[0]=s),l>a[1]&&(a[1]=l),h>a[2]&&(a[2]=h)}r._dirty=!0,i._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var e=this.indices,t=this.attributes,r=t.position.value,i=t.normal.value;if(i&&i.length===r.length)for(var n=0;n65535&&(this.indices=new U.Uint32Array(this.indices));for(var e=this.attributes,t=this.indices,r=this.getEnabledAttributes(),i={},n=0;nthis.distance,n=1;n<8;n++)if(Qe.dot(t[n].array,r)>this.distance!=i)return!0},intersectLine:(Qr=Qe.create(),function(e,t,r){var i=this.distanceToPoint(e),n=this.distanceToPoint(t);if(i>0&&n>0||i<0&&n<0)return null;var a=this.normal.array,o=this.distance,s=e.array;Qe.sub(Qr,t.array,e.array),Qe.normalize(Qr,Qr);var l=Qe.dot(a,Qr);if(0===l)return null;r||(r=new vt);var h=(Qe.dot(a,s)-o)/l;return Qe.scaleAndAdd(r.array,s,Qr,-h),r._dirty=!0,r}),applyTransform:(Zr=Ye.create(),Yr=Et.create(),Kr=Et.create(),Kr[3]=1,function(e){e=e.array,Qe.scale(Kr,this.normal.array,this.distance),Et.transformMat4(Kr,Kr,e),this.distance=Qe.dot(Kr,this.normal.array),Ye.invert(Zr,e),Ye.transpose(Zr,Zr),Yr[3]=0,Qe.copy(Yr,this.normal.array),Et.transformMat4(Yr,Yr,Zr),Qe.copy(this.normal.array,Yr)}),copy:function(e){Qe.copy(this.normal.array,e.normal.array),this.normal._dirty=!0,this.distance=e.distance},clone:function(){var e=new Jr;return e.copy(this),e}};const $r=Jr;var ei,ti=Qe.set,ri=Qe.copy,ii=Qe.transformMat4,ni=Math.min,ai=Math.max,oi=function(){this.planes=[];for(var e=0;e<6;e++)this.planes.push(new $r);for(this.boundingBox=new ir,this.vertices=[],e=0;e<8;e++)this.vertices[e]=Qe.fromValues(0,0,0)};oi.prototype={setFromProjection:function(e){var t=this.planes,r=e.array,i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],l=r[5],h=r[6],u=r[7],c=r[8],d=r[9],f=r[10],p=r[11],m=r[12],g=r[13],_=r[14],v=r[15];ti(t[0].normal.array,o-i,u-s,p-c),t[0].distance=-(v-m),t[0].normalize(),ti(t[1].normal.array,o+i,u+s,p+c),t[1].distance=-(v+m),t[1].normalize(),ti(t[2].normal.array,o+n,u+l,p+d),t[2].distance=-(v+g),t[2].normalize(),ti(t[3].normal.array,o-n,u-l,p-d),t[3].distance=-(v-g),t[3].normalize(),ti(t[4].normal.array,o-a,u-h,p-f),t[4].distance=-(v-_),t[4].normalize(),ti(t[5].normal.array,o+a,u+h,p+f),t[5].distance=-(v+_),t[5].normalize();var y=this.boundingBox,x=this.vertices;if(0===v){var b=l/i,w=-_/(f-1),T=-_/(f+1),S=-T/l,M=-w/l;y.min.set(-S*b,-S,T),y.max.set(S*b,S,w),ti(x[0],-S*b,-S,T),ti(x[1],-S*b,S,T),ti(x[2],S*b,-S,T),ti(x[3],S*b,S,T),ti(x[4],-M*b,-M,w),ti(x[5],-M*b,M,w),ti(x[6],M*b,-M,w),ti(x[7],M*b,M,w)}else{var A=(-1-m)/i,E=(1-m)/i,C=(1-g)/l,D=(-1-g)/l,L=(-1-_)/f,P=(1-_)/f;y.min.set(Math.min(A,E),Math.min(D,C),Math.min(P,L)),y.max.set(Math.max(E,A),Math.max(C,D),Math.max(L,P));var O=y.min.array,N=y.max.array;ti(x[0],O[0],O[1],O[2]),ti(x[1],O[0],N[1],O[2]),ti(x[2],N[0],O[1],O[2]),ti(x[3],N[0],N[1],O[2]),ti(x[4],O[0],O[1],N[2]),ti(x[5],O[0],N[1],N[2]),ti(x[6],N[0],O[1],N[2]),ti(x[7],N[0],N[1],N[2])}},getTransformedBoundingBox:(ei=Qe.create(),function(e,t){var r=this.vertices,i=t.array,n=e.min,a=e.max,o=n.array,s=a.array,l=r[0];ii(ei,l,i),ri(o,ei),ri(s,ei);for(var h=1;h<8;h++)l=r[h],ii(ei,l,i),o[0]=ni(ei[0],o[0]),o[1]=ni(ei[1],o[1]),o[2]=ni(ei[2],o[2]),s[0]=ai(ei[0],s[0]),s[1]=ai(ei[1],s[1]),s[2]=ai(ei[2],s[2]);return n._dirty=!0,a._dirty=!0,e})};const si=oi;var li;const hi=sr.extend((function(){return{projectionMatrix:new Ht,invProjectionMatrix:new Ht,viewMatrix:new Ht,frustum:new si}}),(function(){this.update(!0)}),{update:function(e){sr.prototype.update.call(this,e),Ht.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),Ht.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(e){Ht.copy(this.viewMatrix,e),Ht.invert(this.worldTransform,e),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(e){Ht.copy(this.projectionMatrix,e),Ht.invert(this.invProjectionMatrix,e),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:(li=Et.create(),function(e,t){var r=void 0!==t?t:new Mt,i=e.array[0],n=e.array[1];return Et.set(li,i,n,-1,1),Et.transformMat4(li,li,this.invProjectionMatrix.array),Et.transformMat4(li,li,this.worldTransform.array),Qe.scale(r.origin.array,li,1/li[3]),Et.set(li,i,n,1,1),Et.transformMat4(li,li,this.invProjectionMatrix.array),Et.transformMat4(li,li,this.worldTransform.array),Qe.scale(li,li,1/li[3]),Qe.sub(r.direction.array,li,r.origin.array),Qe.normalize(r.direction.array,r.direction.array),r.direction._dirty=!0,r.origin._dirty=!0,r})});var ui,ci,di=Ye.create(),fi=Ye.create(),pi={};function mi(e){var t=[],r=Object.keys(e);r.sort();for(var i=0;i0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(e)):e instanceof qr&&this.lights.push(e),e.name&&(this._nodeRepository[e.name]=e)},removeFromScene:function(e){var t;e instanceof hi?(t=this._cameraList.indexOf(e))>=0&&this._cameraList.splice(t,1):e instanceof qr&&(t=this.lights.indexOf(e))>=0&&this.lights.splice(t,1),e.name&&delete this._nodeRepository[e.name]},getNode:function(e){return this._nodeRepository[e]},setMainCamera:function(e){var t=this._cameraList.indexOf(e);t>=0&&this._cameraList.splice(t,1),this._cameraList.unshift(e)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var e=this.lights;this._previousLightNumber=this._lightNumber;for(var t={},r=0;r0&&this._doUpdateRenderList(o,t,r,i,n)}},isFrustumCulled:(ui=new ir,ci=new Ht,function(e,t,r){var i=e.boundingBox;if(i||(i=e.skeleton&&e.skeleton.boundingBox?e.skeleton.boundingBox:e.geometry.boundingBox),!i)return!1;if(ci.array=r,ui.transformFrom(i,ci),e.castShadow&&this.viewBoundingBoxLastFrame.union(ui),e.frustumCulling){if(!ui.intersectBoundingBox(t.frustum.boundingBox))return!0;ci.array=t.projectionMatrix.array,ui.max.array[2]>0&&ui.min.array[2]<0&&(ui.max.array[2]=-1e-20),ui.applyProjection(ci);var n=ui.min.array,a=ui.max.array;if(a[0]<-1||n[0]>1||a[1]<-1||n[1]>1||a[2]<-1||n[2]>1)return!0}return!1}),_updateLightUniforms:function(){var e=this.lights;e.sort(_i);var t=this._lightUniforms;for(var r in t)for(var i in t[r])t[r][i].value.length=0;for(var n=0;n=this._maxSize&&a>0){var s=r.head;r.remove(s),delete i[s.key],n=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new yi(t),o.key=e,r.insertEntry(o),i[e]=o}return n},e.prototype.get=function(e){var t=this._map[e],r=this._list;if(null!=t)return t!==r.tail&&(r.remove(t),r.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}();var wi=Mr.isPowerOfTwo,Ti=["px","nx","py","ny","pz","nz"],Si=wr.extend((function(){return{image:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},pixels:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},mipmaps:[]}}),{textureType:"textureCube",update:function(e){var t=e.gl;t.bindTexture(t.TEXTURE_CUBE_MAP,this._cache.get("webgl_texture")),this.updateCommon(e);var r=this.format,i=this.type;t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,this.getAvailableWrapS()),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,this.getAvailableWrapT()),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,this.getAvailableMagFilter()),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,this.getAvailableMinFilter());var n=e.getGLExtension("EXT_texture_filter_anisotropic");if(n&&this.anisotropic>1&&t.texParameterf(t.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i&&(e.getGLExtension("OES_texture_half_float")||(i=S)),this.mipmaps.length)for(var a=this.width,o=this.height,s=0;s0&&e.height>0}Object.defineProperty(Si.prototype,"width",{get:function(){return this.image&&this.image.px?this.image.px.width:this._width},set:function(e){this.image&&this.image.px?console.warn("Texture from image can't set width"):(this._width!==e&&this.dirty(),this._width=e)}}),Object.defineProperty(Si.prototype,"height",{get:function(){return this.image&&this.image.px?this.image.px.height:this._height},set:function(e){this.image&&this.image.px?console.warn("Texture from image can't set height"):(this._height!==e&&this.dirty(),this._height=e)}});const Ai=Si,Ei=hi.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var e=this.fov/180*Math.PI;this.projectionMatrix.perspective(e,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var e=this.projectionMatrix.array,t=2*Math.atan(1/e[5]);this.fov=t/Math.PI*180,this.aspect=e[5]/e[0],this.near=e[14]/(e[10]-1),this.far=e[14]/(e[10]+1)},clone:function(){var e=hi.prototype.clone.call(this);return e.fov=this.fov,e.aspect=this.aspect,e.near=this.near,e.far=this.far,e}});var Ci="framebuffer",Di="renderbuffer",Li="renderbuffer_width",Pi="renderbuffer_height",Oi="renderbuffer_attached",Ni="depthtexture_attached",Ii=36160,Ri=36161,Bi=36096,Fi=m.extend({depthBuffer:!0,viewport:null,_width:0,_height:0,_textures:null,_boundRenderer:null},(function(){this._cache=new xr,this._textures={}}),{getTextureWidth:function(){return this._width},getTextureHeight:function(){return this._height},bind:function(e){if(e.__currentFrameBuffer){if(e.__currentFrameBuffer===this)return;console.warn("Renderer already bound with another framebuffer. Unbind it first")}e.__currentFrameBuffer=this;var t=e.gl;t.bindFramebuffer(Ii,this._getFrameBufferGL(e)),this._boundRenderer=e;var r=this._cache;r.put("viewport",e.viewport);var i,n,a=!1;for(var o in this._textures){a=!0;var s=this._textures[o];s&&(i=s.texture.width,n=s.texture.height,this._doAttach(e,s.texture,o,s.target))}this._width=i,this._height=n,!a&&this.depthBuffer&&console.error("Must attach texture before bind, or renderbuffer may have incorrect width and height."),this.viewport?e.setViewport(this.viewport):e.setViewport(0,0,i,n,1);var l=r.get("attached_textures");if(l)for(var o in l)if(!this._textures[o]){var h=l[o];this._doDetach(t,o,h)}if(!r.get(Ni)&&this.depthBuffer){r.miss(Di)&&r.put(Di,t.createRenderbuffer());var u=r.get(Di);i===r.get(Li)&&n===r.get(Pi)||(t.bindRenderbuffer(Ri,u),t.renderbufferStorage(Ri,t.DEPTH_COMPONENT16,i,n),r.put(Li,i),r.put(Pi,n),t.bindRenderbuffer(Ri,null)),r.get(Oi)||(t.framebufferRenderbuffer(Ii,Bi,Ri,u),r.put(Oi,!0))}},unbind:function(e){e.__currentFrameBuffer=null,e.gl.bindFramebuffer(Ii,null),this._boundRenderer=null,this._cache.use(e.__uid__);var t=this._cache.get("viewport");t&&e.setViewport(t),this.updateMipmap(e)},updateMipmap:function(e){var t=e.gl;for(var r in this._textures){var i=this._textures[r];if(i){var n=i.texture;if(!n.NPOT&&n.useMipmap&&n.minFilter===wr.LINEAR_MIPMAP_LINEAR){var a="textureCube"===n.textureType?34067:3553;t.bindTexture(a,n.getWebGLTexture(e)),t.generateMipmap(a),t.bindTexture(a,null)}}}},checkStatus:function(e){return e.checkFramebufferStatus(Ii)},_getFrameBufferGL:function(e){var t=this._cache;return t.use(e.__uid__),t.miss(Ci)&&t.put(Ci,e.gl.createFramebuffer()),t.get(Ci)},attach:function(e,t,r){if(!e.width)throw new Error("The texture attached to color buffer is not a valid.");t=t||36064,r=r||3553;var i,n=this._boundRenderer;if(n&&n.gl){var a=this._cache;a.use(n.__uid__),i=a.get("attached_textures")}var o=this._textures[t];if(!o||o.target!==r||o.texture!==e||!i||null==i[t]){var s=!0;n&&(s=this._doAttach(n,e,t,r),this.viewport||n.setViewport(0,0,e.width,e.height,1)),s&&(this._textures[t]=this._textures[t]||{},this._textures[t].texture=e,this._textures[t].target=r)}},_doAttach:function(e,t,r,i){var n=e.gl,a=t.getWebGLTexture(e),o=this._cache.get("attached_textures");if(o&&o[r]){var s=o[r];if(s.texture===t&&s.target===i)return}var l=!0;if(((r=+r)===Bi||r===R)&&(e.getGLExtension("WEBGL_depth_texture")||(console.error("Depth texture is not supported by the browser"),l=!1),t.format!==M&&34041!==t.format&&(console.error("The texture attached to depth buffer is not a valid."),l=!1),l)){var h=this._cache.get(Di);h&&(n.framebufferRenderbuffer(Ii,Bi,Ri,null),n.deleteRenderbuffer(h),this._cache.put(Di,!1)),this._cache.put(Oi,!1),this._cache.put(Ni,!0)}return n.framebufferTexture2D(Ii,r,i,a,0),o||(o={},this._cache.put("attached_textures",o)),o[r]=o[r]||{},o[r].texture=t,o[r].target=i,l},_doDetach:function(e,t,r){e.framebufferTexture2D(Ii,t,r,null,0);var i=this._cache.get("attached_textures");i&&i[t]&&(i[t]=null),t!==Bi&&t!==R||this._cache.put(Ni,!1)},detach:function(e,t){this._textures[e]=null,this._boundRenderer&&(this._cache.use(this._boundRenderer.__uid__),this._doDetach(this._boundRenderer.gl,e,t))},dispose:function(e){var t=e.gl,r=this._cache;r.use(e.__uid__);var i=r.get(Di);i&&t.deleteRenderbuffer(i);var n=r.get(Ci);n&&t.deleteFramebuffer(n),r.deleteContext(e.__uid__),this._textures={}}});Fi.DEPTH_ATTACHMENT=Bi,Fi.COLOR_ATTACHMENT0=36064,Fi.STENCIL_ATTACHMENT=36128,Fi.DEPTH_STENCIL_ATTACHMENT=R;const zi=Fi;var Gi=["px","nx","py","ny","pz","nz"];const Ui=m.extend((function(){var e={position:new vt,far:1e3,near:.1,texture:null,shadowMapPass:null},t=e._cameras={px:new Ei({fov:90}),nx:new Ei({fov:90}),py:new Ei({fov:90}),ny:new Ei({fov:90}),pz:new Ei({fov:90}),nz:new Ei({fov:90})};return t.px.lookAt(vt.POSITIVE_X,vt.NEGATIVE_Y),t.nx.lookAt(vt.NEGATIVE_X,vt.NEGATIVE_Y),t.py.lookAt(vt.POSITIVE_Y,vt.POSITIVE_Z),t.ny.lookAt(vt.NEGATIVE_Y,vt.NEGATIVE_Z),t.pz.lookAt(vt.POSITIVE_Z,vt.NEGATIVE_Y),t.nz.lookAt(vt.NEGATIVE_Z,vt.NEGATIVE_Y),e._frameBuffer=new zi,e}),{getCamera:function(e){return this._cameras[e]},render:function(e,t,r){var i=e.gl;r||t.update();for(var n=this.texture.width,a=2*Math.atan(n/(n-.5))/Math.PI*180,o=0;o<6;o++){var s=Gi[o],l=this._cameras[s];if(vt.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=a,this.shadowMapPass){l.update();var h=t.getBoundingBox();h.applyTransform(l.viewMatrix),t.viewBoundingBoxLastFrame.copy(h),this.shadowMapPass.render(e,t,l,!0)}this._frameBuffer.attach(this.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._frameBuffer.bind(e),e.render(t,l,!0),this._frameBuffer.unbind(e)}},dispose:function(e){this._frameBuffer.dispose(e)}}),ki=Vr.extend({dynamic:!1,widthSegments:1,heightSegments:1},(function(){this.build()}),{build:function(){for(var e=this.heightSegments,t=this.widthSegments,r=this.attributes,i=[],n=[],a=[],o=[],s=0;s<=e;s++)for(var l=s/e,h=0;h<=t;h++){var u=h/t;if(i.push([2*u-1,2*l-1,0]),n&&n.push([u,l]),a&&a.push([0,0,1]),h0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),e.renderPass([this],r)}}),Xi=ji;function qi(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var Zi=qi("DXT1"),Yi=qi("DXT3"),Ki=qi("DXT5");const Qi=function(e,t){var r=new Int32Array(e,0,31);if(542327876!==r[0])return null;if(4&!r(20))return null;var i,n,a=r(21),o=r[4],s=r[3],l=512&r[28],h=131072&r[2];switch(a){case Zi:i=8,n=wr.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Yi:i=16,n=wr.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Ki:i=16,n=wr.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}var u=r[1]+4,c=l?6:1,d=1;h&&(d=Math.max(1,r[7]));for(var f=[],p=0;p0){var n=Math.pow(2,e[3]-128-8+i);t[r+0]=e[0]*n,t[r+1]=e[1]*n,t[r+2]=e[2]*n}else t[r+0]=0,t[r+1]=0,t[r+2]=0;return t[r+3]=1,t}function en(e,t,r,i){for(var n,a,o=0,s=0,l=i;l>0;)if(e[s][0]=t[r++],e[s][1]=t[r++],e[s][2]=t[r++],e[s][3]=t[r++],1===e[s][0]&&1===e[s][1]&&1===e[s][2]){for(var h=e[s][3]<>>0;h>0;h--)n=e[s-1],(a=e[s])[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],s++,l--;o+=8}else s++,l--,o=0;return r}function tn(e,t,r,i){if(i<8|i>32767)return en(e,t,r,i);if(2!=(n=t[r++]))return en(e,t,r-1,i);if(e[0][1]=t[r++],e[0][2]=t[r++],n=t[r++],(e[0][2]<<8>>>0|n)>>>0!==i)return null;for(var n=0;n<4;n++)for(var a=0;a128){o=(127&o)>>>0;for(var s=t[r++];o--;)e[a++][n]=s}else for(;o--;)e[a++][n]=t[r++]}return r}const rn=function(e,t,r){null==r&&(r=0);var i=new Uint8Array(e),n=i.length;if("#?"===function(e,t,r){for(var i="",n=0;n<2;n++)i+=Ji(e[n]);return i}(i)){for(var a=2;a=n)){a+=2;for(var o="";a20)return console.warn("Given image is not a height map"),e}var d,f,p,m;l%(4*i)==0?(d=o.data[l],p=o.data[l+4]):l%(4*i)==4*(i-1)?(d=o.data[l-4],p=o.data[l]):(d=o.data[l-4],p=o.data[l+4]),l<4*i?(f=o.data[l],m=o.data[l+4*i]):l>i*(n-1)*4?(f=o.data[l-4*i],m=o.data[l]):(f=o.data[l-4*i],m=o.data[l+4*i]),s.data[l]=d-p+127,s.data[l+1]=f-m+127,s.data[l+2]=255,s.data[l+3]=255}return a.putImageData(s,0,0),r},isHeightImage:function(e,t,r){if(!e||!e.width||!e.height)return!1;var i=document.createElement("canvas"),n=i.getContext("2d"),a=t||32;r=r||20,i.width=i.height=a,n.drawImage(e,0,0,a,a);for(var o=n.getImageData(0,0,a,a),s=0;sr)return!1}return!0},_fetchTexture:function(e,t,r){U.request.get({url:e,responseType:"arraybuffer",onload:t,onerror:r})},createChessboard:function(e,t,r,i){e=e||512,t=t||64,r=r||"black",i=i||"white";var n=Math.ceil(e/t),a=document.createElement("canvas");a.width=e,a.height=e;var o=a.getContext("2d");o.fillStyle=i,o.fillRect(0,0,e,e),o.fillStyle=r;for(var s=0;s=0||(on.forEach((function(t){e.on(t,this[sn(t)],this)}),this),this._meshes.push(e))},detachFromMesh:function(e){var t=this._meshes.indexOf(e);t>=0&&this._meshes.splice(t,1),on.forEach((function(t){e.off(t,this[sn(t)])}),this)},dispose:function(){this._meshes.forEach((function(e){this.detachFromMesh(e)}),this)}};const hn=ln,un=hi.extend({left:-1,right:1,near:-1,far:1,top:1,bottom:-1},{updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},decomposeProjectionMatrix:function(){var e=this.projectionMatrix.array;this.left=(-1-e[12])/e[0],this.right=(1-e[12])/e[0],this.top=(1-e[13])/e[5],this.bottom=(-1-e[13])/e[5],this.near=-(-1-e[14])/e[10],this.far=-(1-e[14])/e[10]},clone:function(){var e=hi.prototype.clone.call(this);return e.left=this.left,e.right=this.right,e.near=this.near,e.far=this.far,e.top=this.top,e.bottom=this.bottom,e}});Xe.import("\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end");var cn=new ki,dn=new Sr({geometry:cn,frustumCulling:!1}),fn=new un;const pn=m.extend((function(){return{fragment:"",outputs:null,material:null,blendWithPrevious:!1,clearColor:!1,clearDepth:!0}}),(function(){var e=new Xe(Xe.source("clay.compositor.vertex"),this.fragment),t=new le({shader:e});t.enableTexturesAll(),this.material=t}),{setUniform:function(e,t){this.material.setUniform(e,t)},getUniform:function(e){var t=this.material.uniforms[e];if(t)return t.value},attachOutput:function(e,t){this.outputs||(this.outputs={}),t=t||36064,this.outputs[t]=e},detachOutput:function(e){for(var t in this.outputs)this.outputs[t]===e&&(this.outputs[t]=null)},bind:function(e,t){if(this.outputs)for(var r in this.outputs){var i=this.outputs[r];i&&t.attach(i,r)}t&&t.bind(e)},unbind:function(e,t){t.unbind(e)},render:function(e,t){var r=e.gl;if(t){this.bind(e,t);var i=e.getGLExtension("EXT_draw_buffers");if(i&&this.outputs){var n=[];for(var a in this.outputs)(a=+a)>=r.COLOR_ATTACHMENT0&&a<=r.COLOR_ATTACHMENT0+8&&n.push(a);i.drawBuffersEXT(n)}}this.trigger("beforerender",this,e);var o=this.clearDepth?r.DEPTH_BUFFER_BIT:0;if(r.depthMask(!0),this.clearColor){o|=r.COLOR_BUFFER_BIT,r.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&r.clearColor(s[0],s[1],s[2],s[3])}r.clear(o),this.blendWithPrevious?(r.enable(r.BLEND),this.material.transparent=!0):(r.disable(r.BLEND),this.material.transparent=!1),this.renderQuad(e),this.trigger("afterrender",this,e),t&&this.unbind(e,t)},renderQuad:function(e){dn.material=this.material,e.renderPass([dn],fn)},dispose:function(e){}});var mn={},gn=["px","nx","py","ny","pz","nz"];mn.prefilterEnvironmentMap=function(e,t,r,i,n){n&&i||(i=mn.generateNormalDistribution(),n=mn.integrateBRDF(e,i));var a=(r=r||{}).width||64,o=r.height||64,s=r.type||t.type,l=new Ai({width:a,height:o,type:s,flipY:!1,mipmaps:[]});l.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var h=Math.min(a,o),u=Math.log(h)/Math.log(2)+1,c=new le({shader:new Xe({vertex:Xe.source("clay.skybox.vertex"),fragment:"#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"})});c.set("normalDistribution",i),r.encodeRGBM&&c.define("fragment","RGBM_ENCODE"),r.decodeRGBM&&c.define("fragment","RGBM_DECODE");var d,f=new vi;if("texture2D"===t.textureType){var p=new Ai({width:a,height:o,type:s===wr.FLOAT?wr.HALF_FLOAT:s});an.panoramaToCubeMap(e,t,p,{encodeRGBM:r.decodeRGBM}),t=p}(d=new ji({scene:f,material:c})).material.set("environmentMap",t);var m=new Ui({texture:l});r.encodeRGBM&&(s=l.type=wr.UNSIGNED_BYTE);for(var g=new Dr({width:a,height:o,type:s}),_=new zi({depthBuffer:!1}),v=U[s===wr.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],y=0;y 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"}),n=new Dr({width:512,height:256,type:wr.HALF_FLOAT,wrapS:wr.CLAMP_TO_EDGE,wrapT:wr.CLAMP_TO_EDGE,minFilter:wr.NEAREST,magFilter:wr.NEAREST,useMipmap:!1});return i.setUniform("normalDistribution",t),i.setUniform("viewportSize",[512,256]),i.attachOutput(n),i.render(e,r),r.dispose(e),n},mn.generateNormalDistribution=function(e,t){for(var r=new Dr({width:e=e||256,height:t=t||1024,type:wr.FLOAT,minFilter:wr.NEAREST,magFilter:wr.NEAREST,wrapS:wr.CLAMP_TO_EDGE,wrapT:wr.CLAMP_TO_EDGE,useMipmap:!1}),i=new Float32Array(t*e*4),n=[],a=0;a>>16)>>>0;h=(((16711935&(h=((252645135&(h=((858993459&(h=((1431655765&h)<<1|(2863311530&h)>>>1)>>>0))<<2|(3435973836&h)>>>2)>>>0))<<4|(4042322160&h)>>>4)>>>0))<<8|(4278255360&h)>>>8)>>>0)/4294967296;var u=Math.sqrt((1-h)/(1+(s*s-1)*h));n[l]=u}for(l=0;l65535?Uint32Array:Uint16Array,v=this.indices=new _(t*e*6),y=this.radius,x=this.phiStart,b=this.phiLength,w=this.thetaStart,T=this.thetaLength,S=[],M=[],A=0,E=1/(y=this.radius);for(d=0;d<=e;d++)for(c=0;c<=t;c++)h=c/t,u=d/e,o=-y*Math.cos(x+h*b)*Math.sin(w+u*T),s=y*Math.cos(w+u*T),l=y*Math.sin(x+h*b)*Math.sin(w+u*T),S[0]=o,S[1]=s,S[2]=l,M[0]=h,M[1]=u,r.set(A,S),i.set(A,M),S[0]*=E,S[1]*=E,S[2]*=E,n.set(A,S),A++;var C=t+1,D=0;for(d=0;d255?255:e}function Qn(e){return e<0?0:e>1?1:e}function Jn(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Kn(parseFloat(t)/100*255):Kn(parseInt(t,10))}function $n(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Qn(parseFloat(t)/100):Qn(parseFloat(t))}function ea(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function ta(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e}function ra(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var ia=new bi(20),na=null;function aa(e,t){na&&ra(na,t),na=ia.put(e,na||t.slice())}function oa(e,t){if(e){t=t||[];var r=ia.get(e);if(r)return ra(t,r);var i=(e+="").replace(/ /g,"").toLowerCase();if(i in Yn)return ra(t,Yn[i]),aa(e,t),t;var n,a=i.length;if("#"===i.charAt(0))return 4===a||5===a?(n=parseInt(i.slice(1,4),16))>=0&&n<=4095?(ta(t,(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,5===a?parseInt(i.slice(4),16)/15:1),aa(e,t),t):void ta(t,0,0,0,1):7===a||9===a?(n=parseInt(i.slice(1,7),16))>=0&&n<=16777215?(ta(t,(16711680&n)>>16,(65280&n)>>8,255&n,9===a?parseInt(i.slice(7),16)/255:1),aa(e,t),t):void ta(t,0,0,0,1):void 0;var o=i.indexOf("("),s=i.indexOf(")");if(-1!==o&&s+1===a){var l=i.substr(0,o),h=i.substr(o+1,s-(o+1)).split(","),u=1;switch(l){case"rgba":if(4!==h.length)return 3===h.length?ta(t,+h[0],+h[1],+h[2],1):ta(t,0,0,0,1);u=$n(h.pop());case"rgb":return 3!==h.length?void ta(t,0,0,0,1):(ta(t,Jn(h[0]),Jn(h[1]),Jn(h[2]),u),aa(e,t),t);case"hsla":return 4!==h.length?void ta(t,0,0,0,1):(h[3]=$n(h[3]),sa(h,t),aa(e,t),t);case"hsl":return 3!==h.length?void ta(t,0,0,0,1):(sa(h,t),aa(e,t),t);default:return}}ta(t,0,0,0,1)}}function sa(e,t){var r=(parseFloat(e[0])%360+360)%360/360,i=$n(e[1]),n=$n(e[2]),a=n<=.5?n*(i+1):n+i-n*i,o=2*n-a;return ta(t=t||[],Kn(255*ea(o,a,r+1/3)),Kn(255*ea(o,a,r)),Kn(255*ea(o,a,r-1/3)),1),4===e.length&&(t[3]=e[3]),t}var la=Object.prototype.toString,ha=Array.prototype,ua=ha.forEach,ca=ha.filter,da=ha.slice,fa=ha.map,pa=function(){}.constructor,ma=pa?pa.prototype:null;function ga(e,t){if(Object.assign)Object.assign(e,t);else for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function _a(e,t,r){if(e="prototype"in e?e.prototype:e,t="prototype"in t?t.prototype:t,Object.getOwnPropertyNames)for(var i=Object.getOwnPropertyNames(t),n=0;no)i.length=o;else for(var s=a;s=2&&this.interpolable},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t){e>=this.maxTime?this.maxTime=e:this._needsSort=!0;var r=this.keyframes,i=r.length;if(this.interpolable)if(va(t)){var n=function(e){return va(e&&e[0])?2:1}(t);if(i>0&&this.arrDim!==n)return void(this.interpolable=!1);if(1===n&&"number"!=typeof t[0]||2===n&&"number"!=typeof t[0][0])return void(this.interpolable=!1);if(i>0){var a=r[i-1];this._isAllValueEqual&&(1===n&&Na(t,a.value)||(this._isAllValueEqual=!1))}this.arrDim=n}else{if(this.arrDim>0)return void(this.interpolable=!1);if("string"==typeof t){var o=oa(t);o?(t=o,this.isValueColor=!0):this.interpolable=!1}else if("number"!=typeof t||isNaN(t))return void(this.interpolable=!1);this._isAllValueEqual&&i>0&&(a=r[i-1],(this.isValueColor&&!Na(a.value,t)||a.value!==t)&&(this._isAllValueEqual=!1))}var s={time:e,value:t,percent:0};return this.keyframes.push(s),s},e.prototype.prepare=function(e){var t=this.keyframes;this._needsSort&&t.sort((function(e,t){return e.time-t.time}));for(var r=this.arrDim,i=t.length,n=t[i-1],a=0;a0&&a!==i-1&&Oa(t[a].value,n.value,r);if(e&&this.needsAnimate()&&e.needsAnimate()&&r===e.arrDim&&this.isValueColor===e.isValueColor&&!e._finished){this._additiveTrack=e;var o=t[0].value;for(a=0;a=0&&!(a[r].percent<=t);r--);r=Math.min(r,o-2)}else{for(r=this._lastFrame;rt);r++);r=Math.min(r-1,o-2)}var u=a[r+1],c=a[r];if(c&&u){this._lastFrame=r,this._lastFramePercent=t;var d=u.percent-c.percent;if(0!==d){var f=(t-c.percent)/d,p=i?this._additiveValue:h?za:e[s];if((l>0||h)&&!p&&(p=this._additiveValue=[]),this.useSpline){var m=a[r][n],g=a[0===r?r:r-1][n],_=a[r>o-2?o-1:r+1][n],v=a[r>o-3?o-1:r+2][n];if(l>0)1===l?Ra(p,g,m,_,v,f,f*f,f*f*f):function(e,t,r,i,n,a,o,s){for(var l=t.length,h=t[0].length,u=0;u0?1===l?Da(p,c[n],u[n],f):function(e,t,r,i){for(var n=t.length,a=n&&t[0].length,o=0;o.5?t:e}(c[n],u[n],f),i?this._additiveValue=y:e[s]=y);i&&this._addToTarget(e)}}}},e.prototype._addToTarget=function(e){var t=this.arrDim,r=this.propName,i=this._additiveValue;0===t?this.isValueColor?(oa(e[r],za),La(za,za,i,1),e[r]=Fa(za)):e[r]=e[r]+i:1===t?La(e[r],e[r],i,1):2===t&&Pa(e[r],e[r],i,1)},e}();const Ua=function(){function e(e,t,r){this._tracks={},this._trackKeys=[],this._delay=0,this._maxTime=0,this._paused=!1,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&r?function(){for(var e=[],t=0;t0)){this._started=1;for(var r=this,i=[],n=0;n1){var o=a.pop();n.addKeyframe(o.time,e[i]),n.prepare(n.getAdditiveTrack())}}}},e}(),ka={_animators:null,getAnimators:function(){return this._animators=this._animators||[],this._animators},animate:function(e,t){var r;if(this._animators=this._animators||[],e){for(var i=e.split("."),n=this,a=0,o=i.length;a=0&&s.splice(e,1)})),s.push(l),this.__zr&&this.__zr.animation.addAnimator(l),l},stopAnimation:function(e){this._animators=this._animators||[];for(var t=this._animators,r=t.length,i=0;i 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.chunk.instancing_header\n#ifdef INSTANCING\nattribute vec4 instanceMat1;\nattribute vec4 instanceMat2;\nattribute vec4 instanceMat3;\n#endif\n@end\n@export clay.chunk.instancing_matrix\nmat4 instanceMat = mat4(\n vec4(instanceMat1.xyz, 0.0),\n vec4(instanceMat2.xyz, 0.0),\n vec4(instanceMat3.xyz, 0.0),\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\n);\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end";function Ha(e){return e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof Image}Object.assign(sr.prototype,ka),Xe.import(Va),Xe.import(qe),Xe.import("\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"),Xe.import("@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\nattribute vec3 normal: NORMAL;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nvarying vec3 v_Normal;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\nvarying vec3 v_Normal;\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"),Xe.import("/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),Xe.import("@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),Xe.import("@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"),Xe.import("@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end");var Wa=vi.prototype.addToScene,ja=vi.prototype.removeFromScene;vi.prototype.addToScene=function(e){if(Wa.call(this,e),this.__zr){var t=this.__zr;e.traverse((function(e){e.__zr=t,e.addAnimatorsToZr&&e.addAnimatorsToZr(t)}))}},vi.prototype.removeFromScene=function(e){ja.call(this,e),e.traverse((function(e){var t=e.__zr;e.__zr=null,t&&e.removeAnimatorsFromZr&&e.removeAnimatorsFromZr(t)}))},le.prototype.setTextureImage=function(e,t,r,i){if(this.shader){var n,a=r.getZr(),o=this;return o.autoUpdateTextureStatus=!1,o.disableTexture(e),!(s=t)||"none"===s||(n=Xa.loadTexture(t,r,i,(function(t){o.enableTexture(e),a&&a.refresh()})),o.set(e,n)),n}var s};var Xa={};Xa.Renderer=ut,Xa.Node=sr,Xa.Mesh=Sr,Xa.Shader=Xe,Xa.Material=le,Xa.Texture=wr,Xa.Texture2D=Dr,Xa.Geometry=Vr,Xa.SphereGeometry=En,Xa.PlaneGeometry=ki,Xa.CubeGeometry=Wi,Xa.AmbientLight=Cn,Xa.DirectionalLight=Dn,Xa.PointLight=Ln,Xa.SpotLight=Pn,Xa.PerspectiveCamera=Ei,Xa.OrthographicCamera=un,Xa.Vector2=_e,Xa.Vector3=vt,Xa.Vector4=Rn,Xa.Quaternion=qt,Xa.Matrix2=Gn,Xa.Matrix2d=Hn,Xa.Matrix3=jn,Xa.Matrix4=Ht,Xa.Plane=$r,Xa.Ray=Mt,Xa.BoundingBox=ir,Xa.Frustum=si;var qa=an.createBlank("rgba(255,255,255,0)").image;function Za(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function Ya(e){if((e.wrapS===wr.REPEAT||e.wrapT===wr.REPEAT)&&e.image){var t=Za(e.width),r=Za(e.height);if(t!==e.width||r!==e.height){var i=document.createElement("canvas");i.width=t,i.height=r,i.getContext("2d").drawImage(e.image,0,0,t,r),e.image=i}}}Xa.loadTexture=function(e,t,r,i){"function"==typeof r&&(i=r,r={}),r=r||{};for(var n=Object.keys(r).sort(),a="",o=0;o3?t[3]=e[3]:t[3]=1,t):((t=i.color.parse(e||"#000",t)||[0,0,0,0])[0]/=255,t[1]/=255,t[2]/=255,t)},Xa.directionFromAlphaBeta=function(e,t){var r=e/180*Math.PI+Math.PI/2,i=-t/180*Math.PI+Math.PI/2,n=[],a=Math.sin(r);return n[0]=a*Math.cos(i),n[1]=-Math.cos(r),n[2]=a*Math.sin(i),n},Xa.getShadowResolution=function(e){var t=1024;switch(e){case"low":t=512;break;case"medium":break;case"high":t=2048;break;case"ultra":t=4096}return t},Xa.COMMON_SHADERS=["lambert","color","realistic","hatching","shadow"],Xa.createShader=function(e){"ecgl.shadow"===e&&(e="ecgl.displayShadow");var t=Xe.source(e+".vertex"),r=Xe.source(e+".fragment");t||console.error("Vertex shader of '%s' not exits",e),r||console.error("Fragment shader of '%s' not exits",e);var i=new Xe(t,r);return i.name=e,i},Xa.createMaterial=function(e,t){t instanceof Array||(t=[t]);var r=Xa.createShader(e),i=new le({shader:r});return t.forEach((function(e){"string"==typeof e&&i.define(e)})),i},Xa.setMaterialFromModel=function(e,t,r,i){t.autoUpdateTextureStatus=!1;var n=r.getModel(e+"Material"),a=n.get("detailTexture"),o=Mn(n.get("textureTiling"),1),s=Mn(n.get("textureOffset"),0);"number"==typeof o&&(o=[o,o]),"number"==typeof s&&(s=[s,s]);var l=o[0]>1||o[1]>1?Xa.Texture.REPEAT:Xa.Texture.CLAMP_TO_EDGE,h={anisotropic:8,wrapS:l,wrapT:l};if("realistic"===e){var u=n.get("roughness"),c=n.get("metalness");null!=c?isNaN(c)&&(t.setTextureImage("metalnessMap",c,i,h),c=Mn(n.get("metalnessAdjust"),.5)):c=0,null!=u?isNaN(u)&&(t.setTextureImage("roughnessMap",u,i,h),u=Mn(n.get("roughnessAdjust"),.5)):u=.5;var d=n.get("normalTexture");t.setTextureImage("detailMap",a,i,h),t.setTextureImage("normalMap",d,i,h),t.set({roughness:u,metalness:c,detailUvRepeat:o,detailUvOffset:s})}else if("lambert"===e)t.setTextureImage("detailMap",a,i,h),t.set({detailUvRepeat:o,detailUvOffset:s});else if("color"===e)t.setTextureImage("detailMap",a,i,h),t.set({detailUvRepeat:o,detailUvOffset:s});else if("hatching"===e){var f=n.get("hatchingTextures")||[];f.length;for(var p=0;p<6;p++)t.setTextureImage("hatch"+(p+1),f[p],i,{anisotropic:8,wrapS:Xa.Texture.REPEAT,wrapT:Xa.Texture.REPEAT});t.set({detailUvRepeat:o,detailUvOffset:s})}},Xa.updateVertexAnimation=function(e,t,r,i){var n=i.get("animation"),a=i.get("animationDurationUpdate"),o=i.get("animationEasingUpdate"),s=r.shadowDepthMaterial;if(n&&t&&a>0&&t.geometry.vertexCount===r.geometry.vertexCount){r.material.define("vertex","VERTEX_ANIMATION"),r.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var l=0;l=0&&this._viewsToDispose.splice(t,1),this.views.push(e),e.layer=this;var r=this.zr;e.scene.traverse((function(e){e.__zr=r,e.addAnimatorsToZr&&e.addAnimatorsToZr(r)}))}},Ja.prototype.removeView=function(e){if(e.layer===this){var t=this.views.indexOf(e);t>=0&&(this.views.splice(t,1),e.scene.traverse($a,this),e.layer=null,this._viewsToDispose.push(e))}},Ja.prototype.removeViewsAll=function(){this.views.forEach((function(e){e.scene.traverse($a,this),e.layer=null,this._viewsToDispose.push(e)}),this),this.views.length=0},Ja.prototype.resize=function(e,t){this.renderer.resize(e,t)},Ja.prototype.clear=function(){var e=this.renderer.gl,t=this._backgroundColor||[0,0,0,0];e.clearColor(t[0],t[1],t[2],t[3]),e.depthMask(!0),e.colorMask(!0,!0,!0,!0),e.clear(e.DEPTH_BUFFER_BIT|e.COLOR_BUFFER_BIT)},Ja.prototype.clearDepth=function(){var e=this.renderer.gl;e.clear(e.DEPTH_BUFFER_BIT)},Ja.prototype.clearColor=function(){var e=this.renderer.gl;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},Ja.prototype.needsRefresh=function(){this.zr.refresh()},Ja.prototype.refresh=function(e){this._backgroundColor=e?Ka.parseColor(e):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var t=0;t20)){e=e.event;var i=this.pickObject(e.offsetX,e.offsetY);i&&(this._dispatchEvent(e.type,e,i),this._dispatchDataEvent(e.type,e,i));var n=this._clickToSetFocusPoint(e);n&&n.view.setDOFFocusOnPoint(n.distance)&&this.zr.refresh()}}},Ja.prototype._clickToSetFocusPoint=function(e){for(var t=this.renderer,r=t.viewport,i=this.views.length-1;i>=0;i--){var n=this.views[i];if(n.hasDOF()&&n.containPoint(e.offsetX,e.offsetY)){this._picking.scene=n.scene,this._picking.camera=n.camera,t.viewport=n.viewport;var a=this._picking.pick(e.offsetX,e.offsetY,!0);if(a)return a.view=n,a}}t.viewport=r},Ja.prototype.onglobalout=function(e){var t=this._hovered;t&&this._dispatchEvent("mouseout",e,{target:t.target})},Ja.prototype.pickObject=function(e,t){for(var r=[],i=this.renderer,n=i.viewport,a=0;a=0&&(c.dataIndex=this._lastDataIndex,c.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(u,"mouseout",t)),l=!0):null!=s&&s!==this._lastEventData&&(null!=this._lastEventData&&(c.eventData=this._lastEventData,this.zr.handler.dispatchToElement(u,"mouseout",t)),l=!0),this._lastEventData=s,this._lastDataIndex=a,this._lastSeriesIndex=o),c.eventData=s,c.dataIndex=a,c.seriesIndex=o,(null!=s||parseInt(a,10)>=0&&parseInt(o,10)>=0)&&(this.zr.handler.dispatchToElement(u,e,t),l&&this.zr.handler.dispatchToElement(u,"mouseover",t))},Ja.prototype._dispatchToView=function(e,t){for(var r=0;re&&o=0&&(function(e){so(e,"itemStyle"),so(e,"lineStyle"),so(e,"areaStyle"),so(e,"label")}(t),"mapbox"===t.coordinateSystem&&(t.coordinateSystem="mapbox3D",e.mapbox3D=e.mapbox))})),lo(e.xAxis3D),lo(e.yAxis3D),lo(e.zAxis3D),lo(e.grid3D),so(e.geo3D)}));const uo={defaultOption:{viewControl:{projection:"perspective",autoRotate:!1,autoRotateDirection:"cw",autoRotateSpeed:10,autoRotateAfterStill:3,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",distance:150,minDistance:40,maxDistance:400,orthographicSize:150,maxOrthographicSize:400,minOrthographicSize:20,center:[0,0,0],alpha:0,beta:0,minAlpha:-90,maxAlpha:90}},setView:function(e){e=e||{},this.option.viewControl=this.option.viewControl||{},null!=e.alpha&&(this.option.viewControl.alpha=e.alpha),null!=e.beta&&(this.option.viewControl.beta=e.beta),null!=e.distance&&(this.option.viewControl.distance=e.distance),null!=e.center&&(this.option.viewControl.center=e.center)}},co={defaultOption:{postEffect:{enable:!1,bloom:{enable:!0,intensity:.1},depthOfField:{enable:!1,focalRange:20,focalDistance:50,blurRadius:10,fstop:2.8,quality:"medium"},screenSpaceAmbientOcclusion:{enable:!1,radius:2,quality:"medium",intensity:1},screenSpaceReflection:{enable:!1,quality:"medium",maxRoughness:.8},colorCorrection:{enable:!0,exposure:0,brightness:0,contrast:1,saturation:1,lookupTexture:""},edge:{enable:!1},FXAA:{enable:!1}},temporalSuperSampling:{enable:"auto"}}},fo={defaultOption:{light:{main:{shadow:!1,shadowQuality:"high",color:"#fff",intensity:1,alpha:0,beta:0},ambient:{color:"#fff",intensity:.2},ambientCubemap:{texture:null,exposure:1,diffuseIntensity:.5,specularIntensity:.5}}}};var po=i.ComponentModel.extend({type:"grid3D",dependencies:["xAxis3D","yAxis3D","zAxis3D"],defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",boxWidth:100,boxHeight:100,boxDepth:100,axisPointer:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.8)",width:1},label:{show:!0,formatter:null,margin:8,textStyle:{fontSize:14,color:"#fff",backgroundColor:"rgba(0,0,0,0.5)",padding:3,borderRadius:3}}},axisLine:{show:!0,lineStyle:{color:"#333",width:2,type:"solid"}},axisTick:{show:!0,inside:!1,length:3,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}},light:{main:{alpha:30,beta:40},ambient:{intensity:.4}},viewControl:{alpha:20,beta:40,autoRotate:!1,distance:200,minDistance:40,maxDistance:400}}});i.util.merge(po.prototype,uo),i.util.merge(po.prototype,co),i.util.merge(po.prototype,fo);const mo=po;function go(e,t){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%"}return"string"==typeof e?(r=e,r.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(e)/100*t:parseFloat(e):null==e?NaN:+e;var r}function _o(){var e="__ec_inner_"+vo++;return function(t){return t[e]||(t[e]={})}}var vo=Math.round(9*Math.random()),yo={};function xo(e,t,r,i,n){var a={};return function(e,t,r,i,n){r=r||yo;var a,o=t.ecModel,s=o&&o.option.textStyle,l=function(e){for(var t;e&&e!==e.ecModel;){var r=(e.option||yo).rich;if(r){t=t||{};for(var i=ba(r),n=0;n0&&this._notFirst?this.animateTo({alpha:h,beta:u,center:c,distance:a,orthographicSize:o,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(a),this.setAlpha(h),this.setBeta(u),this.setCenter(c),this.setOrthographicSize(o)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){},animateTo:function(e){var t=this.zr,r=this,i={},n={};return null!=e.distance&&(i.distance=this.getDistance(),n.distance=e.distance),null!=e.orthographicSize&&(i.orthographicSize=this.getOrthographicSize(),n.orthographicSize=e.orthographicSize),null!=e.alpha&&(i.alpha=this.getAlpha(),n.alpha=e.alpha),null!=e.beta&&(i.beta=this.getBeta(),n.beta=e.beta),null!=e.center&&(i.center=this.getCenter(),n.center=e.center),this._addAnimator(t.animation.animate(i).when(e.duration||1e3,n).during((function(){null!=i.alpha&&r.setAlpha(i.alpha),null!=i.beta&&r.setBeta(i.beta),null!=i.distance&&r.setDistance(i.distance),null!=i.center&&r.setCenter(i.center),null!=i.orthographicSize&&r.setOrthographicSize(i.orthographicSize),r._needsUpdate=!0}))).start(e.easing||"linear")},stopAllAnimation:function(){for(var e=0;e0},_update:function(e){if(this._rotating){var t=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=t*e/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(e=Math.min(e,50),this._updateDistanceOrSize(e),this._updatePan(e),this._updateRotate(e),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(e){var t=this._rotateVelocity;this._phi=t.y*e/20+this._phi,this._theta=t.x*e/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(t,Math.pow(this.damping,e/16))},_updateDistanceOrSize:function(e){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*e/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*e/20),this._zoomSpeed*=Math.pow(this.damping,e/16)},_setDistance:function(e){this._distance=Math.max(Math.min(e,this.maxDistance),this.minDistance)},_setOrthoSize:function(e){this._orthoSize=Math.max(Math.min(e,this.maxOrthographicSize),this.minOrthographicSize);var t=this.getCamera(),r=this._orthoSize,i=r/this.viewGL.viewport.height*this.viewGL.viewport.width;t.left=-i/2,t.right=i/2,t.top=r/2,t.bottom=-r/2},_updatePan:function(e){var t=this._panVelocity,r=this._distance,i=this.getCamera(),n=i.worldTransform.y,a=i.worldTransform.x;this._center.scaleAndAdd(a,-t.x*r/200).scaleAndAdd(n,-t.y*r/200),this._vectorDamping(t,0)},_updateTransform:function(){var e=this.getCamera(),t=new vt,r=this._theta+Math.PI/2,i=this._phi+Math.PI/2,n=Math.sin(r);t.x=n*Math.cos(i),t.y=-Math.cos(r),t.z=n*Math.sin(i),e.position.copy(this._center).scaleAndAdd(t,this._distance),e.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var e=this.autoRotateAfterStill,t=this;!isNaN(e)&&e>0&&(this._stillTimeout=setTimeout((function(){t._rotating=!0}),1e3*e))},_vectorDamping:function(e,t){var r=e.len();(r*=t)<1e-4&&(r=0),e.normalize().scale(r)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var e=this.getCamera().worldTransform.z,t=Math.asin(e.y),r=Math.atan2(e.x,e.z);this._theta=t,this._phi=-r,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(e){if(!e.target&&!this._isAnimating()){var t=e.offsetX,r=e.offsetY;this.viewGL&&!this.viewGL.containPoint(t,r)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),e.event.targetTouches?1===e.event.targetTouches.length&&(this._mode="rotate"):e.event.button===Ao[this.rotateMouseButton]?this._mode="rotate":e.event.button===Ao[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=e.offsetX,this._mouseY=e.offsetY)}},_mouseMoveHandler:function(e){if(!(e.target&&e.target.__isGLToZRProxy||this._isAnimating())){var t=Eo(this.panSensitivity),r=Eo(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(e.offsetX-this._mouseX)/this.zr.getHeight()*2*r[0],this._rotateVelocity.x=(e.offsetY-this._mouseY)/this.zr.getWidth()*2*r[1]):"pan"===this._mode&&(this._panVelocity.x=(e.offsetX-this._mouseX)/this.zr.getWidth()*t[0]*400,this._panVelocity.y=(-e.offsetY+this._mouseY)/this.zr.getHeight()*t[1]*400),this._mouseX=e.offsetX,this._mouseY=e.offsetY,e.event.preventDefault()}},_mouseWheelHandler:function(e){if(!this._isAnimating()){var t=e.event.wheelDelta||-e.event.detail;this._zoomHandler(e,t)}},_pinchHandler:function(e){this._isAnimating()||(this._zoomHandler(e,e.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(e,t){if(0!==t){var r,i=e.offsetX,n=e.offsetY;this.viewGL&&!this.viewGL.containPoint(i,n)||(r="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(t>0?-1:1)*r*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),e.event.preventDefault())}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(e){this._isRightMouseButtonUsed()&&e.preventDefault()},_addAnimator:function(e){var t=this._animators;return t.push(e),e.done((function(){var r=t.indexOf(e);r>=0&&t.splice(r,1)})),e}});Object.defineProperty(Co.prototype,"autoRotate",{get:function(e){return this._autoRotate},set:function(e){this._autoRotate=e,this._rotating=e}});const Do=Co,Lo={convertToDynamicArray:function(e){e&&this.resetOffset();var t=this.attributes;for(var r in t)e||!t[r].value?t[r].value=[]:t[r].value=Array.prototype.slice.call(t[r].value);e||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var e=this.attributes;for(var t in e)e[t].value&&e[t].value.length>0?e[t].value=new Float32Array(e[t].value):e[t].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}},Po={vec2:pe,vec3:Qe,vec4:Et,mat2:Fn,mat2d:kn,mat3:Dt,mat4:Ye,quat:Rt};var Oo=Po.vec3,No=[[0,0],[1,1]],Io=Vr.extend((function(){return{segmentScale:1,dynamic:!0,useNativeLine:!0,attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),positionPrev:new Vr.Attribute("positionPrev","float",3),positionNext:new Vr.Attribute("positionNext","float",3),prevPositionPrev:new Vr.Attribute("prevPositionPrev","float",3),prevPosition:new Vr.Attribute("prevPosition","float",3),prevPositionNext:new Vr.Attribute("prevPositionNext","float",3),offset:new Vr.Attribute("offset","float",1),color:new Vr.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(e){var t=this.attributes;this.vertexCount!==e&&(t.position.init(e),t.color.init(e),this.useNativeLine||(t.positionPrev.init(e),t.positionNext.init(e),t.offset.init(e)),e>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,i){return 1/(Oo.dist(e,t)+Oo.dist(r,t)+Oo.dist(i,r)+1)*this.segmentScale},getCubicCurveVertexCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(No)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(No)},getPolylineVertexCount:function(e){var t;return t="number"==typeof e?e:"number"!=typeof e[0]?e.length:e.length/3,this.useNativeLine?2*(t-1):2*(t-1)+2},getPolylineTriangleCount:function(e){var t;return t="number"==typeof e?e:"number"!=typeof e[0]?e.length:e.length/3,this.useNativeLine?0:2*Math.max(t-1,0)},addCubicCurve:function(e,t,r,i,n,a){null==a&&(a=1);var o=e[0],s=e[1],l=e[2],h=t[0],u=t[1],c=t[2],d=r[0],f=r[1],p=r[2],m=i[0],g=i[1],_=i[2],v=this._getCubicCurveApproxStep(e,t,r,i),y=v*v,x=y*v,b=3*v,w=3*y,T=6*y,S=6*x,M=o-2*h+d,A=s-2*u+f,E=l-2*c+p,C=3*(h-d)-o+m,D=3*(u-f)-s+g,L=3*(c-p)-l+_,P=o,O=s,N=l,I=(h-o)*b+M*w+C*x,R=(u-s)*b+A*w+D*x,B=(c-l)*b+E*w+L*x,F=M*T+C*S,z=A*T+D*S,G=E*T+L*S,U=C*S,k=D*S,V=L*S,H=0,W=0,j=Math.ceil(1/v),X=new Float32Array(3*(j+1)),q=(X=[],0);for(W=0;W1&&(P=I>0?Math.min(P,m):Math.max(P,m),O=R>0?Math.min(O,g):Math.max(O,g),N=B>0?Math.min(N,_):Math.max(N,_));return this.addPolyline(X,n,a)},addLine:function(e,t,r,i){return this.addPolyline([e,t],r,i)},addPolyline:function(e,t,r,i,n){if(e.length){var a="number"!=typeof e[0];if(null==n&&(n=a?e.length:e.length/3),!(n<2)){null==i&&(i=0),null==r&&(r=1),this._itemVertexOffsets.push(this._vertexOffset);var o,s,l=(a="number"!=typeof e[0])?"number"!=typeof t[0]:t.length/4===n,h=this.attributes.position,u=this.attributes.positionPrev,c=this.attributes.positionNext,d=this.attributes.color,f=this.attributes.offset,p=this.indices,m=this._vertexOffset;r=Math.max(r,.01);for(var g=i;g1&&(h.copy(m,m-1),d.copy(m,m-1),m++):(g0&&(c.set(m-2,o),c.set(m-1,o)),h.set(m,o),h.set(m+1,o),d.set(m,s),d.set(m+1,s),f.set(m,r/2),f.set(m+1,-r/2),m+=2),this.useNativeLine)d.set(m,s),h.set(m,o),m++;else if(g>0){var y=3*this._triangleOffset;(p=this.indices)[y]=m-4,p[y+1]=m-3,p[y+2]=m-2,p[y+3]=m-3,p[y+4]=m-1,p[y+5]=m-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,b=this._vertexOffset+2*n;u.copy(x,x+2),u.copy(x+1,x+3),c.copy(b-1,b-3),c.copy(b-2,b-4)}return this._vertexOffset=m,this._vertexOffset}}},setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],i=eo&&(n=this._x=0,a+=this._rowHeight+l,this._y=a,this._rowHeight=0),this._x+=t+l,this._rowHeight=Math.max(this._rowHeight,r),a+r+l>s)return null;e.x+=this.offsetX*this.dpr+n,e.y+=this.offsetY*this.dpr+a,this._zr.add(e);var h=[this.offsetX/this.width,this.offsetY/this.height];return[[n/o+h[0],a/s+h[1]],[(n+t)/o+h[0],(a+r)/s+h[1]]]},_fitElement:function(e,t,r){var i=e.getBoundingRect(),n=t/i.width,a=r/i.height;e.x=-i.x*n,e.y=-i.y*a,e.scaleX=n,e.scaleY=a,e.update()}},Fo.prototype={clear:function(){for(var e=0;e=e)){var n=(r+this._nodeWidth)*this._dpr,a=(i+this._nodeHeight)*this._dpr;try{this._zr.resize({width:n,height:a})}catch(e){this._canvas.width=n,this._canvas.height=a}var o=new Bo(this._zr,r,i,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(o),o}},add:function(e,t,r){if(this._coords[e.id])return this._coords[e.id];var i=this._getCurrentNode().add(e,t,r);if(!i){var n=this._expand();if(!n)return;i=n.add(e,t,r)}return this._coords[e.id]=i,i},getCoordsScale:function(){var e=this._dpr;return[this._nodeWidth/this._canvas.width*e,this._nodeHeight/this._canvas.height*e]},getCoords:function(e){return this._coords[e]},dispose:function(){this._zr.dispose()}};const zo=Fo;function Go(){}Go.prototype={constructor:Go,setScene:function(e){this._scene=e,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(e){this._lightRoot=e,this.mainLight=new Ka.DirectionalLight({shadowBias:.005}),this.ambientLight=new Ka.AmbientLight,e.add(this.mainLight),e.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(e){var t=this.mainLight,r=this.ambientLight,i=e.getModel("light"),n=i.getModel("main"),a=i.getModel("ambient");t.intensity=n.get("intensity"),r.intensity=a.get("intensity"),t.color=Ka.parseColor(n.get("color")).slice(0,3),r.color=Ka.parseColor(a.get("color")).slice(0,3);var o=n.get("alpha")||0,s=n.get("beta")||0;t.position.setArray(Ka.directionFromAlphaBeta(o,s)),t.lookAt(Ka.Vector3.ZERO),t.castShadow=n.get("shadow"),t.shadowResolution=Ka.getShadowResolution(n.get("shadowQuality"))},updateAmbientCubemap:function(e,t,r){var i=t.getModel("light.ambientCubemap"),n=i.get("texture");if(n){this._cubemapLightsCache=this._cubemapLightsCache||{};var a=this._cubemapLightsCache[n];if(!a){var o=this;a=this._cubemapLightsCache[n]=Ka.createAmbientCubemap(i.option,e,r,(function(){o._isSkyboxFromAmbientCubemap&&o._skybox.setEnvironmentMap(a.specular.cubemap),r.getZr().refresh()}))}this._lightRoot.add(a.diffuse),this._lightRoot.add(a.specular),this._currentCubemapLights=a}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(e,t,r){var n=t.get("environment"),a=this,o=(a._skybox=a._skybox||new ji,a._skybox);if(n&&"none"!==n)if("auto"===n)if(this._isSkyboxFromAmbientCubemap=!0,this._currentCubemapLights){var s=this._currentCubemapLights.specular.cubemap;o.setEnvironmentMap(s),this._scene&&o.attachScene(this._scene),o.material.set("lod",3)}else this._skybox&&this._skybox.detachScene();else if("object"==typeof n&&n.colorStops||"string"==typeof n&&i.color.parse(n)){this._isSkyboxFromAmbientCubemap=!1;var l=new Ka.Texture2D({anisotropic:8,flipY:!1});o.setEnvironmentMap(l);var h=l.image=document.createElement("canvas");h.width=h.height=16;var u=h.getContext("2d"),c=new i.graphic.Rect({shape:{x:0,y:0,width:16,height:16},style:{fill:n}});i.innerDrawElementOnCanvas(u,c),o.attachScene(this._scene)}else this._isSkyboxFromAmbientCubemap=!1,l=Ka.loadTexture(n,r,{anisotropic:8,flipY:!1}),o.setEnvironmentMap(l),o.attachScene(this._scene);else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var d=t.coordinateSystem;if(this._skybox)if(!d||!d.viewGL||"auto"===n||n.match&&n.match(/.hdr$/))this._skybox.material.undefine("fragment","SRGB_DECODE");else{var f=d.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material[f]("fragment","SRGB_DECODE")}}};const Uo=Go;var ko=Po.vec3,Vo=Vr.extend((function(){return{segmentScale:1,useNativeLine:!0,attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),normal:new Vr.Attribute("normal","float",3,"NORMAL"),color:new Vr.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setQuadCount:function(e){var t=this.attributes,r=this.getQuadVertexCount()*e,i=this.getQuadTriangleCount()*e;this.vertexCount!==r&&(t.position.init(r),t.normal.init(r),t.color.init(r)),this.triangleCount!==i&&(this.indices=r>65535?new Uint32Array(3*i):new Uint16Array(3*i))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var e=ko.create(),t=ko.create(),r=ko.create(),i=[0,3,1,3,2,1];return function(n,a){var o=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;ko.sub(e,n[1],n[0]),ko.sub(t,n[2],n[1]),ko.cross(r,e,t),ko.normalize(r,r);for(var h=0;h<4;h++)o.set(this._vertexOffset+h,n[h]),l.set(this._vertexOffset+h,a),s.set(this._vertexOffset+h,r);var u=3*this._faceOffset;for(h=0;h<6;h++)this.indices[u+h]=i[h]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});i.util.defaults(Vo.prototype,Lo);const Ho=Vo;var Wo=Mn,jo={x:0,y:2,z:1};function Xo(e,t,r){this.rootNode=new Ka.Node;var i=new Ka.Mesh({geometry:new Ro({useNativeLine:!1}),material:t,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),n=new Ka.Mesh({geometry:new Ho,material:r,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(n),this.rootNode.add(i),this.faceInfo=e,this.plane=new Ka.Plane,this.linesMesh=i,this.quadsMesh=n}Xo.prototype.update=function(e,t,r){var i=e.coordinateSystem,n=[i.getAxis(this.faceInfo[0]),i.getAxis(this.faceInfo[1])],a=this.linesMesh.geometry,o=this.quadsMesh.geometry;a.convertToDynamicArray(!0),o.convertToDynamicArray(!0),this._updateSplitLines(a,n,e,r),this._udpateSplitAreas(o,n,e,r),a.convertToTypedArray(),o.convertToTypedArray();var s=i.getAxis(this.faceInfo[2]);!function(e,t,r,i){var n=[0,0,0],a=i<0?r.getExtentMin():r.getExtentMax();n[jo[r.dim]]=a,e.position.setArray(n),e.rotation.identity(),t.distance=-Math.abs(a),t.normal.set(0,0,0),"x"===r.dim?(e.rotation.rotateY(i*Math.PI/2),t.normal.x=-i):"z"===r.dim?(e.rotation.rotateX(-i*Math.PI/2),t.normal.y=-i):(i>0&&e.rotation.rotateY(Math.PI),t.normal.z=-i)}(this.rootNode,this.plane,s,this.faceInfo[3])},Xo.prototype._updateSplitLines=function(e,t,r,n){var a=n.getDevicePixelRatio();t.forEach((function(n,o){var s=n.model,l=t[1-o].getExtent();if(!n.scale.isBlank()){var h=s.getModel("splitLine",r.getModel("splitLine"));if(h.get("show")){var u=h.getModel("lineStyle"),c=u.get("color"),d=Wo(u.get("opacity"),1),f=Wo(u.get("width"),1);c=i.util.isArray(c)?c:[c];for(var p=n.getTicksCoords({tickModel:h}),m=0,g=0;g65535?new Uint32Array(3*r):new Uint16Array(3*r))},setSpriteAlign:function(e,t,r,i,n){var a,o,s,l;switch(null==r&&(r="left"),null==i&&(i="top"),n=n||0,r){case"left":a=n,s=t[0]+n;break;case"center":case"middle":a=-t[0]/2,s=t[0]/2;break;case"right":a=-t[0]-n,s=-n}switch(i){case"bottom":o=n,l=t[1]+n;break;case"middle":o=-t[1]/2,l=t[1]/2;break;case"top":o=-t[1]-n,l=-n}var h=4*e,u=this.attributes.offset;u.set(h,[a,l]),u.set(h+1,[s,l]),u.set(h+2,[s,o]),u.set(h+3,[a,o])},addSprite:function(e,t,r,i,n,a){var o=this._vertexOffset;this.setSprite(this._vertexOffset/4,e,t,r,i,n,a);for(var s=0;s 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end";var ns=Mn;Ka.Shader.import(is);var as={x:0,y:2,z:1};const os=i.ComponentView.extend({type:"grid3D",__ecgl__:!0,init:function(e,t){var r=new Ka.Material({shader:Ka.createShader("ecgl.color"),depthMask:!1,transparent:!0}),i=new Ka.Material({shader:Ka.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});r.define("fragment","DOUBLE_SIDED"),r.define("both","VERTEX_COLOR"),this.groupGL=new Ka.Node,this._control=new Do({zr:t.getZr()}),this._control.init(),this._faces=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]].map((function(e){var t=new qo(e,i,r);return this.groupGL.add(t.rootNode),t}),this),this._axes=["x","y","z"].map((function(e){var t=new rs(e,i);return this.groupGL.add(t.rootNode),t}),this);var n=t.getDevicePixelRatio();this._axisLabelSurface=new zo({width:256,height:256,devicePixelRatio:n}),this._axisLabelSurface.onupdate=function(){t.getZr().refresh()},this._axisPointerLineMesh=new Ka.Mesh({geometry:new Ro({useNativeLine:!1}),material:i,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new zo({width:128,height:128,devicePixelRatio:n}),this._axisPointerLabelsMesh=new Qo({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new Ka.Node,this._sceneHelper=new Uo,this._sceneHelper.initLight(this._lightRoot)},render:function(e,t,r){this._model=e,this._api=r;var i=e.coordinateSystem;i.viewGL.add(this._lightRoot),e.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL);var n=this._control;n.setViewGL(i.viewGL);var a=e.getModel("viewControl");n.setFromViewControlModel(a,0),this._axisLabelSurface.clear(),n.off("update"),e.get("show")&&(this._faces.forEach((function(i){i.update(e,t,r)}),this),this._axes.forEach((function(t){t.update(e,this._axisLabelSurface,r)}),this)),n.on("update",this._onCameraChange.bind(this,e,r),this),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(e),i.viewGL.setPostEffect(e.getModel("postEffect"),r),i.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._initMouseHandler(e)},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r)},showAxisPointer:function(e,t,r,i){this._doShowAxisPointer(),this._updateAxisPointer(i.value)},hideAxisPointer:function(e,t,r,i){this._doHideAxisPointer()},_initMouseHandler:function(e){var t=e.coordinateSystem.viewGL;e.get("show")&&e.get("axisPointer.show")?t.on("mousemove",this._updateAxisPointerOnMousePosition,this):t.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(e){if(!e.target){for(var t,r=this._model.coordinateSystem,i=r.viewGL,n=i.castRay(e.offsetX,e.offsetY,new Ka.Ray),a=0;ai[1]?0:1,o=this._faces[2*r+a],s=this._faces[2*r+1-a];o.rootNode.invisible=!0,s.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var e=this._model.coordinateSystem,t=e.getAxis("x"),r=e.getAxis("y"),i=e.getAxis("z"),n=i.getExtentMax(),a=i.getExtentMin(),o=t.getExtentMin(),s=t.getExtentMax(),l=r.getExtentMax(),h=r.getExtentMin(),u=this._axes[0].rootNode,c=this._axes[1].rootNode,d=this._axes[2].rootNode,f=this._faces,p=f[4].rootNode.invisible?h:l,m=f[2].rootNode.invisible?n:a,g=f[0].rootNode.invisible?o:s,_=f[2].rootNode.invisible?n:a,v=f[0].rootNode.invisible?s:o,y=f[4].rootNode.invisible?h:l;u.rotation.identity(),c.rotation.identity(),d.rotation.identity(),f[4].rootNode.invisible&&(this._axes[0].flipped=!0,u.rotation.rotateX(Math.PI)),f[0].rootNode.invisible&&(this._axes[1].flipped=!0,c.rotation.rotateZ(Math.PI)),f[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),u.position.set(0,m,p),c.position.set(g,_,0),d.position.set(v,0,y),u.update(),c.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var e=this._control.getCamera(),t=[new Ka.Vector4,new Ka.Vector4],r=new Ka.Vector4;this.groupGL.getWorldPosition(r),r.w=1,r.transformMat4(e.viewMatrix).transformMat4(e.projectionMatrix),r.x/=r.w,r.y/=r.w,this._axes.forEach((function(i){for(var n=i.axisLineCoords,a=(i.labelsMesh.geometry,0);ar.y?"bottom":"top"):(s="middle",o=u>r.x?"left":"right"),i.setSpriteAlign(o,s,this._api)}),this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(e){var t=this._model.coordinateSystem,r=t.dataToPoint(e),i=this._axisPointerLineMesh.geometry,n=this._model.getModel("axisPointer"),a=this._api.getDevicePixelRatio();function o(e){return Mn(e.model.get("axisPointer.show"),n.get("show"))}function s(e){var t=e.model.getModel("axisPointer",n).getModel("lineStyle"),r=Ka.parseColor(t.get("color")),i=ns(t.get("width"),1),a=ns(t.get("opacity"),1);return r[3]*=a,{color:r,lineWidth:i}}i.convertToDynamicArray(!0);for(var l=0;lp&&(p=y,mp&&(p=x,_=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(t){e.copy(this,t)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return 0===this.width||0===this.height},e.create=function(t){return new e(t.x,t.y,t.width,t.height)},e.copy=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},e.applyTransform=function(t,r,i){if(i){if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var n=i[0],a=i[3],o=i[4],s=i[5];return t.x=r.x*n+o,t.y=r.y*a+s,t.width=r.width*n,t.height=r.height*a,t.width<0&&(t.x+=t.width,t.width=-t.width),void(t.height<0&&(t.y+=t.height,t.height=-t.height))}gs.x=vs.x=r.x,gs.y=ys.y=r.y,_s.x=ys.x=r.x+r.width,_s.y=vs.y=r.y+r.height,gs.transform(i),ys.transform(i),_s.transform(i),vs.transform(i),t.x=ps(gs.x,_s.x,vs.x,ys.x),t.y=ps(gs.y,_s.y,vs.y,ys.y);var l=ms(gs.x,_s.x,vs.x,ys.x),h=ms(gs.y,_s.y,vs.y,ys.y);t.width=l-t.x,t.height=h-t.y}else t!==r&&e.copy(t,r)},e}();function Ts(e,t,r,i,n){var a=0,o=0;null==i&&(i=1/0),null==n&&(n=1/0);var s=0;t.eachChild((function(l,h){var u,c,d=l.getBoundingRect(),f=t.childAt(h+1),p=f&&f.getBoundingRect();if("horizontal"===e){var m=d.width+(p?-p.x+d.x:0);(u=a+m)>i||l.newline?(a=0,u=m,o+=s+r,s=d.height):s=Math.max(s,d.height)}else{var g=d.height+(p?-p.y+d.y:0);(c=o+g)>n||l.newline?(a+=s+r,o=0,c=g,s=d.width):s=Math.max(s,d.width)}l.newline||(l.x=a,l.y=o,l.markRedraw(),"horizontal"===e?a=u+r:o=c+r)}))}function Ss(e,t,r){r=function(e){if("number"==typeof e)return[e,e,e,e];var t=e.length;return 2===t?[e[0],e[1],e[0],e[1]]:3===t?[e[0],e[1],e[2],e[1]]:e}(r||0);var i=t.width,n=t.height,a=go(e.left,i),o=go(e.top,n),s=go(e.right,i),l=go(e.bottom,n),h=go(e.width,i),u=go(e.height,n),c=r[2]+r[0],d=r[1]+r[3],f=e.aspect;switch(isNaN(h)&&(h=i-s-d-a),isNaN(u)&&(u=n-l-c-o),null!=f&&(isNaN(h)&&isNaN(u)&&(f>i/n?h=.8*i:u=.8*n),isNaN(h)&&(h=f*u),isNaN(u)&&(u=h/f)),isNaN(a)&&(a=i-s-h-d),isNaN(o)&&(o=n-l-u-c),e.left||e.right){case"center":a=i/2-h/2-r[3];break;case"right":a=i-h-d}switch(e.top||e.bottom){case"middle":case"center":o=n/2-u/2-r[0];break;case"bottom":o=n-u-c}a=a||0,o=o||0,isNaN(h)&&(h=i-d-a-(s||0)),isNaN(u)&&(u=n-c-o-(l||0));var p=new ws(a+r[3],o+r[0],h,u);return p.margin=r,p}wa(Ts,"vertical"),wa(Ts,"horizontal");var Ms=function(){this._pool={},this._allocatedTextures=[]};Ms.prototype={constructor:Ms,get:function(e){var t=Cs(e);this._pool.hasOwnProperty(t)||(this._pool[t]=[]);var r=this._pool[t];if(!r.length){var i=new Dr(e);return this._allocatedTextures.push(i),i}return r.pop()},put:function(e){var t=Cs(e);this._pool.hasOwnProperty(t)||(this._pool[t]=[]),this._pool[t].push(e)},clear:function(e){for(var t=0;t 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n #endif\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n #else\n depth += bias;\n #endif\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n@export clay.sm.debug_depth\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n@import clay.util.decode_float\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n@end\n@export clay.sm.distance.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\nattribute vec3 position : POSITION;\n@import clay.chunk.skinning_header\nvarying vec3 v_WorldPosition;\nvoid main (){\n vec4 P = vec4(position, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n gl_Position = worldViewProjection * P;\n v_WorldPosition = (world * P).xyz;\n}\n@end\n@export clay.sm.distance.fragment\nuniform vec3 lightPosition;\nuniform float range : 100;\nvarying vec3 v_WorldPosition;\n@import clay.util.encode_float\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n@export clay.plugin.shadow_map_common\n@import clay.util.decode_float\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n return shadowContrib / 9.0;\n#endif\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n@end\n@export clay.plugin.compute_shadow_map\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#endif\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\nuniform bool shadowEnabled : true;\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n@import clay.plugin.shadow_map_common\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n#ifdef SHADOW_CASCADE\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n float shadowContrib;\n shadowContribs[0] = 1.0;\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#else\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n@end");var Ns,Is,Rs,Bs,Fs,zs,Gs,Us=m.extend((function(){return{softShadow:Us.PCF,shadowBlur:1,lightFrustumBias:"auto",kernelPCF:new Float32Array([1,0,1,1,-1,1,0,1,-1,0,-1,-1,1,-1,0,-1]),precision:"highp",_lastRenderNotCastShadow:!1,_frameBuffer:new zi,_textures:{},_shadowMapNumber:{POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},_depthMaterials:{},_distanceMaterials:{},_receivers:[],_lightsCastShadow:[],_lightCameras:{},_lightMaterials:{},_texturePool:new Ds}}),(function(){this._gaussianPassH=new pn({fragment:Xe.source("clay.compositor.gaussian_blur")}),this._gaussianPassV=new pn({fragment:Xe.source("clay.compositor.gaussian_blur")}),this._gaussianPassH.setUniform("blurSize",this.shadowBlur),this._gaussianPassH.setUniform("blurDir",0),this._gaussianPassV.setUniform("blurSize",this.shadowBlur),this._gaussianPassV.setUniform("blurDir",1),this._outputDepthPass=new pn({fragment:Xe.source("clay.sm.debug_depth")})}),{render:function(e,t,r,i){r||(r=t.getMainCamera()),this.trigger("beforerender",this,e,t,r),this._renderShadowPass(e,t,r,i),this.trigger("afterrender",this,e,t,r)},renderDebug:function(e,t){e.saveClear();var r=e.viewport,i=0,n=t||r.width/4,a=n;for(var o in this.softShadow===Us.VSM?this._outputDepthPass.material.define("fragment","USE_VSM"):this._outputDepthPass.material.undefine("fragment","USE_VSM"),this._textures){var s=this._textures[o];e.setViewport(i,0,n*s.width/s.height,a),this._outputDepthPass.setUniform("depthMap",s),this._outputDepthPass.render(e),i+=n*s.width/s.height}e.setViewport(r),e.restoreClear()},_updateReceivers:function(e,t){if(t.receiveShadow?(this._receivers.push(t),t.material.set("shadowEnabled",1),t.material.set("pcfKernel",this.kernelPCF)):t.material.set("shadowEnabled",0),this.softShadow===Us.VSM)t.material.define("fragment","USE_VSM"),t.material.undefine("fragment","PCF_KERNEL_SIZE");else{t.material.undefine("fragment","USE_VSM");var r=this.kernelPCF;r&&r.length?t.material.define("fragment","PCF_KERNEL_SIZE",r.length/2):t.material.undefine("fragment","PCF_KERNEL_SIZE")}},_update:function(e,t){var r=this;t.traverse((function(t){t.isRenderable()&&r._updateReceivers(e,t)}));for(var i=0;i4){console.warn("Support at most 4 cascade");continue}p.shadowCascade>1&&(o=p),this.renderDirectionalLightShadow(e,t,r,p,c,u,h)}else"SPOT_LIGHT"===p.type?this.renderSpotLightShadow(e,t,p,l,s):"POINT_LIGHT"===p.type&&this.renderPointLightShadow(e,t,p,d);this._shadowMapNumber[p.type]++}for(var m in this._shadowMapNumber){var g=this._shadowMapNumber[m],_=m+"_SHADOWMAP_COUNT";for(f=0;f0?v.define("fragment",_,g):v.isDefined("fragment",_)&&v.undefine("fragment",_))}for(f=0;f0){var x=h.map(S);if(y.directionalLightShadowMaps={value:h,type:"tv"},y.directionalLightMatrices={value:u,type:"m4v"},y.directionalLightShadowMapSizes={value:x,type:"1fv"},o){var b=c.slice(),w=c.slice();b.pop(),w.shift(),b.reverse(),w.reverse(),u.reverse(),y.shadowCascadeClipsNear={value:b,type:"1fv"},y.shadowCascadeClipsFar={value:w,type:"1fv"}}}if(s.length>0){var T=s.map(S);(y=t.shadowUniforms).spotLightShadowMaps={value:s,type:"tv"},y.spotLightMatrices={value:l,type:"m4v"},y.spotLightShadowMapSizes={value:T,type:"1fv"}}d.length>0&&(y.pointLightShadowMaps={value:d,type:"tv"})}function S(e){return e.height}},renderDirectionalLightShadow:(Ns=new si,Is=new Ht,Rs=new ir,Bs=new Ht,Fs=new Ht,zs=new Ht,Gs=new Ht,function(e,t,r,i,n,a,o){var s=this._getDepthMaterial(i),l={getMaterial:function(e){return e.shadowDepthMaterial||s},isMaterialChanged:Os,getUniform:Ps,ifRender:function(e){return e.castShadow},sortCompare:ut.opaqueSortCompare};if(!t.viewBoundingBoxLastFrame.isFinite()){var h=t.getBoundingBox();t.viewBoundingBoxLastFrame.copy(h).applyTransform(r.viewMatrix)}var u=Math.min(-t.viewBoundingBoxLastFrame.min.z,r.far),c=Math.max(-t.viewBoundingBoxLastFrame.max.z,r.near),d=this._getDirectionalLightCamera(i,t,r),f=zs.array;Gs.copy(d.projectionMatrix),Ye.invert(Fs.array,d.worldTransform.array),Ye.multiply(Fs.array,Fs.array,r.worldTransform.array),Ye.multiply(f,Gs.array,Fs.array);for(var p=[],m=r instanceof Ei,g=(r.near+r.far)/(r.near-r.far),_=2*r.near*r.far/(r.near-r.far),v=0;v<=i.shadowCascade;v++){var y=c*Math.pow(u/c,v/i.shadowCascade),x=c+(u-c)*v/i.shadowCascade,b=y*i.cascadeSplitLogFactor+x*(1-i.cascadeSplitLogFactor);p.push(b),n.push(-(-b*g+_)/-b)}var w=this._getTexture(i,i.shadowCascade);o.push(w);var T=e.viewport,S=e.gl;for(this._frameBuffer.attach(w),this._frameBuffer.bind(e),S.clear(S.COLOR_BUFFER_BIT|S.DEPTH_BUFFER_BIT),v=0;vd?s>f?p[n>0?"px":"nx"]=!0:p[o>0?"pz":"nz"]=!0:d>f?p[a>0?"py":"ny"]=!0:p[o>0?"pz":"nz"]=!0}for(r=0;r0&&(this.outputs[e].keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e]))}}),Hs=m.extend((function(){return{nodes:[]}}),{dirty:function(){this._dirty=!0},addNode:function(e){this.nodes.indexOf(e)>=0||(this.nodes.push(e),this._dirty=!0)},removeNode:function(e){"string"==typeof e&&(e=this.getNodeByName(e));var t=this.nodes.indexOf(e);t>=0&&(this.nodes.splice(t,1),this._dirty=!0)},getNodeByName:function(e){for(var t=0;t=r.COLOR_ATTACHMENT0&&u<=r.COLOR_ATTACHMENT0+8&&h.push(u);l.drawBuffersEXT(h)}e.saveClear(),e.clearBit=16640,t=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),e.restoreClear(),i.unbind(e)}else t=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",t),this._rendering=!1,this._rendered=!0}}),Xs=Vs.extend((function(){return{texture:null,outputs:{color:{}}}}),(function(){}),{getOutput:function(e,t){return this.texture},beforeFrame:function(){},afterFrame:function(){}}),qs=Vs.extend((function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}}),(function(){var e=new pn({fragment:this.shader});this.pass=e}),{render:function(e,t){this.trigger("beforerender",e),this._rendering=!0;var r=e.gl;for(var i in this.inputLinks){var n=(c=this.inputLinks[i]).node.getOutput(e,c.pin);this.pass.setUniform(i,n)}if(this.outputs){this.pass.outputs={};var a={};for(var o in this.outputs){var s=this.updateParameter(o,e);isNaN(s.width)&&this.updateParameter(o,e);var l=this.outputs[o],h=this._compositor.allocateTexture(s);this._outputTextures[o]=h,"string"==typeof(u=l.attachment||r.COLOR_ATTACHMENT0)&&(u=r[u]),a[u]=h}for(var u in this._compositor.getFrameBuffer().bind(e),a)this._compositor.getFrameBuffer().attach(a[u],u);this.pass.render(e),this._compositor.getFrameBuffer().updateMipmap(e)}else this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(e),this.pass.render(e,t);for(var i in this.inputLinks){var c;(c=this.inputLinks[i]).node.removeReference(c.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",e)},updateParameter:function(e,t){var r,i,n=this.outputs[e],a=n.parameters,o=n._parametersCopy;if(o||(o=n._parametersCopy={}),a)for(var s in a)"width"!==s&&"height"!==s&&(o[s]=a[s]);return r="function"==typeof a.width?a.width.call(this,t):a.width,i="function"==typeof a.height?a.height.call(this,t):a.height,r=Math.ceil(r),i=Math.ceil(i),o.width===r&&o.height===i||this._outputTextures[e]&&this._outputTextures[e].dispose(t),o.width=r,o.height=i,o},setParameter:function(e,t){this.pass.setUniform(e,t)},getParameter:function(e){return this.pass.getUniform(e)},setParameters:function(e){for(var t in e)this.setParameter(t,e[t])},define:function(e,t){this.pass.material.define("fragment",e,t)},undefine:function(e){this.pass.material.undefine("fragment",e)},removeReference:function(e){this._outputReferences[e]--,0===this._outputReferences[e]&&(this.outputs[e].keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e]))},clear:function(){Vs.prototype.clear.call(this),this.pass.material.disableTexturesAll()}}),Zs="@export clay.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n@export clay.compositor.kernel.gaussian_13\nfloat gaussianKernel[13];\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n@end\n@export clay.compositor.gaussian_blur\n#define SHADER_NAME gaussian_blur\nuniform sampler2D texture;varying vec2 v_Texcoord;\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main (void)\n{\n @import clay.compositor.kernel.gaussian_9\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n@end\n",Ys="\n@export clay.compositor.lut\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform sampler2D lookup;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n float blueColor = tex.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n@end",Ks="@export clay.compositor.output\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = tex.rgb;\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n gl_FragColor = encodeHDR(gl_FragColor);\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",Qs="@export clay.compositor.bright\nuniform sampler2D texture;\nuniform float threshold : 1;\nuniform float scale : 1.0;\nuniform vec2 textureSize: [512, 512];\nvarying vec2 v_Texcoord;\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n#endif\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n gl_FragColor = encodeHDR(color);\n}\n@end\n",Js="@export clay.compositor.downsample\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n@import clay.util.clamp_sample\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n gl_FragColor = encodeHDR(color);\n}\n@end",$s="\n@export clay.compositor.upsample\n#define HIGH_QUALITY\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nuniform float sampleScale: 0.5;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main()\n{\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n@end",el="@export clay.compositor.hdr.composite\n#define TONEMAPPING\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\nvarying vec2 v_Texcoord;\n@import clay.util.srgb\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n texel.a = min(texel.a, 1.0);\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n#ifdef TONEMAPPING\n texel.rgb *= exposureBias;\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n texel = linearTosRGB(texel);\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n gl_FragColor = encodeHDR(texel);\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",tl="@export clay.compositor.blend\n#define SHADER_NAME blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n gl_FragColor = encodeHDR(tex);\n}\n@end",rl="@export clay.compositor.fxaa\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\nvarying vec2 v_Texcoord;\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n@import clay.util.rgbm\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n float lumaB = dot( rgbB, luma );\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n }\n else {\n gl_FragColor = vec4( rgbB, opacity );\n }\n}\n@end";!function(e){e.import("@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end"),e.import(Zs),e.import("@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end"),e.import(Ys),e.import("@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end"),e.import(Ks),e.import(Qs),e.import(Js),e.import($s),e.import(el),e.import("@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end"),e.import(tl),e.import(rl)}(Xe);var il=/^#source\((.*?)\)/;function nl(e,t,r){var i,n,a,o,s=e.type||"filter";if("filter"===s){var l=e.shader.trim(),h=il.exec(l);if(h?i=Xe.source(h[1].trim()):"#"===l.charAt(0)&&(i=t.shaders[l.substr(1)]),i||(i=l),!i)return}if(e.inputs)for(var u in n={},e.inputs)"string"==typeof e.inputs[u]?n[u]=e.inputs[u]:n[u]={node:e.inputs[u].node,pin:e.inputs[u].pin};if(e.outputs)for(var u in a={},e.outputs){var c=e.outputs[u];a[u]={},null!=c.attachment&&(a[u].attachment=c.attachment),null!=c.keepLastFrame&&(a[u].keepLastFrame=c.keepLastFrame),null!=c.outputLastFrame&&(a[u].outputLastFrame=c.outputLastFrame),c.parameters&&(a[u].parameters=sl(c.parameters))}if(o="scene"===s?new js({name:e.name,scene:r.scene,camera:r.camera,outputs:a}):"texture"===s?new Xs({name:e.name,outputs:a}):new qs({name:e.name,shader:i,inputs:n,outputs:a})){if(e.parameters)for(var u in e.parameters)"string"==typeof(d=e.parameters[u])?"#"===(d=d.trim()).charAt(0)?d=t.textures[d.substr(1)]:o.on("beforerender",ll(u,hl(d))):"function"==typeof d&&o.on("beforerender",d),o.setParameter(u,d);if(e.defines&&o.pass)for(var u in e.defines){var d=e.defines[u];o.pass.material.define("fragment",u,d)}}return o}function al(e,t){return e}function ol(e,t){return t}function sl(e){var t={};if(!e)return t;["type","minFilter","magFilter","wrapS","wrapT","flipY","useMipmap"].forEach((function(r){var i=e[r];null!=i&&("string"==typeof i&&(i=wr[i]),t[r]=i)}));var r=e.scale||1;return["width","height"].forEach((function(i){if(null!=e[i]){var n=e[i];"string"==typeof n?(n=n.trim(),t[i]=(a=hl(n),o=(o=r)||1,function(e){var t=e.getDevicePixelRatio(),r=e.getWidth()*o,i=e.getHeight()*o;return a(r,i,t)})):t[i]=n}var a,o})),t.width||(t.width=al),t.height||(t.height=ol),null!=e.useMipmap&&(t.useMipmap=e.useMipmap),t}function ll(e,t){return function(r){var i=r.getDevicePixelRatio(),n=r.getWidth(),a=r.getHeight(),o=t(n,a,i);this.setParameter(e,o)}}function hl(e){var t=/^expr\((.*)\)$/.exec(e);if(t)try{var r=new Function("width","height","dpr","return "+t[1]);return r(1,1),r}catch(e){throw new Error("Invalid expression.")}}const ul=function(e,t){for(var r=0,i=1/t,n=e;n>0;)r+=i*(n%t),n=Math.floor(n/t),i/=t;return r};function cl(e){for(var t=new Uint8Array(e*e*4),r=0,i=new vt,n=0;n 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n#define SHADER_NAME SSAO_BLUR\n\nuniform sampler2D ssaoTexture;\n\n#ifdef NORMALTEX_ENABLED\nuniform sampler2D normalTex;\n#endif\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\nuniform int direction: 0.0;\n\n#ifdef DEPTHTEX_ENABLED\nuniform sampler2D depthTex;\nuniform mat4 projection;\nuniform float depthRange : 0.5;\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n#endif\n\nvoid main()\n{\n float kernel[5];\n kernel[0] = 0.122581;\n kernel[1] = 0.233062;\n kernel[2] = 0.288713;\n kernel[3] = 0.233062;\n kernel[4] = 0.122581;\n\n vec2 off = vec2(0.0);\n if (direction == 0) {\n off[0] = blurSize / textureSize.x;\n }\n else {\n off[1] = blurSize / textureSize.y;\n }\n\n vec2 coord = v_Texcoord;\n\n float sum = 0.0;\n float weightAll = 0.0;\n\n#ifdef NORMALTEX_ENABLED\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\n#endif\n#if defined(DEPTHTEX_ENABLED)\n float centerDepth = getLinearDepth(v_Texcoord);\n#endif\n\n for (int i = 0; i < 5; i++) {\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\n\n float w = kernel[i];\n#ifdef NORMALTEX_ENABLED\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\n#endif\n#ifdef DEPTHTEX_ENABLED\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\n#endif\n\n weightAll += w;\n sum += texture2D(ssaoTexture, coord).r * w;\n }\n\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\n}\n\n@end\n"),pl.prototype.setDepthTexture=function(e){this._depthTex=e},pl.prototype.setNormalTexture=function(e){this._normalTex=e,this._ssaoPass.material[e?"enableTexture":"disableTexture"]("normalTex"),this.setKernelSize(this._kernelSize)},pl.prototype.update=function(e,t,r){var i=e.getWidth(),n=e.getHeight(),a=this._ssaoPass,o=this._blurPass;a.setUniform("kernel",this._kernels[r%this._kernels.length]),a.setUniform("depthTex",this._depthTex),null!=this._normalTex&&a.setUniform("normalTex",this._normalTex),a.setUniform("depthTexSize",[this._depthTex.width,this._depthTex.height]);var s=new Ht;Ht.transpose(s,t.worldTransform),a.setUniform("projection",t.projectionMatrix.array),a.setUniform("projectionInv",t.invProjectionMatrix.array),a.setUniform("viewInverseTranspose",s.array);var l=this._ssaoTexture,h=this._blurTexture,u=this._blurTexture2;l.width=i/2,l.height=n/2,h.width=i,h.height=n,u.width=i,u.height=n,this._framebuffer.attach(l),this._framebuffer.bind(e),e.gl.clearColor(1,1,1,1),e.gl.clear(e.gl.COLOR_BUFFER_BIT),a.render(e),o.setUniform("textureSize",[i/2,n/2]),o.setUniform("projection",t.projectionMatrix.array),this._framebuffer.attach(h),o.setUniform("direction",0),o.setUniform("ssaoTexture",l),o.render(e),this._framebuffer.attach(u),o.setUniform("textureSize",[i,n]),o.setUniform("direction",1),o.setUniform("ssaoTexture",h),o.render(e),this._framebuffer.unbind(e);var c=e.clearColor;e.gl.clearColor(c[0],c[1],c[2],c[3])},pl.prototype.getTargetTexture=function(){return this._blurTexture2},pl.prototype.setParameter=function(e,t){"noiseTexSize"===e?this.setNoiseSize(t):"kernelSize"===e?this.setKernelSize(t):"intensity"===e?this._ssaoPass.material.set("intensity",t):this._ssaoPass.setUniform(e,t)},pl.prototype.setKernelSize=function(e){this._kernelSize=e,this._ssaoPass.material.define("fragment","KERNEL_SIZE",e),this._kernels=this._kernels||[];for(var t=0;t<30;t++)this._kernels[t]=fl(e,t*e,!!this._normalTex)},pl.prototype.setNoiseSize=function(e){var t=this._ssaoPass.getUniform("noiseTex");t?(t.data=cl(e),t.width=t.height=e,t.dirty()):(t=dl(e),this._ssaoPass.setUniform("noiseTex",dl(e))),this._ssaoPass.setUniform("noiseTexSize",[e,e])},pl.prototype.dispose=function(e){this._blurTexture.dispose(e),this._ssaoTexture.dispose(e),this._blurTexture2.dispose(e)};const ml=pl;function gl(e){e=e||{},this._ssrPass=new pn({fragment:Xe.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new pn({fragment:Xe.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new pn({fragment:Xe.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blendPass=new pn({fragment:Xe.source("clay.compositor.blend")}),this._blendPass.material.disableTexturesAll(),this._blendPass.material.enableTexture(["texture1","texture2"]),this._ssrPass.setUniform("gBufferTexture1",e.normalTexture),this._ssrPass.setUniform("gBufferTexture2",e.depthTexture),this._blurPass1.setUniform("gBufferTexture1",e.normalTexture),this._blurPass1.setUniform("gBufferTexture2",e.depthTexture),this._blurPass2.setUniform("gBufferTexture1",e.normalTexture),this._blurPass2.setUniform("gBufferTexture2",e.depthTexture),this._blurPass2.material.define("fragment","VERTICAL"),this._blurPass2.material.define("fragment","BLEND"),this._ssrTexture=new Dr({type:wr.HALF_FLOAT}),this._texture2=new Dr({type:wr.HALF_FLOAT}),this._texture3=new Dr({type:wr.HALF_FLOAT}),this._prevTexture=new Dr({type:wr.HALF_FLOAT}),this._currentTexture=new Dr({type:wr.HALF_FLOAT}),this._frameBuffer=new zi({depthBuffer:!1}),this._normalDistribution=null,this._totalSamples=256,this._samplePerFrame=4,this._ssrPass.material.define("fragment","SAMPLE_PER_FRAME",this._samplePerFrame),this._ssrPass.material.define("fragment","TOTAL_SAMPLES",this._totalSamples),this._downScale=1}Xe.import("@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"),gl.prototype.setAmbientCubemap=function(e,t){this._ssrPass.material.set("specularCubemap",e),this._ssrPass.material.set("specularIntensity",t);var r=e&&t;this._ssrPass.material[r?"enableTexture":"disableTexture"]("specularCubemap")},gl.prototype.update=function(e,t,r,i){var n=e.getWidth(),a=e.getHeight(),o=this._ssrTexture,s=this._texture2,l=this._texture3;o.width=this._prevTexture.width=this._currentTexture.width=n/this._downScale,o.height=this._prevTexture.height=this._currentTexture.height=a/this._downScale,s.width=l.width=n,s.height=l.height=a;var h=this._frameBuffer,u=this._ssrPass,c=this._blurPass1,d=this._blurPass2,f=this._blendPass,p=new Ht,m=new Ht;Ht.transpose(p,t.worldTransform),Ht.transpose(m,t.viewMatrix),u.setUniform("sourceTexture",r),u.setUniform("projection",t.projectionMatrix.array),u.setUniform("projectionInv",t.invProjectionMatrix.array),u.setUniform("toViewSpace",p.array),u.setUniform("toWorldSpace",m.array),u.setUniform("nearZ",t.near);var g=i/this._totalSamples*this._samplePerFrame;if(u.setUniform("jitterOffset",g),u.setUniform("sampleOffset",i*this._samplePerFrame),c.setUniform("textureSize",[o.width,o.height]),d.setUniform("textureSize",[n,a]),d.setUniform("sourceTexture",r),c.setUniform("projection",t.projectionMatrix.array),d.setUniform("projection",t.projectionMatrix.array),h.attach(o),h.bind(e),u.render(e),this._physicallyCorrect&&(h.attach(this._currentTexture),f.setUniform("texture1",this._prevTexture),f.setUniform("texture2",o),f.material.set({weight1:i>=1?.95:0,weight2:i>=1?.05:1}),f.render(e)),h.attach(s),c.setUniform("texture",this._physicallyCorrect?this._currentTexture:o),c.render(e),h.attach(l),d.setUniform("texture",s),d.render(e),h.unbind(e),this._physicallyCorrect){var _=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=_}},gl.prototype.getTargetTexture=function(){return this._texture3},gl.prototype.setParameter=function(e,t){"maxIteration"===e?this._ssrPass.material.define("fragment","MAX_ITERATION",t):this._ssrPass.setUniform(e,t)},gl.prototype.setPhysicallyCorrect=function(e){e?(this._normalDistribution||(this._normalDistribution=_n.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=e},gl.prototype.setSSAOTexture=function(e){var t=this._blurPass2;e?(t.material.enableTexture("ssaoTex"),t.material.set("ssaoTex",e)):t.material.disableTexture("ssaoTex")},gl.prototype.isFinished=function(e){return!this._physicallyCorrect||e>this._totalSamples/this._samplePerFrame},gl.prototype.dispose=function(e){this._ssrTexture.dispose(e),this._texture2.dispose(e),this._texture3.dispose(e),this._prevTexture.dispose(e),this._currentTexture.dispose(e),this._frameBuffer.dispose(e)};const _l=gl,vl=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925];function yl(e,t,r,i,n){var a=e.gl;t.setUniform(a,"1i",r,n),a.activeTexture(a.TEXTURE0+n),i.isRenderable()?i.bind(e):i.unbind(e)}function xl(e,t,r,i,n){var a,o,s,l,h=e.gl;return function(n,u,c){if(!l||l.material!==n.material){var d=n.material,f=n.__program,p=d.get("roughness");null==p&&(p=1);var m=d.get("normalMap")||t,g=d.get("roughnessMap"),_=d.get("bumpMap"),v=d.get("uvRepeat"),y=d.get("uvOffset"),x=d.get("detailUvRepeat"),b=d.get("detailUvOffset"),w=!!_&&d.isTextureEnabled("bumpMap"),T=!!g&&d.isTextureEnabled("roughnessMap"),S=d.isDefined("fragment","DOUBLE_SIDED");_=_||r,g=g||i,c!==u?(u.set("normalMap",m),u.set("bumpMap",_),u.set("roughnessMap",g),u.set("useBumpMap",w),u.set("useRoughnessMap",T),u.set("doubleSide",S),null!=v&&u.set("uvRepeat",v),null!=y&&u.set("uvOffset",y),null!=x&&u.set("detailUvRepeat",x),null!=b&&u.set("detailUvOffset",b),u.set("roughness",p)):(f.setUniform(h,"1f","roughness",p),a!==m&&yl(e,f,"normalMap",m,0),o!==_&&_&&yl(e,f,"bumpMap",_,1),s!==g&&g&&yl(e,f,"roughnessMap",g,2),null!=v&&f.setUniform(h,"2f","uvRepeat",v),null!=y&&f.setUniform(h,"2f","uvOffset",y),null!=x&&f.setUniform(h,"2f","detailUvRepeat",x),null!=b&&f.setUniform(h,"2f","detailUvOffset",b),f.setUniform(h,"1i","useBumpMap",+w),f.setUniform(h,"1i","useRoughnessMap",+T),f.setUniform(h,"1i","doubleSide",+S)),a=m,o=_,s=g,l=n}}}function bl(e){e=e||{},this._depthTex=new Dr({format:wr.DEPTH_COMPONENT,type:wr.UNSIGNED_INT}),this._normalTex=new Dr({type:wr.HALF_FLOAT}),this._framebuffer=new zi,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,zi.DEPTH_ATTACHMENT),this._normalMaterial=new le({shader:new Xe(Xe.source("ecgl.normal.vertex"),Xe.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=an.createBlank("#000"),this._defaultBumpMap=an.createBlank("#000"),this._defaultRoughessMap=an.createBlank("#000"),this._debugPass=new pn({fragment:Xe.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}Xe.import("@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"),bl.prototype.getDepthTexture=function(){return this._depthTex},bl.prototype.getNormalTexture=function(){return this._normalTex},bl.prototype.update=function(e,t,r){var i=e.getWidth(),n=e.getHeight(),a=this._depthTex,o=this._normalTex,s=this._normalMaterial;a.width=i,a.height=n,o.width=i,o.height=n;var l=t.getRenderList(r).opaque;this._framebuffer.bind(e),e.gl.clearColor(0,0,0,0),e.gl.clear(e.gl.COLOR_BUFFER_BIT|e.gl.DEPTH_BUFFER_BIT),e.gl.disable(e.gl.BLEND),e.renderPass(l,r,{getMaterial:function(){return s},ifRender:function(e){return e.renderNormal},beforeRender:xl(e,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:e.opaqueSortCompare}),this._framebuffer.unbind(e)},bl.prototype.renderDebug=function(e){this._debugPass.render(e)},bl.prototype.dispose=function(e){this._depthTex.dispose(e),this._normalTex.dispose(e)};const wl=bl;function Tl(e){e=e||{},this._edgePass=new pn({fragment:Xe.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",e.normalTexture),this._edgePass.setUniform("depthTexture",e.depthTexture),this._targetTexture=new Dr({type:wr.HALF_FLOAT}),this._frameBuffer=new zi,this._frameBuffer.attach(this._targetTexture)}Tl.prototype.update=function(e,t,r,i){var n=e.getWidth(),a=e.getHeight(),o=this._targetTexture;o.width=n,o.height=a;var s=this._frameBuffer;s.bind(e),this._edgePass.setUniform("projectionInv",t.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[n,a]),this._edgePass.setUniform("texture",r),this._edgePass.render(e),s.unbind(e)},Tl.prototype.getTargetTexture=function(){return this._targetTexture},Tl.prototype.setParameter=function(e,t){this._edgePass.setUniform(e,t)},Tl.prototype.dispose=function(e){this._targetTexture.dispose(e),this._frameBuffer.dispose(e)};const Sl=Tl,Ml={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]};function Al(e,t){return{color:{parameters:{width:e,height:t}}}}Xe.import(Zs),Xe.import(Ys),Xe.import(Ks),Xe.import(Qs),Xe.import(Js),Xe.import($s),Xe.import(el),Xe.import(tl),Xe.import(rl),Xe.import("@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end"),Xe.import("@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end");var El=["composite","FXAA"];function Cl(){this._width,this._height,this._dpr,this._sourceTexture=new Dr({type:wr.HALF_FLOAT}),this._depthTexture=new Dr({format:wr.DEPTH_COMPONENT,type:wr.UNSIGNED_INT}),this._framebuffer=new zi,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,zi.DEPTH_ATTACHMENT),this._normalPass=new wl,this._compositor=function(e,t){var r=new Ws;t=t||{};var i={textures:{},parameters:{}};for(var n in e.parameters){var a=e.parameters[n];i.parameters[n]=sl(a)}return function(e,t,r,i){if(e.textures){var n={},a=0,o=!1,s=r.textureRootPath;f.each(e.textures,(function(e,t){var r,l=e.path,h=sl(e.parameters);if(Array.isArray(l)&&6===l.length)s&&(l=l.map((function(e){return f.relative2absolute(e,s)}))),r=new Ai(h);else{if("string"!=typeof l)return;s&&(l=f.relative2absolute(l,s)),r=new Dr(h)}r.load(l),a++,r.once("success",(function(){n[t]=r,0==--a&&(i(n),o=!0)}))})),0!==a||o||i(n)}else i({})}(e,0,t,(function(n){i.textures=n,function(n,a){for(var o=0;o=this._haltonSequence.length},render:function(e,t,r){var i=this._blendPass;0===this._frame?(i.setUniform("weight1",0),i.setUniform("weight2",1)):(i.setUniform("weight1",.9),i.setUniform("weight2",.1)),i.setUniform("texture1",this._prevFrameTex),i.setUniform("texture2",t||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(e),i.render(e),this._blendFb.unbind(e),r||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(e));var n=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=n,this._frame++},dispose:function(e){this._sourceFb.dispose(e),this._blendFb.dispose(e),this._prevFrameTex.dispose(e),this._outputTex.dispose(e),this._sourceTex.dispose(e),this._outputPass.dispose(e),this._blendPass.dispose(e)}};const Pl=Ll;function Ol(e){e=e||"perspective",this.layer=null,this.scene=new vi,this.rootNode=this.scene,this.viewport={x:0,y:0,width:0,height:0},this.setProjection(e),this._compositor=new Dl,this._temporalSS=new Pl,this._shadowMapPass=new ks;for(var t=[],r=0,i=0;i<30;i++){for(var n=[],a=0;a<6;a++)n.push(4*ul(r,2)-2),n.push(4*ul(r,3)-2),r++;t.push(n)}this._pcfKernels=t,this.scene.on("beforerender",(function(e,t,r){this.needsTemporalSS()&&this._temporalSS.jitterProjection(e,r)}),this)}Ol.prototype.setProjection=function(e){var t=this.camera;t&&t.update(),"perspective"===e?this.camera instanceof Ei||(this.camera=new Ei,t&&this.camera.setLocalTransform(t.localTransform)):this.camera instanceof un||(this.camera=new un,t&&this.camera.setLocalTransform(t.localTransform)),this.camera.near=.1,this.camera.far=2e3},Ol.prototype.setViewport=function(e,t,r,i,n){this.camera instanceof Ei&&(this.camera.aspect=r/i),n=n||1,this.viewport.x=e,this.viewport.y=t,this.viewport.width=r,this.viewport.height=i,this.viewport.devicePixelRatio=n,this._compositor.resize(r*n,i*n),this._temporalSS.resize(r*n,i*n)},Ol.prototype.containPoint=function(e,t){var r=this.viewport;return t=this.layer.renderer.getHeight()-t,e>=r.x&&t>=r.y&&e<=r.x+r.width&&t<=r.y+r.height};var Nl=new _e;Ol.prototype.castRay=function(e,t,r){var i=this.layer.renderer,n=i.viewport;return i.viewport=this.viewport,i.screenToNDC(e,t,Nl),this.camera.castRay(Nl,r),i.viewport=n,r},Ol.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var e=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var t=0;t30},Ol.prototype._doRender=function(e,t,r){var i=this.scene,n=this.camera;r=r||0,this._updateTransparent(e,i,n,r),t||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(e,i,n,!0)),this._updateShadowPCFKernel(r);var a,o=e.clearColor;e.gl.clearColor(o[0],o[1],o[2],o[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(e,n),this._compositor.updateNormal(e,i,n,this._temporalSS.getFrame())),this._updateSSAO(e,i,n,this._temporalSS.getFrame()),this._enablePostEffect?((a=this._compositor.getSourceFrameBuffer()).bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT),e.render(i,n,!0,!0),a.unbind(e),this.needsTemporalSS()&&t?(this._compositor.composite(e,i,n,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),e.setViewport(this.viewport),this._temporalSS.render(e)):(e.setViewport(this.viewport),this._compositor.composite(e,i,n,null,0))):this.needsTemporalSS()&&t?((a=this._temporalSS.getSourceFrameBuffer()).bind(e),e.saveClear(),e.clearBit=e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT,e.render(i,n,!0,!0),e.restoreClear(),a.unbind(e),e.setViewport(this.viewport),this._temporalSS.render(e)):(e.setViewport(this.viewport),e.render(i,n,!0,!0))},Ol.prototype._updateTransparent=function(e,t,r,i){for(var n=new vt,a=new Ht,o=r.getWorldPosition(),s=t.getRenderList(r).transparent,l=0;lthis.camera.far||e80*r){i=a=e[0],n=o=e[1];for(var p=r;pa&&(a=s),l>o&&(o=l);h=Math.max(a-i,o-n)}return nh(d,f,r,i,n,h),f}function rh(e,t,r,i,n){var a,o;if(n===Th(e,t,r,i)>0)for(a=t;a=t;a-=i)o=xh(a,e[a],e[a+1],o);return o&&gh(o,o.next)&&(bh(o),o=o.next),o}function ih(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!gh(i,i.next)&&0!==mh(i.prev,i,i.next))i=i.next;else{if(bh(i),(i=t=i.prev)===i.next)return null;r=!0}}while(r||i!==t);return t}function nh(e,t,r,i,n,a,o){if(e){!o&&a&&function(e,t,r,i){var n=e;do{null===n.z&&(n.z=ch(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,r,i,n,a,o,s,l,h=1;do{for(r=e,e=null,a=null,o=0;r;){for(o++,i=r,s=0,t=0;t0||l>0&&i;)0!==s&&(0===l||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;r=i}a.nextZ=null,h*=2}while(o>1)}(n)}(e,i,n,a);for(var s,l,h=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?oh(e,i,n,a):ah(e))t.push(s.i/r),t.push(e.i/r),t.push(l.i/r),bh(e),e=l.next,h=l.next;else if((e=l)===h){o?1===o?nh(e=sh(e,t,r),t,r,i,n,a,2):2===o&&lh(e,t,r,i,n,a):nh(ih(e),t,r,i,n,a,1);break}}}function ah(e){var t=e.prev,r=e,i=e.next;if(mh(t,r,i)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(fh(t.x,t.y,r.x,r.y,i.x,i.y,n.x,n.y)&&mh(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function oh(e,t,r,i){var n=e.prev,a=e,o=e.next;if(mh(n,a,o)>=0)return!1;for(var s=n.xa.x?n.x>o.x?n.x:o.x:a.x>o.x?a.x:o.x,u=n.y>a.y?n.y>o.y?n.y:o.y:a.y>o.y?a.y:o.y,c=ch(s,l,t,r,i),d=ch(h,u,t,r,i),f=e.nextZ;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&fh(n.x,n.y,a.x,a.y,o.x,o.y,f.x,f.y)&&mh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=e.prevZ;f&&f.z>=c;){if(f!==e.prev&&f!==e.next&&fh(n.x,n.y,a.x,a.y,o.x,o.y,f.x,f.y)&&mh(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function sh(e,t,r){var i=e;do{var n=i.prev,a=i.next.next;!gh(n,a)&&_h(n,i,i.next,a)&&vh(n,a)&&vh(a,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(a.i/r),bh(i),bh(i.next),i=e=a),i=i.next}while(i!==e);return i}function lh(e,t,r,i,n,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&ph(o,s)){var l=yh(o,s);return o=ih(o,o.next),l=ih(l,l.next),nh(o,t,r,i,n,a),void nh(l,t,r,i,n,a)}s=s.next}o=o.next}while(o!==e)}function hh(e,t){return e.x-t.x}function uh(e,t){if(t=function(e,t){var r,i=t,n=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>o){if(o=s,s===n){if(a===i.y)return i;if(a===i.next.y)return i.next}r=i.x=i.x&&i.x>=u&&n!==i.x&&fh(ar.x)&&vh(i,e)&&(r=i,d=l),i=i.next;return r}(e,t)){var r=yh(t,e);ih(r,r.next)}}function ch(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)/n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function dh(e){var t=e,r=e;do{t.x=0&&(e-o)*(i-s)-(r-o)*(t-s)>=0&&(r-o)*(a-s)-(n-o)*(i-s)>=0}function ph(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&_h(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&vh(e,t)&&vh(t,e)&&function(e,t){var r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&n<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}(e,t)}function mh(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function gh(e,t){return e.x===t.x&&e.y===t.y}function _h(e,t,r,i){return!!(gh(e,t)&&gh(r,i)||gh(e,i)&&gh(r,t))||mh(e,t,r)>0!=mh(e,t,i)>0&&mh(r,i,e)>0!=mh(r,i,t)>0}function vh(e,t){return mh(e.prev,e,e.next)<0?mh(e,t,e.next)>=0&&mh(e,e.prev,t)>=0:mh(e,t,e.prev)<0||mh(e,e.next,t)<0}function yh(e,t){var r=new wh(e.i,e.x,e.y),i=new wh(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function xh(e,t,r,i){var n=new wh(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function bh(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function wh(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Th(e,t,r,i){for(var n=0,a=t,o=r-i;ah&&s.push({pivot:Math.floor((l+h)/2),left:h,right:l}),h=a[o].pivot+1,(l=a[o].right)>h&&s.push({pivot:Math.floor((l+h)/2),left:h,right:l})}a=this._parts=s}else for(o=0;o=2e4},doSortTriangles:function(e,t){var r=this.indices;if(0===t){var i=this.attributes.position;e=e.array,this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new r.constructor(r.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var n,a=0,o=0;o0,r={},n=0;n65535?new Uint32Array(3*o):new Uint16Array(3*o),d.material.shader!==t&&d.material.attachShader(t,!0),Ka.setMaterialFromModel(t.__shading,d.material,e,r),s>0&&(this._linesMesh.geometry.resetOffset(),this._linesMesh.geometry.setVertexCount(s),this._linesMesh.geometry.setTriangleCount(l)),this._dataIndexOfVertex=new Uint32Array(a),this._vertexRangeOfDataIndex=new Uint32Array(2*(n-i))},_updateRegionMesh:function(e,t,r,i){for(var n=e.getData(),a=0,o=0,s=!1,l=this._polygonMesh,h=this._linesMesh,u=r;u0;w&&(b*=t.getDevicePixelRatio(),this._updateLinesGeometry(h.geometry,e,u,v,b,e.coordinateSystem.transform)),h.invisible=!w,h.material.set({color:g})}(l=this._polygonMesh).material.transparent=s,l.material.depthMask=!s,l.geometry.updateBoundingBox(),l.frontFace=this.extrudeY?Ka.Mesh.CCW:Ka.Mesh.CW,l.material.get("normalMap")&&l.geometry.generateTangents(),l.seriesIndex=e.seriesIndex,l.on("mousemove",this._onmousemove,this),l.on("mouseout",this._onmouseout,this)},_updateDebugWireframe:function(e){var t=e.getModel("debug.wireframe");if(t.get("show")){var r=Ka.parseColor(t.get("lineStyle.color")||"rgba(0,0,0,0.5)"),i=Mn(t.get("lineStyle.width"),1),n=this._polygonMesh;n.geometry.generateBarycentric(),n.material.define("both","WIREFRAME_TRIANGLE"),n.material.set("wireframeLineColor",r),n.material.set("wireframeLineWidth",i)}},_onmousemove:function(e){var t=this._dataIndexOfVertex[e.triangle[0]];null==t&&(t=-1),t!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(t),this._labelsBuilder.updateLabels([t])),this._lastHoverDataIndex=t,this._polygonMesh.dataIndex=t},_onmouseout:function(e){e.target&&(this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1),this._labelsBuilder.updateLabels([])},_updateGroundPlane:function(e,t,r){var i=e.getModel("groundPlane",e);if(this._groundMesh.invisible=!i.get("show",!0),!this._groundMesh.invisible){var n=e.get("shading"),a=this._groundMaterials[n];a||(a=this._groundMaterials.lambert),Ka.setMaterialFromModel(n,a,i,r),a.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=a,this._groundMesh.material.set("color",Ka.parseColor(i.get("color"))),this._groundMesh.scale.set(t.size[0],t.size[2],1)}},_triangulation:function(e,t,r){this._triangulationResults=[];for(var i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0],a=e.coordinateSystem,o=t;o1?i:0,L[U][g]=A.points[V+2],l.set(n+U,L[U]),s?(I[0]=(A.points[V]*_[0]-v[0])/x,I[1]=(A.points[V+2]*_[g]-v[g])/x):(I[0]=(k?R:R+G)/x,I[1]=(L[U][m]*_[m]-v[m])/x),u.set(n+U,I)}for(zh.sub(P,L[1],L[0]),zh.sub(O,L[3],L[0]),zh.cross(N,P,O),zh.normalize(N,N),U=0;U<4;U++)h.set(n+U,N),f&&c.set(n+U,o);for(U=0;U<6;U++)p[3*a+U]=D[U]+n;n+=4,a+=2,R+=G}}return t.dirty(),{vertexOffset:n,triangleOffset:a}},_getRegionLinesInfo:function(e,t,r){var i=0,n=0;return t.getRegionModel(e).getModel("itemStyle").get("borderWidth")>0&&t.getRegionPolygonCoords(e).forEach((function(e){var t=e.exterior,a=e.interiors;i+=r.getPolylineVertexCount(t),n+=r.getPolylineTriangleCount(t);for(var o=0;othis._endIndex)){t-=this._startIndex;for(var i=this._vertexRangeOfDataIndex[2*t];i0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var e=this.getDisplacementTexture(),t=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==e||this._displacementScale!==t,this._displacementTexture=e,this._displacementScale=t},isDisplacementChanged:function(){return this._displacementChanged}});i.util.merge(ru.prototype,uo),i.util.merge(ru.prototype,co),i.util.merge(ru.prototype,fo),i.util.merge(ru.prototype,Kl);const iu=ru;var nu=Math.PI,au=Math.sin,ou=Math.cos,su=Math.tan,lu=Math.asin,hu=Math.atan2,uu=nu/180,cu=23.4397*uu;function du(e,t){return hu(au(e)*ou(cu)-su(t)*au(cu),ou(e))}function fu(e,t,r){return hu(au(e),ou(e)*au(t)-su(r)*ou(t))}function pu(e,t,r){return lu(au(t)*au(r)+ou(t)*ou(r)*ou(e))}var mu={};mu.getPosition=function(e,t,r){var i=uu*-r,n=uu*t,a=function(e){return function(e){return e.valueOf()/864e5-.5+2440588}(e)-2451545}(e),o=function(e){var t,r,i=(r=function(e){return uu*(357.5291+.98560028*e)}(e))+uu*(1.9148*au(r)+.02*au(2*r)+3e-4*au(3*r))+102.9372*uu+nu;return{dec:(t=i,lu(au(0)*ou(cu)+ou(0)*au(cu)*au(t))),ra:du(i,0)}}(a),s=function(e,t){return uu*(280.16+360.9856235*e)-t}(a,i)-o.ra;return{azimuth:fu(s,n,o.dec),altitude:pu(s,n,o.dec)}};const gu=mu;Ka.Shader.import(Va),Ka.Shader.import("@export ecgl.atmosphere.vertex\nattribute vec3 position: POSITION;\nattribute vec3 normal : NORMAL;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n\n\n@export ecgl.atmosphere.fragment\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform float glowPower;\nuniform vec3 glowColor;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor = vec4(glowColor, intensity * intensity);\n}\n@end");const _u=i.ComponentView.extend({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(e,t){this.groupGL=new Ka.Node,this._sphereGeometry=new Ka.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new Ka.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new Ka.PlaneGeometry,this._earthMesh=new Ka.Mesh({renderNormal:!0}),this._atmosphereMesh=new Ka.Mesh,this._atmosphereGeometry=new Ka.SphereGeometry({widthSegments:80,heightSegments:40}),this._atmosphereMaterial=new Ka.Material({shader:new Ka.Shader(Ka.Shader.source("ecgl.atmosphere.vertex"),Ka.Shader.source("ecgl.atmosphere.fragment")),transparent:!0}),this._atmosphereMesh.geometry=this._atmosphereGeometry,this._atmosphereMesh.material=this._atmosphereMaterial,this._atmosphereMesh.frontFace=Ka.Mesh.CW,this._lightRoot=new Ka.Node,this._sceneHelper=new Uo,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._atmosphereMesh),this.groupGL.add(this._earthMesh),this._control=new Do({zr:t.getZr()}),this._control.init(),this._layerMeshes={}},render:function(e,t,r){var i=e.coordinateSystem,n=e.get("shading");i.viewGL.add(this._lightRoot),e.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL),this._sceneHelper.setScene(i.viewGL.scene),i.viewGL.setPostEffect(e.getModel("postEffect"),r),i.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling"));var a=this._earthMesh;a.geometry=this._sphereGeometry;var o="ecgl."+n;a.material&&a.material.shader.name===o||(a.material=Ka.createMaterial(o)),Ka.setMaterialFromModel(n,a.material,e,r),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach((function(e){var t=a.material.get(e);t&&(t.flipY=!1)})),a.material.set("color",Ka.parseColor(e.get("baseColor")));var s=.99*i.radius;if(a.scale.set(s,s,s),e.get("atmosphere.show")){a.material.define("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!1,this._atmosphereMaterial.setUniforms({glowPower:e.get("atmosphere.glowPower")||6,glowColor:e.get("atmosphere.color")||"#ffffff"}),a.material.setUniforms({glowPower:e.get("atmosphere.innerGlowPower")||2,glowColor:e.get("atmosphere.color")||"#ffffff"});var l=e.get("atmosphere.offset")||5;this._atmosphereMesh.scale.set(s+l,s+l,s+l)}else a.material.undefine("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!0;var h=a.material.setTextureImage("diffuseMap",e.get("baseTexture"),r,{flipY:!1,anisotropic:8});h&&h.surface&&h.surface.attachToMesh(a);var u=a.material.setTextureImage("bumpMap",e.get("heightTexture"),r,{flipY:!1,anisotropic:8});u&&u.surface&&u.surface.attachToMesh(a),a.material[e.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(e,r),this._displaceVertices(e,r),this._updateViewControl(e,r),this._updateLayers(e,r)},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r)},_updateLayers:function(e,t){var r=e.coordinateSystem,n=e.get("layers"),a=r.radius,o=[],s=[],l=[],h=[];i.util.each(n,(function(e){var n=new i.Model(e),u=n.get("type"),c=Ka.loadTexture(n.get("texture"),t,{flipY:!1,anisotropic:8});if(c.surface&&c.surface.attachToMesh(this._earthMesh),"blend"===u){var d=n.get("blendTo"),f=Mn(n.get("intensity"),1);"emission"===d?(l.push(c),h.push(f)):(o.push(c),s.push(f))}else{var p=n.get("id"),m=this._layerMeshes[p];m||(m=this._layerMeshes[p]=new Ka.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0})),"lambert"===n.get("shading")?(m.material=m.__lambertMaterial||new Ka.Material({autoUpdateTextureStatus:!1,shader:Ka.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),m.__lambertMaterial=m.material):(m.material=m.__colorMaterial||new Ka.Material({autoUpdateTextureStatus:!1,shader:Ka.createShader("ecgl.color"),transparent:!0,depthMask:!1}),m.__colorMaterial=m.material),m.material.enableTexture("diffuseMap");var g=n.get("distance"),_=a+(null==g?r.radius/100:g);m.scale.set(_,_,_),a=_;var v=this._blankTexture||(this._blankTexture=Ka.createBlankTexture("rgba(255, 255, 255, 0)"));m.material.set("diffuseMap",v),Ka.loadTexture(n.get("texture"),t,{flipY:!1,anisotropic:8},(function(e){e.surface&&e.surface.attachToMesh(m),m.material.set("diffuseMap",e),t.getZr().refresh()})),n.get("show")?this.groupGL.add(m):this.groupGL.remove(m)}}),this);var u=this._earthMesh.material;u.define("fragment","LAYER_DIFFUSEMAP_COUNT",o.length),u.define("fragment","LAYER_EMISSIVEMAP_COUNT",l.length),u.set("layerDiffuseMap",o),u.set("layerDiffuseIntensity",s),u.set("layerEmissiveMap",l),u.set("layerEmissionIntensity",h);var c=e.getModel("debug.wireframe");if(c.get("show")){u.define("both","WIREFRAME_TRIANGLE");var d=Ka.parseColor(c.get("lineStyle.color")||"rgba(0,0,0,0.5)"),f=Mn(c.get("lineStyle.width"),1);u.set("wireframeLineWidth",f),u.set("wireframeLineColor",d)}else u.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(e,t){var r=e.coordinateSystem,i=e.getModel("viewControl"),n=(r.viewGL.camera,this),a=this._control;a.setViewGL(r.viewGL);var o,s,l=i.get("targetCoord");null!=l&&(s=l[0]+90,o=l[1]),a.setFromViewControlModel(i,{baseDistance:r.radius,alpha:o,beta:s}),a.off("update"),a.on("update",(function(){t.dispatchAction({type:"globeChangeCamera",alpha:a.getAlpha(),beta:a.getBeta(),distance:a.getDistance()-r.radius,center:a.getCenter(),from:n.uid,globeId:e.id})}))},_displaceVertices:function(e,t){var r=e.get("displacementQuality"),i=e.get("debug.wireframe.show"),n=e.coordinateSystem;if(e.isDisplacementChanged()||r!==this._displacementQuality||i!==this._showDebugWireframe){this._displacementQuality=r,this._showDebugWireframe=i;var a=this._sphereGeometry,o={low:100,medium:200,high:400,ultra:800}[r]||200,s=o/2;(a.widthSegments!==o||i)&&(a.widthSegments=o,a.heightSegments=s,a.build()),this._doDisplaceVertices(a,n),i&&a.generateBarycentric()}},_doDisplaceVertices:function(e,t){var r=e.attributes.position.value,i=e.attributes.texcoord0.value,n=e.__originalPosition;n&&n.length===r.length||((n=new Float32Array(r.length)).set(r),e.__originalPosition=n);for(var a=t.displacementWidth,o=t.displacementHeight,s=t.displacementData,l=0;l50&&(a=1e3);var o=[];Ou.perspective(o,Iu,this.width/this.height,1,a),this.viewGL.camera.projectionMatrix.setArray(o),this.viewGL.camera.decomposeProjectionMatrix(),o=Ou.identity([]);var s=this.dataToPoint(this.center);Ou.scale(o,o,[1,-1,1]),Ou.translate(o,o,[0,0,-e]),Ou.rotateX(o,o,t),Ou.rotateZ(o,o,-this.bearing/180*Math.PI),Ou.translate(o,o,[-s[0]*this.getScale()*Bu,-s[1]*this.getScale()*Bu,0]),this.viewGL.camera.viewMatrix.array=o;var l=[];Ou.invert(l,o),this.viewGL.camera.worldTransform.array=l,this.viewGL.camera.decomposeWorldTransform();var h,u=Nu*this.getScale();if(this.altitudeExtent&&!isNaN(this.boxHeight)){var c=this.altitudeExtent[1]-this.altitudeExtent[0];h=this.boxHeight/c*this.getScale()/Math.pow(2,this._initialZoom-this.zoomOffset)}else h=u/(2*Math.PI*6378e3*Math.abs(Math.cos(this.center[1]*(Math.PI/180))))*this.altitudeScale*Bu;this.viewGL.rootNode.scale.set(this.getScale()*Bu,this.getScale()*Bu,h)}},getScale:function(){return Math.pow(2,this.zoom-this.zoomOffset)},projectOnTile:function(e,t){return this.projectOnTileWithScale(e,this.getScale()*Nu,t)},projectOnTileWithScale:function(e,t,r){var i=e[0],n=e[1]*Ru/180,a=t*(i*Ru/180+Ru)/(2*Ru),o=t*(Ru-Math.log(Math.tan(Ru/4+.5*n)))/(2*Ru);return(r=r||[])[0]=a,r[1]=o,r},unprojectFromTile:function(e,t){return this.unprojectOnTileWithScale(e,this.getScale()*Nu,t)},unprojectOnTileWithScale:function(e,t,r){var i=e[0],n=e[1],a=i/t*(2*Ru)-Ru,o=2*(Math.atan(Math.exp(Ru-n/t*(2*Ru)))-Ru/4);return(r=r||[])[0]=180*a/Ru,r[1]=180*o/Ru,r},dataToPoint:function(e,t){return(t=this.projectOnTileWithScale(e,Nu,t))[0]-=this._origin[0],t[1]-=this._origin[1],t[2]=isNaN(e[2])?0:e[2],isNaN(e[2])||(t[2]=e[2],this.altitudeExtent&&(t[2]-=this.altitudeExtent[0])),t}};const zu=Fu;function Gu(){zu.apply(this,arguments)}function Uu(e,t,r){function i(e,t){var r=t.getWidth(),i=t.getHeight(),n=t.getDevicePixelRatio();this.viewGL.setViewport(0,0,r,i,n),this.width=r,this.height=i,this.altitudeScale=e.get("altitudeScale"),this.boxHeight=e.get("boxHeight")}function n(e,t){if("auto"!==this.model.get("boxHeight")){var r=[1/0,-1/0];e.eachSeries((function(e){if(e.coordinateSystem===this){var t=e.getData(),i=e.coordDimToDataDim("alt")[0];if(i){var n=t.getDataExtent(i,!0);r[0]=Math.min(r[0],n[0]),r[1]=Math.max(r[1],n[1])}}}),this),r&&isFinite(r[1]-r[0])&&(this.altitudeExtent=r)}}return{dimensions:t.prototype.dimensions,create:function(a,o){var s=[];return a.eachComponent(e,(function(e){var r=e.__viewGL;r||(r=e.__viewGL=new Il).setRootNode(new Ka.Node);var a=new t;a.viewGL=e.__viewGL,a.resize=i,a.resize(e,o),s.push(a),e.coordinateSystem=a,a.model=e,a.update=n})),a.eachSeries((function(t){if(t.get("coordinateSystem")===e){var r=t.getReferringComponents(e).models[0];if(r||(r=a.getComponent(e)),!r)throw new Error(e+' "'+Mn(t.get(e+"Index"),t.get(e+"Id"),0)+'" not found');t.coordinateSystem=r.coordinateSystem}})),r&&r(s,a,o),s}}}Gu.prototype=new zu,Gu.prototype.constructor=Gu,Gu.prototype.type="mapbox3D";const ku=Uu("mapbox3D",Gu,(function(e){e.forEach((function(e){e.setCameraOption(e.model.getMapboxCameraOption())}))}));(0,i.use)((function(e){e.registerComponentModel(Au),e.registerComponentView(Pu),e.registerCoordinateSystem("mapbox3D",ku),e.registerAction({type:"mapbox3DChangeCamera",event:"mapbox3dcamerachanged",update:"mapbox3D:updateCamera"},(function(e,t){t.eachComponent({mainType:"mapbox3D",query:e},(function(t){t.setMapboxCameraOption(e)}))}))}));var Vu=["zoom","center","pitch","bearing"],Hu=i.ComponentModel.extend({type:"maptalks3D",layoutMode:"box",coordinateSystem:null,defaultOption:{zlevel:-10,urlTemplate:"http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",attribution:'© OpenStreetMap contributors, © CARTO',center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMaptalksCameraOption:function(){var e=this;return Vu.reduce((function(t,r){return t[r]=e.get(r),t}),{})},setMaptalksCameraOption:function(e){null!=e&&Vu.forEach((function(t){null!=e[t]&&(this.option[t]=e[t])}),this)},getMaptalks:function(){return this._maptalks},setMaptalks:function(e){this._maptalks=e}});i.util.merge(Hu.prototype,co),i.util.merge(Hu.prototype,fo);const Wu=Hu;function ju(e,t,r,i){if(this.id=e,this.zr=t,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!maptalks)throw new Error("Maptalks library must be included. See https://maptalks.org");this._maptalks=new maptalks.Map(this.dom,{center:r,zoom:i,doubleClickZoom:!1,fog:!1}),this._initEvents()}ju.prototype.setUnpainted=function(){},ju.prototype.resize=function(){this._maptalks.checkSize()},ju.prototype.getMaptalks=function(){return this._maptalks},ju.prototype.clear=function(){},ju.prototype.refresh=function(){this._maptalks.checkSize()};var Xu=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","DOMMouseScroll","touchstart","touchend","touchmove","touchcancel"];ju.prototype._initEvents=function(){var e=this.dom;this._handlers=this._handlers||{contextmenu:function(e){return e.preventDefault(),!1}},Xu.forEach((function(t){this._handlers[t]=function(r){var i={};for(var n in r)i[n]=r[n];i.bubbles=!1;var a=new r.constructor(r.type,i);"mousewheel"===t||"DOMMouseScroll"===t?e.dispatchEvent(a):e.firstElementChild.dispatchEvent(a)},this.zr.dom.addEventListener(t,this._handlers[t])}),this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},ju.prototype.dispose=function(){Xu.forEach((function(e){this.zr.dom.removeEventListener(e,this._handlers[e])}),this),this._maptalks.remove()};const qu=ju;Ka.Shader.import(Lu);const Zu=i.ComponentView.extend({type:"maptalks3D",__ecgl__:!0,init:function(e,t){this._groundMesh=new Ka.Mesh({geometry:new Ka.PlaneGeometry,material:new Ka.Material({shader:new Ka.Shader({vertex:Ka.Shader.source("ecgl.displayShadow.vertex"),fragment:Ka.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},_initMaptalksLayer:function(e,t){var r=t.getZr();this._zrLayer=new qu("maptalks3D",r,e.get("center"),e.get("zoom")),r.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new Ka.Node,this._sceneHelper=new Uo(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var i=this._zrLayer.getMaptalks(),n=this._dispatchInteractAction.bind(this,t,i);["zoomend","zooming","zoomstart","dragrotating","pitch","pitchend","movestart","moving","moveend","resize","touchstart","touchmove","touchend","animating"].forEach((function(e){i.on(e,n)}))},render:function(e,t,r){this._zrLayer||this._initMaptalksLayer(e,r);var i=this._zrLayer.getMaptalks(),n=e.get("urlTemplate"),a=i.getBaseLayer();n!==this._oldUrlTemplate&&(a?a.setOptions({urlTemplate:n,attribution:e.get("attribution")}):(a=new maptalks.TileLayer("maptalks-echarts-gl-baselayer",{urlTemplate:n,subdomains:["a","b","c"],attribution:e.get("attribution")}),i.setBaseLayer(a))),this._oldUrlTemplate=n,i.setCenter(e.get("center")),i.setZoom(e.get("zoom"),{animation:!1}),i.setPitch(e.get("pitch")),i.setBearing(e.get("bearing")),e.setMaptalks(i);var o=e.coordinateSystem;o.viewGL.scene.add(this._lightRoot),o.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(o.viewGL.scene),this._sceneHelper.updateLight(e),o.viewGL.setPostEffect(e.getModel("postEffect"),r),o.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._maptalks3DModel=e},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r),e.coordinateSystem.viewGL.scene.traverse((function(e){e.material&&(e.material.define("fragment","NORMAL_UP_AXIS",2),e.material.define("fragment","NORMAL_FRONT_AXIS",1))}))},updateCamera:function(e,t,r,i){e.coordinateSystem.setCameraOption(i),this._updateGroundMesh(),r.getZr().refresh()},_dispatchInteractAction:function(e,t,r){var i;e.dispatchAction({type:"maptalks3DChangeCamera",pitch:t.getPitch(),zoom:(i=t.getResolution(),19-Math.log(i/Yu)/Math.LN2+1),center:t.getCenter().toArray(),bearing:t.getBearing(),maptalks3DId:this._maptalks3DModel&&this._maptalks3DModel.id})},_updateGroundMesh:function(){if(this._maptalks3DModel){var e=this._maptalks3DModel.coordinateSystem,t=e.dataToPoint(e.center);this._groundMesh.position.set(t[0],t[1],-.001);var r=new Ka.Plane(new Ka.Vector3(0,0,1),0),i=e.viewGL.camera.castRay(new Ka.Vector2(-1,-1)),n=e.viewGL.camera.castRay(new Ka.Vector2(1,1)),a=i.intersectPlane(r),o=n.intersectPlane(r),s=a.dist(o)/e.viewGL.rootNode.scale.x;this._groundMesh.scale.set(s,s,1)}},dispose:function(e,t){this._zrLayer&&this._zrLayer.dispose(),t.getZr().painter.delLayer(-1e3)}}),Yu=12756274*Math.PI/(256*Math.pow(2,20));function Ku(){zu.apply(this,arguments),this.maxPitch=85,this.zoomOffset=1}Ku.prototype=new zu,Ku.prototype.constructor=Ku,Ku.prototype.type="maptalks3D";const Qu=Uu("maptalks3D",Ku,(function(e){e.forEach((function(e){e.setCameraOption(e.model.getMaptalksCameraOption())}))}));(0,i.use)((function(e){e.registerComponentModel(Wu),e.registerComponentView(Zu),e.registerCoordinateSystem("maptalks3D",Qu),e.registerAction({type:"maptalks3DChangeCamera",event:"maptalks3dcamerachanged",update:"maptalks3D:updateCamera"},(function(e,t){t.eachComponent({mainType:"maptalks3D",query:e},(function(t){t.setMaptalksCameraOption(e)}))}))}));var Ju=Po.vec3,$u=i.helper.dataStack.isDimensionStacked;function ec(e,t,r){for(var i=e.getDataExtent(t),n=e.getDataExtent(r),a=i[1]-i[0]||i[0],o=n[1]-n[0]||n[0],s=new Uint8Array(2500),l=0;l0&&d>0||c<0&&d<0)),m=["x","y","z"].map((function(t){return e.coordDimToDataDim(t)[0]})),g=$u(r,m[2]),_=g?r.getCalculationInfo("stackResultDimension"):m[2];r.each(m,(function(e,i,a,o){var s=r.get(_,o),l=g?s-a:p?0:f[0],h=t.dataToPoint([e,i,l]),u=t.dataToPoint([e,i,s]),c=Ju.dist(h,u),d=[0,u[1]"+a.join("
")}(a):i.format.encodeHTML(i.format.addCommas(a)),s=n.getName(t),l=Ih(n,t);i.util.isObject(l)&&l.colorStops&&(l=(l.colorStops[0]||{}).color),l=l||"transparent";var h=i.format.getTooltipMarker(l),u=e.name;return"\0-"===u&&(u=""),u=u?i.format.encodeHTML(u)+(r?": ":"
"):"",r?h+u+o:u+h+(s?i.format.encodeHTML(s)+": "+o:o)}function sc(e,t,r){r=r||e.getSource();var n=t||i.getCoordinateSystemDimensions(e.get("coordinateSystem"))||["x","y","z"],a=i.helper.createDimensions(r,{dimensionsDefine:r.dimensionsDefine||e.get("dimensions"),encodeDefine:r.encodeDefine||e.get("encode"),coordDimensions:n.map((function(t){var r=e.getReferringComponents(t+"Axis3D").models[0];return{type:r&&"category"===r.get("type")?"ordinal":"float",name:t}}))});"cartesian3D"===e.get("coordinateSystem")&&a.forEach((function(t){if(n.indexOf(t.coordDim)>=0){var r=e.getReferringComponents(t.coordDim+"Axis3D").models[0];r&&"category"===r.get("type")&&(t.ordinalMeta=r.getOrdinalMeta())}}));var o=i.helper.dataStack.enableDataStack(e,a,{byIndex:!0,stackedCoordDimension:"z"}),s=new i.List(a,e);return s.setCalculationInfo(o),s.initData(r),s}var lc=i.SeriesModel.extend({type:"series.bar3D",dependencies:["globe"],visualStyleAccessPathvisu:"itemStyle",getInitialData:function(e,t){return sc(this)},getFormattedLabel:function(e,t,r,i){var n=ac.getFormattedLabel(this,e,t,r,i);return null==n&&(n=this.getData().get("z",e)),n},formatTooltip:function(e){return oc(this,e)},defaultOption:{coordinateSystem:"cartesian3D",globeIndex:0,grid3DIndex:0,zlevel:-10,bevelSize:0,bevelSmoothness:2,onGridPlane:"xy",shading:"color",minHeight:0,itemStyle:{opacity:1},label:{show:!1,distance:2,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},emphasis:{label:{show:!0}},animationDurationUpdate:500}});i.util.merge(lc.prototype,Kl);const hc=lc;var uc,cc,dc,fc,pc,mc,gc,_c,vc=Po.vec3,yc=Po.mat3,xc=Vr.extend((function(){return{attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),normal:new Vr.Attribute("normal","float",3,"NORMAL"),color:new Vr.Attribute("color","float",4,"COLOR"),prevPosition:new Vr.Attribute("prevPosition","float",3),prevNormal:new Vr.Attribute("prevNormal","float",3)},dynamic:!0,enableNormal:!1,bevelSize:1,bevelSegments:0,_dataIndices:null,_vertexOffset:0,_triangleOffset:0}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0},setBarCount:function(e){var t=this.enableNormal,r=this.getBarVertexCount()*e,i=this.getBarTriangleCount()*e;this.vertexCount!==r&&(this.attributes.position.init(r),t?this.attributes.normal.init(r):this.attributes.normal.value=null,this.attributes.color.init(r)),this.triangleCount!==i&&(this.indices=r>65535?new Uint32Array(3*i):new Uint16Array(3*i),this._dataIndices=new Uint32Array(r))},getBarVertexCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarVertexCount(e):this.enableNormal?24:8},getBarTriangleCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarTriangleCount(e):12},_getBevelBarVertexCount:function(e){return 4*(e+1)*(e+1)*2},_getBevelBarTriangleCount:function(e){return(4*e+3+1)*(2*e+1)*2+4},setColor:function(e,t){for(var r=this.getBarVertexCount(),i=r*(e+1),n=r*e;n0&&this.bevelSegments>0)this._addBevelBar(e,c,m,g,this.bevelSize,this.bevelSegments,_);else{vc.copy(n,c),vc.normalize(n,n),vc.cross(a,m,n),vc.normalize(a,a),vc.cross(i,n,a),vc.normalize(a,a),vc.negate(o,i),vc.negate(s,n),vc.negate(l,a),t(h[0],e,i,g[0]/2),t(h[0],h[0],a,g[2]/2),t(h[1],e,i,g[0]/2),t(h[1],h[1],l,g[2]/2),t(h[2],e,o,g[0]/2),t(h[2],h[2],l,g[2]/2),t(h[3],e,o,g[0]/2),t(h[3],h[3],a,g[2]/2),t(r,e,n,g[1]),t(h[4],r,i,g[0]/2),t(h[4],h[4],a,g[2]/2),t(h[5],r,i,g[0]/2),t(h[5],h[5],l,g[2]/2),t(h[6],r,o,g[0]/2),t(h[6],h[6],l,g[2]/2),t(h[7],r,o,g[0]/2),t(h[7],h[7],a,g[2]/2);var x=this.attributes;if(this.enableNormal){u[0]=i,u[1]=o,u[2]=n,u[3]=s,u[4]=a,u[5]=l;for(var b=this._vertexOffset,w=0;w0&&(f++,u[3]<.99&&(p=!0))}})),o.geometry.setBarCount(f);var m=r.getLayout("orient"),g=this._barIndexOfData=new Int32Array(r.count());f=0,r.each((function(e){if(r.hasValue(e)){var t=r.getItemLayout(e),i=t[0],n=t[1],o=t[2],s=4*e;u[0]=c[s++],u[1]=c[s++],u[2]=c[s++],u[3]=c[s++],u[3]>0&&(a._barMesh.geometry.addBar(i,n,m,o,u,e),g[e]=f++)}else g[e]=-1})),o.geometry.dirty(),o.geometry.updateBoundingBox();var _=o.material;_.transparent=p,_.depthMask=!p,o.geometry.sortTriangles=p,this._initHandler(e,t)},_initHandler:function(e,t){var r=e.getData(),i=this._barMesh,n="cartesian3D"===e.coordinateSystem.type;i.seriesIndex=e.seriesIndex;var a=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(e){var o=i.geometry.getDataIndexOfVertex(e.triangle[0]);o!==a&&(this._downplay(a),this._highlight(o),this._labelsBuilder.updateLabels([o]),n&&t.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get("x",o),r.get("y",o),r.get("z",o,!0)]})),a=o,i.dataIndex=o}),this),i.on("mouseout",(function(e){this._downplay(a),this._labelsBuilder.updateLabels(),a=-1,i.dataIndex=-1,n&&t.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_highlight:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var n=t.getItemModel(e).getModel("emphasis.itemStyle"),a=n.get("color"),o=n.get("opacity");if(null==a){var s=Ih(t,e);a=i.color.lift(s,-.4)}null==o&&(o=Rh(t,e));var l=Ka.parseColor(a);l[3]*=o,this._barMesh.geometry.setColor(r,l),this._api.getZr().refresh()}}},_downplay:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var i=Ih(t,e),n=Rh(t,e),a=Ka.parseColor(i);a[3]*=n,this._barMesh.geometry.setColor(r,a),this._api.getZr().refresh()}}},highlight:function(e,t,r,i){this._toggleStatus("highlight",e,t,r,i)},downplay:function(e,t,r,i){this._toggleStatus("downplay",e,t,r,i)},_toggleStatus:function(e,t,r,n,a){var o=t.getData(),s=An(o,a),l=this;null!=s?i.util.each(ac.normalizeToArray(s),(function(t){"highlight"===e?this._highlight(t):this._downplay(t)}),this):o.each((function(t){"highlight"===e?l._highlight(t):l._downplay(t)}))},remove:function(){this.groupGL.removeAll()},dispose:function(){this._labelsBuilder.dispose(),this.groupGL.removeAll()}});(0,i.use)((function(e){e.registerChartView(Tc),e.registerSeriesModel(hc),nc(e),e.registerProcessor((function(e,t){e.eachSeriesByType("bar3d",(function(e){var t=e.getData();t.filterSelf((function(e){return t.hasValue(e)}))}))}))}));const Sc=i.SeriesModel.extend({type:"series.line3D",dependencies:["grid3D"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",getInitialData:function(e,t){return sc(this)},formatTooltip:function(e){return oc(this,e)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,lineStyle:{width:2},animationDurationUpdate:500}});function Mc(e,t,r,i,n,a,o){if(0===n)return!1;var s,l=n;if(o>t+l&&o>i+l||oe+l&&a>r+l||a=0){var g=3*l,_=new vt(this._points[g],this._points[g+1],this._points[g+2]);a.push({dataIndex:l,point:_,pointWorld:_.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(_)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});(0,i.use)((function(e){e.registerChartView(Ec),e.registerSeriesModel(Sc),e.registerLayout((function(e,t){e.eachSeriesByType("line3D",(function(e){var t=e.getData(),r=e.coordinateSystem;if(r){if("cartesian3D"!==r.type)return;var i=new Float32Array(3*t.count()),n=[],a=[],o=r.dimensions.map((function(t){return e.coordDimToDataDim(t)[0]}));r&&t.each(o,(function(e,t,o,s){n[0]=e,n[1]=t,n[2]=o,r.dataToPoint(n,a),i[3*s]=a[0],i[3*s+1]=a[1],i[3*s+2]=a[2]})),t.setLayout("points",i)}}))}))}));const Cc=i.SeriesModel.extend({type:"series.scatter3D",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,getInitialData:function(e,t){return sc(this)},getFormattedLabel:function(e,t,r,i){var n=ac.getFormattedLabel(this,e,t,r,i);if(null==n){var a=this.getData(),o=a.dimensions[a.dimensions.length-1];n=a.get(o,e)}return n},formatTooltip:function(e){return oc(this,e)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,progressive:1e5,progressiveThreshold:1e5,grid3DIndex:0,globeIndex:0,symbol:"circle",symbolSize:10,blendMode:"source-over",label:{show:!1,position:"right",distance:5,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},itemStyle:{opacity:.8},emphasis:{label:{show:!0}},animationDurationUpdate:500}});function Dc(e,t,r){(t=t||document.createElement("canvas")).width=e,t.height=e;var i=t.getContext("2d");return r&&r(i),t}var Lc={getMarginByStyle:function(e){var t=e.minMargin||0,r=0;e.stroke&&"none"!==e.stroke&&(r=null==e.lineWidth?1:e.lineWidth);var i=e.shadowBlur||0,n=e.shadowOffsetX||0,a=e.shadowOffsetY||0,o={};return o.left=Math.max(r/2,-n+i,t),o.right=Math.max(r/2,n+i,t),o.top=Math.max(r/2,-a+i,t),o.bottom=Math.max(r/2,a+i,t),o},createSymbolSprite:function(e,t,r,n){var a=function(e,t,r,n){i.util.isArray(t)||(t=[t,t]);var a=Lc.getMarginByStyle(r,void 0),o=t[0]+a.left+a.right,s=t[1]+a.top+a.bottom,l=i.helper.createSymbol(e,0,0,t[0],t[1]),h=Math.max(o,s);l.x=a.left,l.y=a.top,o>s?l.y+=(h-s)/2:l.x+=(h-o)/2;var u=l.getBoundingRect();return l.x-=u.x,l.y-=u.y,l.setStyle(r),l.update(),l.__size=h,l}(e,t,r),o=Lc.getMarginByStyle(r);return{image:Dc(a.__size,n,(function(e){i.innerDrawElementOnCanvas(e,a)})),margin:o}},createSDFFromCanvas:function(e,t,r,i){return Dc(t,i,(function(t){var i=e.getContext("2d").getImageData(0,0,e.width,e.height);t.putImageData(function(e,t,r){var i=t.width,n=t.height,a=e.canvas.width,o=e.canvas.height,s=i/a,l=n/o;function h(e){return e<128?1:-1}function u(e,a){var o=1/0;e=Math.floor(e*s);for(var u=(a=Math.floor(a*l))*i+e,c=h(t.data[4*u]),d=Math.max(a-r,0);d=2e4},doSortVertices:function(e,t){var r=this.indices,i=Oc.create();if(!r){r=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var n=0;n.05);else for(n=0;n<3;n++)this._progressiveQuickSort(3*t+n);this.dirtyIndices()},_simpleSort:function(e){var t=this._zList,r=this.indices;function i(e,r){return t[r]-t[e]}e?Array.prototype.sort.call(r,i):Ch.sort(r,i,0,r.length-1)},_progressiveQuickSort:function(e){var t=this._zList,r=this.indices;this._quickSort=this._quickSort||new Ch,this._quickSort.step(r,(function(e,r){return t[r]-t[e]}),e)}};var Ic=Po.vec4;Ka.Shader.import("@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end");const Rc=Ka.Mesh.extend((function(){var e=new Ka.Geometry({dynamic:!0,attributes:{color:new Ka.Geometry.Attribute("color","float",4,"COLOR"),position:new Ka.Geometry.Attribute("position","float",3,"POSITION"),size:new Ka.Geometry.Attribute("size","float",1),prevPosition:new Ka.Geometry.Attribute("prevPosition","float",3),prevSize:new Ka.Geometry.Attribute("prevSize","float",1)}});Object.assign(e,Nc);var t=new Ka.Material({shader:Ka.createShader("ecgl.sdfSprite"),transparent:!0,depthMask:!1});t.enableTexture("sprite"),t.define("both","VERTEX_COLOR"),t.define("both","VERTEX_SIZE");var r=new Ka.Texture2D({image:document.createElement("canvas"),flipY:!1});return t.set("sprite",r),e.pick=this._pick.bind(this),{geometry:e,material:t,mode:Ka.Mesh.POINTS,sizeScale:1}}),{_pick:function(e,t,r,i,n,a){var o=this._positionNDC;if(o)for(var s=r.viewport,l=2/s.width,h=2/s.height,u=this.geometry.vertexCount-1;u>=0;u--){var c,d=o[2*(c=this.geometry.indices?this.geometry.indices[u]:u)],f=o[2*c+1],p=this.geometry.attributes.size.get(c)/this.sizeScale/2;if(e>d-p*l&&ef-p*h&&t2?(p=this._updateSymbolSprite(e,d,u,c),s.enableTexture("sprite")):s.disableTexture("sprite"),h.position.init(n-i);var m=[];if(f){s.undefine("VERTEX_SIZE"),s.undefine("VERTEX_COLOR");var g=function(e){const t=e.getVisual("style");if(t)return t[e.getVisual("drawType")]}(o),_=function(e){return e.getVisual("style").opacity}(o);Ka.parseColor(g,m),m[3]*=_,s.set({color:m,u_Size:u.maxSize*this._sizeScale})}else s.set({color:[1,1,1,1]}),s.define("VERTEX_SIZE"),s.define("VERTEX_COLOR"),h.size.init(n-i),h.color.init(n-i),this._originalOpacity=new Float32Array(n-i);for(var v=o.getLayout("points"),y=h.position.value,x=0;x1?(o[0]=r.maxSize,o[1]=r.maxSize/r.aspect):(o[1]=r.maxSize,o[0]=r.maxSize*r.aspect),o[0]=o[0]||1,o[1]=o[1]||1,this._symbolType===r.type&&(a=o,(n=this._symbolSize)&&a&&n[0]===a[0]&&n[1]===a[1])&&this._lineWidth===t.lineWidth||(Pc.createSymbolSprite(r.type,o,{fill:"#fff",lineWidth:t.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(o[0]/2,10)},this._spriteImageCanvas),Pc.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),20,this._mesh.material.get("sprite").image),this._symbolType=r.type,this._symbolSize=o,this._lineWidth=t.lineWidth),this._spriteImageCanvas.width/r.maxSize*i},_updateMaterial:function(e,t){var r="lighter"===e.get("blendMode")?Ka.additiveBlend:null,i=this._mesh.material;i.blend=r,i.set("lineWidth",t.lineWidth/20);var n=Ka.parseColor(t.stroke);i.set("strokeColor",n),i.transparent=!0,i.depthMask=!1,i.depthTest=!this.is2D,i.sortVertices=!this.is2D},_updateLabelBuilder:function(e,t,r){var i=e.getData(),n=this._mesh.geometry,a=n.attributes.position.value,o=(t=this._startDataIndex,this._mesh.sizeScale);this._labelsBuilder.updateData(i,t,r),this._labelsBuilder.getLabelPosition=function(e,r,i){var n=3*(e-t);return[a[n],a[n+1],a[n+2]]},this._labelsBuilder.getLabelDistance=function(e,r,i){return n.attributes.size.get(e-t)/o/2+i},this._labelsBuilder.updateLabels()},_updateAnimation:function(e){Ka.updateVertexAnimation([["prevPosition","position"],["prevSize","size"]],this._prevMesh,this._mesh,e)},_updateHandler:function(e,t,r){var i,n=e.getData(),a=this._mesh,o=this,s=-1,l=e.coordinateSystem&&"cartesian3D"===e.coordinateSystem.type;l&&(i=e.coordinateSystem.model),a.seriesIndex=e.seriesIndex,a.off("mousemove"),a.off("mouseout"),a.on("mousemove",(function(t){var h=t.vertexIndex+o._startDataIndex;h!==s&&(this.highlightOnMouseover&&(this.downplay(n,s),this.highlight(n,h),this._labelsBuilder.updateLabels([h])),l&&r.dispatchAction({type:"grid3DShowAxisPointer",value:[n.get(e.coordDimToDataDim("x")[0],h),n.get(e.coordDimToDataDim("y")[0],h),n.get(e.coordDimToDataDim("z")[0],h)],grid3DIndex:i.componentIndex})),a.dataIndex=h,s=h}),this),a.on("mouseout",(function(e){var t=e.vertexIndex+o._startDataIndex;this.highlightOnMouseover&&(this.downplay(n,t),this._labelsBuilder.updateLabels()),s=-1,a.dataIndex=-1,l&&r.dispatchAction({type:"grid3DHideAxisPointer",grid3DIndex:i.componentIndex})}),this)},updateLayout:function(e,t,r){var i=e.getData();if(this._mesh){var n=this._mesh.geometry.attributes.position.value,a=i.getLayout("points");if(this.is2D)for(var o=0;othis._endDataIndex||tthis._endDataIndex||t 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end");const ad=Ka.Mesh.extend((function(){var e=new Ka.Material({shader:new Ka.Shader(Ka.Shader.source("ecgl.trail2.vertex"),Ka.Shader.source("ecgl.trail2.fragment")),transparent:!0,depthMask:!1}),t=new Ro({dynamic:!0});return t.createAttribute("dist","float",1),t.createAttribute("distAll","float",1),t.createAttribute("start","float",1),{geometry:t,material:e,culling:!1,$ignorePicking:!0}}),{updateData:function(e,t,r){var i=e.hostModel,n=this.geometry,a=i.getModel("effect"),o=a.get("trailWidth")*t.getDevicePixelRatio(),s=a.get("trailLength"),l=i.get("effect.constantSpeed"),h=1e3*i.get("effect.period"),u=null!=l;u?this.material.set("speed",l/1e3):this.material.set("period",h),this.material[u?"define":"undefine"]("vertex","CONSTANT_SPEED");var c=i.get("polyline");n.trailLength=s,this.material.set("trailLength",s),n.resetOffset(),["position","positionPrev","positionNext"].forEach((function(e){n.attributes[e].value=r.attributes[e].value})),["dist","distAll","start","offset","color"].forEach((function(e){n.attributes[e].init(n.vertexCount)})),n.indices=r.indices;var d=[],f=a.get("trailColor"),p=a.get("trailOpacity"),m=null!=f,g=null!=p;this.updateWorldTransform();var _=this.worldTransform.x.len(),v=this.worldTransform.y.len(),y=this.worldTransform.z.len(),x=0,b=0;e.each((function(t){var i=e.getItemLayout(t),a=g?p:Rh(e,t),s=Ih(e,t);null==a&&(a=1),(d=Ka.parseColor(m?f:s,d))[3]*=a;for(var l=c?r.getPolylineVertexCount(i):r.getCubicCurveVertexCount(i[0],i[1],i[2],i[3]),w=0,T=[],S=[],M=x;Mx&&(w+=nd.dist(T,S)),n.attributes.dist.set(M,w),nd.copy(S,T);b=Math.max(b,w);var A=Math.random()*(u?w:h);for(M=x;M0?1:-1)*o/2),n.attributes.color.set(M,d);x+=l})),this.material.set("spotSize",.1*b*s),this.material.set("spotIntensity",a.get("spotIntensity")),n.dirty()},setAnimationTime:function(e){this.material.set("time",e)}});Ka.Shader.import(is);const od=i.ChartView.extend({type:"lines3D",__ecgl__:!0,init:function(e,t){this.groupGL=new Ka.Node,this._meshLinesMaterial=new Ka.Material({shader:Ka.createShader("ecgl.meshLines3D"),transparent:!0,depthMask:!1}),this._linesMesh=new Ka.Mesh({geometry:new Ro,material:this._meshLinesMaterial,$ignorePicking:!0}),this._trailMesh=new ad},render:function(e,t,r){this.groupGL.add(this._linesMesh);var i=e.coordinateSystem,n=e.getData();if(i&&i.viewGL){i.viewGL.add(this.groupGL),this._updateLines(e,t,r);var a=i.viewGL.isLinearSpace()?"define":"undefine";this._linesMesh.material[a]("fragment","SRGB_DECODE"),this._trailMesh.material[a]("fragment","SRGB_DECODE")}var o=this._trailMesh;if(o.stopAnimation(),e.get("effect.show")){this.groupGL.add(o),o.updateData(n,r,this._linesMesh.geometry),o.__time=o.__time||0;var s=36e5;this._curveEffectsAnimator=o.animate("",{loop:!0}).when(s,{__time:s}).during((function(){o.setAnimationTime(o.__time)})).start()}else this.groupGL.remove(o),this._curveEffectsAnimator=null;this._linesMesh.material.blend=this._trailMesh.material.blend="lighter"===e.get("blendMode")?Ka.additiveBlend:null},pauseEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.pause()},resumeEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.resume()},toggleEffect:function(){var e=this._curveEffectsAnimator;e&&(e.isPaused()?e.resume():e.pause())},_updateLines:function(e,t,r){var i=e.getData(),n=e.coordinateSystem,a=this._linesMesh.geometry,o=e.get("polyline");a.expandLine=!0;var s=function(e){return null!=e.radius?e.radius:null!=e.size?Math.max(e.size[0],e.size[1],e.size[2]):100}(n);a.segmentScale=s/20;var l="lineStyle.width".split("."),h=r.getDevicePixelRatio(),u=0;i.each((function(e){var t=i.getItemModel(e).get(l);null==t&&(t=1),i.setItemVisual(e,"lineWidth",t),u=Math.max(t,u)})),a.useNativeLine=!1;var c=0,d=0;i.each((function(e){var t=i.getItemLayout(e);o?(c+=a.getPolylineVertexCount(t),d+=a.getPolylineTriangleCount(t)):(c+=a.getCubicCurveVertexCount(t[0],t[1],t[2],t[3]),d+=a.getCubicCurveTriangleCount(t[0],t[1],t[2],t[3]))})),a.setVertexCount(c),a.setTriangleCount(d),a.resetOffset();var f=[];i.each((function(e){var t=i.getItemLayout(e),r=Ih(i,e),n=Rh(i,e),s=i.getItemVisual(e,"lineWidth")*h;null==n&&(n=1),(f=Ka.parseColor(r,f))[3]*=n,o?a.addPolyline(t,f,s):a.addCubicCurve(t[0],t[1],t[2],t[3],f,s)})),a.dirty()},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});function sd(e,t){for(var r=[],i=0;i0;this._updateSurfaceMesh(this._surfaceMesh,e,u,f);var p=this._surfaceMesh.material;f?(p.define("WIREFRAME_QUAD"),p.set("wireframeLineWidth",d),p.set("wireframeLineColor",Ka.parseColor(c.get("lineStyle.color")))):p.undefine("WIREFRAME_QUAD"),this._initHandler(e,r),this._updateAnimation(e)},_updateAnimation:function(e){Ka.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,e)},_createSurfaceMesh:function(){var e=new Ka.Mesh({geometry:new Ka.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new Ka.Material({shader:new Ka.Shader(Ka.Shader.source("ecgl.sm.depth.vertex"),Ka.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return e.geometry.createAttribute("barycentric","float",4),e.geometry.createAttribute("prevPosition","float",3),e.geometry.createAttribute("prevNormal","float",3),Object.assign(e.geometry,Nh),e},_initHandler:function(e,t){var r=e.getData(),i=this._surfaceMesh,n=e.coordinateSystem;i.seriesIndex=e.seriesIndex;var a=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(e){var o=function(e,t){for(var r=1/0,n=-1,a=[],o=0;o=0){var s=[];i.geometry.attributes.position.get(o,s);for(var l=n.pointToData(s),h=1/0,u=-1,c=[],d=0;d65535?Uint32Array:Uint16Array)((p-1)*(m-1)*6),w=function(e,t,r){r[1]=e*m+t,r[0]=e*m+t+1,r[3]=(e+1)*m+t+1,r[2]=(e+1)*m+t},T=!1;if(l){var S=[],M=[],A=0;g?u.init(n.vertexCount):u.value=null;for(var E=[[],[],[]],C=[],D=[],L=fd.create(),P=function(e,t,r){var i=3*t;return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r},O=new Float32Array(o.length),N=new Float32Array(o.length/3*4),I=0;I0;){if(Math.floor(s/u)===s/u)return[u,s/u];u--}return[u=Math.floor(Math.sqrt(s)),u]},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function md(e,t){for(var r=[],i=0;i=0&&e.call(t,r[n],n)},e.prototype.eachEdge=function(e,t){for(var r=this.edges,i=r.length,n=0;n=0&&r[n].node1.dataIndex>=0&&r[n].node2.dataIndex>=0&&e.call(t,r[n],n)},e.prototype.breadthFirstTraverse=function(e,t,r,i){if(t instanceof Ad||(t=this._nodesMap[Sd(t)]),t){for(var n="out"===r?"outEdges":"in"===r?"inEdges":"edges",a=0;a=0&&r.node2.dataIndex>=0})),n=0,a=i.length;n=0&&this[e][t].setItemVisual(this.dataIndex,r,i)},getVisual:function(r){return this[e][t].getItemVisual(this.dataIndex,r)},setLayout:function(r,i){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,r,i)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}_a(Ad,Cd("hostGraph","data")),_a(Ed,Cd("hostGraph","edgeData"));const Dd=Md;var Ld=_o();function Pd(e,t){if(Ld(this).mainData===this){var r=ga({},Ld(this).datas);r[this.dataType]=t,Bd(t,r,e)}else Fd(t,this.dataType,Ld(this).mainData,e);return t}function Od(e,t){return e.struct&&e.struct.update(),t}function Nd(e,t){return ya(Ld(t).datas,(function(r,i){r!==t&&Fd(r.cloneShallow(),i,t,e)})),t}function Id(e){var t=Ld(this).mainData;return null==e||null==t?t:Ld(t).datas[e]}function Rd(){var e=Ld(this).mainData;return null==e?[{data:e}]:xa(ba(Ld(e).datas),(function(t){return{type:t,data:Ld(e).datas[t]}}))}function Bd(e,t,r){Ld(e).datas={},ya(t,(function(t,i){Fd(t,i,e,r)}))}function Fd(e,t,r,i){Ld(r).datas[t]=e,Ld(e).mainData=r,e.dataType=t,i.struct&&(e[i.structAttr]=i.struct,i.struct[i.datasAttr[t]]=e),e.getLinkedData=Id,e.getLinkedDataAll=Rd}var zd=i.SeriesModel.extend({type:"series.graphGL",visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,init:function(e){zd.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this._updateCategoriesData()},mergeOption:function(e){zd.superApply(this,"mergeOption",arguments),this._updateCategoriesData()},getFormattedLabel:function(e,t,r,i){var n=ac.getFormattedLabel(this,e,t,r,i);if(null==n){var a=this.getData(),o=a.dimensions[a.dimensions.length-1];n=a.get(o,e)}return n},getInitialData:function(e,t){var r=e.edges||e.links||[],n=e.data||e.nodes||[],a=this;if(n&&r)return function(e,t,r,n,a){for(var o=new Dd(!0),s=0;s "+p)),c++)}var m=i.helper.createDimensions(e,{coordDimensions:["value"]});(l=new i.List(m,r)).initData(e);var g,_,v,y=new i.List(["value"],r);return y.initData(u,h),a&&a(l,y),_=(g={mainData:l,struct:o,structAttr:"graph",datas:{node:l,edge:y},datasAttr:{node:"data",edge:"edgeData"}}).mainData,(v=g.datas)||(v={main:_},g.datasAttr={main:"data"}),g.datas=g.mainData=null,Bd(_,v,g),ya(v,(function(e){ya(_.TRANSFERABLE_METHODS,(function(t){e.wrapMethod(t,wa(Pd,g))}))})),_.wrapMethod("cloneShallow",wa(Nd,g)),ya(_.CHANGABLE_METHODS,(function(e){_.wrapMethod(e,wa(Od,g))})),function(e,t){if(!e)throw new Error(void 0)}(v[_.dataType]===_),o.update(),o}(n,r,this,0,(function(e,r){e.wrapMethod("getItemModel",(function(e){const t=a._categoriesModels[e.getShallow("category")];return t&&(t.parentModel=e.parentModel,e.parentModel=t),e}));const i=t.getModel([]).getModel;function n(e,t){const r=i.call(this,e,t);return r.resolveParentPath=o,r}function o(e){if(e&&("label"===e[0]||"label"===e[1])){const t=e.slice();return"label"===e[0]?t[0]="edgeLabel":"label"===e[1]&&(t[1]="edgeLabel"),t}return e}r.wrapMethod("getItemModel",(function(e){return e.resolveParentPath=o,e.getModel=n,e}))})).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(e,t,r){if("edge"===r){var n=this.getData(),a=this.getDataParams(e,r),o=n.graph.getEdgeByIndex(e),s=n.getName(o.node1.dataIndex),l=n.getName(o.node2.dataIndex),h=[];return null!=s&&h.push(s),null!=l&&h.push(l),h=i.format.encodeHTML(h.join(" > ")),a.value&&(h+=" : "+i.format.encodeHTML(a.value)),h}return zd.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var e=(this.option.categories||[]).map((function(e){return null!=e.value?e:Object.assign({value:0},e)})),t=new i.List(["value"],this);t.initData(e),this._categoriesData=t,this._categoriesModels=t.mapArray((function(e){return t.getItemModel(e,!0)}))},setView:function(e){null!=e.zoom&&(this.option.zoom=e.zoom),null!=e.offset&&(this.option.offset=e.offset)},setNodePosition:function(e){for(var t=0;t65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,i){return 1/(Ud.dist(e,t)+Ud.dist(r,t)+Ud.dist(i,r)+1)*this.segmentScale},getCubicCurveVertexCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(kd)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(kd)},getPolylineVertexCount:function(e){var t;return t="number"==typeof e?e:"number"!=typeof e[0]?e.length:e.length/2,this.useNativeLine?2*(t-1):2*(t-1)+2},getPolylineTriangleCount:function(e){var t;return t="number"==typeof e?e:"number"!=typeof e[0]?e.length:e.length/2,this.useNativeLine?0:2*(t-1)},addCubicCurve:function(e,t,r,i,n,a){null==a&&(a=1);var o=e[0],s=e[1],l=t[0],h=t[1],u=r[0],c=r[1],d=i[0],f=i[1],p=this._getCubicCurveApproxStep(e,t,r,i),m=p*p,g=m*p,_=3*p,v=3*m,y=6*m,x=6*g,b=o-2*l+u,w=s-2*h+c,T=3*(l-u)-o+d,S=3*(h-c)-s+f,M=o,A=s,E=(l-o)*_+b*v+T*g,C=(h-s)*_+w*v+S*g,D=b*y+T*x,L=w*y+S*x,P=T*x,O=S*x,N=0,I=0,R=Math.ceil(1/p),B=new Float32Array(3*(R+1)),F=(B=[],0);for(I=0;I1&&(M=E>0?Math.min(M,d):Math.max(M,d),A=C>0?Math.min(A,f):Math.max(A,f));this.addPolyline(B,n,a)},addLine:function(e,t,r,i){this.addPolyline([e,t],r,i)},addPolyline:function(){var e=Ud.create(),t=Ud.create(),r=Ud.create(),i=Ud.create(),n=[],a=[],o=[];return function(s,l,h,u,c){if(s.length){var d="number"!=typeof s[0];if(null==c&&(c=d?s.length:s.length/2),!(c<2)){null==u&&(u=0),null==h&&(h=1),this._itemVertexOffsets.push(this._vertexOffset);for(var f,p=d?"number"!=typeof l[0]:l.length/4===c,m=this.attributes.position,g=this.attributes.color,_=this.attributes.offset,v=this.attributes.normal,y=this.indices,x=this._vertexOffset,b=0;b1&&(m.copy(x,x-1),g.copy(x,x-1),x++);else{var S;if(b0){Ud.sub(e,n,o),Ud.sub(t,a,n),Ud.normalize(e,e),Ud.normalize(t,t),Ud.add(i,e,t),Ud.normalize(i,i);var M=h/2*Math.min(1/Ud.dot(e,i),2);r[0]=-i[1],r[1]=i[0],S=M}else Ud.sub(e,a,n),Ud.normalize(e,e),r[0]=-e[1],r[1]=e[0],S=h/2;else Ud.sub(e,n,o),Ud.normalize(e,e),r[0]=-e[1],r[1]=e[0],S=h/2;v.set(x,r),v.set(x+1,r),_.set(x,S),_.set(x+1,-S),Ud.copy(o,n),m.set(x,n),m.set(x+1,n),g.set(x,f),g.set(x+1,f),x+=2}if(this.useNativeLine)g.set(x,f),m.set(x,n),x++;else if(b>0){var A=3*this._faceOffset;(y=this.indices)[A]=x-4,y[A+1]=x-3,y[A+2]=x-2,y[A+3]=x-3,y[A+4]=x-1,y[A+5]=x-2,this._faceOffset+=2}}this._vertexOffset=x}}}}(),setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],i=e 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end");var Wd={repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null};function jd(e){var t={type:Ka.Texture.FLOAT,minFilter:Ka.Texture.NEAREST,magFilter:Ka.Texture.NEAREST};this._positionSourceTex=new Ka.Texture2D(t),this._positionSourceTex.flipY=!1,this._positionTex=new Ka.Texture2D(t),this._positionPrevTex=new Ka.Texture2D(t),this._forceTex=new Ka.Texture2D(t),this._forcePrevTex=new Ka.Texture2D(t),this._weightedSumTex=new Ka.Texture2D(t),this._weightedSumTex.width=this._weightedSumTex.height=1,this._globalSpeedTex=new Ka.Texture2D(t),this._globalSpeedPrevTex=new Ka.Texture2D(t),this._globalSpeedTex.width=this._globalSpeedTex.height=1,this._globalSpeedPrevTex.width=this._globalSpeedPrevTex.height=1,this._nodeRepulsionPass=new pn({fragment:Ka.Shader.source("ecgl.forceAtlas2.updateNodeRepulsion")}),this._positionPass=new pn({fragment:Ka.Shader.source("ecgl.forceAtlas2.updatePosition")}),this._globalSpeedPass=new pn({fragment:Ka.Shader.source("ecgl.forceAtlas2.calcGlobalSpeed")}),this._copyPass=new pn({fragment:Ka.Shader.source("clay.compositor.output")});var r=function(e){e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE)};this._edgeForceMesh=new Ka.Mesh({geometry:new Ka.Geometry({attributes:{node1:new Ka.Geometry.Attribute("node1","float",2),node2:new Ka.Geometry.Attribute("node2","float",2),weight:new Ka.Geometry.Attribute("weight","float",1)},dynamic:!0,mainAttribute:"node1"}),material:new Ka.Material({transparent:!0,shader:Ka.createShader("ecgl.forceAtlas2.updateEdgeAttraction"),blend:r,depthMask:!1,depthText:!1}),mode:Ka.Mesh.POINTS}),this._weightedSumMesh=new Ka.Mesh({geometry:new Ka.Geometry({attributes:{node:new Ka.Geometry.Attribute("node","float",2)},dynamic:!0,mainAttribute:"node"}),material:new Ka.Material({transparent:!0,shader:Ka.createShader("ecgl.forceAtlas2.calcWeightedSum"),blend:r,depthMask:!1,depthText:!1}),mode:Ka.Mesh.POINTS}),this._framebuffer=new zi({depthBuffer:!1}),this._dummyCamera=new Ka.OrthographicCamera({left:-1,right:1,top:1,bottom:-1,near:0,far:100}),this._globalSpeed=0}jd.prototype.updateOption=function(e){for(var t in Wd)this[t]=Wd[t];var r=this._nodes.length;if(this.jitterTolerence=r>5e4?10:r>5e3?1:.1,this.scaling=r>100?2:10,e)for(var t in Wd)null!=e[t]&&(this[t]=e[t]);if(this.repulsionByDegree)for(var i=this._positionSourceTex.pixels,n=0;ne},jd.prototype._swapTexture=function(){var e=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=e,e=this._forcePrevTex,this._forcePrevTex=this._forceTex,this._forceTex=e,e=this._globalSpeedPrevTex,this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=e},jd.prototype._initFromSource=function(e){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(e),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(e),e.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(e)},jd.prototype._resize=function(e,t){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach((function(r){this[r].width=e,this[r].height=t,this[r].dirty()}),this)},jd.prototype.dispose=function(e){this._framebuffer.dispose(e),this._copyPass.dispose(e),this._nodeRepulsionPass.dispose(e),this._positionPass.dispose(e),this._globalSpeedPass.dispose(e),this._edgeForceMesh.geometry.dispose(e),this._weightedSumMesh.geometry.dispose(e),this._positionSourceTex.dispose(e),this._positionTex.dispose(e),this._positionPrevTex.dispose(e),this._forceTex.dispose(e),this._forcePrevTex.dispose(e),this._weightedSumTex.dispose(e),this._globalSpeedTex.dispose(e),this._globalSpeedPrevTex.dispose(e)};const Xd=jd;var qd=function(){var e=function(){return new Float32Array(2)},t=function(e,t){var r=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(r*r+i*i)},r=function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},i=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e},n=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},a=function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e},o=function(e,t,r){return e[0]=t,e[1]=r,e};function s(){this.subRegions=[],this.nSubRegions=0,this.node=null,this.mass=0,this.centerOfMass=null,this.bbox=new Float32Array(4),this.size=0}var l=s.prototype;function h(){this.position=new Float32Array(2),this.force=e(),this.forcePrev=e(),this.mass=1,this.inDegree=0,this.outDegree=0}function u(e,t){this.source=e,this.target=t,this.weight=1}function c(){this.autoSettings=!0,this.barnesHutOptimize=!0,this.barnesHutTheta=1.5,this.repulsionByDegree=!0,this.linLogMode=!1,this.strongGravityMode=!1,this.gravity=1,this.scaling=1,this.edgeWeightInfluence=1,this.jitterTolerence=.1,this.preventOverlap=!1,this.dissuadeHubs=!1,this.rootRegion=new s,this.rootRegion.centerOfMass=e(),this.nodes=[],this.edges=[],this.bbox=new Float32Array(4),this.gravityCenter=null,this._massArr=null,this._swingingArr=null,this._sizeArr=null,this._globalSpeed=0}l.beforeUpdate=function(){for(var e=0;e=e&&this.bbox[1]<=t&&this.bbox[3]>=t},l.setBBox=function(e,t,r,i){this.bbox[0]=e,this.bbox[1]=t,this.bbox[2]=r,this.bbox[3]=i,this.size=(r-e+i-t)/2},l._newSubRegion=function(){var e=this.subRegions[this.nSubRegions];return e||(e=new s,this.subRegions[this.nSubRegions]=e),this.nSubRegions++,e},l._addNodeToSubRegion=function(e){var t=this.findSubRegion(e.position[0],e.position[1]),r=this.bbox;if(!t){var i=(r[0]+r[2])/2,n=(r[1]+r[3])/2,a=(r[2]-r[0])/2,o=(r[3]-r[1])/2,s=e.position[0]>=i?1:0,l=e.position[1]>=n?1:0;(t=this._newSubRegion()).setBBox(s*a+r[0],l*o+r[1],(s+1)*a+r[0],(l+1)*o+r[1])}t.addNode(e)},l._updateCenterOfMass=function(e){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var t=this.centerOfMass[0]*this.mass,r=this.centerOfMass[1]*this.mass;t+=e.position[0]*e.mass,r+=e.position[1]*e.mass,this.mass+=e.mass,this.centerOfMass[0]=t/this.mass,this.centerOfMass[1]=r/this.mass};var d=c.prototype;d.initNodes=function(e,t,r){var i=t.length;this.nodes.length=0;for(var n=void 0!==r,a=0;a0&&(this.strongGravityMode?this.applyNodeStrongGravity(c):this.applyNodeGravity(c))}for(h=0;h0&&(_=Math.min(_/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=_,h=0;h0&&(y=Math.min(x*y,10)/x,i(u.position,u.position,u.force,y))}},d.applyRegionToNodeRepulsion=function(){var t=e();return function(e,r){if(e.node)this.applyNodeToNodeRepulsion(e.node,r,!0);else{a(t,r.position,e.centerOfMass);var n=t[0]*t[0]+t[1]*t[1];if(n>this.barnesHutTheta*e.size*e.size){var o=this.scaling*r.mass*e.mass/n;i(r.force,r.force,t,o)}else for(var s=0;s0)s=this.scaling*e.mass*r.mass/(l*l);else{if(!(l<0))return;s=100*this.scaling*e.mass*r.mass}}else s=this.scaling*e.mass*r.mass/o;i(e.force,e.force,t,s),i(r.force,r.force,t,-s)}}}}(),d.applyEdgeAttraction=function(){var t=e();return function(e){var n=e.source,o=e.target;a(t,n.position,o.position);var s,l,h=r(t);s=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?e.weight:Math.pow(e.weight,this.edgeWeightInfluence),this.preventOverlap&&(h=h-n.size-o.size)<=0||(l=this.linLogMode?-s*Math.log(h+1)/(h+1):-s,i(n.force,n.force,t,l),i(o.force,o.force,t,-l))}}(),d.applyNodeGravity=function(){var t=e();return function(e){a(t,this.gravityCenter,e.position);var n=r(t);i(e.force,e.force,t,this.gravity*e.mass/(n+1))}}(),d.applyNodeStrongGravity=function(){var t=e();return function(e){a(t,this.gravityCenter,e.position),i(e.force,e.force,t,this.gravity*e.mass)}}(),d.updateBBox=function(){for(var e=1/0,t=1/0,r=-1/0,i=-1/0,n=0;n5e4?10:a>5e3?1:.1,t.scaling=a>100?2:10,t.barnesHutOptimize=a>1e3,e)for(var r in Zd)null!=e[r]&&(t[r]=e[r]);if(!t.gravityCenter){for(var o=[1/0,1/0],s=[-1/0,-1/0],l=0;le},Yd.prototype.getNodePosition=function(e,t){if(t||(t=new Float32Array(2*this._nodes.length)),this._positionArr)for(var r=0;r0?1.1:.9,a=Math.max(Math.min(this._zoom*n,this.maxZoom),this.minZoom);n=a/this._zoom;var o=this._convertPos(r,i),s=(o.x-this._dx)*(n-1),l=(o.y-this._dy)*(n-1);this._dx-=s,this._dy-=l,this._zoom=a,this._needsUpdate=!0}}},dispose:function(){var e=this.zr;e.off("mousedown",this._mouseDownHandler),e.off("mousemove",this._mouseMoveHandler),e.off("mouseup",this._mouseUpHandler),e.off("mousewheel",this._mouseWheelHandler),e.off("globalout",this._mouseUpHandler),e.animation.off("frame",this._update)}});var Jd=Po.vec2;Ka.Shader.import("@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end");var $d=1;const ef=i.ChartView.extend({type:"graphGL",__ecgl__:!0,init:function(e,t){this.groupGL=new Ka.Node,this.viewGL=new Il("orthographic"),this.viewGL.camera.left=this.viewGL.camera.right=0,this.viewGL.add(this.groupGL),this._pointsBuilder=new Fc(!0,t),this._forceEdgesMesh=new Ka.Mesh({material:new Ka.Material({shader:Ka.createShader("ecgl.forceAtlas2.edges"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new Ka.Geometry({attributes:{node:new Ka.Geometry.Attribute("node","float",2),color:new Ka.Geometry.Attribute("color","float",4,"COLOR")},dynamic:!0,mainAttribute:"node"}),renderOrder:-1,mode:Ka.Mesh.LINES}),this._edgesMesh=new Ka.Mesh({material:new Ka.Material({shader:Ka.createShader("ecgl.meshLines2D"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new Hd({useNativeLine:!1,dynamic:!0}),renderOrder:-1,culling:!1}),this._layoutId=0,this._control=new Qd({zr:t.getZr(),viewGL:this.viewGL}),this._control.setTarget(this.groupGL),this._control.init(),this._clickHandler=this._clickHandler.bind(this)},render:function(e,t,r){this.groupGL.add(this._pointsBuilder.rootNode),this._model=e,this._api=r,this._initLayout(e,t,r),this._pointsBuilder.update(e,t,r),this._forceLayoutInstance instanceof Xd||this.groupGL.remove(this._forceEdgesMesh),this._updateCamera(e,r),this._control.off("update"),this._control.on("update",(function(){r.dispatchAction({type:"graphGLRoam",seriesId:e.id,zoom:this._control.getZoom(),offset:this._control.getOffset()}),this._pointsBuilder.updateView(this.viewGL.camera)}),this),this._control.setZoom(Mn(e.get("zoom"),1)),this._control.setOffset(e.get("offset")||[0,0]);var i=this._pointsBuilder.getPointsMesh();if(i.off("mousemove",this._mousemoveHandler),i.off("mouseout",this._mouseOutHandler,this),r.getZr().off("click",this._clickHandler),this._pointsBuilder.highlightOnMouseover=!0,e.get("focusNodeAdjacency")){var n=e.get("focusNodeAdjacencyOn");"click"===n?r.getZr().on("click",this._clickHandler):"mouseover"===n&&(i.on("mousemove",this._mousemoveHandler,this),i.on("mouseout",this._mouseOutHandler,this),this._pointsBuilder.highlightOnMouseover=!1)}this._lastMouseOverDataIndex=-1},_clickHandler:function(e){if(!this._layouting){var t=this._pointsBuilder.getPointsMesh().dataIndex;t>=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(e){if(!this._layouting){var t=this._pointsBuilder.getPointsMesh().dataIndex;t>=0?t!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._mouseOutHandler(e),this._lastMouseOverDataIndex=t}},_mouseOutHandler:function(e){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(e,t){var r=this._forceEdgesMesh.geometry,i=t.getEdgeData(),n=0,a=this._forceLayoutInstance,o=2*i.count();r.attributes.node.init(o),r.attributes.color.init(o),i.each((function(t){var o=e[t];r.attributes.node.set(n,a.getNodeUV(o.node1)),r.attributes.node.set(n+1,a.getNodeUV(o.node2));var s=Ih(i,o.dataIndex),l=Ka.parseColor(s);l[3]*=Mn(Rh(i,o.dataIndex),1),r.attributes.color.set(n,l),r.attributes.color.set(n+1,l),n+=2})),r.dirty()},_updateMeshLinesGeometry:function(){var e=this._model.getEdgeData(),t=this._edgesMesh.geometry,r=(e=this._model.getEdgeData(),this._model.getData().getLayout("points"));t.resetOffset(),t.setVertexCount(e.count()*t.getLineVertexCount()),t.setTriangleCount(e.count()*t.getLineTriangleCount());var i=[],n=[],a=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*e.count()),this._edgeIndicesMap=new Float32Array(e.count()),e.each((function(o){var s=e.graph.getEdgeByIndex(o),l=2*s.node1.dataIndex,h=2*s.node2.dataIndex;i[0]=r[l],i[1]=r[l+1],n[0]=r[h],n[1]=r[h+1];var u=Ih(e,s.dataIndex),c=Ka.parseColor(u);c[3]*=Mn(Rh(e,s.dataIndex),1);var d=e.getItemModel(s.dataIndex),f=Mn(d.get(a),1)*this._api.getDevicePixelRatio();t.addLine(i,n,c,f);for(var p=0;p<4;p++)this._originalEdgeColors[4*s.dataIndex+p]=c[p];this._edgeIndicesMap[s.dataIndex]=o}),this),t.dirty()},_updateForceNodesGeometry:function(e){for(var t=this._pointsBuilder.getPointsMesh(),r=[],i=0;i=f&&(l._syncNodePosition(e),d=0),r.getZr().refresh(),Qa((function(){p(t)}))}))};Qa((function(){l._forceLayoutInstanceToDispose&&(l._forceLayoutInstanceToDispose.dispose(n.layer.renderer),l._forceLayoutInstanceToDispose=null),p(h)})),this._layouting=!0}}},stopLayout:function(e,t,r,i){i&&null!=i.from&&i.from!==this.uid||(this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(i&&i.beforeLayout||(this._syncNodePosition(e),this._updateAfterLayout(e,t,r)),this._api.getZr().refresh(),this._layouting=!1))},_syncNodePosition:function(e){var t=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);e.getData().setLayout("points",t),e.setNodePosition(t)},_updateAfterLayout:function(e,t,r){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(e,t,r),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(e,t,r,i){var n=this._model.getData();this._downplayAll();var a=i.dataIndex,o=n.graph,s=[],l=o.getNodeByIndex(a);s.push(l),l.edges.forEach((function(e){e.dataIndex<0||(e.node1!==l&&s.push(e.node1),e.node2!==l&&s.push(e.node2))}),this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach((function(e){this._pointsBuilder.highlight(n,e.dataIndex)}),this),this._pointsBuilder.updateLabels(s.map((function(e){return e.dataIndex})));var h=[];l.edges.forEach((function(e){e.dataIndex>=0&&(this._highlightEdge(e.dataIndex),h.push(e))}),this),this._focusNodes=s,this._focusEdges=h},unfocusNodeAdjacency:function(e,t,r,i){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(e){var t=this._model.getEdgeData().getItemModel(e),r=Ka.parseColor(t.get("emphasis.lineStyle.color")||t.get("lineStyle.color")),i=Mn(t.get("emphasis.lineStyle.opacity"),t.get("lineStyle.opacity"),1);r[3]*=i,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],r)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach((function(e){this._pointsBuilder.downplay(this._model.getData(),e.dataIndex)}),this),this._focusEdges&&this._focusEdges.forEach((function(e){this._downplayEdge(e.dataIndex)}),this)},_downplayEdge:function(e){var t=this._getColor(e,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],t)},_setEdgeFade:(tf=[],function(e,t){this._getColor(e,tf),tf[3]*=t,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],tf)}),_getColor:function(e,t){for(var r=0;r<4;r++)t[r]=this._originalEdgeColors[4*e+r];return t},_fadeOutEdgesAll:function(e){this._model.getData().graph.eachEdge((function(t){this._setEdgeFade(t.dataIndex,e)}),this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(e,t){this.viewGL.setViewport(0,0,t.getWidth(),t.getHeight(),t.getDevicePixelRatio());for(var r=this.viewGL.camera,i=e.getData().getLayout("points"),n=Jd.create(1/0,1/0),a=Jd.create(-1/0,-1/0),o=[],s=0;sr.left&&hr.top)){var u=Math.max(a[0]-n[0],10),c=u/t.getWidth()*t.getHeight();u*=1.4,c*=1.4,n[0]-=.2*u,r.left=n[0],r.top=l-c/2,r.bottom=l+c/2,r.right=u+n[0],r.near=0,r.far=100}},dispose:function(){var e=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(e),this.groupGL.removeAll(),this._layoutId=-1,this._pointsBuilder.dispose()},remove:function(){this.groupGL.removeAll(),this._control.dispose()}});var tf;function rf(e){return e instanceof Array||(e=[e,e]),e}(0,i.use)((function(e){function t(){}e.registerChartView(ef),e.registerSeriesModel(Gd),e.registerVisual((function(e){const t={};e.eachSeriesByType("graphGL",(function(e){var r=e.getCategoriesData(),n=e.getData(),a={};r.each((function(i){var n=r.getName(i);a["ec-"+n]=i;var o=r.getItemModel(i),s=o.getModel("itemStyle").getItemStyle();s.fill||(s.fill=e.getColorFromPalette(n,t)),r.setItemVisual(i,"style",s);var l=["symbol","symbolSize","symbolKeepAspect"];for(let e=0;e65535?new Uint32Array(3*i):new Uint16Array(3*i))},addLine:function(e){var t=this._vertexOffset;this.attributes.position.set(t,[e[0],e[1],1]),this.attributes.position.set(t+1,[e[0],e[1],-1]),this.attributes.position.set(t+2,[e[0],e[1],2]),this.attributes.position.set(t+3,[e[0],e[1],-2]),this.setTriangleIndices(this._faceOffset++,[t,t+1,t+2]),this.setTriangleIndices(this._faceOffset++,[t+1,t+2,t+3]),this._vertexOffset+=4}});Xe.import("@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n");var of=function(){this.motionBlurFactor=.99,this.vectorFieldTexture=new Dr({type:wr.FLOAT,flipY:!1}),this.particleLife=[5,20],this._particleType="point",this._particleSize=1,this.particleColor=[1,1,1,1],this.particleSpeedScaling=1,this._thisFrameTexture=null,this._particlePass=null,this._spawnTexture=null,this._particleTexture0=null,this._particleTexture1=null,this._particlePointsMesh=null,this._surfaceFrameBuffer=null,this._elapsedTime=0,this._scene=null,this._camera=null,this._lastFrameTexture=null,this._supersampling=1,this._downsampleTextures=[],this._width=512,this._height=512,this.init()};of.prototype={constructor:of,init:function(){var e={type:wr.FLOAT,minFilter:wr.NEAREST,magFilter:wr.NEAREST,useMipmap:!1};this._spawnTexture=new Dr(e),this._particleTexture0=new Dr(e),this._particleTexture1=new Dr(e),this._frameBuffer=new zi({depthBuffer:!1}),this._particlePass=new pn({fragment:Xe.source("ecgl.vfParticle.particle.fragment")}),this._particlePass.setUniform("velocityTexture",this.vectorFieldTexture),this._particlePass.setUniform("spawnTexture",this._spawnTexture),this._downsamplePass=new pn({fragment:Xe.source("clay.compositor.downsample")});var t=new Sr({renderOrder:10,material:new le({shader:new Xe(Xe.source("ecgl.vfParticle.renderPoints.vertex"),Xe.source("ecgl.vfParticle.renderPoints.fragment"))}),mode:Sr.POINTS,geometry:new Vr({dynamic:!0,mainAttribute:"texcoord0"})}),r=new Sr({renderOrder:10,material:new le({shader:new Xe(Xe.source("ecgl.vfParticle.renderLines.vertex"),Xe.source("ecgl.vfParticle.renderLines.fragment"))}),geometry:new af,culling:!1}),i=new Sr({material:new le({shader:new Xe(Xe.source("ecgl.color.vertex"),Xe.source("ecgl.color.fragment"))}),geometry:new ki});i.material.enableTexture("diffuseMap"),this._particlePointsMesh=t,this._particleLinesMesh=r,this._lastFrameFullQuadMesh=i,this._camera=new un,this._thisFrameTexture=new Dr,this._lastFrameTexture=new Dr},setParticleDensity:function(e,t){for(var r=new Float32Array(e*t*4),i=0,n=this.particleLife,a=0;a0?e[e.length-1]:this._lastFrameTexture},setRegion:function(e){this._particlePass.setUniform("region",e)},resize:function(e,t){this._lastFrameTexture.width=e*this._supersampling,this._lastFrameTexture.height=t*this._supersampling,this._thisFrameTexture.width=e*this._supersampling,this._thisFrameTexture.height=t*this._supersampling,this._width=e,this._height=t},setParticleSize:function(e){var t=this._getParticleMesh();if(e<=2)return t.material.disableTexture("spriteTexture"),void(t.material.transparent=!1);this._spriteTexture||(this._spriteTexture=new Dr),this._spriteTexture.image&&this._spriteTexture.image.width===e||(this._spriteTexture.image=function(e){var t=document.createElement("canvas");t.width=t.height=e;var r=t.getContext("2d");return r.fillStyle="#fff",r.arc(e/2,e/2,e/2,0,2*Math.PI),r.fill(),t}(e),this._spriteTexture.dirty()),t.material.transparent=!0,t.material.enableTexture("spriteTexture"),t.material.set("spriteTexture",this._spriteTexture),this._particleSize=e},setGradientTexture:function(e){var t=this._getParticleMesh().material;t[e?"enableTexture":"disableTexture"]("gradientTexture"),t.setUniform("gradientTexture",e)},setColorTextureImage:function(e,t){this._getParticleMesh().material.setTextureImage("colorTexture",e,t,{flipY:!0})},setParticleType:function(e){this._particleType=e},clearFrame:function(e){var t=this._frameBuffer;t.attach(this._lastFrameTexture),t.bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT),t.unbind(e)},setSupersampling:function(e){this._supersampling=e,this.resize(this._width,this._height)},_updateDownsampleTextures:function(e,t){for(var r=this._downsampleTextures,i=Math.max(Math.floor(Math.log(this._supersampling/t.getDevicePixelRatio())/Math.log(2)),0),n=2,a=this._width*this._supersampling,o=this._height*this._supersampling,s=0;s=359&&(n[0]>0&&(n[0]=0),a[0]1?(t.material.shader!==this._meshLinesShader&&t.material.attachShader(this._meshLinesShader),t.mode=Ka.Mesh.TRIANGLES):(t.material.shader!==this._nativeLinesShader&&t.material.attachShader(this._nativeLinesShader),t.mode=Ka.Mesh.LINES),r=r||0,i=i||n.count(),s.resetOffset();var u=0,c=0,d=[],f=[],p=[],m=[],g=[],_=.3,v=.7;function y(){f[0]=d[0]*v+m[0]*_-(d[1]-m[1])*a,f[1]=d[1]*v+m[1]*_-(m[0]-d[0])*a,p[0]=d[0]*_+m[0]*v-(d[1]-m[1])*a,p[1]=d[1]*_+m[1]*v-(m[0]-d[0])*a}if(o||0!==a)for(var x=r;x{t.exports=e}},r={};function i(e){if(r[e])return r[e].exports;var n=r[e]={exports:{}};return t[e](n,n.exports,i),n.exports}return i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(468)})()})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],t):"object"==typeof exports?exports["echarts-gl"]=t(require("echarts")):e["echarts-gl"]=t(e.echarts)}(self,(function(e){return(()=>{"use strict";var t={468:(e,t,r)=>{r.r(t);var i=r(83);function n(e,t,r){"object"==typeof t&&(r=t,t=null);var i,n=this;if(!(e instanceof Function))for(var s in i=[],e)e.hasOwnProperty(s)&&i.push(s);var l=function(t){if(n.apply(this,arguments),e instanceof Function?a(this,e.call(this,t)):o(this,e,i),this.constructor===l)for(var r=l.__initializers__,s=0;s=400?e.onerror&&e.onerror():e.onload&&e.onload(t.response)},e.onerror&&(t.onerror=e.onerror),t.send(null)}};var F,z={supportWebGL:function(){if(null==F)try{var e=document.createElement("canvas");if(!e.getContext("webgl")&&!e.getContext("experimental-webgl"))throw new Error}catch(e){F=!1}return F}};z.Int8Array="undefined"==typeof Int8Array?Array:Int8Array,z.Uint8Array="undefined"==typeof Uint8Array?Array:Uint8Array,z.Uint16Array="undefined"==typeof Uint16Array?Array:Uint16Array,z.Uint32Array="undefined"==typeof Uint32Array?Array:Uint32Array,z.Int16Array="undefined"==typeof Int16Array?Array:Int16Array,z.Float32Array="undefined"==typeof Float32Array?Array:Float32Array,z.Float64Array="undefined"==typeof Float64Array?Array:Float64Array;var G={};"undefined"!=typeof window?G=window:void 0!==r.g&&(G=r.g),z.requestAnimationFrame=G.requestAnimationFrame||G.msRequestAnimationFrame||G.mozRequestAnimationFrame||G.webkitRequestAnimationFrame||function(e){setTimeout(e,16)},z.createCanvas=function(){return document.createElement("canvas")},z.createImage=function(){return new G.Image},z.request={get:B.get},z.addEventListener=function(e,t,r,i){e.addEventListener(t,r,i)},z.removeEventListener=function(e,t,r){e.removeEventListener(t,r)};const U=z;var k=function(){this.head=null,this.tail=null,this._length=0};k.prototype.insert=function(e){var t=new k.Entry(e);return this.insertEntry(t),t},k.prototype.insertAt=function(e,t){if(!(e<0)){for(var r=this.head,i=0;r&&i!=e;)r=r.next,i++;if(r){var n=new k.Entry(t),a=r.prev;a?(a.next=n,n.prev=a):this.head=n,n.next=r,r.prev=n}else this.insert(t)}},k.prototype.insertBeforeEntry=function(e,t){var r=new k.Entry(e),i=t.prev;i?(i.next=r,r.prev=i):this.head=r,r.next=t,t.prev=r,this._length++},k.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,this.tail=e):this.head=this.tail=e,this._length++},k.prototype.remove=function(e){var t=e.prev,r=e.next;t?t.next=r:this.head=r,r?r.prev=t:this.tail=t,e.next=e.prev=null,this._length--},k.prototype.removeAt=function(e){if(!(e<0)){for(var t=this.head,r=0;t&&r!=e;)t=t.next,r++;return t?(this.remove(t),t.value):void 0}},k.prototype.getHead=function(){if(this.head)return this.head.value},k.prototype.getTail=function(){if(this.tail)return this.tail.value},k.prototype.getAt=function(e){if(!(e<0)){for(var t=this.head,r=0;t&&r!=e;)t=t.next,r++;return t.value}},k.prototype.indexOf=function(e){for(var t=this.head,r=0;t;){if(t.value===e)return r;t=t.next,r++}},k.prototype.length=function(){return this._length},k.prototype.isEmpty=function(){return 0===this._length},k.prototype.forEach=function(e,t){for(var r=this.head,i=0,n=void 0!==t;r;)n?e.call(t,r.value,i):e(r.value,i),r=r.next,i++},k.prototype.clear=function(){this.tail=this.head=null,this._length=0},k.Entry=function(e){this.value=e,this.next=null,this.prev=null};const V=k;var H=function(e){this._list=new V,this._map={},this._maxSize=e||10};H.prototype.setMaxSize=function(e){this._maxSize=e},H.prototype.put=function(e,t){if(!this._map.hasOwnProperty(e)){var r=this._list.length();if(r>=this._maxSize&&r>0){var i=this._list.head;this._list.remove(i),delete this._map[i.key]}var n=this._list.insert(t);n.key=e,this._map[e]=n}},H.prototype.get=function(e){var t=this._map[e];if(this._map.hasOwnProperty(e))return t!==this._list.tail&&(this._list.remove(t),this._list.insertEntry(t)),t.value},H.prototype.remove=function(e){var t=this._map[e];void 0!==t&&(delete this._map[e],this._list.remove(t))},H.prototype.clear=function(){this._list.clear(),this._map={}};const W=H;var j={},X={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function q(e){return(e=Math.round(e))<0?0:e>255?255:e}function Z(e){return e<0?0:e>1?1:e}function Y(e){return e.length&&"%"===e.charAt(e.length-1)?q(parseFloat(e)/100*255):q(parseInt(e,10))}function K(e){return e.length&&"%"===e.charAt(e.length-1)?Z(parseFloat(e)/100):Z(parseFloat(e))}function Q(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function J(e,t,r){return e+(t-e)*r}function $(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e}function ee(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var te=new W(20),re=null;function ie(e,t){re&&ee(re,t),re=te.put(e,re||t.slice())}function ne(e,t){var r=(parseFloat(e[0])%360+360)%360/360,i=K(e[1]),n=K(e[2]),a=n<=.5?n*(i+1):n+i-n*i,o=2*n-a;return $(t=t||[],q(255*Q(o,a,r+1/3)),q(255*Q(o,a,r)),q(255*Q(o,a,r-1/3)),1),4===e.length&&(t[3]=e[3]),t}j.parse=function(e,t){if(e){t=t||[];var r=te.get(e);if(r)return ee(t,r);var i,n=(e+="").replace(/ /g,"").toLowerCase();if(n in X)return ee(t,X[n]),ie(e,t),t;if("#"===n.charAt(0))return 4===n.length?(i=parseInt(n.substr(1),16))>=0&&i<=4095?($(t,(3840&i)>>4|(3840&i)>>8,240&i|(240&i)>>4,15&i|(15&i)<<4,1),ie(e,t),t):void $(t,0,0,0,1):7===n.length?(i=parseInt(n.substr(1),16))>=0&&i<=16777215?($(t,(16711680&i)>>16,(65280&i)>>8,255&i,1),ie(e,t),t):void $(t,0,0,0,1):void 0;var a=n.indexOf("("),o=n.indexOf(")");if(-1!==a&&o+1===n.length){var s=n.substr(0,a),l=n.substr(a+1,o-(a+1)).split(","),h=1;switch(s){case"rgba":if(4!==l.length)return void $(t,0,0,0,1);h=K(l.pop());case"rgb":return 3!==l.length?void $(t,0,0,0,1):($(t,Y(l[0]),Y(l[1]),Y(l[2]),h),ie(e,t),t);case"hsla":return 4!==l.length?void $(t,0,0,0,1):(l[3]=K(l[3]),ne(l,t),ie(e,t),t);case"hsl":return 3!==l.length?void $(t,0,0,0,1):(ne(l,t),ie(e,t),t);default:return}}$(t,0,0,0,1)}},j.parseToFloat=function(e,t){if(t=j.parse(e,t))return t[0]/=255,t[1]/=255,t[2]/=255,t},j.lift=function(e,t){var r=j.parse(e);if(r){for(var i=0;i<3;i++)r[i]=t<0?r[i]*(1-t)|0:(255-r[i])*t+r[i]|0;return j.stringify(r,4===r.length?"rgba":"rgb")}},j.toHex=function(e){var t=j.parse(e);if(t)return((1<<24)+(t[0]<<16)+(t[1]<<8)+ +t[2]).toString(16).slice(1)},j.fastLerp=function(e,t,r){if(t&&t.length&&e>=0&&e<=1){r=r||[];var i=e*(t.length-1),n=Math.floor(i),a=Math.ceil(i),o=t[n],s=t[a],l=i-n;return r[0]=q(J(o[0],s[0],l)),r[1]=q(J(o[1],s[1],l)),r[2]=q(J(o[2],s[2],l)),r[3]=Z(J(o[3],s[3],l)),r}},j.fastMapToColor=j.fastLerp,j.lerp=function(e,t,r){if(t&&t.length&&e>=0&&e<=1){var i=e*(t.length-1),n=Math.floor(i),a=Math.ceil(i),o=j.parse(t[n]),s=j.parse(t[a]),l=i-n,h=j.stringify([q(J(o[0],s[0],l)),q(J(o[1],s[1],l)),q(J(o[2],s[2],l)),Z(J(o[3],s[3],l))],"rgba");return r?{color:h,leftIndex:n,rightIndex:a,value:i}:h}},j.mapToColor=j.lerp,j.modifyHSL=function(e,t,r,i){if(e=j.parse(e))return e=function(e){if(e){var t,r,i=e[0]/255,n=e[1]/255,a=e[2]/255,o=Math.min(i,n,a),s=Math.max(i,n,a),l=s-o,h=(s+o)/2;if(0===l)t=0,r=0;else{r=h<.5?l/(s+o):l/(2-s-o);var u=((s-i)/6+l/2)/l,c=((s-n)/6+l/2)/l,d=((s-a)/6+l/2)/l;i===s?t=d-c:n===s?t=1/3+u-d:a===s&&(t=2/3+c-u),t<0&&(t+=1),t>1&&(t-=1)}var f=[360*t,r,h];return null!=e[3]&&f.push(e[3]),f}}(e),null!=t&&(e[0]=(n=t,(n=Math.round(n))<0?0:n>360?360:n)),null!=r&&(e[1]=K(r)),null!=i&&(e[2]=K(i)),j.stringify(ne(e),"rgba");var n},j.modifyAlpha=function(e,t){if((e=j.parse(e))&&null!=t)return e[3]=Z(t),j.stringify(e,"rgba")},j.stringify=function(e,t){if(e&&e.length){var r=e[0]+","+e[1]+","+e[2];return"rgba"!==t&&"hsva"!==t&&"hsla"!==t||(r+=","+e[3]),t+"("+r+")"}};var ae=j.parseToFloat,oe={};function se(e){var t=Object.keys(e);t.sort();for(var r=[],i=0;i=0},getEnabledUniforms:function(){return this._enabledUniforms},getTextureUniforms:function(){return this._textureUniforms},set:function(e,t){if("object"==typeof e)for(var r in e){var i=e[r];this.setUniform(r,i)}else this.setUniform(e,t)},get:function(e){var t=this.uniforms[e];if(t)return t.value},attachShader:function(e,t){var r=this.uniforms;this.uniforms=e.createUniforms(),this.shader=e;var i=this.uniforms;this._enabledUniforms=Object.keys(i),this._enabledUniforms.sort(),this._textureUniforms=this._enabledUniforms.filter((function(e){var t=this.uniforms[e].type;return"t"===t||"tv"===t}),this);var n=this.vertexDefines,a=this.fragmentDefines;if(this.vertexDefines=f.clone(e.vertexDefines),this.fragmentDefines=f.clone(e.fragmentDefines),t){for(var o in r)i[o]&&(i[o].value=r[o].value);f.defaults(this.vertexDefines,n),f.defaults(this.fragmentDefines,a)}var s={};for(var l in e.textures)s[l]={shaderType:e.textures[l].shaderType,type:e.textures[l].type,enabled:!(!t||!this._textureStatus[l])&&this._textureStatus[l].enabled};this._textureStatus=s,this._programKey=""},clone:function(){var e=new this.constructor({name:this.name,shader:this.shader});for(var t in this.uniforms)e.uniforms[t].value=this.uniforms[t].value;return e.depthTest=this.depthTest,e.depthMask=this.depthMask,e.transparent=this.transparent,e.blend=this.blend,e.vertexDefines=f.clone(this.vertexDefines),e.fragmentDefines=f.clone(this.fragmentDefines),e.enableTexture(this.getEnabledTextures()),e.precision=this.precision,e},define:function(e,t,r){var i=this.vertexDefines,n=this.fragmentDefines;"vertex"!==e&&"fragment"!==e&&"both"!==e&&arguments.length<3&&(r=t,t=e,e="both"),r=null!=r?r:null,"vertex"!==e&&"both"!==e||i[t]!==r&&(i[t]=r,this._programKey=""),"fragment"!==e&&"both"!==e||n[t]!==r&&(n[t]=r,"both"!==e&&(this._programKey=""))},undefine:function(e,t){"vertex"!==e&&"fragment"!==e&&"both"!==e&&arguments.length<2&&(t=e,e="both"),"vertex"!==e&&"both"!==e||this.isDefined("vertex",t)&&(delete this.vertexDefines[t],this._programKey=""),"fragment"!==e&&"both"!==e||this.isDefined("fragment",t)&&(delete this.fragmentDefines[t],"both"!==e&&(this._programKey=""))},isDefined:function(e,t){switch(e){case"vertex":return void 0!==this.vertexDefines[t];case"fragment":return void 0!==this.fragmentDefines[t]}},getDefine:function(e,t){switch(e){case"vertex":return this.vertexDefines[t];case"fragment":return this.fragmentDefines[t]}},enableTexture:function(e){if(Array.isArray(e))for(var t=0;t0&&(n=1/Math.sqrt(n),e[0]=t[0]*n,e[1]=t[1]*n),e},fe.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},fe.cross=function(e,t,r){var i=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=i,e},fe.lerp=function(e,t,r,i){var n=t[0],a=t[1];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e},fe.random=function(e,t){t=t||1;var r=2*GLMAT_RANDOM()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e},fe.transformMat2=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n,e[1]=r[1]*i+r[3]*n,e},fe.transformMat2d=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[2]*n+r[4],e[1]=r[1]*i+r[3]*n+r[5],e},fe.transformMat3=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[3]*n+r[6],e[1]=r[1]*i+r[4]*n+r[7],e},fe.transformMat4=function(e,t,r){var i=t[0],n=t[1];return e[0]=r[0]*i+r[4]*n+r[12],e[1]=r[1]*i+r[5]*n+r[13],e},fe.forEach=(he=fe.create(),function(e,t,r,i,n,a){var o,s;for(t||(t=2),r||(r=0),s=i?Math.min(i*t+r,e.length):e.length,o=r;o0&&i.push("#define "+n.toUpperCase()+"_COUNT "+a)}if(r)for(var o=0;ol.getMaxJointNumber()&&(d.USE_SKIN_MATRICES_TEXTURE=null),c+="\n"+Me(d)+"\n"}a&&(c+="\n#define INSTANCING\n");var f=c+Me(t.vertexDefines,s,u),p=c+Me(t.fragmentDefines,s,u),m=f+"\n"+t.shader.vertex,g=["OES_standard_derivatives","EXT_shader_texture_lod"].filter((function(e){return null!=l.getGLExtension(e)}));g.indexOf("EXT_shader_texture_lod")>=0&&(p+="\n#define SUPPORT_TEXTURE_LOD"),g.indexOf("OES_standard_derivatives")>=0&&(p+="\n#define SUPPORT_STANDARD_DERIVATIVES");var _,v,y=function(e){for(var t=[],r=0;r=0){if(1!==s&&4!==s){ke();break}s=2,h=[]}else if(1!==s)if(4!==s)u(c),s=0;else{var d=c;Ie.indexOf(d)>=0||Re.indexOf(d)>=0||Be.indexOf(d)>=0?l[o].semantic=d:"ignore"===d||"unconfigurable"===d?l[o].ignore=!0:l[o].value="bool"===e?"true"===d:parseFloat(d)}else l[o].value="bool"===e?"true"===c:parseFloat(c),h=null;else{if(2!==s){ke();break}if(!(h instanceof Array)){ke();break}h.push(+i[++a])}else l[o].value=new U.Float32Array(h),h=null,s=5;else if(2===s){if(!(h instanceof Array)){ke();break}h.push(+i[++a])}else s=5;else s=4;else{if(0!==s&&3!==s){ke();break}s=1}}return l}function He(e,t){"object"==typeof e&&(t=e.fragment,e=e.vertex),e=Ue(e),t=Ue(t),this._shaderID=function(e,t){var r="vertex:"+e+"fragment:"+t;if(ze[r])return ze[r];var i=f.genGUID();return ze[r]=i,Ge[i]={vertex:e,fragment:t},i}(e,t),this._vertexCode=He.parseImport(e),this._fragmentCode=He.parseImport(t),this.attributeSemantics={},this.matrixSemantics={},this.uniformSemantics={},this.matrixSemanticKeys=[],this.uniformTemplates={},this.attributes={},this.textures={},this.vertexDefines={},this.fragmentDefines={},this._parseAttributes(),this._parseUniforms(),this._parseDefines()}He.prototype={constructor:He,createUniforms:function(){var e={};for(var t in this.uniformTemplates){var r=this.uniformTemplates[t];e[t]={type:r.type,value:r.value()}}return e},_parseImport:function(){this._vertexCode=He.parseImport(this.vertex),this._fragmentCode=He.parseImport(this.fragment)},_addSemanticUniform:function(e,t,r){if(Ie.indexOf(r)>=0)this.attributeSemantics[r]={symbol:e,type:t};else if(Be.indexOf(r)>=0){var i=!1,n=r;r.match(/TRANSPOSE$/)&&(i=!0,n=r.slice(0,-9)),this.matrixSemantics[r]={symbol:e,type:t,isTranspose:i,semanticNoTranspose:n}}else Re.indexOf(r)>=0&&(this.uniformSemantics[r]={symbol:e,type:t})},_addMaterialUniform:function(e,t,r,i,n,a){a[e]={type:r,value:n?Ne.array:i||Ne[t],semantic:null}},_parseUniforms:function(){var e={},t=this;function r(e){return null!=e?function(){return e}:null}function i(i,n,a){var o=Ve(n,a),s=[];for(var l in o){var h=o[l],u=h.semantic,c=l,d=Pe[n],f=r(o[l].value);o[l].isArray&&(c+="["+o[l].arraySize+"]",d+="v"),s.push(c),t._uniformList.push(l),h.ignore||("sampler2D"!==n&&"samplerCube"!==n||(t.textures[l]={shaderType:"fragment",type:n}),u?t._addSemanticUniform(l,d,u):t._addMaterialUniform(l,n,d,f,o[l].isArray,e))}return s.length>0?"uniform "+n+" "+s.join(",")+";\n":""}this._uniformList=[],this._vertexCode=this._vertexCode.replace(Ce,i),this._fragmentCode=this._fragmentCode.replace(Ce,i),t.matrixSemanticKeys=Object.keys(this.matrixSemantics),this.uniformTemplates=e},_parseAttributes:function(){var e={},t=this;this._vertexCode=this._vertexCode.replace(De,(function(r,i,n){var a=Ve(i,n),o=Fe[i]||1,s=[];for(var l in a){var h=a[l].semantic;if(e[l]={type:"float",size:o,semantic:h||null},h){if(Ie.indexOf(h)<0)throw new Error('Unkown semantic "'+h+'"');t.attributeSemantics[h]={symbol:l,type:i}}s.push(l)}return"attribute "+i+" "+s.join(",")+";\n"})),this.attributes=e},_parseDefines:function(){var e=this;function t(t,r,i){var n=e.fragmentDefines;return n[r]||(n[r]="false"!==i&&("true"===i||(i?isNaN(parseFloat(i))?i.trim():parseFloat(i):null))),""}this._vertexCode=this._vertexCode.replace(Le,t),this._fragmentCode=this._fragmentCode.replace(Le,t)},clone:function(){var e=Ge[this._shaderID];return new He(e.vertex,e.fragment)}},Object.defineProperty&&(Object.defineProperty(He.prototype,"shaderID",{get:function(){return this._shaderID}}),Object.defineProperty(He.prototype,"vertex",{get:function(){return this._vertexCode}}),Object.defineProperty(He.prototype,"fragment",{get:function(){return this._fragmentCode}}),Object.defineProperty(He.prototype,"uniforms",{get:function(){return this._uniformList}}));var We=/(@import)\s*([0-9a-zA-Z_\-\.]*)/g;He.parseImport=function(e){return e.replace(We,(function(e,t,r){return(e=He.source(r))?He.parseImport(e):(console.error('Shader chunk "'+r+'" not existed in library'),"")}))};var je=/(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g;He.import=function(e){e.replace(je,(function(e,t,r,i){if(i=i.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g,"")){for(var n,a=r.split("."),o=He.codes,s=0;s 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n}\n@end";var Ze={create:function(){var e=new ce(16);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},clone:function(e){var t=new ce(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},transpose:function(e,t){if(e===t){var r=t[1],i=t[2],n=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=a,e[11]=t[14],e[12]=n,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},invert:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],h=t[7],u=t[8],c=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],_=t[15],v=r*s-i*o,y=r*l-n*o,x=r*h-a*o,b=i*l-n*s,w=i*h-a*s,T=n*h-a*l,S=u*m-c*p,M=u*g-d*p,A=u*_-f*p,E=c*g-d*m,C=c*_-f*m,D=d*_-f*g,L=v*D-y*C+x*E+b*A-w*M+T*S;return L?(L=1/L,e[0]=(s*D-l*C+h*E)*L,e[1]=(n*C-i*D-a*E)*L,e[2]=(m*T-g*w+_*b)*L,e[3]=(d*w-c*T-f*b)*L,e[4]=(l*A-o*D-h*M)*L,e[5]=(r*D-n*A+a*M)*L,e[6]=(g*x-p*T-_*y)*L,e[7]=(u*T-d*x+f*y)*L,e[8]=(o*C-s*A+h*S)*L,e[9]=(i*A-r*C-a*S)*L,e[10]=(p*w-m*x+_*v)*L,e[11]=(c*x-u*w-f*v)*L,e[12]=(s*M-o*E-l*S)*L,e[13]=(r*E-i*M+n*S)*L,e[14]=(m*y-p*b-g*v)*L,e[15]=(u*b-c*y+d*v)*L,e):null},adjoint:function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=t[4],s=t[5],l=t[6],h=t[7],u=t[8],c=t[9],d=t[10],f=t[11],p=t[12],m=t[13],g=t[14],_=t[15];return e[0]=s*(d*_-f*g)-c*(l*_-h*g)+m*(l*f-h*d),e[1]=-(i*(d*_-f*g)-c*(n*_-a*g)+m*(n*f-a*d)),e[2]=i*(l*_-h*g)-s*(n*_-a*g)+m*(n*h-a*l),e[3]=-(i*(l*f-h*d)-s*(n*f-a*d)+c*(n*h-a*l)),e[4]=-(o*(d*_-f*g)-u*(l*_-h*g)+p*(l*f-h*d)),e[5]=r*(d*_-f*g)-u*(n*_-a*g)+p*(n*f-a*d),e[6]=-(r*(l*_-h*g)-o*(n*_-a*g)+p*(n*h-a*l)),e[7]=r*(l*f-h*d)-o*(n*f-a*d)+u*(n*h-a*l),e[8]=o*(c*_-f*m)-u*(s*_-h*m)+p*(s*f-h*c),e[9]=-(r*(c*_-f*m)-u*(i*_-a*m)+p*(i*f-a*c)),e[10]=r*(s*_-h*m)-o*(i*_-a*m)+p*(i*h-a*s),e[11]=-(r*(s*f-h*c)-o*(i*f-a*c)+u*(i*h-a*s)),e[12]=-(o*(c*g-d*m)-u*(s*g-l*m)+p*(s*d-l*c)),e[13]=r*(c*g-d*m)-u*(i*g-n*m)+p*(i*d-n*c),e[14]=-(r*(s*g-l*m)-o*(i*g-n*m)+p*(i*l-n*s)),e[15]=r*(s*d-l*c)-o*(i*d-n*c)+u*(i*l-n*s),e},determinant:function(e){var t=e[0],r=e[1],i=e[2],n=e[3],a=e[4],o=e[5],s=e[6],l=e[7],h=e[8],u=e[9],c=e[10],d=e[11],f=e[12],p=e[13],m=e[14],g=e[15];return(t*o-r*a)*(c*g-d*m)-(t*s-i*a)*(u*g-d*p)+(t*l-n*a)*(u*m-c*p)+(r*s-i*o)*(h*g-d*f)-(r*l-n*o)*(h*m-c*f)+(i*l-n*s)*(h*p-u*f)},multiply:function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],f=t[10],p=t[11],m=t[12],g=t[13],_=t[14],v=t[15],y=r[0],x=r[1],b=r[2],w=r[3];return e[0]=y*i+x*s+b*c+w*m,e[1]=y*n+x*l+b*d+w*g,e[2]=y*a+x*h+b*f+w*_,e[3]=y*o+x*u+b*p+w*v,y=r[4],x=r[5],b=r[6],w=r[7],e[4]=y*i+x*s+b*c+w*m,e[5]=y*n+x*l+b*d+w*g,e[6]=y*a+x*h+b*f+w*_,e[7]=y*o+x*u+b*p+w*v,y=r[8],x=r[9],b=r[10],w=r[11],e[8]=y*i+x*s+b*c+w*m,e[9]=y*n+x*l+b*d+w*g,e[10]=y*a+x*h+b*f+w*_,e[11]=y*o+x*u+b*p+w*v,y=r[12],x=r[13],b=r[14],w=r[15],e[12]=y*i+x*s+b*c+w*m,e[13]=y*n+x*l+b*d+w*g,e[14]=y*a+x*h+b*f+w*_,e[15]=y*o+x*u+b*p+w*v,e},multiplyAffine:function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[4],s=t[5],l=t[6],h=t[8],u=t[9],c=t[10],d=t[12],f=t[13],p=t[14],m=r[0],g=r[1],_=r[2];return e[0]=m*i+g*o+_*h,e[1]=m*n+g*s+_*u,e[2]=m*a+g*l+_*c,m=r[4],g=r[5],_=r[6],e[4]=m*i+g*o+_*h,e[5]=m*n+g*s+_*u,e[6]=m*a+g*l+_*c,m=r[8],g=r[9],_=r[10],e[8]=m*i+g*o+_*h,e[9]=m*n+g*s+_*u,e[10]=m*a+g*l+_*c,m=r[12],g=r[13],_=r[14],e[12]=m*i+g*o+_*h+d,e[13]=m*n+g*s+_*u+f,e[14]=m*a+g*l+_*c+p,e}};Ze.mul=Ze.multiply,Ze.mulAffine=Ze.multiplyAffine,Ze.translate=function(e,t,r){var i,n,a,o,s,l,h,u,c,d,f,p,m=r[0],g=r[1],_=r[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*_+t[12],e[13]=t[1]*m+t[5]*g+t[9]*_+t[13],e[14]=t[2]*m+t[6]*g+t[10]*_+t[14],e[15]=t[3]*m+t[7]*g+t[11]*_+t[15]):(i=t[0],n=t[1],a=t[2],o=t[3],s=t[4],l=t[5],h=t[6],u=t[7],c=t[8],d=t[9],f=t[10],p=t[11],e[0]=i,e[1]=n,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=h,e[7]=u,e[8]=c,e[9]=d,e[10]=f,e[11]=p,e[12]=i*m+s*g+c*_+t[12],e[13]=n*m+l*g+d*_+t[13],e[14]=a*m+h*g+f*_+t[14],e[15]=o*m+u*g+p*_+t[15]),e},Ze.scale=function(e,t,r){var i=r[0],n=r[1],a=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=t[7]*n,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},Ze.rotate=function(e,t,r,i){var n,a,o,s,l,h,u,c,d,f,p,m,g,_,v,y,x,b,w,T,S,M,A,E,C=i[0],D=i[1],L=i[2],P=Math.sqrt(C*C+D*D+L*L);return Math.abs(P)0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e},Ke.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},Ke.cross=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2];return e[0]=n*l-a*s,e[1]=a*o-i*l,e[2]=i*s-n*o,e},Ke.lerp=function(e,t,r,i){var n=t[0],a=t[1],o=t[2];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e},Ke.random=function(e,t){t=t||1;var r=2*de()*Math.PI,i=2*de()-1,n=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*n,e[1]=Math.sin(r)*n,e[2]=i*t,e},Ke.transformMat4=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[3]*i+r[7]*n+r[11]*a+r[15];return o=o||1,e[0]=(r[0]*i+r[4]*n+r[8]*a+r[12])/o,e[1]=(r[1]*i+r[5]*n+r[9]*a+r[13])/o,e[2]=(r[2]*i+r[6]*n+r[10]*a+r[14])/o,e},Ke.transformMat3=function(e,t,r){var i=t[0],n=t[1],a=t[2];return e[0]=i*r[0]+n*r[3]+a*r[6],e[1]=i*r[1]+n*r[4]+a*r[7],e[2]=i*r[2]+n*r[5]+a*r[8],e},Ke.transformQuat=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2],h=r[3],u=h*i+s*a-l*n,c=h*n+l*i-o*a,d=h*a+o*n-s*i,f=-o*i-s*n-l*a;return e[0]=u*h+f*-o+c*-l-d*-s,e[1]=c*h+f*-s+d*-o-u*-l,e[2]=d*h+f*-l+u*-s-c*-o,e},Ke.rotateX=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0],a[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),a[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},Ke.rotateY=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),a[1]=n[1],a[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},Ke.rotateZ=function(e,t,r,i){var n=[],a=[];return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],a[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),a[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),a[2]=n[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e},Ke.forEach=function(){var e=Ke.create();return function(t,r,i,n,a,o){var s,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s1?0:Math.acos(n)};const Qe=Ke;Xe.import(qe);var Je=Ye.create,$e={};function et(e){return e.material}function tt(e,t,r){return t.uniforms[r].value}function rt(e,t,r,i){return r!==i}function it(e){return!0}function nt(){}var at={float:S,byte:5120,ubyte:T,short:5122,ushort:5123};function ot(e,t,r){this.availableAttributes=e,this.availableAttributeSymbols=t,this.indicesBuffer=r,this.vao=null}function st(e){var t,r;this.bind=function(e){t||((t=U.createCanvas()).width=t.height=1,t.getContext("2d"));var i=e.gl,n=!r;n&&(r=i.createTexture()),i.bindTexture(i.TEXTURE_2D,r),n&&i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t)},this.unbind=function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,null)},this.isRenderable=function(){return!0}}var lt=m.extend((function(){return{canvas:null,_width:100,_height:100,devicePixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1,clearColor:[0,0,0,0],clearBit:17664,alpha:!0,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!1,throwError:!0,gl:null,viewport:{},maxJointNumber:20,__currentFrameBuffer:null,_viewportStack:[],_clearStack:[],_sceneRendering:null}}),(function(){this.canvas||(this.canvas=U.createCanvas());var e=this.canvas;try{var t={alpha:this.alpha,depth:this.depth,stencil:this.stencil,antialias:this.antialias,premultipliedAlpha:this.premultipliedAlpha,preserveDrawingBuffer:this.preserveDrawingBuffer};if(this.gl=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!this.gl)throw new Error;this._glinfo=new v(this.gl),this.gl.targetRenderer&&console.error("Already created a renderer"),this.gl.targetRenderer=this,this.resize()}catch(e){throw"Error creating WebGL Context "+e}this._programMgr=new Ee(this),this._placeholderTexture=new st(this)}),{resize:function(e,t){var r=this.canvas,i=this.devicePixelRatio;null!=e?(r.style&&(r.style.width=e+"px",r.style.height=t+"px"),r.width=e*i,r.height=t*i,this._width=e,this._height=t):(this._width=r.width/i,this._height=r.height/i),this.setViewport(0,0,this._width,this._height)},getWidth:function(){return this._width},getHeight:function(){return this._height},getViewportAspect:function(){var e=this.viewport;return e.width/e.height},setDevicePixelRatio:function(e){this.devicePixelRatio=e,this.resize(this._width,this._height)},getDevicePixelRatio:function(){return this.devicePixelRatio},getGLExtension:function(e){return this._glinfo.getExtension(e)},getGLParameter:function(e){return this._glinfo.getParameter(e)},setViewport:function(e,t,r,i,n){if("object"==typeof e){var a=e;e=a.x,t=a.y,r=a.width,i=a.height,n=a.devicePixelRatio}n=n||this.devicePixelRatio,this.gl.viewport(e*n,t*n,r*n,i*n),this.viewport={x:e,y:t,width:r,height:i,devicePixelRatio:n}},saveViewport:function(){this._viewportStack.push(this.viewport)},restoreViewport:function(){this._viewportStack.length>0&&this.setViewport(this._viewportStack.pop())},saveClear:function(){this._clearStack.push({clearBit:this.clearBit,clearColor:this.clearColor})},restoreClear:function(){if(this._clearStack.length>0){var e=this._clearStack.pop();this.clearColor=e.clearColor,this.clearBit=e.clearBit}},bindSceneRendering:function(e){this._sceneRendering=e},render:function(e,t,r,i){var n=this.gl,a=this.clearColor;if(this.clearBit){n.colorMask(!0,!0,!0,!0),n.depthMask(!0);var o=this.viewport,s=!1,l=o.devicePixelRatio;(o.width!==this._width||o.height!==this._height||l&&l!==this.devicePixelRatio||o.x||o.y)&&(s=!0,n.enable(n.SCISSOR_TEST),n.scissor(o.x*l,o.y*l,o.width*l,o.height*l)),n.clearColor(a[0],a[1],a[2],a[3]),n.clear(this.clearBit),s&&n.disable(n.SCISSOR_TEST)}if(r||e.update(!1),e.updateLights(),t=t||e.getMainCamera()){t.update();var h=e.updateRenderList(t,!0);this._sceneRendering=e;var u=h.opaque,c=h.transparent,d=e.material;e.trigger("beforerender",this,e,t,h),i?(this.renderPreZ(u,e,t),n.depthFunc(n.LEQUAL)):n.depthFunc(n.LESS);for(var f=Je(),p=Qe.create(),m=0;m0){var s=e[n-1],l=s.joints?s.joints.length:0;if((a.joints?a.joints.length:0)===l&&a.material===s.material&&a.lightGroup===s.lightGroup){a.__program=s.__program;continue}}var h=this._programMgr.getProgram(a,o,t);this.validateProgram(h),a.__program=h}},renderPass:function(e,t,r){this.trigger("beforerenderpass",this,e,t,r),(r=r||{}).getMaterial=r.getMaterial||et,r.getUniform=r.getUniform||tt,r.isMaterialChanged=r.isMaterialChanged||rt,r.beforeRender=r.beforeRender||nt,r.afterRender=r.afterRender||nt;var i=r.ifRender||it;this.updatePrograms(e,this._sceneRendering,r),r.sortCompare&&e.sort(r.sortCompare);var n=this.viewport,a=n.devicePixelRatio,o=[n.x*a,n.y*a,n.width*a,n.height*a],s=this.devicePixelRatio,l=this.__currentFrameBuffer?[this.__currentFrameBuffer.getTextureWidth(),this.__currentFrameBuffer.getTextureHeight()]:[this._width*s,this._height*s],h=[o[2],o[3]],u=Date.now();t?(Ye.copy(ht.VIEW,t.viewMatrix.array),Ye.copy(ht.PROJECTION,t.projectionMatrix.array),Ye.copy(ht.VIEWINVERSE,t.worldTransform.array)):(Ye.identity(ht.VIEW),Ye.identity(ht.PROJECTION),Ye.identity(ht.VIEWINVERSE)),Ye.multiply(ht.VIEWPROJECTION,ht.PROJECTION,ht.VIEW),Ye.invert(ht.PROJECTIONINVERSE,ht.PROJECTION),Ye.invert(ht.VIEWPROJECTIONINVERSE,ht.VIEWPROJECTION);for(var c,d,f,p,m,g,_,v,y,x,b,w,T=this.gl,S=this._sceneRendering,M=0;Mthis.getMaxJointNumber()){var a=n.getSubSkinMatricesTexture(e.__uid__,e.joints);t.useTextureSlot(this,a,r),t.setUniform(i,"1i","skinMatricesTexture",r),t.setUniform(i,"1f","skinMatricesTextureSize",a.width)}else{var o=n.getSubSkinMatrices(e.__uid__,e.joints);t.setUniformOfSemantic(i,"SKIN_MATRIX",o)}},_renderObject:function(e,t,r){var i=this.gl,n=e.geometry,a=e.mode;null==a&&(a=4);var o=null,s=e.isInstancedMesh&&e.isInstancedMesh();if(!s||(o=this.getGLExtension("ANGLE_instanced_arrays"))){var l;if(s&&(l=this._bindInstancedAttributes(e,r,o)),t.indicesBuffer){var h=this.getGLExtension("OES_element_index_uint")&&n.indices instanceof Uint32Array?i.UNSIGNED_INT:i.UNSIGNED_SHORT;s?o.drawElementsInstancedANGLE(a,t.indicesBuffer.count,h,0,e.getInstanceCount()):i.drawElements(a,t.indicesBuffer.count,h,0)}else s?o.drawArraysInstancedANGLE(a,0,n.vertexCount,e.getInstanceCount()):i.drawArrays(a,0,n.vertexCount);if(s)for(var u=0;ur?r:e}ct.add=function(e,t,r){return Qe.add(e.array,t.array,r.array),e._dirty=!0,e},ct.set=function(e,t,r,i){Qe.set(e.array,t,r,i),e._dirty=!0},ct.copy=function(e,t){return Qe.copy(e.array,t.array),e._dirty=!0,e},ct.cross=function(e,t,r){return Qe.cross(e.array,t.array,r.array),e._dirty=!0,e},ct.distance=ct.dist=function(e,t){return Qe.distance(e.array,t.array)},ct.divide=ct.div=function(e,t,r){return Qe.divide(e.array,t.array,r.array),e._dirty=!0,e},ct.dot=function(e,t){return Qe.dot(e.array,t.array)},ct.len=function(e){return Qe.length(e.array)},ct.lerp=function(e,t,r,i){return Qe.lerp(e.array,t.array,r.array,i),e._dirty=!0,e},ct.min=function(e,t,r){return Qe.min(e.array,t.array,r.array),e._dirty=!0,e},ct.max=function(e,t,r){return Qe.max(e.array,t.array,r.array),e._dirty=!0,e},ct.multiply=ct.mul=function(e,t,r){return Qe.multiply(e.array,t.array,r.array),e._dirty=!0,e},ct.negate=function(e,t){return Qe.negate(e.array,t.array),e._dirty=!0,e},ct.normalize=function(e,t){return Qe.normalize(e.array,t.array),e._dirty=!0,e},ct.random=function(e,t){return Qe.random(e.array,t),e._dirty=!0,e},ct.scale=function(e,t,r){return Qe.scale(e.array,t.array,r),e._dirty=!0,e},ct.scaleAndAdd=function(e,t,r,i){return Qe.scaleAndAdd(e.array,t.array,r.array,i),e._dirty=!0,e},ct.squaredDistance=ct.sqrDist=function(e,t){return Qe.sqrDist(e.array,t.array)},ct.squaredLength=ct.sqrLen=function(e){return Qe.sqrLen(e.array)},ct.subtract=ct.sub=function(e,t,r){return Qe.subtract(e.array,t.array,r.array),e._dirty=!0,e},ct.transformMat3=function(e,t,r){return Qe.transformMat3(e.array,t.array,r.array),e._dirty=!0,e},ct.transformMat4=function(e,t,r){return Qe.transformMat4(e.array,t.array,r.array),e._dirty=!0,e},ct.transformQuat=function(e,t,r){return Qe.transformQuat(e.array,t.array,r.array),e._dirty=!0,e};var mt=Math.atan2,gt=Math.asin,_t=Math.abs;ct.eulerFromQuat=function(e,t,r){e._dirty=!0,t=t.array;var i=e.array,n=t[0],a=t[1],o=t[2],s=t[3],l=n*n,h=a*a,u=o*o,c=s*s;switch(r=(r||"XYZ").toUpperCase()){case"XYZ":i[0]=mt(2*(n*s-a*o),c-l-h+u),i[1]=gt(pt(2*(n*o+a*s),-1,1)),i[2]=mt(2*(o*s-n*a),c+l-h-u);break;case"YXZ":i[0]=gt(pt(2*(n*s-a*o),-1,1)),i[1]=mt(2*(n*o+a*s),c-l-h+u),i[2]=mt(2*(n*a+o*s),c-l+h-u);break;case"ZXY":i[0]=gt(pt(2*(n*s+a*o),-1,1)),i[1]=mt(2*(a*s-o*n),c-l-h+u),i[2]=mt(2*(o*s-n*a),c-l+h-u);break;case"ZYX":i[0]=mt(2*(n*s+o*a),c-l-h+u),i[1]=gt(pt(2*(a*s-n*o),-1,1)),i[2]=mt(2*(n*a+o*s),c+l-h-u);break;case"YZX":i[0]=mt(2*(n*s-o*a),c-l+h-u),i[1]=mt(2*(a*s-n*o),c+l-h-u),i[2]=gt(pt(2*(n*a+o*s),-1,1));break;case"XZY":i[0]=mt(2*(n*s+a*o),c-l+h-u),i[1]=mt(2*(n*o+a*s),c+l-h-u),i[2]=gt(pt(2*(o*s-n*a),-1,1));break;default:console.warn("Unkown order: "+r)}return e},ct.eulerFromMat3=function(e,t,r){var i=t.array,n=i[0],a=i[3],o=i[6],s=i[1],l=i[4],h=i[7],u=i[2],c=i[5],d=i[8],f=e.array;switch(r=(r||"XYZ").toUpperCase()){case"XYZ":f[1]=gt(pt(o,-1,1)),_t(o)<.99999?(f[0]=mt(-h,d),f[2]=mt(-a,n)):(f[0]=mt(c,l),f[2]=0);break;case"YXZ":f[0]=gt(-pt(h,-1,1)),_t(h)<.99999?(f[1]=mt(o,d),f[2]=mt(s,l)):(f[1]=mt(-u,n),f[2]=0);break;case"ZXY":f[0]=gt(pt(c,-1,1)),_t(c)<.99999?(f[1]=mt(-u,d),f[2]=mt(-a,l)):(f[1]=0,f[2]=mt(s,n));break;case"ZYX":f[1]=gt(-pt(u,-1,1)),_t(u)<.99999?(f[0]=mt(c,d),f[2]=mt(s,n)):(f[0]=0,f[2]=mt(-a,l));break;case"YZX":f[2]=gt(pt(s,-1,1)),_t(s)<.99999?(f[0]=mt(-h,l),f[1]=mt(-u,n)):(f[0]=0,f[1]=mt(o,d));break;case"XZY":f[2]=gt(-pt(a,-1,1)),_t(a)<.99999?(f[0]=mt(c,l),f[1]=mt(o,n)):(f[0]=mt(-h,d),f[1]=0);break;default:console.warn("Unkown order: "+r)}return e._dirty=!0,e},Object.defineProperties(ct,{POSITIVE_X:{get:function(){return new ct(1,0,0)}},NEGATIVE_X:{get:function(){return new ct(-1,0,0)}},POSITIVE_Y:{get:function(){return new ct(0,1,0)}},NEGATIVE_Y:{get:function(){return new ct(0,-1,0)}},POSITIVE_Z:{get:function(){return new ct(0,0,1)}},NEGATIVE_Z:{get:function(){return new ct(0,0,-1)}},UP:{get:function(){return new ct(0,1,0)}},ZERO:{get:function(){return new ct}}});const vt=ct;var yt,xt,bt,wt,Tt,St=function(e,t){this.origin=e||new vt,this.direction=t||new vt};St.prototype={constructor:St,intersectPlane:function(e,t){var r=e.normal.array,i=e.distance,n=this.origin.array,a=this.direction.array,o=Qe.dot(r,a);if(0===o)return null;t||(t=new vt);var s=(Qe.dot(r,n)-i)/o;return Qe.scaleAndAdd(t.array,n,a,-s),t._dirty=!0,t},mirrorAgainstPlane:function(e){var t=Qe.dot(e.normal.array,this.direction.array);Qe.scaleAndAdd(this.direction.array,this.direction.array,e.normal.array,2*-t),this.direction._dirty=!0},distanceToPoint:(Tt=Qe.create(),function(e){Qe.sub(Tt,e,this.origin.array);var t=Qe.dot(Tt,this.direction.array);if(t<0)return Qe.distance(this.origin.array,e);var r=Qe.lenSquared(Tt);return Math.sqrt(r-t*t)}),intersectSphere:function(){var e=Qe.create();return function(t,r,i){var n=this.origin.array,a=this.direction.array;t=t.array,Qe.sub(e,t,n);var o=Qe.dot(e,a),s=Qe.squaredLength(e)-o*o,l=r*r;if(!(s>l)){var h=Math.sqrt(l-s),u=o-h,c=o+h;return i||(i=new vt),u<0?c<0?null:(Qe.scaleAndAdd(i.array,n,a,c),i):(Qe.scaleAndAdd(i.array,n,a,u),i)}}}(),intersectBoundingBox:function(e,t){var r,i,n,a,o,s,l=this.direction.array,h=this.origin.array,u=e.min.array,c=e.max.array,d=1/l[0],f=1/l[1],p=1/l[2];if(d>=0?(r=(u[0]-h[0])*d,i=(c[0]-h[0])*d):(i=(u[0]-h[0])*d,r=(c[0]-h[0])*d),f>=0?(n=(u[1]-h[1])*f,a=(c[1]-h[1])*f):(a=(u[1]-h[1])*f,n=(c[1]-h[1])*f),r>a||n>i)return null;if((n>r||r!=r)&&(r=n),(a=0?(o=(u[2]-h[2])*p,s=(c[2]-h[2])*p):(s=(u[2]-h[2])*p,o=(c[2]-h[2])*p),r>s||o>i)return null;if((o>r||r!=r)&&(r=o),(s=0?r:i;return t||(t=new vt),Qe.scaleAndAdd(t.array,h,l,m),t},intersectTriangle:(yt=Qe.create(),xt=Qe.create(),bt=Qe.create(),wt=Qe.create(),function(e,t,r,i,n,a){var o=this.direction.array,s=this.origin.array;e=e.array,t=t.array,r=r.array,Qe.sub(yt,t,e),Qe.sub(xt,r,e),Qe.cross(wt,xt,o);var l=Qe.dot(yt,wt);if(i){if(l>-1e-5)return null}else if(l>-1e-5&&l<1e-5)return null;Qe.sub(bt,s,e);var h=Qe.dot(wt,bt)/l;if(h<0||h>1)return null;Qe.cross(wt,yt,bt);var u=Qe.dot(o,wt)/l;if(u<0||u>1||h+u>1)return null;Qe.cross(wt,yt,xt);var c=-Qe.dot(bt,wt)/l;return c<0?null:(n||(n=new vt),a&&vt.set(a,1-h-u,h,u),Qe.scaleAndAdd(n.array,s,o,c),n)}),applyTransform:function(e){vt.add(this.direction,this.direction,this.origin),vt.transformMat4(this.origin,this.origin,e),vt.transformMat4(this.direction,this.direction,e),vt.sub(this.direction,this.direction,this.origin),vt.normalize(this.direction,this.direction)},copy:function(e){vt.copy(this.origin,e.origin),vt.copy(this.direction,e.direction)},clone:function(){var e=new St;return e.copy(this),e}};const Mt=St;var At={create:function(){var e=new ce(4);return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e},clone:function(e){var t=new ce(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},fromValues:function(e,t,r,i){var n=new ce(4);return n[0]=e,n[1]=t,n[2]=r,n[3]=i,n},copy:function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},set:function(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e},add:function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},subtract:function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}};At.sub=At.subtract,At.multiply=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e},At.mul=At.multiply,At.divide=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e},At.div=At.divide,At.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e},At.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e},At.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e},At.scaleAndAdd=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e},At.distance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(r*r+i*i+n*n+a*a)},At.dist=At.distance,At.squaredDistance=function(e,t){var r=t[0]-e[0],i=t[1]-e[1],n=t[2]-e[2],a=t[3]-e[3];return r*r+i*i+n*n+a*a},At.sqrDist=At.squaredDistance,At.length=function(e){var t=e[0],r=e[1],i=e[2],n=e[3];return Math.sqrt(t*t+r*r+i*i+n*n)},At.len=At.length,At.squaredLength=function(e){var t=e[0],r=e[1],i=e[2],n=e[3];return t*t+r*r+i*i+n*n},At.sqrLen=At.squaredLength,At.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e},At.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},At.normalize=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e[3]=t[3]*o),e},At.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},At.lerp=function(e,t,r,i){var n=t[0],a=t[1],o=t[2],s=t[3];return e[0]=n+i*(r[0]-n),e[1]=a+i*(r[1]-a),e[2]=o+i*(r[2]-o),e[3]=s+i*(r[3]-s),e},At.random=function(e,t){return t=t||1,e[0]=de(),e[1]=de(),e[2]=de(),e[3]=de(),At.normalize(e,e),At.scale(e,e,t),e},At.transformMat4=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3];return e[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*o,e[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*o,e[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*o,e[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*o,e},At.transformQuat=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=r[0],s=r[1],l=r[2],h=r[3],u=h*i+s*a-l*n,c=h*n+l*i-o*a,d=h*a+o*n-s*i,f=-o*i-s*n-l*a;return e[0]=u*h+f*-o+c*-l-d*-s,e[1]=c*h+f*-s+d*-o-u*-l,e[2]=d*h+f*-l+u*-s-c*-o,e},At.forEach=function(){var e=At.create();return function(t,r,i,n,a,o){var s,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,t.length):t.length,s=i;s.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(Qe.cross(Lt,t,r),e[0]=Lt[0],e[1]=Lt[1],e[2]=Lt[2],e[3]=1+i,It.normalize(e,e))}),It.setAxes=(Nt=Dt.create(),function(e,t,r,i){return Nt[0]=r[0],Nt[3]=r[1],Nt[6]=r[2],Nt[1]=i[0],Nt[4]=i[1],Nt[7]=i[2],Nt[2]=-t[0],Nt[5]=-t[1],Nt[8]=-t[2],It.normalize(e,It.fromMat3(e,Nt))}),It.clone=Et.clone,It.fromValues=Et.fromValues,It.copy=Et.copy,It.set=Et.set,It.identity=function(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e},It.setAxisAngle=function(e,t,r){r*=.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e},It.add=Et.add,It.multiply=function(e,t,r){var i=t[0],n=t[1],a=t[2],o=t[3],s=r[0],l=r[1],h=r[2],u=r[3];return e[0]=i*u+o*s+n*h-a*l,e[1]=n*u+o*l+a*s-i*h,e[2]=a*u+o*h+i*l-n*s,e[3]=o*u-i*s-n*l-a*h,e},It.mul=It.multiply,It.scale=Et.scale,It.rotateX=function(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+o*s,e[1]=n*l+a*s,e[2]=a*l-n*s,e[3]=o*l-i*s,e},It.rotateY=function(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l-a*s,e[1]=n*l+o*s,e[2]=a*l+i*s,e[3]=o*l-n*s,e},It.rotateZ=function(e,t,r){r*=.5;var i=t[0],n=t[1],a=t[2],o=t[3],s=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*s,e[1]=n*l-i*s,e[2]=a*l+o*s,e[3]=o*l-a*s,e},It.calculateW=function(e,t){var r=t[0],i=t[1],n=t[2];return e[0]=r,e[1]=i,e[2]=n,e[3]=Math.sqrt(Math.abs(1-r*r-i*i-n*n)),e},It.dot=Et.dot,It.lerp=Et.lerp,It.slerp=function(e,t,r,i){var n,a,o,s,l,h=t[0],u=t[1],c=t[2],d=t[3],f=r[0],p=r[1],m=r[2],g=r[3];return(a=h*f+u*p+c*m+d*g)<0&&(a=-a,f=-f,p=-p,m=-m,g=-g),1-a>1e-6?(n=Math.acos(a),o=Math.sin(n),s=Math.sin((1-i)*n)/o,l=Math.sin(i*n)/o):(s=1-i,l=i),e[0]=s*h+l*f,e[1]=s*u+l*p,e[2]=s*c+l*m,e[3]=s*d+l*g,e},It.invert=function(e,t){var r=t[0],i=t[1],n=t[2],a=t[3],o=r*r+i*i+n*n+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-i*s,e[2]=-n*s,e[3]=a*s,e},It.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},It.length=Et.length,It.len=It.length,It.squaredLength=Et.squaredLength,It.sqrLen=It.squaredLength,It.normalize=Et.normalize,It.fromMat3=function(e,t){var r,i=t[0]+t[4]+t[8];if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var n=0;t[4]>t[0]&&(n=1),t[8]>t[3*n+n]&&(n=2);var a=(n+1)%3,o=(n+2)%3;r=Math.sqrt(t[3*n+n]-t[3*a+a]-t[3*o+o]+1),e[n]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+n]+t[3*n+a])*r,e[o]=(t[3*o+n]+t[3*n+o])*r}return e};const Rt=It;var Bt,Ft,zt,Gt,Ut=function(){this._axisX=new vt,this._axisY=new vt,this._axisZ=new vt,this.array=Ye.create(),this._dirty=!0};Ut.prototype={constructor:Ut,setArray:function(e){for(var t=0;t0){var t=this.min,r=this.max,i=t.array,n=r.array;tr(i,e[0]),tr(n,e[0]);for(var a=1;an[0]&&(n[0]=o[0]),o[1]>n[1]&&(n[1]=o[1]),o[2]>n[2]&&(n[2]=o[2])}t._dirty=!0,r._dirty=!0}},union:function(e){var t=this.min,r=this.max;return Qe.min(t.array,t.array,e.min.array),Qe.max(r.array,r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},intersection:function(e){var t=this.min,r=this.max;return Qe.max(t.array,t.array,e.min.array),Qe.min(r.array,r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},intersectBoundingBox:function(e){var t=this.min.array,r=this.max.array,i=e.min.array,n=e.max.array;return!(t[0]>n[0]||t[1]>n[1]||t[2]>n[2]||r[0]=n[0]&&r[1]>=n[1]&&r[2]>=n[2]},containPoint:function(e){var t=this.min.array,r=this.max.array,i=e.array;return t[0]<=i[0]&&t[1]<=i[1]&&t[2]<=i[2]&&r[0]>=i[0]&&r[1]>=i[1]&&r[2]>=i[2]},isFinite:function(){var e=this.min.array,t=this.max.array;return isFinite(e[0])&&isFinite(e[1])&&isFinite(e[2])&&isFinite(t[0])&&isFinite(t[1])&&isFinite(t[2])},applyTransform:function(e){this.transformFrom(this,e)},transformFrom:(Zt=Qe.create(),Yt=Qe.create(),Kt=Qe.create(),Qt=Qe.create(),Jt=Qe.create(),$t=Qe.create(),function(e,t){var r=e.min.array,i=e.max.array,n=t.array;return Zt[0]=n[0]*r[0],Zt[1]=n[1]*r[0],Zt[2]=n[2]*r[0],Yt[0]=n[0]*i[0],Yt[1]=n[1]*i[0],Yt[2]=n[2]*i[0],Kt[0]=n[4]*r[1],Kt[1]=n[5]*r[1],Kt[2]=n[6]*r[1],Qt[0]=n[4]*i[1],Qt[1]=n[5]*i[1],Qt[2]=n[6]*i[1],Jt[0]=n[8]*r[2],Jt[1]=n[9]*r[2],Jt[2]=n[10]*r[2],$t[0]=n[8]*i[2],$t[1]=n[9]*i[2],$t[2]=n[10]*i[2],r=this.min.array,i=this.max.array,r[0]=Math.min(Zt[0],Yt[0])+Math.min(Kt[0],Qt[0])+Math.min(Jt[0],$t[0])+n[12],r[1]=Math.min(Zt[1],Yt[1])+Math.min(Kt[1],Qt[1])+Math.min(Jt[1],$t[1])+n[13],r[2]=Math.min(Zt[2],Yt[2])+Math.min(Kt[2],Qt[2])+Math.min(Jt[2],$t[2])+n[14],i[0]=Math.max(Zt[0],Yt[0])+Math.max(Kt[0],Qt[0])+Math.max(Jt[0],$t[0])+n[12],i[1]=Math.max(Zt[1],Yt[1])+Math.max(Kt[1],Qt[1])+Math.max(Jt[1],$t[1])+n[13],i[2]=Math.max(Zt[2],Yt[2])+Math.max(Kt[2],Qt[2])+Math.max(Jt[2],$t[2])+n[14],this.min._dirty=!0,this.max._dirty=!0,this}),applyProjection:function(e){var t=this.min.array,r=this.max.array,i=e.array,n=t[0],a=t[1],o=t[2],s=r[0],l=r[1],h=t[2],u=r[0],c=r[1],d=r[2];if(1===i[15])t[0]=i[0]*n+i[12],t[1]=i[5]*a+i[13],r[2]=i[10]*o+i[14],r[0]=i[0]*u+i[12],r[1]=i[5]*c+i[13],t[2]=i[10]*d+i[14];else{var f=-1/o;t[0]=i[0]*n*f,t[1]=i[5]*a*f,r[2]=(i[10]*o+i[14])*f,f=-1/h,r[0]=i[0]*s*f,r[1]=i[5]*l*f,f=-1/d,t[2]=(i[10]*d+i[14])*f}return this.min._dirty=!0,this.max._dirty=!0,this},updateVertices:function(){var e=this.vertices;if(!e){e=[];for(var t=0;t<8;t++)e[t]=Qe.fromValues(0,0,0);this.vertices=e}var r=this.min.array,i=this.max.array;return er(e[0],r[0],r[1],r[2]),er(e[1],r[0],i[1],r[2]),er(e[2],i[0],r[1],r[2]),er(e[3],i[0],i[1],r[2]),er(e[4],r[0],r[1],i[2]),er(e[5],r[0],i[1],i[2]),er(e[6],i[0],r[1],i[2]),er(e[7],i[0],i[1],i[2]),this},copy:function(e){var t=this.min,r=this.max;return tr(t.array,e.min.array),tr(r.array,e.max.array),t._dirty=!0,r._dirty=!0,this},clone:function(){var e=new rr;return e.copy(this),e}};const ir=rr;var nr,ar,or=0;const sr=m.extend({name:"",position:null,rotation:null,scale:null,worldTransform:null,localTransform:null,autoUpdateLocalTransform:!0,_parent:null,_scene:null,_needsUpdateWorldTransform:!0,_inIterating:!1,__depth:0},(function(){this.name||(this.name=(this.type||"NODE")+"_"+or++),this.position||(this.position=new vt),this.rotation||(this.rotation=new qt),this.scale||(this.scale=new vt(1,1,1)),this.worldTransform=new Ht,this.localTransform=new Ht,this._children=[]}),{target:null,invisible:!1,isSkinnedMesh:function(){return!1},isRenderable:function(){return!1},setName:function(e){var t=this._scene;if(t){var r=t._nodeRepository;delete r[this.name],r[e]=this}this.name=e},add:function(e){var t=e._parent;if(t!==this){t&&t.remove(e),e._parent=this,this._children.push(e);var r=this._scene;r&&r!==e.scene&&e.traverse(this._addSelfToScene,this),e._needsUpdateWorldTransform=!0}},remove:function(e){var t=this._children,r=t.indexOf(e);r<0||(t.splice(r,1),e._parent=null,this._scene&&e.traverse(this._removeSelfFromScene,this))},removeAll:function(){for(var e=this._children,t=0;t0},beforeRender:function(e){},afterRender:function(e,t){},getBoundingBox:function(e,t){return t=sr.prototype.getBoundingBox.call(this,e,t),this.geometry&&this.geometry.boundingBox&&t.union(this.geometry.boundingBox),t},clone:(lr=["castShadow","receiveShadow","mode","culling","cullFace","frontFace","frustumCulling","renderOrder","lineWidth","ignorePicking","ignorePreZ","ignoreGBuffer"],function(){var e=sr.prototype.clone.call(this);e.geometry=this.geometry,e.material=this.material;for(var t=0;t=0&&g[p]>1e-4&&(Qe.transformMat4(T,m,d[_[p]]),Qe.scaleAndAdd(v,v,T,g[p]));S.set(f,v)}}for(f=0;f>t;return e+1},dispose:function(e){var t=this._cache;t.use(e.__uid__);var r=t.get("webgl_texture");r&&e.gl.deleteTexture(r),t.deleteContext(e.__uid__)},isRenderable:function(){},isPowerOfTwo:function(){}});Object.defineProperty(br.prototype,"width",{get:function(){return this._width},set:function(e){this._width=e}}),Object.defineProperty(br.prototype,"height",{get:function(){return this._height},set:function(e){this._height=e}}),br.BYTE=5120,br.UNSIGNED_BYTE=T,br.SHORT=5122,br.UNSIGNED_SHORT=5123,br.INT=5124,br.UNSIGNED_INT=5125,br.FLOAT=S,br.HALF_FLOAT=36193,br.UNSIGNED_INT_24_8_WEBGL=34042,br.DEPTH_COMPONENT=M,br.DEPTH_STENCIL=34041,br.ALPHA=6406,br.RGB=6407,br.RGBA=A,br.LUMINANCE=6409,br.LUMINANCE_ALPHA=6410,br.SRGB=35904,br.SRGB_ALPHA=35906,br.COMPRESSED_RGB_S3TC_DXT1_EXT=33776,br.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777,br.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778,br.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779,br.NEAREST=E,br.LINEAR=C,br.NEAREST_MIPMAP_NEAREST=D,br.LINEAR_MIPMAP_NEAREST=L,br.NEAREST_MIPMAP_LINEAR=P,br.LINEAR_MIPMAP_LINEAR=O,br.REPEAT=N,br.CLAMP_TO_EDGE=I,br.MIRRORED_REPEAT=33648;const wr=br;var Tr=ur.extend({skeleton:null,joints:null},(function(){this.joints||(this.joints=[])}),{offsetMatrix:null,isInstancedMesh:function(){return!1},isSkinnedMesh:function(){return!!(this.skeleton&&this.joints&&this.joints.length>0)},clone:function(){var e=ur.prototype.clone.call(this);return e.skeleton=this.skeleton,this.joints&&(e.joints=this.joints.slice()),e}});Tr.POINTS=0,Tr.LINES=1,Tr.LINE_LOOP=2,Tr.LINE_STRIP=3,Tr.TRIANGLES=4,Tr.TRIANGLE_STRIP=5,Tr.TRIANGLE_FAN=6,Tr.BACK=x,Tr.FRONT=y,Tr.FRONT_AND_BACK=1032,Tr.CW=b,Tr.CCW=w;const Sr=Tr;const Mr={isPowerOfTwo:function(e){return 0==(e&e-1)},nextPowerOfTwo:function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},nearestPowerOfTwo:function(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}};var Ar=Mr.isPowerOfTwo;function Er(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}var Cr=wr.extend((function(){return{image:null,pixels:null,mipmaps:[],convertToPOT:!1}}),{textureType:"texture2D",update:function(e){var t=e.gl;t.bindTexture(t.TEXTURE_2D,this._cache.get("webgl_texture")),this.updateCommon(e);var r=this.format,i=this.type,n=!(!this.convertToPOT||this.mipmaps.length||!this.image||this.wrapS!==wr.REPEAT&&this.wrapT!==wr.REPEAT||!this.NPOT);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,n?this.wrapS:this.getAvailableWrapS()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,n?this.wrapT:this.getAvailableWrapT()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n?this.magFilter:this.getAvailableMagFilter()),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n?this.minFilter:this.getAvailableMinFilter());var a=e.getGLExtension("EXT_texture_filter_anisotropic");if(a&&this.anisotropic>1&&t.texParameterf(t.TEXTURE_2D,a.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i&&(e.getGLExtension("OES_texture_half_float")||(i=S)),this.mipmaps.length)for(var o=this.width,s=this.height,l=0;l=wr.COMPRESSED_RGB_S3TC_DXT1_EXT?e.compressedTexImage2D(e.TEXTURE_2D,r,a,i,n,0,t.pixels):e.texImage2D(e.TEXTURE_2D,r,a,i,n,0,a,o,t.pixels)},generateMipmap:function(e){var t=e.gl;this.useMipmap&&!this.NPOT&&(t.bindTexture(t.TEXTURE_2D,this._cache.get("webgl_texture")),t.generateMipmap(t.TEXTURE_2D))},isPowerOfTwo:function(){return Ar(this.width)&&Ar(this.height)},isRenderable:function(){return this.image?this.image.width>0&&this.image.height>0:!(!this.width||!this.height)},bind:function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,this.getWebGLTexture(e))},unbind:function(e){e.gl.bindTexture(e.gl.TEXTURE_2D,null)},load:function(e,t){var r=U.createImage();t&&(r.crossOrigin=t);var i=this;return r.onload=function(){i.dirty(),i.trigger("success",i)},r.onerror=function(){i.trigger("error",i)},r.src=e,this.image=r,this}});Object.defineProperty(Cr.prototype,"width",{get:function(){return this.image?this.image.width:this._width},set:function(e){this.image?console.warn("Texture from image can't set width"):(this._width!==e&&this.dirty(),this._width=e)}}),Object.defineProperty(Cr.prototype,"height",{get:function(){return this.image?this.image.height:this._height},set:function(e){this.image?console.warn("Texture from image can't set height"):(this._height!==e&&this.dirty(),this._height=e)}});const Dr=Cr;function Lr(e){return{byte:U.Int8Array,ubyte:U.Uint8Array,short:U.Int16Array,ushort:U.Uint16Array}[e]||U.Float32Array}function Pr(e){return"attr_"+e}function Or(e,t,r,i){switch(this.name=e,this.type=t,this.size=r,this.semantic=i||"",this.value=null,r){case 1:this.get=function(e){return this.value[e]},this.set=function(e,t){this.value[e]=t},this.copy=function(e,t){this.value[e]=this.value[e]};break;case 2:this.get=function(e,t){var r=this.value;return t[0]=r[2*e],t[1]=r[2*e+1],t},this.set=function(e,t){var r=this.value;r[2*e]=t[0],r[2*e+1]=t[1]},this.copy=function(e,t){var r=this.value;t*=2,r[e*=2]=r[t],r[e+1]=r[t+1]};break;case 3:this.get=function(e,t){var r=3*e,i=this.value;return t[0]=i[r],t[1]=i[r+1],t[2]=i[r+2],t},this.set=function(e,t){var r=3*e,i=this.value;i[r]=t[0],i[r+1]=t[1],i[r+2]=t[2]},this.copy=function(e,t){var r=this.value;t*=3,r[e*=3]=r[t],r[e+1]=r[t+1],r[e+2]=r[t+2]};break;case 4:this.get=function(e,t){var r=this.value,i=4*e;return t[0]=r[i],t[1]=r[i+1],t[2]=r[i+2],t[3]=r[i+3],t},this.set=function(e,t){var r=this.value,i=4*e;r[i]=t[0],r[i+1]=t[1],r[i+2]=t[2],r[i+3]=t[3]},this.copy=function(e,t){var r=this.value;t*=4,r[e*=4]=r[t],r[e+1]=r[t+1],r[e+2]=r[t+2],r[e+3]=r[t+3]}}}function Nr(e,t,r,i,n){this.name=e,this.type=t,this.buffer=r,this.size=i,this.semantic=n,this.symbol="",this.needsRemove=!1}function Ir(e){this.buffer=e,this.count=0}Or.prototype.init=function(e){if(!this.value||this.value.length!==e*this.size){var t=Lr(this.type);this.value=new t(e*this.size)}},Or.prototype.fromArray=function(e){var t,r=Lr(this.type);if(e[0]&&e[0].length){var i=0,n=this.size;t=new r(e.length*n);for(var a=0;a=0){t||(t=[]);var r=this.indices;return t[0]=r[3*e],t[1]=r[3*e+1],t[2]=r[3*e+2],t}},setTriangleIndices:function(e,t){var r=this.indices;r[3*e]=t[0],r[3*e+1]=t[1],r[3*e+2]=t[2]},isUseIndices:function(){return!!this.indices},initIndicesFromArray:function(e){var t,r=this.vertexCount>65535?U.Uint32Array:U.Uint16Array;if(e[0]&&e[0].length){var i=0;t=new r(3*e.length);for(var n=0;n=0&&(t.splice(r,1),delete this.attributes[e],!0)},getAttribute:function(e){return this.attributes[e]},getEnabledAttributes:function(){var e=this._enabledAttributes,t=this._attributeList;if(e)return e;for(var r=[],i=this.vertexCount,n=0;na[0]&&(a[0]=s),l>a[1]&&(a[1]=l),h>a[2]&&(a[2]=h)}r._dirty=!0,i._dirty=!0}},generateVertexNormals:function(){if(this.vertexCount){var e=this.indices,t=this.attributes,r=t.position.value,i=t.normal.value;if(i&&i.length===r.length)for(var n=0;n65535&&(this.indices=new U.Uint32Array(this.indices));for(var e=this.attributes,t=this.indices,r=this.getEnabledAttributes(),i={},n=0;nthis.distance,n=1;n<8;n++)if(Qe.dot(t[n].array,r)>this.distance!=i)return!0},intersectLine:(Qr=Qe.create(),function(e,t,r){var i=this.distanceToPoint(e),n=this.distanceToPoint(t);if(i>0&&n>0||i<0&&n<0)return null;var a=this.normal.array,o=this.distance,s=e.array;Qe.sub(Qr,t.array,e.array),Qe.normalize(Qr,Qr);var l=Qe.dot(a,Qr);if(0===l)return null;r||(r=new vt);var h=(Qe.dot(a,s)-o)/l;return Qe.scaleAndAdd(r.array,s,Qr,-h),r._dirty=!0,r}),applyTransform:(Zr=Ye.create(),Yr=Et.create(),Kr=Et.create(),Kr[3]=1,function(e){e=e.array,Qe.scale(Kr,this.normal.array,this.distance),Et.transformMat4(Kr,Kr,e),this.distance=Qe.dot(Kr,this.normal.array),Ye.invert(Zr,e),Ye.transpose(Zr,Zr),Yr[3]=0,Qe.copy(Yr,this.normal.array),Et.transformMat4(Yr,Yr,Zr),Qe.copy(this.normal.array,Yr)}),copy:function(e){Qe.copy(this.normal.array,e.normal.array),this.normal._dirty=!0,this.distance=e.distance},clone:function(){var e=new Jr;return e.copy(this),e}};const $r=Jr;var ei,ti=Qe.set,ri=Qe.copy,ii=Qe.transformMat4,ni=Math.min,ai=Math.max,oi=function(){this.planes=[];for(var e=0;e<6;e++)this.planes.push(new $r);for(this.boundingBox=new ir,this.vertices=[],e=0;e<8;e++)this.vertices[e]=Qe.fromValues(0,0,0)};oi.prototype={setFromProjection:function(e){var t=this.planes,r=e.array,i=r[0],n=r[1],a=r[2],o=r[3],s=r[4],l=r[5],h=r[6],u=r[7],c=r[8],d=r[9],f=r[10],p=r[11],m=r[12],g=r[13],_=r[14],v=r[15];ti(t[0].normal.array,o-i,u-s,p-c),t[0].distance=-(v-m),t[0].normalize(),ti(t[1].normal.array,o+i,u+s,p+c),t[1].distance=-(v+m),t[1].normalize(),ti(t[2].normal.array,o+n,u+l,p+d),t[2].distance=-(v+g),t[2].normalize(),ti(t[3].normal.array,o-n,u-l,p-d),t[3].distance=-(v-g),t[3].normalize(),ti(t[4].normal.array,o-a,u-h,p-f),t[4].distance=-(v-_),t[4].normalize(),ti(t[5].normal.array,o+a,u+h,p+f),t[5].distance=-(v+_),t[5].normalize();var y=this.boundingBox,x=this.vertices;if(0===v){var b=l/i,w=-_/(f-1),T=-_/(f+1),S=-T/l,M=-w/l;y.min.set(-S*b,-S,T),y.max.set(S*b,S,w),ti(x[0],-S*b,-S,T),ti(x[1],-S*b,S,T),ti(x[2],S*b,-S,T),ti(x[3],S*b,S,T),ti(x[4],-M*b,-M,w),ti(x[5],-M*b,M,w),ti(x[6],M*b,-M,w),ti(x[7],M*b,M,w)}else{var A=(-1-m)/i,E=(1-m)/i,C=(1-g)/l,D=(-1-g)/l,L=(-1-_)/f,P=(1-_)/f;y.min.set(Math.min(A,E),Math.min(D,C),Math.min(P,L)),y.max.set(Math.max(E,A),Math.max(C,D),Math.max(L,P));var O=y.min.array,N=y.max.array;ti(x[0],O[0],O[1],O[2]),ti(x[1],O[0],N[1],O[2]),ti(x[2],N[0],O[1],O[2]),ti(x[3],N[0],N[1],O[2]),ti(x[4],O[0],O[1],N[2]),ti(x[5],O[0],N[1],N[2]),ti(x[6],N[0],O[1],N[2]),ti(x[7],N[0],N[1],N[2])}},getTransformedBoundingBox:(ei=Qe.create(),function(e,t){var r=this.vertices,i=t.array,n=e.min,a=e.max,o=n.array,s=a.array,l=r[0];ii(ei,l,i),ri(o,ei),ri(s,ei);for(var h=1;h<8;h++)l=r[h],ii(ei,l,i),o[0]=ni(ei[0],o[0]),o[1]=ni(ei[1],o[1]),o[2]=ni(ei[2],o[2]),s[0]=ai(ei[0],s[0]),s[1]=ai(ei[1],s[1]),s[2]=ai(ei[2],s[2]);return n._dirty=!0,a._dirty=!0,e})};const si=oi;var li;const hi=sr.extend((function(){return{projectionMatrix:new Ht,invProjectionMatrix:new Ht,viewMatrix:new Ht,frustum:new si}}),(function(){this.update(!0)}),{update:function(e){sr.prototype.update.call(this,e),Ht.invert(this.viewMatrix,this.worldTransform),this.updateProjectionMatrix(),Ht.invert(this.invProjectionMatrix,this.projectionMatrix),this.frustum.setFromProjection(this.projectionMatrix)},setViewMatrix:function(e){Ht.copy(this.viewMatrix,e),Ht.invert(this.worldTransform,e),this.decomposeWorldTransform()},decomposeProjectionMatrix:function(){},setProjectionMatrix:function(e){Ht.copy(this.projectionMatrix,e),Ht.invert(this.invProjectionMatrix,e),this.decomposeProjectionMatrix()},updateProjectionMatrix:function(){},castRay:(li=Et.create(),function(e,t){var r=void 0!==t?t:new Mt,i=e.array[0],n=e.array[1];return Et.set(li,i,n,-1,1),Et.transformMat4(li,li,this.invProjectionMatrix.array),Et.transformMat4(li,li,this.worldTransform.array),Qe.scale(r.origin.array,li,1/li[3]),Et.set(li,i,n,1,1),Et.transformMat4(li,li,this.invProjectionMatrix.array),Et.transformMat4(li,li,this.worldTransform.array),Qe.scale(li,li,1/li[3]),Qe.sub(r.direction.array,li,r.origin.array),Qe.normalize(r.direction.array,r.direction.array),r.direction._dirty=!0,r.origin._dirty=!0,r})});var ui,ci,di=Ye.create(),fi=Ye.create(),pi={};function mi(e){var t=[],r=Object.keys(e);r.sort();for(var i=0;i0&&console.warn("Found multiple camera in one scene. Use the fist one."),this._cameraList.push(e)):e instanceof qr&&this.lights.push(e),e.name&&(this._nodeRepository[e.name]=e)},removeFromScene:function(e){var t;e instanceof hi?(t=this._cameraList.indexOf(e))>=0&&this._cameraList.splice(t,1):e instanceof qr&&(t=this.lights.indexOf(e))>=0&&this.lights.splice(t,1),e.name&&delete this._nodeRepository[e.name]},getNode:function(e){return this._nodeRepository[e]},setMainCamera:function(e){var t=this._cameraList.indexOf(e);t>=0&&this._cameraList.splice(t,1),this._cameraList.unshift(e)},getMainCamera:function(){return this._cameraList[0]},getLights:function(){return this.lights},updateLights:function(){var e=this.lights;this._previousLightNumber=this._lightNumber;for(var t={},r=0;r0&&this._doUpdateRenderList(o,t,r,i,n)}},isFrustumCulled:(ui=new ir,ci=new Ht,function(e,t,r){var i=e.boundingBox;if(i||(i=e.skeleton&&e.skeleton.boundingBox?e.skeleton.boundingBox:e.geometry.boundingBox),!i)return!1;if(ci.array=r,ui.transformFrom(i,ci),e.castShadow&&this.viewBoundingBoxLastFrame.union(ui),e.frustumCulling){if(!ui.intersectBoundingBox(t.frustum.boundingBox))return!0;ci.array=t.projectionMatrix.array,ui.max.array[2]>0&&ui.min.array[2]<0&&(ui.max.array[2]=-1e-20),ui.applyProjection(ci);var n=ui.min.array,a=ui.max.array;if(a[0]<-1||n[0]>1||a[1]<-1||n[1]>1||a[2]<-1||n[2]>1)return!0}return!1}),_updateLightUniforms:function(){var e=this.lights;e.sort(_i);var t=this._lightUniforms;for(var r in t)for(var i in t[r])t[r][i].value.length=0;for(var n=0;n=this._maxSize&&a>0){var s=r.head;r.remove(s),delete i[s.key],n=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new yi(t),o.key=e,r.insertEntry(o),i[e]=o}return n},e.prototype.get=function(e){var t=this._map[e],r=this._list;if(null!=t)return t!==r.tail&&(r.remove(t),r.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}();var wi=Mr.isPowerOfTwo,Ti=["px","nx","py","ny","pz","nz"],Si=wr.extend((function(){return{image:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},pixels:{px:null,nx:null,py:null,ny:null,pz:null,nz:null},mipmaps:[]}}),{textureType:"textureCube",update:function(e){var t=e.gl;t.bindTexture(t.TEXTURE_CUBE_MAP,this._cache.get("webgl_texture")),this.updateCommon(e);var r=this.format,i=this.type;t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,this.getAvailableWrapS()),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,this.getAvailableWrapT()),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,this.getAvailableMagFilter()),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,this.getAvailableMinFilter());var n=e.getGLExtension("EXT_texture_filter_anisotropic");if(n&&this.anisotropic>1&&t.texParameterf(t.TEXTURE_CUBE_MAP,n.TEXTURE_MAX_ANISOTROPY_EXT,this.anisotropic),36193===i&&(e.getGLExtension("OES_texture_half_float")||(i=S)),this.mipmaps.length)for(var a=this.width,o=this.height,s=0;s0&&e.height>0}Object.defineProperty(Si.prototype,"width",{get:function(){return this.image&&this.image.px?this.image.px.width:this._width},set:function(e){this.image&&this.image.px?console.warn("Texture from image can't set width"):(this._width!==e&&this.dirty(),this._width=e)}}),Object.defineProperty(Si.prototype,"height",{get:function(){return this.image&&this.image.px?this.image.px.height:this._height},set:function(e){this.image&&this.image.px?console.warn("Texture from image can't set height"):(this._height!==e&&this.dirty(),this._height=e)}});const Ai=Si,Ei=hi.extend({fov:50,aspect:1,near:.1,far:2e3},{updateProjectionMatrix:function(){var e=this.fov/180*Math.PI;this.projectionMatrix.perspective(e,this.aspect,this.near,this.far)},decomposeProjectionMatrix:function(){var e=this.projectionMatrix.array,t=2*Math.atan(1/e[5]);this.fov=t/Math.PI*180,this.aspect=e[5]/e[0],this.near=e[14]/(e[10]-1),this.far=e[14]/(e[10]+1)},clone:function(){var e=hi.prototype.clone.call(this);return e.fov=this.fov,e.aspect=this.aspect,e.near=this.near,e.far=this.far,e}});var Ci="framebuffer",Di="renderbuffer",Li="renderbuffer_width",Pi="renderbuffer_height",Oi="renderbuffer_attached",Ni="depthtexture_attached",Ii=36160,Ri=36161,Bi=36096,Fi=m.extend({depthBuffer:!0,viewport:null,_width:0,_height:0,_textures:null,_boundRenderer:null},(function(){this._cache=new xr,this._textures={}}),{getTextureWidth:function(){return this._width},getTextureHeight:function(){return this._height},bind:function(e){if(e.__currentFrameBuffer){if(e.__currentFrameBuffer===this)return;console.warn("Renderer already bound with another framebuffer. Unbind it first")}e.__currentFrameBuffer=this;var t=e.gl;t.bindFramebuffer(Ii,this._getFrameBufferGL(e)),this._boundRenderer=e;var r=this._cache;r.put("viewport",e.viewport);var i,n,a=!1;for(var o in this._textures){a=!0;var s=this._textures[o];s&&(i=s.texture.width,n=s.texture.height,this._doAttach(e,s.texture,o,s.target))}this._width=i,this._height=n,!a&&this.depthBuffer&&console.error("Must attach texture before bind, or renderbuffer may have incorrect width and height."),this.viewport?e.setViewport(this.viewport):e.setViewport(0,0,i,n,1);var l=r.get("attached_textures");if(l)for(var o in l)if(!this._textures[o]){var h=l[o];this._doDetach(t,o,h)}if(!r.get(Ni)&&this.depthBuffer){r.miss(Di)&&r.put(Di,t.createRenderbuffer());var u=r.get(Di);i===r.get(Li)&&n===r.get(Pi)||(t.bindRenderbuffer(Ri,u),t.renderbufferStorage(Ri,t.DEPTH_COMPONENT16,i,n),r.put(Li,i),r.put(Pi,n),t.bindRenderbuffer(Ri,null)),r.get(Oi)||(t.framebufferRenderbuffer(Ii,Bi,Ri,u),r.put(Oi,!0))}},unbind:function(e){e.__currentFrameBuffer=null,e.gl.bindFramebuffer(Ii,null),this._boundRenderer=null,this._cache.use(e.__uid__);var t=this._cache.get("viewport");t&&e.setViewport(t),this.updateMipmap(e)},updateMipmap:function(e){var t=e.gl;for(var r in this._textures){var i=this._textures[r];if(i){var n=i.texture;if(!n.NPOT&&n.useMipmap&&n.minFilter===wr.LINEAR_MIPMAP_LINEAR){var a="textureCube"===n.textureType?34067:3553;t.bindTexture(a,n.getWebGLTexture(e)),t.generateMipmap(a),t.bindTexture(a,null)}}}},checkStatus:function(e){return e.checkFramebufferStatus(Ii)},_getFrameBufferGL:function(e){var t=this._cache;return t.use(e.__uid__),t.miss(Ci)&&t.put(Ci,e.gl.createFramebuffer()),t.get(Ci)},attach:function(e,t,r){if(!e.width)throw new Error("The texture attached to color buffer is not a valid.");t=t||36064,r=r||3553;var i,n=this._boundRenderer;if(n&&n.gl){var a=this._cache;a.use(n.__uid__),i=a.get("attached_textures")}var o=this._textures[t];if(!o||o.target!==r||o.texture!==e||!i||null==i[t]){var s=!0;n&&(s=this._doAttach(n,e,t,r),this.viewport||n.setViewport(0,0,e.width,e.height,1)),s&&(this._textures[t]=this._textures[t]||{},this._textures[t].texture=e,this._textures[t].target=r)}},_doAttach:function(e,t,r,i){var n=e.gl,a=t.getWebGLTexture(e),o=this._cache.get("attached_textures");if(o&&o[r]){var s=o[r];if(s.texture===t&&s.target===i)return}var l=!0;if(((r=+r)===Bi||r===R)&&(e.getGLExtension("WEBGL_depth_texture")||(console.error("Depth texture is not supported by the browser"),l=!1),t.format!==M&&34041!==t.format&&(console.error("The texture attached to depth buffer is not a valid."),l=!1),l)){var h=this._cache.get(Di);h&&(n.framebufferRenderbuffer(Ii,Bi,Ri,null),n.deleteRenderbuffer(h),this._cache.put(Di,!1)),this._cache.put(Oi,!1),this._cache.put(Ni,!0)}return n.framebufferTexture2D(Ii,r,i,a,0),o||(o={},this._cache.put("attached_textures",o)),o[r]=o[r]||{},o[r].texture=t,o[r].target=i,l},_doDetach:function(e,t,r){e.framebufferTexture2D(Ii,t,r,null,0);var i=this._cache.get("attached_textures");i&&i[t]&&(i[t]=null),t!==Bi&&t!==R||this._cache.put(Ni,!1)},detach:function(e,t){this._textures[e]=null,this._boundRenderer&&(this._cache.use(this._boundRenderer.__uid__),this._doDetach(this._boundRenderer.gl,e,t))},dispose:function(e){var t=e.gl,r=this._cache;r.use(e.__uid__);var i=r.get(Di);i&&t.deleteRenderbuffer(i);var n=r.get(Ci);n&&t.deleteFramebuffer(n),r.deleteContext(e.__uid__),this._textures={}}});Fi.DEPTH_ATTACHMENT=Bi,Fi.COLOR_ATTACHMENT0=36064,Fi.STENCIL_ATTACHMENT=36128,Fi.DEPTH_STENCIL_ATTACHMENT=R;const zi=Fi;var Gi=["px","nx","py","ny","pz","nz"];const Ui=m.extend((function(){var e={position:new vt,far:1e3,near:.1,texture:null,shadowMapPass:null},t=e._cameras={px:new Ei({fov:90}),nx:new Ei({fov:90}),py:new Ei({fov:90}),ny:new Ei({fov:90}),pz:new Ei({fov:90}),nz:new Ei({fov:90})};return t.px.lookAt(vt.POSITIVE_X,vt.NEGATIVE_Y),t.nx.lookAt(vt.NEGATIVE_X,vt.NEGATIVE_Y),t.py.lookAt(vt.POSITIVE_Y,vt.POSITIVE_Z),t.ny.lookAt(vt.NEGATIVE_Y,vt.NEGATIVE_Z),t.pz.lookAt(vt.POSITIVE_Z,vt.NEGATIVE_Y),t.nz.lookAt(vt.NEGATIVE_Z,vt.NEGATIVE_Y),e._frameBuffer=new zi,e}),{getCamera:function(e){return this._cameras[e]},render:function(e,t,r){var i=e.gl;r||t.update();for(var n=this.texture.width,a=2*Math.atan(n/(n-.5))/Math.PI*180,o=0;o<6;o++){var s=Gi[o],l=this._cameras[s];if(vt.copy(l.position,this.position),l.far=this.far,l.near=this.near,l.fov=a,this.shadowMapPass){l.update();var h=t.getBoundingBox();h.applyTransform(l.viewMatrix),t.viewBoundingBoxLastFrame.copy(h),this.shadowMapPass.render(e,t,l,!0)}this._frameBuffer.attach(this.texture,i.COLOR_ATTACHMENT0,i.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._frameBuffer.bind(e),e.render(t,l,!0),this._frameBuffer.unbind(e)}},dispose:function(e){this._frameBuffer.dispose(e)}}),ki=Vr.extend({dynamic:!1,widthSegments:1,heightSegments:1},(function(){this.build()}),{build:function(){for(var e=this.heightSegments,t=this.widthSegments,r=this.attributes,i=[],n=[],a=[],o=[],s=0;s<=e;s++)for(var l=s/e,h=0;h<=t;h++){var u=h/t;if(i.push([2*u-1,2*l-1,0]),n&&n.push([u,l]),a&&a.push([0,0,1]),h0?this.material.define("fragment","LOD"):this.material.undefine("fragment","LOD"),e.renderPass([this],r)}}),Xi=ji;function qi(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var Zi=qi("DXT1"),Yi=qi("DXT3"),Ki=qi("DXT5");const Qi=function(e,t){var r=new Int32Array(e,0,31);if(542327876!==r[0])return null;if(4&!r(20))return null;var i,n,a=r(21),o=r[4],s=r[3],l=512&r[28],h=131072&r[2];switch(a){case Zi:i=8,n=wr.COMPRESSED_RGB_S3TC_DXT1_EXT;break;case Yi:i=16,n=wr.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case Ki:i=16,n=wr.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;default:return null}var u=r[1]+4,c=l?6:1,d=1;h&&(d=Math.max(1,r[7]));for(var f=[],p=0;p0){var n=Math.pow(2,e[3]-128-8+i);t[r+0]=e[0]*n,t[r+1]=e[1]*n,t[r+2]=e[2]*n}else t[r+0]=0,t[r+1]=0,t[r+2]=0;return t[r+3]=1,t}function en(e,t,r,i){for(var n,a,o=0,s=0,l=i;l>0;)if(e[s][0]=t[r++],e[s][1]=t[r++],e[s][2]=t[r++],e[s][3]=t[r++],1===e[s][0]&&1===e[s][1]&&1===e[s][2]){for(var h=e[s][3]<>>0;h>0;h--)n=e[s-1],(a=e[s])[0]=n[0],a[1]=n[1],a[2]=n[2],a[3]=n[3],s++,l--;o+=8}else s++,l--,o=0;return r}function tn(e,t,r,i){if(i<8|i>32767)return en(e,t,r,i);if(2!=(n=t[r++]))return en(e,t,r-1,i);if(e[0][1]=t[r++],e[0][2]=t[r++],n=t[r++],(e[0][2]<<8>>>0|n)>>>0!==i)return null;for(var n=0;n<4;n++)for(var a=0;a128){o=(127&o)>>>0;for(var s=t[r++];o--;)e[a++][n]=s}else for(;o--;)e[a++][n]=t[r++]}return r}const rn=function(e,t,r){null==r&&(r=0);var i=new Uint8Array(e),n=i.length;if("#?"===function(e,t,r){for(var i="",n=0;n<2;n++)i+=Ji(e[n]);return i}(i)){for(var a=2;a=n)){a+=2;for(var o="";a20)return console.warn("Given image is not a height map"),e}var d,f,p,m;l%(4*i)==0?(d=o.data[l],p=o.data[l+4]):l%(4*i)==4*(i-1)?(d=o.data[l-4],p=o.data[l]):(d=o.data[l-4],p=o.data[l+4]),l<4*i?(f=o.data[l],m=o.data[l+4*i]):l>i*(n-1)*4?(f=o.data[l-4*i],m=o.data[l]):(f=o.data[l-4*i],m=o.data[l+4*i]),s.data[l]=d-p+127,s.data[l+1]=f-m+127,s.data[l+2]=255,s.data[l+3]=255}return a.putImageData(s,0,0),r},isHeightImage:function(e,t,r){if(!e||!e.width||!e.height)return!1;var i=document.createElement("canvas"),n=i.getContext("2d"),a=t||32;r=r||20,i.width=i.height=a,n.drawImage(e,0,0,a,a);for(var o=n.getImageData(0,0,a,a),s=0;sr)return!1}return!0},_fetchTexture:function(e,t,r){U.request.get({url:e,responseType:"arraybuffer",onload:t,onerror:r})},createChessboard:function(e,t,r,i){e=e||512,t=t||64,r=r||"black",i=i||"white";var n=Math.ceil(e/t),a=document.createElement("canvas");a.width=e,a.height=e;var o=a.getContext("2d");o.fillStyle=i,o.fillRect(0,0,e,e),o.fillStyle=r;for(var s=0;s=0||(on.forEach((function(t){e.on(t,this[sn(t)],this)}),this),this._meshes.push(e))},detachFromMesh:function(e){var t=this._meshes.indexOf(e);t>=0&&this._meshes.splice(t,1),on.forEach((function(t){e.off(t,this[sn(t)])}),this)},dispose:function(){this._meshes.forEach((function(e){this.detachFromMesh(e)}),this)}};const hn=ln,un=hi.extend({left:-1,right:1,near:-1,far:1,top:1,bottom:-1},{updateProjectionMatrix:function(){this.projectionMatrix.ortho(this.left,this.right,this.bottom,this.top,this.near,this.far)},decomposeProjectionMatrix:function(){var e=this.projectionMatrix.array;this.left=(-1-e[12])/e[0],this.right=(1-e[12])/e[0],this.top=(1-e[13])/e[5],this.bottom=(-1-e[13])/e[5],this.near=-(-1-e[14])/e[10],this.far=-(1-e[14])/e[10]},clone:function(){var e=hi.prototype.clone.call(this);return e.left=this.left,e.right=this.right,e.near=this.near,e.far=this.far,e.top=this.top,e.bottom=this.bottom,e}});Xe.import("\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end");var cn=new ki,dn=new Sr({geometry:cn,frustumCulling:!1}),fn=new un;const pn=m.extend((function(){return{fragment:"",outputs:null,material:null,blendWithPrevious:!1,clearColor:!1,clearDepth:!0}}),(function(){var e=new Xe(Xe.source("clay.compositor.vertex"),this.fragment),t=new le({shader:e});t.enableTexturesAll(),this.material=t}),{setUniform:function(e,t){this.material.setUniform(e,t)},getUniform:function(e){var t=this.material.uniforms[e];if(t)return t.value},attachOutput:function(e,t){this.outputs||(this.outputs={}),t=t||36064,this.outputs[t]=e},detachOutput:function(e){for(var t in this.outputs)this.outputs[t]===e&&(this.outputs[t]=null)},bind:function(e,t){if(this.outputs)for(var r in this.outputs){var i=this.outputs[r];i&&t.attach(i,r)}t&&t.bind(e)},unbind:function(e,t){t.unbind(e)},render:function(e,t){var r=e.gl;if(t){this.bind(e,t);var i=e.getGLExtension("EXT_draw_buffers");if(i&&this.outputs){var n=[];for(var a in this.outputs)(a=+a)>=r.COLOR_ATTACHMENT0&&a<=r.COLOR_ATTACHMENT0+8&&n.push(a);i.drawBuffersEXT(n)}}this.trigger("beforerender",this,e);var o=this.clearDepth?r.DEPTH_BUFFER_BIT:0;if(r.depthMask(!0),this.clearColor){o|=r.COLOR_BUFFER_BIT,r.colorMask(!0,!0,!0,!0);var s=this.clearColor;Array.isArray(s)&&r.clearColor(s[0],s[1],s[2],s[3])}r.clear(o),this.blendWithPrevious?(r.enable(r.BLEND),this.material.transparent=!0):(r.disable(r.BLEND),this.material.transparent=!1),this.renderQuad(e),this.trigger("afterrender",this,e),t&&this.unbind(e,t)},renderQuad:function(e){dn.material=this.material,e.renderPass([dn],fn)},dispose:function(e){}});var mn={},gn=["px","nx","py","ny","pz","nz"];mn.prefilterEnvironmentMap=function(e,t,r,i,n){n&&i||(i=mn.generateNormalDistribution(),n=mn.integrateBRDF(e,i));var a=(r=r||{}).width||64,o=r.height||64,s=r.type||t.type,l=new Ai({width:a,height:o,type:s,flipY:!1,mipmaps:[]});l.isPowerOfTwo()||console.warn("Width and height must be power of two to enable mipmap.");var h=Math.min(a,o),u=Math.log(h)/Math.log(2)+1,c=new le({shader:new Xe({vertex:Xe.source("clay.skybox.vertex"),fragment:"#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"})});c.set("normalDistribution",i),r.encodeRGBM&&c.define("fragment","RGBM_ENCODE"),r.decodeRGBM&&c.define("fragment","RGBM_DECODE");var d,f=new vi;if("texture2D"===t.textureType){var p=new Ai({width:a,height:o,type:s===wr.FLOAT?wr.HALF_FLOAT:s});an.panoramaToCubeMap(e,t,p,{encodeRGBM:r.decodeRGBM}),t=p}(d=new ji({scene:f,material:c})).material.set("environmentMap",t);var m=new Ui({texture:l});r.encodeRGBM&&(s=l.type=wr.UNSIGNED_BYTE);for(var g=new Dr({width:a,height:o,type:s}),_=new zi({depthBuffer:!1}),v=U[s===wr.UNSIGNED_BYTE?"Uint8Array":"Float32Array"],y=0;y 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"}),n=new Dr({width:512,height:256,type:wr.HALF_FLOAT,wrapS:wr.CLAMP_TO_EDGE,wrapT:wr.CLAMP_TO_EDGE,minFilter:wr.NEAREST,magFilter:wr.NEAREST,useMipmap:!1});return i.setUniform("normalDistribution",t),i.setUniform("viewportSize",[512,256]),i.attachOutput(n),i.render(e,r),r.dispose(e),n},mn.generateNormalDistribution=function(e,t){for(var r=new Dr({width:e=e||256,height:t=t||1024,type:wr.FLOAT,minFilter:wr.NEAREST,magFilter:wr.NEAREST,wrapS:wr.CLAMP_TO_EDGE,wrapT:wr.CLAMP_TO_EDGE,useMipmap:!1}),i=new Float32Array(t*e*4),n=[],a=0;a>>16)>>>0;h=(((16711935&(h=((252645135&(h=((858993459&(h=((1431655765&h)<<1|(2863311530&h)>>>1)>>>0))<<2|(3435973836&h)>>>2)>>>0))<<4|(4042322160&h)>>>4)>>>0))<<8|(4278255360&h)>>>8)>>>0)/4294967296;var u=Math.sqrt((1-h)/(1+(s*s-1)*h));n[l]=u}for(l=0;l65535?Uint32Array:Uint16Array,v=this.indices=new _(t*e*6),y=this.radius,x=this.phiStart,b=this.phiLength,w=this.thetaStart,T=this.thetaLength,S=[],M=[],A=0,E=1/(y=this.radius);for(d=0;d<=e;d++)for(c=0;c<=t;c++)h=c/t,u=d/e,o=-y*Math.cos(x+h*b)*Math.sin(w+u*T),s=y*Math.cos(w+u*T),l=y*Math.sin(x+h*b)*Math.sin(w+u*T),S[0]=o,S[1]=s,S[2]=l,M[0]=h,M[1]=u,r.set(A,S),i.set(A,M),S[0]*=E,S[1]*=E,S[2]*=E,n.set(A,S),A++;var C=t+1,D=0;for(d=0;d255?255:e}function Qn(e){return e<0?0:e>1?1:e}function Jn(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Kn(parseFloat(t)/100*255):Kn(parseInt(t,10))}function $n(e){var t=e;return t.length&&"%"===t.charAt(t.length-1)?Qn(parseFloat(t)/100):Qn(parseFloat(t))}function ea(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}function ta(e,t,r,i,n){return e[0]=t,e[1]=r,e[2]=i,e[3]=n,e}function ra(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}var ia=new bi(20),na=null;function aa(e,t){na&&ra(na,t),na=ia.put(e,na||t.slice())}function oa(e,t){if(e){t=t||[];var r=ia.get(e);if(r)return ra(t,r);var i=(e+="").replace(/ /g,"").toLowerCase();if(i in Yn)return ra(t,Yn[i]),aa(e,t),t;var n,a=i.length;if("#"===i.charAt(0))return 4===a||5===a?(n=parseInt(i.slice(1,4),16))>=0&&n<=4095?(ta(t,(3840&n)>>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,5===a?parseInt(i.slice(4),16)/15:1),aa(e,t),t):void ta(t,0,0,0,1):7===a||9===a?(n=parseInt(i.slice(1,7),16))>=0&&n<=16777215?(ta(t,(16711680&n)>>16,(65280&n)>>8,255&n,9===a?parseInt(i.slice(7),16)/255:1),aa(e,t),t):void ta(t,0,0,0,1):void 0;var o=i.indexOf("("),s=i.indexOf(")");if(-1!==o&&s+1===a){var l=i.substr(0,o),h=i.substr(o+1,s-(o+1)).split(","),u=1;switch(l){case"rgba":if(4!==h.length)return 3===h.length?ta(t,+h[0],+h[1],+h[2],1):ta(t,0,0,0,1);u=$n(h.pop());case"rgb":return 3!==h.length?void ta(t,0,0,0,1):(ta(t,Jn(h[0]),Jn(h[1]),Jn(h[2]),u),aa(e,t),t);case"hsla":return 4!==h.length?void ta(t,0,0,0,1):(h[3]=$n(h[3]),sa(h,t),aa(e,t),t);case"hsl":return 3!==h.length?void ta(t,0,0,0,1):(sa(h,t),aa(e,t),t);default:return}}ta(t,0,0,0,1)}}function sa(e,t){var r=(parseFloat(e[0])%360+360)%360/360,i=$n(e[1]),n=$n(e[2]),a=n<=.5?n*(i+1):n+i-n*i,o=2*n-a;return ta(t=t||[],Kn(255*ea(o,a,r+1/3)),Kn(255*ea(o,a,r)),Kn(255*ea(o,a,r-1/3)),1),4===e.length&&(t[3]=e[3]),t}var la=Object.prototype.toString,ha=Array.prototype,ua=ha.forEach,ca=ha.filter,da=ha.slice,fa=ha.map,pa=function(){}.constructor,ma=pa?pa.prototype:null;function ga(e,t){if(Object.assign)Object.assign(e,t);else for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function _a(e,t,r){if(e="prototype"in e?e.prototype:e,t="prototype"in t?t.prototype:t,Object.getOwnPropertyNames)for(var i=Object.getOwnPropertyNames(t),n=0;no)i.length=o;else for(var s=a;s=2&&this.interpolable},e.prototype.getAdditiveTrack=function(){return this._additiveTrack},e.prototype.addKeyframe=function(e,t){e>=this.maxTime?this.maxTime=e:this._needsSort=!0;var r=this.keyframes,i=r.length;if(this.interpolable)if(va(t)){var n=function(e){return va(e&&e[0])?2:1}(t);if(i>0&&this.arrDim!==n)return void(this.interpolable=!1);if(1===n&&"number"!=typeof t[0]||2===n&&"number"!=typeof t[0][0])return void(this.interpolable=!1);if(i>0){var a=r[i-1];this._isAllValueEqual&&(1===n&&Na(t,a.value)||(this._isAllValueEqual=!1))}this.arrDim=n}else{if(this.arrDim>0)return void(this.interpolable=!1);if("string"==typeof t){var o=oa(t);o?(t=o,this.isValueColor=!0):this.interpolable=!1}else if("number"!=typeof t||isNaN(t))return void(this.interpolable=!1);this._isAllValueEqual&&i>0&&(a=r[i-1],(this.isValueColor&&!Na(a.value,t)||a.value!==t)&&(this._isAllValueEqual=!1))}var s={time:e,value:t,percent:0};return this.keyframes.push(s),s},e.prototype.prepare=function(e){var t=this.keyframes;this._needsSort&&t.sort((function(e,t){return e.time-t.time}));for(var r=this.arrDim,i=t.length,n=t[i-1],a=0;a0&&a!==i-1&&Oa(t[a].value,n.value,r);if(e&&this.needsAnimate()&&e.needsAnimate()&&r===e.arrDim&&this.isValueColor===e.isValueColor&&!e._finished){this._additiveTrack=e;var o=t[0].value;for(a=0;a=0&&!(a[r].percent<=t);r--);r=Math.min(r,o-2)}else{for(r=this._lastFrame;rt);r++);r=Math.min(r-1,o-2)}var u=a[r+1],c=a[r];if(c&&u){this._lastFrame=r,this._lastFramePercent=t;var d=u.percent-c.percent;if(0!==d){var f=(t-c.percent)/d,p=i?this._additiveValue:h?za:e[s];if((l>0||h)&&!p&&(p=this._additiveValue=[]),this.useSpline){var m=a[r][n],g=a[0===r?r:r-1][n],_=a[r>o-2?o-1:r+1][n],v=a[r>o-3?o-1:r+2][n];if(l>0)1===l?Ra(p,g,m,_,v,f,f*f,f*f*f):function(e,t,r,i,n,a,o,s){for(var l=t.length,h=t[0].length,u=0;u0?1===l?Da(p,c[n],u[n],f):function(e,t,r,i){for(var n=t.length,a=n&&t[0].length,o=0;o.5?t:e}(c[n],u[n],f),i?this._additiveValue=y:e[s]=y);i&&this._addToTarget(e)}}}},e.prototype._addToTarget=function(e){var t=this.arrDim,r=this.propName,i=this._additiveValue;0===t?this.isValueColor?(oa(e[r],za),La(za,za,i,1),e[r]=Fa(za)):e[r]=e[r]+i:1===t?La(e[r],e[r],i,1):2===t&&Pa(e[r],e[r],i,1)},e}();const Ua=function(){function e(e,t,r){this._tracks={},this._trackKeys=[],this._delay=0,this._maxTime=0,this._paused=!1,this._started=0,this._clip=null,this._target=e,this._loop=t,t&&r?function(){for(var e=[],t=0;t0)){this._started=1;for(var r=this,i=[],n=0;n1){var o=a.pop();n.addKeyframe(o.time,e[i]),n.prepare(n.getAdditiveTrack())}}}},e}(),ka={_animators:null,getAnimators:function(){return this._animators=this._animators||[],this._animators},animate:function(e,t){var r;if(this._animators=this._animators||[],e){for(var i=e.split("."),n=this,a=0,o=i.length;a=0&&s.splice(e,1)})),s.push(l),this.__zr&&this.__zr.animation.addAnimator(l),l},stopAnimation:function(e){this._animators=this._animators||[];for(var t=this._animators,r=t.length,i=0;i 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.chunk.instancing_header\n#ifdef INSTANCING\nattribute vec4 instanceMat1;\nattribute vec4 instanceMat2;\nattribute vec4 instanceMat3;\n#endif\n@end\n@export clay.chunk.instancing_matrix\nmat4 instanceMat = mat4(\n vec4(instanceMat1.xyz, 0.0),\n vec4(instanceMat2.xyz, 0.0),\n vec4(instanceMat3.xyz, 0.0),\n vec4(instanceMat1.w, instanceMat2.w, instanceMat3.w, 1.0)\n);\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end";function Ha(e){return e instanceof HTMLCanvasElement||e instanceof HTMLImageElement||e instanceof Image}Object.assign(sr.prototype,ka),Xe.import(Va),Xe.import(qe),Xe.import("\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"),Xe.import("@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\nattribute vec3 normal: NORMAL;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nvarying vec3 v_Normal;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef ATMOSPHERE_ENABLED\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\nvarying vec3 v_Normal;\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"),Xe.import("/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),Xe.import("@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef ATMOSPHERE_ENABLED\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform vec3 glowColor;\nuniform float glowPower;\n#endif\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef ATMOSPHERE_ENABLED\n float atmoIntensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor.rgb += glowColor * atmoIntensity;\n#endif\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"),Xe.import("@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"),Xe.import("@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end");var Wa=vi.prototype.addToScene,ja=vi.prototype.removeFromScene;vi.prototype.addToScene=function(e){if(Wa.call(this,e),this.__zr){var t=this.__zr;e.traverse((function(e){e.__zr=t,e.addAnimatorsToZr&&e.addAnimatorsToZr(t)}))}},vi.prototype.removeFromScene=function(e){ja.call(this,e),e.traverse((function(e){var t=e.__zr;e.__zr=null,t&&e.removeAnimatorsFromZr&&e.removeAnimatorsFromZr(t)}))},le.prototype.setTextureImage=function(e,t,r,i){if(this.shader){var n,a=r.getZr(),o=this;return o.autoUpdateTextureStatus=!1,o.disableTexture(e),!(s=t)||"none"===s||(n=Xa.loadTexture(t,r,i,(function(t){o.enableTexture(e),a&&a.refresh()})),o.set(e,n)),n}var s};var Xa={};Xa.Renderer=ut,Xa.Node=sr,Xa.Mesh=Sr,Xa.Shader=Xe,Xa.Material=le,Xa.Texture=wr,Xa.Texture2D=Dr,Xa.Geometry=Vr,Xa.SphereGeometry=En,Xa.PlaneGeometry=ki,Xa.CubeGeometry=Wi,Xa.AmbientLight=Cn,Xa.DirectionalLight=Dn,Xa.PointLight=Ln,Xa.SpotLight=Pn,Xa.PerspectiveCamera=Ei,Xa.OrthographicCamera=un,Xa.Vector2=_e,Xa.Vector3=vt,Xa.Vector4=Rn,Xa.Quaternion=qt,Xa.Matrix2=Gn,Xa.Matrix2d=Hn,Xa.Matrix3=jn,Xa.Matrix4=Ht,Xa.Plane=$r,Xa.Ray=Mt,Xa.BoundingBox=ir,Xa.Frustum=si;var qa=null;function Za(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function Ya(e){if((e.wrapS===wr.REPEAT||e.wrapT===wr.REPEAT)&&e.image){var t=Za(e.width),r=Za(e.height);if(t!==e.width||r!==e.height){var i=document.createElement("canvas");i.width=t,i.height=r,i.getContext("2d").drawImage(e.image,0,0,t,r),e.image=i}}}Xa.loadTexture=function(e,t,r,i){"function"==typeof r&&(i=r,r={}),r=r||{};for(var n=Object.keys(r).sort(),a="",o=0;o3?t[3]=e[3]:t[3]=1,t):((t=i.color.parse(e||"#000",t)||[0,0,0,0])[0]/=255,t[1]/=255,t[2]/=255,t)},Xa.directionFromAlphaBeta=function(e,t){var r=e/180*Math.PI+Math.PI/2,i=-t/180*Math.PI+Math.PI/2,n=[],a=Math.sin(r);return n[0]=a*Math.cos(i),n[1]=-Math.cos(r),n[2]=a*Math.sin(i),n},Xa.getShadowResolution=function(e){var t=1024;switch(e){case"low":t=512;break;case"medium":break;case"high":t=2048;break;case"ultra":t=4096}return t},Xa.COMMON_SHADERS=["lambert","color","realistic","hatching","shadow"],Xa.createShader=function(e){"ecgl.shadow"===e&&(e="ecgl.displayShadow");var t=Xe.source(e+".vertex"),r=Xe.source(e+".fragment");t||console.error("Vertex shader of '%s' not exits",e),r||console.error("Fragment shader of '%s' not exits",e);var i=new Xe(t,r);return i.name=e,i},Xa.createMaterial=function(e,t){t instanceof Array||(t=[t]);var r=Xa.createShader(e),i=new le({shader:r});return t.forEach((function(e){"string"==typeof e&&i.define(e)})),i},Xa.setMaterialFromModel=function(e,t,r,i){t.autoUpdateTextureStatus=!1;var n=r.getModel(e+"Material"),a=n.get("detailTexture"),o=Mn(n.get("textureTiling"),1),s=Mn(n.get("textureOffset"),0);"number"==typeof o&&(o=[o,o]),"number"==typeof s&&(s=[s,s]);var l=o[0]>1||o[1]>1?Xa.Texture.REPEAT:Xa.Texture.CLAMP_TO_EDGE,h={anisotropic:8,wrapS:l,wrapT:l};if("realistic"===e){var u=n.get("roughness"),c=n.get("metalness");null!=c?isNaN(c)&&(t.setTextureImage("metalnessMap",c,i,h),c=Mn(n.get("metalnessAdjust"),.5)):c=0,null!=u?isNaN(u)&&(t.setTextureImage("roughnessMap",u,i,h),u=Mn(n.get("roughnessAdjust"),.5)):u=.5;var d=n.get("normalTexture");t.setTextureImage("detailMap",a,i,h),t.setTextureImage("normalMap",d,i,h),t.set({roughness:u,metalness:c,detailUvRepeat:o,detailUvOffset:s})}else if("lambert"===e)t.setTextureImage("detailMap",a,i,h),t.set({detailUvRepeat:o,detailUvOffset:s});else if("color"===e)t.setTextureImage("detailMap",a,i,h),t.set({detailUvRepeat:o,detailUvOffset:s});else if("hatching"===e){var f=n.get("hatchingTextures")||[];f.length;for(var p=0;p<6;p++)t.setTextureImage("hatch"+(p+1),f[p],i,{anisotropic:8,wrapS:Xa.Texture.REPEAT,wrapT:Xa.Texture.REPEAT});t.set({detailUvRepeat:o,detailUvOffset:s})}},Xa.updateVertexAnimation=function(e,t,r,i){var n=i.get("animation"),a=i.get("animationDurationUpdate"),o=i.get("animationEasingUpdate"),s=r.shadowDepthMaterial;if(n&&t&&a>0&&t.geometry.vertexCount===r.geometry.vertexCount){r.material.define("vertex","VERTEX_ANIMATION"),r.ignorePreZ=!0,s&&s.define("vertex","VERTEX_ANIMATION");for(var l=0;l=0&&this._viewsToDispose.splice(t,1),this.views.push(e),e.layer=this;var r=this.zr;e.scene.traverse((function(e){e.__zr=r,e.addAnimatorsToZr&&e.addAnimatorsToZr(r)}))}},Ja.prototype.removeView=function(e){if(e.layer===this){var t=this.views.indexOf(e);t>=0&&(this.views.splice(t,1),e.scene.traverse($a,this),e.layer=null,this._viewsToDispose.push(e))}},Ja.prototype.removeViewsAll=function(){this.views.forEach((function(e){e.scene.traverse($a,this),e.layer=null,this._viewsToDispose.push(e)}),this),this.views.length=0},Ja.prototype.resize=function(e,t){this.renderer.resize(e,t)},Ja.prototype.clear=function(){var e=this.renderer.gl,t=this._backgroundColor||[0,0,0,0];e.clearColor(t[0],t[1],t[2],t[3]),e.depthMask(!0),e.colorMask(!0,!0,!0,!0),e.clear(e.DEPTH_BUFFER_BIT|e.COLOR_BUFFER_BIT)},Ja.prototype.clearDepth=function(){var e=this.renderer.gl;e.clear(e.DEPTH_BUFFER_BIT)},Ja.prototype.clearColor=function(){var e=this.renderer.gl;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)},Ja.prototype.needsRefresh=function(){this.zr.refresh()},Ja.prototype.refresh=function(e){this._backgroundColor=e?Ka.parseColor(e):[0,0,0,0],this.renderer.clearColor=this._backgroundColor;for(var t=0;t20)){e=e.event;var i=this.pickObject(e.offsetX,e.offsetY);i&&(this._dispatchEvent(e.type,e,i),this._dispatchDataEvent(e.type,e,i));var n=this._clickToSetFocusPoint(e);n&&n.view.setDOFFocusOnPoint(n.distance)&&this.zr.refresh()}}},Ja.prototype._clickToSetFocusPoint=function(e){for(var t=this.renderer,r=t.viewport,i=this.views.length-1;i>=0;i--){var n=this.views[i];if(n.hasDOF()&&n.containPoint(e.offsetX,e.offsetY)){this._picking.scene=n.scene,this._picking.camera=n.camera,t.viewport=n.viewport;var a=this._picking.pick(e.offsetX,e.offsetY,!0);if(a)return a.view=n,a}}t.viewport=r},Ja.prototype.onglobalout=function(e){var t=this._hovered;t&&this._dispatchEvent("mouseout",e,{target:t.target})},Ja.prototype.pickObject=function(e,t){for(var r=[],i=this.renderer,n=i.viewport,a=0;a=0&&(c.dataIndex=this._lastDataIndex,c.seriesIndex=this._lastSeriesIndex,this.zr.handler.dispatchToElement(u,"mouseout",t)),l=!0):null!=s&&s!==this._lastEventData&&(null!=this._lastEventData&&(c.eventData=this._lastEventData,this.zr.handler.dispatchToElement(u,"mouseout",t)),l=!0),this._lastEventData=s,this._lastDataIndex=a,this._lastSeriesIndex=o),c.eventData=s,c.dataIndex=a,c.seriesIndex=o,(null!=s||parseInt(a,10)>=0&&parseInt(o,10)>=0)&&(this.zr.handler.dispatchToElement(u,e,t),l&&this.zr.handler.dispatchToElement(u,"mouseover",t))},Ja.prototype._dispatchToView=function(e,t){for(var r=0;re&&o=0&&(function(e){so(e,"itemStyle"),so(e,"lineStyle"),so(e,"areaStyle"),so(e,"label")}(t),"mapbox"===t.coordinateSystem&&(t.coordinateSystem="mapbox3D",e.mapbox3D=e.mapbox))})),lo(e.xAxis3D),lo(e.yAxis3D),lo(e.zAxis3D),lo(e.grid3D),so(e.geo3D)}));const uo={defaultOption:{viewControl:{projection:"perspective",autoRotate:!1,autoRotateDirection:"cw",autoRotateSpeed:10,autoRotateAfterStill:3,damping:.8,rotateSensitivity:1,zoomSensitivity:1,panSensitivity:1,panMouseButton:"middle",rotateMouseButton:"left",distance:150,minDistance:40,maxDistance:400,orthographicSize:150,maxOrthographicSize:400,minOrthographicSize:20,center:[0,0,0],alpha:0,beta:0,minAlpha:-90,maxAlpha:90}},setView:function(e){e=e||{},this.option.viewControl=this.option.viewControl||{},null!=e.alpha&&(this.option.viewControl.alpha=e.alpha),null!=e.beta&&(this.option.viewControl.beta=e.beta),null!=e.distance&&(this.option.viewControl.distance=e.distance),null!=e.center&&(this.option.viewControl.center=e.center)}},co={defaultOption:{postEffect:{enable:!1,bloom:{enable:!0,intensity:.1},depthOfField:{enable:!1,focalRange:20,focalDistance:50,blurRadius:10,fstop:2.8,quality:"medium"},screenSpaceAmbientOcclusion:{enable:!1,radius:2,quality:"medium",intensity:1},screenSpaceReflection:{enable:!1,quality:"medium",maxRoughness:.8},colorCorrection:{enable:!0,exposure:0,brightness:0,contrast:1,saturation:1,lookupTexture:""},edge:{enable:!1},FXAA:{enable:!1}},temporalSuperSampling:{enable:"auto"}}},fo={defaultOption:{light:{main:{shadow:!1,shadowQuality:"high",color:"#fff",intensity:1,alpha:0,beta:0},ambient:{color:"#fff",intensity:.2},ambientCubemap:{texture:null,exposure:1,diffuseIntensity:.5,specularIntensity:.5}}}};var po=i.ComponentModel.extend({type:"grid3D",dependencies:["xAxis3D","yAxis3D","zAxis3D"],defaultOption:{show:!0,zlevel:-10,left:0,top:0,width:"100%",height:"100%",environment:"auto",boxWidth:100,boxHeight:100,boxDepth:100,axisPointer:{show:!0,lineStyle:{color:"rgba(0, 0, 0, 0.8)",width:1},label:{show:!0,formatter:null,margin:8,textStyle:{fontSize:14,color:"#fff",backgroundColor:"rgba(0,0,0,0.5)",padding:3,borderRadius:3}}},axisLine:{show:!0,lineStyle:{color:"#333",width:2,type:"solid"}},axisTick:{show:!0,inside:!1,length:3,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,margin:8,textStyle:{fontSize:12}},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}},light:{main:{alpha:30,beta:40},ambient:{intensity:.4}},viewControl:{alpha:20,beta:40,autoRotate:!1,distance:200,minDistance:40,maxDistance:400}}});i.util.merge(po.prototype,uo),i.util.merge(po.prototype,co),i.util.merge(po.prototype,fo);const mo=po;function go(e,t){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%"}return"string"==typeof e?(r=e,r.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(e)/100*t:parseFloat(e):null==e?NaN:+e;var r}function _o(){var e="__ec_inner_"+vo++;return function(t){return t[e]||(t[e]={})}}var vo=Math.round(9*Math.random()),yo={};function xo(e,t,r,i,n){var a={};return function(e,t,r,i,n){r=r||yo;var a,o=t.ecModel,s=o&&o.option.textStyle,l=function(e){for(var t;e&&e!==e.ecModel;){var r=(e.option||yo).rich;if(r){t=t||{};for(var i=ba(r),n=0;n0&&this._notFirst?this.animateTo({alpha:h,beta:u,center:c,distance:a,orthographicSize:o,easing:l.animationEasingUpdate,duration:l.animationDurationUpdate}):(this.setDistance(a),this.setAlpha(h),this.setBeta(u),this.setCenter(c),this.setOrthographicSize(o)),this._notFirst=!0,this._validateProperties()},_validateProperties:function(){},animateTo:function(e){var t=this.zr,r=this,i={},n={};return null!=e.distance&&(i.distance=this.getDistance(),n.distance=e.distance),null!=e.orthographicSize&&(i.orthographicSize=this.getOrthographicSize(),n.orthographicSize=e.orthographicSize),null!=e.alpha&&(i.alpha=this.getAlpha(),n.alpha=e.alpha),null!=e.beta&&(i.beta=this.getBeta(),n.beta=e.beta),null!=e.center&&(i.center=this.getCenter(),n.center=e.center),this._addAnimator(t.animation.animate(i).when(e.duration||1e3,n).during((function(){null!=i.alpha&&r.setAlpha(i.alpha),null!=i.beta&&r.setBeta(i.beta),null!=i.distance&&r.setDistance(i.distance),null!=i.center&&r.setCenter(i.center),null!=i.orthographicSize&&r.setOrthographicSize(i.orthographicSize),r._needsUpdate=!0}))).start(e.easing||"linear")},stopAllAnimation:function(){for(var e=0;e0},_update:function(e){if(this._rotating){var t=("cw"===this.autoRotateDirection?1:-1)*this.autoRotateSpeed/180*Math.PI;this._phi-=t*e/1e3,this._needsUpdate=!0}else this._rotateVelocity.len()>0&&(this._needsUpdate=!0);(Math.abs(this._zoomSpeed)>.1||this._panVelocity.len()>0)&&(this._needsUpdate=!0),this._needsUpdate&&(e=Math.min(e,50),this._updateDistanceOrSize(e),this._updatePan(e),this._updateRotate(e),this._updateTransform(),this.getCamera().update(),this.zr&&this.zr.refresh(),this.trigger("update"),this._needsUpdate=!1)},_updateRotate:function(e){var t=this._rotateVelocity;this._phi=t.y*e/20+this._phi,this._theta=t.x*e/20+this._theta,this.setAlpha(this.getAlpha()),this.setBeta(this.getBeta()),this._vectorDamping(t,Math.pow(this.damping,e/16))},_updateDistanceOrSize:function(e){"perspective"===this._projection?this._setDistance(this._distance+this._zoomSpeed*e/20):this._setOrthoSize(this._orthoSize+this._zoomSpeed*e/20),this._zoomSpeed*=Math.pow(this.damping,e/16)},_setDistance:function(e){this._distance=Math.max(Math.min(e,this.maxDistance),this.minDistance)},_setOrthoSize:function(e){this._orthoSize=Math.max(Math.min(e,this.maxOrthographicSize),this.minOrthographicSize);var t=this.getCamera(),r=this._orthoSize,i=r/this.viewGL.viewport.height*this.viewGL.viewport.width;t.left=-i/2,t.right=i/2,t.top=r/2,t.bottom=-r/2},_updatePan:function(e){var t=this._panVelocity,r=this._distance,i=this.getCamera(),n=i.worldTransform.y,a=i.worldTransform.x;this._center.scaleAndAdd(a,-t.x*r/200).scaleAndAdd(n,-t.y*r/200),this._vectorDamping(t,0)},_updateTransform:function(){var e=this.getCamera(),t=new vt,r=this._theta+Math.PI/2,i=this._phi+Math.PI/2,n=Math.sin(r);t.x=n*Math.cos(i),t.y=-Math.cos(r),t.z=n*Math.sin(i),e.position.copy(this._center).scaleAndAdd(t,this._distance),e.rotation.identity().rotateY(-this._phi).rotateX(-this._theta)},_startCountingStill:function(){clearTimeout(this._stillTimeout);var e=this.autoRotateAfterStill,t=this;!isNaN(e)&&e>0&&(this._stillTimeout=setTimeout((function(){t._rotating=!0}),1e3*e))},_vectorDamping:function(e,t){var r=e.len();(r*=t)<1e-4&&(r=0),e.normalize().scale(r)},_decomposeTransform:function(){if(this.getCamera()){this.getCamera().updateWorldTransform();var e=this.getCamera().worldTransform.z,t=Math.asin(e.y),r=Math.atan2(e.x,e.z);this._theta=t,this._phi=-r,this.setBeta(this.getBeta()),this.setAlpha(this.getAlpha()),this.getCamera().aspect?this._setDistance(this.getCamera().position.dist(this._center)):this._setOrthoSize(this.getCamera().top-this.getCamera().bottom)}},_mouseDownHandler:function(e){if(!e.target&&!this._isAnimating()){var t=e.offsetX,r=e.offsetY;this.viewGL&&!this.viewGL.containPoint(t,r)||(this.zr.on("mousemove",this._mouseMoveHandler),this.zr.on("mouseup",this._mouseUpHandler),e.event.targetTouches?1===e.event.targetTouches.length&&(this._mode="rotate"):e.event.button===Ao[this.rotateMouseButton]?this._mode="rotate":e.event.button===Ao[this.panMouseButton]?this._mode="pan":this._mode="",this._rotateVelocity.set(0,0),this._rotating=!1,this.autoRotate&&this._startCountingStill(),this._mouseX=e.offsetX,this._mouseY=e.offsetY)}},_mouseMoveHandler:function(e){if(!(e.target&&e.target.__isGLToZRProxy||this._isAnimating())){var t=Eo(this.panSensitivity),r=Eo(this.rotateSensitivity);"rotate"===this._mode?(this._rotateVelocity.y=(e.offsetX-this._mouseX)/this.zr.getHeight()*2*r[0],this._rotateVelocity.x=(e.offsetY-this._mouseY)/this.zr.getWidth()*2*r[1]):"pan"===this._mode&&(this._panVelocity.x=(e.offsetX-this._mouseX)/this.zr.getWidth()*t[0]*400,this._panVelocity.y=(-e.offsetY+this._mouseY)/this.zr.getHeight()*t[1]*400),this._mouseX=e.offsetX,this._mouseY=e.offsetY,e.event.preventDefault()}},_mouseWheelHandler:function(e){if(!this._isAnimating()){var t=e.event.wheelDelta||-e.event.detail;this._zoomHandler(e,t)}},_pinchHandler:function(e){this._isAnimating()||(this._zoomHandler(e,e.pinchScale>1?1:-1),this._mode="")},_zoomHandler:function(e,t){if(0!==t){var r,i=e.offsetX,n=e.offsetY;this.viewGL&&!this.viewGL.containPoint(i,n)||(r="perspective"===this._projection?Math.max(Math.max(Math.min(this._distance-this.minDistance,this.maxDistance-this._distance))/20,.5):Math.max(Math.max(Math.min(this._orthoSize-this.minOrthographicSize,this.maxOrthographicSize-this._orthoSize))/20,.5),this._zoomSpeed=(t>0?-1:1)*r*this.zoomSensitivity,this._rotating=!1,this.autoRotate&&"rotate"===this._mode&&this._startCountingStill(),e.event.preventDefault())}},_mouseUpHandler:function(){this.zr.off("mousemove",this._mouseMoveHandler),this.zr.off("mouseup",this._mouseUpHandler)},_isRightMouseButtonUsed:function(){return"right"===this.rotateMouseButton||"right"===this.panMouseButton},_contextMenuHandler:function(e){this._isRightMouseButtonUsed()&&e.preventDefault()},_addAnimator:function(e){var t=this._animators;return t.push(e),e.done((function(){var r=t.indexOf(e);r>=0&&t.splice(r,1)})),e}});Object.defineProperty(Co.prototype,"autoRotate",{get:function(e){return this._autoRotate},set:function(e){this._autoRotate=e,this._rotating=e}});const Do=Co,Lo={convertToDynamicArray:function(e){e&&this.resetOffset();var t=this.attributes;for(var r in t)e||!t[r].value?t[r].value=[]:t[r].value=Array.prototype.slice.call(t[r].value);e||!this.indices?this.indices=[]:this.indices=Array.prototype.slice.call(this.indices)},convertToTypedArray:function(){var e=this.attributes;for(var t in e)e[t].value&&e[t].value.length>0?e[t].value=new Float32Array(e[t].value):e[t].value=null;this.indices&&this.indices.length>0&&(this.indices=this.vertexCount>65535?new Uint32Array(this.indices):new Uint16Array(this.indices)),this.dirty()}},Po={vec2:pe,vec3:Qe,vec4:Et,mat2:Fn,mat2d:kn,mat3:Dt,mat4:Ye,quat:Rt};var Oo=Po.vec3,No=[[0,0],[1,1]],Io=Vr.extend((function(){return{segmentScale:1,dynamic:!0,useNativeLine:!0,attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),positionPrev:new Vr.Attribute("positionPrev","float",3),positionNext:new Vr.Attribute("positionNext","float",3),prevPositionPrev:new Vr.Attribute("prevPositionPrev","float",3),prevPosition:new Vr.Attribute("prevPosition","float",3),prevPositionNext:new Vr.Attribute("prevPositionNext","float",3),offset:new Vr.Attribute("offset","float",1),color:new Vr.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0,this._itemVertexOffsets=[]},setVertexCount:function(e){var t=this.attributes;this.vertexCount!==e&&(t.position.init(e),t.color.init(e),this.useNativeLine||(t.positionPrev.init(e),t.positionNext.init(e),t.offset.init(e)),e>65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,i){return 1/(Oo.dist(e,t)+Oo.dist(r,t)+Oo.dist(i,r)+1)*this.segmentScale},getCubicCurveVertexCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(No)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(No)},getPolylineVertexCount:function(e){var t;return t="number"==typeof e?e:"number"!=typeof e[0]?e.length:e.length/3,this.useNativeLine?2*(t-1):2*(t-1)+2},getPolylineTriangleCount:function(e){var t;return t="number"==typeof e?e:"number"!=typeof e[0]?e.length:e.length/3,this.useNativeLine?0:2*Math.max(t-1,0)},addCubicCurve:function(e,t,r,i,n,a){null==a&&(a=1);var o=e[0],s=e[1],l=e[2],h=t[0],u=t[1],c=t[2],d=r[0],f=r[1],p=r[2],m=i[0],g=i[1],_=i[2],v=this._getCubicCurveApproxStep(e,t,r,i),y=v*v,x=y*v,b=3*v,w=3*y,T=6*y,S=6*x,M=o-2*h+d,A=s-2*u+f,E=l-2*c+p,C=3*(h-d)-o+m,D=3*(u-f)-s+g,L=3*(c-p)-l+_,P=o,O=s,N=l,I=(h-o)*b+M*w+C*x,R=(u-s)*b+A*w+D*x,B=(c-l)*b+E*w+L*x,F=M*T+C*S,z=A*T+D*S,G=E*T+L*S,U=C*S,k=D*S,V=L*S,H=0,W=0,j=Math.ceil(1/v),X=new Float32Array(3*(j+1)),q=(X=[],0);for(W=0;W1&&(P=I>0?Math.min(P,m):Math.max(P,m),O=R>0?Math.min(O,g):Math.max(O,g),N=B>0?Math.min(N,_):Math.max(N,_));return this.addPolyline(X,n,a)},addLine:function(e,t,r,i){return this.addPolyline([e,t],r,i)},addPolyline:function(e,t,r,i,n){if(e.length){var a="number"!=typeof e[0];if(null==n&&(n=a?e.length:e.length/3),!(n<2)){null==i&&(i=0),null==r&&(r=1),this._itemVertexOffsets.push(this._vertexOffset);var o,s,l=(a="number"!=typeof e[0])?"number"!=typeof t[0]:t.length/4===n,h=this.attributes.position,u=this.attributes.positionPrev,c=this.attributes.positionNext,d=this.attributes.color,f=this.attributes.offset,p=this.indices,m=this._vertexOffset;r=Math.max(r,.01);for(var g=i;g1&&(h.copy(m,m-1),d.copy(m,m-1),m++):(g0&&(c.set(m-2,o),c.set(m-1,o)),h.set(m,o),h.set(m+1,o),d.set(m,s),d.set(m+1,s),f.set(m,r/2),f.set(m+1,-r/2),m+=2),this.useNativeLine)d.set(m,s),h.set(m,o),m++;else if(g>0){var y=3*this._triangleOffset;(p=this.indices)[y]=m-4,p[y+1]=m-3,p[y+2]=m-2,p[y+3]=m-3,p[y+4]=m-1,p[y+5]=m-2,this._triangleOffset+=2}}if(!this.useNativeLine){var x=this._vertexOffset,b=this._vertexOffset+2*n;u.copy(x,x+2),u.copy(x+1,x+3),c.copy(b-1,b-3),c.copy(b-2,b-4)}return this._vertexOffset=m,this._vertexOffset}}},setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],i=eo&&(n=this._x=0,a+=this._rowHeight+l,this._y=a,this._rowHeight=0),this._x+=t+l,this._rowHeight=Math.max(this._rowHeight,r),a+r+l>s)return null;e.x+=this.offsetX*this.dpr+n,e.y+=this.offsetY*this.dpr+a,this._zr.add(e);var h=[this.offsetX/this.width,this.offsetY/this.height];return[[n/o+h[0],a/s+h[1]],[(n+t)/o+h[0],(a+r)/s+h[1]]]},_fitElement:function(e,t,r){var i=e.getBoundingRect(),n=t/i.width,a=r/i.height;e.x=-i.x*n,e.y=-i.y*a,e.scaleX=n,e.scaleY=a,e.update()}},Fo.prototype={clear:function(){for(var e=0;e=e)){var n=(r+this._nodeWidth)*this._dpr,a=(i+this._nodeHeight)*this._dpr;try{this._zr.resize({width:n,height:a})}catch(e){this._canvas.width=n,this._canvas.height=a}var o=new Bo(this._zr,r,i,this._nodeWidth,this._nodeHeight,this._gap,this._dpr);return this._textureAtlasNodes.push(o),o}},add:function(e,t,r){if(this._coords[e.id])return this._coords[e.id];var i=this._getCurrentNode().add(e,t,r);if(!i){var n=this._expand();if(!n)return;i=n.add(e,t,r)}return this._coords[e.id]=i,i},getCoordsScale:function(){var e=this._dpr;return[this._nodeWidth/this._canvas.width*e,this._nodeHeight/this._canvas.height*e]},getCoords:function(e){return this._coords[e]},dispose:function(){this._zr.dispose()}};const zo=Fo;function Go(){}Go.prototype={constructor:Go,setScene:function(e){this._scene=e,this._skybox&&this._skybox.attachScene(this._scene)},initLight:function(e){this._lightRoot=e,this.mainLight=new Ka.DirectionalLight({shadowBias:.005}),this.ambientLight=new Ka.AmbientLight,e.add(this.mainLight),e.add(this.ambientLight)},dispose:function(){this._lightRoot&&(this._lightRoot.remove(this.mainLight),this._lightRoot.remove(this.ambientLight))},updateLight:function(e){var t=this.mainLight,r=this.ambientLight,i=e.getModel("light"),n=i.getModel("main"),a=i.getModel("ambient");t.intensity=n.get("intensity"),r.intensity=a.get("intensity"),t.color=Ka.parseColor(n.get("color")).slice(0,3),r.color=Ka.parseColor(a.get("color")).slice(0,3);var o=n.get("alpha")||0,s=n.get("beta")||0;t.position.setArray(Ka.directionFromAlphaBeta(o,s)),t.lookAt(Ka.Vector3.ZERO),t.castShadow=n.get("shadow"),t.shadowResolution=Ka.getShadowResolution(n.get("shadowQuality"))},updateAmbientCubemap:function(e,t,r){var i=t.getModel("light.ambientCubemap"),n=i.get("texture");if(n){this._cubemapLightsCache=this._cubemapLightsCache||{};var a=this._cubemapLightsCache[n];if(!a){var o=this;a=this._cubemapLightsCache[n]=Ka.createAmbientCubemap(i.option,e,r,(function(){o._isSkyboxFromAmbientCubemap&&o._skybox.setEnvironmentMap(a.specular.cubemap),r.getZr().refresh()}))}this._lightRoot.add(a.diffuse),this._lightRoot.add(a.specular),this._currentCubemapLights=a}else this._currentCubemapLights&&(this._lightRoot.remove(this._currentCubemapLights.diffuse),this._lightRoot.remove(this._currentCubemapLights.specular),this._currentCubemapLights=null)},updateSkybox:function(e,t,r){var n=t.get("environment"),a=this,o=(a._skybox=a._skybox||new ji,a._skybox);if(n&&"none"!==n)if("auto"===n)if(this._isSkyboxFromAmbientCubemap=!0,this._currentCubemapLights){var s=this._currentCubemapLights.specular.cubemap;o.setEnvironmentMap(s),this._scene&&o.attachScene(this._scene),o.material.set("lod",3)}else this._skybox&&this._skybox.detachScene();else if("object"==typeof n&&n.colorStops||"string"==typeof n&&i.color.parse(n)){this._isSkyboxFromAmbientCubemap=!1;var l=new Ka.Texture2D({anisotropic:8,flipY:!1});o.setEnvironmentMap(l);var h=l.image=document.createElement("canvas");h.width=h.height=16;var u=h.getContext("2d"),c=new i.graphic.Rect({shape:{x:0,y:0,width:16,height:16},style:{fill:n}});i.innerDrawElementOnCanvas(u,c),o.attachScene(this._scene)}else this._isSkyboxFromAmbientCubemap=!1,l=Ka.loadTexture(n,r,{anisotropic:8,flipY:!1}),o.setEnvironmentMap(l),o.attachScene(this._scene);else this._skybox&&this._skybox.detachScene(this._scene),this._skybox=null;var d=t.coordinateSystem;if(this._skybox)if(!d||!d.viewGL||"auto"===n||n.match&&n.match(/.hdr$/))this._skybox.material.undefine("fragment","SRGB_DECODE");else{var f=d.viewGL.isLinearSpace()?"define":"undefine";this._skybox.material[f]("fragment","SRGB_DECODE")}}};const Uo=Go;var ko=Po.vec3,Vo=Vr.extend((function(){return{segmentScale:1,useNativeLine:!0,attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),normal:new Vr.Attribute("normal","float",3,"NORMAL"),color:new Vr.Attribute("color","float",4,"COLOR")}}}),{resetOffset:function(){this._vertexOffset=0,this._faceOffset=0},setQuadCount:function(e){var t=this.attributes,r=this.getQuadVertexCount()*e,i=this.getQuadTriangleCount()*e;this.vertexCount!==r&&(t.position.init(r),t.normal.init(r),t.color.init(r)),this.triangleCount!==i&&(this.indices=r>65535?new Uint32Array(3*i):new Uint16Array(3*i))},getQuadVertexCount:function(){return 4},getQuadTriangleCount:function(){return 2},addQuad:function(){var e=ko.create(),t=ko.create(),r=ko.create(),i=[0,3,1,3,2,1];return function(n,a){var o=this.attributes.position,s=this.attributes.normal,l=this.attributes.color;ko.sub(e,n[1],n[0]),ko.sub(t,n[2],n[1]),ko.cross(r,e,t),ko.normalize(r,r);for(var h=0;h<4;h++)o.set(this._vertexOffset+h,n[h]),l.set(this._vertexOffset+h,a),s.set(this._vertexOffset+h,r);var u=3*this._faceOffset;for(h=0;h<6;h++)this.indices[u+h]=i[h]+this._vertexOffset;this._vertexOffset+=4,this._faceOffset+=2}}()});i.util.defaults(Vo.prototype,Lo);const Ho=Vo;var Wo=Mn,jo={x:0,y:2,z:1};function Xo(e,t,r){this.rootNode=new Ka.Node;var i=new Ka.Mesh({geometry:new Ro({useNativeLine:!1}),material:t,castShadow:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:1}),n=new Ka.Mesh({geometry:new Ho,material:r,castShadow:!1,culling:!1,ignorePicking:!0,$ignorePicking:!0,renderOrder:0});this.rootNode.add(n),this.rootNode.add(i),this.faceInfo=e,this.plane=new Ka.Plane,this.linesMesh=i,this.quadsMesh=n}Xo.prototype.update=function(e,t,r){var i=e.coordinateSystem,n=[i.getAxis(this.faceInfo[0]),i.getAxis(this.faceInfo[1])],a=this.linesMesh.geometry,o=this.quadsMesh.geometry;a.convertToDynamicArray(!0),o.convertToDynamicArray(!0),this._updateSplitLines(a,n,e,r),this._udpateSplitAreas(o,n,e,r),a.convertToTypedArray(),o.convertToTypedArray();var s=i.getAxis(this.faceInfo[2]);!function(e,t,r,i){var n=[0,0,0],a=i<0?r.getExtentMin():r.getExtentMax();n[jo[r.dim]]=a,e.position.setArray(n),e.rotation.identity(),t.distance=-Math.abs(a),t.normal.set(0,0,0),"x"===r.dim?(e.rotation.rotateY(i*Math.PI/2),t.normal.x=-i):"z"===r.dim?(e.rotation.rotateX(-i*Math.PI/2),t.normal.y=-i):(i>0&&e.rotation.rotateY(Math.PI),t.normal.z=-i)}(this.rootNode,this.plane,s,this.faceInfo[3])},Xo.prototype._updateSplitLines=function(e,t,r,n){var a=n.getDevicePixelRatio();t.forEach((function(n,o){var s=n.model,l=t[1-o].getExtent();if(!n.scale.isBlank()){var h=s.getModel("splitLine",r.getModel("splitLine"));if(h.get("show")){var u=h.getModel("lineStyle"),c=u.get("color"),d=Wo(u.get("opacity"),1),f=Wo(u.get("width"),1);c=i.util.isArray(c)?c:[c];for(var p=n.getTicksCoords({tickModel:h}),m=0,g=0;g65535?new Uint32Array(3*r):new Uint16Array(3*r))},setSpriteAlign:function(e,t,r,i,n){var a,o,s,l;switch(null==r&&(r="left"),null==i&&(i="top"),n=n||0,r){case"left":a=n,s=t[0]+n;break;case"center":case"middle":a=-t[0]/2,s=t[0]/2;break;case"right":a=-t[0]-n,s=-n}switch(i){case"bottom":o=n,l=t[1]+n;break;case"middle":o=-t[1]/2,l=t[1]/2;break;case"top":o=-t[1]-n,l=-n}var h=4*e,u=this.attributes.offset;u.set(h,[a,l]),u.set(h+1,[s,l]),u.set(h+2,[s,o]),u.set(h+3,[a,o])},addSprite:function(e,t,r,i,n,a){var o=this._vertexOffset;this.setSprite(this._vertexOffset/4,e,t,r,i,n,a);for(var s=0;s 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end";var ns=Mn;Ka.Shader.import(is);var as={x:0,y:2,z:1};const os=i.ComponentView.extend({type:"grid3D",__ecgl__:!0,init:function(e,t){var r=new Ka.Material({shader:Ka.createShader("ecgl.color"),depthMask:!1,transparent:!0}),i=new Ka.Material({shader:Ka.createShader("ecgl.meshLines3D"),depthMask:!1,transparent:!0});r.define("fragment","DOUBLE_SIDED"),r.define("both","VERTEX_COLOR"),this.groupGL=new Ka.Node,this._control=new Do({zr:t.getZr()}),this._control.init(),this._faces=[["y","z","x",-1,"left"],["y","z","x",1,"right"],["x","y","z",-1,"bottom"],["x","y","z",1,"top"],["x","z","y",-1,"far"],["x","z","y",1,"near"]].map((function(e){var t=new qo(e,i,r);return this.groupGL.add(t.rootNode),t}),this),this._axes=["x","y","z"].map((function(e){var t=new rs(e,i);return this.groupGL.add(t.rootNode),t}),this);var n=t.getDevicePixelRatio();this._axisLabelSurface=new zo({width:256,height:256,devicePixelRatio:n}),this._axisLabelSurface.onupdate=function(){t.getZr().refresh()},this._axisPointerLineMesh=new Ka.Mesh({geometry:new Ro({useNativeLine:!1}),material:i,castShadow:!1,ignorePicking:!0,renderOrder:3}),this.groupGL.add(this._axisPointerLineMesh),this._axisPointerLabelsSurface=new zo({width:128,height:128,devicePixelRatio:n}),this._axisPointerLabelsMesh=new Qo({ignorePicking:!0,renderOrder:4,castShadow:!1}),this._axisPointerLabelsMesh.material.set("textureAtlas",this._axisPointerLabelsSurface.getTexture()),this.groupGL.add(this._axisPointerLabelsMesh),this._lightRoot=new Ka.Node,this._sceneHelper=new Uo,this._sceneHelper.initLight(this._lightRoot)},render:function(e,t,r){this._model=e,this._api=r;var i=e.coordinateSystem;i.viewGL.add(this._lightRoot),e.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL);var n=this._control;n.setViewGL(i.viewGL);var a=e.getModel("viewControl");n.setFromViewControlModel(a,0),this._axisLabelSurface.clear(),n.off("update"),e.get("show")&&(this._faces.forEach((function(i){i.update(e,t,r)}),this),this._axes.forEach((function(t){t.update(e,this._axisLabelSurface,r)}),this)),n.on("update",this._onCameraChange.bind(this,e,r),this),this._sceneHelper.setScene(i.viewGL.scene),this._sceneHelper.updateLight(e),i.viewGL.setPostEffect(e.getModel("postEffect"),r),i.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._initMouseHandler(e)},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r)},showAxisPointer:function(e,t,r,i){this._doShowAxisPointer(),this._updateAxisPointer(i.value)},hideAxisPointer:function(e,t,r,i){this._doHideAxisPointer()},_initMouseHandler:function(e){var t=e.coordinateSystem.viewGL;e.get("show")&&e.get("axisPointer.show")?t.on("mousemove",this._updateAxisPointerOnMousePosition,this):t.off("mousemove",this._updateAxisPointerOnMousePosition)},_updateAxisPointerOnMousePosition:function(e){if(!e.target){for(var t,r=this._model.coordinateSystem,i=r.viewGL,n=i.castRay(e.offsetX,e.offsetY,new Ka.Ray),a=0;ai[1]?0:1,o=this._faces[2*r+a],s=this._faces[2*r+1-a];o.rootNode.invisible=!0,s.rootNode.invisible=!1}},_updateAxisLinePosition:function(){var e=this._model.coordinateSystem,t=e.getAxis("x"),r=e.getAxis("y"),i=e.getAxis("z"),n=i.getExtentMax(),a=i.getExtentMin(),o=t.getExtentMin(),s=t.getExtentMax(),l=r.getExtentMax(),h=r.getExtentMin(),u=this._axes[0].rootNode,c=this._axes[1].rootNode,d=this._axes[2].rootNode,f=this._faces,p=f[4].rootNode.invisible?h:l,m=f[2].rootNode.invisible?n:a,g=f[0].rootNode.invisible?o:s,_=f[2].rootNode.invisible?n:a,v=f[0].rootNode.invisible?s:o,y=f[4].rootNode.invisible?h:l;u.rotation.identity(),c.rotation.identity(),d.rotation.identity(),f[4].rootNode.invisible&&(this._axes[0].flipped=!0,u.rotation.rotateX(Math.PI)),f[0].rootNode.invisible&&(this._axes[1].flipped=!0,c.rotation.rotateZ(Math.PI)),f[4].rootNode.invisible&&(this._axes[2].flipped=!0,d.rotation.rotateY(Math.PI)),u.position.set(0,m,p),c.position.set(g,_,0),d.position.set(v,0,y),u.update(),c.update(),d.update(),this._updateAxisLabelAlign()},_updateAxisLabelAlign:function(){var e=this._control.getCamera(),t=[new Ka.Vector4,new Ka.Vector4],r=new Ka.Vector4;this.groupGL.getWorldPosition(r),r.w=1,r.transformMat4(e.viewMatrix).transformMat4(e.projectionMatrix),r.x/=r.w,r.y/=r.w,this._axes.forEach((function(i){for(var n=i.axisLineCoords,a=(i.labelsMesh.geometry,0);ar.y?"bottom":"top"):(s="middle",o=u>r.x?"left":"right"),i.setSpriteAlign(o,s,this._api)}),this)},_doShowAxisPointer:function(){this._axisPointerLineMesh.invisible&&(this._axisPointerLineMesh.invisible=!1,this._axisPointerLabelsMesh.invisible=!1,this._api.getZr().refresh())},_doHideAxisPointer:function(){this._axisPointerLineMesh.invisible||(this._axisPointerLineMesh.invisible=!0,this._axisPointerLabelsMesh.invisible=!0,this._api.getZr().refresh())},_updateAxisPointer:function(e){var t=this._model.coordinateSystem,r=t.dataToPoint(e),i=this._axisPointerLineMesh.geometry,n=this._model.getModel("axisPointer"),a=this._api.getDevicePixelRatio();function o(e){return Mn(e.model.get("axisPointer.show"),n.get("show"))}function s(e){var t=e.model.getModel("axisPointer",n).getModel("lineStyle"),r=Ka.parseColor(t.get("color")),i=ns(t.get("width"),1),a=ns(t.get("opacity"),1);return r[3]*=a,{color:r,lineWidth:i}}i.convertToDynamicArray(!0);for(var l=0;lp&&(p=y,mp&&(p=x,_=r.x&&e<=r.x+r.width&&t>=r.y&&t<=r.y+r.height},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(t){e.copy(this,t)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return 0===this.width||0===this.height},e.create=function(t){return new e(t.x,t.y,t.width,t.height)},e.copy=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},e.applyTransform=function(t,r,i){if(i){if(i[1]<1e-5&&i[1]>-1e-5&&i[2]<1e-5&&i[2]>-1e-5){var n=i[0],a=i[3],o=i[4],s=i[5];return t.x=r.x*n+o,t.y=r.y*a+s,t.width=r.width*n,t.height=r.height*a,t.width<0&&(t.x+=t.width,t.width=-t.width),void(t.height<0&&(t.y+=t.height,t.height=-t.height))}gs.x=vs.x=r.x,gs.y=ys.y=r.y,_s.x=ys.x=r.x+r.width,_s.y=vs.y=r.y+r.height,gs.transform(i),ys.transform(i),_s.transform(i),vs.transform(i),t.x=ps(gs.x,_s.x,vs.x,ys.x),t.y=ps(gs.y,_s.y,vs.y,ys.y);var l=ms(gs.x,_s.x,vs.x,ys.x),h=ms(gs.y,_s.y,vs.y,ys.y);t.width=l-t.x,t.height=h-t.y}else t!==r&&e.copy(t,r)},e}();function Ts(e,t,r,i,n){var a=0,o=0;null==i&&(i=1/0),null==n&&(n=1/0);var s=0;t.eachChild((function(l,h){var u,c,d=l.getBoundingRect(),f=t.childAt(h+1),p=f&&f.getBoundingRect();if("horizontal"===e){var m=d.width+(p?-p.x+d.x:0);(u=a+m)>i||l.newline?(a=0,u=m,o+=s+r,s=d.height):s=Math.max(s,d.height)}else{var g=d.height+(p?-p.y+d.y:0);(c=o+g)>n||l.newline?(a+=s+r,o=0,c=g,s=d.width):s=Math.max(s,d.width)}l.newline||(l.x=a,l.y=o,l.markRedraw(),"horizontal"===e?a=u+r:o=c+r)}))}function Ss(e,t,r){r=function(e){if("number"==typeof e)return[e,e,e,e];var t=e.length;return 2===t?[e[0],e[1],e[0],e[1]]:3===t?[e[0],e[1],e[2],e[1]]:e}(r||0);var i=t.width,n=t.height,a=go(e.left,i),o=go(e.top,n),s=go(e.right,i),l=go(e.bottom,n),h=go(e.width,i),u=go(e.height,n),c=r[2]+r[0],d=r[1]+r[3],f=e.aspect;switch(isNaN(h)&&(h=i-s-d-a),isNaN(u)&&(u=n-l-c-o),null!=f&&(isNaN(h)&&isNaN(u)&&(f>i/n?h=.8*i:u=.8*n),isNaN(h)&&(h=f*u),isNaN(u)&&(u=h/f)),isNaN(a)&&(a=i-s-h-d),isNaN(o)&&(o=n-l-u-c),e.left||e.right){case"center":a=i/2-h/2-r[3];break;case"right":a=i-h-d}switch(e.top||e.bottom){case"middle":case"center":o=n/2-u/2-r[0];break;case"bottom":o=n-u-c}a=a||0,o=o||0,isNaN(h)&&(h=i-d-a-(s||0)),isNaN(u)&&(u=n-c-o-(l||0));var p=new ws(a+r[3],o+r[0],h,u);return p.margin=r,p}wa(Ts,"vertical"),wa(Ts,"horizontal");var Ms=function(){this._pool={},this._allocatedTextures=[]};Ms.prototype={constructor:Ms,get:function(e){var t=Cs(e);this._pool.hasOwnProperty(t)||(this._pool[t]=[]);var r=this._pool[t];if(!r.length){var i=new Dr(e);return this._allocatedTextures.push(i),i}return r.pop()},put:function(e){var t=Cs(e);this._pool.hasOwnProperty(t)||(this._pool[t]=[]),this._pool[t].push(e)},clear:function(e){for(var t=0;t 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n #endif\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n #ifdef SUPPORT_STANDARD_DERIVATIVES\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n #else\n depth += bias;\n #endif\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n@export clay.sm.debug_depth\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n@import clay.util.decode_float\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n@end\n@export clay.sm.distance.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\nattribute vec3 position : POSITION;\n@import clay.chunk.skinning_header\nvarying vec3 v_WorldPosition;\nvoid main (){\n vec4 P = vec4(position, 1.0);\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = skinMatrixWS * P;\n#endif\n#ifdef INSTANCING\n @import clay.chunk.instancing_matrix\n P = instanceMat * P;\n#endif\n gl_Position = worldViewProjection * P;\n v_WorldPosition = (world * P).xyz;\n}\n@end\n@export clay.sm.distance.fragment\nuniform vec3 lightPosition;\nuniform float range : 100;\nvarying vec3 v_WorldPosition;\n@import clay.util.encode_float\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n@export clay.plugin.shadow_map_common\n@import clay.util.decode_float\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n return shadowContrib / 9.0;\n#endif\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n@end\n@export clay.plugin.compute_shadow_map\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#endif\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\nuniform bool shadowEnabled : true;\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n@import clay.plugin.shadow_map_common\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n#ifdef SHADOW_CASCADE\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n float shadowContrib;\n shadowContribs[0] = 1.0;\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#else\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n@end");var Ns,Is,Rs,Bs,Fs,zs,Gs,Us=m.extend((function(){return{softShadow:Us.PCF,shadowBlur:1,lightFrustumBias:"auto",kernelPCF:new Float32Array([1,0,1,1,-1,1,0,1,-1,0,-1,-1,1,-1,0,-1]),precision:"highp",_lastRenderNotCastShadow:!1,_frameBuffer:new zi,_textures:{},_shadowMapNumber:{POINT_LIGHT:0,DIRECTIONAL_LIGHT:0,SPOT_LIGHT:0},_depthMaterials:{},_distanceMaterials:{},_receivers:[],_lightsCastShadow:[],_lightCameras:{},_lightMaterials:{},_texturePool:new Ds}}),(function(){this._gaussianPassH=new pn({fragment:Xe.source("clay.compositor.gaussian_blur")}),this._gaussianPassV=new pn({fragment:Xe.source("clay.compositor.gaussian_blur")}),this._gaussianPassH.setUniform("blurSize",this.shadowBlur),this._gaussianPassH.setUniform("blurDir",0),this._gaussianPassV.setUniform("blurSize",this.shadowBlur),this._gaussianPassV.setUniform("blurDir",1),this._outputDepthPass=new pn({fragment:Xe.source("clay.sm.debug_depth")})}),{render:function(e,t,r,i){r||(r=t.getMainCamera()),this.trigger("beforerender",this,e,t,r),this._renderShadowPass(e,t,r,i),this.trigger("afterrender",this,e,t,r)},renderDebug:function(e,t){e.saveClear();var r=e.viewport,i=0,n=t||r.width/4,a=n;for(var o in this.softShadow===Us.VSM?this._outputDepthPass.material.define("fragment","USE_VSM"):this._outputDepthPass.material.undefine("fragment","USE_VSM"),this._textures){var s=this._textures[o];e.setViewport(i,0,n*s.width/s.height,a),this._outputDepthPass.setUniform("depthMap",s),this._outputDepthPass.render(e),i+=n*s.width/s.height}e.setViewport(r),e.restoreClear()},_updateReceivers:function(e,t){if(t.receiveShadow?(this._receivers.push(t),t.material.set("shadowEnabled",1),t.material.set("pcfKernel",this.kernelPCF)):t.material.set("shadowEnabled",0),this.softShadow===Us.VSM)t.material.define("fragment","USE_VSM"),t.material.undefine("fragment","PCF_KERNEL_SIZE");else{t.material.undefine("fragment","USE_VSM");var r=this.kernelPCF;r&&r.length?t.material.define("fragment","PCF_KERNEL_SIZE",r.length/2):t.material.undefine("fragment","PCF_KERNEL_SIZE")}},_update:function(e,t){var r=this;t.traverse((function(t){t.isRenderable()&&r._updateReceivers(e,t)}));for(var i=0;i4){console.warn("Support at most 4 cascade");continue}p.shadowCascade>1&&(o=p),this.renderDirectionalLightShadow(e,t,r,p,c,u,h)}else"SPOT_LIGHT"===p.type?this.renderSpotLightShadow(e,t,p,l,s):"POINT_LIGHT"===p.type&&this.renderPointLightShadow(e,t,p,d);this._shadowMapNumber[p.type]++}for(var m in this._shadowMapNumber){var g=this._shadowMapNumber[m],_=m+"_SHADOWMAP_COUNT";for(f=0;f0?v.define("fragment",_,g):v.isDefined("fragment",_)&&v.undefine("fragment",_))}for(f=0;f0){var x=h.map(S);if(y.directionalLightShadowMaps={value:h,type:"tv"},y.directionalLightMatrices={value:u,type:"m4v"},y.directionalLightShadowMapSizes={value:x,type:"1fv"},o){var b=c.slice(),w=c.slice();b.pop(),w.shift(),b.reverse(),w.reverse(),u.reverse(),y.shadowCascadeClipsNear={value:b,type:"1fv"},y.shadowCascadeClipsFar={value:w,type:"1fv"}}}if(s.length>0){var T=s.map(S);(y=t.shadowUniforms).spotLightShadowMaps={value:s,type:"tv"},y.spotLightMatrices={value:l,type:"m4v"},y.spotLightShadowMapSizes={value:T,type:"1fv"}}d.length>0&&(y.pointLightShadowMaps={value:d,type:"tv"})}function S(e){return e.height}},renderDirectionalLightShadow:(Ns=new si,Is=new Ht,Rs=new ir,Bs=new Ht,Fs=new Ht,zs=new Ht,Gs=new Ht,function(e,t,r,i,n,a,o){var s=this._getDepthMaterial(i),l={getMaterial:function(e){return e.shadowDepthMaterial||s},isMaterialChanged:Os,getUniform:Ps,ifRender:function(e){return e.castShadow},sortCompare:ut.opaqueSortCompare};if(!t.viewBoundingBoxLastFrame.isFinite()){var h=t.getBoundingBox();t.viewBoundingBoxLastFrame.copy(h).applyTransform(r.viewMatrix)}var u=Math.min(-t.viewBoundingBoxLastFrame.min.z,r.far),c=Math.max(-t.viewBoundingBoxLastFrame.max.z,r.near),d=this._getDirectionalLightCamera(i,t,r),f=zs.array;Gs.copy(d.projectionMatrix),Ye.invert(Fs.array,d.worldTransform.array),Ye.multiply(Fs.array,Fs.array,r.worldTransform.array),Ye.multiply(f,Gs.array,Fs.array);for(var p=[],m=r instanceof Ei,g=(r.near+r.far)/(r.near-r.far),_=2*r.near*r.far/(r.near-r.far),v=0;v<=i.shadowCascade;v++){var y=c*Math.pow(u/c,v/i.shadowCascade),x=c+(u-c)*v/i.shadowCascade,b=y*i.cascadeSplitLogFactor+x*(1-i.cascadeSplitLogFactor);p.push(b),n.push(-(-b*g+_)/-b)}var w=this._getTexture(i,i.shadowCascade);o.push(w);var T=e.viewport,S=e.gl;for(this._frameBuffer.attach(w),this._frameBuffer.bind(e),S.clear(S.COLOR_BUFFER_BIT|S.DEPTH_BUFFER_BIT),v=0;vd?s>f?p[n>0?"px":"nx"]=!0:p[o>0?"pz":"nz"]=!0:d>f?p[a>0?"py":"ny"]=!0:p[o>0?"pz":"nz"]=!0}for(r=0;r0&&(this.outputs[e].keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e]))}}),Hs=m.extend((function(){return{nodes:[]}}),{dirty:function(){this._dirty=!0},addNode:function(e){this.nodes.indexOf(e)>=0||(this.nodes.push(e),this._dirty=!0)},removeNode:function(e){"string"==typeof e&&(e=this.getNodeByName(e));var t=this.nodes.indexOf(e);t>=0&&(this.nodes.splice(t,1),this._dirty=!0)},getNodeByName:function(e){for(var t=0;t=r.COLOR_ATTACHMENT0&&u<=r.COLOR_ATTACHMENT0+8&&h.push(u);l.drawBuffersEXT(h)}e.saveClear(),e.clearBit=16640,t=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ),e.restoreClear(),i.unbind(e)}else t=e.render(this.scene,this.camera,!this.autoUpdateScene,this.preZ);this.trigger("afterrender",t),this._rendering=!1,this._rendered=!0}}),Xs=Vs.extend((function(){return{texture:null,outputs:{color:{}}}}),(function(){}),{getOutput:function(e,t){return this.texture},beforeFrame:function(){},afterFrame:function(){}}),qs=Vs.extend((function(){return{name:"",inputs:{},outputs:null,shader:"",inputLinks:{},outputLinks:{},pass:null,_prevOutputTextures:{},_outputTextures:{},_outputReferences:{},_rendering:!1,_rendered:!1,_compositor:null}}),(function(){var e=new pn({fragment:this.shader});this.pass=e}),{render:function(e,t){this.trigger("beforerender",e),this._rendering=!0;var r=e.gl;for(var i in this.inputLinks){var n=(c=this.inputLinks[i]).node.getOutput(e,c.pin);this.pass.setUniform(i,n)}if(this.outputs){this.pass.outputs={};var a={};for(var o in this.outputs){var s=this.updateParameter(o,e);isNaN(s.width)&&this.updateParameter(o,e);var l=this.outputs[o],h=this._compositor.allocateTexture(s);this._outputTextures[o]=h,"string"==typeof(u=l.attachment||r.COLOR_ATTACHMENT0)&&(u=r[u]),a[u]=h}for(var u in this._compositor.getFrameBuffer().bind(e),a)this._compositor.getFrameBuffer().attach(a[u],u);this.pass.render(e),this._compositor.getFrameBuffer().updateMipmap(e)}else this.pass.outputs=null,this._compositor.getFrameBuffer().unbind(e),this.pass.render(e,t);for(var i in this.inputLinks){var c;(c=this.inputLinks[i]).node.removeReference(c.pin)}this._rendering=!1,this._rendered=!0,this.trigger("afterrender",e)},updateParameter:function(e,t){var r,i,n=this.outputs[e],a=n.parameters,o=n._parametersCopy;if(o||(o=n._parametersCopy={}),a)for(var s in a)"width"!==s&&"height"!==s&&(o[s]=a[s]);return r="function"==typeof a.width?a.width.call(this,t):a.width,i="function"==typeof a.height?a.height.call(this,t):a.height,r=Math.ceil(r),i=Math.ceil(i),o.width===r&&o.height===i||this._outputTextures[e]&&this._outputTextures[e].dispose(t),o.width=r,o.height=i,o},setParameter:function(e,t){this.pass.setUniform(e,t)},getParameter:function(e){return this.pass.getUniform(e)},setParameters:function(e){for(var t in e)this.setParameter(t,e[t])},define:function(e,t){this.pass.material.define("fragment",e,t)},undefine:function(e){this.pass.material.undefine("fragment",e)},removeReference:function(e){this._outputReferences[e]--,0===this._outputReferences[e]&&(this.outputs[e].keepLastFrame?(this._prevOutputTextures[e]&&this._compositor.releaseTexture(this._prevOutputTextures[e]),this._prevOutputTextures[e]=this._outputTextures[e]):this._compositor.releaseTexture(this._outputTextures[e]))},clear:function(){Vs.prototype.clear.call(this),this.pass.material.disableTexturesAll()}}),Zs="@export clay.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n@export clay.compositor.kernel.gaussian_13\nfloat gaussianKernel[13];\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n@end\n@export clay.compositor.gaussian_blur\n#define SHADER_NAME gaussian_blur\nuniform sampler2D texture;varying vec2 v_Texcoord;\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main (void)\n{\n @import clay.compositor.kernel.gaussian_9\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n@end\n",Ys="\n@export clay.compositor.lut\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform sampler2D lookup;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n float blueColor = tex.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n@end",Ks="@export clay.compositor.output\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = tex.rgb;\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n gl_FragColor = encodeHDR(gl_FragColor);\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",Qs="@export clay.compositor.bright\nuniform sampler2D texture;\nuniform float threshold : 1;\nuniform float scale : 1.0;\nuniform vec2 textureSize: [512, 512];\nvarying vec2 v_Texcoord;\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n#endif\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n gl_FragColor = encodeHDR(color);\n}\n@end\n",Js="@export clay.compositor.downsample\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n@import clay.util.clamp_sample\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n gl_FragColor = encodeHDR(color);\n}\n@end",$s="\n@export clay.compositor.upsample\n#define HIGH_QUALITY\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nuniform float sampleScale: 0.5;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main()\n{\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n@end",el="@export clay.compositor.hdr.composite\n#define TONEMAPPING\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\nvarying vec2 v_Texcoord;\n@import clay.util.srgb\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n texel.a = min(texel.a, 1.0);\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n#ifdef TONEMAPPING\n texel.rgb *= exposureBias;\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n texel = linearTosRGB(texel);\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n gl_FragColor = encodeHDR(texel);\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end",tl="@export clay.compositor.blend\n#define SHADER_NAME blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n gl_FragColor = encodeHDR(tex);\n}\n@end",rl="@export clay.compositor.fxaa\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\nvarying vec2 v_Texcoord;\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n@import clay.util.rgbm\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n float lumaB = dot( rgbB, luma );\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n }\n else {\n gl_FragColor = vec4( rgbB, opacity );\n }\n}\n@end";!function(e){e.import("@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end"),e.import(Zs),e.import("@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end"),e.import(Ys),e.import("@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end"),e.import(Ks),e.import(Qs),e.import(Js),e.import($s),e.import(el),e.import("@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end"),e.import(tl),e.import(rl)}(Xe);var il=/^#source\((.*?)\)/;function nl(e,t,r){var i,n,a,o,s=e.type||"filter";if("filter"===s){var l=e.shader.trim(),h=il.exec(l);if(h?i=Xe.source(h[1].trim()):"#"===l.charAt(0)&&(i=t.shaders[l.substr(1)]),i||(i=l),!i)return}if(e.inputs)for(var u in n={},e.inputs)"string"==typeof e.inputs[u]?n[u]=e.inputs[u]:n[u]={node:e.inputs[u].node,pin:e.inputs[u].pin};if(e.outputs)for(var u in a={},e.outputs){var c=e.outputs[u];a[u]={},null!=c.attachment&&(a[u].attachment=c.attachment),null!=c.keepLastFrame&&(a[u].keepLastFrame=c.keepLastFrame),null!=c.outputLastFrame&&(a[u].outputLastFrame=c.outputLastFrame),c.parameters&&(a[u].parameters=sl(c.parameters))}if(o="scene"===s?new js({name:e.name,scene:r.scene,camera:r.camera,outputs:a}):"texture"===s?new Xs({name:e.name,outputs:a}):new qs({name:e.name,shader:i,inputs:n,outputs:a})){if(e.parameters)for(var u in e.parameters)"string"==typeof(d=e.parameters[u])?"#"===(d=d.trim()).charAt(0)?d=t.textures[d.substr(1)]:o.on("beforerender",ll(u,hl(d))):"function"==typeof d&&o.on("beforerender",d),o.setParameter(u,d);if(e.defines&&o.pass)for(var u in e.defines){var d=e.defines[u];o.pass.material.define("fragment",u,d)}}return o}function al(e,t){return e}function ol(e,t){return t}function sl(e){var t={};if(!e)return t;["type","minFilter","magFilter","wrapS","wrapT","flipY","useMipmap"].forEach((function(r){var i=e[r];null!=i&&("string"==typeof i&&(i=wr[i]),t[r]=i)}));var r=e.scale||1;return["width","height"].forEach((function(i){if(null!=e[i]){var n=e[i];"string"==typeof n?(n=n.trim(),t[i]=(a=hl(n),o=(o=r)||1,function(e){var t=e.getDevicePixelRatio(),r=e.getWidth()*o,i=e.getHeight()*o;return a(r,i,t)})):t[i]=n}var a,o})),t.width||(t.width=al),t.height||(t.height=ol),null!=e.useMipmap&&(t.useMipmap=e.useMipmap),t}function ll(e,t){return function(r){var i=r.getDevicePixelRatio(),n=r.getWidth(),a=r.getHeight(),o=t(n,a,i);this.setParameter(e,o)}}function hl(e){var t=/^expr\((.*)\)$/.exec(e);if(t)try{var r=new Function("width","height","dpr","return "+t[1]);return r(1,1),r}catch(e){throw new Error("Invalid expression.")}}const ul=function(e,t){for(var r=0,i=1/t,n=e;n>0;)r+=i*(n%t),n=Math.floor(n/t),i/=t;return r};function cl(e){for(var t=new Uint8Array(e*e*4),r=0,i=new vt,n=0;n 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n#define SHADER_NAME SSAO_BLUR\n\nuniform sampler2D ssaoTexture;\n\n#ifdef NORMALTEX_ENABLED\nuniform sampler2D normalTex;\n#endif\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\nuniform int direction: 0.0;\n\n#ifdef DEPTHTEX_ENABLED\nuniform sampler2D depthTex;\nuniform mat4 projection;\nuniform float depthRange : 0.5;\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n#endif\n\nvoid main()\n{\n float kernel[5];\n kernel[0] = 0.122581;\n kernel[1] = 0.233062;\n kernel[2] = 0.288713;\n kernel[3] = 0.233062;\n kernel[4] = 0.122581;\n\n vec2 off = vec2(0.0);\n if (direction == 0) {\n off[0] = blurSize / textureSize.x;\n }\n else {\n off[1] = blurSize / textureSize.y;\n }\n\n vec2 coord = v_Texcoord;\n\n float sum = 0.0;\n float weightAll = 0.0;\n\n#ifdef NORMALTEX_ENABLED\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\n#endif\n#if defined(DEPTHTEX_ENABLED)\n float centerDepth = getLinearDepth(v_Texcoord);\n#endif\n\n for (int i = 0; i < 5; i++) {\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\n\n float w = kernel[i];\n#ifdef NORMALTEX_ENABLED\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\n#endif\n#ifdef DEPTHTEX_ENABLED\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\n#endif\n\n weightAll += w;\n sum += texture2D(ssaoTexture, coord).r * w;\n }\n\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\n}\n\n@end\n"),pl.prototype.setDepthTexture=function(e){this._depthTex=e},pl.prototype.setNormalTexture=function(e){this._normalTex=e,this._ssaoPass.material[e?"enableTexture":"disableTexture"]("normalTex"),this.setKernelSize(this._kernelSize)},pl.prototype.update=function(e,t,r){var i=e.getWidth(),n=e.getHeight(),a=this._ssaoPass,o=this._blurPass;a.setUniform("kernel",this._kernels[r%this._kernels.length]),a.setUniform("depthTex",this._depthTex),null!=this._normalTex&&a.setUniform("normalTex",this._normalTex),a.setUniform("depthTexSize",[this._depthTex.width,this._depthTex.height]);var s=new Ht;Ht.transpose(s,t.worldTransform),a.setUniform("projection",t.projectionMatrix.array),a.setUniform("projectionInv",t.invProjectionMatrix.array),a.setUniform("viewInverseTranspose",s.array);var l=this._ssaoTexture,h=this._blurTexture,u=this._blurTexture2;l.width=i/2,l.height=n/2,h.width=i,h.height=n,u.width=i,u.height=n,this._framebuffer.attach(l),this._framebuffer.bind(e),e.gl.clearColor(1,1,1,1),e.gl.clear(e.gl.COLOR_BUFFER_BIT),a.render(e),o.setUniform("textureSize",[i/2,n/2]),o.setUniform("projection",t.projectionMatrix.array),this._framebuffer.attach(h),o.setUniform("direction",0),o.setUniform("ssaoTexture",l),o.render(e),this._framebuffer.attach(u),o.setUniform("textureSize",[i,n]),o.setUniform("direction",1),o.setUniform("ssaoTexture",h),o.render(e),this._framebuffer.unbind(e);var c=e.clearColor;e.gl.clearColor(c[0],c[1],c[2],c[3])},pl.prototype.getTargetTexture=function(){return this._blurTexture2},pl.prototype.setParameter=function(e,t){"noiseTexSize"===e?this.setNoiseSize(t):"kernelSize"===e?this.setKernelSize(t):"intensity"===e?this._ssaoPass.material.set("intensity",t):this._ssaoPass.setUniform(e,t)},pl.prototype.setKernelSize=function(e){this._kernelSize=e,this._ssaoPass.material.define("fragment","KERNEL_SIZE",e),this._kernels=this._kernels||[];for(var t=0;t<30;t++)this._kernels[t]=fl(e,t*e,!!this._normalTex)},pl.prototype.setNoiseSize=function(e){var t=this._ssaoPass.getUniform("noiseTex");t?(t.data=cl(e),t.width=t.height=e,t.dirty()):(t=dl(e),this._ssaoPass.setUniform("noiseTex",dl(e))),this._ssaoPass.setUniform("noiseTexSize",[e,e])},pl.prototype.dispose=function(e){this._blurTexture.dispose(e),this._ssaoTexture.dispose(e),this._blurTexture2.dispose(e)};const ml=pl;function gl(e){e=e||{},this._ssrPass=new pn({fragment:Xe.source("ecgl.ssr.main"),clearColor:[0,0,0,0]}),this._blurPass1=new pn({fragment:Xe.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blurPass2=new pn({fragment:Xe.source("ecgl.ssr.blur"),clearColor:[0,0,0,0]}),this._blendPass=new pn({fragment:Xe.source("clay.compositor.blend")}),this._blendPass.material.disableTexturesAll(),this._blendPass.material.enableTexture(["texture1","texture2"]),this._ssrPass.setUniform("gBufferTexture1",e.normalTexture),this._ssrPass.setUniform("gBufferTexture2",e.depthTexture),this._blurPass1.setUniform("gBufferTexture1",e.normalTexture),this._blurPass1.setUniform("gBufferTexture2",e.depthTexture),this._blurPass2.setUniform("gBufferTexture1",e.normalTexture),this._blurPass2.setUniform("gBufferTexture2",e.depthTexture),this._blurPass2.material.define("fragment","VERTICAL"),this._blurPass2.material.define("fragment","BLEND"),this._ssrTexture=new Dr({type:wr.HALF_FLOAT}),this._texture2=new Dr({type:wr.HALF_FLOAT}),this._texture3=new Dr({type:wr.HALF_FLOAT}),this._prevTexture=new Dr({type:wr.HALF_FLOAT}),this._currentTexture=new Dr({type:wr.HALF_FLOAT}),this._frameBuffer=new zi({depthBuffer:!1}),this._normalDistribution=null,this._totalSamples=256,this._samplePerFrame=4,this._ssrPass.material.define("fragment","SAMPLE_PER_FRAME",this._samplePerFrame),this._ssrPass.material.define("fragment","TOTAL_SAMPLES",this._totalSamples),this._downScale=1}Xe.import("@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"),gl.prototype.setAmbientCubemap=function(e,t){this._ssrPass.material.set("specularCubemap",e),this._ssrPass.material.set("specularIntensity",t);var r=e&&t;this._ssrPass.material[r?"enableTexture":"disableTexture"]("specularCubemap")},gl.prototype.update=function(e,t,r,i){var n=e.getWidth(),a=e.getHeight(),o=this._ssrTexture,s=this._texture2,l=this._texture3;o.width=this._prevTexture.width=this._currentTexture.width=n/this._downScale,o.height=this._prevTexture.height=this._currentTexture.height=a/this._downScale,s.width=l.width=n,s.height=l.height=a;var h=this._frameBuffer,u=this._ssrPass,c=this._blurPass1,d=this._blurPass2,f=this._blendPass,p=new Ht,m=new Ht;Ht.transpose(p,t.worldTransform),Ht.transpose(m,t.viewMatrix),u.setUniform("sourceTexture",r),u.setUniform("projection",t.projectionMatrix.array),u.setUniform("projectionInv",t.invProjectionMatrix.array),u.setUniform("toViewSpace",p.array),u.setUniform("toWorldSpace",m.array),u.setUniform("nearZ",t.near);var g=i/this._totalSamples*this._samplePerFrame;if(u.setUniform("jitterOffset",g),u.setUniform("sampleOffset",i*this._samplePerFrame),c.setUniform("textureSize",[o.width,o.height]),d.setUniform("textureSize",[n,a]),d.setUniform("sourceTexture",r),c.setUniform("projection",t.projectionMatrix.array),d.setUniform("projection",t.projectionMatrix.array),h.attach(o),h.bind(e),u.render(e),this._physicallyCorrect&&(h.attach(this._currentTexture),f.setUniform("texture1",this._prevTexture),f.setUniform("texture2",o),f.material.set({weight1:i>=1?.95:0,weight2:i>=1?.05:1}),f.render(e)),h.attach(s),c.setUniform("texture",this._physicallyCorrect?this._currentTexture:o),c.render(e),h.attach(l),d.setUniform("texture",s),d.render(e),h.unbind(e),this._physicallyCorrect){var _=this._prevTexture;this._prevTexture=this._currentTexture,this._currentTexture=_}},gl.prototype.getTargetTexture=function(){return this._texture3},gl.prototype.setParameter=function(e,t){"maxIteration"===e?this._ssrPass.material.define("fragment","MAX_ITERATION",t):this._ssrPass.setUniform(e,t)},gl.prototype.setPhysicallyCorrect=function(e){e?(this._normalDistribution||(this._normalDistribution=_n.generateNormalDistribution(64,this._totalSamples)),this._ssrPass.material.define("fragment","PHYSICALLY_CORRECT"),this._ssrPass.material.set("normalDistribution",this._normalDistribution),this._ssrPass.material.set("normalDistributionSize",[64,this._totalSamples])):this._ssrPass.material.undefine("fragment","PHYSICALLY_CORRECT"),this._physicallyCorrect=e},gl.prototype.setSSAOTexture=function(e){var t=this._blurPass2;e?(t.material.enableTexture("ssaoTex"),t.material.set("ssaoTex",e)):t.material.disableTexture("ssaoTex")},gl.prototype.isFinished=function(e){return!this._physicallyCorrect||e>this._totalSamples/this._samplePerFrame},gl.prototype.dispose=function(e){this._ssrTexture.dispose(e),this._texture2.dispose(e),this._texture3.dispose(e),this._prevTexture.dispose(e),this._currentTexture.dispose(e),this._frameBuffer.dispose(e)};const _l=gl,vl=[0,0,-.321585265978,-.154972575841,.458126042375,.188473391593,.842080129861,.527766490688,.147304551086,-.659453822776,-.331943915203,-.940619700594,.0479226680259,.54812163202,.701581552186,-.709825561388,-.295436780218,.940589268233,-.901489676764,.237713156085,.973570876096,-.109899459384,-.866792314779,-.451805525005,.330975007087,.800048655954,-.344275183665,.381779221166,-.386139432542,-.437418421534,-.576478634965,-.0148463392551,.385798197415,-.262426961053,-.666302061145,.682427250835,-.628010632582,-.732836215494,.10163141741,-.987658134403,.711995289051,-.320024291314,.0296005138058,.950296523438,.0130612307608,-.351024443122,-.879596633704,-.10478487883,.435712737232,.504254490347,.779203817497,.206477676721,.388264289969,-.896736162545,-.153106280781,-.629203242522,-.245517550697,.657969239148,.126830499058,.26862328493,-.634888119007,-.302301223431,.617074219636,.779817204925];function yl(e,t,r,i,n){var a=e.gl;t.setUniform(a,"1i",r,n),a.activeTexture(a.TEXTURE0+n),i.isRenderable()?i.bind(e):i.unbind(e)}function xl(e,t,r,i,n){var a,o,s,l,h=e.gl;return function(n,u,c){if(!l||l.material!==n.material){var d=n.material,f=n.__program,p=d.get("roughness");null==p&&(p=1);var m=d.get("normalMap")||t,g=d.get("roughnessMap"),_=d.get("bumpMap"),v=d.get("uvRepeat"),y=d.get("uvOffset"),x=d.get("detailUvRepeat"),b=d.get("detailUvOffset"),w=!!_&&d.isTextureEnabled("bumpMap"),T=!!g&&d.isTextureEnabled("roughnessMap"),S=d.isDefined("fragment","DOUBLE_SIDED");_=_||r,g=g||i,c!==u?(u.set("normalMap",m),u.set("bumpMap",_),u.set("roughnessMap",g),u.set("useBumpMap",w),u.set("useRoughnessMap",T),u.set("doubleSide",S),null!=v&&u.set("uvRepeat",v),null!=y&&u.set("uvOffset",y),null!=x&&u.set("detailUvRepeat",x),null!=b&&u.set("detailUvOffset",b),u.set("roughness",p)):(f.setUniform(h,"1f","roughness",p),a!==m&&yl(e,f,"normalMap",m,0),o!==_&&_&&yl(e,f,"bumpMap",_,1),s!==g&&g&&yl(e,f,"roughnessMap",g,2),null!=v&&f.setUniform(h,"2f","uvRepeat",v),null!=y&&f.setUniform(h,"2f","uvOffset",y),null!=x&&f.setUniform(h,"2f","detailUvRepeat",x),null!=b&&f.setUniform(h,"2f","detailUvOffset",b),f.setUniform(h,"1i","useBumpMap",+w),f.setUniform(h,"1i","useRoughnessMap",+T),f.setUniform(h,"1i","doubleSide",+S)),a=m,o=_,s=g,l=n}}}function bl(e){e=e||{},this._depthTex=new Dr({format:wr.DEPTH_COMPONENT,type:wr.UNSIGNED_INT}),this._normalTex=new Dr({type:wr.HALF_FLOAT}),this._framebuffer=new zi,this._framebuffer.attach(this._normalTex),this._framebuffer.attach(this._depthTex,zi.DEPTH_ATTACHMENT),this._normalMaterial=new le({shader:new Xe(Xe.source("ecgl.normal.vertex"),Xe.source("ecgl.normal.fragment"))}),this._normalMaterial.enableTexture(["normalMap","bumpMap","roughnessMap"]),this._defaultNormalMap=an.createBlank("#000"),this._defaultBumpMap=an.createBlank("#000"),this._defaultRoughessMap=an.createBlank("#000"),this._debugPass=new pn({fragment:Xe.source("clay.compositor.output")}),this._debugPass.setUniform("texture",this._normalTex),this._debugPass.material.undefine("fragment","OUTPUT_ALPHA")}Xe.import("@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"),bl.prototype.getDepthTexture=function(){return this._depthTex},bl.prototype.getNormalTexture=function(){return this._normalTex},bl.prototype.update=function(e,t,r){var i=e.getWidth(),n=e.getHeight(),a=this._depthTex,o=this._normalTex,s=this._normalMaterial;a.width=i,a.height=n,o.width=i,o.height=n;var l=t.getRenderList(r).opaque;this._framebuffer.bind(e),e.gl.clearColor(0,0,0,0),e.gl.clear(e.gl.COLOR_BUFFER_BIT|e.gl.DEPTH_BUFFER_BIT),e.gl.disable(e.gl.BLEND),e.renderPass(l,r,{getMaterial:function(){return s},ifRender:function(e){return e.renderNormal},beforeRender:xl(e,this._defaultNormalMap,this._defaultBumpMap,this._defaultRoughessMap,this._normalMaterial),sort:e.opaqueSortCompare}),this._framebuffer.unbind(e)},bl.prototype.renderDebug=function(e){this._debugPass.render(e)},bl.prototype.dispose=function(e){this._depthTex.dispose(e),this._normalTex.dispose(e)};const wl=bl;function Tl(e){e=e||{},this._edgePass=new pn({fragment:Xe.source("ecgl.edge")}),this._edgePass.setUniform("normalTexture",e.normalTexture),this._edgePass.setUniform("depthTexture",e.depthTexture),this._targetTexture=new Dr({type:wr.HALF_FLOAT}),this._frameBuffer=new zi,this._frameBuffer.attach(this._targetTexture)}Tl.prototype.update=function(e,t,r,i){var n=e.getWidth(),a=e.getHeight(),o=this._targetTexture;o.width=n,o.height=a;var s=this._frameBuffer;s.bind(e),this._edgePass.setUniform("projectionInv",t.invProjectionMatrix.array),this._edgePass.setUniform("textureSize",[n,a]),this._edgePass.setUniform("texture",r),this._edgePass.render(e),s.unbind(e)},Tl.prototype.getTargetTexture=function(){return this._targetTexture},Tl.prototype.setParameter=function(e,t){this._edgePass.setUniform(e,t)},Tl.prototype.dispose=function(e){this._targetTexture.dispose(e),this._frameBuffer.dispose(e)};const Sl=Tl,Ml={type:"compositor",nodes:[{name:"source",type:"texture",outputs:{color:{}}},{name:"source_half",shader:"#source(clay.compositor.downsample)",inputs:{texture:"source"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bright",shader:"#source(clay.compositor.bright)",inputs:{texture:"source_half"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{threshold:2,scale:4,textureSize:"expr([width * 1.0 / 2, height / 2])"}},{name:"bright_downsample_4",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 2, height / 2] )"}},{name:"bright_downsample_8",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 4, height / 4] )"}},{name:"bright_downsample_16",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 8, height / 8] )"}},{name:"bright_downsample_32",shader:"#source(clay.compositor.downsample)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 32)",height:"expr(height * 1.0 / 32)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0 / 16, height / 16] )"}},{name:"bright_upsample_16_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_32"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 32, height / 32] )"}},{name:"bright_upsample_16_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_16_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 16)",height:"expr(height * 1.0 / 16)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_16"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 16, height * 1.0 / 16] )"}},{name:"bright_upsample_8_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_8_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_8_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_8_blur_v",texture2:"bright_upsample_16_blur_v"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 8)",height:"expr(height * 1.0 / 8)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_4_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_8"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 8, height * 1.0 / 8] )"}},{name:"bright_upsample_4_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_4_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_4_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_4_blur_v",texture2:"bright_upsample_8_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 4)",height:"expr(height * 1.0 / 4)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_2_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_downsample_4"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 4, height * 1.0 / 4] )"}},{name:"bright_upsample_2_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_2_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_2_blend",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_2_blur_v",texture2:"bright_upsample_4_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0 / 2)",height:"expr(height * 1.0 / 2)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"bright_upsample_full_blur_h",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:0,textureSize:"expr( [width * 1.0 / 2, height * 1.0 / 2] )"}},{name:"bright_upsample_full_blur_v",shader:"#source(clay.compositor.gaussian_blur)",inputs:{texture:"bright_upsample_full_blur_h"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{blurSize:1,blurDir:1,textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"bloom_composite",shader:"#source(clay.compositor.blend)",inputs:{texture1:"bright_upsample_full_blur_v",texture2:"bright_upsample_2_blend"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{weight1:.3,weight2:.7}},{name:"coc",shader:"#source(ecgl.dof.coc)",outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{focalDist:50,focalRange:30}},{name:"dof_far_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"}},{name:"dof_near_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"source",coc:"coc"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_NEARFIELD:null}},{name:"dof_coc_blur",shader:"#source(ecgl.dof.diskBlur)",inputs:{texture:"coc"},outputs:{color:{parameters:{minFilter:"NEAREST",magFilter:"NEAREST",width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},parameters:{textureSize:"expr( [width * 1.0, height * 1.0] )"},defines:{BLUR_COC:null}},{name:"dof_composite",shader:"#source(ecgl.dof.composite)",inputs:{original:"source",blurred:"dof_far_blur",nearfield:"dof_near_blur",coc:"coc",nearcoc:"dof_coc_blur"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)",type:"HALF_FLOAT"}}}},{name:"composite",shader:"#source(clay.compositor.hdr.composite)",inputs:{texture:"source",bloom:"bloom_composite"},outputs:{color:{parameters:{width:"expr(width * 1.0)",height:"expr(height * 1.0)"}}},defines:{}},{name:"FXAA",shader:"#source(clay.compositor.fxaa)",inputs:{texture:"composite"}}]};function Al(e,t){return{color:{parameters:{width:e,height:t}}}}Xe.import(Zs),Xe.import(Ys),Xe.import(Ks),Xe.import(Qs),Xe.import(Js),Xe.import($s),Xe.import(el),Xe.import(tl),Xe.import(rl),Xe.import("@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end"),Xe.import("@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end");var El=["composite","FXAA"];function Cl(){this._width,this._height,this._dpr,this._sourceTexture=new Dr({type:wr.HALF_FLOAT}),this._depthTexture=new Dr({format:wr.DEPTH_COMPONENT,type:wr.UNSIGNED_INT}),this._framebuffer=new zi,this._framebuffer.attach(this._sourceTexture),this._framebuffer.attach(this._depthTexture,zi.DEPTH_ATTACHMENT),this._normalPass=new wl,this._compositor=function(e,t){var r=new Ws;t=t||{};var i={textures:{},parameters:{}};for(var n in e.parameters){var a=e.parameters[n];i.parameters[n]=sl(a)}return function(e,t,r,i){if(e.textures){var n={},a=0,o=!1,s=r.textureRootPath;f.each(e.textures,(function(e,t){var r,l=e.path,h=sl(e.parameters);if(Array.isArray(l)&&6===l.length)s&&(l=l.map((function(e){return f.relative2absolute(e,s)}))),r=new Ai(h);else{if("string"!=typeof l)return;s&&(l=f.relative2absolute(l,s)),r=new Dr(h)}r.load(l),a++,r.once("success",(function(){n[t]=r,0==--a&&(i(n),o=!0)}))})),0!==a||o||i(n)}else i({})}(e,0,t,(function(n){i.textures=n,function(n,a){for(var o=0;o=this._haltonSequence.length},render:function(e,t,r){var i=this._blendPass;0===this._frame?(i.setUniform("weight1",0),i.setUniform("weight2",1)):(i.setUniform("weight1",.9),i.setUniform("weight2",.1)),i.setUniform("texture1",this._prevFrameTex),i.setUniform("texture2",t||this._sourceTex),this._blendFb.attach(this._outputTex),this._blendFb.bind(e),i.render(e),this._blendFb.unbind(e),r||(this._outputPass.setUniform("texture",this._outputTex),this._outputPass.render(e));var n=this._prevFrameTex;this._prevFrameTex=this._outputTex,this._outputTex=n,this._frame++},dispose:function(e){this._sourceFb.dispose(e),this._blendFb.dispose(e),this._prevFrameTex.dispose(e),this._outputTex.dispose(e),this._sourceTex.dispose(e),this._outputPass.dispose(e),this._blendPass.dispose(e)}};const Pl=Ll;function Ol(e){e=e||"perspective",this.layer=null,this.scene=new vi,this.rootNode=this.scene,this.viewport={x:0,y:0,width:0,height:0},this.setProjection(e),this._compositor=new Dl,this._temporalSS=new Pl,this._shadowMapPass=new ks;for(var t=[],r=0,i=0;i<30;i++){for(var n=[],a=0;a<6;a++)n.push(4*ul(r,2)-2),n.push(4*ul(r,3)-2),r++;t.push(n)}this._pcfKernels=t,this.scene.on("beforerender",(function(e,t,r){this.needsTemporalSS()&&this._temporalSS.jitterProjection(e,r)}),this)}Ol.prototype.setProjection=function(e){var t=this.camera;t&&t.update(),"perspective"===e?this.camera instanceof Ei||(this.camera=new Ei,t&&this.camera.setLocalTransform(t.localTransform)):this.camera instanceof un||(this.camera=new un,t&&this.camera.setLocalTransform(t.localTransform)),this.camera.near=.1,this.camera.far=2e3},Ol.prototype.setViewport=function(e,t,r,i,n){this.camera instanceof Ei&&(this.camera.aspect=r/i),n=n||1,this.viewport.x=e,this.viewport.y=t,this.viewport.width=r,this.viewport.height=i,this.viewport.devicePixelRatio=n,this._compositor.resize(r*n,i*n),this._temporalSS.resize(r*n,i*n)},Ol.prototype.containPoint=function(e,t){var r=this.viewport;return t=this.layer.renderer.getHeight()-t,e>=r.x&&t>=r.y&&e<=r.x+r.width&&t<=r.y+r.height};var Nl=new _e;Ol.prototype.castRay=function(e,t,r){var i=this.layer.renderer,n=i.viewport;return i.viewport=this.viewport,i.screenToNDC(e,t,Nl),this.camera.castRay(Nl,r),i.viewport=n,r},Ol.prototype.prepareRender=function(){this.scene.update(),this.camera.update(),this.scene.updateLights();var e=this.scene.updateRenderList(this.camera);this._needsSortProgressively=!1;for(var t=0;t30},Ol.prototype._doRender=function(e,t,r){var i=this.scene,n=this.camera;r=r||0,this._updateTransparent(e,i,n,r),t||(this._shadowMapPass.kernelPCF=this._pcfKernels[0],this._shadowMapPass.render(e,i,n,!0)),this._updateShadowPCFKernel(r);var a,o=e.clearColor;e.gl.clearColor(o[0],o[1],o[2],o[3]),this._enablePostEffect&&(this.needsTemporalSS()&&this._temporalSS.jitterProjection(e,n),this._compositor.updateNormal(e,i,n,this._temporalSS.getFrame())),this._updateSSAO(e,i,n,this._temporalSS.getFrame()),this._enablePostEffect?((a=this._compositor.getSourceFrameBuffer()).bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT),e.render(i,n,!0,!0),a.unbind(e),this.needsTemporalSS()&&t?(this._compositor.composite(e,i,n,this._temporalSS.getSourceFrameBuffer(),this._temporalSS.getFrame()),e.setViewport(this.viewport),this._temporalSS.render(e)):(e.setViewport(this.viewport),this._compositor.composite(e,i,n,null,0))):this.needsTemporalSS()&&t?((a=this._temporalSS.getSourceFrameBuffer()).bind(e),e.saveClear(),e.clearBit=e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT,e.render(i,n,!0,!0),e.restoreClear(),a.unbind(e),e.setViewport(this.viewport),this._temporalSS.render(e)):(e.setViewport(this.viewport),e.render(i,n,!0,!0))},Ol.prototype._updateTransparent=function(e,t,r,i){for(var n=new vt,a=new Ht,o=r.getWorldPosition(),s=t.getRenderList(r).transparent,l=0;lthis.camera.far||e80*r){i=a=e[0],n=o=e[1];for(var p=r;pa&&(a=s),l>o&&(o=l);h=Math.max(a-i,o-n)}return nh(d,f,r,i,n,h),f}function rh(e,t,r,i,n){var a,o;if(n===Th(e,t,r,i)>0)for(a=t;a=t;a-=i)o=xh(a,e[a],e[a+1],o);return o&&gh(o,o.next)&&(bh(o),o=o.next),o}function ih(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!gh(i,i.next)&&0!==mh(i.prev,i,i.next))i=i.next;else{if(bh(i),(i=t=i.prev)===i.next)return null;r=!0}}while(r||i!==t);return t}function nh(e,t,r,i,n,a,o){if(e){!o&&a&&function(e,t,r,i){var n=e;do{null===n.z&&(n.z=ch(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,r,i,n,a,o,s,l,h=1;do{for(r=e,e=null,a=null,o=0;r;){for(o++,i=r,s=0,t=0;t0||l>0&&i;)0!==s&&(0===l||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,l--),a?a.nextZ=n:e=n,n.prevZ=a,a=n;r=i}a.nextZ=null,h*=2}while(o>1)}(n)}(e,i,n,a);for(var s,l,h=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?oh(e,i,n,a):ah(e))t.push(s.i/r),t.push(e.i/r),t.push(l.i/r),bh(e),e=l.next,h=l.next;else if((e=l)===h){o?1===o?nh(e=sh(e,t,r),t,r,i,n,a,2):2===o&&lh(e,t,r,i,n,a):nh(ih(e),t,r,i,n,a,1);break}}}function ah(e){var t=e.prev,r=e,i=e.next;if(mh(t,r,i)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(fh(t.x,t.y,r.x,r.y,i.x,i.y,n.x,n.y)&&mh(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function oh(e,t,r,i){var n=e.prev,a=e,o=e.next;if(mh(n,a,o)>=0)return!1;for(var s=n.xa.x?n.x>o.x?n.x:o.x:a.x>o.x?a.x:o.x,u=n.y>a.y?n.y>o.y?n.y:o.y:a.y>o.y?a.y:o.y,c=ch(s,l,t,r,i),d=ch(h,u,t,r,i),f=e.nextZ;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&fh(n.x,n.y,a.x,a.y,o.x,o.y,f.x,f.y)&&mh(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(f=e.prevZ;f&&f.z>=c;){if(f!==e.prev&&f!==e.next&&fh(n.x,n.y,a.x,a.y,o.x,o.y,f.x,f.y)&&mh(f.prev,f,f.next)>=0)return!1;f=f.prevZ}return!0}function sh(e,t,r){var i=e;do{var n=i.prev,a=i.next.next;!gh(n,a)&&_h(n,i,i.next,a)&&vh(n,a)&&vh(a,n)&&(t.push(n.i/r),t.push(i.i/r),t.push(a.i/r),bh(i),bh(i.next),i=e=a),i=i.next}while(i!==e);return i}function lh(e,t,r,i,n,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&ph(o,s)){var l=yh(o,s);return o=ih(o,o.next),l=ih(l,l.next),nh(o,t,r,i,n,a),void nh(l,t,r,i,n,a)}s=s.next}o=o.next}while(o!==e)}function hh(e,t){return e.x-t.x}function uh(e,t){if(t=function(e,t){var r,i=t,n=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>o){if(o=s,s===n){if(a===i.y)return i;if(a===i.next.y)return i.next}r=i.x=i.x&&i.x>=u&&n!==i.x&&fh(ar.x)&&vh(i,e)&&(r=i,d=l),i=i.next;return r}(e,t)){var r=yh(t,e);ih(r,r.next)}}function ch(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)/n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)/n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function dh(e){var t=e,r=e;do{t.x=0&&(e-o)*(i-s)-(r-o)*(t-s)>=0&&(r-o)*(a-s)-(n-o)*(i-s)>=0}function ph(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&_h(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&vh(e,t)&&vh(t,e)&&function(e,t){var r=e,i=!1,n=(e.x+t.x)/2,a=(e.y+t.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&n<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}(e,t)}function mh(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function gh(e,t){return e.x===t.x&&e.y===t.y}function _h(e,t,r,i){return!!(gh(e,t)&&gh(r,i)||gh(e,i)&&gh(r,t))||mh(e,t,r)>0!=mh(e,t,i)>0&&mh(r,i,e)>0!=mh(r,i,t)>0}function vh(e,t){return mh(e.prev,e,e.next)<0?mh(e,t,e.next)>=0&&mh(e,e.prev,t)>=0:mh(e,t,e.prev)<0||mh(e,e.next,t)<0}function yh(e,t){var r=new wh(e.i,e.x,e.y),i=new wh(t.i,t.x,t.y),n=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function xh(e,t,r,i){var n=new wh(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function bh(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function wh(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Th(e,t,r,i){for(var n=0,a=t,o=r-i;ah&&s.push({pivot:Math.floor((l+h)/2),left:h,right:l}),h=a[o].pivot+1,(l=a[o].right)>h&&s.push({pivot:Math.floor((l+h)/2),left:h,right:l})}a=this._parts=s}else for(o=0;o=2e4},doSortTriangles:function(e,t){var r=this.indices;if(0===t){var i=this.attributes.position;e=e.array,this._triangleZList&&this._triangleZList.length===this.triangleCount||(this._triangleZList=new Float32Array(this.triangleCount),this._sortedTriangleIndices=new Uint32Array(this.triangleCount),this._indicesTmp=new r.constructor(r.length),this._triangleZListTmp=new Float32Array(this.triangleCount));for(var n,a=0,o=0;o0,r={},n=0;n65535?new Uint32Array(3*o):new Uint16Array(3*o),d.material.shader!==t&&d.material.attachShader(t,!0),Ka.setMaterialFromModel(t.__shading,d.material,e,r),s>0&&(this._linesMesh.geometry.resetOffset(),this._linesMesh.geometry.setVertexCount(s),this._linesMesh.geometry.setTriangleCount(l)),this._dataIndexOfVertex=new Uint32Array(a),this._vertexRangeOfDataIndex=new Uint32Array(2*(n-i))},_updateRegionMesh:function(e,t,r,i){for(var n=e.getData(),a=0,o=0,s=!1,l=this._polygonMesh,h=this._linesMesh,u=r;u0;w&&(b*=t.getDevicePixelRatio(),this._updateLinesGeometry(h.geometry,e,u,v,b,e.coordinateSystem.transform)),h.invisible=!w,h.material.set({color:g})}(l=this._polygonMesh).material.transparent=s,l.material.depthMask=!s,l.geometry.updateBoundingBox(),l.frontFace=this.extrudeY?Ka.Mesh.CCW:Ka.Mesh.CW,l.material.get("normalMap")&&l.geometry.generateTangents(),l.seriesIndex=e.seriesIndex,l.on("mousemove",this._onmousemove,this),l.on("mouseout",this._onmouseout,this)},_updateDebugWireframe:function(e){var t=e.getModel("debug.wireframe");if(t.get("show")){var r=Ka.parseColor(t.get("lineStyle.color")||"rgba(0,0,0,0.5)"),i=Mn(t.get("lineStyle.width"),1),n=this._polygonMesh;n.geometry.generateBarycentric(),n.material.define("both","WIREFRAME_TRIANGLE"),n.material.set("wireframeLineColor",r),n.material.set("wireframeLineWidth",i)}},_onmousemove:function(e){var t=this._dataIndexOfVertex[e.triangle[0]];null==t&&(t=-1),t!==this._lastHoverDataIndex&&(this.downplay(this._lastHoverDataIndex),this.highlight(t),this._labelsBuilder.updateLabels([t])),this._lastHoverDataIndex=t,this._polygonMesh.dataIndex=t},_onmouseout:function(e){e.target&&(this.downplay(this._lastHoverDataIndex),this._lastHoverDataIndex=-1,this._polygonMesh.dataIndex=-1),this._labelsBuilder.updateLabels([])},_updateGroundPlane:function(e,t,r){var i=e.getModel("groundPlane",e);if(this._groundMesh.invisible=!i.get("show",!0),!this._groundMesh.invisible){var n=e.get("shading"),a=this._groundMaterials[n];a||(a=this._groundMaterials.lambert),Ka.setMaterialFromModel(n,a,i,r),a.get("normalMap")&&this._groundMesh.geometry.generateTangents(),this._groundMesh.material=a,this._groundMesh.material.set("color",Ka.parseColor(i.get("color"))),this._groundMesh.scale.set(t.size[0],t.size[2],1)}},_triangulation:function(e,t,r){this._triangulationResults=[];for(var i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0],a=e.coordinateSystem,o=t;o1?i:0,L[U][g]=A.points[V+2],l.set(n+U,L[U]),s?(I[0]=(A.points[V]*_[0]-v[0])/x,I[1]=(A.points[V+2]*_[g]-v[g])/x):(I[0]=(k?R:R+G)/x,I[1]=(L[U][m]*_[m]-v[m])/x),u.set(n+U,I)}for(zh.sub(P,L[1],L[0]),zh.sub(O,L[3],L[0]),zh.cross(N,P,O),zh.normalize(N,N),U=0;U<4;U++)h.set(n+U,N),f&&c.set(n+U,o);for(U=0;U<6;U++)p[3*a+U]=D[U]+n;n+=4,a+=2,R+=G}}return t.dirty(),{vertexOffset:n,triangleOffset:a}},_getRegionLinesInfo:function(e,t,r){var i=0,n=0;return t.getRegionModel(e).getModel("itemStyle").get("borderWidth")>0&&t.getRegionPolygonCoords(e).forEach((function(e){var t=e.exterior,a=e.interiors;i+=r.getPolylineVertexCount(t),n+=r.getPolylineTriangleCount(t);for(var o=0;othis._endIndex)){t-=this._startIndex;for(var i=this._vertexRangeOfDataIndex[2*t];i0},_displacementChanged:!0,_displacementScale:0,updateDisplacementHash:function(){var e=this.getDisplacementTexture(),t=this.getDisplacemenScale();this._displacementChanged=this._displacementTexture!==e||this._displacementScale!==t,this._displacementTexture=e,this._displacementScale=t},isDisplacementChanged:function(){return this._displacementChanged}});i.util.merge(ru.prototype,uo),i.util.merge(ru.prototype,co),i.util.merge(ru.prototype,fo),i.util.merge(ru.prototype,Kl);const iu=ru;var nu=Math.PI,au=Math.sin,ou=Math.cos,su=Math.tan,lu=Math.asin,hu=Math.atan2,uu=nu/180,cu=23.4397*uu;function du(e,t){return hu(au(e)*ou(cu)-su(t)*au(cu),ou(e))}function fu(e,t,r){return hu(au(e),ou(e)*au(t)-su(r)*ou(t))}function pu(e,t,r){return lu(au(t)*au(r)+ou(t)*ou(r)*ou(e))}var mu={};mu.getPosition=function(e,t,r){var i=uu*-r,n=uu*t,a=function(e){return function(e){return e.valueOf()/864e5-.5+2440588}(e)-2451545}(e),o=function(e){var t,r,i=(r=function(e){return uu*(357.5291+.98560028*e)}(e))+uu*(1.9148*au(r)+.02*au(2*r)+3e-4*au(3*r))+102.9372*uu+nu;return{dec:(t=i,lu(au(0)*ou(cu)+ou(0)*au(cu)*au(t))),ra:du(i,0)}}(a),s=function(e,t){return uu*(280.16+360.9856235*e)-t}(a,i)-o.ra;return{azimuth:fu(s,n,o.dec),altitude:pu(s,n,o.dec)}};const gu=mu;Ka.Shader.import(Va),Ka.Shader.import("@export ecgl.atmosphere.vertex\nattribute vec3 position: POSITION;\nattribute vec3 normal : NORMAL;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 normalMatrix : WORLDINVERSETRANSPOSE;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n v_Normal = normalize((normalMatrix * vec4(normal, 0.0)).xyz);\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n\n\n@export ecgl.atmosphere.fragment\nuniform mat4 viewTranspose: VIEWTRANSPOSE;\nuniform float glowPower;\nuniform vec3 glowColor;\n\nvarying vec3 v_Normal;\n\nvoid main() {\n float intensity = pow(1.0 - dot(v_Normal, (viewTranspose * vec4(0.0, 0.0, 1.0, 0.0)).xyz), glowPower);\n gl_FragColor = vec4(glowColor, intensity * intensity);\n}\n@end");const _u=i.ComponentView.extend({type:"globe",__ecgl__:!0,_displacementScale:0,init:function(e,t){this.groupGL=new Ka.Node,this._sphereGeometry=new Ka.SphereGeometry({widthSegments:200,heightSegments:100,dynamic:!0}),this._overlayGeometry=new Ka.SphereGeometry({widthSegments:80,heightSegments:40}),this._planeGeometry=new Ka.PlaneGeometry,this._earthMesh=new Ka.Mesh({renderNormal:!0}),this._atmosphereMesh=new Ka.Mesh,this._atmosphereGeometry=new Ka.SphereGeometry({widthSegments:80,heightSegments:40}),this._atmosphereMaterial=new Ka.Material({shader:new Ka.Shader(Ka.Shader.source("ecgl.atmosphere.vertex"),Ka.Shader.source("ecgl.atmosphere.fragment")),transparent:!0}),this._atmosphereMesh.geometry=this._atmosphereGeometry,this._atmosphereMesh.material=this._atmosphereMaterial,this._atmosphereMesh.frontFace=Ka.Mesh.CW,this._lightRoot=new Ka.Node,this._sceneHelper=new Uo,this._sceneHelper.initLight(this._lightRoot),this.groupGL.add(this._atmosphereMesh),this.groupGL.add(this._earthMesh),this._control=new Do({zr:t.getZr()}),this._control.init(),this._layerMeshes={}},render:function(e,t,r){var i=e.coordinateSystem,n=e.get("shading");i.viewGL.add(this._lightRoot),e.get("show")?i.viewGL.add(this.groupGL):i.viewGL.remove(this.groupGL),this._sceneHelper.setScene(i.viewGL.scene),i.viewGL.setPostEffect(e.getModel("postEffect"),r),i.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling"));var a=this._earthMesh;a.geometry=this._sphereGeometry;var o="ecgl."+n;a.material&&a.material.shader.name===o||(a.material=Ka.createMaterial(o)),Ka.setMaterialFromModel(n,a.material,e,r),["roughnessMap","metalnessMap","detailMap","normalMap"].forEach((function(e){var t=a.material.get(e);t&&(t.flipY=!1)})),a.material.set("color",Ka.parseColor(e.get("baseColor")));var s=.99*i.radius;if(a.scale.set(s,s,s),e.get("atmosphere.show")){a.material.define("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!1,this._atmosphereMaterial.setUniforms({glowPower:e.get("atmosphere.glowPower")||6,glowColor:e.get("atmosphere.color")||"#ffffff"}),a.material.setUniforms({glowPower:e.get("atmosphere.innerGlowPower")||2,glowColor:e.get("atmosphere.color")||"#ffffff"});var l=e.get("atmosphere.offset")||5;this._atmosphereMesh.scale.set(s+l,s+l,s+l)}else a.material.undefine("both","ATMOSPHERE_ENABLED"),this._atmosphereMesh.invisible=!0;var h=a.material.setTextureImage("diffuseMap",e.get("baseTexture"),r,{flipY:!1,anisotropic:8});h&&h.surface&&h.surface.attachToMesh(a);var u=a.material.setTextureImage("bumpMap",e.get("heightTexture"),r,{flipY:!1,anisotropic:8});u&&u.surface&&u.surface.attachToMesh(a),a.material[e.get("postEffect.enable")?"define":"undefine"]("fragment","SRGB_DECODE"),this._updateLight(e,r),this._displaceVertices(e,r),this._updateViewControl(e,r),this._updateLayers(e,r)},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r)},_updateLayers:function(e,t){var r=e.coordinateSystem,n=e.get("layers"),a=r.radius,o=[],s=[],l=[],h=[];i.util.each(n,(function(e){var n=new i.Model(e),u=n.get("type"),c=Ka.loadTexture(n.get("texture"),t,{flipY:!1,anisotropic:8});if(c.surface&&c.surface.attachToMesh(this._earthMesh),"blend"===u){var d=n.get("blendTo"),f=Mn(n.get("intensity"),1);"emission"===d?(l.push(c),h.push(f)):(o.push(c),s.push(f))}else{var p=n.get("id"),m=this._layerMeshes[p];m||(m=this._layerMeshes[p]=new Ka.Mesh({geometry:this._overlayGeometry,castShadow:!1,ignorePicking:!0})),"lambert"===n.get("shading")?(m.material=m.__lambertMaterial||new Ka.Material({autoUpdateTextureStatus:!1,shader:Ka.createShader("ecgl.lambert"),transparent:!0,depthMask:!1}),m.__lambertMaterial=m.material):(m.material=m.__colorMaterial||new Ka.Material({autoUpdateTextureStatus:!1,shader:Ka.createShader("ecgl.color"),transparent:!0,depthMask:!1}),m.__colorMaterial=m.material),m.material.enableTexture("diffuseMap");var g=n.get("distance"),_=a+(null==g?r.radius/100:g);m.scale.set(_,_,_),a=_;var v=this._blankTexture||(this._blankTexture=Ka.createBlankTexture("rgba(255, 255, 255, 0)"));m.material.set("diffuseMap",v),Ka.loadTexture(n.get("texture"),t,{flipY:!1,anisotropic:8},(function(e){e.surface&&e.surface.attachToMesh(m),m.material.set("diffuseMap",e),t.getZr().refresh()})),n.get("show")?this.groupGL.add(m):this.groupGL.remove(m)}}),this);var u=this._earthMesh.material;u.define("fragment","LAYER_DIFFUSEMAP_COUNT",o.length),u.define("fragment","LAYER_EMISSIVEMAP_COUNT",l.length),u.set("layerDiffuseMap",o),u.set("layerDiffuseIntensity",s),u.set("layerEmissiveMap",l),u.set("layerEmissionIntensity",h);var c=e.getModel("debug.wireframe");if(c.get("show")){u.define("both","WIREFRAME_TRIANGLE");var d=Ka.parseColor(c.get("lineStyle.color")||"rgba(0,0,0,0.5)"),f=Mn(c.get("lineStyle.width"),1);u.set("wireframeLineWidth",f),u.set("wireframeLineColor",d)}else u.undefine("both","WIREFRAME_TRIANGLE")},_updateViewControl:function(e,t){var r=e.coordinateSystem,i=e.getModel("viewControl"),n=(r.viewGL.camera,this),a=this._control;a.setViewGL(r.viewGL);var o,s,l=i.get("targetCoord");null!=l&&(s=l[0]+90,o=l[1]),a.setFromViewControlModel(i,{baseDistance:r.radius,alpha:o,beta:s}),a.off("update"),a.on("update",(function(){t.dispatchAction({type:"globeChangeCamera",alpha:a.getAlpha(),beta:a.getBeta(),distance:a.getDistance()-r.radius,center:a.getCenter(),from:n.uid,globeId:e.id})}))},_displaceVertices:function(e,t){var r=e.get("displacementQuality"),i=e.get("debug.wireframe.show"),n=e.coordinateSystem;if(e.isDisplacementChanged()||r!==this._displacementQuality||i!==this._showDebugWireframe){this._displacementQuality=r,this._showDebugWireframe=i;var a=this._sphereGeometry,o={low:100,medium:200,high:400,ultra:800}[r]||200,s=o/2;(a.widthSegments!==o||i)&&(a.widthSegments=o,a.heightSegments=s,a.build()),this._doDisplaceVertices(a,n),i&&a.generateBarycentric()}},_doDisplaceVertices:function(e,t){var r=e.attributes.position.value,i=e.attributes.texcoord0.value,n=e.__originalPosition;n&&n.length===r.length||((n=new Float32Array(r.length)).set(r),e.__originalPosition=n);for(var a=t.displacementWidth,o=t.displacementHeight,s=t.displacementData,l=0;l50&&(a=1e3);var o=[];Ou.perspective(o,Iu,this.width/this.height,1,a),this.viewGL.camera.projectionMatrix.setArray(o),this.viewGL.camera.decomposeProjectionMatrix(),o=Ou.identity([]);var s=this.dataToPoint(this.center);Ou.scale(o,o,[1,-1,1]),Ou.translate(o,o,[0,0,-e]),Ou.rotateX(o,o,t),Ou.rotateZ(o,o,-this.bearing/180*Math.PI),Ou.translate(o,o,[-s[0]*this.getScale()*Bu,-s[1]*this.getScale()*Bu,0]),this.viewGL.camera.viewMatrix.array=o;var l=[];Ou.invert(l,o),this.viewGL.camera.worldTransform.array=l,this.viewGL.camera.decomposeWorldTransform();var h,u=Nu*this.getScale();if(this.altitudeExtent&&!isNaN(this.boxHeight)){var c=this.altitudeExtent[1]-this.altitudeExtent[0];h=this.boxHeight/c*this.getScale()/Math.pow(2,this._initialZoom-this.zoomOffset)}else h=u/(2*Math.PI*6378e3*Math.abs(Math.cos(this.center[1]*(Math.PI/180))))*this.altitudeScale*Bu;this.viewGL.rootNode.scale.set(this.getScale()*Bu,this.getScale()*Bu,h)}},getScale:function(){return Math.pow(2,this.zoom-this.zoomOffset)},projectOnTile:function(e,t){return this.projectOnTileWithScale(e,this.getScale()*Nu,t)},projectOnTileWithScale:function(e,t,r){var i=e[0],n=e[1]*Ru/180,a=t*(i*Ru/180+Ru)/(2*Ru),o=t*(Ru-Math.log(Math.tan(Ru/4+.5*n)))/(2*Ru);return(r=r||[])[0]=a,r[1]=o,r},unprojectFromTile:function(e,t){return this.unprojectOnTileWithScale(e,this.getScale()*Nu,t)},unprojectOnTileWithScale:function(e,t,r){var i=e[0],n=e[1],a=i/t*(2*Ru)-Ru,o=2*(Math.atan(Math.exp(Ru-n/t*(2*Ru)))-Ru/4);return(r=r||[])[0]=180*a/Ru,r[1]=180*o/Ru,r},dataToPoint:function(e,t){return(t=this.projectOnTileWithScale(e,Nu,t))[0]-=this._origin[0],t[1]-=this._origin[1],t[2]=isNaN(e[2])?0:e[2],isNaN(e[2])||(t[2]=e[2],this.altitudeExtent&&(t[2]-=this.altitudeExtent[0])),t}};const zu=Fu;function Gu(){zu.apply(this,arguments)}function Uu(e,t,r){function i(e,t){var r=t.getWidth(),i=t.getHeight(),n=t.getDevicePixelRatio();this.viewGL.setViewport(0,0,r,i,n),this.width=r,this.height=i,this.altitudeScale=e.get("altitudeScale"),this.boxHeight=e.get("boxHeight")}function n(e,t){if("auto"!==this.model.get("boxHeight")){var r=[1/0,-1/0];e.eachSeries((function(e){if(e.coordinateSystem===this){var t=e.getData(),i=e.coordDimToDataDim("alt")[0];if(i){var n=t.getDataExtent(i,!0);r[0]=Math.min(r[0],n[0]),r[1]=Math.max(r[1],n[1])}}}),this),r&&isFinite(r[1]-r[0])&&(this.altitudeExtent=r)}}return{dimensions:t.prototype.dimensions,create:function(a,o){var s=[];return a.eachComponent(e,(function(e){var r=e.__viewGL;r||(r=e.__viewGL=new Il).setRootNode(new Ka.Node);var a=new t;a.viewGL=e.__viewGL,a.resize=i,a.resize(e,o),s.push(a),e.coordinateSystem=a,a.model=e,a.update=n})),a.eachSeries((function(t){if(t.get("coordinateSystem")===e){var r=t.getReferringComponents(e).models[0];if(r||(r=a.getComponent(e)),!r)throw new Error(e+' "'+Mn(t.get(e+"Index"),t.get(e+"Id"),0)+'" not found');t.coordinateSystem=r.coordinateSystem}})),r&&r(s,a,o),s}}}Gu.prototype=new zu,Gu.prototype.constructor=Gu,Gu.prototype.type="mapbox3D";const ku=Uu("mapbox3D",Gu,(function(e){e.forEach((function(e){e.setCameraOption(e.model.getMapboxCameraOption())}))}));(0,i.use)((function(e){e.registerComponentModel(Au),e.registerComponentView(Pu),e.registerCoordinateSystem("mapbox3D",ku),e.registerAction({type:"mapbox3DChangeCamera",event:"mapbox3dcamerachanged",update:"mapbox3D:updateCamera"},(function(e,t){t.eachComponent({mainType:"mapbox3D",query:e},(function(t){t.setMapboxCameraOption(e)}))}))}));var Vu=["zoom","center","pitch","bearing"],Hu=i.ComponentModel.extend({type:"maptalks3D",layoutMode:"box",coordinateSystem:null,defaultOption:{zlevel:-10,urlTemplate:"http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png",attribution:'© OpenStreetMap contributors, © CARTO',center:[0,0],zoom:0,pitch:0,bearing:0,light:{main:{alpha:20,beta:30}},altitudeScale:1,boxHeight:"auto"},getMaptalksCameraOption:function(){var e=this;return Vu.reduce((function(t,r){return t[r]=e.get(r),t}),{})},setMaptalksCameraOption:function(e){null!=e&&Vu.forEach((function(t){null!=e[t]&&(this.option[t]=e[t])}),this)},getMaptalks:function(){return this._maptalks},setMaptalks:function(e){this._maptalks=e}});i.util.merge(Hu.prototype,co),i.util.merge(Hu.prototype,fo);const Wu=Hu;function ju(e,t,r,i){if(this.id=e,this.zr=t,this.dom=document.createElement("div"),this.dom.style.cssText="position:absolute;left:0;right:0;top:0;bottom:0;",!maptalks)throw new Error("Maptalks library must be included. See https://maptalks.org");this._maptalks=new maptalks.Map(this.dom,{center:r,zoom:i,doubleClickZoom:!1,fog:!1}),this._initEvents()}ju.prototype.setUnpainted=function(){},ju.prototype.resize=function(){this._maptalks.checkSize()},ju.prototype.getMaptalks=function(){return this._maptalks},ju.prototype.clear=function(){},ju.prototype.refresh=function(){this._maptalks.checkSize()};var Xu=["mousedown","mouseup","click","dblclick","mousemove","mousewheel","DOMMouseScroll","touchstart","touchend","touchmove","touchcancel"];ju.prototype._initEvents=function(){var e=this.dom;this._handlers=this._handlers||{contextmenu:function(e){return e.preventDefault(),!1}},Xu.forEach((function(t){this._handlers[t]=function(r){var i={};for(var n in r)i[n]=r[n];i.bubbles=!1;var a=new r.constructor(r.type,i);"mousewheel"===t||"DOMMouseScroll"===t?e.dispatchEvent(a):e.firstElementChild.dispatchEvent(a)},this.zr.dom.addEventListener(t,this._handlers[t])}),this),this.zr.dom.addEventListener("contextmenu",this._handlers.contextmenu)},ju.prototype.dispose=function(){Xu.forEach((function(e){this.zr.dom.removeEventListener(e,this._handlers[e])}),this),this._maptalks.remove()};const qu=ju;Ka.Shader.import(Lu);const Zu=i.ComponentView.extend({type:"maptalks3D",__ecgl__:!0,init:function(e,t){this._groundMesh=new Ka.Mesh({geometry:new Ka.PlaneGeometry,material:new Ka.Material({shader:new Ka.Shader({vertex:Ka.Shader.source("ecgl.displayShadow.vertex"),fragment:Ka.Shader.source("ecgl.displayShadow.fragment")}),depthMask:!1}),renderOrder:-100,culling:!1,castShadow:!1,$ignorePicking:!0,renderNormal:!0})},_initMaptalksLayer:function(e,t){var r=t.getZr();this._zrLayer=new qu("maptalks3D",r,e.get("center"),e.get("zoom")),r.painter.insertLayer(-1e3,this._zrLayer),this._lightRoot=new Ka.Node,this._sceneHelper=new Uo(this._lightRoot),this._sceneHelper.initLight(this._lightRoot);var i=this._zrLayer.getMaptalks(),n=this._dispatchInteractAction.bind(this,t,i);["zoomend","zooming","zoomstart","dragrotating","pitch","pitchend","movestart","moving","moveend","resize","touchstart","touchmove","touchend","animating"].forEach((function(e){i.on(e,n)}))},render:function(e,t,r){this._zrLayer||this._initMaptalksLayer(e,r);var i=this._zrLayer.getMaptalks(),n=e.get("urlTemplate"),a=i.getBaseLayer();n!==this._oldUrlTemplate&&(a?a.setOptions({urlTemplate:n,attribution:e.get("attribution")}):(a=new maptalks.TileLayer("maptalks-echarts-gl-baselayer",{urlTemplate:n,subdomains:["a","b","c"],attribution:e.get("attribution")}),i.setBaseLayer(a))),this._oldUrlTemplate=n,i.setCenter(e.get("center")),i.setZoom(e.get("zoom"),{animation:!1}),i.setPitch(e.get("pitch")),i.setBearing(e.get("bearing")),e.setMaptalks(i);var o=e.coordinateSystem;o.viewGL.scene.add(this._lightRoot),o.viewGL.add(this._groundMesh),this._updateGroundMesh(),this._sceneHelper.setScene(o.viewGL.scene),this._sceneHelper.updateLight(e),o.viewGL.setPostEffect(e.getModel("postEffect"),r),o.viewGL.setTemporalSuperSampling(e.getModel("temporalSuperSampling")),this._maptalks3DModel=e},afterRender:function(e,t,r,i){var n=i.renderer;this._sceneHelper.updateAmbientCubemap(n,e,r),this._sceneHelper.updateSkybox(n,e,r),e.coordinateSystem.viewGL.scene.traverse((function(e){e.material&&(e.material.define("fragment","NORMAL_UP_AXIS",2),e.material.define("fragment","NORMAL_FRONT_AXIS",1))}))},updateCamera:function(e,t,r,i){e.coordinateSystem.setCameraOption(i),this._updateGroundMesh(),r.getZr().refresh()},_dispatchInteractAction:function(e,t,r){var i;e.dispatchAction({type:"maptalks3DChangeCamera",pitch:t.getPitch(),zoom:(i=t.getResolution(),19-Math.log(i/Yu)/Math.LN2+1),center:t.getCenter().toArray(),bearing:t.getBearing(),maptalks3DId:this._maptalks3DModel&&this._maptalks3DModel.id})},_updateGroundMesh:function(){if(this._maptalks3DModel){var e=this._maptalks3DModel.coordinateSystem,t=e.dataToPoint(e.center);this._groundMesh.position.set(t[0],t[1],-.001);var r=new Ka.Plane(new Ka.Vector3(0,0,1),0),i=e.viewGL.camera.castRay(new Ka.Vector2(-1,-1)),n=e.viewGL.camera.castRay(new Ka.Vector2(1,1)),a=i.intersectPlane(r),o=n.intersectPlane(r),s=a.dist(o)/e.viewGL.rootNode.scale.x;this._groundMesh.scale.set(s,s,1)}},dispose:function(e,t){this._zrLayer&&this._zrLayer.dispose(),t.getZr().painter.delLayer(-1e3)}}),Yu=12756274*Math.PI/(256*Math.pow(2,20));function Ku(){zu.apply(this,arguments),this.maxPitch=85,this.zoomOffset=1}Ku.prototype=new zu,Ku.prototype.constructor=Ku,Ku.prototype.type="maptalks3D";const Qu=Uu("maptalks3D",Ku,(function(e){e.forEach((function(e){e.setCameraOption(e.model.getMaptalksCameraOption())}))}));(0,i.use)((function(e){e.registerComponentModel(Wu),e.registerComponentView(Zu),e.registerCoordinateSystem("maptalks3D",Qu),e.registerAction({type:"maptalks3DChangeCamera",event:"maptalks3dcamerachanged",update:"maptalks3D:updateCamera"},(function(e,t){t.eachComponent({mainType:"maptalks3D",query:e},(function(t){t.setMaptalksCameraOption(e)}))}))}));var Ju=Po.vec3,$u=i.helper.dataStack.isDimensionStacked;function ec(e,t,r){for(var i=e.getDataExtent(t),n=e.getDataExtent(r),a=i[1]-i[0]||i[0],o=n[1]-n[0]||n[0],s=new Uint8Array(2500),l=0;l0&&d>0||c<0&&d<0)),m=["x","y","z"].map((function(t){return e.coordDimToDataDim(t)[0]})),g=$u(r,m[2]),_=g?r.getCalculationInfo("stackResultDimension"):m[2];r.each(m,(function(e,i,a,o){var s=r.get(_,o),l=g?s-a:p?0:f[0],h=t.dataToPoint([e,i,l]),u=t.dataToPoint([e,i,s]),c=Ju.dist(h,u),d=[0,u[1]"+a.join("
")}(a):i.format.encodeHTML(i.format.addCommas(a)),s=n.getName(t),l=Ih(n,t);i.util.isObject(l)&&l.colorStops&&(l=(l.colorStops[0]||{}).color),l=l||"transparent";var h=i.format.getTooltipMarker(l),u=e.name;return"\0-"===u&&(u=""),u=u?i.format.encodeHTML(u)+(r?": ":"
"):"",r?h+u+o:u+h+(s?i.format.encodeHTML(s)+": "+o:o)}function sc(e,t,r){r=r||e.getSource();var n=t||i.getCoordinateSystemDimensions(e.get("coordinateSystem"))||["x","y","z"],a=i.helper.createDimensions(r,{dimensionsDefine:r.dimensionsDefine||e.get("dimensions"),encodeDefine:r.encodeDefine||e.get("encode"),coordDimensions:n.map((function(t){var r=e.getReferringComponents(t+"Axis3D").models[0];return{type:r&&"category"===r.get("type")?"ordinal":"float",name:t}}))});"cartesian3D"===e.get("coordinateSystem")&&a.forEach((function(t){if(n.indexOf(t.coordDim)>=0){var r=e.getReferringComponents(t.coordDim+"Axis3D").models[0];r&&"category"===r.get("type")&&(t.ordinalMeta=r.getOrdinalMeta())}}));var o=i.helper.dataStack.enableDataStack(e,a,{byIndex:!0,stackedCoordDimension:"z"}),s=new i.List(a,e);return s.setCalculationInfo(o),s.initData(r),s}var lc=i.SeriesModel.extend({type:"series.bar3D",dependencies:["globe"],visualStyleAccessPathvisu:"itemStyle",getInitialData:function(e,t){return sc(this)},getFormattedLabel:function(e,t,r,i){var n=ac.getFormattedLabel(this,e,t,r,i);return null==n&&(n=this.getData().get("z",e)),n},formatTooltip:function(e){return oc(this,e)},defaultOption:{coordinateSystem:"cartesian3D",globeIndex:0,grid3DIndex:0,zlevel:-10,bevelSize:0,bevelSmoothness:2,onGridPlane:"xy",shading:"color",minHeight:0,itemStyle:{opacity:1},label:{show:!1,distance:2,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},emphasis:{label:{show:!0}},animationDurationUpdate:500}});i.util.merge(lc.prototype,Kl);const hc=lc;var uc,cc,dc,fc,pc,mc,gc,_c,vc=Po.vec3,yc=Po.mat3,xc=Vr.extend((function(){return{attributes:{position:new Vr.Attribute("position","float",3,"POSITION"),normal:new Vr.Attribute("normal","float",3,"NORMAL"),color:new Vr.Attribute("color","float",4,"COLOR"),prevPosition:new Vr.Attribute("prevPosition","float",3),prevNormal:new Vr.Attribute("prevNormal","float",3)},dynamic:!0,enableNormal:!1,bevelSize:1,bevelSegments:0,_dataIndices:null,_vertexOffset:0,_triangleOffset:0}}),{resetOffset:function(){this._vertexOffset=0,this._triangleOffset=0},setBarCount:function(e){var t=this.enableNormal,r=this.getBarVertexCount()*e,i=this.getBarTriangleCount()*e;this.vertexCount!==r&&(this.attributes.position.init(r),t?this.attributes.normal.init(r):this.attributes.normal.value=null,this.attributes.color.init(r)),this.triangleCount!==i&&(this.indices=r>65535?new Uint32Array(3*i):new Uint16Array(3*i),this._dataIndices=new Uint32Array(r))},getBarVertexCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarVertexCount(e):this.enableNormal?24:8},getBarTriangleCount:function(){var e=this.bevelSize>0?this.bevelSegments:0;return e>0?this._getBevelBarTriangleCount(e):12},_getBevelBarVertexCount:function(e){return 4*(e+1)*(e+1)*2},_getBevelBarTriangleCount:function(e){return(4*e+3+1)*(2*e+1)*2+4},setColor:function(e,t){for(var r=this.getBarVertexCount(),i=r*(e+1),n=r*e;n0&&this.bevelSegments>0)this._addBevelBar(e,c,m,g,this.bevelSize,this.bevelSegments,_);else{vc.copy(n,c),vc.normalize(n,n),vc.cross(a,m,n),vc.normalize(a,a),vc.cross(i,n,a),vc.normalize(a,a),vc.negate(o,i),vc.negate(s,n),vc.negate(l,a),t(h[0],e,i,g[0]/2),t(h[0],h[0],a,g[2]/2),t(h[1],e,i,g[0]/2),t(h[1],h[1],l,g[2]/2),t(h[2],e,o,g[0]/2),t(h[2],h[2],l,g[2]/2),t(h[3],e,o,g[0]/2),t(h[3],h[3],a,g[2]/2),t(r,e,n,g[1]),t(h[4],r,i,g[0]/2),t(h[4],h[4],a,g[2]/2),t(h[5],r,i,g[0]/2),t(h[5],h[5],l,g[2]/2),t(h[6],r,o,g[0]/2),t(h[6],h[6],l,g[2]/2),t(h[7],r,o,g[0]/2),t(h[7],h[7],a,g[2]/2);var x=this.attributes;if(this.enableNormal){u[0]=i,u[1]=o,u[2]=n,u[3]=s,u[4]=a,u[5]=l;for(var b=this._vertexOffset,w=0;w0&&(f++,u[3]<.99&&(p=!0))}})),o.geometry.setBarCount(f);var m=r.getLayout("orient"),g=this._barIndexOfData=new Int32Array(r.count());f=0,r.each((function(e){if(r.hasValue(e)){var t=r.getItemLayout(e),i=t[0],n=t[1],o=t[2],s=4*e;u[0]=c[s++],u[1]=c[s++],u[2]=c[s++],u[3]=c[s++],u[3]>0&&(a._barMesh.geometry.addBar(i,n,m,o,u,e),g[e]=f++)}else g[e]=-1})),o.geometry.dirty(),o.geometry.updateBoundingBox();var _=o.material;_.transparent=p,_.depthMask=!p,o.geometry.sortTriangles=p,this._initHandler(e,t)},_initHandler:function(e,t){var r=e.getData(),i=this._barMesh,n="cartesian3D"===e.coordinateSystem.type;i.seriesIndex=e.seriesIndex;var a=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(e){var o=i.geometry.getDataIndexOfVertex(e.triangle[0]);o!==a&&(this._downplay(a),this._highlight(o),this._labelsBuilder.updateLabels([o]),n&&t.dispatchAction({type:"grid3DShowAxisPointer",value:[r.get("x",o),r.get("y",o),r.get("z",o,!0)]})),a=o,i.dataIndex=o}),this),i.on("mouseout",(function(e){this._downplay(a),this._labelsBuilder.updateLabels(),a=-1,i.dataIndex=-1,n&&t.dispatchAction({type:"grid3DHideAxisPointer"})}),this)},_highlight:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var n=t.getItemModel(e).getModel("emphasis.itemStyle"),a=n.get("color"),o=n.get("opacity");if(null==a){var s=Ih(t,e);a=i.color.lift(s,-.4)}null==o&&(o=Rh(t,e));var l=Ka.parseColor(a);l[3]*=o,this._barMesh.geometry.setColor(r,l),this._api.getZr().refresh()}}},_downplay:function(e){var t=this._data;if(t){var r=this._barIndexOfData[e];if(!(r<0)){var i=Ih(t,e),n=Rh(t,e),a=Ka.parseColor(i);a[3]*=n,this._barMesh.geometry.setColor(r,a),this._api.getZr().refresh()}}},highlight:function(e,t,r,i){this._toggleStatus("highlight",e,t,r,i)},downplay:function(e,t,r,i){this._toggleStatus("downplay",e,t,r,i)},_toggleStatus:function(e,t,r,n,a){var o=t.getData(),s=An(o,a),l=this;null!=s?i.util.each(ac.normalizeToArray(s),(function(t){"highlight"===e?this._highlight(t):this._downplay(t)}),this):o.each((function(t){"highlight"===e?l._highlight(t):l._downplay(t)}))},remove:function(){this.groupGL.removeAll()},dispose:function(){this._labelsBuilder.dispose(),this.groupGL.removeAll()}});(0,i.use)((function(e){e.registerChartView(Tc),e.registerSeriesModel(hc),nc(e),e.registerProcessor((function(e,t){e.eachSeriesByType("bar3d",(function(e){var t=e.getData();t.filterSelf((function(e){return t.hasValue(e)}))}))}))}));const Sc=i.SeriesModel.extend({type:"series.line3D",dependencies:["grid3D"],visualStyleAccessPath:"lineStyle",visualDrawType:"stroke",getInitialData:function(e,t){return sc(this)},formatTooltip:function(e){return oc(this,e)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,grid3DIndex:0,lineStyle:{width:2},animationDurationUpdate:500}});function Mc(e,t,r,i,n,a,o){if(0===n)return!1;var s,l=n;if(o>t+l&&o>i+l||oe+l&&a>r+l||a=0){var g=3*l,_=new vt(this._points[g],this._points[g+1],this._points[g+2]);a.push({dataIndex:l,point:_,pointWorld:_.clone(),target:this._line3DMesh,distance:this._camera.getWorldPosition().dist(_)})}},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});(0,i.use)((function(e){e.registerChartView(Ec),e.registerSeriesModel(Sc),e.registerLayout((function(e,t){e.eachSeriesByType("line3D",(function(e){var t=e.getData(),r=e.coordinateSystem;if(r){if("cartesian3D"!==r.type)return;var i=new Float32Array(3*t.count()),n=[],a=[],o=r.dimensions.map((function(t){return e.coordDimToDataDim(t)[0]}));r&&t.each(o,(function(e,t,o,s){n[0]=e,n[1]=t,n[2]=o,r.dataToPoint(n,a),i[3*s]=a[0],i[3*s+1]=a[1],i[3*s+2]=a[2]})),t.setLayout("points",i)}}))}))}));const Cc=i.SeriesModel.extend({type:"series.scatter3D",dependencies:["globe","grid3D","geo3D"],visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,getInitialData:function(e,t){return sc(this)},getFormattedLabel:function(e,t,r,i){var n=ac.getFormattedLabel(this,e,t,r,i);if(null==n){var a=this.getData(),o=a.dimensions[a.dimensions.length-1];n=a.get(o,e)}return n},formatTooltip:function(e){return oc(this,e)},defaultOption:{coordinateSystem:"cartesian3D",zlevel:-10,progressive:1e5,progressiveThreshold:1e5,grid3DIndex:0,globeIndex:0,symbol:"circle",symbolSize:10,blendMode:"source-over",label:{show:!1,position:"right",distance:5,textStyle:{fontSize:14,color:"#000",backgroundColor:"rgba(255,255,255,0.7)",padding:3,borderRadius:3}},itemStyle:{opacity:.8},emphasis:{label:{show:!0}},animationDurationUpdate:500}});function Dc(e,t,r){(t=t||document.createElement("canvas")).width=e,t.height=e;var i=t.getContext("2d");return r&&r(i),t}var Lc={getMarginByStyle:function(e){var t=e.minMargin||0,r=0;e.stroke&&"none"!==e.stroke&&(r=null==e.lineWidth?1:e.lineWidth);var i=e.shadowBlur||0,n=e.shadowOffsetX||0,a=e.shadowOffsetY||0,o={};return o.left=Math.max(r/2,-n+i,t),o.right=Math.max(r/2,n+i,t),o.top=Math.max(r/2,-a+i,t),o.bottom=Math.max(r/2,a+i,t),o},createSymbolSprite:function(e,t,r,n){var a=function(e,t,r,n){i.util.isArray(t)||(t=[t,t]);var a=Lc.getMarginByStyle(r,void 0),o=t[0]+a.left+a.right,s=t[1]+a.top+a.bottom,l=i.helper.createSymbol(e,0,0,t[0],t[1]),h=Math.max(o,s);l.x=a.left,l.y=a.top,o>s?l.y+=(h-s)/2:l.x+=(h-o)/2;var u=l.getBoundingRect();return l.x-=u.x,l.y-=u.y,l.setStyle(r),l.update(),l.__size=h,l}(e,t,r),o=Lc.getMarginByStyle(r);return{image:Dc(a.__size,n,(function(e){i.innerDrawElementOnCanvas(e,a)})),margin:o}},createSDFFromCanvas:function(e,t,r,i){return Dc(t,i,(function(t){var i=e.getContext("2d").getImageData(0,0,e.width,e.height);t.putImageData(function(e,t,r){var i=t.width,n=t.height,a=e.canvas.width,o=e.canvas.height,s=i/a,l=n/o;function h(e){return e<128?1:-1}function u(e,a){var o=1/0;e=Math.floor(e*s);for(var u=(a=Math.floor(a*l))*i+e,c=h(t.data[4*u]),d=Math.max(a-r,0);d=2e4},doSortVertices:function(e,t){var r=this.indices,i=Oc.create();if(!r){r=this.indices=this.vertexCount>65535?new Uint32Array(this.vertexCount):new Uint16Array(this.vertexCount);for(var n=0;n.05);else for(n=0;n<3;n++)this._progressiveQuickSort(3*t+n);this.dirtyIndices()},_simpleSort:function(e){var t=this._zList,r=this.indices;function i(e,r){return t[r]-t[e]}e?Array.prototype.sort.call(r,i):Ch.sort(r,i,0,r.length-1)},_progressiveQuickSort:function(e){var t=this._zList,r=this.indices;this._quickSort=this._quickSort||new Ch,this._quickSort.step(r,(function(e,r){return t[r]-t[e]}),e)}};var Ic=Po.vec4;Ka.Shader.import("@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end");const Rc=Ka.Mesh.extend((function(){var e=new Ka.Geometry({dynamic:!0,attributes:{color:new Ka.Geometry.Attribute("color","float",4,"COLOR"),position:new Ka.Geometry.Attribute("position","float",3,"POSITION"),size:new Ka.Geometry.Attribute("size","float",1),prevPosition:new Ka.Geometry.Attribute("prevPosition","float",3),prevSize:new Ka.Geometry.Attribute("prevSize","float",1)}});Object.assign(e,Nc);var t=new Ka.Material({shader:Ka.createShader("ecgl.sdfSprite"),transparent:!0,depthMask:!1});t.enableTexture("sprite"),t.define("both","VERTEX_COLOR"),t.define("both","VERTEX_SIZE");var r=new Ka.Texture2D({image:document.createElement("canvas"),flipY:!1});return t.set("sprite",r),e.pick=this._pick.bind(this),{geometry:e,material:t,mode:Ka.Mesh.POINTS,sizeScale:1}}),{_pick:function(e,t,r,i,n,a){var o=this._positionNDC;if(o)for(var s=r.viewport,l=2/s.width,h=2/s.height,u=this.geometry.vertexCount-1;u>=0;u--){var c,d=o[2*(c=this.geometry.indices?this.geometry.indices[u]:u)],f=o[2*c+1],p=this.geometry.attributes.size.get(c)/this.sizeScale/2;if(e>d-p*l&&ef-p*h&&t2?(p=this._updateSymbolSprite(e,d,u,c),s.enableTexture("sprite")):s.disableTexture("sprite"),h.position.init(n-i);var m=[];if(f){s.undefine("VERTEX_SIZE"),s.undefine("VERTEX_COLOR");var g=function(e){const t=e.getVisual("style");if(t)return t[e.getVisual("drawType")]}(o),_=function(e){return e.getVisual("style").opacity}(o);Ka.parseColor(g,m),m[3]*=_,s.set({color:m,u_Size:u.maxSize*this._sizeScale})}else s.set({color:[1,1,1,1]}),s.define("VERTEX_SIZE"),s.define("VERTEX_COLOR"),h.size.init(n-i),h.color.init(n-i),this._originalOpacity=new Float32Array(n-i);for(var v=o.getLayout("points"),y=h.position.value,x=0;x1?(o[0]=r.maxSize,o[1]=r.maxSize/r.aspect):(o[1]=r.maxSize,o[0]=r.maxSize*r.aspect),o[0]=o[0]||1,o[1]=o[1]||1,this._symbolType===r.type&&(a=o,(n=this._symbolSize)&&a&&n[0]===a[0]&&n[1]===a[1])&&this._lineWidth===t.lineWidth||(Pc.createSymbolSprite(r.type,o,{fill:"#fff",lineWidth:t.lineWidth,stroke:"transparent",shadowColor:"transparent",minMargin:Math.min(o[0]/2,10)},this._spriteImageCanvas),Pc.createSDFFromCanvas(this._spriteImageCanvas,Math.min(this._spriteImageCanvas.width,32),20,this._mesh.material.get("sprite").image),this._symbolType=r.type,this._symbolSize=o,this._lineWidth=t.lineWidth),this._spriteImageCanvas.width/r.maxSize*i},_updateMaterial:function(e,t){var r="lighter"===e.get("blendMode")?Ka.additiveBlend:null,i=this._mesh.material;i.blend=r,i.set("lineWidth",t.lineWidth/20);var n=Ka.parseColor(t.stroke);i.set("strokeColor",n),i.transparent=!0,i.depthMask=!1,i.depthTest=!this.is2D,i.sortVertices=!this.is2D},_updateLabelBuilder:function(e,t,r){var i=e.getData(),n=this._mesh.geometry,a=n.attributes.position.value,o=(t=this._startDataIndex,this._mesh.sizeScale);this._labelsBuilder.updateData(i,t,r),this._labelsBuilder.getLabelPosition=function(e,r,i){var n=3*(e-t);return[a[n],a[n+1],a[n+2]]},this._labelsBuilder.getLabelDistance=function(e,r,i){return n.attributes.size.get(e-t)/o/2+i},this._labelsBuilder.updateLabels()},_updateAnimation:function(e){Ka.updateVertexAnimation([["prevPosition","position"],["prevSize","size"]],this._prevMesh,this._mesh,e)},_updateHandler:function(e,t,r){var i,n=e.getData(),a=this._mesh,o=this,s=-1,l=e.coordinateSystem&&"cartesian3D"===e.coordinateSystem.type;l&&(i=e.coordinateSystem.model),a.seriesIndex=e.seriesIndex,a.off("mousemove"),a.off("mouseout"),a.on("mousemove",(function(t){var h=t.vertexIndex+o._startDataIndex;h!==s&&(this.highlightOnMouseover&&(this.downplay(n,s),this.highlight(n,h),this._labelsBuilder.updateLabels([h])),l&&r.dispatchAction({type:"grid3DShowAxisPointer",value:[n.get(e.coordDimToDataDim("x")[0],h),n.get(e.coordDimToDataDim("y")[0],h),n.get(e.coordDimToDataDim("z")[0],h)],grid3DIndex:i.componentIndex})),a.dataIndex=h,s=h}),this),a.on("mouseout",(function(e){var t=e.vertexIndex+o._startDataIndex;this.highlightOnMouseover&&(this.downplay(n,t),this._labelsBuilder.updateLabels()),s=-1,a.dataIndex=-1,l&&r.dispatchAction({type:"grid3DHideAxisPointer",grid3DIndex:i.componentIndex})}),this)},updateLayout:function(e,t,r){var i=e.getData();if(this._mesh){var n=this._mesh.geometry.attributes.position.value,a=i.getLayout("points");if(this.is2D)for(var o=0;othis._endDataIndex||tthis._endDataIndex||t 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end");const ad=Ka.Mesh.extend((function(){var e=new Ka.Material({shader:new Ka.Shader(Ka.Shader.source("ecgl.trail2.vertex"),Ka.Shader.source("ecgl.trail2.fragment")),transparent:!0,depthMask:!1}),t=new Ro({dynamic:!0});return t.createAttribute("dist","float",1),t.createAttribute("distAll","float",1),t.createAttribute("start","float",1),{geometry:t,material:e,culling:!1,$ignorePicking:!0}}),{updateData:function(e,t,r){var i=e.hostModel,n=this.geometry,a=i.getModel("effect"),o=a.get("trailWidth")*t.getDevicePixelRatio(),s=a.get("trailLength"),l=i.get("effect.constantSpeed"),h=1e3*i.get("effect.period"),u=null!=l;u?this.material.set("speed",l/1e3):this.material.set("period",h),this.material[u?"define":"undefine"]("vertex","CONSTANT_SPEED");var c=i.get("polyline");n.trailLength=s,this.material.set("trailLength",s),n.resetOffset(),["position","positionPrev","positionNext"].forEach((function(e){n.attributes[e].value=r.attributes[e].value})),["dist","distAll","start","offset","color"].forEach((function(e){n.attributes[e].init(n.vertexCount)})),n.indices=r.indices;var d=[],f=a.get("trailColor"),p=a.get("trailOpacity"),m=null!=f,g=null!=p;this.updateWorldTransform();var _=this.worldTransform.x.len(),v=this.worldTransform.y.len(),y=this.worldTransform.z.len(),x=0,b=0;e.each((function(t){var i=e.getItemLayout(t),a=g?p:Rh(e,t),s=Ih(e,t);null==a&&(a=1),(d=Ka.parseColor(m?f:s,d))[3]*=a;for(var l=c?r.getPolylineVertexCount(i):r.getCubicCurveVertexCount(i[0],i[1],i[2],i[3]),w=0,T=[],S=[],M=x;Mx&&(w+=nd.dist(T,S)),n.attributes.dist.set(M,w),nd.copy(S,T);b=Math.max(b,w);var A=Math.random()*(u?w:h);for(M=x;M0?1:-1)*o/2),n.attributes.color.set(M,d);x+=l})),this.material.set("spotSize",.1*b*s),this.material.set("spotIntensity",a.get("spotIntensity")),n.dirty()},setAnimationTime:function(e){this.material.set("time",e)}});Ka.Shader.import(is);const od=i.ChartView.extend({type:"lines3D",__ecgl__:!0,init:function(e,t){this.groupGL=new Ka.Node,this._meshLinesMaterial=new Ka.Material({shader:Ka.createShader("ecgl.meshLines3D"),transparent:!0,depthMask:!1}),this._linesMesh=new Ka.Mesh({geometry:new Ro,material:this._meshLinesMaterial,$ignorePicking:!0}),this._trailMesh=new ad},render:function(e,t,r){this.groupGL.add(this._linesMesh);var i=e.coordinateSystem,n=e.getData();if(i&&i.viewGL){i.viewGL.add(this.groupGL),this._updateLines(e,t,r);var a=i.viewGL.isLinearSpace()?"define":"undefine";this._linesMesh.material[a]("fragment","SRGB_DECODE"),this._trailMesh.material[a]("fragment","SRGB_DECODE")}var o=this._trailMesh;if(o.stopAnimation(),e.get("effect.show")){this.groupGL.add(o),o.updateData(n,r,this._linesMesh.geometry),o.__time=o.__time||0;var s=36e5;this._curveEffectsAnimator=o.animate("",{loop:!0}).when(s,{__time:s}).during((function(){o.setAnimationTime(o.__time)})).start()}else this.groupGL.remove(o),this._curveEffectsAnimator=null;this._linesMesh.material.blend=this._trailMesh.material.blend="lighter"===e.get("blendMode")?Ka.additiveBlend:null},pauseEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.pause()},resumeEffect:function(){this._curveEffectsAnimator&&this._curveEffectsAnimator.resume()},toggleEffect:function(){var e=this._curveEffectsAnimator;e&&(e.isPaused()?e.resume():e.pause())},_updateLines:function(e,t,r){var i=e.getData(),n=e.coordinateSystem,a=this._linesMesh.geometry,o=e.get("polyline");a.expandLine=!0;var s=function(e){return null!=e.radius?e.radius:null!=e.size?Math.max(e.size[0],e.size[1],e.size[2]):100}(n);a.segmentScale=s/20;var l="lineStyle.width".split("."),h=r.getDevicePixelRatio(),u=0;i.each((function(e){var t=i.getItemModel(e).get(l);null==t&&(t=1),i.setItemVisual(e,"lineWidth",t),u=Math.max(t,u)})),a.useNativeLine=!1;var c=0,d=0;i.each((function(e){var t=i.getItemLayout(e);o?(c+=a.getPolylineVertexCount(t),d+=a.getPolylineTriangleCount(t)):(c+=a.getCubicCurveVertexCount(t[0],t[1],t[2],t[3]),d+=a.getCubicCurveTriangleCount(t[0],t[1],t[2],t[3]))})),a.setVertexCount(c),a.setTriangleCount(d),a.resetOffset();var f=[];i.each((function(e){var t=i.getItemLayout(e),r=Ih(i,e),n=Rh(i,e),s=i.getItemVisual(e,"lineWidth")*h;null==n&&(n=1),(f=Ka.parseColor(r,f))[3]*=n,o?a.addPolyline(t,f,s):a.addCubicCurve(t[0],t[1],t[2],t[3],f,s)})),a.dirty()},remove:function(){this.groupGL.removeAll()},dispose:function(){this.groupGL.removeAll()}});function sd(e,t){for(var r=[],i=0;i0;this._updateSurfaceMesh(this._surfaceMesh,e,u,f);var p=this._surfaceMesh.material;f?(p.define("WIREFRAME_QUAD"),p.set("wireframeLineWidth",d),p.set("wireframeLineColor",Ka.parseColor(c.get("lineStyle.color")))):p.undefine("WIREFRAME_QUAD"),this._initHandler(e,r),this._updateAnimation(e)},_updateAnimation:function(e){Ka.updateVertexAnimation([["prevPosition","position"],["prevNormal","normal"]],this._prevSurfaceMesh,this._surfaceMesh,e)},_createSurfaceMesh:function(){var e=new Ka.Mesh({geometry:new Ka.Geometry({dynamic:!0,sortTriangles:!0}),shadowDepthMaterial:new Ka.Material({shader:new Ka.Shader(Ka.Shader.source("ecgl.sm.depth.vertex"),Ka.Shader.source("ecgl.sm.depth.fragment"))}),culling:!1,renderOrder:10,renderNormal:!0});return e.geometry.createAttribute("barycentric","float",4),e.geometry.createAttribute("prevPosition","float",3),e.geometry.createAttribute("prevNormal","float",3),Object.assign(e.geometry,Nh),e},_initHandler:function(e,t){var r=e.getData(),i=this._surfaceMesh,n=e.coordinateSystem;i.seriesIndex=e.seriesIndex;var a=-1;i.off("mousemove"),i.off("mouseout"),i.on("mousemove",(function(e){var o=function(e,t){for(var r=1/0,n=-1,a=[],o=0;o=0){var s=[];i.geometry.attributes.position.get(o,s);for(var l=n.pointToData(s),h=1/0,u=-1,c=[],d=0;d65535?Uint32Array:Uint16Array)((p-1)*(m-1)*6),w=function(e,t,r){r[1]=e*m+t,r[0]=e*m+t+1,r[3]=(e+1)*m+t+1,r[2]=(e+1)*m+t},T=!1;if(l){var S=[],M=[],A=0;g?u.init(n.vertexCount):u.value=null;for(var E=[[],[],[]],C=[],D=[],L=fd.create(),P=function(e,t,r){var i=3*t;return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r},O=new Float32Array(o.length),N=new Float32Array(o.length/3*4),I=0;I0;){if(Math.floor(s/u)===s/u)return[u,s/u];u--}return[u=Math.floor(Math.sqrt(s)),u]},dispose:function(){this.groupGL.removeAll()},remove:function(){this.groupGL.removeAll()}});function md(e,t){for(var r=[],i=0;i=0&&e.call(t,r[n],n)},e.prototype.eachEdge=function(e,t){for(var r=this.edges,i=r.length,n=0;n=0&&r[n].node1.dataIndex>=0&&r[n].node2.dataIndex>=0&&e.call(t,r[n],n)},e.prototype.breadthFirstTraverse=function(e,t,r,i){if(t instanceof Ad||(t=this._nodesMap[Sd(t)]),t){for(var n="out"===r?"outEdges":"in"===r?"inEdges":"edges",a=0;a=0&&r.node2.dataIndex>=0})),n=0,a=i.length;n=0&&this[e][t].setItemVisual(this.dataIndex,r,i)},getVisual:function(r){return this[e][t].getItemVisual(this.dataIndex,r)},setLayout:function(r,i){this.dataIndex>=0&&this[e][t].setItemLayout(this.dataIndex,r,i)},getLayout:function(){return this[e][t].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[e][t].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[e][t].getRawIndex(this.dataIndex)}}}_a(Ad,Cd("hostGraph","data")),_a(Ed,Cd("hostGraph","edgeData"));const Dd=Md;var Ld=_o();function Pd(e,t){if(Ld(this).mainData===this){var r=ga({},Ld(this).datas);r[this.dataType]=t,Bd(t,r,e)}else Fd(t,this.dataType,Ld(this).mainData,e);return t}function Od(e,t){return e.struct&&e.struct.update(),t}function Nd(e,t){return ya(Ld(t).datas,(function(r,i){r!==t&&Fd(r.cloneShallow(),i,t,e)})),t}function Id(e){var t=Ld(this).mainData;return null==e||null==t?t:Ld(t).datas[e]}function Rd(){var e=Ld(this).mainData;return null==e?[{data:e}]:xa(ba(Ld(e).datas),(function(t){return{type:t,data:Ld(e).datas[t]}}))}function Bd(e,t,r){Ld(e).datas={},ya(t,(function(t,i){Fd(t,i,e,r)}))}function Fd(e,t,r,i){Ld(r).datas[t]=e,Ld(e).mainData=r,e.dataType=t,i.struct&&(e[i.structAttr]=i.struct,i.struct[i.datasAttr[t]]=e),e.getLinkedData=Id,e.getLinkedDataAll=Rd}var zd=i.SeriesModel.extend({type:"series.graphGL",visualStyleAccessPath:"itemStyle",hasSymbolVisual:!0,init:function(e){zd.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this._updateCategoriesData()},mergeOption:function(e){zd.superApply(this,"mergeOption",arguments),this._updateCategoriesData()},getFormattedLabel:function(e,t,r,i){var n=ac.getFormattedLabel(this,e,t,r,i);if(null==n){var a=this.getData(),o=a.dimensions[a.dimensions.length-1];n=a.get(o,e)}return n},getInitialData:function(e,t){var r=e.edges||e.links||[],n=e.data||e.nodes||[],a=this;if(n&&r)return function(e,t,r,n,a){for(var o=new Dd(!0),s=0;s "+p)),c++)}var m=i.helper.createDimensions(e,{coordDimensions:["value"]});(l=new i.List(m,r)).initData(e);var g,_,v,y=new i.List(["value"],r);return y.initData(u,h),a&&a(l,y),_=(g={mainData:l,struct:o,structAttr:"graph",datas:{node:l,edge:y},datasAttr:{node:"data",edge:"edgeData"}}).mainData,(v=g.datas)||(v={main:_},g.datasAttr={main:"data"}),g.datas=g.mainData=null,Bd(_,v,g),ya(v,(function(e){ya(_.TRANSFERABLE_METHODS,(function(t){e.wrapMethod(t,wa(Pd,g))}))})),_.wrapMethod("cloneShallow",wa(Nd,g)),ya(_.CHANGABLE_METHODS,(function(e){_.wrapMethod(e,wa(Od,g))})),function(e,t){if(!e)throw new Error(void 0)}(v[_.dataType]===_),o.update(),o}(n,r,this,0,(function(e,r){e.wrapMethod("getItemModel",(function(e){const t=a._categoriesModels[e.getShallow("category")];return t&&(t.parentModel=e.parentModel,e.parentModel=t),e}));const i=t.getModel([]).getModel;function n(e,t){const r=i.call(this,e,t);return r.resolveParentPath=o,r}function o(e){if(e&&("label"===e[0]||"label"===e[1])){const t=e.slice();return"label"===e[0]?t[0]="edgeLabel":"label"===e[1]&&(t[1]="edgeLabel"),t}return e}r.wrapMethod("getItemModel",(function(e){return e.resolveParentPath=o,e.getModel=n,e}))})).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(e,t,r){if("edge"===r){var n=this.getData(),a=this.getDataParams(e,r),o=n.graph.getEdgeByIndex(e),s=n.getName(o.node1.dataIndex),l=n.getName(o.node2.dataIndex),h=[];return null!=s&&h.push(s),null!=l&&h.push(l),h=i.format.encodeHTML(h.join(" > ")),a.value&&(h+=" : "+i.format.encodeHTML(a.value)),h}return zd.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var e=(this.option.categories||[]).map((function(e){return null!=e.value?e:Object.assign({value:0},e)})),t=new i.List(["value"],this);t.initData(e),this._categoriesData=t,this._categoriesModels=t.mapArray((function(e){return t.getItemModel(e,!0)}))},setView:function(e){null!=e.zoom&&(this.option.zoom=e.zoom),null!=e.offset&&(this.option.offset=e.offset)},setNodePosition:function(e){for(var t=0;t65535?this.indices instanceof Uint16Array&&(this.indices=new Uint32Array(this.indices)):this.indices instanceof Uint32Array&&(this.indices=new Uint16Array(this.indices)))},setTriangleCount:function(e){this.triangleCount!==e&&(this.indices=0===e?null:this.vertexCount>65535?new Uint32Array(3*e):new Uint16Array(3*e))},_getCubicCurveApproxStep:function(e,t,r,i){return 1/(Ud.dist(e,t)+Ud.dist(r,t)+Ud.dist(i,r)+1)*this.segmentScale},getCubicCurveVertexCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?2*a:2*a+2},getCubicCurveTriangleCount:function(e,t,r,i){var n=this._getCubicCurveApproxStep(e,t,r,i),a=Math.ceil(1/n);return this.useNativeLine?0:2*a},getLineVertexCount:function(){return this.getPolylineVertexCount(kd)},getLineTriangleCount:function(){return this.getPolylineTriangleCount(kd)},getPolylineVertexCount:function(e){var t;return t="number"==typeof e?e:"number"!=typeof e[0]?e.length:e.length/2,this.useNativeLine?2*(t-1):2*(t-1)+2},getPolylineTriangleCount:function(e){var t;return t="number"==typeof e?e:"number"!=typeof e[0]?e.length:e.length/2,this.useNativeLine?0:2*(t-1)},addCubicCurve:function(e,t,r,i,n,a){null==a&&(a=1);var o=e[0],s=e[1],l=t[0],h=t[1],u=r[0],c=r[1],d=i[0],f=i[1],p=this._getCubicCurveApproxStep(e,t,r,i),m=p*p,g=m*p,_=3*p,v=3*m,y=6*m,x=6*g,b=o-2*l+u,w=s-2*h+c,T=3*(l-u)-o+d,S=3*(h-c)-s+f,M=o,A=s,E=(l-o)*_+b*v+T*g,C=(h-s)*_+w*v+S*g,D=b*y+T*x,L=w*y+S*x,P=T*x,O=S*x,N=0,I=0,R=Math.ceil(1/p),B=new Float32Array(3*(R+1)),F=(B=[],0);for(I=0;I1&&(M=E>0?Math.min(M,d):Math.max(M,d),A=C>0?Math.min(A,f):Math.max(A,f));this.addPolyline(B,n,a)},addLine:function(e,t,r,i){this.addPolyline([e,t],r,i)},addPolyline:function(){var e=Ud.create(),t=Ud.create(),r=Ud.create(),i=Ud.create(),n=[],a=[],o=[];return function(s,l,h,u,c){if(s.length){var d="number"!=typeof s[0];if(null==c&&(c=d?s.length:s.length/2),!(c<2)){null==u&&(u=0),null==h&&(h=1),this._itemVertexOffsets.push(this._vertexOffset);for(var f,p=d?"number"!=typeof l[0]:l.length/4===c,m=this.attributes.position,g=this.attributes.color,_=this.attributes.offset,v=this.attributes.normal,y=this.indices,x=this._vertexOffset,b=0;b1&&(m.copy(x,x-1),g.copy(x,x-1),x++);else{var S;if(b0){Ud.sub(e,n,o),Ud.sub(t,a,n),Ud.normalize(e,e),Ud.normalize(t,t),Ud.add(i,e,t),Ud.normalize(i,i);var M=h/2*Math.min(1/Ud.dot(e,i),2);r[0]=-i[1],r[1]=i[0],S=M}else Ud.sub(e,a,n),Ud.normalize(e,e),r[0]=-e[1],r[1]=e[0],S=h/2;else Ud.sub(e,n,o),Ud.normalize(e,e),r[0]=-e[1],r[1]=e[0],S=h/2;v.set(x,r),v.set(x+1,r),_.set(x,S),_.set(x+1,-S),Ud.copy(o,n),m.set(x,n),m.set(x+1,n),g.set(x,f),g.set(x+1,f),x+=2}if(this.useNativeLine)g.set(x,f),m.set(x,n),x++;else if(b>0){var A=3*this._faceOffset;(y=this.indices)[A]=x-4,y[A+1]=x-3,y[A+2]=x-2,y[A+3]=x-3,y[A+4]=x-1,y[A+5]=x-2,this._faceOffset+=2}}this._vertexOffset=x}}}}(),setItemColor:function(e,t){for(var r=this._itemVertexOffsets[e],i=e 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end");var Wd={repulsionByDegree:!0,linLogMode:!1,strongGravityMode:!1,gravity:1,scaling:1,edgeWeightInfluence:1,jitterTolerence:.1,preventOverlap:!1,dissuadeHubs:!1,gravityCenter:null};function jd(e){var t={type:Ka.Texture.FLOAT,minFilter:Ka.Texture.NEAREST,magFilter:Ka.Texture.NEAREST};this._positionSourceTex=new Ka.Texture2D(t),this._positionSourceTex.flipY=!1,this._positionTex=new Ka.Texture2D(t),this._positionPrevTex=new Ka.Texture2D(t),this._forceTex=new Ka.Texture2D(t),this._forcePrevTex=new Ka.Texture2D(t),this._weightedSumTex=new Ka.Texture2D(t),this._weightedSumTex.width=this._weightedSumTex.height=1,this._globalSpeedTex=new Ka.Texture2D(t),this._globalSpeedPrevTex=new Ka.Texture2D(t),this._globalSpeedTex.width=this._globalSpeedTex.height=1,this._globalSpeedPrevTex.width=this._globalSpeedPrevTex.height=1,this._nodeRepulsionPass=new pn({fragment:Ka.Shader.source("ecgl.forceAtlas2.updateNodeRepulsion")}),this._positionPass=new pn({fragment:Ka.Shader.source("ecgl.forceAtlas2.updatePosition")}),this._globalSpeedPass=new pn({fragment:Ka.Shader.source("ecgl.forceAtlas2.calcGlobalSpeed")}),this._copyPass=new pn({fragment:Ka.Shader.source("clay.compositor.output")});var r=function(e){e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE)};this._edgeForceMesh=new Ka.Mesh({geometry:new Ka.Geometry({attributes:{node1:new Ka.Geometry.Attribute("node1","float",2),node2:new Ka.Geometry.Attribute("node2","float",2),weight:new Ka.Geometry.Attribute("weight","float",1)},dynamic:!0,mainAttribute:"node1"}),material:new Ka.Material({transparent:!0,shader:Ka.createShader("ecgl.forceAtlas2.updateEdgeAttraction"),blend:r,depthMask:!1,depthText:!1}),mode:Ka.Mesh.POINTS}),this._weightedSumMesh=new Ka.Mesh({geometry:new Ka.Geometry({attributes:{node:new Ka.Geometry.Attribute("node","float",2)},dynamic:!0,mainAttribute:"node"}),material:new Ka.Material({transparent:!0,shader:Ka.createShader("ecgl.forceAtlas2.calcWeightedSum"),blend:r,depthMask:!1,depthText:!1}),mode:Ka.Mesh.POINTS}),this._framebuffer=new zi({depthBuffer:!1}),this._dummyCamera=new Ka.OrthographicCamera({left:-1,right:1,top:1,bottom:-1,near:0,far:100}),this._globalSpeed=0}jd.prototype.updateOption=function(e){for(var t in Wd)this[t]=Wd[t];var r=this._nodes.length;if(this.jitterTolerence=r>5e4?10:r>5e3?1:.1,this.scaling=r>100?2:10,e)for(var t in Wd)null!=e[t]&&(this[t]=e[t]);if(this.repulsionByDegree)for(var i=this._positionSourceTex.pixels,n=0;ne},jd.prototype._swapTexture=function(){var e=this._positionPrevTex;this._positionPrevTex=this._positionTex,this._positionTex=e,e=this._forcePrevTex,this._forcePrevTex=this._forceTex,this._forceTex=e,e=this._globalSpeedPrevTex,this._globalSpeedPrevTex=this._globalSpeedTex,this._globalSpeedTex=e},jd.prototype._initFromSource=function(e){this._framebuffer.attach(this._positionPrevTex),this._framebuffer.bind(e),this._copyPass.setUniform("texture",this._positionSourceTex),this._copyPass.render(e),e.gl.clearColor(0,0,0,0),this._framebuffer.attach(this._forcePrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.attach(this._globalSpeedPrevTex),e.gl.clear(e.gl.COLOR_BUFFER_BIT),this._framebuffer.unbind(e)},jd.prototype._resize=function(e,t){["_positionSourceTex","_positionTex","_positionPrevTex","_forceTex","_forcePrevTex"].forEach((function(r){this[r].width=e,this[r].height=t,this[r].dirty()}),this)},jd.prototype.dispose=function(e){this._framebuffer.dispose(e),this._copyPass.dispose(e),this._nodeRepulsionPass.dispose(e),this._positionPass.dispose(e),this._globalSpeedPass.dispose(e),this._edgeForceMesh.geometry.dispose(e),this._weightedSumMesh.geometry.dispose(e),this._positionSourceTex.dispose(e),this._positionTex.dispose(e),this._positionPrevTex.dispose(e),this._forceTex.dispose(e),this._forcePrevTex.dispose(e),this._weightedSumTex.dispose(e),this._globalSpeedTex.dispose(e),this._globalSpeedPrevTex.dispose(e)};const Xd=jd;var qd=function(){var e=function(){return new Float32Array(2)},t=function(e,t){var r=t[0]-e[0],i=t[1]-e[1];return Math.sqrt(r*r+i*i)},r=function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},i=function(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e},n=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},a=function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e},o=function(e,t,r){return e[0]=t,e[1]=r,e};function s(){this.subRegions=[],this.nSubRegions=0,this.node=null,this.mass=0,this.centerOfMass=null,this.bbox=new Float32Array(4),this.size=0}var l=s.prototype;function h(){this.position=new Float32Array(2),this.force=e(),this.forcePrev=e(),this.mass=1,this.inDegree=0,this.outDegree=0}function u(e,t){this.source=e,this.target=t,this.weight=1}function c(){this.autoSettings=!0,this.barnesHutOptimize=!0,this.barnesHutTheta=1.5,this.repulsionByDegree=!0,this.linLogMode=!1,this.strongGravityMode=!1,this.gravity=1,this.scaling=1,this.edgeWeightInfluence=1,this.jitterTolerence=.1,this.preventOverlap=!1,this.dissuadeHubs=!1,this.rootRegion=new s,this.rootRegion.centerOfMass=e(),this.nodes=[],this.edges=[],this.bbox=new Float32Array(4),this.gravityCenter=null,this._massArr=null,this._swingingArr=null,this._sizeArr=null,this._globalSpeed=0}l.beforeUpdate=function(){for(var e=0;e=e&&this.bbox[1]<=t&&this.bbox[3]>=t},l.setBBox=function(e,t,r,i){this.bbox[0]=e,this.bbox[1]=t,this.bbox[2]=r,this.bbox[3]=i,this.size=(r-e+i-t)/2},l._newSubRegion=function(){var e=this.subRegions[this.nSubRegions];return e||(e=new s,this.subRegions[this.nSubRegions]=e),this.nSubRegions++,e},l._addNodeToSubRegion=function(e){var t=this.findSubRegion(e.position[0],e.position[1]),r=this.bbox;if(!t){var i=(r[0]+r[2])/2,n=(r[1]+r[3])/2,a=(r[2]-r[0])/2,o=(r[3]-r[1])/2,s=e.position[0]>=i?1:0,l=e.position[1]>=n?1:0;(t=this._newSubRegion()).setBBox(s*a+r[0],l*o+r[1],(s+1)*a+r[0],(l+1)*o+r[1])}t.addNode(e)},l._updateCenterOfMass=function(e){null==this.centerOfMass&&(this.centerOfMass=new Float32Array(2));var t=this.centerOfMass[0]*this.mass,r=this.centerOfMass[1]*this.mass;t+=e.position[0]*e.mass,r+=e.position[1]*e.mass,this.mass+=e.mass,this.centerOfMass[0]=t/this.mass,this.centerOfMass[1]=r/this.mass};var d=c.prototype;d.initNodes=function(e,t,r){var i=t.length;this.nodes.length=0;for(var n=void 0!==r,a=0;a0&&(this.strongGravityMode?this.applyNodeStrongGravity(c):this.applyNodeGravity(c))}for(h=0;h0&&(_=Math.min(_/this._globalSpeed,1.5)*this._globalSpeed),this._globalSpeed=_,h=0;h0&&(y=Math.min(x*y,10)/x,i(u.position,u.position,u.force,y))}},d.applyRegionToNodeRepulsion=function(){var t=e();return function(e,r){if(e.node)this.applyNodeToNodeRepulsion(e.node,r,!0);else{a(t,r.position,e.centerOfMass);var n=t[0]*t[0]+t[1]*t[1];if(n>this.barnesHutTheta*e.size*e.size){var o=this.scaling*r.mass*e.mass/n;i(r.force,r.force,t,o)}else for(var s=0;s0)s=this.scaling*e.mass*r.mass/(l*l);else{if(!(l<0))return;s=100*this.scaling*e.mass*r.mass}}else s=this.scaling*e.mass*r.mass/o;i(e.force,e.force,t,s),i(r.force,r.force,t,-s)}}}}(),d.applyEdgeAttraction=function(){var t=e();return function(e){var n=e.source,o=e.target;a(t,n.position,o.position);var s,l,h=r(t);s=0===this.edgeWeightInfluence?1:1===this.edgeWeightInfluence?e.weight:Math.pow(e.weight,this.edgeWeightInfluence),this.preventOverlap&&(h=h-n.size-o.size)<=0||(l=this.linLogMode?-s*Math.log(h+1)/(h+1):-s,i(n.force,n.force,t,l),i(o.force,o.force,t,-l))}}(),d.applyNodeGravity=function(){var t=e();return function(e){a(t,this.gravityCenter,e.position);var n=r(t);i(e.force,e.force,t,this.gravity*e.mass/(n+1))}}(),d.applyNodeStrongGravity=function(){var t=e();return function(e){a(t,this.gravityCenter,e.position),i(e.force,e.force,t,this.gravity*e.mass)}}(),d.updateBBox=function(){for(var e=1/0,t=1/0,r=-1/0,i=-1/0,n=0;n5e4?10:a>5e3?1:.1,t.scaling=a>100?2:10,t.barnesHutOptimize=a>1e3,e)for(var r in Zd)null!=e[r]&&(t[r]=e[r]);if(!t.gravityCenter){for(var o=[1/0,1/0],s=[-1/0,-1/0],l=0;le},Yd.prototype.getNodePosition=function(e,t){if(t||(t=new Float32Array(2*this._nodes.length)),this._positionArr)for(var r=0;r0?1.1:.9,a=Math.max(Math.min(this._zoom*n,this.maxZoom),this.minZoom);n=a/this._zoom;var o=this._convertPos(r,i),s=(o.x-this._dx)*(n-1),l=(o.y-this._dy)*(n-1);this._dx-=s,this._dy-=l,this._zoom=a,this._needsUpdate=!0}}},dispose:function(){var e=this.zr;e.off("mousedown",this._mouseDownHandler),e.off("mousemove",this._mouseMoveHandler),e.off("mouseup",this._mouseUpHandler),e.off("mousewheel",this._mouseWheelHandler),e.off("globalout",this._mouseUpHandler),e.animation.off("frame",this._update)}});var Jd=Po.vec2;Ka.Shader.import("@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end");var $d=1;const ef=i.ChartView.extend({type:"graphGL",__ecgl__:!0,init:function(e,t){this.groupGL=new Ka.Node,this.viewGL=new Il("orthographic"),this.viewGL.camera.left=this.viewGL.camera.right=0,this.viewGL.add(this.groupGL),this._pointsBuilder=new Fc(!0,t),this._forceEdgesMesh=new Ka.Mesh({material:new Ka.Material({shader:Ka.createShader("ecgl.forceAtlas2.edges"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new Ka.Geometry({attributes:{node:new Ka.Geometry.Attribute("node","float",2),color:new Ka.Geometry.Attribute("color","float",4,"COLOR")},dynamic:!0,mainAttribute:"node"}),renderOrder:-1,mode:Ka.Mesh.LINES}),this._edgesMesh=new Ka.Mesh({material:new Ka.Material({shader:Ka.createShader("ecgl.meshLines2D"),transparent:!0,depthMask:!1,depthTest:!1}),$ignorePicking:!0,geometry:new Hd({useNativeLine:!1,dynamic:!0}),renderOrder:-1,culling:!1}),this._layoutId=0,this._control=new Qd({zr:t.getZr(),viewGL:this.viewGL}),this._control.setTarget(this.groupGL),this._control.init(),this._clickHandler=this._clickHandler.bind(this)},render:function(e,t,r){this.groupGL.add(this._pointsBuilder.rootNode),this._model=e,this._api=r,this._initLayout(e,t,r),this._pointsBuilder.update(e,t,r),this._forceLayoutInstance instanceof Xd||this.groupGL.remove(this._forceEdgesMesh),this._updateCamera(e,r),this._control.off("update"),this._control.on("update",(function(){r.dispatchAction({type:"graphGLRoam",seriesId:e.id,zoom:this._control.getZoom(),offset:this._control.getOffset()}),this._pointsBuilder.updateView(this.viewGL.camera)}),this),this._control.setZoom(Mn(e.get("zoom"),1)),this._control.setOffset(e.get("offset")||[0,0]);var i=this._pointsBuilder.getPointsMesh();if(i.off("mousemove",this._mousemoveHandler),i.off("mouseout",this._mouseOutHandler,this),r.getZr().off("click",this._clickHandler),this._pointsBuilder.highlightOnMouseover=!0,e.get("focusNodeAdjacency")){var n=e.get("focusNodeAdjacencyOn");"click"===n?r.getZr().on("click",this._clickHandler):"mouseover"===n&&(i.on("mousemove",this._mousemoveHandler,this),i.on("mouseout",this._mouseOutHandler,this),this._pointsBuilder.highlightOnMouseover=!1)}this._lastMouseOverDataIndex=-1},_clickHandler:function(e){if(!this._layouting){var t=this._pointsBuilder.getPointsMesh().dataIndex;t>=0?this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id})}},_mousemoveHandler:function(e){if(!this._layouting){var t=this._pointsBuilder.getPointsMesh().dataIndex;t>=0?t!==this._lastMouseOverDataIndex&&this._api.dispatchAction({type:"graphGLFocusNodeAdjacency",seriesId:this._model.id,dataIndex:t}):this._mouseOutHandler(e),this._lastMouseOverDataIndex=t}},_mouseOutHandler:function(e){this._layouting||(this._api.dispatchAction({type:"graphGLUnfocusNodeAdjacency",seriesId:this._model.id}),this._lastMouseOverDataIndex=-1)},_updateForceEdgesGeometry:function(e,t){var r=this._forceEdgesMesh.geometry,i=t.getEdgeData(),n=0,a=this._forceLayoutInstance,o=2*i.count();r.attributes.node.init(o),r.attributes.color.init(o),i.each((function(t){var o=e[t];r.attributes.node.set(n,a.getNodeUV(o.node1)),r.attributes.node.set(n+1,a.getNodeUV(o.node2));var s=Ih(i,o.dataIndex),l=Ka.parseColor(s);l[3]*=Mn(Rh(i,o.dataIndex),1),r.attributes.color.set(n,l),r.attributes.color.set(n+1,l),n+=2})),r.dirty()},_updateMeshLinesGeometry:function(){var e=this._model.getEdgeData(),t=this._edgesMesh.geometry,r=(e=this._model.getEdgeData(),this._model.getData().getLayout("points"));t.resetOffset(),t.setVertexCount(e.count()*t.getLineVertexCount()),t.setTriangleCount(e.count()*t.getLineTriangleCount());var i=[],n=[],a=["lineStyle","width"];this._originalEdgeColors=new Float32Array(4*e.count()),this._edgeIndicesMap=new Float32Array(e.count()),e.each((function(o){var s=e.graph.getEdgeByIndex(o),l=2*s.node1.dataIndex,h=2*s.node2.dataIndex;i[0]=r[l],i[1]=r[l+1],n[0]=r[h],n[1]=r[h+1];var u=Ih(e,s.dataIndex),c=Ka.parseColor(u);c[3]*=Mn(Rh(e,s.dataIndex),1);var d=e.getItemModel(s.dataIndex),f=Mn(d.get(a),1)*this._api.getDevicePixelRatio();t.addLine(i,n,c,f);for(var p=0;p<4;p++)this._originalEdgeColors[4*s.dataIndex+p]=c[p];this._edgeIndicesMap[s.dataIndex]=o}),this),t.dirty()},_updateForceNodesGeometry:function(e){for(var t=this._pointsBuilder.getPointsMesh(),r=[],i=0;i=f&&(l._syncNodePosition(e),d=0),r.getZr().refresh(),Qa((function(){p(t)}))}))};Qa((function(){l._forceLayoutInstanceToDispose&&(l._forceLayoutInstanceToDispose.dispose(n.layer.renderer),l._forceLayoutInstanceToDispose=null),p(h)})),this._layouting=!0}}},stopLayout:function(e,t,r,i){i&&null!=i.from&&i.from!==this.uid||(this._layoutId=0,this.groupGL.remove(this._forceEdgesMesh),this.groupGL.add(this._edgesMesh),this._forceLayoutInstance&&this.viewGL.layer&&(i&&i.beforeLayout||(this._syncNodePosition(e),this._updateAfterLayout(e,t,r)),this._api.getZr().refresh(),this._layouting=!1))},_syncNodePosition:function(e){var t=this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer);e.getData().setLayout("points",t),e.setNodePosition(t)},_updateAfterLayout:function(e,t,r){this._updateMeshLinesGeometry(),this._pointsBuilder.removePositionTexture(),this._pointsBuilder.updateLayout(e,t,r),this._pointsBuilder.updateView(this.viewGL.camera),this._pointsBuilder.updateLabels(),this._pointsBuilder.showLabels()},focusNodeAdjacency:function(e,t,r,i){var n=this._model.getData();this._downplayAll();var a=i.dataIndex,o=n.graph,s=[],l=o.getNodeByIndex(a);s.push(l),l.edges.forEach((function(e){e.dataIndex<0||(e.node1!==l&&s.push(e.node1),e.node2!==l&&s.push(e.node2))}),this),this._pointsBuilder.fadeOutAll(.05),this._fadeOutEdgesAll(.05),s.forEach((function(e){this._pointsBuilder.highlight(n,e.dataIndex)}),this),this._pointsBuilder.updateLabels(s.map((function(e){return e.dataIndex})));var h=[];l.edges.forEach((function(e){e.dataIndex>=0&&(this._highlightEdge(e.dataIndex),h.push(e))}),this),this._focusNodes=s,this._focusEdges=h},unfocusNodeAdjacency:function(e,t,r,i){this._downplayAll(),this._pointsBuilder.fadeInAll(),this._fadeInEdgesAll(),this._pointsBuilder.updateLabels()},_highlightEdge:function(e){var t=this._model.getEdgeData().getItemModel(e),r=Ka.parseColor(t.get("emphasis.lineStyle.color")||t.get("lineStyle.color")),i=Mn(t.get("emphasis.lineStyle.opacity"),t.get("lineStyle.opacity"),1);r[3]*=i,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],r)},_downplayAll:function(){this._focusNodes&&this._focusNodes.forEach((function(e){this._pointsBuilder.downplay(this._model.getData(),e.dataIndex)}),this),this._focusEdges&&this._focusEdges.forEach((function(e){this._downplayEdge(e.dataIndex)}),this)},_downplayEdge:function(e){var t=this._getColor(e,[]);this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],t)},_setEdgeFade:(tf=[],function(e,t){this._getColor(e,tf),tf[3]*=t,this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[e],tf)}),_getColor:function(e,t){for(var r=0;r<4;r++)t[r]=this._originalEdgeColors[4*e+r];return t},_fadeOutEdgesAll:function(e){this._model.getData().graph.eachEdge((function(t){this._setEdgeFade(t.dataIndex,e)}),this)},_fadeInEdgesAll:function(){this._fadeOutEdgesAll(1)},_updateCamera:function(e,t){this.viewGL.setViewport(0,0,t.getWidth(),t.getHeight(),t.getDevicePixelRatio());for(var r=this.viewGL.camera,i=e.getData().getLayout("points"),n=Jd.create(1/0,1/0),a=Jd.create(-1/0,-1/0),o=[],s=0;sr.left&&hr.top)){var u=Math.max(a[0]-n[0],10),c=u/t.getWidth()*t.getHeight();u*=1.4,c*=1.4,n[0]-=.2*u,r.left=n[0],r.top=l-c/2,r.bottom=l+c/2,r.right=u+n[0],r.near=0,r.far=100}},dispose:function(){var e=this.viewGL.layer.renderer;this._forceLayoutInstance&&this._forceLayoutInstance.dispose(e),this.groupGL.removeAll(),this._layoutId=-1,this._pointsBuilder.dispose()},remove:function(){this.groupGL.removeAll(),this._control.dispose()}});var tf;function rf(e){return e instanceof Array||(e=[e,e]),e}(0,i.use)((function(e){function t(){}e.registerChartView(ef),e.registerSeriesModel(Gd),e.registerVisual((function(e){const t={};e.eachSeriesByType("graphGL",(function(e){var r=e.getCategoriesData(),n=e.getData(),a={};r.each((function(i){var n=r.getName(i);a["ec-"+n]=i;var o=r.getItemModel(i),s=o.getModel("itemStyle").getItemStyle();s.fill||(s.fill=e.getColorFromPalette(n,t)),r.setItemVisual(i,"style",s);var l=["symbol","symbolSize","symbolKeepAspect"];for(let e=0;e65535?new Uint32Array(3*i):new Uint16Array(3*i))},addLine:function(e){var t=this._vertexOffset;this.attributes.position.set(t,[e[0],e[1],1]),this.attributes.position.set(t+1,[e[0],e[1],-1]),this.attributes.position.set(t+2,[e[0],e[1],2]),this.attributes.position.set(t+3,[e[0],e[1],-2]),this.setTriangleIndices(this._faceOffset++,[t,t+1,t+2]),this.setTriangleIndices(this._faceOffset++,[t+1,t+2,t+3]),this._vertexOffset+=4}});Xe.import("@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n");var of=function(){this.motionBlurFactor=.99,this.vectorFieldTexture=new Dr({type:wr.FLOAT,flipY:!1}),this.particleLife=[5,20],this._particleType="point",this._particleSize=1,this.particleColor=[1,1,1,1],this.particleSpeedScaling=1,this._thisFrameTexture=null,this._particlePass=null,this._spawnTexture=null,this._particleTexture0=null,this._particleTexture1=null,this._particlePointsMesh=null,this._surfaceFrameBuffer=null,this._elapsedTime=0,this._scene=null,this._camera=null,this._lastFrameTexture=null,this._supersampling=1,this._downsampleTextures=[],this._width=512,this._height=512,this.init()};of.prototype={constructor:of,init:function(){var e={type:wr.FLOAT,minFilter:wr.NEAREST,magFilter:wr.NEAREST,useMipmap:!1};this._spawnTexture=new Dr(e),this._particleTexture0=new Dr(e),this._particleTexture1=new Dr(e),this._frameBuffer=new zi({depthBuffer:!1}),this._particlePass=new pn({fragment:Xe.source("ecgl.vfParticle.particle.fragment")}),this._particlePass.setUniform("velocityTexture",this.vectorFieldTexture),this._particlePass.setUniform("spawnTexture",this._spawnTexture),this._downsamplePass=new pn({fragment:Xe.source("clay.compositor.downsample")});var t=new Sr({renderOrder:10,material:new le({shader:new Xe(Xe.source("ecgl.vfParticle.renderPoints.vertex"),Xe.source("ecgl.vfParticle.renderPoints.fragment"))}),mode:Sr.POINTS,geometry:new Vr({dynamic:!0,mainAttribute:"texcoord0"})}),r=new Sr({renderOrder:10,material:new le({shader:new Xe(Xe.source("ecgl.vfParticle.renderLines.vertex"),Xe.source("ecgl.vfParticle.renderLines.fragment"))}),geometry:new af,culling:!1}),i=new Sr({material:new le({shader:new Xe(Xe.source("ecgl.color.vertex"),Xe.source("ecgl.color.fragment"))}),geometry:new ki});i.material.enableTexture("diffuseMap"),this._particlePointsMesh=t,this._particleLinesMesh=r,this._lastFrameFullQuadMesh=i,this._camera=new un,this._thisFrameTexture=new Dr,this._lastFrameTexture=new Dr},setParticleDensity:function(e,t){for(var r=new Float32Array(e*t*4),i=0,n=this.particleLife,a=0;a0?e[e.length-1]:this._lastFrameTexture},setRegion:function(e){this._particlePass.setUniform("region",e)},resize:function(e,t){this._lastFrameTexture.width=e*this._supersampling,this._lastFrameTexture.height=t*this._supersampling,this._thisFrameTexture.width=e*this._supersampling,this._thisFrameTexture.height=t*this._supersampling,this._width=e,this._height=t},setParticleSize:function(e){var t=this._getParticleMesh();if(e<=2)return t.material.disableTexture("spriteTexture"),void(t.material.transparent=!1);this._spriteTexture||(this._spriteTexture=new Dr),this._spriteTexture.image&&this._spriteTexture.image.width===e||(this._spriteTexture.image=function(e){var t=document.createElement("canvas");t.width=t.height=e;var r=t.getContext("2d");return r.fillStyle="#fff",r.arc(e/2,e/2,e/2,0,2*Math.PI),r.fill(),t}(e),this._spriteTexture.dirty()),t.material.transparent=!0,t.material.enableTexture("spriteTexture"),t.material.set("spriteTexture",this._spriteTexture),this._particleSize=e},setGradientTexture:function(e){var t=this._getParticleMesh().material;t[e?"enableTexture":"disableTexture"]("gradientTexture"),t.setUniform("gradientTexture",e)},setColorTextureImage:function(e,t){this._getParticleMesh().material.setTextureImage("colorTexture",e,t,{flipY:!0})},setParticleType:function(e){this._particleType=e},clearFrame:function(e){var t=this._frameBuffer;t.attach(this._lastFrameTexture),t.bind(e),e.gl.clear(e.gl.DEPTH_BUFFER_BIT|e.gl.COLOR_BUFFER_BIT),t.unbind(e)},setSupersampling:function(e){this._supersampling=e,this.resize(this._width,this._height)},_updateDownsampleTextures:function(e,t){for(var r=this._downsampleTextures,i=Math.max(Math.floor(Math.log(this._supersampling/t.getDevicePixelRatio())/Math.log(2)),0),n=2,a=this._width*this._supersampling,o=this._height*this._supersampling,s=0;s=359&&(n[0]>0&&(n[0]=0),a[0]1?(t.material.shader!==this._meshLinesShader&&t.material.attachShader(this._meshLinesShader),t.mode=Ka.Mesh.TRIANGLES):(t.material.shader!==this._nativeLinesShader&&t.material.attachShader(this._nativeLinesShader),t.mode=Ka.Mesh.LINES),r=r||0,i=i||n.count(),s.resetOffset();var u=0,c=0,d=[],f=[],p=[],m=[],g=[],_=.3,v=.7;function y(){f[0]=d[0]*v+m[0]*_-(d[1]-m[1])*a,f[1]=d[1]*v+m[1]*_-(m[0]-d[0])*a,p[0]=d[0]*_+m[0]*v-(d[1]-m[1])*a,p[1]=d[1]*_+m[1]*v-(m[0]-d[0])*a}if(o||0!==a)for(var x=r;x{t.exports=e}},r={};function i(e){if(r[e])return r[e].exports;var n=r[e]={exports:{}};return t[e](n,n.exports,i),n.exports}return i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i(468)})()})); \ No newline at end of file diff --git a/package.json b/package.json index 62d79fd1..da6c508d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "echarts-gl", "description": "Extension pack of ECharts providing 3D plots and globe visualization", - "version": "2.0.7", + "version": "2.0.8", "maintainers": [ { "name": "Yi Shen"