@arcgis/core 4.32.0-next.20241219 → 4.32.0-next.20241221
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WebLinkChart.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0da2aaca3f0b4fe910e3.js → 015285436ca965f94e17.js} +1 -1
- package/assets/esri/core/workers/chunks/127c82cdb229434883b6.js +1 -0
- package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +1 -0
- package/assets/esri/core/workers/chunks/{5119811063bfc97fb725.js → 1a713cc601c6fcd97d2f.js} +1 -1
- package/assets/esri/core/workers/chunks/{48f6eb3b63fec1d3312d.js → 2d908c115ea18e813b95.js} +1 -1
- package/assets/esri/core/workers/chunks/{11052103efe3d53a784e.js → 31d9f0a37a5d0a1c450b.js} +1 -1
- package/assets/esri/core/workers/chunks/{e7c3199813070ff30a3d.js → 3bb94da29dac3367ecc6.js} +1 -1
- package/assets/esri/core/workers/chunks/3ed7c8138231de3a3b96.js +1 -0
- package/assets/esri/core/workers/chunks/{9cc9bac6e02ab241e852.js → 4746b7afa90ea3641e60.js} +1 -1
- package/assets/esri/core/workers/chunks/{ce33d2b5f22a5c566661.js → 4b5dbdcad438cb2dd4bf.js} +1 -1
- package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +1 -0
- package/assets/esri/core/workers/chunks/{ee1ddf56549bb169509c.js → 6332da54159d72a6ce66.js} +1 -1
- package/assets/esri/core/workers/chunks/648d7d8fa19a2e772c89.js +1 -0
- package/assets/esri/core/workers/chunks/66b411119b8ffb99b9dc.js +1 -0
- package/assets/esri/core/workers/chunks/69efc716991a407c3d23.js +1 -0
- package/assets/esri/core/workers/chunks/88c68881cbdf4e911832.js +1 -0
- package/assets/esri/core/workers/chunks/8e60de347b209a753c73.js +1 -0
- package/assets/esri/core/workers/chunks/{fb43c44a7d6b61f31e75.js → 94432e04de01ee7adc0e.js} +1 -1
- package/assets/esri/core/workers/chunks/{80ac74da0b0e45e74beb.js → 9a498f2c007f4d78d4dd.js} +1 -1
- package/assets/esri/core/workers/chunks/{770d233254419b741616.js → 9ad7d095e614e7e8d7f5.js} +1 -1
- package/assets/esri/core/workers/chunks/9dd167db3f2e68b71cea.js +1 -0
- package/assets/esri/core/workers/chunks/{b15894bff153e0793ef4.js → 9f495ad57cdbfa90c5b8.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7b76bc7bff34abc2253.js → a0b3d70a1b0360084593.js} +1 -1
- package/assets/esri/core/workers/chunks/a90611cdc86190799560.js +1 -0
- package/assets/esri/core/workers/chunks/{e213f4a1c95a33f80cdc.js → aedff36d3fec86abb9fb.js} +1 -1
- package/assets/esri/core/workers/chunks/{194013d377e7dd00845f.js → b611f46835edcd6eefcc.js} +1 -1
- package/assets/esri/core/workers/chunks/{eddab4dc706e75c6637f.js → bff74200a0df0950cf08.js} +1 -1
- package/assets/esri/core/workers/chunks/{8f2ffb6944c9028d3bea.js → c08cb75c3eef6c45f604.js} +1 -1
- package/assets/esri/core/workers/chunks/c1c216b0aebe86311fae.js +1 -0
- package/assets/esri/core/workers/chunks/{f2b195d04414417682d4.js → cbf57abb537e86c1dd7f.js} +1 -1
- package/assets/esri/core/workers/chunks/dce55e7f76adecc055c3.js +1 -0
- package/assets/esri/core/workers/chunks/f2cdb7be3fd65f65c30b.js +1 -0
- package/assets/esri/core/workers/chunks/f9af0473878d960a02f2.js +1 -0
- package/assets/esri/core/workers/chunks/fa1c68f2ffcdff7986b6.js +1 -0
- package/assets/esri/core/workers/chunks/{0f1a7aeec18db5323365.js → fdd8a5eb07466541f1f9.js} +1 -1
- package/assets/esri/themes/base/widgets/_FeatureTable.scss +3 -3
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/OperatorProject.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/form/elements/GroupElement.js +1 -1
- package/form/elements/UtilityNetworkAssociationsElement.d.ts +4 -0
- package/form/elements/{UtilityNetworkAssociationElement.js → UtilityNetworkAssociationsElement.js} +1 -1
- package/form/elements.js +1 -1
- package/form/support/formUtils.js +1 -1
- package/geometry/operators/affineTransformOperator.js +1 -1
- package/geometry/operators/alphaShapeOperator.js +1 -1
- package/geometry/operators/areaOperator.js +1 -1
- package/geometry/operators/autoCompleteOperator.js +1 -1
- package/geometry/operators/boundaryOperator.js +1 -1
- package/geometry/operators/bufferOperator.js +1 -1
- package/geometry/operators/centroidOperator.js +1 -1
- package/geometry/operators/clipOperator.js +1 -1
- package/geometry/operators/containsOperator.js +1 -1
- package/geometry/operators/convexHullOperator.js +1 -1
- package/geometry/operators/crossesOperator.js +1 -1
- package/geometry/operators/cutOperator.js +1 -1
- package/geometry/operators/densifyOperator.js +1 -1
- package/geometry/operators/differenceOperator.js +1 -1
- package/geometry/operators/disjointOperator.js +1 -1
- package/geometry/operators/distanceOperator.js +1 -1
- package/geometry/operators/equalsOperator.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/generalizeOperator.js +1 -1
- package/geometry/operators/geodesicBufferOperator.js +1 -1
- package/geometry/operators/geodesicProximityOperator.js +1 -1
- package/geometry/operators/geodeticAreaOperator.js +1 -1
- package/geometry/operators/geodeticDensifyOperator.js +1 -1
- package/geometry/operators/geodeticDistanceOperator.js +1 -1
- package/geometry/operators/geodeticLengthOperator.js +1 -1
- package/geometry/operators/graphicBufferOperator.js +1 -1
- package/geometry/operators/integrateOperator.js +1 -1
- package/geometry/operators/intersectionOperator.js +1 -1
- package/geometry/operators/intersectsOperator.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/labelPointOperator.js +1 -1
- package/geometry/operators/lengthOperator.js +1 -1
- package/geometry/operators/linesToPolygonsOperator.js +1 -1
- package/geometry/operators/locateBetweenOperator.js +1 -1
- package/geometry/operators/minimumBoundingCircleOperator.js +1 -1
- package/geometry/operators/multiPartToSinglePartOperator.js +1 -1
- package/geometry/operators/offsetOperator.js +1 -1
- package/geometry/operators/overlapsOperator.js +1 -1
- package/geometry/operators/polygonOverlayOperator.js +1 -1
- package/geometry/operators/polygonSlicerOperator.js +1 -1
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/proximityOperator.js +1 -1
- package/geometry/operators/relateOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/simplifyOperator.js +1 -1
- package/geometry/operators/singlePartToMultiPartOperator.js +1 -1
- package/geometry/operators/symmetricDifferenceOperator.js +1 -1
- package/geometry/operators/touchesOperator.js +1 -1
- package/geometry/operators/unionOperator.js +1 -1
- package/geometry/operators/withinOperator.js +1 -1
- package/interfaces.d.ts +231 -71
- package/layers/LinkChartLayer.js +1 -1
- package/layers/graphics/OptimizedFeature.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/knowledgeGraph/supportUtils.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/VideoElement.js +1 -1
- package/layers/support/domainUtils.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/linkChart/OrganicLayoutSettings.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/query/operations/pbfOptimizedFeatureSet.js +1 -1
- package/rest/support/fileFormat.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/ResourceProxy.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/input/handlers/KeyRotate.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/ClusterStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +5 -0
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/support/DebouncedFeatureOverride.js +5 -0
- package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/terrain/TileTexture.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/lib/TextureCompressionWorker.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/support/TextureCompressionHelper.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/webscene/Slide.js +1 -1
- package/webscene/SlideLegend.d.ts +4 -0
- package/webscene/SlideLegend.js +5 -0
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/Features/FeaturesViewModel.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/DigitizationAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
- package/widgets/OrientedImageryViewer/digitizationUtils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print/TemplateOptions.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/support/forms/formUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0e9bd990a8d0691fb9c8.js +0 -1
- package/assets/esri/core/workers/chunks/27933d6ffeebb5c13ab7.js +0 -1
- package/assets/esri/core/workers/chunks/3ef5002b21b1a5b97e11.js +0 -1
- package/assets/esri/core/workers/chunks/48266c87363e7dcaefb3.js +0 -1
- package/assets/esri/core/workers/chunks/5786b190ad3e2d933245.js +0 -1
- package/assets/esri/core/workers/chunks/668679baf519ada9ae28.js +0 -1
- package/assets/esri/core/workers/chunks/737f381f2cfeddb96d15.js +0 -1
- package/assets/esri/core/workers/chunks/84d26c6c805f5855ffd3.js +0 -1
- package/assets/esri/core/workers/chunks/8f2f2d497b875e2b4139.js +0 -1
- package/assets/esri/core/workers/chunks/a4c8b773283ea8f0e256.js +0 -1
- package/assets/esri/core/workers/chunks/a68068b3151a14c4a0ad.js +0 -1
- package/assets/esri/core/workers/chunks/ad99308fb9678cdce917.js +0 -1
- package/assets/esri/core/workers/chunks/cc427e8f1b17744b6ea4.js +0 -1
- package/assets/esri/core/workers/chunks/dd4bd96dfb7f9921b774.js +0 -1
- package/assets/esri/core/workers/chunks/e1a03231e24293e66418.js +0 -1
- package/assets/esri/core/workers/chunks/fce1158755f959730602.js +0 -1
- package/views/2d/layers/features/sources/strategies/chunks/OverrideChunk.js +0 -5
- package/views/3d/input/handlers/SingleKey.js +0 -5
- package/views/3d/input/handlers/SingleKeyResetHeading.js +0 -5
- package/views/3d/input/handlers/SingleKeyResetTilt.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Q as t,g as e,h as n,a as r,P as i,aI as s,S as o,J as a,M as m,L as c,ac as u,m as l,c as h,aJ as g,b as _,n as f,aK as p,F as d,aL as y,ap as P,C as x,R as C,aM as E,aN as S,aO as w,aP as b,aQ as T,aR as v,E as I,t as D,K as G,k as N,aS as M,aT as A,O as q}from"./QuadraticBezier.js";import{t as Y,g as X,p as R,b as F,f as O,G as L,d as U,k as H,i as z,a as V,e as j,u as k,B,C as Z}from"./Geometry.js";import{aw as K,i as W,P as Q,d as J,T as $,c as tt,E as et,s as nt,r as rt,ax as it,Q as st,ay as ot,aa as at,e as mt,y as ct,a as ut,S as lt,v as ht,q as gt,m as _t,l as ft,b as pt,av as dt,D as yt,az as Pt,aA as xt,V as Ct,aB as Et,H as St,aC as wt,o as bt,aD as Tt,p as vt}from"./Transformation2D.js";import{b as It,c as Dt}from"./tslib.es6.js";import{c as Gt,b as Nt}from"./Clipper-a9xfvRaw.js";import{O as Mt}from"./OperatorDensify.js";import{O as At,m as qt,o as Yt}from"./OperatorSimplify.js";import{O as Xt}from"./OperatorClip.js";import{O as Rt}from"./OperatorIntersection.js";import{G as Ft}from"./SimpleGeometryCursor.js";import{l as Ot,m as Lt,r as Ut,d as Ht,b as zt,e as Vt,u as jt,v as kt,f as Bt,C as Zt}from"./CrackAndCluster-CfzXpEle.js";import{O as Kt}from"./OperatorUnion.js";import{O as Wt}from"./OperatorDifference.js";class Qt{constructor(t){if(this.m_geom=this.m_sr=null,t){if(t.move)return this.m_geom=t.move.m_geom,t.move.m_geom=null,this.m_sr=t.move.m_sr,void(t.move.m_sr=null);if(t.copy)return this.m_geom=t.copy.m_geom?t.copy.m_geom.clone():null,void(this.m_sr=t.copy.m_sr);t.geom&&(this.m_geom=t.geom),t.sr&&(this.m_sr=t.sr)}}getGeometry(){return this.m_geom}getSpatialReference(){return this.m_sr}setGeometry(t){this.m_geom=t}setSpatialReference(t){this.m_sr=t}equals(t,e){const n=t;return!(!this.m_sr&&n.m_sr)&&(!(this.m_sr&&!n.m_sr)&&(!(!this.m_geom&&n.m_geom)&&(!(this.m_geom&&!n.m_geom)&&(!(this.m_sr&&n.m_sr&&!this.m_sr.equals(n.m_sr))&&!(this.m_geom&&n.m_geom&&!this.m_geom.equals(n.m_geom,e))))))}clone(){let t=null;return this.m_geom&&(t=this.m_geom.clone()),new Qt({geom:t,sr:this.m_sr})}hasGeom(){return!!this.m_geom}}class Jt{constructor(t){this.m_factor=1,this.m_wkid=0,this.m_peUnit=null,t&&(this.m_peUnit=t,this.m_factor=t.getUnitFactor(),this.m_wkid=t.getCode(),this.m_wkid<0&&(this.m_wkid=0))}getName(){return this.m_peUnit.getName()}getID(){return this.m_wkid}getConversionFactor(t){return this.getUnitType()!==t.getUnitType()&&Y("unit type mismatch"),this.getUnitToBaseFactor()/t.getUnitToBaseFactor()}getUnitToBaseFactor(){return this.m_factor}getHashCode(){return K(W(this.getUnitType()),W(this.getUnitToBaseFactor()))}equals(t){return!!t&&(this.getUnitType()===t.getUnitType()&&this.getUnitToBaseFactor()===t.getUnitToBaseFactor()&&this.getID()===t.getID()&&this.getName()===t.getName())}static isValidWkid(t){return!1}}const $t={330:104878,500:104879,1300:104899,1450:104986,2230:104988,3800:104978,5e3:104919,6200:104906,8200:104909,9500:104927,9600:104977,1e4:[104911,104936],11e3:104941,11080:104872,11100:104907,12e3:104920,12400:104995,13e3:104948,14e3:[104923,104989],15e3:[104913,104954],15100:104976,16e3:[104926,104931],18e3:[104922,104982],21e3:104947,21500:104877,27e3:[104950,104957],29e3:104964,3e4:104921,31e3:104949,33e3:104946,4e4:[104914,104967],40600:104897,41900:104937,42e3:104951,43100:104993,49300:104924,50100:104939,54e3:104955,58200:104981,59500:104930,74e3:104961,77e3:104956,79e3:104962,83500:104910,85e3:104917,88800:104934,89200:104985,96e3:104997,104e3:104963,106500:104898,11e4:104938,133e3:104932,135e3:104983,17e4:104965,198200:104987,198630:104935,208e3:104966,235800:104952,249400:104929,252100:104980,255e3:104973,47e4:104972,529800:104942,531e3:104996,56e4:104928,561400:104979,578900:104945,584700:104959,593e3:104970,606e3:104999,718e3:104933,745700:104984,761400:104953,763500:104994,764e3:104940,788900:104958,1188300:104998,1195e3:104969,1352600:104968,1560800:104874,1562090:104915,1737400:104903,1821460:104918,1821490:104876,2409300:104912,2410300:104873,2439400:104974,2439700:104900,2575e3:104943,2631200:104875,2632345:104916,3393400:104904,3396190:[104905,104971],6051e3:104901,6051800:104902,637e4:104128,6370997:[4052,37008],6371e3:4035,6371007:4047,6371228:[4053,10346],6376045:[8042,8043],6376523:[4027,4901,4902],6376896:37007,6378135:[4122,4322,4324,4720,4985,4987],6378136:[4740,4923,7678,7680,9474,9475,104017,104018],6378137:[3823,3824,3888,3889,4017,4019,4023,4031,4040,4046,4055,4074,4075,4080,4081,4121,4126,4130,4133,4140,4141,4148,4151,4152,4163,4166,4167,4170,4171,4172,4173,4176,4180,4189,4190,4258,4269,4283,4318,4319,4326,4463,4466,4469,4470,4480,4482,4483,4490,4557,4558,4612,4617,4619,4624,4627,4659,4661,4667,4669,4670,4674,4686,4687,4693,4694,4702,4737,4742,4747,4749,4750,4755,4756,4757,4758,4759,4761,4762,4763,4764,4765,4883,4885,4887,4889,4893,4895,4898,4907,4909,4921,4925,4927,4929,4931,4933,4935,4937,4939,4941,4943,4945,4947,4949,4951,4953,4955,4957,4959,4961,4963,4965,4967,4971,4975,4977,4979,4981,4983,4989,4997,4999,5012,5013,5245,5246,5251,5252,5263,5264,5323,5324,5340,5342,5353,5354,5359,5360,5364,5365,5370,5371,5372,5373,5380,5381,5392,5393,5488,5489,5545,5546,5592,5593,5885,5886,6134,6135,6310,6311,6318,6319,6321,6322,6324,6325,6364,6365,6667,6668,6705,6706,6782,6783,6980,6982,6983,6987,6989,6990,7034,7035,7036,7037,7038,7039,7040,7041,7042,7072,7073,7084,7085,7086,7087,7133,7135,7136,7138,7139,7372,7373,7657,7659,7661,7663,7665,7685,7686,7797,7798,7816,7843,7844,7880,7881,7885,7886,7900,7901,7902,7903,7904,7905,7906,7907,7908,7909,7910,7911,7912,7915,7917,7919,7921,7923,7925,7927,7929,7931,8085,8086,8231,8232,8235,8237,8239,8240,8244,8246,8248,8249,8251,8252,8254,8255,8399,8403,8426,8427,8449,8542,8544,8545,8684,8685,8698,8699,8817,8818,8860,8888,8899,8900,8901,8902,8906,8907,8916,8918,8920,8922,8924,8926,8928,8930,8932,8934,8936,8938,8940,8942,8944,8946,8948,8949,8972,8973,8974,8975,8976,8977,8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,8993,8994,8995,8996,8997,8998,8999,9e3,9002,9003,9005,9006,9008,9009,9011,9012,9013,9014,9016,9017,9018,9019,9053,9054,9055,9056,9057,9059,9060,9061,9062,9063,9064,9065,9066,9067,9068,9069,9071,9072,9074,9075,9139,9140,9147,9148,9152,9153,9183,9184,9293,9294,9299,9308,9309,9332,9333,9364,9372,9379,9380,9384,9453,9469,9470,9546,9547,9695,9696,9701,9702,9739,9754,9755,9758,9763,9776,9777,9778,9779,9781,9782,9783,9784,9866,9871,9939,9964,9969,9974,9989,9990,10175,10177,10178,10185,10191,10196,10204,10209,10214,10219,10224,10229,10237,10272,10277,10283,10284,10298,10299,10300,10304,10305,10307,10309,10310,10311,10312,10327,10328,10413,10414,10468,10474,10475,10570,10571,10605,10606,10623,10628,20033,20040,20041,20045,20046,104009,104010,104011,104012,104013,104014,104015,104016,104019,104020,104021,104022,104024,104027,104028,104050,104100,104107,104108,104110,104111,104114,104115,104116,104117,104118,104119,104120,104121,104122,104123,104124,104129,104133,104134,104137,104141,104142,104143,104144,104145,104179,104180,104181,104182,104183,104184,104185,104186,104199,104223,104257,104258,104259,104260,104286,104287,104602,104613,104644,104645,104646,104647,104653,104804,104896,104991],6378140:4610,6378145:[4025,4276,4760,4891,37001],6378150:37003,6378155:[37004,37207],6378160:[3821,4003,4021,4036,4202,4203,4237,4238,4291,4618,4708,5527,37231,104023,104136],6378166:37002,6378200:[4020,4229,4286,4303,4706],6378245:[4024,4147,4164,4178,4179,4191,4200,4205,4214,4284,4317,4555,4676,4677,4678,4991,4993,5560,5561,37257,104135],6378270:[4732,37005,37229],6378273:[4054,10345],6378300:[4029,4168,4174],6378388:[4022,4123,4153,4154,4158,4159,4160,4161,4165,4181,4182,4183,4184,4185,4192,4194,4195,4196,4199,4204,4207,4208,4215,4218,4221,4224,4225,4230,4231,4233,4235,4236,4247,4248,4249,4254,4255,4259,4264,4265,4271,4272,4274,4285,4287,4288,4292,4297,4309,4311,4313,4316,4472,4475,4611,4614,4615,4616,4621,4622,4623,4625,4626,4628,4629,4630,4631,4632,4633,4636,4637,4639,4641,4642,4643,4644,4645,4646,4658,4660,4662,4663,4664,4665,4668,4672,4673,4684,4688,4689,4690,4691,4692,4698,4704,4705,4707,4709,4710,4711,4712,4714,4715,4716,4718,4719,4721,4722,4724,4725,4727,4728,4729,4730,4733,4734,4735,4739,4741,4753,4754,4802,4803,4806,4809,4810,4823,4824,4900,5524,6883,8428,8430,8431,9248,9251,9253,9403,9893,10158,10249,10252,37201,37204,37205,37212,37213,37214,37215,37216,37217,37218,37219,37221,37222,37224,37226,37227,37230,37232,37233,37234,37235,37237,37238,37241,37242,37245,37246,37247,37249,37250,37251,37253,37259,104104,104106,104125,104126,104127,104130,104138,104248],6378523:104786,24764e3:104960,25559e3:104944,60268e3:104925,71492e3:104908,6957e5:104975,6377397.155:[3819,3906,4004,4120,4124,4125,4149,4150,4156,4162,4211,4219,4257,4262,4280,4289,4294,4295,4301,4306,4308,4312,4314,4613,4666,4745,4746,4801,4804,4805,4808,4813,4814,4815,4818,4820,4904,5132,5228,5229,5681,5830,8351,9267,10268,37255,104101,104102,104105,104131,104648,104696,104697,104990,104992],6377563.396:[4001,4188,4277,4278,4279],6377340.189:[4002,4299,4300],6377492.018:[4005,4273,4817],6377483.865280418:[4006,4293],6378293.645208759:[4007,4157,4302,4738,5464],6378206.4:[4008,4127,4128,4129,4135,4136,4137,4138,4139,4169,4216,4242,4253,4267,4608,4609,4638,4675,4683,4695,4717,4723,4726,4995,5451,5467,37220,37239,37243,37252,37260,104e3,104109,104112,104113,104132],6378450.047:[4009,4268],6378300.789:[4010,4281],6378249.2:[4011,4014,4155,4193,4206,4213,4223,4226,4227,4228,4252,4261,4266,4275,4282,4296,4304,4310,4315,4671,4807,4811,4816,4821,37223,37225,104139,104140,104261,104304],6378249.145:[4012,4013,4132,4134,4142,4143,4175,4197,4198,4201,4209,4210,4212,4220,4222,4232,4234,4246,4250,4251,4256,4260,4263,4270,4305,4307,4600,4601,4602,4603,4604,4605,4606,4607,4620,4679,4680,4696,4697,4699,4700,4701,4703,4713,4731,4736,4743,4744,4812,4819,6881,6882,6892,6894,8694,37206,37208,37211,37228,37240,37254,104025,104026,104103,104305],6377276.345:[4015,4131,4144,4239,4240,4244,4682,5233,6207,37202,104256,104664,104693],6377298.556:[4016,4298],6377304.063:[4018,4245],6378298.3:[4028,4903],6378136.2:4032,6378136.3:4033,6378249.144808011:[4034,4241],20922931.8:[4042,4243],6377301.243:[4044,4145,37203],6377299.151:[4045,4146],6377019.27:[4657,10256,10260,10265],6378306.3696:[4748,4752],6377295.664:[4751,37006],6378136.5:[7682,7683],6371008.7714:104047,6378418.941:[104700,104726,104760],6378586.581:[104701,104743],6378505.809:104702,6378544.823:104703,6378490.569:104704,6378470.757:[104705,104776],6378403.701:[104706,104750],6378434.181:[104707,104724,104739,104764],6378454.907:104708,6378400.653:104709,6378567.378:104710,6378546.957:[104711,104717,104780],6378476.853:[104712,104736],6378411.321:[104713,104728],6378647.541:[104714,104715],6378514.953:[104716,104782],6378421.989:[104718,104770],6378481.425:[104719,104753,104774,104781],6378518.001:[104720,104725],6378521.049:[104721,104723,104731,104745,104748],6378464.661:104722,6378436.619:104727,6378574.389:[104729,104730],6378472.281:[104732,104756],6378498.189:[104733,104746],6378449.421:[104734,104766],6378525.621:[104735,104754],6378466.185:104737,6378496.665:104738,6378643.579:104740,6378559.758:104741,6378414.369:[104742,104763,104772],6378441.801:104744,6378502.761:[104747,104759,104773,104775],6378617.061:104749,6378624.681:[104751,104765],6378468.623:104752,6378445.763:[104755,104758,104761],6378670.401:104757,6378438.753:104762,6378543.909:104767,6378605.783:104768,6378540.861:104769,6378443.325:[104771,104784],6378548.481:104777,6378463.746:104778,6378426.561:104779,6378453.688:104783,6378530.193:104785,6378376.271:[104800,104828],6378471.92:104801,6378472.931:104802,6378411.351:104803,6378380.991:104805,6378414.96:104806,6378345.09:[104807,104819,104844,104870],6378412.542:104808,6378470.401:104809,6378376.331:104810,6378379.031:104811,6378407.621:104812,6378376.811:[104813,104827],6378313.92:104814,6378414.93:104815,6378413.021:104816,6378380.381:104817,6378530.851:104818,6378591.521:104820,6378378.881:104821,6378408.481:[104822,104832],6378375.601:[104823,104838],6378408.041:104824,6378655.071:104825,6378409.151:104826,6378315.7:[104829,104840,104845,104851],6378285.86:[104830,104835,104859],6378379.301:104831,6378560.121:104833,6378531.821:104834,6378500.6:104836,6378376.041:104837,6378406.601:104839,6378438.991:104841,6378345.42:104842,6378593.86:104843,6378381.271:[104846,104847],6378413.671:104848,6378344.377:104849,6378563.891:104850,6378408.091:104852,6378377.671:104853,6378472.751:104854,6378412.511:104855,6378407.281:104856,6378534.451:104857,6378406.051:104858,6378532.921:104860,6378380.091:104861,6378408.941:104862,6378624.171:104863,6378377.411:104864,6378474.591:104865,6378407.141:104866,6378376.871:104867,6378375.251:104868,6378405.971:104869,6378437.651:104871};function te(){for(const t in $t)delete $t[t]}class ee extends Jt{constructor(t){if("number"==typeof t)return super(),this.m_factor=t,void(this.m_wkid=0);super(t)}getUnitType(){return 1}convertFromRadians(t){return t/this.getUnitToBaseFactor()}convertToRadians(t){return t*this.getUnitToBaseFactor()}}function ne(t){return new Aa}function re(t){return t.getType()===Mm.PE_TYPE_LINUNIT?new Aa(t):t.getType()===Mm.PE_TYPE_ANGUNIT?new ee(t):void Y("peUnit")}function ie(t){const e=Um(null);return t.getType()===Mm.PE_TYPE_PROJCS||t.getType()===Mm.PE_TYPE_GEOGCS?e.reset(t.getUnit()):Y("PE_coord_sys"),e.get()||V("cannot create units from coord sys"),re(e.get())}class se{constructor(e,n,r){void 0===e?(this.x=new St,this.y=new St,this.z=new St):e instanceof t?(this.x=new St(e.x),this.y=new St(e.y),this.z=new St(e.z)):e instanceof St?(this.x=e.clone(),this.y=n.clone(),this.z=r.clone()):Y("EPoint3D constructor")}dotProduct(t){return this.x.mulE(t.x).addE(this.y.mulE(t.y)).addE(this.z.mulE(t.z))}crossProduct(t){return new se(this.y.mulE(t.z).subE(this.z.mulE(t.y)),this.z.mulE(t.x).subE(this.x.mulE(t.z)),this.x.mulE(t.y).subE(this.y.mulE(t.x)))}crossProductVector(t){const e=this.y.mulE(t.z).subE(t.y.mulE(this.z)),n=t.x.mulE(this.z).subE(this.x.mulE(t.z)),r=this.x.mulE(t.y).subE(t.x.mulE(this.y));return new se(e,n,r)}sqrLength(){return this.x.mulE(this.x).addE(this.y.mulE(this.y)).addE(this.z.mulE(this.z))}length(){return this.sqrLength().sqrt()}static distance(t,e){return t.sub(e).length()}negate(){return new se(this.x.negate(),this.y.negate(),this.z.negate())}add(t){return new se(this.x.addE(t.x),this.y.addE(t.y),this.z.addE(t.z))}sub(t){return new se(this.x.subE(t.x),this.y.subE(t.y),this.z.subE(t.z))}subThis(t){return this.x.subThisE(t.x),this.y.subThisE(t.y),this.z.subThisE(t.z),this}addThis(t){return this.x.addThisE(t.x),this.y.addThisE(t.y),this.z.addThisE(t.z),this}mul(t){return new se(this.x.mulE(t),this.y.mulE(t),this.z.mulE(t))}div(t){return new se(this.x.divE(t),this.y.divE(t),this.z.divE(t))}eq(t){return this.x.eq(t.x)&&this.y.eq(t.y)&&this.z.eq(t.z)}isZero(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()}value(){return t.construct(this.x.value(),this.y.value(),this.z.value())}}class oe{constructor(e){this.m_origin=new t,this.m_normal=new t,this.m_axisX=new t,this.m_axisY=new t,X(0)}assign(t){return X(0),this}set(t,e,n,r){X(0)}setFromPoints(t,e,n){return X(0),!1}getCoord(t,e){return X(0),{}}getCoord2D(t){return X(0),{}}getCoordX(t,e){return X(0),0}getCoordY(t,e){return X(0),0}getCoordZ(t,e){return X(0),0}setPreferredAxisX(t){X(0)}getOrigin(){return X(0),{}}getNormal(){return X(0),{}}getAxisX(){return this.m_axisX.clone()}getAxisY(){return this.m_axisY.clone()}setAxisX(t,e=!1){X(0)}setAxisY(t,e=!1){X(0)}recalculateAxisY(){X(0)}setOrigin(t){X(0)}setNormal(t,e){X(0)}intersect(t,e){return X(0),!1}intersectLine(t){return X(0),0}intersectLineEx(t,e){return X(0),0}closestCoordinate(t){return X(0),{}}projectVector(t){return X(0),{}}signedDistance(t){return X(0),0}distance(t){return X(0),0}}function ae(t,e){return!1}function me(t,e,n,r,i=100,s=ae){let o,a,m,c,u,l,h,g,_;X(r>0);let f,p,d,y=0,P=0;const x=dt();e>n&&(n=pt(e,e=n));const C=t(e),E=t(n);C<E?(o=a=m=e,c=u=l=C):(o=a=m=n,c=u=l=E);let S=0;for(;S<i&&(d=.5*(n-e),_=e+d,f=r*(Math.abs(o)+.25),p=2*f,!(s(o,c)||Math.abs(o-_)<=p-d));++S){if(Math.abs(P)>f){const t=(o-a)*(c-l);let r=(o-m)*(c-u),i=(o-m)*r-(o-a)*t;r=2*(r-t),r>0&&(i=-i),r=Math.abs(r);const s=P;P=y,Math.abs(i)>=Math.abs(r*s*.5)||i<=r*(e-o)||i>=r*(n-o)?(P=o>=_?e-o:n-o,y=dt()*P):(y=i/r,g=o+y,(g-e<p||n-g<p)&&(y=_-o<0?-Math.abs(f):Math.abs(f)))}else P=o>=_?e-o:n-o,y=P*x;g=o+y,h=t(g),h<c?(g>=o?e=o:n=o,m=a,a=o,o=g,l=u,u=c,c=h):(g<o?e=g:n=g,h<=u||a===o?(m=a,a=g,l=u,u=h):(h<=l||m===o||m===a)&&(m=g,l=h))}return J(o,c)}function ce(t,e,n){if(t>n){t-=Math.ceil((t-n)/vt)*vt}else if(t<e){t+=Math.ceil((e-t)/vt)*vt}return t}function ue(t,e,n){return le(t,e,n,0)}function le(t,e,n,r){const i=n.x,s=n.y;return ge(t,e,Math.cos(i),Math.sin(i),Math.cos(s),Math.sin(s),r)}function he(t,e,n,r,i,s){return ge(t,e,n,r,i,s,0)}function ge(e,n,r,i,s,o,a){const m=e/Math.sqrt(1-n*o*o),c=m+a,u=c*s*r,l=c*s*i,h=(m*(1-n)+a)*o;return t.construct(u,l,h)}function _e(t,e,n){const r=new St,i=new St,s=new St,o=new St;r.setCos(n.x),i.setSin(n.x),s.setCos(n.y),o.setSin(n.y);const a=o.negate().mulE(o.mul(e)).add(1).sqrt(),m=new St(t).divE(a),c=m.mulE(s).mulE(r),u=m.mulE(s).mulE(i),l=m.mul(1-e).mulE(o);return new se(c,u,l)}function fe(t,e,n){const r=n.x,i=n.y,s=n.z,o=Math.atan2(i,r),a=Math.sqrt(r*r+i*i),m=Math.atan2(s,(1-e)*a);return Q.construct(o,m)}function pe(t,e,n){const r=1-e,i=t/Math.sqrt(mt(n.x)+mt(n.y)+mt(n.z)/r);return n.mul(i)}function de(e,n,r,i,s){const o=ue(e,n,r),a=ue(e,n,i);return fe(e,n,t.lerp(o,a,s))}function ye(e,n,r){const i=new t;return i.setCrossProductVector(n,r),Math.abs(Math.atan2(i.length(),n.dotProduct(r)))*e}function Pe(e,n,r,i,s){const o=r.getUnitVector(),a=i.getUnitVector(),m=n.getUnitVector(),c=new t;if(c.setCrossProductVector(o,a),!c.isZero()){c.normalizeThis();const t=m.sub(c.mul(c.dotProduct(m)));if(!t.isZero()){t.normalizeThis();const n=o.add(a).mul(.5);if(n.dotProduct(t)>n.dotProduct(o)){const n=Math.abs(c.dotProduct(m)),r=Math.asin(n);return s.assign(t.getUnitVector().mul(e)),r*e}}}const u=ye(1,o,m),l=ye(1,a,m);return u<=l?(s.assign(r),u*e):(s.assign(i),l*e)}function xe(t,e,n,r){const i={stack:[],error:void 0,hasError:!1};try{const s=It(i,new Gm,!1);return Fm.geodeticDistance(t,e,n.x,n.y,r.x,r.y,s,null,null,Mm.PE_LINETYPE_GEODESIC),s.val}catch(s){i.error=s,i.hasError=!0}finally{Dt(i)}}function Ce(e,n,r,i,s){switch(X(r.isFinite()&&i.isFinite()),s){case 0:return xe(e,n,r,i);case 1:return we(e,n,r);case 2:case 3:{const s=ue(e,n,r),o=ue(e,n,i);return t.distance(s,o)}default:H("")}}function Ee(e,n,r,i,s,o=0,a){if(2===o||3===o)return Se(e,n,r,i,s,3===o,a);const m=fe(e,n,r),c=r=>{const a=fe(e,n,t.lerp(i,s,r));return Ce(e,n,m,a,o)},u=t.distance(i,s);if(u>0){const r=Xe(e,u),{first:o,second:m}=me(c,0,1,r);return a&&a.assign(pe(e,n,t.lerp(i,s,o))),J(o,m)}{const t=c(0);return a&&a.assign(i),J(.5,t)}}function Se(e,n,r,i,s,o=!1,a){const m=pe(e,n,r);if(o){const o=new oe({pt0:new t(0,0,0),pt1:i,pt2:s}),c=o.closestCoordinate(r),u=o.closestCoordinate(i),l=o.closestCoordinate(s),h=Q.getClosestCoordinate(u,l,c),g=pe(e,n,t.lerp(i,s,h)),_=t.distance(g,m);return a&&a.assign(g),J(h,_)}const c=r=>{const o=pe(e,n,t.lerp(i,s,r));return t.distance(o,m)},u=t.distance(i,s);if(u>0){const r=Xe(e,u),{first:o,second:m}=me(c,0,1,r);return a&&a.assign(pe(e,n,t.lerp(i,s,o))),J(o,m)}{const e=t.distance(r,i);return a&&a.assign(r),J(.5,e)}}function we(t,e,n,r){const i={stack:[],error:void 0,hasError:!1};try{const r=It(i,new Gm,!1);return Fm.greatEllipticDistance(t,e,n.x,n.y,n.x,n.y,r,null,null),r.val}catch(s){i.error=s,i.hasError=!0}finally{Dt(i)}}function be(e,n,r,i,s){if(Math.abs(r.x-i.x)>Math.PI)return Number.NaN;if(Math.abs(r.y)>gt||Math.abs(i.y)>gt)return Number.NaN;if((Math.abs(r.y)===gt||Math.abs(i.y)===gt)&&r.x!==i.x)return Number.NaN;const{first:o,second:a}=wt(r.x,i.x);let m=s;m=ce(m,o,a);if(!et.construct(r.x,i.x).containsCoordinate(m))return Number.NaN;const c=P.constructPoint2D(r),u=P.constructPoint2D(i),l=_e(1,n,c),h=_e(1,n,u),g=l.crossProductVector(h);if(g.z.isZero()){return r.y}const _=g.x.divE(g.z.negate()),f=g.y.divE(g.z.negate()),p=_.mulE(_).addE(f.mulE(f)).sqrt();if(p.isZero()||_.isZero()&&f.isZero()){return r.y}const d=Math.atan2(f.value(),_.value());let y=Math.atan2(p.value()*Math.cos(d-m),1-n);const x=ue(1,n,Q.construct(m,y)),C=t.construct(x.x,x.y,-x.z),E=g.value().dotProduct(x),S=g.value().dotProduct(C);return Math.abs(S)<Math.abs(E)&&(y=-y),y}function Te(t,e,n,r,i,s){if(s[0]=Number.NaN,s[1]=Number.NaN,Math.abs(n.x-r.x)>Math.PI)return 0;if(Math.abs(n.y)>gt||Math.abs(r.y)>gt)return 0;if((Math.abs(n.y)===gt||Math.abs(r.y)===gt)&&n.x!==r.x)return 0;if(Math.abs(i)>=gt)return 0;if(n.y>0&&r.y>0&&n.y>i&&r.y>i||n.y<0&&r.y<0&&n.y<i&&r.y<i)return 0;const o=P.constructPoint2D(n),a=P.constructPoint2D(r),m=_e(1,e,o),c=_e(1,e,a),u=m.crossProductVector(c);if(u.z.isZero()){return et.construct(n.y,r.y).containsCoordinate(i)?(s[0]=n.x,1):0}const l=u.x.divE(u.z.negate()),h=u.y.divE(u.z.negate()),g=l.mulE(l).addE(h.mulE(h)).sqrt();if(g.isZero()||l.isZero()&&h.isZero())return 0===i?(s[0]=n.x,s[1]=r.x,2):0;const _=(1-e)*Math.tan(i)/g.value();if(Math.abs(_)>1)return 0;const f=Math.acos(_),p=Math.atan2(h.value(),l.value()),d=p-f;let y=p+f;const x=Math.min(n.x,r.x),C=Math.max(n.x,r.x);ce(d,x,C),0!==i?ce(y,x,C):y=d;let E=0;return x<=d&&d<=C&&(s[E]=d,E++),y!==d&&x<=y&&y<=C&&(s[E]=y,E++),E}function ve(t,e){e[0]>.5*Math.PI?(t[0]+=Math.PI,e[0]=Math.PI-e[0]):e[0]<.5*-Math.PI&&(t[0]-=Math.PI,e[0]=-Math.PI-e[0]),X(e[0]>=.5*-Math.PI&&e[0]<=.5*Math.PI)}function Ie(t,e){return t*Math.sqrt(1-e)}function De(t){return 1-t}function Ge(t,e,n,r,i){r=ft(r,-gt,gt),i=ft(i,-gt,gt);const s=gt-.03;let o;o=r>s&&i>s||r<-s&&i<-s?Ne(t,r,i):Me(t,i)-Me(t,r);return.5*(n-e)*o*De(t)}function Ne(t,e,n){let r=1;if(e<0&&(r=-1,e=-e,n=-n),0!==t){const i=t*t,s=i*t,o=[1,(1+11*t)/12,(1+118*t+241*i)/360,(1+1089*t+10419*i+8651*s)/20160,(1+9836*t+318246*i+1027436*s+458881*(s*t))/1814400],a=e=>{let n=0;const r=mt(e)/(t-1);for(let t=o.length-1;t>=0;--t)n=o[t]+n*r;return n*=-mt(e/(1-t)),n},m=a(gt-e);return(a(gt-n)-m)*r}{const t=gt-e,i=gt-n,s=-4*mt(Math.sin(t/2));return(-4*mt(Math.sin(i/2))-s)*r}}function Me(t,e){if(0===e)return 0;const n=Math.sin(e);let r=n,i=n;if(0!==t){r/=1-t*n*n;const e=Math.sqrt(t);i=n*ct(e*n)}return r+i}function Ae(t,e){return t/Math.sqrt(1-e)}function qe(t,e){return(1-e)*t}function Ye(t,e,n){const r=n/(2*qe(t,e)),i=r*r;return n*(1-i*(.16666666666666666-.008333333333333333*i))}function Xe(t,e){if(0!==e){const n=t*Tt()/e;return Math.min(n,1e-10)}return 0}function Re(t,e,n,i,s,o=!0){switch(Le(i)){case 0:break;case 1:Y("relation string length has to be 9 characters");break;default:Y("relation string")}if(o){const r=$e(i,t.getDimension(),e.getDimension());if(0!==r)return dn(t,e,n,r,s)}let m=0;if("number"==typeof n)m=n;else{const i=r.constructEmpty();t.queryEnvelope(i);const s=r.constructEmpty();e.queryEnvelope(s);const o=r.constructEmpty();o.setCoords({env2D:i}),o.mergeEnvelope2D(s),m=a(n,o,!1)}const c=ln(t,m),u=ln(e,m);if(c.isEmpty()||u.isEmpty())return Je(c,u,i);const l=c.getGeometryType(),h=u.getGeometryType();let g=!1;switch(l){case L.enumPolygon:switch(h){case L.enumPolygon:g=Ue(c,u,m,i,s);break;case L.enumPolyline:g=He(c,u,m,i,s);break;case L.enumPoint:g=Be(c,u,m,i);break;case L.enumMultiPoint:g=ze(c,u,m,i,s)}break;case L.enumPolyline:switch(h){case L.enumPolygon:g=He(u,c,m,hn(i),s);break;case L.enumPolyline:g=Ve(c,u,m,i,s);break;case L.enumPoint:g=Ze(c,u,m,i,s);break;case L.enumMultiPoint:g=je(c,u,m,i,s)}break;case L.enumPoint:switch(h){case L.enumPolygon:g=Be(u,c,m,hn(i));break;case L.enumPolyline:g=Ze(u,c,m,hn(i),s);break;case L.enumPoint:g=We(c,u,m,i);break;case L.enumMultiPoint:g=Ke(u,c,m,hn(i))}break;case L.enumMultiPoint:switch(h){case L.enumPolygon:g=ze(u,c,m,hn(i),s);break;case L.enumPolyline:g=je(u,c,m,hn(i),s);break;case L.enumMultiPoint:g=ke(c,u,m,i,s);break;case L.enumPoint:g=Ke(c,u,m,i)}break;default:g=!1}return g}function Fe(t,e,n,i){const s=new cn;s.resetMatrix_(),s.setPredicates_("T*****F**"),s.setAreaAreaPredicates_();const o=r.constructEmpty(),a=r.constructEmpty();t.queryEnvelope(o),e.queryEnvelope(a);let m=!1;if(Cn(o,a,n)&&(s.areaAreaDisjointPredicates_(t,e),m=!0),m||En(t,e),m){return Qe(s.m_matrix,s.m_scl)}let c=new _,u=c.addGeometry(t),l=c.addGeometry(e),h=null,g=0;if(t.hasNonLinearSegments()||e.hasNonLinearSegments()){h=new Zt;const t=c.getEnvelope2D(i),e=Ht(n,t);g=Bt(e,0),zt(c,e,n,12e3,h,null,i)}Vt(c,new x(n,0).add(g),i,!1,!1);const p=c.getGeometry(l).getBoundary();if(c.filterClosePoints(0,!0,!0,!1,f),qt(c,u,-1,!1,f,i),0===c.getPointCount(u))return!1;qt(c,l,-1,!1,f,i),s.setEditShape_(c,i);const d=0===c.getPointCount(l);if(!d){s.computeMatrixTopoGraphHalfEdges_(u,l),s.m_topoGraph.removeShape();const t=Qe(s.m_matrix,s.m_scl);if(!t)return t}const y=c.getGeometry(u);c=new _,u=c.addGeometry(y),l=c.addGeometry(p),s.setEditShape_(c,i),s.m_predicateCount=0,s.resetMatrix_(),s.setPredicates_(d?"T*****F**":"******F**"),s.setAreaLinePredicates_(),s.computeMatrixTopoGraphHalfEdges_(u,l),s.m_topoGraph.removeShape();return Qe(s.m_matrix,s.m_scl)}function Oe(t,e,n,i){const s=new cn;s.resetMatrix_(),s.setPredicates_("T*****F**"),s.setAreaLinePredicates_();const o=r.constructEmpty(),a=r.constructEmpty();t.queryEnvelope(o),e.queryEnvelope(a);let m=!1;if(Cn(o,a,n)&&(s.areaLineDisjointPredicates_(t,e),m=!0),m||En(t,e),m){return Qe(s.m_matrix,s.m_scl)}const c=new _,u=c.addGeometry(t),l=c.addGeometry(e);if(s.setEditShapeCrackAndCluster_(c,new x(n,0),i),0===c.getPointCount(u))return!1;s.computeMatrixTopoGraphHalfEdges_(u,l),s.m_topoGraph.removeShape();return Qe(s.m_matrix,s.m_scl)}function Le(t){if(9!==t.length)return 1;for(let e=0;e<9;e++){const n=t[e];if("*"!==n&&"T"!==n&&"F"!==n&&"0"!==n&&"1"!==n&&"2"!==n)return 2}return 0}function Ue(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setAreaAreaPredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let c=!1;if(Cn(a,m,n)&&(o.areaAreaDisjointPredicates_(t,e),c=!0),c||En(t,e),!c){const r=new _,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new x(n,0),s),o.computeMatrixTopoGraphHalfEdges_(i,a),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function He(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setAreaLinePredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let c=!1;if(Cn(a,m,n)&&(o.areaLineDisjointPredicates_(t,e),c=!0),c||En(t,e),!c){const r=new _,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new x(n,0),s),o.m_clusterIndexB=o.m_topoGraph.createUserIndexForClusters(),mn(a,o.m_topoGraph,o.m_clusterIndexB),o.computeMatrixTopoGraphHalfEdges_(i,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexB),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function ze(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setAreaPointPredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let c=!1;if(Cn(a,m,n)&&(o.areaPointDisjointPredicates_(t),c=!0),c||En(t,e),!c){const r=new _,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new x(n,0),s),o.computeMatrixTopoGraphClusters_(i,a),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function Ve(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setLineLinePredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let c=!1;if(Cn(a,m,n)&&(o.lineLineDisjointPredicates_(t,e),c=!0),c||En(t,e),!c){const r=new _,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new x(n,0),s),o.m_clusterIndexA=o.m_topoGraph.createUserIndexForClusters(),o.m_clusterIndexB=o.m_topoGraph.createUserIndexForClusters(),mn(i,o.m_topoGraph,o.m_clusterIndexA),mn(a,o.m_topoGraph,o.m_clusterIndexB),o.computeMatrixTopoGraphHalfEdges_(i,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexA),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexB),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function je(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setLinePointPredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let c=!1;if(Cn(a,m,n)&&(o.linePointDisjointPredicates_(t),c=!0),c||En(t,e),!c){const r=new _,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new x(n,0),s),o.m_clusterIndexA=o.m_topoGraph.createUserIndexForClusters(),mn(i,o.m_topoGraph,o.m_clusterIndexA),o.computeMatrixTopoGraphClusters_(i,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexA),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function ke(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setPointPointPredicates_();const a=new r,m=new r;t.queryEnvelope(a),e.queryEnvelope(m);let c=!1;if(Cn(a,m,n)&&(o.pointPointDisjointPredicates_(),c=!0),!c){const r=new _,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new x(n,0),s),o.computeMatrixTopoGraphClusters_(i,a),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function Be(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setAreaPointPredicates_();const a=r.constructEmpty();t.queryEnvelope(a);const m=e.getXY();let c=!1;if(Sn(m,a,n)&&(o.areaPointDisjointPredicates_(t),c=!0),!c){const e=Lt(t,m,n);if(1===e)o.m_matrix[0]=0,o.m_matrix[2]=2,o.m_matrix[3]=-1,o.m_matrix[5]=1,o.m_matrix[6]=-1;else if(2===e){o.m_matrix[6]=-1;if(0!==t.calculateArea2D())o.m_matrix[0]=-1,o.m_matrix[3]=0,o.m_matrix[2]=2,o.m_matrix[5]=1;else{o.m_matrix[0]=0,o.m_matrix[3]=-1,o.m_matrix[5]=-1;const e=r.constructEmpty();t.queryEnvelope(e),o.m_matrix[2]=e.height()||e.width()?1:-1}}else o.areaPointDisjointPredicates_(t)}return Qe(o.m_matrix,i)}function Ze(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setLinePointPredicates_();const a=r.constructEmpty();t.queryEnvelope(a);let c=!1;if(Sn(e.getXY(),a,n)&&(o.linePointDisjointPredicates_(t),c=!0),!c){let r=null,i=!1,a=!1;if(o.m_performPredicates[0]||o.m_performPredicates[6]){!dn(t,e,n,4,s)?(o.m_performPredicates[0]&&(r=C(t),a=!dn(r,e,n,4,s),i=!0,o.m_matrix[0]=a?-1:0),o.m_matrix[6]=-1):(o.m_matrix[0]=-1,o.m_matrix[6]=0)}if(o.m_performPredicates[3]&&(null!==r&&r.isEmpty()?o.m_matrix[3]=-1:(i||(null==r&&(r=C(t)),a=!dn(r,e,n,4,s),i=!0),o.m_matrix[3]=a?0:-1)),o.m_performPredicates[5])if(null!==r&&r.isEmpty())o.m_matrix[5]=-1;else if(i&&!a)o.m_matrix[5]=0;else{null===r&&(r=C(t));const i=dn(r,e,n,3,s);o.m_matrix[5]=i?-1:0}if(o.m_performPredicates[2]){if(0!==t.calculateLength2D())o.m_matrix[2]=1;else{const r=new m({vd:t.getDescription()});r.addPoints(t,0,t.getPointCount());const i=dn(r,e,n,3,s);o.m_matrix[2]=i?-1:0}}}return Qe(o.m_matrix,o.m_scl)}function Ke(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setPointPointPredicates_();const a=r.constructEmpty();t.queryEnvelope(a);const m=e.getXY(),c=new Q;let u=!1;if(Sn(m,a,n)&&(o.pointPointDisjointPredicates_(),u=!0),!u){let e=!1,r=!0;const i=n*n;for(let n=0;n<t.getPointCount()&&(t.queryXY(n,c),Q.sqrDistance(c,m)<=i?e=!0:r=!1,!e||r);n++);e?(o.m_matrix[0]=0,o.m_matrix[2]=r?-1:0,o.m_matrix[6]=-1):(o.m_matrix[0]=-1,o.m_matrix[2]=0,o.m_matrix[6]=0)}return Qe(o.m_matrix,i)}function We(t,e,n,r,i){const s=t.getXY(),o=e.getXY(),a=ut(9,-1);Q.sqrDistance(s,o)<=n*n?a[0]=0:(a[2]=0,a[6]=0),a[8]=2;return Qe(a,r)}function Qe(t,e){for(let n=0;n<9;n++)switch(e[n]){case"T":if(-1===t[n])return!1;break;case"F":if(-1!==t[n])return!1;break;case"0":if(0!==t[n])return!1;break;case"1":if(1!==t[n])return!1;break;case"2":if(2!==t[n])return!1}return!0}function Je(t,e,n){const i=ut(9,-1);if(t.isEmpty()&&e.isEmpty())return Qe(i,n);let s,o=!1;t.isEmpty()?(s=e,o=!0):s=t,i[0]=-1,i[1]=-1,i[3]=-1,i[4]=-1,i[6]=-1,i[7]=-1,i[8]=2;const a=s.getGeometryType();if(j(a))if(a===L.enumPolygon){if(0!==s.calculateArea2D())i[2]=2,i[5]=1;else{i[5]=-1;const t=r.constructEmpty();s.queryEnvelope(t),i[2]=t.height()||t.width()?1:0}}else{const t=0!==s.calculateLength2D();i[2]=t?1:0,i[5]=E(s)?0:-1}else i[2]=0,i[5]=-1;return o&&un(i),Qe(i,n)}function $e(t,e,n){return tn(t)?3:en(t)?4:nn(t,e,n)?8:rn(t,e,n)?16:on(t)?64:sn(t)?1:an(t,e,n)?32:0}function tn(t){return"T*F**FFF*"===t}function en(t){return"FF*FF****"===t}function nn(t,e,n){return(0!==e||0!==n)&&(2===e&&2===n?"F***T****"===t:(2===e||1===e)&&0===n&&"F**T*****"===t)}function rn(t,e,n){return e>n?"T*****T**"===t:1===e&&1===n&&"0********"===t}function sn(t){return"T*****FF*"===t}function on(t){return"T**FF*FF*"===t}function an(t,e,n){return e===n&&(1!==e?"T*T***T**"===t:"1*T***T**"===t)}function mn(t,e,n){const r=e.getGeometryID(t);for(let i=e.getFirstCluster();i!==f;i=e.getNextCluster(i)){if(!(e.getClusterParentage(i)&r))continue;const t=e.getClusterHalfEdge(i);if(t===f){e.setClusterUserIndex(i,n,0);continue}let s=t,o=0;do{const t=s;e.getHalfEdgeParentage(t)&r&&o++,s=e.getHalfEdgeNext(e.getHalfEdgeTwin(t))}while(s!==t);e.setClusterUserIndex(i,n,o)}}class cn{nullFunc(){return V("should not be called"),!1}constructor(){this.m_clusterIndexA=-1,this.m_clusterIndexB=-1,this.m_visitedIndex=-1,this.m_topoGraph=new Yt,this.m_matrix=ut(9,0),this.m_maxDim=ut(9,0),this.m_performPredicates=ut(9,!1),this.m_scl="",this.m_predicateCount=0,this.m_predicatesHalfEdge=this.nullFunc,this.m_predicatesCluster=this.nullFunc}resetMatrix_(){this.m_matrix.fill(-2),this.m_maxDim.fill(-2)}setPredicates_(t){this.m_scl=t;for(let e=0;e<9;e++)"*"!==this.m_scl[e]?(this.m_performPredicates[e]=!0,this.m_predicateCount++):this.m_performPredicates[e]=!1}setRemainingPredicatesToFalse_(){for(let t=0;t<9;t++)this.m_performPredicates[t]&&-2===this.m_matrix[t]&&(this.m_matrix[t]=-1,this.m_performPredicates[t]=!1)}isPredicateKnown_(t){return-2!==this.m_matrix[t]&&(-1===this.m_matrix[t]?(this.m_performPredicates[t]=!1,this.m_predicateCount--,!0):"T"!==this.m_scl[t]&&"F"!==this.m_scl[t]?!(this.m_matrix[t]<this.m_maxDim[t])&&(this.m_performPredicates[t]=!1,this.m_predicateCount--,!0):(this.m_performPredicates[t]=!1,this.m_predicateCount--,!0))}setAreaAreaPredicates_(){this.m_predicatesHalfEdge=this.areaAreaPredicates_,this.m_maxDim[0]=2,this.m_maxDim[1]=1,this.m_maxDim[2]=2,this.m_maxDim[3]=1,this.m_maxDim[4]=1,this.m_maxDim[5]=1,this.m_maxDim[6]=2,this.m_maxDim[7]=1,this.m_maxDim[8]=2,this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setAreaLinePredicates_(){this.m_predicatesHalfEdge=this.areaLinePredicates_,this.m_predicatesCluster=this.areaPointPredicates_,this.m_maxDim[0]=1,this.m_maxDim[1]=0,this.m_maxDim[2]=2,this.m_maxDim[3]=1,this.m_maxDim[4]=0,this.m_maxDim[5]=1,this.m_maxDim[6]=1,this.m_maxDim[7]=0,this.m_maxDim[8]=2,this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setLineLinePredicates_(){this.m_predicatesHalfEdge=this.lineLinePredicates_,this.m_predicatesCluster=this.linePointPredicates_,this.m_maxDim[0]=1,this.m_maxDim[1]=0,this.m_maxDim[2]=1,this.m_maxDim[3]=0,this.m_maxDim[4]=0,this.m_maxDim[5]=0,this.m_maxDim[6]=1,this.m_maxDim[7]=0,this.m_maxDim[8]=2,this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setAreaPointPredicates_(){this.m_predicatesCluster=this.areaPointPredicates_,this.m_maxDim[0]=0,this.m_maxDim[1]=-1,this.m_maxDim[2]=2,this.m_maxDim[3]=0,this.m_maxDim[4]=-1,this.m_maxDim[5]=1,this.m_maxDim[6]=0,this.m_maxDim[7]=-1,this.m_maxDim[8]=2,this.m_performPredicates[1]&&(this.m_matrix[1]=-1,this.m_performPredicates[1]=!1,this.m_predicateCount--),this.m_performPredicates[4]&&(this.m_matrix[4]=-1,this.m_performPredicates[4]=!1,this.m_predicateCount--),this.m_performPredicates[7]&&(this.m_matrix[7]=-1,this.m_performPredicates[7]=!1,this.m_predicateCount--),this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setLinePointPredicates_(){this.m_predicatesCluster=this.linePointPredicates_,this.m_maxDim[0]=0,this.m_maxDim[1]=-1,this.m_maxDim[2]=1,this.m_maxDim[3]=0,this.m_maxDim[4]=-1,this.m_maxDim[5]=0,this.m_maxDim[6]=0,this.m_maxDim[7]=-1,this.m_maxDim[8]=2,this.m_performPredicates[1]&&(this.m_matrix[1]=-1,this.m_performPredicates[1]=!1,this.m_predicateCount--),this.m_performPredicates[4]&&(this.m_matrix[4]=-1,this.m_performPredicates[4]=!1,this.m_predicateCount--),this.m_performPredicates[7]&&(this.m_matrix[7]=-1,this.m_performPredicates[7]=!1,this.m_predicateCount--),this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setPointPointPredicates_(){this.m_predicatesCluster=this.pointPointPredicates_,this.m_maxDim[0]=0,this.m_maxDim[1]=-1,this.m_maxDim[2]=0,this.m_maxDim[3]=-1,this.m_maxDim[4]=-1,this.m_maxDim[5]=-1,this.m_maxDim[6]=0,this.m_maxDim[7]=-1,this.m_maxDim[8]=2,this.m_performPredicates[1]&&(this.m_matrix[1]=-1,this.m_performPredicates[1]=!1,this.m_predicateCount--),this.m_performPredicates[3]&&(this.m_matrix[3]=-1,this.m_performPredicates[3]=!1,this.m_predicateCount--),this.m_performPredicates[4]&&(this.m_matrix[4]=-1,this.m_performPredicates[4]=!1,this.m_predicateCount--),this.m_performPredicates[5]&&(this.m_matrix[5]=-1,this.m_performPredicates[5]=!1,this.m_predicateCount--),this.m_performPredicates[7]&&(this.m_matrix[7]=-1,this.m_performPredicates[7]=!1,this.m_predicateCount--),this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}areaAreaDisjointPredicates_(t,e){this.m_matrix[0]=-1,this.m_matrix[1]=-1,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.areaGeomContainsOrDisjointPredicates_(t,this.m_performPredicates[2]?2:-1,this.m_scl[2],this.m_performPredicates[5]?5:-1,this.m_scl[5]),this.areaGeomContainsOrDisjointPredicates_(e,this.m_performPredicates[6]?6:-1,this.m_scl[6],this.m_performPredicates[7]?7:-1,this.m_scl[7])}areaGeomContainsOrDisjointPredicates_(t,e,n,i,s){const o=-1!==e,a=-1!==i;if(o||a){if(!("T"!==n&&"F"!==n&&o||"T"!==s&&"F"!==s&&a)||0!==t.calculateArea2D())o&&(this.m_matrix[e]=2),a&&(this.m_matrix[i]=1);else if(a&&(this.m_matrix[i]=-1),o){const n=r.constructEmpty();t.queryEnvelope(n),this.m_matrix[e]=n.height()||n.width()?1:0}}}areaAreaContainsPredicates_(t){this.m_matrix[2]=2,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.m_matrix[5]=1,this.m_matrix[6]=-1,this.m_matrix[7]=-1,this.areaGeomContainsOrDisjointPredicates_(t,this.m_performPredicates[0]?0:-1,this.m_scl[0],this.m_performPredicates[1]?1:-1,this.m_scl[1])}areaAreaWithinPredicates_(t){this.areaAreaContainsPredicates_(t),un(this.m_matrix)}areaLineDisjointPredicates_(t,e){if(this.m_matrix[0]=-1,this.m_matrix[1]=-1,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.m_performPredicates[6]){const t=this.m_scl[6],n="T"===t||"F"===t||0!==e.calculateLength2D();this.m_matrix[6]=n?1:0}if(this.m_performPredicates[7]){const t=E(e);this.m_matrix[7]=t?0:-1}this.areaGeomContainsOrDisjointPredicates_(t,this.m_performPredicates[2]?2:-1,this.m_scl[2],this.m_performPredicates[5]?5:-1,this.m_scl[5])}areaLineContainsPredicates_(t,e){if(this.m_performPredicates[0]){const t=this.m_scl[0],n="T"===t||"F"===t||0!==e.calculateLength2D();this.m_matrix[0]=n?1:0}if(this.m_performPredicates[1]){const t=E(e);this.m_matrix[1]=t?0:-1}this.m_matrix[2]=2,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.m_matrix[5]=1,this.m_matrix[6]=-1,this.m_matrix[7]=-1}areaPointDisjointPredicates_(t){this.m_matrix[0]=-1,this.m_matrix[3]=-1,this.m_matrix[6]=0,this.areaGeomContainsOrDisjointPredicates_(t,this.m_performPredicates[2]?2:-1,this.m_scl[2],this.m_performPredicates[5]?5:-1,this.m_scl[5])}areaPointContainsPredicates_(t){this.m_matrix[0]=0,this.m_matrix[2]=2,this.m_matrix[3]=-1,this.m_matrix[5]=1,this.m_matrix[6]=-1}lineLineDisjointPredicates_(t,e){if(this.m_matrix[0]=-1,this.m_matrix[1]=-1,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.m_performPredicates[2]){const e=this.m_scl[2],n="T"===e||"F"===e||0!==t.calculateLength2D();this.m_matrix[2]=n?1:0}if(this.m_performPredicates[5]){const e=E(t);this.m_matrix[5]=e?0:-1}if(this.m_performPredicates[6]){const t=this.m_scl[6],n="T"===t||"F"===t||0!==e.calculateLength2D();this.m_matrix[6]=n?1:0}if(this.m_performPredicates[7]){const t=E(e);this.m_matrix[7]=t?0:-1}}linePointDisjointPredicates_(t){if(this.m_matrix[0]=-1,this.m_matrix[3]=-1,this.m_performPredicates[2]){const e=this.m_scl[2],n="T"===e||"F"===e||0!==t.calculateLength2D();this.m_matrix[2]=n?1:0}if(this.m_performPredicates[5]){const e=E(t);this.m_matrix[5]=e?0:-1}this.m_matrix[6]=0}pointPointDisjointPredicates_(){this.m_matrix[0]=-1,this.m_matrix[2]=0,this.m_matrix[6]=0}areaAreaPredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorAreaInteriorArea_(t,e,n);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[1]){this.interiorAreaBoundaryArea_(t,e,1);const n=this.isPredicateKnown_(1);r&&=n}if(this.m_performPredicates[2]){this.interiorAreaExteriorArea_(t,e,n,2);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[3]){this.interiorAreaBoundaryArea_(t,n,3);const e=this.isPredicateKnown_(3);r&&=e}if(this.m_performPredicates[4]){this.boundaryAreaBoundaryArea_(t,e,n);const i=this.isPredicateKnown_(4);r&&=i}if(this.m_performPredicates[5]){this.boundaryAreaExteriorArea_(t,e,n,5);const i=this.isPredicateKnown_(5);r&&=i}if(this.m_performPredicates[6]){this.interiorAreaExteriorArea_(t,n,e,6);const i=this.isPredicateKnown_(6);r&&=i}if(this.m_performPredicates[7]){this.boundaryAreaExteriorArea_(t,n,e,7);const i=this.isPredicateKnown_(7);r&&=i}return r}areaLinePredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorAreaInteriorLine_(t,e,n);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[1]){this.interiorAreaBoundaryLine_(t,e,n,this.m_clusterIndexB);const i=this.isPredicateKnown_(1);r&&=i}if(this.m_performPredicates[2]){this.interiorAreaExteriorLine_(t,e,n);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[3]){this.boundaryAreaInteriorLine_(t,e,n,this.m_clusterIndexB);const i=this.isPredicateKnown_(3);r&&=i}if(this.m_performPredicates[4]){this.boundaryAreaBoundaryLine_(t,e,n,this.m_clusterIndexB);const i=this.isPredicateKnown_(4);r&&=i}if(this.m_performPredicates[5]){this.boundaryAreaExteriorLine_(t,e,n);const i=this.isPredicateKnown_(5);r&&=i}if(this.m_performPredicates[6]){this.exteriorAreaInteriorLine_(t,e);const n=this.isPredicateKnown_(6);r&&=n}if(this.m_performPredicates[7]){this.exteriorAreaBoundaryLine_(t,e,n,this.m_clusterIndexB);const i=this.isPredicateKnown_(7);r&&=i}return r}lineLinePredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorLineInteriorLine_(t,e,n,this.m_clusterIndexA,this.m_clusterIndexB);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[1]){this.interiorLineBoundaryLine_(t,e,n,this.m_clusterIndexA,this.m_clusterIndexB,1);const i=this.isPredicateKnown_(1);r&&=i}if(this.m_performPredicates[2]){this.interiorLineExteriorLine_(t,e,n,2);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[3]){this.interiorLineBoundaryLine_(t,n,e,this.m_clusterIndexB,this.m_clusterIndexA,3);const i=this.isPredicateKnown_(3);r&&=i}if(this.m_performPredicates[4]){this.boundaryLineBoundaryLine_(t,e,n,this.m_clusterIndexA,this.m_clusterIndexB);const i=this.isPredicateKnown_(4);r&&=i}if(this.m_performPredicates[5]){this.boundaryLineExteriorLine_(t,e,n,this.m_clusterIndexA,5);const i=this.isPredicateKnown_(5);r&&=i}if(this.m_performPredicates[6]){this.interiorLineExteriorLine_(t,n,e,6);const i=this.isPredicateKnown_(6);r&&=i}if(this.m_performPredicates[7]){this.boundaryLineExteriorLine_(t,n,e,this.m_clusterIndexB,7);const i=this.isPredicateKnown_(7);r&&=i}return r}areaPointPredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorAreaInteriorPoint_(t,e);const n=this.isPredicateKnown_(0);r&&=n}if(this.m_performPredicates[2]){this.interiorAreaExteriorPoint_(t,e);const n=this.isPredicateKnown_(2);r&&=n}if(this.m_performPredicates[3]){this.boundaryAreaInteriorPoint_(t,e,n);const i=this.isPredicateKnown_(3);r&&=i}if(this.m_performPredicates[5]){this.boundaryAreaExteriorPoint_(t,e);const n=this.isPredicateKnown_(5);r&&=n}if(this.m_performPredicates[6]){this.exteriorAreaInteriorPoint_(t,e);const n=this.isPredicateKnown_(6);r&&=n}return r}linePointPredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorLineInteriorPoint_(t,e,n,this.m_clusterIndexA);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[2]){this.interiorLineExteriorPoint_(t,e,n,this.m_clusterIndexA);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[3]){this.boundaryLineInteriorPoint_(t,e,n,this.m_clusterIndexA);const i=this.isPredicateKnown_(3);r&&=i}if(this.m_performPredicates[5]){this.boundaryLineExteriorPoint_(t,e,n,this.m_clusterIndexA);const i=this.isPredicateKnown_(5);r&&=i}if(this.m_performPredicates[6]){this.exteriorLineInteriorPoint_(t,e,n);const i=this.isPredicateKnown_(6);r&&=i}return r}pointPointPredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorPointInteriorPoint_(t,e,n);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[2]){this.interiorPointExteriorPoint_(t,e,n,2);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[6]){this.interiorPointExteriorPoint_(t,n,e,6);const i=this.isPredicateKnown_(6);r&&=i}return r}interiorAreaInteriorArea_(t,e,n){if(2===this.m_matrix[0])return;const r=this.m_topoGraph.getHalfEdgeFaceParentage(t);r&e&&r&n&&(this.m_matrix[0]=2)}interiorAreaBoundaryArea_(t,e,n){if(1===this.m_matrix[n])return;const r=this.m_topoGraph.getHalfEdgeFaceParentage(t),i=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(t));r&e&&i&e&&(this.m_matrix[n]=1)}interiorAreaExteriorArea_(t,e,n,r){if(2===this.m_matrix[r])return;const i=this.m_topoGraph.getHalfEdgeFaceParentage(t);i&e&&!(i&n)&&(this.m_matrix[r]=2)}boundaryAreaBoundaryArea_(t,e,n){if(1===this.m_matrix[4])return;const r=this.m_topoGraph.getHalfEdgeParentage(t);if(r&e&&r&n)this.m_matrix[4]=1;else if(0!==this.m_matrix[4]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const r=this.m_topoGraph.getHalfEdgeTo(t),i=this.m_topoGraph.getClusterParentage(r);if(i&e&&i&n)return void(this.m_matrix[4]=0)}}boundaryAreaExteriorArea_(t,e,n,r){if(1===this.m_matrix[r])return;const i=this.m_topoGraph.getHalfEdgeFaceParentage(t),s=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(t));i&n||s&n||(this.m_matrix[r]=1)}interiorAreaInteriorLine_(t,e,n){if(1===this.m_matrix[0])return;const r=this.m_topoGraph.getHalfEdgeFaceParentage(t),i=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(t));r&e&&i&e&&(this.m_matrix[0]=1)}interiorAreaBoundaryLine_(t,e,n,r){if(0!==this.m_matrix[1]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(t),s=this.m_topoGraph.getClusterParentage(i);if(!(s&e)){if(this.m_topoGraph.getHalfEdgeFaceParentage(t)&e){const t=this.m_topoGraph.getClusterUserIndex(i,r);if(s&n&&t%2!=0)return void(this.m_matrix[1]=0)}}}}interiorAreaExteriorLine_(t,e,n){if(2===this.m_matrix[2])return;this.m_topoGraph.getHalfEdgeParentage(t)&e&&(this.m_matrix[2]=2)}boundaryAreaInteriorLine_(t,e,n,r){if(1===this.m_matrix[3])return;const i=this.m_topoGraph.getHalfEdgeParentage(t);if(i&e&&i&n)this.m_matrix[3]=1;else if(0!==this.m_matrix[3]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(t),s=this.m_topoGraph.getClusterParentage(i);if(s&e){const t=this.m_topoGraph.getClusterUserIndex(i,r);if(s&n&&t%2==0)return void(this.m_matrix[3]=0)}}}boundaryAreaBoundaryLine_(t,e,n,r){if(0!==this.m_matrix[4]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(t),s=this.m_topoGraph.getClusterParentage(i);if(s&e){const t=this.m_topoGraph.getClusterUserIndex(i,r);if(s&n&&t%2!=0)return void(this.m_matrix[4]=0)}}}boundaryAreaExteriorLine_(t,e,n){if(1===this.m_matrix[5])return;const r=this.m_topoGraph.getHalfEdgeParentage(t);r&e&&!(r&n)&&(this.m_matrix[5]=1)}exteriorAreaInteriorLine_(t,e){if(1===this.m_matrix[6])return;const n=this.m_topoGraph.getHalfEdgeFaceParentage(t),r=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(t));n&e||r&e||(this.m_matrix[6]=1)}exteriorAreaBoundaryLine_(t,e,n,r){if(0!==this.m_matrix[7]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(t),s=this.m_topoGraph.getClusterParentage(i);if(!(s&e)){if(!(this.m_topoGraph.getHalfEdgeFaceParentage(t)&e)){const t=this.m_topoGraph.getClusterUserIndex(i,r);if(s&n&&t%2!=0)return void(this.m_matrix[7]=0)}}}}interiorLineInteriorLine_(t,e,n,r,i){if(1===this.m_matrix[0])return;const s=this.m_topoGraph.getHalfEdgeParentage(t);if(s&e&&s&n)this.m_matrix[0]=1;else if(0!==this.m_matrix[0]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const s=this.m_topoGraph.getHalfEdgeTo(t),o=this.m_topoGraph.getClusterParentage(s);if(o&e&&o&n){const t=this.m_topoGraph.getClusterUserIndex(s,r),e=this.m_topoGraph.getClusterUserIndex(s,i);if(t%2==0&&e%2==0)return void(this.m_matrix[0]=0)}}}interiorLineBoundaryLine_(t,e,n,r,i,s){if(0!==this.m_matrix[s]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const o=this.m_topoGraph.getHalfEdgeTo(t),a=this.m_topoGraph.getClusterParentage(o);if(a&e&&a&n){const t=this.m_topoGraph.getClusterUserIndex(o,r),e=this.m_topoGraph.getClusterUserIndex(o,i);if(t%2==0&&e%2!=0)return void(this.m_matrix[s]=0)}}}interiorLineExteriorLine_(t,e,n,r){if(1===this.m_matrix[r])return;const i=this.m_topoGraph.getHalfEdgeParentage(t);i&e&&!(i&n)&&(this.m_matrix[r]=1)}boundaryLineBoundaryLine_(t,e,n,r,i){if(0!==this.m_matrix[4]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const s=this.m_topoGraph.getHalfEdgeTo(t),o=this.m_topoGraph.getClusterParentage(s);if(o&e&&o&n){const t=this.m_topoGraph.getClusterUserIndex(s,r),e=this.m_topoGraph.getClusterUserIndex(s,i);if(t%2!=0&&e%2!=0)return void(this.m_matrix[4]=0)}}}boundaryLineExteriorLine_(t,e,n,r,i){if(0!==this.m_matrix[i]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const e=this.m_topoGraph.getHalfEdgeTo(t);if(!(this.m_topoGraph.getClusterParentage(e)&n)){if(this.m_topoGraph.getClusterUserIndex(e,r)%2!=0)return void(this.m_matrix[i]=0)}}}interiorAreaInteriorPoint_(t,e){if(0===this.m_matrix[0])return;if(!(this.m_topoGraph.getClusterParentage(t)&e)){const n=this.m_topoGraph.getClusterChain(t);if(this.m_topoGraph.getChainParentage(n)&e)return void(this.m_matrix[0]=0)}}interiorAreaExteriorPoint_(t,e){if(2===this.m_matrix[2])return;this.m_topoGraph.getClusterParentage(t)&e&&(this.m_matrix[2]=2)}boundaryAreaInteriorPoint_(t,e,n){if(0===this.m_matrix[3])return;const r=this.m_topoGraph.getClusterParentage(t);r&e&&r&n&&(this.m_matrix[3]=0)}boundaryAreaExteriorPoint_(t,e){if(1===this.m_matrix[5])return;this.m_topoGraph.getClusterParentage(t)&e&&(this.m_matrix[5]=1)}exteriorAreaInteriorPoint_(t,e){if(0===this.m_matrix[6])return;if(!(this.m_topoGraph.getClusterParentage(t)&e)){const n=this.m_topoGraph.getClusterChain(t);if(!(this.m_topoGraph.getChainParentage(n)&e))return void(this.m_matrix[6]=0)}}interiorLineInteriorPoint_(t,e,n,r){if(0===this.m_matrix[0])return;const i=this.m_topoGraph.getClusterParentage(t);if(i&e&&i&n){if(this.m_topoGraph.getClusterUserIndex(t,r)%2==0)return void(this.m_matrix[0]=0)}}interiorLineExteriorPoint_(t,e,n,r){if(1===this.m_matrix[2])return;if(-1===this.m_topoGraph.getClusterHalfEdge(t)){if(0!==this.m_matrix[2]){if(!(this.m_topoGraph.getClusterParentage(t)&n))return void(this.m_matrix[2]=0)}}else this.m_matrix[2]=1}boundaryLineInteriorPoint_(t,e,n,r){if(0===this.m_matrix[3])return;const i=this.m_topoGraph.getClusterParentage(t);if(i&e&&i&n){if(this.m_topoGraph.getClusterUserIndex(t,r)%2!=0)return void(this.m_matrix[3]=0)}}boundaryLineExteriorPoint_(t,e,n,r){if(0===this.m_matrix[5])return;const i=this.m_topoGraph.getClusterParentage(t);if(i&e&&!(i&n)){if(this.m_topoGraph.getClusterUserIndex(t,r)%2!=0)return void(this.m_matrix[5]=0)}}exteriorLineInteriorPoint_(t,e,n){if(0===this.m_matrix[6])return;const r=this.m_topoGraph.getClusterParentage(t);r&e||!(r&n)||(this.m_matrix[6]=0)}interiorPointInteriorPoint_(t,e,n){if(0===this.m_matrix[0])return;const r=this.m_topoGraph.getClusterParentage(t);r&e&&r&n&&(this.m_matrix[0]=0)}interiorPointExteriorPoint_(t,e,n,r){if(0===this.m_matrix[r])return;const i=this.m_topoGraph.getClusterParentage(t);!(i&e)||i&n||(this.m_matrix[r]=0)}computeMatrixTopoGraphHalfEdges_(t,e){let n=!1;const r=this.m_topoGraph.getGeometryID(t),i=this.m_topoGraph.getGeometryID(e);this.m_visitedIndex=this.m_topoGraph.createUserIndexForHalfEdges();for(let s=this.m_topoGraph.getFirstCluster();s!==f;s=this.m_topoGraph.getNextCluster(s)){const t=this.m_topoGraph.getClusterHalfEdge(s);if(t===f){if(null!==this.m_predicatesCluster&&(n=this.m_predicatesCluster(s,r,i),n))break;continue}let e=t;do{let t=e;if(1!==this.m_topoGraph.getHalfEdgeUserIndex(t,this.m_visitedIndex))do{if(n=this.m_predicatesHalfEdge(t,r,i),n)break;this.m_topoGraph.setHalfEdgeUserIndex(t,this.m_visitedIndex,1),t=this.m_topoGraph.getHalfEdgeNext(t)}while(t!==e&&!n);if(n)break;e=this.m_topoGraph.getHalfEdgeNext(this.m_topoGraph.getHalfEdgeTwin(t))}while(e!==t);if(n)break}n||this.setRemainingPredicatesToFalse_(),this.m_topoGraph.deleteUserIndexForHalfEdges(this.m_visitedIndex)}computeMatrixTopoGraphClusters_(t,e){let n=!1;const r=this.m_topoGraph.getGeometryID(t),i=this.m_topoGraph.getGeometryID(e);for(let s=this.m_topoGraph.getFirstCluster();s!==f&&(n=this.m_predicatesCluster(s,r,i),!n);s=this.m_topoGraph.getNextCluster(s));n||this.setRemainingPredicatesToFalse_()}setEditShape_(t,e){this.m_topoGraph.setEditShape(t,e)}setEditShapeCrackAndCluster_(t,e,n){let r=0;if(t.hasCurves()){const i=new Zt,s=t.getEnvelope2D(n),o=Ht(e.total(),s);r=Bt(o,0),zt(t,o,e.total(),12e3,i,null,n),i.clearStitcher(t)}Vt(t,e.add(r),n,!1,!1),t.filterClosePoints(0,!0,!0,!1,f);for(let i=t.getFirstGeometry();i!==f;i=t.getNextGeometry(i))t.getGeometryType(i)===L.enumPolygon&&qt(t,i,-1,!1,f,n);this.setEditShape_(t,n)}}function un(t){const e=t[1],n=t[2],r=t[5];t[1]=t[3],t[2]=t[6],t[5]=t[7],t[3]=e,t[6]=n,t[7]=r}function ln(t,s,o){const a=t.getGeometryType();if(U(a)){const e=new n({vd:t.getDescription()});return e.addSegment(t,!0),e}if(a===L.enumEnvelope){const o=t,a=r.constructEmpty();if(t.queryEnvelope(a),a.height()<=s&&a.width()<=s){const e=new i({vd:t.getDescription()});return o.getCenter(e),e}if(a.height()<=s||a.width()<=s){const e=new n({vd:t.getDescription()}),r=new i;return o.queryCornerByVal(0,r),e.startPathPoint(r),o.queryCornerByVal(2,r),e.lineToPoint(r),e}const m=new e({vd:t.getDescription()});return m.addEnvelope(o,!1),m}return t}function hn(t){return`${t[0]}${t[3]}${t[6]}${t[1]}${t[4]}${t[7]}${t[2]}${t[5]}${t[8]}`}class gn{nullFunc(){return V("should not be called"),!1}constructor(t,e,n,i=!1){this.m_bDone=!1,this.m_tolerance=0,this.m_elementHandle=-1,this.m_query=r.constructEmpty(),this.m_envInter=r.constructEmpty(),this.m_quadTree=null,this.m_intersector=null,this.m_function=this.nullFunc;const s=t.getAccelerators();let o=null;null!=s&&(o=i?s.getQuadTreeForPaths():s.getQuadTree());const a=e.getAccelerators();let m=null;if(null!=a&&(m=i?a.getQuadTreeForPaths():a.getQuadTree()),null===o&&null===m&&!i){const i=t.getPointCount(),s=e.getPointCount();if(i>10&&s>10){const a=r.constructEmpty(),c=r.constructEmpty(),l=r.constructEmpty();t.queryLooseEnvelope(a),e.queryLooseEnvelope(c),a.inflateCoords(n,n),c.inflateCoords(n,n),l.setCoords({env2D:a}),l.intersect(c),i>=s?o=j(t.getGeometryType())?u(t,l):S(t,l):m=j(e.getGeometryType())?u(e,l):S(e,l)}}this.construct_(t,o,e,m,n,i)}next(){if(this.m_bQuadTree){if(this.m_bDone)return!1;for(;this.m_function(););return!this.m_bDone}return!!this.m_intersector&&this.m_intersector.next()}getRedElement(){return this.m_bQuadTree?this.m_bSwapElements?this.m_quadTree.getElement(this.m_elementHandle):j(this.m_queryType)?this.m_bPaths?this.m_pathIndex:this.m_segIter.getStartPointIndex():this.m_pointIndex:this.m_bSwapElements?this.m_intersector.getBlueElement(this.m_intersector.getHandleB()):this.m_intersector.getRedElement(this.m_intersector.getHandleA())}getBlueElement(){return this.m_bQuadTree?this.m_bSwapElements?j(this.m_queryType)?this.m_bPaths?this.m_pathIndex:this.m_segIter.getStartPointIndex():this.m_pointIndex:this.m_quadTree.getElement(this.m_elementHandle):this.m_bSwapElements?this.m_intersector.getRedElement(this.m_intersector.getHandleA()):this.m_intersector.getBlueElement(this.m_intersector.getHandleB())}getRedEnvelope(){return this.m_bPaths||k(""),this.m_bQuadTree?this.m_bSwapElements?this.m_quadTree.getElementExtent(this.m_elementHandle):this.m_query:this.m_bSwapElements?this.m_intersector.getBlueEnvelope(this.m_intersector.getHandleB()):this.m_intersector.getRedEnvelope(this.m_intersector.getHandleA())}getBlueEnvelope(){return this.m_bPaths||k(""),this.m_bQuadTree?this.m_bSwapElements?this.m_query:this.m_quadTree.getElementExtent(this.m_elementHandle):this.m_bSwapElements?this.m_intersector.getRedEnvelope(this.m_intersector.getHandleA()):this.m_intersector.getBlueEnvelope(this.m_intersector.getHandleB())}construct_(t,e,n,i,s,o){const a=r.constructEmpty(),m=r.constructEmpty();t.queryLooseEnvelope(a),n.queryLooseEnvelope(m),a.inflateCoords(s,s),m.inflateCoords(s,s),this.m_envInter.setCoords({env2D:a}),this.m_envInter.intersect(m),this.m_multiVertexImplA=t,this.m_multiVertexImplB=n;const c=t.getGeometryType(),u=n.getGeometryType();this.m_bPaths=o,this.m_pathIndex=-1,this.m_pointIndex=-1,this.m_bSwapElements=!1,this.m_queryType=L.enumUnknown,this.m_bQuadTree=!1,null!==e&&(this.m_bDone=!1,this.m_tolerance=s,this.m_quadTree=e,this.m_qtIter=this.m_quadTree.getIteratorForQT(),this.m_bQuadTree=!0,this.m_bSwapElements=!0,j(u)?(this.m_queryType=u,this.m_function=this.nextPath_,o?this.m_pathIndex=n.getPathCount():this.m_segIter=n.querySegmentIterator()):(this.m_queryType=u,this.m_function=this.nextPoint_,this.m_pointIndex=n.getPointCount())),this.m_bQuadTree||null!==i&&(this.m_bDone=!1,this.m_tolerance=s,this.m_quadTree=i,this.m_qtIter=this.m_quadTree.getIteratorForQT(),this.m_bQuadTree=!0,this.m_bSwapElements=!1,j(c)?(this.m_queryType=c,this.m_function=this.nextPath_,o?this.m_pathIndex=t.getPathCount():this.m_segIter=t.querySegmentIterator()):(this.m_queryType=c,this.m_function=this.nextPoint_,this.m_pointIndex=t.getPointCount())),this.m_bQuadTree||(o&&j(c)&&j(u)?this.m_intersector=v(t,n,s):j(c)&&j(u)?(this.m_intersector=w(t,n,s),this.m_bSwapElements=!1):j(c)&&!j(u)?(this.m_intersector=b(t,n,s),this.m_bSwapElements=!1):!j(c)&&j(u)?(this.m_intersector=b(n,t,s),this.m_bSwapElements=!0):(this.m_intersector=T(t,n,s),this.m_bSwapElements=!1))}nextPath_(){return this.m_bPaths?-1==--this.m_pathIndex?(this.m_bDone=!0,!1):(this.m_bSwapElements?this.m_multiVertexImplB.queryPathEnvelope(this.m_pathIndex,this.m_query):this.m_multiVertexImplA.queryPathEnvelope(this.m_pathIndex,this.m_query),this.m_qtIter.resetIterator(this.m_query,this.m_tolerance),this.m_function=this.iterate_,!0):this.m_segIter.nextPath()?(this.m_function=this.nextSegment_,!0):(this.m_bDone=!0,!1)}nextSegment_(){if(!this.m_segIter.hasNextSegment())return this.m_function=this.nextPath_,!0;const t=this.m_segIter.nextSegment(),e=new r;return t.queryLooseEnvelope(e),!e.isIntersecting(this.m_envInter)||(this.m_qtIter.resetIterator(t,this.m_tolerance),this.m_function=this.iterate_,!0)}nextPoint_(){if(-1==--this.m_pointIndex)return this.m_bDone=!0,!1;const t=new Q;if(this.m_bSwapElements){const e=this.m_multiVertexImplB.getXY(this.m_pointIndex);t.setCoordsPoint2D(e)}else{const e=this.m_multiVertexImplA.getXY(this.m_pointIndex);t.setCoordsPoint2D(e)}return!this.m_envInter.contains(t)||(this.m_qtIter.resetIterator(r.construct(t.x,t.y,t.x,t.y),this.m_tolerance),this.m_function=this.iterate_,!0)}iterate_(){return this.m_elementHandle=this.m_qtIter.next(),-1===this.m_elementHandle&&(j(this.m_queryType)?(this.m_function=this.m_bPaths?this.nextPath_:this.nextSegment_,!0):(this.m_function=this.nextPoint_,!0))}}function _n(t){return 2===t?1:1===t?2:128===t?64:64===t?128:t}function fn(t,e,n){let i;if(t instanceof gm||null===t){const s=r.constructEmpty();s.setCoords({pt:e}),s.mergeEnvelope2D(n),i=a(t,s,!1)}else i=t;return i}function pn(t,e,n){let i;if(t instanceof gm||null===t){const s=r.constructEmpty();s.setCoords({env2D:e}),s.mergeEnvelope2D(n),i=a(t,s,!1)}else i=t;return i}function dn(t,e,i,s,o){if(t.isEmpty()||e.isEmpty())return 4===s;F(t),F(e);let a=t.getGeometryType(),m=e.getGeometryType();if(a===L.enumEnvelope){if(m===L.enumEnvelope)return yn(t,e,i,s);if(m===L.enumPoint)return Pn(e,t,i,_n(s))}else if(a===L.enumPoint){if(m===L.enumEnvelope)return Pn(t,e,i,s);if(m===L.enumPoint)return xn(t,e,i,s)}const c=r.constructEmpty();t.queryEnvelope(c);const u=r.constructEmpty();e.queryEnvelope(u);const l=pn(i,c,u);if(Cn(c,u,l))return 4===s;let h=!1,g=null,_=null,f=null,p=null;switch(U(a)?(g=new n({vd:t.getDescription()}),g.addSegment(t,!0),f=g,a=L.enumPolyline):f=t,U(m)?(_=new n({vd:e.getDescription()}),_.addSegment(e,!0),p=_,m=L.enumPolyline):p=e,a!==L.enumEnvelope&&m!==L.enumEnvelope?(f.getDimension()<p.getDimension()||a===L.enumPoint&&m===L.enumMultiPoint)&&(s=_n(s)):a!==L.enumPolygon&&m!==L.enumEnvelope&&(s=_n(s)),a){case L.enumPolygon:switch(m){case L.enumPolygon:h=wn(f,p,l,s,o);break;case L.enumPolyline:h=bn(f,p,l,s,o);break;case L.enumPoint:h=Tn(f,p,l,s);break;case L.enumMultiPoint:h=vn(f,p,l,s);break;case L.enumEnvelope:h=In(f,p,l,s,o)}break;case L.enumPolyline:switch(m){case L.enumPolygon:h=bn(p,f,l,s,o);break;case L.enumPolyline:h=Dn(f,p,l,s,o);break;case L.enumPoint:h=Gn(f,p,l,s);break;case L.enumMultiPoint:h=Nn(f,p,l,s);break;case L.enumEnvelope:h=Mn(f,p,l,s,o)}break;case L.enumPoint:switch(m){case L.enumPolygon:h=Tn(p,f,l,s);break;case L.enumPolyline:h=Gn(p,f,l,s);break;case L.enumMultiPoint:h=qn(p,f,l,s)}break;case L.enumMultiPoint:switch(m){case L.enumPolygon:h=vn(p,f,l,s);break;case L.enumPolyline:h=Nn(p,f,l,s);break;case L.enumMultiPoint:h=An(f,p,l,s);break;case L.enumPoint:h=qn(f,p,l,s);break;case L.enumEnvelope:h=Yn(f,p,l,s)}break;case L.enumEnvelope:switch(m){case L.enumPolygon:h=In(p,f,l,s,o);break;case L.enumPolyline:h=Mn(p,f,l,s,o);break;case L.enumMultiPoint:h=Yn(p,f,l,s)}}return h}function yn(t,e,n,i,s){if(t.isEmpty()||e.isEmpty())return 4===i;const o=r.constructEmpty();t.queryEnvelope(o);const a=r.constructEmpty();e.queryEnvelope(a);const m=pn(n,o,a);switch(i){case 4:return Cn(o,a,m);case 2:return Br(a,o,m,!1);case 128:return Br(a,o,m,!0);case 1:return Br(o,a,m,!1);case 64:return Br(o,a,m,!0);case 3:return Vr(o,a,m);case 8:return jr(o,a,m);case 32:return kr(o,a,m);case 16:return!1}return!1}function Pn(t,e,n,i,s){if(t.isEmpty()||e.isEmpty())return 4===i;const o=t.getXY(),a=r.constructEmpty();e.queryEnvelope(a);const m=fn(n,o,a);switch(i){case 4:return Sn(o,a,m);case 2:case 128:return zr(o,a,m);case 1:case 64:return!1;case 3:return Ur(o,a,m);case 8:return Hr(o,a,m)}return!1}function xn(t,e,n,i,s){if(t.isEmpty()||e.isEmpty())return 4===i;const o=t.getXY(),m=e.getXY();let c;if(n instanceof gm||null===n){const t=r.constructEmpty();t.setCoords({pt:o}),t.merge(m),c=a(n,t,!1)}else c=n;switch(i){case 4:return Or(o,m,c);case 2:case 128:return Lr(m,o,c);case 1:case 64:return Lr(o,m,c);case 3:return Fr(o,m,c)}return!1}function Cn(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:e}),i.inflateCoords(n,n),!t.isIntersecting(i)}function En(t,e,n,r=!1){const i=t.getGeometryType(),s=e.getGeometryType();if(z(i)){const e=t.getImpl().getAccelerators();if(null!==e){const t=e.getRasterizedGeometry();X(null===t)}}if(z(s)){const t=e.getImpl().getAccelerators();if(null!==t){const e=t.getRasterizedGeometry();X(null===e)}}return 0}function Sn(t,e,n,i){const s=r.constructEmpty();return s.setCoords({env2D:e}),s.inflateCoords(n,n),!s.contains(t)}function wn(t,e,n,r,i){switch(r){case 4:return Rn(t,e,n);case 2:return Ln(e,t,n,i);case 128:return Un(e,t,n);case 1:return Ln(t,e,n,i);case 64:return Un(t,e,n);case 3:return Xn(t,e,n,i);case 8:return Fn(t,e,n);case 32:return On(t,e,n,i)}return!1}function bn(t,e,n,r,i){switch(r){case 4:return Hn(t,e,n);case 1:return jn(t,e,n,i);case 64:return kn(t,e,n);case 8:return zn(t,e,n,i);case 16:return Vn(t,e,n)}return!1}function Tn(t,e,n,r,i){switch(r){case 4:return Bn(t,e,n);case 1:case 64:return Kn(t,e,n);case 8:return Zn(t,e,n)}return!1}function vn(t,e,n,r,i){switch(r){case 4:return Wn(t,e,n);case 1:return $n(t,e,n,!1);case 64:return $n(t,e,n,!0);case 8:return Qn(t,e,n);case 16:return Jn(t,e,n)}return!1}function In(t,e,n,r,i){if(er(t,e,n))return 4===r;if(4===r)return!1;switch(r){case 2:return ir(t,e,n,!1);case 128:return ir(t,e,n,!0);case 1:return sr(t,e,n,!1,i);case 64:return sr(t,e,n,!0,i);case 3:return tr(t,e,n,i);case 8:return nr(t,e,n,i);case 32:return rr(t,e,n,i);case 16:return!1}return!1}function Dn(t,e,n,r,i){switch(r){case 4:return ar(t,e,n);case 2:return lr(e,t,n,i);case 128:return hr(e,t,n,i);case 1:return lr(t,e,n,i);case 64:return hr(t,e,n,i);case 3:return or(t,e,n,i);case 8:return mr(t,e,n,i);case 32:return ur(t,e,n,i);case 16:return cr(t,e,n,i)}return!1}function Gn(t,e,n,r,i){switch(r){case 4:return gr(t,e,n);case 1:case 64:return fr(t,e,n);case 8:return _r(t,e,n)}return!1}function Nn(t,e,n,r,i){switch(r){case 4:return pr(t,e,n);case 1:case 64:return Pr(t,e,n);case 8:return dr(t,e,n);case 16:return yr(t,e,n)}return!1}function Mn(t,e,n,r,i){if(Cr(t,e,n))return 4===r;if(4===r)return!1;switch(r){case 2:return Sr(t,e,n,!1);case 128:return Sr(t,e,n,!0);case 1:case 64:case 32:return!1;case 3:return xr(t,e,n);case 8:return Er(t,e,n,i);case 16:return wr(t,e,n)}return!1}function An(t,e,n,r,i){switch(r){case 4:return Tr(t,e,n);case 2:case 128:return Ir(e,t,n);case 1:case 64:return Ir(t,e,n);case 3:return br(t,e,n);case 32:return vr(t,e,n)}return!1}function qn(t,e,n,r,i){switch(r){case 4:return Gr(t,e,n);case 2:case 128:return Nr(t,e,n);case 1:case 64:return Mr(t,e,n);case 3:return Dr(t,e,n)}return!1}function Yn(t,e,n,r,i){switch(r){case 4:return qr(t,e,n);case 2:return Xr(t,e,n,!1);case 128:return Xr(t,e,n,!0);case 1:case 64:return!1;case 3:return Ar(t,e,n);case 8:return Yr(t,e,n);case 16:return Rr(t,e,n)}return!1}function Xn(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),!Vr(s,o,n))return!1;if(En(t,e),ti(t,e,n))return!0;const a=t.calculateLength2D(),m=e.calculateLength2D(),c=Math.max(t.getPointCount(),e.getPointCount());if(Math.abs(a-m)>4*c*n)return!1;if(t.hasNonLinearSegments()||e.hasNonLinearSegments()){return Re(t,e,n,"**F**FFF*",i,!1)}return ri(t,e,n,!0)}function Rn(t,e,n,r){En(t,e,n,!0);return 1===Zr(t,e,n,!0)}function Fn(t,e,n,r){return En(t,e),li(t,e,n,null)}function On(t,e,n,r){return En(t,e),hi(t,e,n,r)}function Ln(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&(En(t,e),gi(t,e,n,i))}function Un(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&(En(t,e),2===Zr(t,e,n,!1))}function Hn(t,e,n,r){En(t,e,n,!0);return 1===Zr(t,e,n,!0)}function zn(t,e,n,r){return En(t,e),_i(t,e,n,r)}function Vn(t,e,n,r){return En(t,e),fi(t,e,n,null)}function jn(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&(En(t,e),pi(t,e,n,i))}function kn(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&(En(t,e),2===Zr(t,e,n,!1))}function Bn(t,e,n,r){return 0===Ot(t,e,n)}function Zn(t,e,n,r){return yi(t,e.getXY(),n)}function Kn(t,e,n,r){return di(t,e.getXY(),n)}function Wn(t,e,n,r,i){En(t,e);return 1===Kr(t,e,n)}function Qn(t,n,i,s){En(t,n);const o=r.constructEmpty();t.queryEnvelope(o),o.inflateCoords(i,i);const a=new Q;let m=!1;const c=t.getImpl(),u=new e;let l=t,h=!1;for(let e=0;e<n.getPointCount();e++){if(n.queryXY(e,a),o.contains(a)){const t=Lt(l,a,i);if(2===t)m=!0;else if(1===t)return!1}h||(!Ut(t,n.getPointCount()-1)||null!==c.getAccelerators()&&null!==c.getAccelerators().getQuadTree()?l=t:(t.copyTo(u),u.getImpl().buildQuadTreeAccelerator(1),l=u),h=!0)}return!!m}function Jn(t,n,i,s){En(t,n);const o=new r,a=new r,m=new r;t.queryEnvelope(o),n.queryEnvelope(m),a.setCoords({env2D:o}),a.inflateCoords(i,i);let c=!1,u=!1;const l=new Q,h=t.getImpl(),g=new e;let _=t,f=!1;for(let e=0;e<n.getPointCount();e++){if(n.queryXY(e,l),a.contains(l)){const t=Lt(_,l,i);0===t?u=!0:1===t&&(c=!0)}else u=!0;if(c&&u)return!0;f||(!Ut(t,n.getPointCount()-1)||null!==h.getAccelerators()&&null!==h.getAccelerators().getQuadTree()?_=t:(t.copyTo(g),g.getImpl().buildQuadTreeAccelerator(1),_=g),f=!0)}return!1}function $n(t,n,i,s,o){const a=r.constructEmpty(),m=r.constructEmpty();if(t.queryEnvelope(a),n.queryEnvelope(m),!Qr(a,m,i))return!1;En(t,n);let c=!1;const u=new Q,l=t.getImpl(),h=new e;let g=t,_=!1;for(let e=0;e<n.getPointCount();e++){if(n.queryXY(e,u),!a.contains(u))return!1;const r=Lt(g,u,i);if(1===r)c=!0;else if(0===r)return!1;if(s&&2===r)return!1;_||(!Ut(t,n.getPointCount()-1)||null!==l.getAccelerators()&&null!==l.getAccelerators().getQuadTree()?g=t:(t.copyTo(h),h.getImpl().buildQuadTreeAccelerator(1),g=h),_=!0)}return c}function tr(t,n,i,s){const o=new r,a=new r;if(t.queryEnvelope(o),n.queryEnvelope(a),!Vr(o,a,i))return!1;const m=new e;return m.addEnvelope(n,!1),Xn(t,m,i,s)}function er(t,e,n,i){En(t,e);const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),Qr(o,s,n))return!1;const a=o.getLowerLeft();return 0===Lt(t,a,0)&&(!o.contains(t.getXY(0))&&!ui(t,o,n))}function nr(t,n,i,s){En(t,n);const o=new r,a=new r;if(t.queryEnvelope(o),n.queryEnvelope(a),Qr(a,o,i))return!1;if(a.height()<=i||a.width()<=i)return!1;const m=new e;return m.addEnvelope(n,!1),li(t,m,i,s)}function rr(t,n,i,s){En(t,n);const o=new r,a=new r;if(t.queryEnvelope(o),n.queryEnvelope(a),Qr(a,o,i))return!1;if(a.height()<=i||a.width()<=i)return!1;const m=new e;return m.addEnvelope(n,!1),hi(t,m,i,s)}function ir(t,e,n,i,s){const o=r.constructEmpty(),a=r.constructEmpty();return t.queryEnvelope(o),e.queryEnvelope(a),i?Jr(a,o,n):Qr(a,o,n)}function sr(t,n,i,s,o){const a=r.constructEmpty(),m=r.constructEmpty();if(t.queryEnvelope(a),n.queryEnvelope(m),!Qr(a,m,i))return!1;En(t,n);const c=new e;return c.addEnvelope(n,!1),s?2===Zr(t,c,i,!1):gi(t,c,i,o)}function or(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),!Vr(s,o,n))return!1;if(En(t,e),ti(t,e,n))return!0;if(t.hasNonLinearSegments()||e.hasNonLinearSegments()){return Re(t,e,n,"**F**FFF*",i,!1)}return ri(t,e,n,!1)}function ar(t,e,n,r){En(t,e);const i=t.getImpl(),s=e.getImpl();return!new gn(i,s,n,!0).next()||!si(t,e,n)}function mr(t,e,n,i){En(t,e);const s=[],o=oi(t,e,n,s);if(-2===o){const s=r.constructEmpty(),o=r.constructEmpty(),a=r.constructEmpty();let m,c;if(t.queryEnvelope(s),e.queryEnvelope(o),s.inflateCoords(1e3*n,1e3*n),o.inflateCoords(1e3*n,1e3*n),a.setCoords({env2D:s}),a.intersect(o),t.getPointCount()>10){if(m=Gt(t,a,n,0,i),m.isEmpty())return!1}else m=t;if(e.getPointCount()>10){if(c=Gt(e,a,n,0,i),c.isEmpty())return!1}else c=e;return Re(m,c,n,"F********",i,!1)}if(0!==o)return!1;const a=new m;for(let r=0;r<s.length;r+=2){const t=s[r],e=s[r+1];a.addXY(t,e)}const c=t.getBoundary(),u=e.getBoundary();return c.addPoints(u,0,u.getPointCount()),!c.isEmpty()&&Ir(c,a,n)}function cr(t,e,n,i){En(t,e);const s=[],o=oi(t,e,n,s);if(-2===o){const s=r.constructEmpty(),o=r.constructEmpty(),a=r.constructEmpty();let m,c;if(t.queryEnvelope(s),e.queryEnvelope(o),s.inflateCoords(1e3*n,1e3*n),o.inflateCoords(1e3*n,1e3*n),a.setCoords({env2D:s}),a.intersect(o),t.getPointCount()>10){if(m=Gt(t,a,n,0,i),m.isEmpty())return!1}else m=t;if(e.getPointCount()>10){if(c=Gt(e,a,n,0,i),c.isEmpty())return!1}else c=e;return Re(m,c,n,"0********",i,!1)}if(0!==o)return!1;const a=new m;for(let r=0;r<s.length;r+=2){const t=s[r],e=s[r+1];a.addXY(t,e)}const c=t.getBoundary(),u=e.getBoundary();return c.addPoints(u,0,u.getPointCount()),!!c.isEmpty()||!Ir(c,a,n)}function ur(t,e,n,i){En(t,e);const s=r.constructEmpty(),o=r.constructEmpty();t.queryEnvelope(s),e.queryEnvelope(o);const a=$r(s,o,n),m=$r(o,s,n),c=t.hasNonLinearSegments(),u=e.hasNonLinearSegments(),l=oi(t,e,n,null);if(-1===l)return!1;if(1===l){if(a&&m)return!0;if(!c&&!u)return a&&!m?!ii(e,t,n,!1):m&&!a?!ii(t,e,n,!1):!ii(t,e,n,!1)&&!ii(e,t,n,!1)}const h=r.constructEmpty(),g=r.constructEmpty(),_=r.constructEmpty();let f,p;h.setCoords({env2D:s}),h.inflateCoords(1e3*n,1e3*n),g.setCoords({env2D:o}),g.inflateCoords(1e3*n,1e3*n),_.setCoords({env2D:h}),_.intersect(g);let d="";if(d+="1*",a){if(e.getPointCount()>10){if(p=Gt(e,_,n,0,i),p.isEmpty())return!1}else p=e;d+="****"}else p=e,d+="T***";if(m){if(t.getPointCount()>10){if(f=Gt(t,_,n,0,i),f.isEmpty())return!1}else f=t;d+="***"}else f=t,d+="T**";return Re(f,p,n,d,i,!1)}function lr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),!Qr(s,o,n))return!1;if(En(t,e),t.hasNonLinearSegments()||e.hasNonLinearSegments()){return Re(t,e,n,"******FF*",i,!1)}return ii(e,t,n,!1)}function hr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),!Qr(s,o,n))return!1;En(t,e);return Re(t,e,n,"T**FF*FF*",i,!1)}function gr(t,e,n,r){En(t,e);return!mi(t,e.getXY(),n)}function _r(t,e,n,r){En(t,e);return xi(t,e.getXY(),n)}function fr(t,e,n,r){En(t,e);return ci(t,e.getXY(),n)}function pr(t,e,n,r){return En(t,e),!ai(t,e,n,!1)}function dr(t,e,n,r){En(t,e);const i=t.getImpl(),s=e.getImpl(),o=new m,a=new gn(i,s,n,!1),c=i.querySegmentIterator();let u=!1;for(;a.next();){const t=a.getRedElement(),e=a.getBlueElement();c.resetToVertex(t,-1);const r=c.nextSegment(),i=s.getXY(e);r.isIntersectingPoint(i,n)&&(u=!0,o.addPoint2D(i))}if(!u)return!1;const l=t.getBoundary();return!l.isEmpty()&&Ir(l,o,n)}function yr(t,e,n,r){En(t,e);const i=t.getImpl(),s=e.getImpl(),o=s.getPointCount(),a=ut(o,!1),c=new gn(i,s,n,!1),u=i.querySegmentIterator();let l=!1;for(;c.next();){const t=c.getRedElement(),e=c.getBlueElement();u.resetToVertex(t,-1);const r=u.nextSegment(),i=s.getXY(e);r.isIntersectingPoint(i,n)&&(l=!0,a[e]=!0)}if(!l)return!1;let h=!1;for(let m=0;m<o;m++)if(!a[m]){h=!0;break}if(!h)return!1;const g=t.getBoundary();if(g.isEmpty())return!0;const _=new m;for(let m=0;m<o;m++)a[m]&&_.addPoint2D(s.getXY(m));return!Ir(g,_,n)}function Pr(t,e,n,i,s){const o=r.constructEmpty(),a=r.constructEmpty();if(t.queryEnvelope(o),e.queryEnvelope(a),!Qr(o,a,n))return!1;En(t,e);const m=ai(t,e,n,!0);if(!m)return m;const c=t.getBoundary();return c.isEmpty()?m:!Ir(c,e,n)}function xr(t,e,n,i){const s=new r,o=new r;return t.queryEnvelope(s),e.queryEnvelope(o),!(o.height()>n&&o.width()>n)&&Vr(s,o,n)}function Cr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();t.queryEnvelope(s),e.queryEnvelope(o);const a=Ci(o,s,n);return 0===a?!ui(t,o,n):4===a}function Er(t,n,i,s){const o=new r,a=new r;if(t.queryEnvelope(o),n.queryEnvelope(a),a.height()<=i||a.width()<=i)return!1;const m=new r,c=new r;if(m.setCoords({env2D:a}),c.setCoords({env2D:a}),m.inflateCoords(i,i),c.inflateCoords(-i,-i),c.containsEnvelope(o)||!o.isIntersecting(m))return!1;const u=t.getImpl().querySegmentIterator();u.stripAttributes();const l=t.getImpl().getAccelerators();let h=null,g=null;null!==l&&(h=l.getQuadTree(),null!==h&&(g=h.getIterator(a,i))),g||u.nextPath()||V("relational_operations");let _=!1,f=null;const p=new Q,d=new Q,y=t.hasNonLinearSegments();let P=!1;for(;;){if(null!==g){const t=g.next();if(-1===t)break;u.resetToVertex(h.getElement(t),-1),f=u.nextSegment()}else{for(;!u.hasNextSegment()&&u.nextPath(););if(!u.hasNextSegment())break;f=u.nextSegment()}if(y&&f.getGeometryType()!==L.enumLine){const t=new r;if(f.queryEnvelope(t),c.containsEnvelope(t))return!1;if(m.isIntersecting(t)){P=!0;break}}else{p.assign(f.getStartXY()),d.assign(f.getEndXY());let t=c.clipLine(p,d);if(0!==t)return!1;_||(t=m.clipLine(p,d),0!==t&&(_=!0))}}if(!P)return _;const x=new e;return x.addEnvelope(a,!1),zn(x,t,i,s)}function Sr(t,e,n,i,s){const o=r.constructEmpty(),a=r.constructEmpty();if(t.queryEnvelope(o),e.queryEnvelope(a),a.height()<=n||a.width()<=n)return!1;if(i)return Jr(a,o,n);if(!Qr(a,o,n))return!1;const m=r.constructEmpty();m.setCoords({env2D:a}),m.inflateCoords(-n,-n);const u=r.constructEmpty();if(u.setCoords({env2D:a}),u.inflateCoords(n,n),m.containsEnvelope(o))return!0;const l=t.getImpl().querySegmentIterator();l.stripAttributes(),l.nextPath()||V("relational_operations");let h,g,_,f,p,d,y=!1;const P=t.hasNonLinearSegments();for(P&&(_=new c,f=new c,p=new c,d=new c,m.querySide(0,_),m.querySide(1,f),m.querySide(2,p),m.querySide(3,d));;){for(;!l.hasNextSegment()&&l.nextPath(););if(!l.hasNextSegment())break;const t=l.nextSegment();if(P&&t.getGeometryType()!==L.enumLine){if(t.isIntersecting(_,n)){y=!0;break}if(t.isIntersecting(f,n)){y=!0;break}if(t.isIntersecting(p,n)){y=!0;break}if(t.isIntersecting(d,n)){y=!0;break}}else{h=t.getStartXY(),g=t.getEndXY();if(0!==m.clipLine(h,g)){y=!0;break}}}return y}function wr(t,e,n,i){const s=new r,o=new r;if(t.queryEnvelope(s),e.queryEnvelope(o),o.height()<=n||o.width()<=n)return!1;const a=new r;if(a.setCoords({env2D:o}),a.inflateCoords(n,n),a.containsEnvelope(s))return!1;const m=!0,u=new r;if(u.setCoords({env2D:o}),u.inflateCoords(-n,-n),!u.isIntersecting(s))return!1;const l=t.getImpl().querySegmentIterator();l.stripAttributes();const h=t.getImpl().getAccelerators();let g=null,_=null;if(null!==h&&(g=h.getQuadTree(),null!==g&&(_=g.getIterator(o,n))),!_){const t=l.nextPath();X(t)}let f=!1,p=null;const d=new Q,y=new Q;let P=null,x=null,C=null,E=null;for(t.hasNonLinearSegments()&&(P=new c,x=new c,C=new c,E=new c,u.querySide(0,P),u.querySide(1,x),u.querySide(2,C),u.querySide(3,E));;){if(null!==_){const t=_.next();if(-1===t)break;l.resetToVertex(g.getElement(t),-1),p=l.nextSegment()}else{for(;!l.hasNextSegment()&&l.nextPath(););if(!l.hasNextSegment())break;p=l.nextSegment()}if(p.getGeometryType()===L.enumLine){d.assign(p.getStartXY()),y.assign(p.getEndXY());if(0!==u.clipLine(d,y)){f=!0;break}}else{if(P.isIntersecting(p,n)){f=!0;break}if(x.isIntersecting(p,n)){f=!0;break}if(C.isIntersecting(p,n)){f=!0;break}if(E.isIntersecting(p,n)){f=!0;break}}}return f&&m}function br(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Vr(s,o,n)&&(!!ei(t,e,n)||ni(t,e,n,!1,!0,!1))}function Tr(t,e,n,r){const i=t,s=e,o=new gn(i,s,n,!1),a=n*n,m=new Q,c=new Q;for(;o.next();){const t=o.getRedElement(),e=o.getBlueElement();if(i.queryXY(t,m),s.queryXY(e,c),Q.sqrDistance(m,c)<=a)return!1}return!0}function vr(t,e,n,r){return ni(t,e,n,!1,!1,!0)}function Ir(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&ni(e,t,n,!0,!1,!1)}function Dr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),Vr(s,o,n)}function Gr(t,e,n,r){return Pi(t,e.getXY(),n)}function Nr(t,e,n,r){return Dr(t,e,n)}function Mr(t,e,n,r){return!Gr(t,e,n)}function Ar(t,e,n,i){const s=new r,o=new r;return t.queryEnvelope(s),e.queryEnvelope(o),!(o.height()>n||o.width()>n)&&Vr(s,o,n)}function qr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),Qr(o,s,n))return!1;const a=r.constructEmpty();a.setCoords({env2D:o}),a.inflateCoords(n,n);const m=new Q;for(let r=0;r<t.getPointCount();r++)if(t.queryXY(r,m),a.contains(m))return!1;return!0}function Yr(t,e,n,i){const s=new r,o=new r,a=new r;if(e.queryEnvelope(s),s.height()<=n||s.width()<=n)return!1;o.setCoords({env2D:s}),a.setCoords({env2D:s}),o.inflateCoords(n,n),a.inflateCoords(-n,-n);const m=new Q;let c=!1;for(let r=0;r<t.getPointCount();r++)if(t.queryXY(r,m),o.contains(m)){if(a.containsExclusive(m))return!1;c=!0}return c}function Xr(t,e,n,i,s){const o=r.constructEmpty(),a=r.constructEmpty();if(t.queryEnvelope(o),e.queryEnvelope(a),a.height()<=n||a.width()<=n)return!1;if(i)return Jr(a,o,n);if(!Qr(a,o,n))return!1;let m=!1;const c=r.constructEmpty(),u=r.constructEmpty();c.setCoords({env2D:a}),u.setCoords({env2D:a}),c.inflateCoords(-n,-n),u.inflateCoords(n,n);const l=new Q;for(let r=0;r<t.getPointCount();r++){if(t.queryXY(r,l),!u.contains(l))return!1;c.containsExclusive(l)&&(m=!0)}return m}function Rr(t,e,n,i){const s=new r,o=new r;if(t.queryEnvelope(s),e.queryEnvelope(o),Qr(o,s,n))return!1;if(o.height()<=n||o.width()<=n)return!1;const a=new r,m=new r;a.setCoords({env2D:o}),a.inflateCoords(-n,-n),m.setCoords({env2D:o}),m.inflateCoords(n,n);const c=new Q;let u=!1,l=!1;for(let r=0;r<t.getPointCount();r++)if(t.queryXY(r,c),!u&&a.containsExclusive(c)&&(u=!0),l||m.contains(c)||(l=!0),u&&l)return!0;return!1}function Fr(t,e,n,r){return Q.sqrDistance(t,e)<=n*n}function Or(t,e,n,r){return Q.sqrDistance(t,e)>n*n}function Lr(t,e,n,r){return Fr(t,e,n)}function Ur(t,e,n,i){const s=new r;return s.setCoords({pt:t}),Vr(s,e,n)}function Hr(t,e,n,i){if(e.height()<=n||e.width()<=n)return!1;const s=new r,o=new r;return s.setCoords({env2D:e}),s.inflateCoords(n,n),!!s.contains(t)&&(o.setCoords({env2D:e}),o.inflateCoords(-n,-n),!o.containsExclusive(t))}function zr(t,e,n,i){if(e.height()<=n||e.width()<=n)return!1;const s=r.constructEmpty();s.setCoords({env2D:e}),s.inflateCoords(-n,-n);return s.containsExclusive(t)}function Vr(t,e,n,r){return Qr(t,e,n)&&Qr(e,t,n)}function jr(t,e,n,i){if(t.height()<=n||t.width()<=n||e.height()<=n||e.width()<=n)return!1;const s=new r;return s.setCoords({env2D:t}),s.inflateCoords(-n,-n),s.intersect(e),!(!s.isEmpty()&&s.height()>n&&s.width()>n)&&(s.setCoords({env2D:t}),s.inflateCoords(n,n),s.intersect(e),!s.isEmpty())}function kr(t,e,n,i){if(t.height()<=n||t.width()<=n||e.height()<=n||e.width()<=n)return!1;if(Qr(t,e,n))return!1;if(Qr(e,t,n))return!1;const s=new r;return s.setCoords({env2D:t}),s.inflateCoords(-n,-n),s.intersect(e),!s.isEmpty()&&(s.height()>n||s.width()>n)}function Br(t,e,n,i,s){if(t.height()<=n||t.width()<=n)return!1;if(i)return Jr(t,e,n);if(!Qr(t,e,n))return!1;const o=r.constructEmpty();return o.setCoords({env2D:t}),o.inflateCoords(-n,-n),o.intersect(e),!o.isEmpty()}function Zr(t,n,i,s,o){const a=new Q,m=new Q,c=r.constructEmpty(),u=r.constructEmpty(),l=t.getImpl(),h=n.getImpl(),g=h.getGeometryType(),_=new gn(l,h,i,!0);if(!_.next())return 1;if(si(t,n,i))return s?4:0;const f=new e;let p=t;const d=new e;let y=null;g===L.enumPolygon&&(y=n);const P=g===L.enumPolygon?ut(l.getPathCount(),!1):[],x=ut(h.getPathCount(),!1);let C=!1,E=!1,S=!1,w=!1,b=!1,T=!1;do{if(S&&b||w&&T)break;if(S&&w)break;const e=_.getRedElement(),r=_.getBlueElement();if(!x[r]&&(m.assign(n.getXY(n.getPathStart(r))),c.setCoords({env2D:_.getRedEnvelope()}),c.inflateCoords(i,i),c.contains(m))){if(0!==Lt(p,m,0)){if(w=!0,s)return 4}else T=!0;x[r]=!0}if(g===L.enumPolygon&&!P[e]&&(a.assign(t.getXY(t.getPathStart(e))),u.setCoords({env2D:_.getBlueEnvelope()}),u.inflateCoords(i,i),u.contains(a))){if(0!==Lt(y,a,0)){if(S=!0,s)return 4}else b=!0;P[e]=!0}if(C||(!Ut(t,n.getPathCount()-1)||null!==l.getAccelerators()&&null!==l.getAccelerators().getQuadTree()?p=t:(t.copyTo(f),f.getImpl().buildQuadTreeAccelerator(1),p=f),C=!0),g===L.enumPolygon&&!E){const e=n;!Ut(e,t.getPathCount()-1)||null!==h.getAccelerators()&&null!==h.getAccelerators().getQuadTree()?y=n:(e.copyTo(d),d.getImpl().buildQuadTreeAccelerator(1),y=d),E=!0}}while(_.next());if(!S&&!w)return 1;if(!b||!T){if(g===L.enumPolygon)for(let t=0,e=l.getPathCount();t<e;t++)if(!P[t]){b=!0;break}for(let t=0,e=h.getPathCount();t<e;t++)if(!x[t]){T=!0;break}}return S&&b||w&&T||S&&w?4:w?2:3}function Kr(t,n,i,s,o){const a=r.constructEmpty();t.queryEnvelope(a),a.inflateCoords(i,i);const m=new Q,c=t.getImpl(),u=new e;let l=t,h=!1,g=!1,_=!1;for(let e=0;e<n.getPointCount();e++){if(n.queryXY(e,m),a.contains(m)){const t=Lt(l,m,i);if(1===t)return g=!0,4;if(2===t)return 4;_=!0}else _=!0;h||(!Ut(t,n.getPointCount()-1)||null!==c.getAccelerators()&&null!=c.getAccelerators().getQuadTree()?l=t:(t.copyTo(u),u.getImpl().buildQuadTreeAccelerator(1),l=u),h=!0)}return g?_?4:2:1}function Wr(t,n,i,s,o){s[0]=!1;const a=t.getImpl(),m=n.getImpl(),c=a.querySegmentIterator(),u=m.querySegmentIterator(),l=[0,0],h=[0,0],g=new gn(a,m,i);let _=!1;for(;g.next();){const t=g.getRedElement(),e=g.getBlueElement();c.resetToVertex(t,-1),u.resetToVertex(e,-1);const n=c.nextSegment(),r=u.nextSegment();let o=0;if(Ei(n,r)?!_&&r.isIntersecting(n,i)&&(_=!0):o=r.intersect(n,null,h,l,i),0!==o&&(_=!0,1===o)){const t=l[0],e=h[0];if(t>0&&t<1&&e>0&&e<1)return s[0]=!0,!1}}if(!_){s[0]=!0;const o=r.constructEmpty();t.queryEnvelope(o),o.inflateCoords(i,i);const c=new e;let u=t,l=!1;for(let e=0,i=n.getPathCount();e<i;e++)if(n.getPathSize(e)>0){const i=r.constructEmpty();if(n.queryPathEnvelope(e,i),!o.isIntersecting(i))return!1;{const t=n.getXY(n.getPathStart(e)),r=jt(u,t,0);if(X(-1!==r),0===r)return!1}l||(!Ut(t,n.getPathCount()-1)||null!==a.getAccelerators()&&null!==a.getAccelerators().getQuadTree()?u=t:(t.copyTo(c),c.getImpl().buildQuadTreeAccelerator(1),u=c),l=!0)}if(1===t.getPathCount()||n.getGeometryType()===L.enumPolyline)return!0;const h=n,g=r.constructEmpty();h.queryEnvelope(g),g.inflateCoords(i,i);const _=new e;let f=h,p=!1;for(let e=0,n=t.getPathCount();e<n;e++)if(t.getPathSize(e)>0){const n=r.constructEmpty();if(t.queryPathEnvelope(e,n),g.isIntersecting(n)){const n=t.getXY(t.getPathStart(e)),r=jt(f,n,0);if(X(-1!==r),1===r)return!1}p||(!Ut(h,t.getPathCount()-1)||null!==m.getAccelerators()&&null!==m.getAccelerators().getQuadTree()?f=h:(h.copyTo(_),_.getImpl().buildQuadTreeAccelerator(1),f=_),p=!0)}return!0}return!1}function Qr(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:t}),i.inflateCoords(n,n),i.containsEnvelope(e)}function Jr(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:e}),i.inflateCoords(n,n),t.containsExclusiveEnvelope(i)}function $r(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:e}),i.inflateCoords(n,n),!i.contains(t.getLowerLeft())||(!i.contains(t.getLowerRight())||(!i.contains(t.getUpperLeft())||!i.contains(t.getUpperRight())))}function ti(t,e,n,r){if(t.getPathCount()!==e.getPathCount()||t.getPointCount()!==e.getPointCount())return!1;if(t.hasNonLinearSegments()||e.hasNonLinearSegments())return t.equals(e);const i=new Q,s=new Q;let o=!0;const a=n*n;for(let m=0;m<t.getPathCount();m++){if(t.getPathEnd(m)!==e.getPathEnd(m)){o=!1;break}for(let n=t.getPathStart(m);n<e.getPathEnd(m);n++)if(t.queryXY(n,i),e.queryXY(n,s),Q.sqrDistance(i,s)>a){o=!1;break}if(!o)break}return!!o}function ei(t,e,n,r){if(t.getPointCount()!==e.getPointCount())return!1;const i=new Q,s=new Q;let o=!0;const a=n*n;for(let m=0;m<t.getPointCount();m++)if(t.queryXY(m,i),e.queryXY(m,s),Q.sqrDistance(i,s)>a){o=!1;break}return!!o}function ni(t,e,n,r,i,s,o){const a=t.getImpl(),m=e.getImpl(),c=a.getPointCount(),u=m.getPointCount(),l=ut(c,!1),h=i||s?ut(u,!1):[],g=n*n,_=new gn(a,m,n);for(;_.next();){const t=_.getRedElement(),e=_.getBlueElement(),n=a.getXY(t),r=m.getXY(e);Q.sqrDistance(n,r)<=g&&(l[t]=!0,(i||s)&&(h[e]=!0))}let f=!1,p=!1;for(let P=0;P<c;P++){const t=l[P];if(f||=!t,p||=t,(i||r)&&f)return!1}if(r)return!0;let d=!1,y=!1;for(let P=0;P<u;P++){const t=h[P];if(d||=!t,y||=t,i&&d)return!1}return!!i||f&&p&&d&&y}function ri(t,e,n,r){return ii(t,e,n,r)&&ii(e,t,n,r)}function ii(t,e,n,i){if(R(t),R(e),e.isEmpty())return!1;let s=!0;const o=ut(2,Number.NaN),m=ut(2,Number.NaN),c=[],l=new wi;let h;const g=r.constructEmpty(),_=r.constructEmpty(),f=r.constructEmpty();t.queryEnvelope(g),e.queryEnvelope(_),g.inflateCoords(n,n),_.inflateCoords(n,n),f.setCoords({env2D:g}),f.intersect(_);const p=t.getImpl().querySegmentIterator(),d=e.getImpl().querySegmentIterator(),y=e.getImpl().getAccelerators();let P=null,x=null,C=null,E=null;if(null!==y&&(P=y.getQuadTree(),x=y.getQuadTreeForPaths(),null!==x&&(E=x.getIteratorForQT())),null===P){const n=t.getPointCount(),r=e.getPointCount();n>10&&r>10&&(P=u(e.getImpl(),f))}for(null!==P&&(C=P.getIteratorForQT());p.nextPath();)for(;p.hasNextSegment();){let t=p.nextSegment();if(t.queryEnvelope(g),!g.isIntersecting(f))return s=!1,!1;if(null!==E&&(E.resetIterator(g,n),-1===E.next()))continue;let e=0,r=null;if(null!=C)C.resetIterator(t,n);else if(d.resetToFirstPath(),!d.nextPath())return s=!1,!1;do{if(e=0,null!==C){const i=C.next();if(-1===i)return s=!1,!1;d.resetToVertex(P.getElement(i),-1),r=d.nextSegment(),e=t.intersect(r,null,o,m,n)}else{for(;!d.hasNextSegment();)if(!d.nextPath())return s=!1,!1;r=d.nextSegment(),r.queryEnvelope(_),_.inflateCoords(n,n),g.isIntersecting(_)&&(e=t.intersect(r,null,o,m,n))}}while(2!==e||0!==o[0]||i&&!(m[0]<=m[1]));let u=Number.NaN,y=!1;do{let i=!1;if(1===o[1]){if(!p.hasNextSegment()){y=!0;break}t=p.nextSegment(),i=!0}if(1===m[1]&&m[0]<=m[1]){if(-1===u)break;if(u=1,!d.hasNextSegment())break;r=d.nextSegment(),i=!0}if(0===m[1]&&m[0]>m[1]){if(1===u)break;if(Number.isNaN(u)){if(!d.hasPreviousSegment())break;d.previousSegment(),u=-1}if(!d.hasPreviousSegment())break;r=d.previousSegment(),i=!0}if(!i)break;e=t.intersect(r,null,o,m,n)}while(2===e&&(!i||m[0]<=m[1]));if(y)continue;const x=t.calculateLength2D();t.queryEnvelope(g),c.length=0,l.m_overlapEvents.length=0;let S=!1,w=!1,b=0;const T=a(null,g,!0);for(null!==C?C.resetIterator(t,n):(d.resetToFirstPath(),d.nextPath()||V("relational_operations"));;){if(e=0,null!==C){const i=C.next();if(-1===i)break;d.resetToVertex(P.getElement(i),-1),r=d.nextSegment(),e=t.intersect(r,null,o,m,n)}else{for(;!d.hasNextSegment()&&d.nextPath(););if(!d.hasNextSegment())break;r=d.nextSegment(),r.queryEnvelope(_),_.inflateCoords(n,n),g.isIntersecting(_)&&(e=t.intersect(r,null,o,m,n))}if(2===e&&(!i||m[0]<=m[1])){const t=p.getStartPointIndex(),e=p.getPathIndex(),r=d.getStartPointIndex(),i=d.getPathIndex();if(h=Si(t,e,o[0],o[1],r,i,m[0],m[1]),l.m_overlapEvents.push(h),c.push(c.length),!(S||h.m_scalarA0<b&&h.m_scalarA1<b))if(0===b&&x*(h.m_scalarA0-b)>n)S=!0;else if(0!==b&&x*(h.m_scalarA0-b)>T)S=!0;else if(b=h.m_scalarA1,x*(1-b)<=n||1===b){w=!0;break}}}if(!w){if(!S)return s=!1,!1;c.length>1&&c.sort(((t,e)=>l.compareOverlapEvents(t,e))),b=0;for(let t=0;t<l.m_overlapEvents.length;t++)if(h=l.m_overlapEvents[c[t]],!(h.m_scalarA0<b&&h.m_scalarA1<b)){if(0===b&&x*(h.m_scalarA0-b)>n)return s=!1,!1;if(0!==b&&x*(h.m_scalarA0-b)>T)return s=!1,!1;if(b=h.m_scalarA1,x*(1-b)<=n||1===b)break}if(x*(1-b)>n)return s=!1,!1;c.length=0,l.m_overlapEvents.length=0}}return s}function si(t,e,n){const r=t.getImpl(),i=e.getImpl(),s=r.querySegmentIterator(),o=i.querySegmentIterator(),a=new gn(r,i,n);for(;a.next();){const t=a.getRedElement(),e=a.getBlueElement();s.resetToVertex(t,-1),o.resetToVertex(e,-1);const r=s.nextSegment();if(o.nextSegment().isIntersecting(r,n))return!0}return!1}function oi(t,e,n,r){const i=t.getImpl(),s=e.getImpl(),o=i.querySegmentIterator(),a=s.querySegmentIterator(),m=ut(2,Number.NaN),c=new gn(i,s,n);let u=!1,l=-1;for(;c.next();){const t=c.getRedElement(),e=c.getBlueElement();o.resetToVertex(t,-1),a.resetToVertex(e,-1);const i=o.nextSegment(),s=a.nextSegment();let h=0;if(Ei(i,s)){if(s.isIntersecting(i,n))return-2}else h=i.intersect(s,null,m,null,n);if(h)if(2===h){const t=i.calculateLength2D(),e=m[0];if(t*(m[1]-e)>n)return l=1,l;u=!0}else if(l=0,r){const t=m[0],e=new Q;i.queryCoord2D(t,e),r.push(e.x),r.push(e.y)}}return u?-2:l}function ai(t,e,n,r){const i=t.getImpl(),s=e,o=s.getPointCount(),a=r?ut(o,!1):[],m=new gn(i,s,n,!1),c=i.querySegmentIterator();for(;m.next();){const t=m.getRedElement(),e=m.getBlueElement();c.resetToVertex(t,-1);const i=c.nextSegment(),o=s.getXY(e);if(i.isIntersectingPoint(o,n)){if(!r)return!0;a[e]=!0}}if(!r)return!1;for(let u=0;u<o;u++)if(!a[u])return!1;return!0}function mi(t,e,n){const i=new Q,s=n*n,o=t.querySegmentIterator(),a=t.getImpl().getAccelerators();if(null!==a){const t=a.getQuadTree();if(null!==t){const a=r.constructEmpty();a.setCoords({pt:e});const m=t.getIterator(a,n);for(let n=m.next();-1!==n;n=m.next())if(o.resetToVertex(t.getElement(n),-1),o.hasNextSegment()){const t=o.nextSegment(),n=t.getClosestCoordinate(e,!1);if(t.queryCoord2D(n,i),Q.sqrDistance(e,i)<=s)return!0}return!1}}const m=r.constructEmpty();for(;o.nextPath();)for(;o.hasNextSegment();){const t=o.nextSegment();if(t.queryEnvelope(m),m.inflateCoords(n,n),!m.contains(e))continue;const r=t.getClosestCoordinate(e,!1);if(t.queryCoord2D(r,i),Q.sqrDistance(e,i)<=s)return!0}return!1}function ci(t,e,n){return mi(t,e,n)&&!xi(t,e,n)}function ui(t,e,n,i){const s=t.querySegmentIterator(),o=t.getImpl().getAccelerators(),a=t.hasNonLinearSegments();let m=null,u=null,l=null,h=null;if(null!==o){const t=o.getQuadTree();if(null!==t){const i=t.getIterator(e,n);a&&(m=new c,u=new c,l=new c,h=new c,e.querySide(0,m),e.querySide(1,u),e.querySide(2,l),e.querySide(3,h));const o=r.constructEmpty();o.setCoords({env2D:e}),o.inflateCoords(n,n);for(let r=i.next();-1!==r;r=i.next())if(s.resetToVertex(t.getElement(r),-1),s.hasNextSegment()){const t=s.nextSegment();if(t.getGeometryType()===L.enumLine){const e=t.getStartXY(),n=t.getEndXY();if(o.clipLine(e,n))return!0;continue}if(e.contains(t.getStartXY())||e.contains(t.getEndXY()))return!0;if(t.isIntersecting(m,n))return!0;if(t.isIntersecting(u,n))return!0;if(t.isIntersecting(l,n))return!0;if(t.isIntersecting(h,n))return!0}return!1}}if(a){m=new c,u=new c,l=new c,h=new c,e.querySide(0,m),e.querySide(1,u),e.querySide(2,l),e.querySide(3,h);const r=t.querySegmentIterator();for(;r.nextPath();)for(;r.hasNextSegment();){const t=r.nextSegment();if(e.contains(t.getStartXY())||e.contains(t.getEndXY()))return!0;if(t.isIntersecting(m,n))return!0;if(t.isIntersecting(u,n))return!0;if(t.isIntersecting(l,n))return!0;if(t.isIntersecting(h,n))return!0}}else{const i=r.constructEmpty();i.setCoords({env2D:e}),i.inflateCoords(n,n);const s=t.getImpl(),o=s.getAttributeStreamRef(0),a=new Q;for(let t=0,e=s.getPathCount();t<e;t++){let e=!0;const n=new Q,r=new Q,m=new Q,c=s.getPathStart(t),u=new Q;for(let l=c,h=s.getPathEnd(t);l<h;l++)if(e)o.queryPoint2D(2*l,n),u.assign(n),e=!1;else{if(o.queryPoint2D(2*l,a),r.setCoordsPoint2D(n),m.setCoordsPoint2D(a),i.clipLine(r,m))return!0;n.assign(a)}if(s.isClosedPath(t)&&!e&&(r.setCoordsPoint2D(n),m.setCoordsPoint2D(u),i.clipLine(r,m)))return!0}}return!1}function li(t,e,n,i){const s=t.getImpl(),o=e.getImpl(),a=[0],m=l(s.getIsSimple(0,a))&&l(o.getIsSimple(0,a)),c=s.querySegmentIterator(),u=o.querySegmentIterator(),h=ut(2,0),g=ut(2,0),_=new gn(s,o,n);let f=!1;for(;_.next();){const t=_.getRedElement(),e=_.getBlueElement();c.resetToVertex(t,-1),u.resetToVertex(e,-1);const r=c.nextSegment(),i=u.nextSegment();let s=0;if(Ei(r,i)){if(i.isIntersecting(r,n)){f=!0;break}}else s=i.intersect(r,null,g,h,n);if(2===s){const t=h[0],e=h[1],i=r.calculateLength2D();if(m&&(e-t)*i>n)return!1;f=!0}else if(s){const t=h[0],e=g[0];if(t>0&&t<1&&e>0&&e<1)return!1;f=!0}}if(!f)return!1;const p=r.constructEmpty(),d=r.constructEmpty(),y=r.constructEmpty();let P,x;if(t.queryEnvelope(p),e.queryEnvelope(d),p.inflateCoords(1e3*n,1e3*n),d.inflateCoords(1e3*n,1e3*n),y.setCoords({env2D:p}),y.intersect(d),t.getPointCount()>10){if(P=Gt(t,y,n,0,i),P.isEmpty())return!1}else P=t;if(e.getPointCount()>10){if(x=Gt(e,y,n,0,i),x.isEmpty())return!1}else x=e;return Re(P,x,n,"F********",i,!1)}function hi(t,e,n,i){const s=t.getImpl(),o=e.getImpl(),a=[0],m=l(s.getIsSimple(0,a))&&l(o.getIsSimple(0,a)),c=r.constructEmpty(),u=r.constructEmpty(),h=r.constructEmpty();t.queryEnvelope(c),e.queryEnvelope(u);let g=!1;const _=$r(c,u,n),f=$r(u,c,n),p=s.querySegmentIterator(),d=o.querySegmentIterator(),y=ut(2,Number.NaN),P=ut(2,Number.NaN),x=new gn(s,o,n);for(;x.next();){const t=x.getRedElement(),e=x.getBlueElement();p.resetToVertex(t,-1),d.resetToVertex(e,-1);const r=p.nextSegment(),i=d.nextSegment();let s=0;if(Ei(r,i)){if(i.isIntersecting(r,n))break}else s=i.intersect(r,null,P,y,n);if(2===s){const t=y[0],e=y[1],i=r.calculateLength2D();if(m&&(e-t)*i>n&&(g=!0,_&&f))return!0}else if(s){const t=y[0],e=P[0];if(t>0&&t<1&&e>0&&e<1)return!0}}const C=r.constructEmpty(),E=r.constructEmpty();let S,w;C.setCoords({env2D:c}),C.inflateCoords(1e3*n,1e3*n),E.setCoords({env2D:u}),E.inflateCoords(1e3*n,1e3*n),h.setCoords({env2D:C}),h.intersect(E);let b="";if(b+=g?"**":"T*",_){if(e.getPointCount()>10){if(w=Gt(e,h,n,0,i),w.isEmpty())return!1}else w=e;b+="****"}else w=e,b+="T***";if(f){if(t.getPointCount()>10){if(S=Gt(t,h,n,0,i),S.isEmpty())return!1}else S=t;b+="***"}else S=t,b+="T**";return Re(S,w,n,b,i,!1)}function gi(t,e,n,i){const s=[!1],o=Wr(t,e,n,s);if(s[0])return o;const a=r.constructEmpty();let m;if(e.queryEnvelope(a),a.inflateCoords(1e3*n,1e3*n),t.getPointCount()>10){if(m=Gt(t,a,n,0,i),m.isEmpty())return!1}else m=t;return Fe(m,e,n,i)}function _i(t,e,n,i){const s=t.getImpl(),o=e.getImpl(),a=s.querySegmentIterator(),m=o.querySegmentIterator(),c=ut(2,Number.NaN),u=ut(2,Number.NaN),l=new gn(s,o,n);let h=!1;for(;l.next();){const t=l.getRedElement(),e=l.getBlueElement();a.resetToVertex(t,-1),m.resetToVertex(e,-1);const r=a.nextSegment(),i=m.nextSegment();let s=0;if(Ei(r,i)?!h&&i.isIntersecting(r,n)&&(h=!0):s=i.intersect(r,null,u,c,n),2===s)h=!0;else if(s){const t=c[0],e=u[0];if(t>0&&t<1&&e>0&&e<1)return!1;h=!0}}if(!h)return!1;const g=r.constructEmpty(),_=r.constructEmpty(),f=r.constructEmpty();let p,d;if(t.queryEnvelope(g),e.queryEnvelope(_),g.inflateCoords(1e3*n,1e3*n),_.inflateCoords(1e3*n,1e3*n),f.setCoords({env2D:g}),f.intersect(_),t.getPointCount()>10){if(p=Gt(t,f,n,0,i),p.isEmpty())return!1}else p=t;if(e.getPointCount()>10){if(d=Gt(e,f,n,0,i),d.isEmpty())return!1}else d=e;return Re(p,d,n,"F********",i,!1)}function fi(t,e,n,i){const s=t.getImpl(),o=e.getImpl(),a=s.querySegmentIterator(),m=o.querySegmentIterator(),c=ut(2,Number.NaN),u=ut(2,Number.NaN),l=new gn(s,o,n);let h=!1;for(;l.next();){const t=l.getRedElement(),e=l.getBlueElement();a.resetToVertex(t,-1),m.resetToVertex(e,-1);const r=a.nextSegment(),i=m.nextSegment();let s=0;if(Ei(r,i)?!h&&i.isIntersecting(r,n)&&(h=!0):s=i.intersect(r,null,u,c,n),2===s)h=!0;else if(s){const t=c[0],e=u[0];if(t>0&&t<1&&e>0&&e<1)return!0;h=!0}}if(!h)return!1;const g=r.constructEmpty(),_=r.constructEmpty(),f=r.constructEmpty(),p=r.constructEmpty(),d=r.constructEmpty();if(t.queryEnvelope(g),e.queryEnvelope(_),$r(_,g,n)){let r,s;if(f.setCoords({env2D:g}),f.inflateCoords(1e3*n,1e3*n),p.setCoords({env2D:_}),p.inflateCoords(1e3*n,1e3*n),d.setCoords({env2D:f}),d.intersect(p),t.getPointCount()>10){if(r=Gt(t,d,n,0,i),r.isEmpty())return!1}else r=t;if(e.getPointCount()>10){if(s=Gt(e,d,n,0,i),s.isEmpty())return!1}else s=e;return Re(r,s,n,"T********",i,!1)}return Re(t,e,n,"T*****T**",i,!1)}function pi(t,e,n,i){const s=[!1],o=Wr(t,e,n,s);if(s[0])return o;const a=r.constructEmpty();let m;if(e.queryEnvelope(a),a.inflateCoords(1e3*n,1e3*n),t.getPointCount()>10){if(m=Gt(t,a,n,0,i),m.isEmpty())return!1}else m=t;return Oe(m,e,n,i)}function di(t,e,n,r){return 1===Lt(t,e,n)}function yi(t,e,n,r){return 2===Lt(t,e,n)}function Pi(t,e,n,r){const i=new Q,s=n*n;for(let o=0;o<t.getPointCount();o++)if(t.queryXY(o,i),Q.sqrDistance(i,e)<=s)return!1;return!0}function xi(t,e,n){const r=t.getBoundary();return!r.isEmpty()&&!Pi(r,e,n)}function Ci(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:t}),i.inflateCoords(n,n),i.containsEnvelope(e)?1073741824:i.isIntersecting(e)?t.isIntersecting(e)?t.xmin<e.xmin&&e.xmax<t.xmax?e.ymin<t.ymin&&e.ymax>t.ymax?0:1073741824:t.ymin<e.ymin&&e.ymax<t.ymax?e.xmin<t.xmin&&e.xmax>t.xmax?0:1073741824:0:0:4}function Ei(t,e){return t.getGeometryType()!==L.enumLine||e.getGeometryType()!==L.enumLine}function Si(t,e,n,r,i,s,o,a){return{m_ivertexA:t,m_ipathA:e,m_scalarA0:n,m_scalarA1:r,m_ivertexB:i,m_ipathB:s,m_scalarB0:o,m_scalarB1:a}}class wi{constructor(){this.m_overlapEvents=[]}compareOverlapEvents(t,e){const n=this.m_overlapEvents[t],r=this.m_overlapEvents[e];if(n.m_ipathA<r.m_ipathA)return-1;if(n.m_ipathA===r.m_ipathA){if(n.m_ivertexA<r.m_ivertexA)return-1;if(n.m_ivertexA===r.m_ivertexA){if(n.m_scalarA0<r.m_scalarA0)return-1;if(n.m_scalarA0===r.m_scalarA0){if(n.m_scalarA1<r.m_scalarA1)return-1;if(n.m_scalarA1===r.m_scalarA1&&n.m_ivertexB<r.m_ivertexB)return-1}}}return 1}}function bi(t,e,n){return e.m_projector.project(t,n)}function Ti(t,e,n,r,i){t.m_projector.transformInPlaceZ(e,null,n,r,null,i);const s=r.slice(0,n).filter((t=>!t.isNAN()));for(let o=0,a=s.length;o<a;++o)r[o].assign(s[o]);return s.length}function vi(t,e,n,r,i){return t.m_projector.transformInPlaceZ(e,null,n,r,null,i)}function Ii(t,i,s,o){if(t&&i&&i.isPannable()||Y("fold_into_360_range_geodetic"),t.isEmpty())return t;if(4===s)return Di(t,i,o);let a=t;const m=a.getGeometryType();if(j(m)){a=mo(t,i);const e=new r;a.queryEnvelope(e);const n=h(i,e,!1).total(),o=i.getPannableExtent();let m=Math.floor((e.xmin-o.xmin)/o.width())*o.width()+o.xmin,c=a;for(;m<e.xmax;)m>e.xmin+n&&m<e.xmax-n&&(c=oo(c,i,s,!0,m)),m+=o.width();a=c}else{if(m===L.enumEnvelope){const t=new e({vd:a.getDescription()});return t.addEnvelope(a,!1),Ii(t,i,s,o)}if(U(m)){const t=new n({vd:a.getDescription()});return t.addSegment(a,!0),Ii(t,i,s,o)}}return Di(a,i,o)}function Di(t,r,i){if(t&&r&&r.isPannable()||Y(""),t.isEmpty())return t;let s;const o=t.getGeometryType();if(o===L.enumEnvelope){const n=new e({vd:t.getDescription()});n.addEnvelope(t,!1),s=n}else if(U(o)){const e=new n({vd:t.getDescription()});e.addSegment(t,!0),s=e}else s=t;const a=mo(s,r);return a.isEmpty()?a:$s(a,r,0,a!==t,0,i)}function Gi(t,e,n){if(!e.isPannable()||t.isEmpty())return t;const r=e.getPannableExtent().width(),i=.5*r,s=t.queryInterval(0,0);if(s.width()<i||!z(t.getGeometryType())){if(Number.isNaN(n))return t;const e=s.getCenter();if(Math.abs(e-n)<=i)return t;{const i=new $,s=ot((n-e)/r)*r;i.setShiftCoords(s,0);const o=t.clone();return o.applyTransformation(i),o}}const o=t.getGeometryType(),a=t,m=a.getAttributeStreamRef(0),c=t.clone(),u=c.getAttributeStreamRef(0);let l=0,h=0,g=0,_=j(o)?0:-1;const f=et.constructEmpty();let p=!1;for(let d=0,y=a.getPointCount();d<y;d++){const t=m.read(2*d);d===h&&(j(o)?(0===_&&Number.isNaN(n)&&(p=!0),_>0&&Number.isNaN(n)&&(n=f.getCenter(),p=!1),h=a.getPathEnd(_),_++):h=a.getPointCount(),Number.isNaN(n)?g=t:(g=n,l=0));let e=t-g;Math.abs(e)>i&&(e=ot(e/r)*r,l-=e,Math.abs(l)<.1*r&&(l=0));const s=t+l;u.write(2*d,s),p&&f.mergeCoordinate(s),g=t}return c.notifyModified(),c}const Ni="missing implementation";function Mi(t,e,n,i){const s=e.getCoordinateSystemType();if(0===s){const r=new _m;return e.queryPrecisionDescriptor(r),Ai(t,r,e,n)}let o=t;2!==i&&3!==i||!e.isPannable()||(o=Di(o,e,n));const a=new _m;if(e.queryPrecisionDescriptor(a),o=Ai(o,a,e,n),0===i||o.isEmpty())return o;if(1===s){if(1===i){const t=new r;o.queryLooseEnvelope(t);const i=e.getPannableExtent(),s=.01*i.width();return i.xmin=t.xmin-s,i.xmax=t.xmax+s,(new Xt).execute(o,i,e,n)}return o}if(2===s){const t=e.getPCSHorizon();if(1===i||2===i){const r=(new Rt).execute(o,t,e,n);return r===t?r.clone():r}return o}if(3===s)return o;V(Ni)}function Ai(t,e,n,r){const i=e.getXYGridRange(),s=t.hasAttribute(1),o=t.hasAttribute(2);let a=new et,m=new et;s&&(a=e.getZGridRange()),o&&(m=e.getMGridRange());let c=(new Xt).execute(t,i,n,r);if(s){const e=c.queryInterval(1,0);a.contains(e)||(t===c&&(c=c.clone()),g(c,a,1,0))}if(o){const e=c.queryInterval(2,0);m.contains(e)||(t===c&&(c=c.clone()),g(c,m,2,0))}return c}class qi{constructor(t){this.m_inputPCSHorizonClipOption=0,this.m_outputPCSHorizonClipOption=0,this.m_bDontGeonormalizePolygon=!1,this.m_bClipOutCurvedPoles=!1,this.m_bNormalizeOutputGeometry=!1,this.m_bDontHackPolesInGeogToGeog=!1,this.m_centralMeridianOfOutputGCS=0,this.m_densificationStepInput=0,t||Y(""),this.m_projTransform=t,this.m_bClipOutCurvedPoles=!1;const e=this.m_projTransform.getExtendedParamsImpl();this.m_bNormalizeOutputGeometry=e.normalizeResultGeometry,this.m_bNormalizeOutputGeometry&&(e.legacyHorizonClipping?this.m_bNormalizeOutputGeometry=!1:this.m_projTransform.getOutputSR().isPannable()||(this.m_bNormalizeOutputGeometry=!1)),e.clipWithInputHorizon?(this.m_inputPCSHorizonClipOption=0,!e.legacyHorizonClipping&&this.m_projTransform.getInputSR().isPannable()&&(this.m_inputPCSHorizonClipOption=this.m_bNormalizeOutputGeometry?4:2)):this.m_inputPCSHorizonClipOption=1,e.clipWithOutputHorizon?(this.m_outputPCSHorizonClipOption=0,!e.legacyHorizonClipping&&this.m_projTransform.getOutputSR().isPannable()&&(this.m_outputPCSHorizonClipOption=this.m_bNormalizeOutputGeometry?4:2)):this.m_outputPCSHorizonClipOption=1,this.m_centralMeridianOfOutputGCS=e.centralMeridianOfOutputGCS,this.m_densificationStepInput=e.densificationStep;const n=this.m_projTransform.getExtendedParamsInternal();this.m_bDontGeonormalizePolygon=n.hasFlag(2147483648),this.m_bDontHackPolesInGeogToGeog=n.hasFlag(1073741824),this.m_bClipOutCurvedPoles=n.hasFlag(536870912)}project(t,e){if(this.m_projTransform.isIdentity()||t.isEmpty())return t;const n=t.getGeometryType();if(n===L.enumPoint)return this.projectPoint(t,e);const r=this.m_projTransform.getInputSR().getCoordinateSystemType(),i=this.m_projTransform.getOutputSR().getCoordinateSystemType(),s=this.m_projTransform.getInputSR(),o=this.m_projTransform.getOutputSR();if(0===r&&r===i){const e=Xi(s,o),n=t.clone();return n.applyTransformation(e),n}switch(n){case L.enumPolyline:case L.enumPolygon:return this.projectMultiPath(t,e);case L.enumMultiPoint:return this.projectMultiPoint(t,e);case L.enumEnvelope:return this.projectEnvelope(t,e);case L.enumGeometryCollection:return this.projectGeometryCollection(t,e);default:V("")}}projectPoint(t,e){const n=[t.getXY()];let r,i=null;(r=t.hasAttribute(1))&&(i=[t.getZ()]),this.transformInPlaceZ(n,i,1,n,i,null);const s=t.clone();return s.setXY(n[0]),r&&s.setZ(i[0]),s}projectMultiPoint(t,e){let n=new m({copy:t});const r=this.m_projTransform.getInputSR(),i=this.m_projTransform.getOutputSR(),s=r.getCoordinateSystemType(),o=i.getCoordinateSystemType();if(3===s&&X(0),n=po(n,r,this.m_inputPCSHorizonClipOption,e),n.isEmpty())return n;2===s&&To(r,0,n),Fo(this.m_projTransform,n,!1);let a=0;3===o&&X(0);const c=2===o;return c?a=i.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(a=this.m_centralMeridianOfOutputGCS),c&&0!==this.m_outputPCSHorizonClipOption||(n=$s(n,nm(i),a,!1,0,e)),c&&(n=Zs(n,i,this.m_outputPCSHorizonClipOption,e),So(i,n,this.m_bNormalizeOutputGeometry),n.isEmpty()),n}projectMultiPath(t,e){const n=t.getGeometryType();return n===L.enumPolygon?this.projectPolygon(t,e):n===L.enumPolyline?this.projectPolyline(t,e):void V("project_multi_path_")}projectEnvelope(t,e){this.m_projTransform.getInputSR(),this.m_projTransform.getOutputSR();const n=this.m_projTransform.isVertical()&&t.hasAttribute(1);let r=et.constructEmpty();if(n&&(r=t.queryInterval(1,0)),r.width()>0){const n=t.clone();n.setInterval(1,0,r.vmin,r.vmin);const i=this.projectEnvelopeHelper(n,e);n.setInterval(1,0,r.vmax,r.vmax);const s=this.projectEnvelopeHelper(n,e);return i.merge(s),i}return this.projectEnvelopeHelper(t,e)}projectPolygon(t,i){X(t.getGeometryType()===L.enumPolygon),X(!this.m_projTransform.isIdentity()),X(!t.isEmpty());const s=this.m_projTransform.getInputSR(),o=this.m_projTransform.getOutputSR(),a=s.getCoordinateSystemType(),m=o.getCoordinateSystemType(),c=new e({copy:t});3===a&&X(0),3===m&&X(0);const u=2===a,l=2===m,h=u?s.getGCS():s,g=l?o.getGCS():o,_=!l&&!this.m_bDontHackPolesInGeogToGeog;let f=!1,p=po(c,s,this.m_inputPCSHorizonClipOption,i);if(p.isEmpty())return p;let d=this.m_densificationStepInput;const y=!Number.isNaN(d);let P;y&&(p=(new Mt).execute(p,d,0,0,i));let x=l?o.getPCSInfo():null,C=Number.NaN;u&&(C=s.getCentralMeridian());const E=null!==o.getGCSSplitLines();if(this.m_bDontGeonormalizePolygon){const t=p;if(u&&(Yo(s,C,t),y)){const t=s.getUnitsPerMillimeter();d*=s.getGCS().getUnitsPerMillimeter()/t}if(Lo(this.m_projTransform,t,_),y){const t=s.getGCS().getUnitsPerMillimeter();d*=o.getGCS().getUnitsPerMillimeter()/t}P=t}else{let t=new n({vd:p.getDescription()});if(t.addAndExplicitlyOpenAllPaths(p,!1),u){if(Yo(s,C,t),y){const t=s.getUnitsPerMillimeter();d*=s.getGCS().getUnitsPerMillimeter()/t}if(this.m_bClipOutCurvedPoles){const e=s.getPCSInfo(),n=e.getSouthPoleGeometry()===Ym.PE_POLE_LINE_CURVED,o=e.getNorthPoleGeometry()===Ym.PE_POLE_LINE_CURVED;if(n||o){const e=r.constructEmpty();t.queryLooseEnvelope(e),e.inflateCoords(1,1);const s=89.9999*h.getOneDegreeGCSUnit();n&&(e.ymin=-s),o&&(e.ymax=s),t=Nt(t,e,h,0,0,i)}}}if(Lo(this.m_projTransform,t,_),y){const t=nm(s).getUnitsPerMillimeter();d*=nm(o).getUnitsPerMillimeter()/t}let e=Number.NaN;l?(x=o.getPCSInfo(),e=o.getCentralMeridian()):Number.isNaN(this.m_centralMeridianOfOutputGCS)||(e=this.m_centralMeridianOfOutputGCS);let a=Yi(s)|Yi(o),m=10*g.getTolerance(0);this.m_bDontHackPolesInGeogToGeog&&(a=3,m=10*g.getTolerance(0)),P=io(p,s,t,g,e,i,a,m,this.m_bNormalizeOutputGeometry),a=0}if(E&&(X(!o.isPannable()),P=Os(P,o,i)),l){if(!f){const t=g.getPannableExtent().width();if(P.queryInterval(0,0).width()>=t-10*g.getTolerance(0)){const t=x.getNorthPoleLocation(),e=x.getSouthPoleLocation(),n=x.getNorthPoleGeometry(),r=x.getSouthPoleGeometry();let i=0;n===Ym.PE_POLE_POINT&&t!==Ym.PE_POLE_OUTSIDE_BOUNDARY&&(i=1),r===Ym.PE_POLE_POINT&&e!==Ym.PE_POLE_OUTSIDE_BOUNDARY&&(i|=2),f||=0!==i}}P=Zs(P,o,this.m_outputPCSHorizonClipOption,i),y&&(P=(new Mt).execute(P,d,0,0,i)),bo(o,P,this.m_bNormalizeOutputGeometry)}return P.isEmpty()||f&&(P=(new At).execute(P,o,!1,i)),P}projectPolyline(t,e){X(t.getGeometryType()===L.enumPolyline),X(!this.m_projTransform.isIdentity()),X(!t.isEmpty());const r=this.m_projTransform.getInputSR(),i=this.m_projTransform.getOutputSR(),s=r.getCoordinateSystemType(),o=i.getCoordinateSystemType(),a=new n({copy:t});3===s&&X(0),3===o&&X(0);const m=2===s,c=2===o;m&&r.getGCS();const u=c?i.getGCS():i,l=!c&&!this.m_bDontHackPolesInGeogToGeog;let h=po(a,r,this.m_inputPCSHorizonClipOption,e);if(h.isEmpty())return h;let g=Number.NaN;m&&(g=r.getCentralMeridian());const _=null!==i.getGCSSplitLines();let f=this.m_densificationStepInput;const p=!Number.isNaN(f);let d;if(p&&(h=(new Mt).execute(h,f,0,0,e)),this.m_bDontGeonormalizePolygon){if(m&&(Yo(r,g,h),p)){const t=r.getUnitsPerMillimeter();f*=r.getGCS().getUnitsPerMillimeter()/t}if(Lo(this.m_projTransform,h,l),p){const t=r.getGCS().getUnitsPerMillimeter();f*=i.getGCS().getUnitsPerMillimeter()/t}d=h}else{const t=new n({vd:h.getDescription()});if(t.addAndExplicitlyOpenAllPaths(h,!1),m&&(Yo(r,g,t),p)){const t=r.getUnitsPerMillimeter();f*=r.getGCS().getUnitsPerMillimeter()/t}if(Lo(this.m_projTransform,t,l),p){const t=r.getGCS().getUnitsPerMillimeter();f*=i.getGCS().getUnitsPerMillimeter()/t}let s=Number.NaN;c?s=i.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(s=this.m_centralMeridianOfOutputGCS);let o=Yi(r)|Yi(i),a=10*u.getTolerance(0);this.m_bDontHackPolesInGeogToGeog&&(o=3,a=0),d=so(h,r,t,u,s,e,o,a,this.m_bNormalizeOutputGeometry),o=0}return _&&(X(!i.isPannable()),d=Os(d,i,e)),c&&(d=Zs(d,i,this.m_outputPCSHorizonClipOption,e),p&&(d=(new Mt).execute(d,f,0,0,e)),bo(i,d,this.m_bNormalizeOutputGeometry)),d.isEmpty(),d}projectGeometryCollection(t,e){return X(0),{}}projectEnvelopeHelper(t,e){const s=(t.height()+t.width())/400;if(0!==s){const o=(new Mt).execute(t,s,0,0,e),a=this.projectMultiPath(o,e),c=new I({vd:t.getDescription()});if(a.isEmpty()){const s=Math.min(t.height(),t.width()),a=D(this.m_projTransform.getInputSR(),t,!0).total();if(s>100*a){const t=r.constructEmpty(),e=h(this.m_projTransform.getOutputSR(),t,!0).total(),n=this.m_projTransform.getInputSR().getOneMeter()/this.m_projTransform.getOutputSR().getOneMeter();if(s>100*Math.max(a,e*n))return c}const u=new n;u.addAndExplicitlyOpenAllPaths(o,!1);this.projectMultiPath(u,e).queryEnvelope(c);const l=new m({vd:t.getDescription()});l.reserve(4);const g=new i;for(let e=0;e<4;e++)t.queryCornerByVal(e,g),l.add(g);const _=this.projectMultiPoint(l,e),f=new I;return _.queryEnvelope(f),c.merge(f),c}return a.queryEnvelope(c),c}{const n=t.getCenterXY(),r=new i(n),s=this.projectPoint(r,e),o=new I({vd:t.getDescription()});if(s.isEmpty())o.setEmpty();else{t.copyTo(o);const e=s.getXY();o.setCoords(e.x,e.y,e.x,e.y)}return o}}transformInPlace(t,e,n,r){return X(0),0}transformInPlaceZ(t,e,n,r,i,s){if(this.m_projTransform.isIdentity())return t!==r&&it(r,t,n),e!==i&&yt(i,e,0,0,n),n;const o=this.m_projTransform,a=o.getInputSR(),m=o.getOutputSR(),c=a.getCoordinateSystemType(),u=m.getCoordinateSystemType();if(0===c&&c===u){return Xi(a,m).transformPoints2D(t,n,r),o.isVertical()&&X(0),n}3===c&&H("image: transform_in_place_"),3===u&&H("image: transform_in_place_"),yo(t,n,r,a,this.m_inputPCSHorizonClipOption),i!==e&&yt(i,e,0,0,n),2===c&&Xo(a,0,r,n),Ho(this.m_projTransform,r,i,n,!1);let l=0;const h=2===u;if(h?l=m.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(l=this.m_centralMeridianOfOutputGCS),h&&0!==this.m_outputPCSHorizonClipOption||to(r,n,m.getGCS(),l),h){if(!Js(r,n,m,this.m_outputPCSHorizonClipOption))for(let t=0;t<n;++t)r[t].setNAN();xo(m,r,n,!1)}let g=n;for(let _=0;_<n;++_)r[_].isNAN()&&(i&&(i[_]=Number.NaN),g--);return g}}function Yi(t){if(2!==t.getCoordinateSystemType())return 0;let e=0;const n=t.getPCSInfo(),r=n.getNorthPoleLocation(),i=n.getSouthPoleLocation(),s=n.getNorthPoleGeometry(),o=n.getSouthPoleGeometry();return s===Ym.PE_POLE_POINT&&r!==Ym.PE_POLE_OUTSIDE_BOUNDARY&&(e=1),o===Ym.PE_POLE_POINT&&i!==Ym.PE_POLE_OUTSIDE_BOUNDARY&&(e|=2),e}function Xi(t,e){const n=t.getHorzUnitFactor(),r=e.getHorzUnitFactor();let i=1,s=1;const o=20015077/180;1===t.getUnit().getUnitType()&&(i=o),1===e.getUnit().getUnitType()&&(s=o);const a=n/r*(i!==s?i/s:1),m=new $;return m.setScaleCoords(a,a),m}let Ri=class{getOperatorType(){return 10300}supportsCurves(){return!0}accelerateGeometry(t,e,n){return!1}canAccelerateGeometry(t){return!1}executeMany(t,e,n){return!e||e.isIdentity()?t:new Fi(t,e,n)}execute(t,e,n){return e.isIdentity()?t:bi(t,e,n)}transform(t,e,n,r,i=!0){return i?Ti(t,e,n,r,null):vi(t,e,n,r,null)}transform3D(t,e,n,r,i=!0){return X(0),0}foldInto360Range(t,e){return Di(t,e,null)}foldInto360RangeGeodetic(t,e,n){return Ii(t,e,n,null)}normalizeGeometryEx(t,e,n,r,i=0){return Ts(t,e,n,r,i)}normalizeGeometry(t,e,n){return Gi(t,e,n)}clipToSpatialReference(t,e,n,r=0){return Mi(t,e,n,r)}};class Fi extends Ft{constructor(t,e,n){super(),this.m_projTrans=e,this.m_progressTracker=n,this.m_index=-1,t||Y(""),this.m_inputGeoms=t}next(){const t=this.m_inputGeoms.next();return null!=t?(R(t),F(t),this.m_index=this.m_inputGeoms.getGeometryID(),bi(t,this.m_projTrans,this.m_progressTracker)):null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}}function Oi(t,r,i,s,o,a,m=!1){t||Y("Geometry.Geodetic_densify.densify");let c=t.getGeometryType();if(F(t),R(t),t.isEmpty()||O(c))return t;const u=new ji;u.m_sr=r,u.m_gcs=r.getGCS(),u.m_transform=u.m_gcs!==r?r.getSRToGCSTransform():null,u.m_progressTracker=a;const l=Ha();let h,g,_;if(u.m_gcs.querySpheroidData(l),u.m_a=l.majorSemiAxis,u.m_eSquared=l.e2,u.m_rpu=u.m_gcs.getUnit().getUnitToBaseFactor(),u.m_gcsTolerance=u.m_gcs.getTolerance(0),u.m_radTolerance=u.m_gcsTolerance*u.m_rpu,u.m_maxLength=s,u.m_maxDeviation=o,u.m_curveType=i,c===L.enumEnvelope){const n=new e({vd:t.getDescription()});n.addEnvelope(t,!1),h=n,c=L.enumPolygon}else if(U(c)){const e=new n({vd:t.getDescription()});e.addSegment(t,!0),h=e,c=L.enumPolyline}else h=t;if(4!==u.m_curveType){if(g=u.m_transform&&!u.m_transform.isIdentity()?(new Ri).execute(h,u.m_transform,a):mo(h,u.m_gcs),g.isEmpty())return g;g=Li(u.m_rpu,g);let t=u.geodeticDensify(g);m||(t=(new Ri).foldInto360RangeGeodetic(t,u.m_gcs,u.m_curveType)),_=u.m_transform&&!u.m_transform.isIdentity()?(new Ri).execute(t,u.m_transform.getInverse(),a):t}else{let t;if(r.isPannable())t=mo(h,r);else{const e=r.getPCSHorizon();t=(new Rt).execute(h,e,r,a),t===e&&(t=e.clone())}if(g=t,g.isEmpty())return g;_=u.shapePreservingDensify(g)}return _}function Li(t,e){const n=new r;if(e.queryLooseEnvelope(n),n.width()*t<Math.PI)return e;let s=!1;const o=e.querySegmentIterator(),a=new Q,m=new Q;for(;o.nextPath();)for(;o.hasNextSegment();){const e=o.nextSegment();if(a.setCoordsPoint2D(e.getStartXY()),m.setCoordsPoint2D(e.getEndXY()),a.scale(t),m.scale(t),Math.abs(a.x-m.x)>Math.PI){if(!Hi(a,m)){s=!0;break}if(Math.abs(a.x-m.x)>2*Math.PI){s=!0;break}}}if(!s)return e;const c=e.createInstance();c.reserve(e.getPointCount());const u=e.getDescription().getAttributeCount()>1,l=new Q,h=new Q,g=new Q(0,0),_=new Q(0,0),f=new i;for(o.resetToFirstPath();o.nextPath();){let e=Number.NaN,n=0;for(;o.hasNextSegment();){const r=o.nextSegment();a.setCoordsPoint2D(r.getStartXY()),m.setCoordsPoint2D(r.getEndXY()),a.scale(t),m.scale(t),Number.isNaN(e)?(n=ns(a.x,Number.NaN,n),g.setCoordsPoint2D(a)):g.setCoordsPoint2D(_),e=g.x;if(Hi(a,m)){if(m.x-a.x>2*Math.PI)for(;m.x-a.x>2*Math.PI;)m.x-=2*Math.PI;else if(m.x-a.x<2*-Math.PI)for(;m.x-a.x<2*-Math.PI;)m.x+=2*Math.PI;n=ns(m.x,Number.NaN,n),_.setCoordsPoint2D(m)}else l.setCoordsPoint2D(m),ms(l),n=ns(l.x,e,n),_.setCoords(n+l.x,l.y);if(Math.abs(_.x-m.x)<.5&&_.setCoordsPoint2D(m),u){r.queryCoord(0,f),h.setCoordsPoint2D(g),h.scale(1/t),f.setXY(h);o.isFirstSegmentInPath()?c.startPathPoint(f):c.lineToPoint(f),o.isLastSegmentInPath()&&!o.isPathClosed()&&(r.queryCoord(1,f),h.setCoordsPoint2D(_),h.scale(1/t),f.setXY(h),c.lineToPoint(f))}else{o.isFirstSegmentInPath()&&c.insertPath2D(-1,null,0,0,!0);const e=c.getPathCount()-1;h.setCoordsPoint2D(g),h.scale(1/t),c.insertPoint2D(e,-1,h),o.isLastSegmentInPath()&&!o.isPathClosed()&&(h.setCoordsPoint2D(_),h.scale(1/t),c.insertPoint2D(e,-1,h))}}}return c}function Ui(t,e,n,r,i,s,o,a,m,c,u,l){const h=new Q,g=new Q,_=r.compare(i)>0;ts(_,r,i,h,g);const f=Zi(t,e,n,h,g,s,o,a,m,c,null,u,l);return _&&$i(m,c,null,u),f}function Hi(t,e){return!(!vm(t.y,gt)||!vm(e.y,gt))||!(!vm(t.y,-gt)||!vm(e.y,-gt))}function zi(t,e){return!(!vm(t.y,gt)||vm(e.y,gt))||!(!vm(t.y,-gt)||vm(e.y,-gt))}function Vi(t,e){return!(!vm(e.y,gt)||vm(t.y,gt))||!(!vm(e.y,-gt)||vm(t.y,-gt))}class ji{constructor(){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_progressTracker=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_gcsTolerance=0,this.m_radTolerance=0,this.m_maxLength=0,this.m_maxDeviation=0,this.m_curveType=0}geodeticDensify(t){const e=t.createInstance(),n=t.querySegmentIterator(),r=[],i=[],s=new o,a=t.getDescription().getAttributeCount()>1;for(;n.nextPath();){const t=[0];for(;n.hasNextSegment();){const o=n.nextSegment(),m=o.getStartXY(),c=o.getEndXY();m.scale(this.m_rpu),c.scale(this.m_rpu);const u=new Q,l=new Q,h=m.compare(c)>0;ts(h,m,c,u,l),r.length=0,i.length=0,this.m_maxLength>0?Zi(this.m_a,this.m_eSquared,this.m_curveType,u,l,this.m_maxLength,this.m_maxDeviation,this.m_radTolerance,null,null,a?i:null,r,t):Ki(),h&&$i(null,null,a?i:null,r),r[0].setCoordsPoint2D(o.getStartXY()),r.at(-1).setCoordsPoint2D(o.getEndXY());const g=1/this.m_rpu;for(let t=1,e=r.length-1;t<e;t++)r[t].scale(g);if(a){const t=es(h,o,s);Bi(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),o,t,i,r,e)}else ki(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),r,e)}}return e}shapePreservingDensify(t){const e=t.createInstance(),n=t.querySegmentIterator(),r=[],i=[],s=new o,a=t.getDescription().getAttributeCount()>1;for(;n.nextPath();)for(;n.hasNextSegment();){const t=n.nextSegment(),o=t.getStartXY(),m=t.getEndXY(),c=o.compare(m)>0,u=es(c,t,s);r.length=0,i.length=0,Ji(this.m_a,this.m_eSquared,this.m_rpu,u,this.m_sr,this.m_maxLength,this.m_maxDeviation,a?i:null,r),c&&$i(null,null,a?i:null,r),a?Bi(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),t,u,i,r,e):ki(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),r,e)}return e}}function ki(t,e,n,r){t&&r.insertPath2D(-1,null,0,0,!0);const i=r.getPathCount()-1;r.insertPointsFromPoints(i,-1,n,0,n.length-1,!0),e&&r.insertPoint2D(i,-1,n.at(-1))}function Bi(t,e,n,r,s,o,a){a.reserve(a.getPointCount()+o.length-1);const m=new i;if(n.queryStart(m),t?a.startPathPoint(m):a.lineToPoint(m),o.length>2){const t=r.calculateLength2D();for(let e=1;e<o.length-1;e++){const n=r.lengthToT(s[e]*t);r.queryCoord(n,m),m.setXY(o[e]),a.lineToPoint(m)}}e&&(n.queryEnd(m),a.lineToPoint(m))}function Zi(t,e,n,r,i,s,o,a,m,c,u,l,h){const g={stack:[],error:void 0,hasError:!1};try{const _=It(g,new Gm,!1),f=It(g,new Gm,!1),p=It(g,new Gm,!1);Fm.geodeticDistance(t,e,r.x,r.y,i.x,i.y,p,_,f,n);const d=p.val,y=_.val,P=f.val;let x=y,C=P;x<0&&(x+=2*Math.PI),C<0&&(C+=2*Math.PI),m&&(m[0]=x),c&&(c[0]=C);let E=Number.NaN,S=Number.NaN;if(null!==u){const n=Om.q90(t,e),i=Om.q(t,e,r.y);E=(n-i)/d,S=(n+i)/d}const w=zi(r,i),b=Vi(r,i),T=w||b,v=os(r,i,a),I=It(g,new lt(new Gm,new Gm),!1),D=new Q,G=new Q,N=new Q;h[0]=ns(r.x,Number.NaN,h[0]);let M=h[0];if(d<=s)return l.push(r.clone()),h[0]=ns(i.x,Number.NaN,h[0]),null!=u&&u.push(0),T?(w&&rs(r,i,u,l),b&&is(r,i,u,l)):v?ss(r,i,y,E,S,u,l):o>0&&(G.setCoords(r.x-M,r.y),D.setCoords(i.x-h[0],i.y),M=Wi()),l.push(i.clone()),d;const A=1+Math.ceil(d/s),q=d/(A-1),Y=new Q;l.push(r.clone()),Y.setCoordsPoint2D(r),G.setCoords(r.x-h[0],r.y),null!==u&&u.push(0);for(let s=1;s<A;s++){let m;if(s<A-1){const i=s*q;Fm.geodeticCoordinate(t,e,r.x,r.y,i,y,I.at(0),I.at(1),n),D.setCoords(I.at(0).val,I.at(1).val),h[0]=ns(D.x,Y.x,h[0]),N.setCoords(h[0]+D.x,D.y),m=s/(A-1)}else h[0]=ns(i.x,Number.NaN,h[0]),D.setCoords(i.x-h[0],i.y),N.setCoordsPoint2D(i),m=1;T?(1===s&&w&&rs(r,N,u,l),s===A-1&&b&&is(Y,i,u,l)):v?as(Y,N,a)&&(r.x<i.x?Y.x>N.x&&(h[0]+=2*Math.PI,N.setCoords(h[0]+D.x,D.y)):Y.x<N.x&&(h[0]-=2*Math.PI,N.setCoords(h[0]+D.x,D.y)),ss(Y,N,y,E,S,u,l)):o>0&&Wi(),l.push(N.clone()),null!=u&&u.push(m),Y.setCoordsPoint2D(N),G.setCoordsPoint2D(D),M=h[0]}return d}catch(_){g.error=_,g.hasError=!0}finally{Dt(g)}}function Ki(t,e,n,r,i,s,o,a,m,c){X(0)}function Wi(t,e,n,r,i,s,o,a,m,c,u,l,h,g,_){return X(0),0}function Qi(e,n,r,i){const s=ue(e,n,r),o=ue(e,n,i);return t.distance(s,o)}function Ji(t,e,n,r,i,s,o,a,m){const c=r.isCurve(),u=Ie(t,e)*Math.PI*179/180;let l=s;s>0&&!(s>u)||(l=u),l=Ye(t,e,l);let h=o;!c||h>0||(h=.001);const g=h>0;let _=Number.NaN;g&&(_=Ye(t,e,h));const f=i.getPECoordSys(),p=1===i.getCoordinateSystemType(),d=i.getTolerance(0),y=r.getStartXY(),P=r.getEndXY(),x=new Q,C=new Q;if(p)x.setCoordsPoint2D(y),x.scale(n),C.setCoordsPoint2D(P),C.scale(n);else{const t=[y.x,y.y,P.x,P.y];Am.projToGeog(f,2,t),x.setCoords(t[0],t[1]),x.scale(n),C.setCoords(t[2],t[3]),C.scale(n)}let E=0,S=0;const w=[],b=[],T=[];w.push(P.clone()),b.push(C.clone()),T.push(1),m.push(y.clone()),null!==a&&a.push(S);const v=i.isPannable(),I=y.clone(),D=[.5,.33333333333333337,.6666666666666666,.16666666666666669,.8333333333333333];let G=5;for(c||(g?(D[0]=.5,D[1]=.25,D[2]=.75,G=3):G=1);b.length>0;){const s=w.at(-1).clone();C.assign(b.at(-1));const o=T.at(-1);let u=!1,h=Number.NaN;const y=Qi(t,e,x,C);let P=l>=y&&Math.abs(x.y-C.y)<.9*Math.PI;p&&P&&(P=Math.abs(x.x-C.x)<.9*Math.PI);const N=new Q,M=new Q;let A=!1;if(c||g||!P||P&&(A=!0),r.calculateSubLength(S,o)<=d&&(A=!0),!A)for(let a=0;a<G;a++){const s=ht(S,o,D[a]),m=new Q;r.queryCoord2D(s,m);const c=new Q;if(p)c.setCoords(m.x*n,m.y*n);else{const t=[m.x,m.y];Am.projToGeog(f,1,t),c.setCoords(t[0]*n,t[1]*n)}if(0===a&&(h=s,N.setCoordsPoint2D(m),M.setCoordsPoint2D(c),!P)){u=!0;break}if(p&&Math.abs(x.x-c.x)>=Math.PI){u=!0;break}if(l<Qi(t,e,x,c)){u=!0;break}if(g){const s=de(t,e,x,C,D[a]),m=s.clone();if(p?(m.x/=n,m.y/=n):(m.x/=n,m.y/=n,vi(i.getGCSToSRTransform(),[m],1,[m],null)),m.isNAN()){const n=ue(t,e,c),r=ue(t,e,x),i=ue(t,e,C),{first:s,second:o}=Ee(t,e,n,r,i,2,null);if(o>_){u=!0;break}}else{if(v){const t=i.getPannableExtent().width(),e=ht(r.getStartX(),r.getEndX(),.5);for(;m.x<e-.5*t;)m.x+=t;for(;m.x>=e+.5*t;)m.x-=t}const a=r.getClosestCoordinateOnInterval(m,new et(S,o),-1),c=r.getCoord2D(a);if(!p){const t=[c.x,c.y];Am.projToGeog(f,1,t),c.x=t[0],c.y=t[1]}c.x*=n,c.y*=n;let l=Qi(t,e,c,s);if(l>_){if(l<4*_){const n=ue(t,e,c),r=ue(t,e,x),i=ue(t,e,C),{first:s,second:o}=Ee(t,e,n,r,i,2,null);l=o}if(l>_){u=!0;break}}}}}u?(w.push(N.clone()),b.push(M.clone()),T.push(h)):(w.pop(),b.pop(),T.pop(),m.push(s.clone()),E+=y,null!==a&&a.push(E),I.setCoordsPoint2D(s),x.setCoordsPoint2D(C),S=o)}if(null!==a){const t=1/E;for(let e=0;e<a.length;e++)a[e]*=t}}function $i(t,e,n,r){if(r.reverse(),null!==n&&n.reverse(),t){const n=t[0],r=e[0];t[0]=r,e[0]=n}}function ts(t,e,n,r,i){t?(r.setCoordsPoint2D(n),i.setCoordsPoint2D(e)):(r.setCoordsPoint2D(e),i.setCoordsPoint2D(n))}function es(t,e,n){return t?(n.create(e.getGeometryType()),e.copyTo(n.get()),n.get().reverse(),n.get()):e}function ns(t,e,n){if(Number.isNaN(e)){for(;n-t>Math.PI;)n-=2*Math.PI;for(;t-n>Math.PI;)n+=2*Math.PI;return n}return n+t-e>Math.PI?n-=2*Math.PI:e-(n+t)>Math.PI&&(n+=2*Math.PI),n}function rs(t,e,n,r){if(t.y>0){const i=new Q;i.setCoords(e.x,gt),vm(t.x,i.x)||vm(e.y,i.y)||(r.push(i),null!==n&&n.push(0))}else{const i=new Q;i.setCoords(e.x,-gt),vm(t.x,i.x)||vm(e.y,i.y)||(r.push(i),null!==n&&n.push(0))}}function is(t,e,n,r){if(e.y>0){const i=new Q;i.setCoords(t.x,gt),vm(e.x,i.x)||vm(t.y,i.y)||(r.push(i),null!==n&&n.push(1))}else{const i=new Q;i.setCoords(t.x,-gt),vm(e.x,i.x)||vm(t.y,i.y)||(r.push(i),null!==n&&n.push(1))}}function ss(t,e,n,r,i,s,o){if(Dm(n)){if(gt-t.y>0){const e=new Q;e.setCoords(t.x,gt),o.push(e),null!==s&&s.push(r)}if(gt-e.y>0){const t=new Q;t.setCoords(e.x,gt),o.push(t),null!==s&&s.push(r)}}else{if(gt+t.y>0){const e=new Q;e.setCoords(t.x,-gt),o.push(e),null!==s&&s.push(i)}if(gt+e.y>0){const t=new Q;t.setCoords(e.x,-gt),o.push(t),null!==s&&s.push(i)}}}function os(t,e,n){return!(!as(t,e,n)||vm(t.y,gt)||vm(t.y,-gt)||vm(e.y,gt)||vm(e.y,-gt))}function as(t,e,n){return Math.abs(Math.abs(t.x-e.x)-Math.PI)<=n}function ms(t){if(t.x<-Math.PI)for(;t.x<-Math.PI;)t.x+=2*Math.PI;else if(t.x>Math.PI)for(;t.x>Math.PI;)t.x-=2*Math.PI}function cs(t,e,n,r){const i={stack:[],error:void 0,hasError:!1};try{const s=[n.x],o=[n.y-r],a=[n.x],m=[n.y+r];ve(s,o),ve(a,m);const c=It(i,new Gm,!1),u=It(i,new Gm,!1);Fm.greatEllipticDistance(t,e,n.x,n.y,s[0],o[0],c,null,null),Fm.greatEllipticDistance(t,e,n.x,n.y,a[0],m[0],u,null,null);return Math.min(c.val,u.val)}catch(s){i.error=s,i.hasError=!0}finally{Dt(i)}}function us(t,e,n,i,s){const o=new r;n.queryEnvelope(o);const a=D(null,n,!0).total();if(e.xmin-o.xmin<=a&&o.xmax-e.xmax<=a)return n;const m=e.width();let c=0;for(;e.xmin+c*m<o.xmin;)c++;for(;e.xmin+c*m>o.xmin;)c--;const u=c*m,l=new $;l.setShiftCoords(-u,0);const g=n;g.applyTransformation(l);const _=new r;g.queryEnvelope(_);let f=null;if(_.xmax>e.xmax){let n=0;const i=new r;i.setCoords({env2D:e}),i.ymin-=1,i.ymax+=1;let o=g;for(;i.xmin<_.xmax;){_.xmax>i.xmax&&(o=oo(o,t,2,!0,i.xmax));const r=G(o,i),a=h(null,r,!0).total(),c=Gt(o,i,a,Number.NaN,s);null===f?f=c===o?c.clone():c:(l.setShiftCoords(-n*m,0),c.applyTransformation(l),f.add(c,!1)),n++,i.xmin=i.xmax,i.xmax=e.xmax+n*m}}else f=g;return f}class ls{constructor(e,n){this.m_basisX=new t,this.m_basisY=new t,this.m_normal=new t,X(1===e.getCoordinateSystemType()),this.m_gcs=e;const r=Ha();e.querySpheroidData(r),this.m_a=r.majorSemiAxis,this.m_e2=r.e2,this.m_rpu=e.getUnit().getUnitToBaseFactor(),this.m_curvCenterRad=n.mul(this.m_rpu);const i=this.m_curvCenterRad.x,s=this.m_curvCenterRad.y,o=Math.cos(i),a=Math.sin(i),m=Math.cos(s),c=Math.sin(s);this.m_cartCenter3D=he(this.m_a,this.m_e2,o,a,m,c),this.m_normal.setCoordsPoint3D(this.m_cartCenter3D),this.m_d=this.m_cartCenter3D.length(),this.m_normal.divThis(this.m_d),t.selectRightHandedBasisFromNormal(this.m_normal,this.m_basisX,this.m_basisY),this.m_northPolePcs=this.projectPoint(Q.construct(0,.5*Math.PI/this.m_rpu)),this.m_southPolePcs=this.projectPoint(Q.construct(0,.5*-Math.PI/this.m_rpu))}project(t){const e=t.getGeometryType();if(z(e)){R(t);const e=t;return this.projectMultiVertex(e)}Y("Gnomonic.project")}unproject(t,e,n){const r=t.getGeometryType();if(z(r)){R(t);let i=t;const s=[];if(r===L.enumPolygon){const t=i.getPathCount();for(let e=0;e<t;e++){const t=i.calculateRingArea2D(e);s.push(t)}}return this.unprojectMultiVertex(e,i),j(r)?(xs(this.m_gcs,0,i),hs(s,this.m_gcs,0,i,n)):i=$s(i,this.m_gcs,0,!0,0,n),i}Y("Gnomonic.unproject")}projectPoint(t){const e=t.mul(this.m_rpu),n=ue(this.m_a,this.m_e2,e),r=this.m_normal.dotProduct(n);if(r<=0)return Q.construct(Number.NaN,Number.NaN);const i=this.m_d/r,s=n.mul(i).sub(this.m_cartCenter3D),o=new Q;return o.x=this.m_basisX.dotProduct(s),o.y=this.m_basisY.dotProduct(s),o}unprojectPoint(t){const e=this.m_cartCenter3D.add(this.m_basisX.mul(t.x).add(this.m_basisY.mul(t.y)));return fe(this.m_a,this.m_e2,e).divide(this.m_rpu)}projectMultiVertex(t){const e=t.getImpl();let n=!0;const r=new Q,i=new Q;for(let s=0,o=e.getPointCount();s<o;s++)e.queryXY(s,r),r.y*this.m_rpu>.5*Math.PI?i.assign(this.m_northPolePcs):r.y*this.m_rpu<.5*-Math.PI?i.assign(this.m_southPolePcs):i.assign(this.projectPoint(r)),e.setXY(s,i),i.isNAN()&&(n=!1);return e.notifyModifiedFlags(2001),n}unprojectMultiVertex(t,e){const n=e.getImpl(),r=t*t,i=!this.m_northPolePcs.isNAN(),s=!this.m_southPolePcs.isNAN();for(let o=0,a=n.getPointCount();o<a;o++){const t=n.getXY(o);let e=new Q;i&&Q.sqrDistance(t,this.m_northPolePcs)<=r?(e.setCoords(this.m_curvCenterRad.x,.5*Math.PI),e.scale(1/this.m_rpu)):s&&Q.sqrDistance(t,this.m_southPolePcs)<=r?(e.setCoords(this.m_curvCenterRad.x,.5*-Math.PI),e.scale(1/this.m_rpu)):e=this.unprojectPoint(t),n.setXY(o,e)}n.notifyModifiedFlags(2001)}}function hs(t,e,n,i,s){const o=i.getGeometryType(),a=e.getPannableExtent();let m=i,c=!1,u=!1;if(o===L.enumPolygon){const i=new r,o=Q.construct(n,0);i.setCoords({env2D:a}),i.centerAt(o),c=gs(t,e,i,m,s);const l=Ps(e,i,m,s);l!==m&&(u=!0),m=l}else m=(new Ri).foldInto360RangeGeodetic(m,e,2);o===L.enumPolygon&&(c||u)&&(m=(new At).execute(m,e,!1,s)),m!==i&&(i.setEmpty(),i.add(m,!1))}function gs(t,e,n,r,i){const s=_s(n,r),o=fs(t,e,n,r,i);return s||o}function _s(t,e){const n=new r;e.queryEnvelope(n);const i=vm(t.ymax,n.ymax),s=vm(t.ymin,n.ymin),o=i||s;return!!o&&(ps(t,e),o)}function fs(t,n,r,i,s){const o=[],a=[],m=.5*r.width();for(let e=0;e<i.getPathCount();e++){const c=i.getXY(i.getPathStart(e)),u=i.getXY(i.getPathEnd(e)-1),l=t[e]<0;if(Math.abs(c.x-u.x)>m){const t=ds(l,n,r,e,i,s);o.push(t),a.push(e)}else if(!l){if(i.calculateRingArea2D(e)<0){const t=ys(n,r,e,i,s);o.push(t),a.push(e)}}}if(0===o.length)return!1;const c=new e({vd:i.getDescription()});let u=0,l=a[u];for(let e=0;e<i.getPathCount();e++)e===l?(c.add(o[u],!1),u++,u<a.length&&(l=a[u])):c.addPath(i,e,!0);return i.setEmpty(),i.add(c,!1),!0}function ps(t,n){const i=new e,s=new r;for(let e=0;e<n.getPathCount();e++){n.queryPathEnvelope(e,s);let r=vm(t.ymax,s.ymax),o=vm(t.ymin,s.ymin);if(!(r||o)){i.addPath(n,e,!0);continue}i.insertPath2D(-1,null,0,0,!0);const a=n.getPathStart(e),m=n.getPathEnd(e),c=m-a;let u=-1;for(u=a;u<m;u++){const e=n.getXY(u);if(r=vm(t.ymax,e.y),o=vm(t.ymin,e.y),!r&&!o)break}let l=u,h=!1,g=Number.NaN;do{const s=n.getXY(l);r=vm(t.ymax,s.y),o=vm(t.ymin,s.y);const m=a+(l+1-a)%c;if(r||o){let r=Q.construct(g,s.y);i.insertPoint2D(e,-1,r);const o=n.getXY(m),a=vm(t.ymax,o.y),c=vm(t.ymin,o.y);a||c||(r=Q.construct(o.x,s.y),h?i.setXY(i.getPointCount()-1,r):i.insertPoint2D(e,-1,r)),h=!0}else i.insertPoint2D(e,-1,s),g=s.x,h=!1;l=m}while(l!==u)}n.setEmpty(),n.add(i,!1)}function ds(t,n,s,o,a,m){const c=new e,u=new e,l=new $,g=a.getXY(a.getPathStart(o)),f=a.getXY(a.getPathEnd(o)-1),p=s.width(),d=.5*p,y=new r;a.queryEnvelope(y);const P=Math.ceil(y.width()/p)+1;let x,C;g.x>f.x?(x=-p,C=t?s.ymin:s.ymax):(x=p,C=t?s.ymax:s.ymin),l.setShiftCoords(x,0),c.addPath(a,o,!0),u.add(c,!1);const E=new i;for(let e=0;e<P;e++)u.applyTransformation(l),u.getPointByVal(0,E),c.lineToPoint(E),c.addSegmentsFromPath(u,0,0,u.getSegmentCount()-1,!1);const S=c.getXY(0),w=c.getXY(c.getPointCount()-1);S.y=C,w.y=C,c.lineTo(w);const b=new Q;for(b.setCoordsPoint2D(w),b.x-=.5*x;Math.abs(b.x-S.x)>d;)c.lineTo(b),b.x-=.5*x;c.lineTo(S);const T=s.getCenter().x,v=new r;c.queryEnvelope(v);let I=0;const D=v.getCenter().x;D-T>d?I=-Math.ceil((D-T-d)/p):T-D>d&&(I=Math.ceil((T-D-d)/p)),0!==I&&(l.setShiftCoords(I*p,0),c.applyTransformation(l));const N=new _,M=N.addGeometry(c);ao(N,M,n,0,2,!0,s.xmin),ao(N,M,n,0,2,!0,s.xmax);const A=N.getGeometry(M),q=G(A,s);q.inflateCoords(0,1);const Y=h(null,q,!0);return Gt(A,s,Y.total(),Number.NaN,m)}function ys(t,e,n,i,s){const o=e.width(),a=.5*o,m=e.getCenter().x,c=new r;i.queryPathEnvelope(n,c);let u,l=0,g=c.getCenter().x;if(g-m>a?l=-Math.ceil((g-m-a)/o):m-g>a&&(l=Math.ceil((m-g-a)/o)),0!==l){const t=new $;t.setShiftCoords(l*o,0),i.getImpl().applyTransformationToPath(t,n),i.queryPathEnvelope(n,c),g=c.getCenter().x}const f=new r;e.containsExclusiveEnvelope(c)?(u=!1,f.setCoords({env2D:e})):(u=!0,f.setCoords({env2D:e}),f.xmin-=o,f.xmax+=o);let p=i.createInstance();p.addPathPoint2D(null,0,!0);const d=new Q;if(d.setCoords(f.xmin,f.ymin),p.insertPoint2D(0,-1,d),d.setCoords(f.xmin,f.ymax),p.insertPoint2D(0,-1,d),d.setCoords(.5*(f.xmin+f.xmax),f.ymax),p.insertPoint2D(0,-1,d),d.setCoords(f.xmax,f.ymax),p.insertPoint2D(0,-1,d),d.setCoords(f.xmax,f.ymin),p.insertPoint2D(0,-1,d),d.setCoords(.5*(f.xmin+f.xmax),f.ymin),p.insertPoint2D(0,-1,d),u){p.addPath(i,n,!0);const r=new $;g<m?r.setShiftCoords(o,0):r.setShiftCoords(-o,0),i.getImpl().applyTransformationToPath(r,n),p.addPath(i,n,!0);const a=new _,c=a.addGeometry(p);ao(a,c,t,0,2,!0,e.xmin),ao(a,c,t,0,2,!0,e.xmax),p=a.getGeometry(c);const u=G(p,e);u.inflateCoords(0,1);const l=h(null,u,!0).total();p=Gt(p,e,l,Number.NaN,s)}else p.addPath(i,n,!0);return p}function Ps(t,e,n,i){const s=new r;n.queryEnvelope(s);const o=D(null,n,!0).total();if(e.xmin-s.xmin<=o&&s.xmax-e.xmax<=o)return n;const a=n.createInstance();let m=n.createInstance();const c=new r,u=n.getPathCount();for(let r=0;r<u;r++)n.queryPathEnvelope(r,c),e.xmin-c.xmin<=o&&c.xmax-e.xmax<=o?a.addPath(n,r,!0):(m.setEmpty(),m.addPath(n,r,!0),m=us(t,e,m,!0,i),a.add(m,!0));return a}function xs(t,e,n){const r=t.getPannableExtent(),i=Q.construct(e,0);r.centerAt(i);const s=r.width(),o=.5*s,a=new Q;a.setNAN();let m=Number.NaN;for(let c=0;c<n.getPathCount();c++)for(let t=n.getPathStart(c);t<n.getPathEnd(c);t++){const e=n.getXY(t),i=vm(e.y,r.ymax)||vm(r.ymin,e.y);t===n.getPathStart(c)?(a.setNAN(),m=0):a.isNAN()||i||(m=Cs(e.x,a.x,o,s,m)),e.x+=m,n.setXY(t,e),i||a.setCoordsPoint2D(e)}n.getImpl().notifyModifiedFlags(2001)}function Cs(t,e,n,r,i){return i+t-e>n?i-=r:e-(i+t)>n&&(i+=r),i}function Es(t,e,n,r,s,o){const a=e.getAttributeStreamRef(0),m=e.getPointCount();let c=!1;const u=new Q;for(let i=0;i<m;++i){if(a.queryPoint2D(2*i,u),1&o&&u.y>=n){c=!0;break}if(2&o&&u.y<=-n){c=!0;break}}if(!c)return!1;let l=!1;t&&(l=e.getImpl().isClosedPathInXYPlane(0));const h=new _,g=h.addGeometry(e),p=h.getFirstPath(g);let d=-1,y=!0;const P=new Q,x=new i;let C=f;const E=vs*s/360;for(let i=h.getFirstVertex(p);i!==f;i=h.getNextVertex(i)){h.queryXY(i,u);let t=1&o&&u.y>=n?1:0;if(t|=2&o&&u.y<=-n?2:0,d>0&&d!==t){if(P.x!==u.x){const t=h.getPrevVertex(i);h.queryPoint(t,x);const e=h.insertVertex(p,i,x);P.x=u.x,h.setXY(e,P)}if(l){let t=C!==f?h.getNextVertex(C):h.getFirstVertex(p);const e=h.getPrevVertex(i);for(;t!==e;)t=h.removeVertex(t,!1);if(C!==f){const t=h.getXY(C),n=h.getXY(e);if(Math.abs(t.x-n.x)>E){h.queryPoint(C,x);const r=h.insertVertex(p,e,x);t.x=ht(t.x,n.x,.5),h.setXY(r,t)}}}C=f}if(t&&(u.y=tt(r,u.y),h.setXY(i,u),!y&&d!==t))if(u.x!==P.x){h.queryPoint(i,x);const t=h.insertVertex(p,i,x);h.setXYCoords(t,P.x,u.y),C=t}else C=i;d=t,P.assign(u),y=!1}if(l){if(C!==f){let t=h.getNextVertex(C);for(;t!==f;)t=h.removeVertex(t,!1)}const t=h.getFirstVertex(p);let e=h.getLastVertex(p);const n=h.getXY(t),r=h.getXY(e);if(!n.equals(r)&&(h.queryPoint(t,x),e=h.insertVertex(p,f,x),Math.abs(n.x-r.x)>E)){const t=h.insertVertex(p,e,x);n.x=ht(n.x,r.x,.5),h.setXY(t,n)}}return e.assignCopy(h.getGeometry(g)),!0}function Ss(t,n){let r=new e({vd:t});r.addEnvelope(n,!1);const i=n.width()/180;return r=(new Mt).execute(r,i,0,0,null),r}function ws(t,e){const n=t.getPannableExtent();return Number.isNaN(e)||n.centerAtCoords(e,0),n}function bs(e,n,r){const i=Ha();n.querySpheroidData(i);const s=n.getGCS()!==n?n.getSRToGCSTransform():null,o=_t(Q,100),a=new t(0,0,0),m=e.getPointCount(),c=n.getGCS().getUnit().getUnitToBaseFactor();for(let t=0,g=m;t<g;){const n=Math.min(100,g-t);e.queryCoordinates(o,n,t,t+n),s&&(new Ri).transform(s,o,n,o,!1);for(let t=0;t<n;t++){if(o[t].isNAN())continue;o[t].scale(c);const e=ue(i.majorSemiAxis,i.e2,o[t]);a.addThis(e)}t+=n}const u=fe(i.majorSemiAxis,i.e2,a);u.scale(1/c);const l=e;if(!new ls(n.getGCS(),u).project(l))return 0;r.length=e.getPathCount();const h=l.calculateArea2D()<0;for(let t=0,g=e.getPathCount();t<g;t++){const e=l.calculateRingArea2D(t),n=h?e<0:e>0;r[t]=n}return h?-1:1}function Ts(t,r,i,s,o){if(!r.isPannable()||t.isEmpty())return t;const a=t.getGeometryType();a===L.enumGeometryCollection&&H("not yet impl for geometry collection");const m=r.getPannableExtent();Number.isNaN(i)&&(i=m.getCenterX());const c=m.width(),u=.5*c,l=o>0,h=t.queryInterval(0,0);if(!l&&h.width()<u||!z(t.getGeometryType())){const e=h.getCenter();if(Math.abs(e-i)<=u)return t;{const n=new $,r=ot((i-e)/c)*c;n.setShiftCoords(r,0);const s=t.clone();return s.applyTransformation(n),s}}if(a===L.enumPolygon){let a=new n({vd:t.getDescription()});a.addAndExplicitlyOpenAllPaths(t,!1),l&&(a=Oi(a,r,2,o,Number.NaN,null,!0));const m=[];if(!s){{let n=t;l&&(n=new e,n.add(a,!1));const i=bs(t,r,m);if(i)i<0&&a.reverseAllPaths();else{const t=n.getPathCount();for(let e=0;e<t;e++)m.push(n.calculateRingArea2D(e)>0)}}s=m}return new Is(null,s,a,null,r,i,3,0,null).geoNormalizePolygonGeometry(!0)}if(a===L.enumPolyline){let e=new n({vd:t.getDescription()});e.addAndExplicitlyOpenAllPaths(t,!1),l&&(e=Oi(e,r,2,o,Number.NaN,null,!0));return new Is(null,null,e,null,r,i,3,0,null).geoNormalizePolylineGeometry(!0)}if(a===L.enumMultiPoint){const e=t,n=e.getAttributeStreamRef(0);let r,s=null,o=i,a=0;const m=.1*c;for(let i=0,l=e.getPointCount();i<l;i++){const e=n.read(2*i);let l=e-o;if(Math.abs(l)>u&&(l=ot(l/c)*c,a-=l,Math.abs(a)<m&&(a=0)),0!==a){s||(r=t.clone(),s=r.getAttributeStreamRef(0));const n=e+a;s.write(2*i,n)}o=e}return s?(r.notifyModified(),r):t}V("")}const vs=210;class Is{constructor(t,e,n,r,i,s,o,a,m){this.m_bAdjustedAtPoles=0,this.m_inputPoly=n,this.m_progressTracker=m,this.m_originalGeometry=t,this.m_originalSR=r,this.m_polygonRingFlags=e,this.m_pannableSR=i,this.m_poleSnappingTolerance=a,this.m_poleFlags=o,this.m_bAdjustedAtPoles=0,this.m_pannableExtent=ws(this.m_pannableSR,s),this.m_centralLongitude=Number.isNaN(s)?this.m_pannableExtent.getCenterX():s,this.m_width360=this.m_pannableExtent.width(),this.m_degree=this.m_width360/360,this.m_GCSLargeDelta=vs*this.m_degree,X(null===this.m_originalGeometry&&null===this.m_originalSR||null!==this.m_originalGeometry&&null!==this.m_originalSR)}geonormalizeRing(t,e,r,i,o,a,m){let c=r;const u=new n({vd:this.m_inputPoly.getDescription()});u.addPath(this.m_inputPoly,t,!0),0!==this.m_poleFlags&&(this.m_bAdjustedAtPoles|=Es(!0,u,this.m_pannableExtent.ymax-this.m_poleSnappingTolerance,this.m_pannableExtent.ymax,this.m_pannableExtent.width(),this.m_poleFlags)?1:0,this.m_bAdjustedAtPoles&&(c=!1));let l=-1;c&&(l=this.m_originalGeometry.getPathStart(t));const h=u.getAttributeStreamRef(0),g=u.getPointCount();let _=0,f=h.read(0),p=0;const d=3*this.m_pannableSR.getTolerance(0);let y=!1;const P=new Q,x=new Q;let C=!1;const E=u.hasNonLinearSegments(),S=new Q;for(let n=1;n<g;++n){h.queryPoint2D(2*n,S);const t=S.x;let e=t+_;const r=e-f;if(S.x=e,Math.abs(r)>this.m_GCSLargeDelta){if(c){const t=l+n-1,e=l+(n+1<g?n:0),s=a.read(2*t),o=(a.read(2*e)-s)*i;Math.abs(r-o)>1*this.m_degree&&(c=!1)}if(!c){_-=tt(this.m_width360,e-f),e=t+_,++p,C=0!==_,S.x=e}}else y||s(P,x,S,d)&&(y=!0);C&&(E&&V("error in geonormalize_ring_ for curves"),h.write(2*n,e)),f=e,P.setCoordsPoint2D(x),x.setCoordsPoint2D(S)}p&&u.notifyModified();const w=u.getXY(0),b=u.getXY(g-1);if(Q.distance(w,b)<d){const t=this.finalizeGeoNormalizeClosedRing(u,y,o);m.add(t,!1)}else{if(e<0)if(null!==this.m_originalGeometry){X(null!==this.m_originalGeometry);e=this.m_originalGeometry.calculateRingArea2D(t)>0?1:0}else e=1;const n=this.finalizeGeoNormalizeOpenedRing(e>0,u);m.add(n,!1)}}geoNormalizePolygonGeometry(t){X(this.m_originalSR&&this.m_originalGeometry||!this.m_originalGeometry&&!this.m_originalSR),X(this.m_pannableSR.isPannable());let n=null,i=Number.NaN;const s=!!this.m_originalSR&&this.m_originalSR.isPannable();s&&(n=this.m_originalGeometry.getAttributeStreamRef(0),i=this.m_width360/this.m_originalSR.getPannableExtent().width()),this.m_bAdjustedAtPoles=0;const o=new e({vd:this.m_inputPoly.getDescription()});for(let e=0,r=this.m_inputPoly.getPathCount();e<r;++e){const r=this.m_polygonRingFlags?this.m_polygonRingFlags[e]?1:0:-1;this.geonormalizeRing(e,r,s,i,t,n,o)}const a=this.m_pannableSR.getTolerance(0),m=this.m_pannableExtent.width()/180;go(o,this.m_pannableExtent,.1*a,!1);const c=r.constructEmpty();if(c.setCoords({env2D:this.m_pannableExtent}),t){let t=!0;for(let e=0;e<2;e++){t=!0;const e=r.constructEmpty();for(let n=0,r=o.getPathCount();n<r;n++)if(o.queryPathEnvelope(n,e),!(c.xmin<=e.xmin&&c.xmax>=e.xmax||e.xmin>=c.xmax||e.xmax<=c.xmin)){t=!1;break}if(t)break;c.move(.5*this.m_width360,0)}t||c.setCoords({env2D:this.m_pannableExtent})}let u=Gt(o,c,a,m,this.m_progressTracker),l=o!==u;const h=this.m_originalGeometry?this.m_originalGeometry.calculateArea2D():1,g=u.calculateArea2D();let _=0;if(g>0&&h<0)_=1;else if(g<=0&&h>0)if(0===g){if(this.m_originalSR){let t=Number.NaN;2===this.m_originalSR.getCoordinateSystemType()?t=this.m_originalSR.getPCSHorizon().calculateArea2D():1===this.m_originalSR.getCoordinateSystemType()&&(t=this.m_originalSR.getPannableExtent().getArea()),h>.99*t&&(_=-1)}}else _=-1;if(0!==_){const t=Ss(u.getDescription(),c);t.add(u,!1),l=!0,u=t}return l&&(u=(new At).execute(u,this.m_pannableSR,!1,this.m_progressTracker)),u}geoNormalizePolylineGeometry(t){X(this.m_pannableSR.isPannable());let e=null;const i=this.m_originalSR&&this.m_originalSR.isPannable();let s=1;i&&(X(this.m_originalGeometry),s=this.m_width360/this.m_originalSR.getPannableExtent().width(),e=this.m_originalGeometry.getAttributeStreamRef(0));const o=this.m_pannableExtent.width(),a=o*at()*4;let m=t,c=Number.NaN;const u=et.constructEmpty();this.m_bAdjustedAtPoles=0;let l=new n({vd:this.m_inputPoly.getDescription()});for(let _=0,f=this.m_inputPoly.getPathCount();_<f;++_){let t=i;const h=new n({vd:this.m_inputPoly.getDescription()});h.addPath(this.m_inputPoly,_,!0);const g=this.m_inputPoly.isClosedPath(_);0!==this.m_poleFlags&&(this.m_bAdjustedAtPoles|=Es(g,h,this.m_pannableExtent.ymax-this.m_poleSnappingTolerance,this.m_pannableExtent.ymax,o,this.m_poleFlags)?1:0,this.m_bAdjustedAtPoles&&(t=!1));let f=-1;const p=h.getPointCount();let d=!1;t&&(f=this.m_originalGeometry.getPathStart(_),d=this.m_originalGeometry.isClosedPath(_));const y=h.getAttributeStreamRef(0);let P=0,x=y.read(0),C=0;const E=new Q,S=new Q;let w=!1;const b=h.hasNonLinearSegments(),T=new Q;for(let n=1;n<p;++n){y.queryPoint2D(2*n,T);const r=T.x;let i=r+P;const o=i-x;if(T.x=i,Math.abs(o)>this.m_GCSLargeDelta){if(t){const r=f+n-1;let i=f;(!d||n+1<p)&&(i+=n);const a=e.read(2*r),m=(e.read(2*i)-a)*s;Math.abs(o-m)>1*this.m_degree&&(t=!1)}if(!t){P-=tt(this.m_width360,i-x),i=r+P,++C,w=0!==P,T.x=i}}w&&(b&&V("error in geonormalize_ring_ for curves"),y.write(2*n,i)),x=i,E.setCoordsPoint2D(S),S.setCoordsPoint2D(T)}if(C&&h.notifyModified(),m){let t=!1;if(!h.isEmpty()){const e=r.constructEmpty();if(h.queryEnvelope(e),e.width()>=o||e.ymin<=this.m_pannableExtent.ymin||e.ymax>=this.m_pannableExtent.ymax)t=!0;else{if(Number.isNaN(c)){const t=this.m_centralLongitude-.5*o;c=e.xmin,c+=Math.round((t-e.xmin)/o)*o,c>t&&(c-=o),X(c<=t),c<t&&(c+=o),X(c>=t)}let n=Math.round((c-e.xmin)/o)*o;if(e.xmin+n>c+a&&(n-=o),e.xmin+n<c-a&&(n+=o),u.mergeCoordinate(e.xmin+n),u.mergeCoordinate(e.xmax+n),t=u.width()>=o,!t){const t=new $;t.setShiftCoords(n,0),h.applyTransformation(t)}}}l.add(h,!1),t&&(l=(()=>{const t=new n({vd:l.getDescription()});for(let e=0,r=l.getPathCount();e<r;++e){const r=new n({vd:l.getDescription()});r.addPath(l,e,!0);const i=$s(r,this.m_pannableSR,this.m_centralLongitude,!0,0,this.m_progressTracker);t.add(i,!1)}return t})(),m=!1)}else{const t=$s(h,this.m_pannableSR,this.m_centralLongitude,!0,0,this.m_progressTracker);l.add(t,!1)}}if(m)return l;const h=this.m_pannableSR.getTolerance(0),g=this.m_pannableExtent.width()/180;go(l,this.m_pannableExtent,.1*h,!1);return Gt(l,this.m_pannableExtent,h,g,this.m_progressTracker)}finalizeGeoNormalizeOpenedRing(t,i){const s=i.getPointCount(),o=i.getXY(0),a=i.getXY(s-1);{const t=Math.abs(a.x-o.x),e=Math.round(t/this.m_width360)*this.m_width360;X(Math.abs(t-e)<this.m_pannableSR.getTolerance(0))}const m=nt(a.x-o.x),c=r.constructEmpty();i.queryLooseEnvelope(c);const u=this.m_pannableExtent.getCenterX();let l=0,h=u-this.m_width360,g=u+this.m_width360;if(m>=0){let t=Math.ceil((h-c.xmin)/this.m_width360);for(t*=this.m_width360;h>c.xmin+t;)t+=this.m_width360;for(;h<c.xmax+t;)t-=this.m_width360;for(l=t,c.width()>720&&(g=h+360*Math.ceil(c.width()/360));g<c.xmax;)g+=this.m_width360}else{let t=Math.ceil((g-c.xmax)/this.m_width360);for(t*=this.m_width360;g<c.xmax+t;)t-=this.m_width360;for(;g>c.xmin+t;)t+=this.m_width360;for(l=t,c.width()>720&&(h=g-360*Math.ceil(c.width()/360));h>c.xmin;)h-=this.m_width360}const _=Math.round(Math.abs(a.x-o.x)/this.m_width360)*this.m_width360,f=m*_,p=c.clone();p.move(l,0);const d=new Q(0,0),y=new $;y.setShiftCoords(l,0),i.applyTransformation(y);const P=new n({vd:i.getDescription()});P.add(i,!1),d.assign(i.getXY(s-1));let x=0,C=P.getXY(0).x;for(;m>0?p.xmax<g:p.xmin>h;)p.move(f,0),y.xd=f,i.applyTransformation(y),C+=f,this.m_pannableExtent.xmin<=C&&this.m_pannableExtent.xmax>=C&&(x=P.getPointCount()-1),i.setXY(0,d),d.assign(i.getXY(s-1)),P.addSegmentsFromPath(i,0,0,s-1,!1);const E=new e({vd:P.getDescription()});E.add(P,!1);const S=P.getXY(0),w=P.getXY(P.getPointCount()-1),b=m<0?t:!t,T=E.getPointCount()-1;if(b){const t=new Q(w.x,this.m_pannableExtent.ymax);E.lineTo(t);const e=new Q(this.m_pannableExtent.getCenterX(),this.m_pannableExtent.ymax);E.lineTo(e);const n=new Q(S.x,this.m_pannableExtent.ymax);E.lineTo(n)}else{const t=new Q(w.x,this.m_pannableExtent.ymin);E.lineTo(t);const e=new Q(this.m_pannableExtent.getCenterX(),this.m_pannableExtent.ymin);E.lineTo(e);const n=new Q(S.x,this.m_pannableExtent.ymin);E.lineTo(n)}if(E.interpolateAttributesPath(0,T,0),E.getImpl().changeRingStartPoint(x),_>this.m_width360){const t=new e({copy:E});y.setShiftCoords(this.m_width360,0),t.applyTransformation(y),E.add(t,!1)}return E}finalizeGeoNormalizeClosedRing(t,n,i){const s=new e({vd:t.getDescription()});s.add(t,!1);const a=()=>{const t=s.getPointCount()-2;return s.getSegmentType(t)!==L.enumLine};if(s.hasNonLinearSegments()&&a()){const t=new o,e=s.getPointCount()-2;s.getSegmentBuffer(e,t,!1),s.removePointFromPath(0,e+1),s.closeLastPathWithSegment(t.get())}else s.removePointFromPath(0,s.getPointCount()-1);const m=r.constructEmpty();s.queryLooseEnvelope(m);let c=Math.ceil((this.m_pannableExtent.xmin-m.xmin)/this.m_width360);for(c*=this.m_width360;this.m_pannableExtent.xmin>m.xmin+c;)c+=this.m_width360;for(;this.m_pannableExtent.xmin<m.xmax+c;)c-=this.m_width360;if(c+=this.m_width360,0!==c){m.move(c,0);const t=new $;t.setShiftCoords(c,0),s.applyTransformation(t)}if(this.m_pannableExtent.xmin<=m.xmin&&this.m_pannableExtent.xmax>=m.xmax){if(n){const t=s.calculateArea2D(),e=(new At).execute(s,this.m_pannableSR,!0,this.m_progressTracker);if(e!==s){const n=e.calculateArea2D();nt(t)!==nt(n)&&e.reverseAllPaths(),s.assignMove(e)}}let t;if(t=new e(i?{copy:s}:{move:s}),i)for(;m.xmin<this.m_pannableExtent.xmax;){m.move(this.m_width360,0);const e=new $;e.setShiftCoords(this.m_width360,0),s.applyTransformation(e),t.add(s,!1)}return t}let u=new e({vd:t.getDescription()});u.add(s,!1);const l=n||m.width()>this.m_width360-10*this.m_pannableSR.getTolerance(0);for(;m.xmin<this.m_pannableExtent.xmax;){m.move(this.m_width360,0);const t=new $;t.setShiftCoords(this.m_width360,0),s.applyTransformation(t),u.add(s,!1)}if(l){const t=u.calculateArea2D();u.setFillRule(1),u=(new At).execute(u,this.m_pannableSR,!0,this.m_progressTracker);const e=u.calculateArea2D();nt(t)!==nt(e)&&u.reverseAllPaths()}return u}geonormalize_ring_(t,e,n,r,i,s,o){X(0)}}function Ds(t,e=!0){return X(0),{}}function Gs(t){return Ga()}function Ns(t,e,n,r,i){if(t.equals(e))return!1;if(r){let n=1,s=0,o=1,a=1,m=0,c=1;Number.isNaN(t.m_heightMetersPerUnit)||(n=t.m_heightMetersPerUnit,s=t.m_heightZ0,o=t.m_heightSign,a=e.m_heightMetersPerUnit,m=e.m_heightZ0,c=e.m_heightSign);const u=o*c*n/a;for(let t=0;t<i;t++)r[t]=(r[t]-s)*u+m}let s=1,o=0;if(Number.isNaN(t.m_XYToRadians)||(s=t.m_XYToRadians/e.m_XYToRadians,o=t.m_PrimeMeridianDegrees-e.m_PrimeMeridianDegrees,0!==o&&(o=q(o),o/=e.m_XYToRadians)),Array.isArray(n)){const t=n;for(let e=0;e<i;e++)t[e][0]=t[e][0]*s+o,t[e][1]=t[e][1]*s}else{const t=n;for(let e=0;e<i;e++){const n=e<<1;t[n]=t[n]*s+o,t[n+1]=t[n+1]*s}}return!0}function Ms(){return{m_heightMetersPerUnit:0,m_heightSign:0,m_heightZ0:0,m_XYToRadians:0,m_PrimeMeridianDegrees:0,assign(t){this.m_heightMetersPerUnit=t.m_heightMetersPerUnit,this.m_heightSign=t.m_heightSign,this.m_heightZ0=t.m_heightZ0,this.m_XYToRadians=t.m_XYToRadians,this.m_PrimeMeridianDegrees=t.m_PrimeMeridianDegrees},equals(t){return st(this.m_heightSign,t.m_heightSign)&&st(this.m_heightMetersPerUnit,t.m_heightMetersPerUnit)&&st(this.m_heightZ0,t.m_heightZ0)&&st(this.m_XYToRadians,t.m_XYToRadians)&&st(this.m_PrimeMeridianDegrees,t.m_PrimeMeridianDegrees)},initFromGcsAndVcsPe(t,e){this.m_heightSign=1,this.m_heightMetersPerUnit=Number.NaN,this.m_heightZ0=0,this.m_XYToRadians=Number.NaN,this.m_PrimeMeridianDegrees=Number.NaN,e&&X(0),t&&(this.m_XYToRadians=t.getUnit().getUnitFactor(),this.m_PrimeMeridianDegrees=t.getPrimem().getLongitude())},initFromGcsAndVcs(t,e){const n=t?t.getPECoordSys():null,r=e?e.getPEVerticalCoordSys():null;this.initFromGcsAndVcsPe(n,r)},processUnitParams(t){Number.isNaN(this.m_heightMetersPerUnit)&&(this.m_heightMetersPerUnit=t.m_heightMetersPerUnit,this.m_heightSign=t.m_heightSign,this.m_heightZ0=t.m_heightZ0),Number.isNaN(this.m_XYToRadians)&&(this.m_XYToRadians=t.m_XYToRadians,this.m_PrimeMeridianDegrees=t.m_PrimeMeridianDegrees)}}}function As(t,e,n,r,i,s,o){let a=null;if(e){a=e.getPEVerticalCoordSys()}let m=null;if(t){m=t.getPECoordSys()}let c=null;if(r){c=r.getPEVerticalCoordSys()}let u=null;if(n){u=n.getPECoordSys()}if(!(m||a||u||c))return!1;const l=Ms();l.initFromGcsAndVcsPe(m,a);const h=Ms();return h.initFromGcsAndVcsPe(u,c),Ns(l,h,i,s,o)}class qs{supportsCurves(){return!0}accelerateGeometry(t,e,n){return Ys(t,e,n)}canAccelerateGeometry(t){return Xs(t)}}function Ys(t,e,n){if(!Xs(t))return!1;p(e,t,!1);let r=0;const i=t.getGeometryType();return j(i)&&d(t)&&0!==n&&(r|=t.getImpl().buildQuadTreeAccelerator(n)?1:0),j(i)&&y(t)&&0!==n&&(r|=t.getImpl().buildQuadTreeForPathsAccelerator(n)?1:0),r>0}function Xs(t){return d(t)||y(t)}class Rs extends qs{getOperatorType(){return 8}execute(t,e,n,r){return dn(t,e,n,1,r)}}class Fs extends qs{getOperatorType(){return 3}execute(t,e,n,r=null){return dn(t,e,n,4,r)}}function Os(t,e,i){const s=e.getGCSSplitLines();if(null===s)return t;const o=e.getGCS(),a=o.getPannableExtent().width(),m=r.constructEmpty();t.queryLooseEnvelope(m);const u=et.constructEmpty();m.queryIntervalX(u);const l=s.querySegmentIterator();let h=null;const g=new $;for(;l.nextPath();)for(;l.hasNextSegment();){const t=l.nextSegment(),e=t.queryInterval(0,0),r=et.constructEmpty();r.setCoordsFromEnvelope(e);let i=0;for(;r.vmax>u.vmin;)r.move(-a),i--;for(;r.vmin<=u.vmax;){if(r.isIntersecting(u)){null===h&&(h=new n);const e=new c({start:t.getStartXY(),end:t.getEndXY()});0!==i&&(g.setShiftCoords(i*a,0),e.applyTransformation(g)),h.addSegment(e,!0)}r.move(a),++i}}if(null!==h){const e=D(o,h,!0),n=N(e);return kt(t,h,n,i)}return t}function Ls(t,e,n){let r=t.getName();return cm(r)||(n||e>0?(r=t.toString(Mm.PE_STR_NAME_CANON|Mm.PE_STR_AUTH_NONE),r=js(r)):r=t.toString(Mm.PE_STR_AUTH_TOP)),r}function Us(t,e,n,r){return X(0),""}function Hs(t,e=-1){if((e>1||e<-1)&&Y("verbosity"),-1===e)return t.toString();{const n=0===e?Mm.PE_STR_AUTH_TOP:Mm.PE_STR_AUTH_ALL;return t.toString(n)}}function zs(t,e){(e>1||e<-1)&&Y("verbosity");let n=Mm.PE_STR_FMT_WKT2;return-1!==e&&(n|=0===e?Mm.PE_STR_AUTH_TOP:Mm.PE_STR_AUTH_ALL),t.toString(n)}function Vs(t){return X(0),""}function js(t){return t.toLocaleUpperCase("en-US")}function ks(t,e,n){const r=t.getPCSHorizon();if(r.getGeometryType()!==L.enumPolygon)if(r.getGeometryType()!==L.enumEnvelope)Y("");else{const t=r;for(let r=0;r<n;r++)t.contains(e[r])||e[r].setNAN()}else{const i=t.getDefaultPrecisionSR().getTolerance(0),s=r;for(let t=0;t<n;t++)1!==Lt(s,e[t],i)&&e[t].setNAN()}}function Bs(t,e,n,r){for(let i=0;i<e;i++){if(t[i].y<n.ymin||t[i].y>n.ymax){t[i].setNAN();continue}const e=t[i].x;t[i].x=no(e,n,r)}}function Zs(t,e,n,s){if(t.isEmpty()||1===n)return t;const o=t.getGeometryType();if(o===L.enumPoint){const r=t,i=r.getXY();return 0===Js([i],1,e,n)||i.isNAN()?r.setEmpty():r.setXY(i),t}if(o===L.enumMultiPoint){const r=t,s=t.createInstance(),o=r.getPointCount();s.reserve(o);const a=r.getAttributeStreamRef(0),m=r.getDescription().getAttributeCount()>1,c=new i,u=Float64Array.from(a.getArray());if(Js(u,o,e,n)>0)for(let t=0,e=2*o;t<e;t+=2)Number.isNaN(u[t])||(m?(r.getPointByVal(t>>1,c),c.setXYCoords(u[t],u[t+1]),s.add(c)):s.addXY(u[t],u[t+1]));return s}let a=t;const m=e.getOneDegreeGCSUnit(),c=90*m,u=180*m,l=360*m,h=e.getCentralMeridian(),g=.5*m,_=r.constructEmpty();a.queryEnvelope(_);const f=e.getGCSHorizon(),d=e.getGCSHorisonIsInclusive(),y=f.getGeometryType()===L.enumEnvelope,P=r.constructEmpty();f.queryEnvelope(P);const x=e.getGCS();if(2!==n&&4!==n||(P.xmin=h-u,P.xmax=P.xmin+l),4===n){if(!(_.width()>l-m)){const t=r.constructEmpty();t.setCoords({xmin:_.xmin-m,ymin:P.ymin,xmax:_.xmax+m,ymax:P.ymax}),a=(new Xt).execute(a,t,x,s);let e=Math.floor((h-_.getCenterX())/l);for(_.move(e*l,0);_.xmin>P.xmax;)e-=1,_.move(-l,0);for(;_.xmin<P.xmin;)e+=1,_.move(l,0);if(0!==e){const t=new $;t.setShiftCoords(e*l,0),a.applyTransformation(t)}return a}n=2}if(2===n&&(P.xmin=h-u,P.xmax=P.xmin+l),_.ymin<-c||_.ymax>c){const t=r.constructEmpty();if(t.setCoords({xmin:_.xmin-m,ymin:-c,xmax:_.xmax+m,ymax:c}),a=(new Xt).execute(a,t,x,s),a.isEmpty())return a;a.queryEnvelope(_)}if(d&&(P.ymax<_.ymin||P.ymin>_.ymax))return a.createInstance();_.width()>l&&(a=lo(a,h-u,l,x,!0,0,!0,s),a.queryEnvelope(_));let C=uo(_.xmin,_.xmax,P.xmin,P.xmax,l);if(0!==C&&_.move(C,0),_.xmax>P.xmax||_.xmin<P.xmin){if(_.xmax>P.xmax)for(;_.xmin>=P.xmax;)_.move(-l,0),C-=l;for(;_.xmin<P.xmax-l;)_.move(l,0),C+=l}const E=p(x,f,!1);if(0!==C){const t=new $;t.setShiftCoords(C,0),a.applyTransformation(t),C=0}if(d){if(y&&P.containsEnvelope(_))return a;const t=new Array(2);for(let e=0;e<2;e++){let n;if(y?n=j(o)?Gt(a,P,E,g,s):Gt(a,P,E,0,s):(n=(new Rt).execute(a,f,x,s),n===f&&(n=n.clone())),P.xmin<=_.xmin&&P.xmax>=_.xmax)return n;if(P.xmin>=_.xmin&&P.xmax<=_.xmax)return n;if(t[e]=n,0===e){_.move(-l,0);const t=new $;t.setShiftCoords(-l,0),a.applyTransformation(t)}}return j(o)?t[0].add(t[1],!1):V("intersect_with_GCS_horizon: unexpected geometry type"),t[0]}{if(P.ymax<_.ymin||P.ymin>_.ymax)return a;let t=0;for(;!a.isEmpty()&&_.xmax>P.xmin;){if(0!==t){const e=new $;e.setShiftCoords(t,0),a.applyTransformation(e)}if(!(new Fs).execute(a,f,x,s)){a=(new Wt).execute(a,f,x,s),f===a&&(a=a.clone())}if(0!==t){const e=new $;e.setShiftCoords(-t,0),a.applyTransformation(e)}t-=l,_.move(-l,0)}return a}}function Ks(t,e,n,r,i,s){const o={stack:[],error:void 0,hasError:!1};try{if(2===s){return be(t,e,n,r,i)}if(Math.abs(n.x-r.x)>=Math.PI||!ia(n.x,r.x,i))return Number.NaN;n.x>r.x&&(r=pt(n,n=r));const a=It(o,new Gm,!1),m=It(o,new Gm,!1),c=It(o,new Gm,!1),u=n.clone();Fm.geodeticDistance(t,e,n.x,n.y,r.x,r.y,m,a,null,s);const l=m.val;let h=0,g=1;for(;l*(g-h)>1e-12*t;){const o=.5*(h+g);if(Fm.geodeticCoordinate(t,e,n.x,n.y,l*o,a.val,m,c,s),u.x=m.val,u.y=c.val,u.x===i)return u.y;if(ia(n.x,u.x,i))g=o;else{if(!ia(r.x,u.x,i))return Number.NaN;h=o}}return u.y}catch(a){o.error=a,o.hasError=!0}finally{Dt(o)}}function Ws(t,e){let n;if(Array.isArray(t)){const r=t;n=new Float64Array(2*e);for(let t=0,i=0;t<e;t++,i+=2)n[i]=r[t].x,n[i+1]=r[t].y}else n=t;return n}function Qs(t,e,n,r){for(let i=0,s=0;i<r;i++,s+=2)e[n+i].x=t[s],e[n+i].y=t[s+1]}function Js(t,e,n,i){if(0===e||1===i)return e;const s=Ws(t,e);if(2===i){const r=n.getPannableExtentInGCS();let i=e;for(let t=0,n=2*e;t<n;t+=2)(s[t+1]>r.ymax||s[t+1]<r.ymin)&&(s[t]=Number.NaN,i--);return i?(ho(s,e,r.xmin,r.width(),!0),t!==s&&Qs(s,t,0,e),i):0}const o=n.getOneDegreeGCSUnit(),a=90*o,m=180*o,c=360*o;let u=e;for(let r=0,p=2*e;r<p;r+=2)(s[r+1]>a||s[r+1]<-a)&&(s[r]=Number.NaN,u--);if(!u)return 0;const l=r.constructEmpty();l.setFromPoints(s,e);const h=n.getGCSHorizon(),g=n.getGCSHorisonIsInclusive(),_=h.getGeometryType()===L.enumEnvelope,f=r.constructEmpty();if(h.queryEnvelope(f),g&&(f.ymax<l.ymin||f.ymin>l.ymax))return 0;if(g){if(ho(s,e,f.getCenterX()-m,c,!0),u=e,_)for(let t=0,n=2*e;t<n;t+=2)f.containsCoords(s[t],s[t+1])||(s[t]=Number.NaN,u--);else{const t=p(n.getGCS(),h,!1),r=new Q;for(let n=0,i=2*e;n<i;n+=2){r.setCoords(s[n],s[n+1]);0!==Lt(h,r,t)||(s[n]=Number.NaN,u--)}}}else{ho(s,e,-m,c,!0),u=e;const t=p(n.getGCS(),h,!1),r=new Q;for(let n=0,i=2*e;n<i;n+=2){r.setCoords(s[n],s[n+1]),r.isNAN()&&u--;const e=co(r.x,f.xmin,f.xmax,c);r.x+=e;0!==Lt(h,r,t)&&(s[n]=Number.NaN,u--)}}return u>0&&Array.isArray(t)&&Qs(s,t,0,e),u}function $s(t,e,n,r,i,s){if(e.isPannable()||Y("fold_into_360_degree_range"),t.isEmpty())return t;let o,a;if(2===e.getCoordinateSystemType()){const t=e.getPannableExtent();a=t.xmin,o=t.width()}else{const t=e.getOneDegreeGCSUnit();o=360*t,a=n-180*t}return lo(t,a,o,e,r,i,!0,s)}function to(t,e,n,r){let i,s;if(2===n.getCoordinateSystemType()){const t=n.getPannableExtent();i=t.xmin,s=t.width()}else{const t=n.getOneDegreeGCSUnit();s=360*t,i=r-180*t}ho(t,e,i,s)}function eo(t,e){const n=e.width();let r=rt(t-e.vmin,n);r<0&&(r+=n);return e.snapClip(r+e.vmin)}function no(t,e,n){return t>e.xmax&&t-e.xmax<n?e.xmax:t<e.xmin&&e.xmin-t<n?e.xmin:t}function ro(t,e,n){if(t[0]<e.vmin||t[0]>e.vmax||n&&t[0]===e.vmax){const n=e.width();return t[0]+=Math.ceil((e.vmin-t[0])/n)*n,t[0]=e.snapClip(t[0]),!0}return!1}function io(t,e,n,r,i,s,o,a,m){return new Is(t,null,n,e,r,i,o,a,s).geoNormalizePolygonGeometry(m)}function so(t,e,n,r,i,s,o,a,m){return new Is(t,null,n,e,r,i,o,a,s).geoNormalizePolylineGeometry(m)}function oo(t,e,n,r,i){const s=new _,o=s.addGeometry(t);return ao(s,o,e,p(e,t,!1),n,r,i),s.getGeometry(o)}function ao(t,e,n,r,i,s,o){const a={stack:[],error:void 0,hasError:!1};try{X(ka()),n.isPannable()||k("insert_geodetic_points");const m=n.getPannableExtent(),c=n.getGCS(),u=Ha();c.querySpheroidData(u);const l=c.getUnit().getUnitToBaseFactor(),h=u.majorSemiAxis,g=u.e2;let _=0;const p=new et;m.queryIntervalX(p);let d=null;const y=new Array(4);2===n.getCoordinateSystemType()?(d=n.getPECoordSys(),s?(y[0]=eo(o,p),y[1]=m.getCenterY(),Am.projToGeog(d,1,y),_=y[0]*l):(y[0]=m.getCenterX(),y[1]=o,Am.projToGeog(d,1,y),_=y[1]*l)):_=o*l,s||0===_||2===i||k("insert_geodetic_points: 1");const P=It(a,new Gm,!1),x=new Q,C=new Q,E=new Q,S=new Q,w=new Q,b=new Q;for(let a=t.getFirstPath(e);a!==f;a=t.getNextPath(a)){const e=t.getFirstVertex(a);t.queryXY(e,E);let m=!1;const c=t.getNextVertex(e);for(let a=c;a!==f;a=t.getNextVertex(a)){if(a===c){if(m)break;m=!0}if(t.queryXY(a,S),s&&(r<o-E.x&&S.x-o>r||r<o-S.x&&E.x-o>r)||!s&&(0!==o||r<-E.y&&S.y>r||r<-S.y&&E.y>r))do{if(Math.abs(E.x-S.x)>=.5*p.width())break;2===n.getCoordinateSystemType()?(y[0]=eo(E.x,p),y[1]=E.y,y[2]=eo(S.x,p),y[3]=S.y,qo(d,2,y,0),w.x=y[0]*l,w.y=y[1]*l,b.y=y[3]*l):(w.x=E.x*l,w.y=E.y*l,b.y=S.y*l),b.x=(S.x-E.x)*Math.PI*2/p.width()+w.x;let e=0;const r=_t(Q,2);if(s){if(C.x=_,C.y=Ks(h,g,w,b,_,i),Number.isNaN(C.y))break;r[0]=C,e=1}else if(2===i){const t=[0,0];if(e=Te(h,g,w,b,_,t),!e)break;r[0].x=t[0],r[0].y=_,2===e&&(r[1].x=t[1],r[1].y=_)}else{if(C.x=sa(h,g,w,b,i),Number.isNaN(C.x))break;C.y=0,r[0]=C,e=1}let m=-1;for(let c=0;c<e;c++){Fm.geodeticDistance(h,g,w.x,w.y,b.x,b.y,P,null,null,i);const e=P.val;Fm.geodeticDistance(h,g,w.x,w.y,r[c].x,r[c].y,P,null,null,i);const u=P.val;2===n.getCoordinateSystemType()?(y[0]=r[c].x/l,y[1]=r[c].y/l,Am.geogToProj(d,1,y),s?(x.y=y[1],x.x=o):(x.x=oa(y[0],E.x,S.x,p),x.y=o)):s?(x.x=o,x.y=r[c].y/l):(x.x=oa(r[c].x/l,E.x,S.x,p),x.y=o);const _=e>0?ft(u/e,0,1):.5;if(0===_||1===_)continue;if(m>_)continue;const f=t.getPrevVertex(a);t.splitSegment(f,[_],1);const C=t.getNextVertex(f);t.setXYCoords(C,x.x,x.y),m=_}}while(0);E.setCoordsPoint2D(S)}}}catch(m){a.error=m,a.hasError=!0}finally{Dt(a)}}function mo(t,e){X(e.isPannable());const n=e.getPannableExtent();if(t.getGeometryType()===L.enumPoint){const e=t.getY();return n.ymin<=e&&e<=n.ymax?t:t.createInstance()}const i=r.constructEmpty();t.queryEnvelope(i);const s=r.constructEmpty();s.setCoords({env2D:n}),s.xmin=i.xmin,s.xmax=i.xmax,s.inflateCoords(.01*s.height(),0);const o=a(e,i,!1);let m;return m=s.containsEnvelope(i)?t:Gt(t,s,o,0,null),m}function co(t,e,n,r){return ot((.5*(n+e)-t)/r)*r}function uo(t,e,n,r,i){if(t>=n&&e<=r)return 0;return co(.5*(e+t),n,r,i)}function lo(t,i,s,o,a,m,c,u){const l=t.getGeometryType(),h=et.constructEmpty();h.setCoords(i,i+s);const g=[0];if(l===L.enumPoint){const e=t;if(g[0]=e.getX(),ro(g,h,c)){const e=a?t:t.clone();return e.setX(g[0]),e}return t}const _=r.constructEmpty();if(t.queryEnvelope(_),_.isEmpty())return t;if(l===L.enumMultiPoint){const e=a?t:t.clone(),n=e.getImpl(),r=n.getAttributeStreamRef(0),i=2*n.getPointCount();let s=!1;for(let t=0;t<i;t+=2)g[0]=r.read(t),ro(g,h,c)&&(r.write(t,g[0]),s=!0);return s&&n.notifyModifiedFlags(2001),e}const f=et.constructEmpty();if(_.queryIntervalX(f),h.contains(f))return h.vmax,f.vmax,t;const p=r.constructEmpty();if(p.setCoords({env2D:_}),0===f.width()){let e=f.vmin;e+=Math.ceil((h.vmin-e)/s)*s,e=h.snapClip(e);const n=a?t:t.clone();return n.setAttributeBasic(0,0,e),n}if(l===L.enumEnvelope){const e=a?t:t.clone();return _.intersect(p),e.setEnvelope(_),e}const d=.1*Math.max(_.height(),_.width())*1;p.inflateCoords(0,d);let y=t;const P=o.getTolerance(0),x=new $;for(;;){const t=Math.floor((f.vmin-i)/s),e=Math.ceil((f.vmax-i)/s);if(!(e-t>3))break;{const n=Math.floor(.5*(e+t));p.xmin=_.xmin-d,p.xmax=i+s*n;const r=Gt(y,p,P,m,u);p.xmin=p.xmax,p.xmax=_.xmax+d;const a=Gt(y,p,P,m,u);x.setShiftCoords((n-e)*s,0),a.applyTransformation(x),l===L.enumPolygon?y=(new Kt).execute(r,a,o,u):(y=r,y.add(a,!1)),y.queryEnvelope(_),_.queryIntervalX(f)}}p.xmin=i,p.xmax=i+s;const C=r.constructEmpty();C.setCoords({env2D:p}),C.inflateCoords(P,0);const E=Math.floor((_.xmin-p.xmin)/s)*s;let S;E?(p.move(E,0),x.setShiftCoords(-E,0)):x.setIdentity(),S=l===L.enumPolyline?new n({vd:y.getDescription()}):new e({vd:y.getDescription()});const w=r.constructEmpty(),b=r.constructEmpty();for(;_.xmax>p.xmin;){const t=Gt(y,p,P,0,u);t.queryEnvelope(b);let e=!1;e=l===L.enumPolyline?!t.isEmpty()&&(b.width()>P||b.height()>P):!t.isEmpty()&&(l!==L.enumPolygon||b.width()>P),e&&(t.applyTransformation(x),t.queryEnvelope(b),S.queryEnvelope(w),w.inflateCoords(P,P),w.isIntersecting(b)&&l===L.enumPolygon?S=(new Kt).execute(S,t,o,u):S.add(t,!1)),p.move(s,0),x.shiftCoords(-s,0)}return S}function ho(t,e,n,r,i=!0){const s=new et;s.setCoords(n,n+r);const o=[0];if(Array.isArray(t)){const n=t;for(let t=0;t<e;t++)s.containsRightExclusive(n[t].x)||(o[0]=n[t].x,ro(o,s,i),n[t].x=o[0])}else{const n=t;for(let t=0;t<e;t++){const e=t<<1;s.containsRightExclusive(n[e])||(o[0]=n[e],ro(o,s,i),n[e]=o[0])}}}function go(t,e,n,i=!0){if(t.isEmpty())return;const s=t.getGeometryType();if(!i||s!==L.enumPolygon)if(z(s)){let r=!1;if(j(s)&&t.hasNonLinearSegments()){const i=t.getImpl(),s=i.getAttributeStreamRef(0),o=i.getSegmentFlagsStreamRef();X(null!==o);for(let t=0,a=i.getPathCount();t<a;t++){let a=!0;const m=i.isClosedPath(t),c=i.getPathEnd(t);if(m&&i.getPathSize(t)>0){a=1===(31&o.read(c-1))}for(let u=i.getPathStart(t);u<c;u++){if(1===(31&o.read(u))){if(a){const t=s.read(2*u),i=no(t,e,n);i!==t&&(r=!0,s.write(2*u,i))}a=!0}else a=!1}}}else{const i=t.getImpl(),s=i.getAttributeStreamRef(0);for(let t=0,o=i.getPointCount();t<o;t++){const i=s.read(2*t),o=no(i,e,n);o!==i&&(r=!0,s.write(2*t,o))}}r&&t.getImpl().notifyModifiedFlags(2001)}else if(s===L.enumEnvelope){const i=t,s=r.constructEmpty();i.queryEnvelope(s),s.xmin=no(s.xmin,e,n),s.xmax=no(s.xmax,e,n),i.setEnvelope(s)}else if(s===L.enumPoint){const r=t;r.setX(no(r.getX(),e,n))}else V("")}function _o(t,e,n){const r=new Q;return r.x=no(t.x,e,n),r.y=t.y,r}function fo(t,e){if(e.isEmpty())return 0;const n=t.getPECoordSys();if(n.getProjection().getCode()===Mm.PE_PRJ_AZIMUTHAL_EQUIDISTANT){const i=Ha();t.querySpheroidData(i);const s=n.getParameters();if(null===s[Mm.PE_PARM_LAM0])return 0;if(null===s[Mm.PE_PARM_PHI0])return 0;const o=[s[Mm.PE_PARM_LAM0].getValue(),s[Mm.PE_PARM_PHI0].getValue()];Am.geogToProj(n,1,o);const a=new Q(o[0],o[1]),m=r.constructEmpty();e.queryEnvelope(m);const c=_t(Q,4);m.queryCorners(c);let u=0;const l=t.getOneMeter();let h=Math.max(i.majorSemiAxis,i.minorSemiAxis)*Math.PI,g=Math.min(i.majorSemiAxis,i.minorSemiAxis)*Math.PI;g-=h/180,h*=l,g*=l;for(let t=0;t<4;t++){const e=Q.distance(c[t],a);if(e>h)u++;else if(e>g)return-1}if(0===u)return 1;if(4===u){const t=r.constructEmpty();return t.setCoords({center:a,width:h,height:h}),m.isIntersectingNe(t)?-1:0}return-1}return-1}function po(t,e,n,i){const s=t.getGeometryType();X(s===L.enumPolygon||s===L.enumPolyline||s===L.enumMultiPoint);const o=e.getCoordinateSystemType();if(2===o){let o=t;if(0===n){const n=fo(e,t);if(0===n)return t.createInstance();if(1===n)return t;const s=e.getPCSHorizon(),m=s.getGeometryType(),c=e.getDefaultPrecisionSR();if(m===L.enumEnvelope){const n=r.constructEmpty();s.queryEnvelope(n);const m=a(c,n,!1);o=Gt(t,n,m,5e4*e.getOneMeterPCSUnit(),i)}else(new Rs).execute(s,t,c,i)||(o=(new Rt).execute(o,s,c,i),o===s&&(o=o.clone()))}else if(e.isPannable()){const t=r.constructEmpty();o.queryEnvelope(t);const a=e.getPannableExtent();a.containsEnvelope(t)||(go(o,a,e.getTolerance(0)),2!==n&&4!==n||(o=mo(o,e)),4!==n?o=$s(o,e,0,!0,1e5*e.getOneMeterPCSUnit(),i):s===L.enumPolygon&&t.width()>2*a.width()&&(o=lo(o,-2*a.width(),2*a.width(),e,!0,0,!0,i)))}return o}if(X(1===o),s===L.enumMultiPoint)return go(t,e.getPannableExtent(),e.getTolerance(0)),t;{const n=r.constructEmpty();t.queryEnvelope(n);let o=t;const a=e.getPannableExtent();if(n.ymin<a.ymin||n.ymax>a.ymax){const t=Math.max(1,n.calculateToleranceFromEnvelope()),s=new r(n.xmin-t,a.ymin,n.xmax+t,a.ymax);if(o=(new Xt).execute(o,s,e,i),o.isEmpty())return o}return s===L.enumPolygon&&n.width()>2*a.width()&&(o=lo(o,-2*a.width(),2*a.width(),e,!0,0,!0,i)),o}}function yo(t,e,n,r,i,s){const o=r.getCoordinateSystemType();if(2===o){if(0===i)n!==t&&it(n,t,e),ks(r,n,e);else if(n!==t&&it(n,t,e),r.isPannable()){const t=r.getTolerance(0);Bs(n,e,r.getPannableExtent(),t),to(n,e,r,0)}}else{X(1===o);const i=r.getTolerance(0),s=r.getPannableExtent();for(let r=0;r<e;r++)n[r].assign(_o(t[r],s,i))}}function Po(t,e){const n=e.getPointCount();if(!n)return;const r=e.getImpl(),i=r.getAttributeStreamRef(0),s=t;Am.geogToProj(s,n,i.getArray()),r.notifyModifiedFlags(2001)}function xo(t,e,n,r){if(!n)return;const i=t.getPECoordSys();if(1===n){const n=[e[0].x,e[0].y];if(Am.geogToProj(i,1,n),r){const{first:r,second:i}=t.m_peCoordSysVal.getGeogToProjFactors();n[0]=r*(e[0].x-t.getCentralMeridian())+i}return void e[0].setCoords(n[0],n[1])}const s=t.isPannable(),o=s?t.getPannableExtent().width():0,a=179*o/360;let m=0;s&&(m=t.getCentralMeridian());const c=256,u=new Float64Array(2*c);for(let l=0;l<n;){for(let t=l;t<n&&e[t].isNAN();++t)l++;let h=Math.min(c,n-l);if(h>0){for(let t=1,n=l+1;t<h;++t,++n)if(e[n].isNAN()){h=t;break}for(let t=0;t<h;++t){const n=t<<1;u[n]=e[l+t].x,u[n+1]=e[l+t].y}if(Am.geogToProj(i,h,u),r){const{first:n,second:r}=t.m_peCoordSysVal.getGeogToProjFactors();for(let t=0;t<h;++t){u[t<<1]=n*(e[l+t].x-m)+r}}if(s)for(let t=0,n=l;t<h;t++,n++){const r=t<<1,i=u[r],s=nt(i),c=e[n].x-m;s*nt(c)<0&&Math.abs(i)>a&&(u[r]-=s*o)}Qs(u,e,l,h),l+=h}}}function Co(t,e,n,r){const i=t.getSRToGCSTransform();return(new Ri).transform(i,e,n,r,!1)}function Eo(t,e,n,i){const s=new m({vd:e.getDescription()});let o;s.addPoints(e,0,-1),o=(new Ri).execute(s,t,i);const a=e.getPointCount();if(n.setEmpty(),t.getInputSR().isPannable()){if(a!==o.getPointCount())return!1;const i=new r;e.queryEnvelope(i);const s=new r;o.queryEnvelope(s);const m=i.width(),c=s.width();if(0!==m&&0!==c){const e=c/m,n=t.getOutputSR().getPannableExtent().width()/t.getInputSR().getPannableExtent().width();if(Math.abs(e/n-1)>1e-10)return!1}else if(0!==m||0!==c)return!1;n.add(e,!1);for(let t=0;t<a;t++){const e=o.getXY(t);n.setXY(t,e)}return!0}return!1}function So(t,e,n){X(!n||t.isPannable());const r=e.getPointCount();if(!r)return;const i=e.getImpl(),s=i.getAttributeStreamRef(0),o=t.getPECoordSys();let a=0;const m=s.readRange(0,2*r);let c=()=>{Am.geogToProj(o,r,m)};const u=t.isPannable()&&!n,l=u?t.getPannableExtent().width():0,h=179*l/360;if(t.isPannable()&&(a=t.getCentralMeridian(),n)){const e=t.m_peCoordSysVal.getGeogToProjFactors(),n=e.first,i=e.second;c=()=>{Am.geogToProj(o,r,m);for(let t=0;t<r;t++){const e=t<<1,r=s.read(e),o=n*(r-a)+i;m[e]=o}}}if(c(),u)for(let g=0;g<r;g++){const t=g<<1,e=m[t],n=nt(e),r=s.read(t)-a;n*nt(r)<0&&Math.abs(e)>h&&(m[t]+=-n*l)}s.writeRangeFromArray(0,2*r,m,!0,1),i.notifyModifiedFlags(2001)}function wo(t,e,n){switch(e.getGeometryType()){case L.enumLine:return void Ko(t,e,n);case L.enumBezier:return void ea(t,e,n);case L.enumEllipticArc:return void Qo(t,e,n);case L.enumBezier2:return void na();case L.enumRationalBezier2:return void ra();default:V("")}}function bo(t,e,n){if(!e.hasNonLinearSegments())return void So(t,e,n);if(X(!n||t.isPannable()),e.isEmpty())return;const r=0,s=t.getPECoordSys(),a=t.isPannable(),m=a?t.getPannableExtent().width():0,c=179*m/360;let u=0;a&&(u=t.getCentralMeridian());const l=e.createInstance();l.reserveParts(e.getPointCount(),e.getPathCount());const h=e.getImpl(),g=new o;for(let o=0,_=e.getPathCount();o<_;++o)if(h.hasNonLinearSegmentsPath(o)){let e=!0,r=-1;const s=h.getPathStart(o),a=s+h.getSegmentCountPath(o);h.isClosedPath(o)&&(r=a-1);const m=new Q;for(let o=s;o<a;++o){if(h.getSegmentBuffer(o,g,!1),wo(t,g.get(),n),!e){g.get().getStartXY().equals(m)||g.get().moveTo(m)}if(o!==r)l.addSegment(g.get(),e);else{if(e){const t=new i;g.get().queryStart(t),l.startPathPoint(t)}l.closeLastPathWithSegment(g.get())}m.assign(g.get().getEndXY()),e=!1}}else{const t=1024;let n,i=h.getPathSize(o),g=Math.min(i,t);l.insertPath(-1,e,o,!0);const _=h.getAttributeStreamRef(0),f=l.getAttributeStreamRef(0);for(let e=h.getPathStart(o),l=h.getPathEnd(o);e<l;){if(n=_.readRange(e,g),Am.geogToProj(s,g,n),a)for(let t=0;t<g;t++){const e=t<<1,i=n[e],s=nt(i),o=_.read(2*(r+t))-u;s*nt(o)<0&&Math.abs(i)>c&&(n[e]+=-s*m)}f.writeRangeFromArray(e,g,n,!0,1),e+=g,i-=g,g=Math.min(i,t)}}e.assignMove(l)}function To(t,e,n){const r=1e3;let i=n.getPointCount();if(!i)return;const s=n.getImpl(),o=s.getAttributeStreamRef(0);let a=Math.min(i,r),m=0;const c=t.getPECoordSys();Number.isNaN(e)&&(e=0);const u=t.isPannable(),l=t.getOneDegreeGCSUnit(),h=360*l,g=179*l;let _;for(;i;){if(_=o.readRange(2*m,2*a),qo(c,a,_,e),u)for(let t=0;t<a;t++){const n=t<<1,r=_[n]-e,i=nt(r),s=o.read(2*(m+t));i*nt(s)<0&&Math.abs(r)>g&&(_[n]+=-i*h)}o.writeRangeFromArray(2*m,2*a,_,!0,1),m+=a,i-=a,a=Math.min(i,r)}s.notifyModifiedFlags(2001)}function vo(t,e,n){switch(n.getGeometryType()){case L.enumLine:return void Io(t,e,n);case L.enumBezier:return void No(t,e,n);case L.enumEllipticArc:return void Do(t,e,n);case L.enumBezier2:return void Mo();case L.enumRationalBezier2:return void Ao();default:V("")}}function Io(t,e,n){const r=[n.getStartXY(),n.getEndXY()];Xo(t,e,r,2),n.setStartXY(r[0]),n.setEndXY(r[1]),n.normalizeAfterEndpointChange()}function Do(t,e,n){if(0===n.projectionBehavior())Go(t,e,n);else{const r=n.isClosed()&&n.isMajor(),i=[n.getStartXY(),r?n.getCenter():n.getEndXY()],s=[i[0].clone(),i[1].clone()];Jo(t,e,s,2);const o=new $;o.initializeFromTwoPointsArray(i,s),n.applyTransformation(o);const a=r?0:1;n.setCoordsForIntersector(s[0],s[a],!1)}}function Go(t,e,n){$o(!1,t,e,n,!1)}function No(t,e,n){const r=_t(Q,4);n.queryControlPoints(r),Jo(t,e,r,4),n.setControlPoints(r)}function Mo(t,e,n){X(0)}function Ao(t,e,n){X(0)}function qo(t,e,n,r){const i=Am.projToGeogCenter(t,e,n,r);for(let s=0;s<e;++s){const t=s<<1;X(Number.isFinite(n[t]+n[t+1]))}return i}function Yo(t,e,n){if(!n.hasNonLinearSegments())return void To(t,e,n);if(n.isEmpty())return;const r=t.getPECoordSys();Number.isNaN(e)&&(e=0);const s=t.isPannable(),a=t.getOneDegreeGCSUnit(),m=360*a,c=179*a,u=n.createInstance();u.reserveParts(n.getPointCount(),n.getPathCount());const l=n.getImpl(),h=new o;for(let o=0,g=n.getPathCount();o<g;++o)if(l.hasNonLinearSegmentsPath(o)){let n=!0,r=-1;const s=l.getPathStart(o),a=s+l.getSegmentCountPath(o);l.isClosedPath(o)&&(r=a-1);const m=new Q;for(let o=s;o<a;++o){if(l.getSegmentBuffer(o,h,!1),vo(t,e,h.get()),!n){h.get().getStartXY().equals(m)||h.get().moveTo(m)}if(o!==r)u.addSegment(h.get(),n);else{if(n){const t=new i;h.get().queryStart(t),u.startPathPoint(t)}u.closeLastPathWithSegment(h.get())}m.assign(h.get().getEndXY()),n=!1}}else{const t=1e3;let i,a=l.getPathSize(o),h=Math.min(a,t);u.insertPath(-1,n,o,!0);const g=l.getAttributeStreamRef(0),_=u.getAttributeStreamRef(0);for(let n=l.getPathStart(o),u=l.getPathEnd(o);n<u;){if(i=g.readRange(2*n,2*h),qo(r,h,i,e),s)for(let t=0;t<h;t++){const r=t<<1,s=i[r]-e,o=nt(s),a=g.read(2*n);o*nt(a)<0&&Math.abs(s)>c&&(i[r]+=-o*m)}_.writeRangeFromArray(2*n,2*h,i,!0,1),n+=h,a-=h,h=Math.min(a,t)}}n.assignMove(u)}function Xo(t,e,n,r){const i=t.getPECoordSys();Number.isNaN(e)&&(e=0);const s=t.isPannable(),o=t.getOneDegreeGCSUnit(),a=360*o,m=179*o,c=256,u=new Float64Array(2*c);for(let l=0;l<r;){for(let e=l;e<r&&n[e].isNAN();++e)l++;let t=Math.min(c,r-l);if(t>0){for(let e=1,r=l+1;e<t;++e,++r)if(n[r].isNAN()){t=e;break}for(let e=0;e<t;e++){const t=e<<1;u[t]=n[l+e].x,u[t+1]=n[l+e].y}if(qo(i,t,u,e),s)for(let r=0,i=l;r<t;++r,++i){const t=r<<1,s=n[i].x,o=u[t]-e,c=nt(o);c*nt(s)<0&&Math.abs(o)>m&&(u[t]-=c*a)}for(let e=0;e<t;e++){const t=e<<1;n[l+e].x=u[t],n[l+e].y=u[t+1]}l+=t}}}function Ro(t,e,n,r){X(0)}function Fo(t,e,n){let r=e.getPointCount();if(!r)return!1;const i=e.getImpl(),s=i.getAttributeStreamRef(0);let o=null;const a=t.getInputSR(),m=t.getOutputSR();a.getVCS(),m.getVCS();const c=a.getOneDegreeGCSUnit(),u=m.getOneDegreeGCSUnit(),l=t.isVertical();l&&e.hasAttribute(1)&&(o=i.getAttributeStreamRef(1));const h=t.getDatumTransformation(),g=!!h&&1===h.getType();if(g||null===o||(Ro(o.getArray()),o=null),!h||0===h.count()){const t=a.getGcsUnitFactor()/m.getGcsUnitFactor(),e=(a.getPrimeMeridian()-m.getPrimeMeridian())*u,n=-90*c,o=90*c;let l=0;const h=s.getArray(),g=[0];for(let i=1,s=2*r;i<s;)g[0]=h[i],l|=Pt(g,n,o)?1:0,h[i]=g[0],i+=2;if(0!==e||1!==t){l=1;const n=s.getArray();for(let i=0,s=2*r;i<s;){let r=n[i];r*=t,r+=e,n[i]=r,n[i+1]*=t,i+=2}}return 0!==l&&i.notifyModifiedFlags(2001),!!l}const _=1e3;let f=Math.min(r,_);const p=new Array(f),d=new Array(f);let y=null;null!==o&&(y=new Float64Array(f));let P=0,x=Number.NaN,C=Number.NaN;const E=360*u,S=u/c;n&&(C=90*u,x=89.9*c,d.fill(0));let w=!0,b=0;for(;r;){let t=!1;const e=s.readRange(2*P,2*f);for(let n=0;n<f;n++)p[n]=e[n<<1];if(n)for(let n=0;n<f;n++){const r=1+(n<<1),i=Math.abs(e[r])-x;if(i>0){const s=e[r];e[r]=tt(x,s),d[n]=tt(i,s),t=!0}}const i=e[0];if(g){const t=h;y&&o.queryRange(P,f,y,!0,1),t.transform(!1,e,y,f),y&&o.writeRangeFromArray(P,f,y,!0,1)}else{h.transform(!1,e,f)}w&&(b=e[0]-S*i,w=!1);for(let n=0;n<f;n++){const t=n<<1,r=e[t]-p[n]*S-b;Math.abs(r)>200&&(e[t]+=r>0?-E:E)}if(t){for(let t=0;t<f;t++)if(d[t]){const n=1+(t<<1);e[n]+=S*d[t],e[n]>C?e[n]=C:e[n]<-C&&(e[n]=-C)}d.fill(0)}s.writeRangeFromArray(2*P,2*f,e,!0,1),l&&o&&o.writeRangeFromArray(P,f,y,!0,1),P+=f,r-=f,f=Math.min(r,_)}return i.notifyModifiedFlags(2001),!0}function Oo(t,e,n){switch(e.getGeometryType()){case L.enumLine:return zo(t,e,n);case L.enumBezier:return ko(t,e,n);case L.enumEllipticArc:return Vo(t,e,n);case L.enumBezier2:return Bo();case L.enumRationalBezier2:return Zo();default:V("")}}function Lo(t,e,n){if(!e.hasNonLinearSegments())return Fo(t,e,n);if(e.isEmpty())return!1;const r=e.createInstance();r.reserveParts(e.getPointCount(),e.getPathCount());const s=e.getImpl(),a=new o;for(let o=0,m=e.getPathCount();o<m;++o){let e=!0,m=-1;const c=s.getPathStart(o),u=c+s.getSegmentCountPath(o);s.isClosedPath(o)&&(m=u-1);const l=new Q;for(let o=c;o<u;++o){if(s.getSegmentBuffer(o,a,!1),Oo(t,a.get(),n),!e){a.get().getStartXY().equals(l)||a.get().moveTo(l)}if(o!==m)r.addSegment(a.get(),e);else{if(e){const t=new i;a.get().queryStart(t),r.startPathPoint(t)}r.closeLastPathWithSegment(a.get())}l.assign(a.get().getEndXY()),e=!1}}return e.assignMove(r),!0}function Uo(t,e,n,r,i,s){if(t.isIdentityGeogToGeog()){const n=90*t.getInputSR().getOneDegreeGCSUnit();let i=0;const s=[0];for(let t=0;t<r;t++)s[0]=e[t].y,i|=Pt(s,-n,n)?1:0,e[t].y=s[0];return i}const o=t.getInputSR(),a=t.getOutputSR(),m=o.getVCS(),c=a.getVCS(),u=o.getOneDegreeGCSUnit(),l=90*u,h=a.getOneDegreeGCSUnit(),g=t.isVertical(),_=t.getDatumTransformation(),f=!!_&&1===_.getType();if(g||(n=null),!_||0===_.count()){let t=0;const i=[0];for(let n=0;n<r;n++)i[0]=e[n].y,t|=Pt(i,-l,l)?1:0,e[n].y=i[0];return t|=As(o.getGCS(),m,a.getGCS(),c,e,n,r)?1:0,t}f||null===n||Ro();const p=1024;let d=Math.min(r,p);const y=new Array(d),P=ut(d,0);let x=0,C=Number.NaN,E=Number.NaN;const S=360*h,w=h/u;i&&(E=90*h,C=89.9*u);let b=!0,T=0,v=r;for(;v;){let t=!1;for(let n=0;n<d;n++)y[n]=e[n+x].x;if(i)for(let n=0;n<d;n++){const r=Math.abs(e[n+x].y)-C;if(r>0){const i=e[n+x].y;e[n+x].y=tt(C,i),P[n]=tt(r,i),t=!0}}const r=e[0].x;if(f){_.transform(!1,e,n,d)}else{_.transform(!1,e,d)}b&&(T=e[0].x-w*r,b=!1);for(let n=0;n<d;n++){const t=e[x+n].x-y[n]*w-T;Math.abs(t)>200&&(t>0?e[x+n].x-=S:e[x+n].x+=S)}if(t){for(let t=0;t<d;t++)P[t]&&(e[x+t].y+=w*P[t],e[x+t].y>E?e[x+t].y=E:e[x+t].y<-E&&(e[x+t].y=-E));P.fill(0,0,d)}x+=d,v-=d,d=Math.min(v,p)}return 1}function Ho(t,e,n,r,i,s){let o=0,a=!0,m=0;for(let c=0;c<r;++c)e[c].isNAN()?a||(o|=Uo(t,e.slice(m,c-m),n?n.slice(m,c-m):null,c-m,i),m=c,a=!0):a&&(m=c,a=!1);return a||(o|=Uo(t,0===m?e:e.slice(m),n?0===m?n:n.slice(m):null,r-m,i)),0!==o}function zo(t,e,n){const r=[e.getStartXY(),e.getEndXY()],i=[0,0];let s=null;e.hasAttribute(1)&&(s=i,s[0]=e.getAttributeAsDbl(0,1,0),s[1]=e.getAttributeAsDbl(1,1,0));const o=Ho(t,r,s,2,n);return e.setStartXY(r[0]),e.setEndXY(r[1]),s&&(e.setStartAttribute(1,0,s[0]),e.setEndAttribute(1,0,s[1])),e.normalizeAfterEndpointChange(),o}function Vo(t,e,n){if(0===e.projectionBehavior())return jo(t,e,n);const r=e.getStartXY().equals(e.getEndXY()),i=_t(Q,3),s=_t(Q,3),o=[0,0,0];let a=null;i[0].assign(e.getStartXY()),i[1].assign(r?e.getCenter():e.getEndXY());let m=!1;e.hasAttribute(1)&&(a=o,a[0]=e.getAttributeAsDbl(0,1,0),a[1]=e.getAttributeAsDbl(1,1,0),a[2]=ht(a[0],a[1],.5),r&&(a[1]=a[2])),s[0].setCoordsPoint2D(i[0]),s[1].setCoordsPoint2D(i[1]);const c=new $;if(r||e.isDegenerateToLine())m=Ho(t,s,a,2,n),c.initializeFromTwoPoints(i[0],i[1],s[0],s[1]);else{const r=new Q;e.queryCoord2D(.5,r),i[2].setCoordsPoint2D(r),s[2].setCoordsPoint2D(r),m=Ho(t,s,a,3,n),c.setFromTwoTriangles(i,s)}return c.isIdentity()||(e.applyTransformation(c),e.setStartXY(s[0]),e.setEndXY(r?s[0]:s[1]),e.normalizeAfterEndpointChange()),a&&(e.setStartAttribute(1,0,a[0]),e.setEndAttribute(1,0,r?a[0]:a[1])),m}function jo(t,e,n){const r=[e.getStartXY(),e.getEndXY(),e.getInteriorPoint(),e.getCenter()];let i=4;e.isDegenerateToLine()&&(i=2);const s=[0,0,0,0];let o=null;if(e.hasAttribute(1)){o=s,o[0]=e.getAttributeAsDbl(0,1,0),o[1]=e.getAttributeAsDbl(1,1,0);const t=ht(o[0],o[1],.5);o[2]=t,o[3]=t}const a=e.getStartXY().equals(e.getEndXY())&&!e.isDegenerateToLine(),m=Ho(t,r,o,i,n);return a?e.constructCircleCenterAndPoint(r[3],r[0],!e.isClockwise()):e.isDegenerateToLine()?e.constructLineCircularArc(r[0],r[1]):e.constructCircularArcThreePoint(r[0],r[1],r[2]),o&&(e.setStartAttribute(1,0,o[0]),e.setEndAttribute(1,0,o[1])),m}function ko(t,e,n){const r=_t(Q,4);e.queryControlPoints(r);const i=[0,0,0,0];let s=null;e.hasAttribute(1)&&(s=i,s[0]=e.getAttributeAsDbl(0,1,0),s[3]=e.getAttributeAsDbl(1,1,0),s[1]=ht(s[0],s[3],.5),s[2]=s[1]);const o=Ho(t,r,s||null,r.length,n);return e.setControlPoints(r),s&&(e.setStartAttribute(1,0,s[0]),e.setEndAttribute(1,0,s[3])),e.normalizeAfterEndpointChange(),o}function Bo(t,e,n){return X(0),!1}function Zo(t,e,n){return X(0),!1}function Ko(t,e,n){const r=[e.getStartXY(),e.getEndXY()];xo(t,r,2,n),e.setStartXY(r[0]),e.setEndXY(r[1]),e.normalizeAfterEndpointChange()}function Wo(t,e,n,r){xo(t,e,n,r)}function Qo(t,e,n){if(0===e.projectionBehavior())ta(t,e,n);else{const r=e.isClosed()&&e.isMajor(),i=[e.getStartXY(),r?e.getCenter():e.getEndXY()],s=[i[0].clone(),i[1].clone()];Wo(t,s,2,n);const o=new $;o.initializeFromTwoPointsArray(i,s),e.applyTransformation(o);const a=r?0:1;e.setCoordsForIntersector(s[0],s[a],!1)}}function Jo(t,e,n,i){Xo(t,e,n,i);const s=new r;s.setFromPoints(n,i);const o=t.getOneDegreeGCSUnit(),a=360*o,m=180*o;if(s.width()>m){for(let t=0;t<i;t++)for(;n[t].x<e;)n[t].x+=a;if(s.setFromPoints(n,i),s.xmax>m+e)for(let t=0;t<i;t++)n[t].x-=a}}function $o(t,e,n,r,i){const s=_t(Q,3);let o=0,a=!1,m=!1;const c=r.isDegenerateToLine();c?(s[0].assign(r.getStartXY()),s[1].assign(r.getEndXY()),s[2].setCoords(0,0),o=2):r.isClosed()&&r.isMajor()?(a=!0,m=!r.isClockwise(),s[0].assign(r.getStartXY()),s[1].assign(r.getCenter()),s[2].setCoords(0,0),o=2):(s[0].assign(r.getStartXY()),s[1].assign(r.getEndXY()),s[2].assign(r.getInteriorPoint()),o=3),t?Wo(e,s,o,i):Jo(e,n,s,o),c?r.constructLineCircularArc(s[0],s[1]):a?r.constructCircleCenterAndPoint(s[1],s[0],m):r.constructCircularArcThreePoint(s[0],s[1],s[2])}function ta(t,e,n){$o(!0,t,0,e,n)}function ea(t,e,n){const r=_t(Q,4);e.queryControlPoints(r),Wo(t,r,4,n),e.setControlPoints(r)}function na(t,e,n){X(0)}function ra(t,e,n){X(0)}function ia(t,e,n){const r=A(t),i=A(e),s=M(r,i),o=M(r,A(n));return 0===o||(s>0&&o>0&&o<=s||s<0&&o<0&&o>=s)}function sa(t,e,n,r,i){const s={stack:[],error:void 0,hasError:!1};try{const o=n.clone(),a=r.clone();if(2===i){const n=[0,0];return Te(t,e,o,a,0,n),n[0]}if(o.y>a.y){const t=new Q;t.assign(o),o.assign(a),a.assign(t)}const m=It(s,new Gm,!1),c=It(s,new Gm,!1),u=It(s,new Gm,!1),l=new et;if(l.setCoords(o.y,a.y),!l.containsCoordinate(0)||Math.abs(o.x-a.x)>=Math.PI)return Number.NaN;if(o.x===a.x)return o.x;Fm.geodeticDistance(t,e,o.x,o.y,a.x,a.y,c,m,null,i);const h=c.val;let g=0,_=1;const f=o.clone();for(;h*(_-g)>1e-12*t;){const n=.5*(g+_);if(Fm.geodeticCoordinate(t,e,o.x,o.y,h*n,m.val,c,u,i),f.x=c.val,f.y=u.val,l.setCoords(o.y,f.y),0===f.y)return f.x;if(l.containsCoordinate(0))_=n;else{if(l.setCoords(a.y,f.y),!l.containsCoordinate(0))return X(!1),Number.NaN;g=n}}return f.x}catch(o){s.error=o,s.hasError=!0}finally{Dt(s)}}function oa(t,e,n,r){const i=new et;i.setCoords(e,n);const s=r.width();let o=Math.floor((t-e)/s)*s+t;const a=i.getCenter();for(;Math.abs(o-a)>Math.abs(o+s-a);)o+=s;return o}class aa extends Ft{constructor(){super(),this.m_geometryDeque=[],this.m_index=-1}next(){if(this.m_geometryDeque.length>0){this.m_index++;const t=this.m_geometryDeque[0];return this.m_geometryDeque.shift(),t}return null}getGeometryID(){return this.m_index}tick(t){this.m_geometryDeque.push(t)}tock(){return!0}getRank(){return 1}}function ma(t,e){return t===e||null!==t&&null!==e&&(t.m_csType===e.m_csType&&(0===t.m_WKID&&0===e.m_WKID?t.m_hashCode===e.m_hashCode&&t.m_canonicalWkt===e.m_canonicalWkt:t.m_WKID===e.m_WKID))}function ca(t,e){return t===e||null!==t&&null!==e&&(t.m_csType===e.m_csType&&(0===t.m_WKID&&0===e.m_WKID?1===t.m_csType?t.m_peCoordSys.isEqual(e.m_peCoordSys):t.m_peCoordSys===e.m_peCoordSys:t.m_WKID===e.m_WKID))}class ua{constructor(t,e=!0){this.m_PCSHorizon=null,this.m_GCSHorizon=null,this.m_GCSSplitLines=null,this.m_bGCSHorisonIsInclusive=!1,this.m_oneMeterPCS=0,this.m_oneDegreeGCS=0,this.m_gcsUnitFactor=0,this.m_northPole=Q.getNAN(),this.m_southPole=Q.getNAN(),this.m_polesUpdated=0,this.m_domain=r.constructEmpty(),this.m_primeMeridian=Number.NaN,this.m_geogToProjFactor=1,this.m_geogToProjOffset=0,this.m_geogToProjFactorsUpdated=0,this.m_oneMillimeter=0,this.m_centralMeridian=0,this.m_pPCSInfoNoDomain=null,this.m_oldWKID=-1973,this.m_vcsWKID=-1,this.m_bIsPannable=!1,this.m_bCached=!1,this.m_pannableExtent=r.constructEmpty(),this.m_pannableExtentGCS=r.constructEmpty(),this.m_areaOfUse=null,this.m_canonicalWkt="",this.m_peCoordSys=t,this.m_WKID=Nm.getCode(t),this.m_WKID<=0?(this.m_WKID=0,this.m_canonicalWkt=Ls(t,0,!0),this.m_hashCode=xt(this.m_canonicalWkt)):this.m_hashCode=Ct(this.m_WKID);const n=this.m_peCoordSys.getType();this.m_csType=n===Mm.PE_TYPE_PROJCS?2:1,X(n===Mm.PE_TYPE_PROJCS||n===Mm.PE_TYPE_GEOGCS),n===Mm.PE_TYPE_PROJCS&&(t.loadConstants()||Y("PeProjcs.loadConstants failed"));const i=n===Mm.PE_TYPE_GEOGCS?this.m_peCoordSys:this.m_peCoordSys.getGeogcs();n!==Mm.PE_TYPE_GEOGCS&&Nm.getCode(i),this.m_unit=ie(t),this.m_primeMeridian=i.getPrimem().getLongitude();{const t=i.getUnit().getUnitFactor();this.m_gcsUnitFactor=t;let e=Math.PI/(180*t);Math.abs(e-1)<1e-10&&(e=1),this.m_oneDegreeGCS=e}if(n===Mm.PE_TYPE_PROJCS){const t=this.m_peCoordSys,e=t.getUnit().getUnitFactor();this.m_oneMeterPCS=1/e,this.m_oneMillimeter=.001/e,this.m_pPCSInfoNoDomain=Ym.generate(t,Ym.PE_PCSINFO_OPTION_NONE),this.m_pPCSInfoNoDomain||V("cannot create pcs info"),this.m_bIsPannable=this.m_pPCSInfoNoDomain.isPannableRectangle(),this.m_centralMeridian=this.m_pPCSInfoNoDomain.getCentralMeridian()}else{this.m_bIsPannable=!0,this.m_polesUpdated=1,this.m_oneMeterPCS=0;const t=1/i.getUnit().getUnitFactor(),e=i.getDatum().getSpheroid().getAxis();this.m_oneMillimeter=.001/e*t,this.m_centralMeridian=0}this.m_bIsPannable&&(this.updateGCSHorizon(),this.updatePCSHorizon(),this.updatePoles(),this.updateDomain(),this.updatePannableExtent(),this.updatePannableExtentGCS())}[Symbol.dispose](){}getHashCode(){return this.m_hashCode}getPCSHorizonPannable(){return this.m_PCSHorizon}getGCSHorizonPannable(){return this.m_GCSHorizon}getPCSInfo(){return X(this.m_pPCSInfoNoDomain),this.m_pPCSInfoNoDomain}getCentralMeridian(){return this.m_centralMeridian}updateGCSHorizon(){if(this.m_peCoordSys.getType()!==Mm.PE_TYPE_PROJCS)return;let t=!0;const i=this.m_peCoordSys,s=i.getGeogcs(),o=i.horizonGcsGenerate();if(!o)return;X(o.length>0);const a=o[0].getNump(),m=o[0].getKind();let c,u;t=o[0].getInclusive()>0;const l=this.getOneDegreeGCSUnit(),h=90*l,g=360*l,_=370*l,f=180*l*Mm.PE_HORIZON_DELTA/Math.PI,p=r.constructEmpty();let d=null;if(a>1)for(let e=1;e<a;e++)if(o[e].getKind()===Mm.PE_HORIZON_LINE){d||(d=new n);const t=o[e].getCoord();d.startPathCoords(t[0][0],t[0][1]),d.lineToCoords(t[1][0],t[1][1])}if(m===Mm.PE_HORIZON_RECT){const e=o[0].getCoord();if(p.setFromPoints([new Q(e[0][0],e[0][1]),new Q(e[1][0],e[1][1])],2),Math.abs(p.ymax-h)<1e-7*f&&(p.ymax=h),Math.abs(p.ymin+h)<1e-7*f&&(p.ymin=-h),p.width()>_){const t=-400*l,e=t+5*g;p.setCoords({xmin:t,ymin:p.ymin,xmax:e,ymax:p.ymax})}const n=new I({env2D:p});this.m_GCSHorizon||(this.m_GCSHorizon=n,this.m_bGCSHorisonIsInclusive=t)}else{let n=this.getPCSInfo().isGcsHorizonMultiOverlap();const i=Qa(s,null,null,1),m=[],_=new et;for(let t=0;t<a;t++){if(o[t].getKind()!==Mm.PE_HORIZON_POLY)continue;c=o[t].getSize();const e=o[t].getCoord(),n=r.constructEmpty();n.setFromPoints(Et(e),c),m.push(new et(n.xmin,n.xmax)),n.width(),_.merge(m.at(-1))}let f=!1;const p=new et;_.width()>g&&m.length>1?(p.vmin=this.getCentralMeridian()-g,p.vmax=p.vmin+2*g,f=!0,n=!0):(p.vmin=_.vmin,p.vmax=p.vmin+g);const y=t=>{let e=0;for(;m[t].vmin+e<p.vmin;)e+=g;for(;m[t].vmax+e-g>p.vmin;)e-=g;return e};let P=new e;if(n){const t=new aa,n=(new Kt).executeMany(t,i,null);for(let r=0;r<a;r++){if(o[r].getKind()!==Mm.PE_HORIZON_POLY)continue;c=o[r].getSize();const i=o[r].getCoord();u=o[r].getInclusive()>0;const s=new e;if(s.addPathPoint2D(Et(i),c-1,!0),f){const e=y(r),n=m[r].clone();n.move(e);let i=e;const o=new $;do{o.setShiftCoords(i,0);const e=s.clone();e.applyTransformation(o),t.tick(e),t.tock(),i+=g,n.move(g)}while(n.vmin<p.vmax)}else t.tick(s),n.tock()}P=n.next()}else{P=new e;for(let n=0;n<a;n++){if(o[n].getKind()!==Mm.PE_HORIZON_POLY)continue;c=o[n].getSize();const r=o[n].getCoord();if(u=o[n].getInclusive()>0,X(u===t),f){const t=new e;t.addPathPoint2D(Et(r),c-1,!0);const i=y(n),s=m[n].clone();s.move(i);let o=i;const a=new $;do{if(0!==o){a.setShiftCoords(o,0);const n=new e({copy:t});n.applyTransformation(a),P.addPath(n,0,!0)}else P.addPath(t,0,!0);o+=g,s.move(g)}while(s.vmin<p.vmax)}else P.addPathPoint2D(Et(r),c-1,!0)}}f&&(P=(new Xt).execute(P,new r(p.vmin,-h-l,p.vmax,h+l),i,null)),t?(new Rt).accelerateGeometry(P,i,1):(new Wt).accelerateGeometry(P,i,1),(new Fs).accelerateGeometry(P,i,1),null===this.m_GCSHorizon&&(this.m_GCSHorizon=P,this.m_bGCSHorisonIsInclusive=t,this.m_GCSSplitLines=d)}}updateAreaOfUse(){return null}updatePCSHorizon(){if(this.m_peCoordSys.getType()!==Mm.PE_TYPE_PROJCS)return;const t=this.m_peCoordSys.horizonPcsGenerate();if(!t)return;let n;this.getPCSInfo();const i=t[0].getKind();t[0].getInclusive();const s=r.constructEmpty(),o=t[0].getNump();let a=!1;if(i===Mm.PE_HORIZON_RECT){const e=t[0].getCoord();s.setFromPoints(Et(e),2),n=new I({env2D:s})}else{let r=-1;for(let e=0;e<o;e++)t[e].getKind()===Mm.PE_HORIZON_POLY&&(r=e);X(r>=0);const i=t[r].getSize()-1,s=t[r].getCoord(),m=new e;n=m,m.addPathPoint2D(Et(s),i,!0),a=!0}if(this.getPCSInfo().isDensificationNeeded()){X(i!==Mm.PE_HORIZON_RECT);const t=1e5*this.getOneMeterPCSUnit();n=(new Mt).execute(n,t,0,0,null)}if(a){{const t=new I;n.queryEnvelope(t),n.calculateArea2D(),n.calculateLength2D(),n.getExteriorRingCount()}(new Rt).accelerateGeometry(n,null,1)}null===this.m_PCSHorizon&&(this.m_PCSHorizon=n)}updatePannableExtent(){const t=this.m_peCoordSys.getType();if(t===Mm.PE_TYPE_PROJCS){const t=this.m_peCoordSys,e=this.getPCSInfo().getCentralMeridian(),n=t.getGeogcs();n||V("");const i=[e+1/n.getUnit().getUnitFactor()*Math.PI,0];Am.geogToProj(t,1,i);const s=i[0],o=t.getParameters()[Mm.PE_PARM_X0].getValue(),a=this.getPCSHorizon(),m=r.constructEmpty();a.queryEnvelope(m);const c=Math.abs(s-o),u=c+o,l=-1*c+o,h=m.ymax,g=m.ymin;this.m_pannableExtent.setCoords({xmin:l,ymin:g,xmax:u,ymax:h})}else if(t===Mm.PE_TYPE_GEOGCS){const t=1/this.m_peCoordSys.getUnit().getUnitFactor()*Math.PI;this.m_pannableExtent.setCoords({xmin:-t,ymin:-t/2,xmax:t,ymax:t/2})}else V("")}updatePannableExtentGCS(){const t=this.m_peCoordSys.getType();if(t===Mm.PE_TYPE_PROJCS){const t=this.m_peCoordSys,e=this.m_centralMeridian,n=t.getGeogcs();n||V("");const i=1/n.getUnit().getUnitFactor()*Math.PI,s=this.getGCSHorizon(),o=r.constructEmpty();s.queryEnvelope(o),this.m_pannableExtentGCS.setCoords({xmin:e-i,ymin:o.ymin,xmax:e+i,ymax:o.ymax})}else if(t===Mm.PE_TYPE_GEOGCS){const t=1/this.m_peCoordSys.getUnit().getUnitFactor()*Math.PI;this.m_pannableExtentGCS.setCoords({xmin:-t,ymin:-t/2,xmax:t,ymax:t/2})}else V("")}updateDomain(){if(1===this.m_csType){const t=400*this.getOneDegreeGCSUnit();this.m_domain=r.construct(-t,-t,t,t)}else{X(2===this.m_csType);const t=Ym.generate(this.m_peCoordSys,Ym.PE_PCSINFO_OPTION_DOMAIN);t||V("generate pcs info failed");const e=new r(t.getDomainMinx(),t.getDomainMiny(),t.getDomainMaxx(),t.getDomainMaxy());this.m_domain.isEmpty()&&this.m_domain.setCoords({env2D:e})}}updatePoles(){if(this.m_peCoordSys.getType()===Mm.PE_TYPE_PROJCS){const t=90*this.getOneDegreeGCSUnit(),e=[[0,t],[0,-t]];Am.geogToProj(this.m_peCoordSys,2,e);const n=this.getPCSInfo().getNorthPoleLocation()!==Ym.PE_POLE_OUTSIDE_BOUNDARY,r=this.getPCSInfo().getSouthPoleLocation()!==Ym.PE_POLE_OUTSIDE_BOUNDARY;this.m_polesUpdated||(n&&this.m_northPole.setCoords(e[0][0],e[0][1]),r&&this.m_southPole.setCoords(e[1][0],e[1][1]),this.m_polesUpdated=1)}else this.m_polesUpdated=1}updateGeogToProjFactors(){if(this.m_peCoordSys.getType()===Mm.PE_TYPE_PROJCS){const t=this.getOneDegreeGCSUnit(),e=this.m_pPCSInfoNoDomain.getCentralMeridian(),n=[0,0,0,0];n[0]=e,n[1]=0,n[2]=e+t,n[3]=0;const r=Am.geogToProj(this.m_peCoordSys,2,n);X(2===r);const i=(n[2]-n[0])/t,s=n[0];0===this.m_geogToProjFactorsUpdated&&(this.m_geogToProjFactor=i,this.m_geogToProjOffset=s,this.m_geogToProjFactorsUpdated=1)}else this.m_geogToProjFactorsUpdated=1}getOneMeterPCSUnit(){return this.m_oneMeterPCS}getOneDegreeGCSUnit(){return this.m_oneDegreeGCS}getGcsUnitFactor(){return this.m_gcsUnitFactor}getUnitsPerMillimeter(){return this.m_oneMillimeter}getGCSSplitLines(){return this.m_bIsPannable?null:(this.m_GCSHorizon||this.updateGCSHorizon(),this.m_GCSSplitLines)}getGCSHorizon(){return this.m_bIsPannable?this.getGCSHorizonPannable():(null!==this.m_GCSHorizon||this.updateGCSHorizon(),this.m_GCSHorizon)}getGCSHorisonIsInclusive(){return this.m_bIsPannable||this.getGCSHorizon(),this.m_bGCSHorisonIsInclusive}getPCSHorizon(){return this.m_bIsPannable?this.getPCSHorizonPannable():(null!==this.m_PCSHorizon||this.updatePCSHorizon(),this.m_PCSHorizon)}getPole(t){return this.m_bIsPannable||0!==this.m_polesUpdated||this.updatePoles(),t?this.m_southPole:this.m_northPole}getGeogToProjFactors(){return 0===this.m_geogToProjFactorsUpdated&&this.updateGeogToProjFactors(),J(this.m_geogToProjFactor,this.m_geogToProjOffset)}getDomainXY(){if(this.m_bIsPannable)return this.m_domain.clone();let t=!1;return t=this.m_domain.isEmpty(),t&&this.updateDomain(),this.m_domain.clone()}getPrimeMeridian(){return this.m_primeMeridian}getLatestID(){return this.m_WKID}getOldID(){let t=this.m_oldWKID;if(t<0){if(t=0,this.m_WKID>0){const e=[0],n=[0];km(this.m_peCoordSys.getType(),this.m_WKID,e,n)||V("query_code_change"),t=e[0]}this.m_oldWKID=t}return t}isCustomWkid(){return!1}isPannable(){return this.m_bIsPannable}getPannableExtent(){return this.m_pannableExtent.clone()}getPannableExtentGCS(){return this.m_pannableExtentGCS.clone()}getAreaOfUse(){return null!==this.m_areaOfUse?this.m_areaOfUse:this.updateAreaOfUse()}getVcsCode(){return 0}saveMemory(){}getCSType(){return this.m_csType}getUnit(){return this.m_unit}setCached(){this.m_bCached=!0}getCached(){return this.m_bCached}static equal(t,e){return!1}static equal_for_projection(t,e){return!1}}function la(t,e,n,r){return ha(!0,t,e,n,r)}function ha(t,e,n,r,i,s){return new da(2,e,n,r,i,s)}function ga(){return{centralMeridianOfOutputGCS:Number.NaN,densificationStep:Number.NaN,clipWithInputHorizon:!0,clipWithOutputHorizon:!0,legacyHorizonClipping:!1,normalizeResultGeometry:!1,equals(t){return st(this.centralMeridianOfOutputGCS,t.centralMeridianOfOutputGCS)&&st(this.densificationStep,t.densificationStep)&&this.clipWithInputHorizon===t.clipWithInputHorizon&&this.clipWithOutputHorizon===t.clipWithOutputHorizon&&this.legacyHorizonClipping===t.legacyHorizonClipping&&this.normalizeResultGeometry===t.normalizeResultGeometry}}}function _a(){return{flagsMask:0,setFlag(t,e){e?this.flagsMask|=t:this.flagsMask&=~t},hasFlag(t){return!!(this.flagsMask&t)}}}function fa(){return{m_extendedParams:ga(),m_extendedParamsInternal:_a()}}function pa(){return fa()}class da{constructor(t,e,n,r,i,s){let o,a;this.m_datumTran=null,this.m_bIdentity=!0,this.m_bIdentityGeogToGeog=!0,this.m_bVertical=!1,this.m_bNormalize=!1,e&&n||Y("!inputSR || !outputSR"),r&&0===r.getType()&&(r.m_bReadOnly=!0),this.m_bNormalize=!1,1!==t&&(o=e.getVCS(),a=n.getVCS(),this.m_bVertical=null!=o&&null!=a),this.m_inputSR=e,this.m_outputSR=n,this.m_bIdentity=!1,this.m_bIdentityGeogToGeog=!1,X(!this.m_params),i&&(this.m_params=fa(),this.m_params.m_extendedParams=i),s&&(this.m_params||(this.m_params=fa()),this.m_params.m_extendedParamsInternal=s);let m=!1;const c=null!=r,u=e.getCoordinateSystemType(),l=n.getCoordinateSystemType();if(n.isPannable()&&0!==u&&i){const t=i.centralMeridianOfOutputGCS;if(!Number.isNaN(t)&&n.isPannable()){const e=n.getPannableExtent(),r=e.getCenterX();if(r!==t){const n=Math.ceil(e.width());t+n!==r+n&&(m=!0)}}}const h=i&&i.normalizeResultGeometry;if(e.equals(n))return this.m_bIdentity=!m,this.m_bIdentityGeogToGeog=!0,void this.updateProjector();const g=!c&&e.equalForProjection(n,this.m_bVertical);this.m_bIdentity=g&&!m,this.m_bIdentity?this.m_bIdentityGeogToGeog=!0:0!==u&&0!==l&&(h&&this.m_outputSR.isPannable()&&(this.m_bNormalize=h),this.m_datumTran=r||null,this.m_bIdentityGeogToGeog=(!this.m_datumTran||0===this.m_datumTran.count())&&this.m_inputSR.getGCS().equalForProjection(this.m_outputSR.getGCS(),this.m_bVertical)),this.updateProjector()}getInputSR(){return this.m_inputSR}getOutputSR(){return this.m_outputSR}getDatumTransformation(){return this.m_datumTran}getInverse(){const t=new da(1,this.m_outputSR,this.m_inputSR,this.m_datumTran?.createInverse());return t.m_bIdentity=this.m_bIdentity,t.m_bVertical=this.m_bVertical,t.m_bIdentityGeogToGeog=this.m_bIdentityGeogToGeog,t.updateProjector(),t}isIdentity(){return this.m_bIdentity}getExtendedParams(){return this.m_params?this.m_params.m_extendedParams:pa().m_extendedParams}equals(t){return X(0),!1}isVertical(){return this.m_bVertical}isMatchingTransformation(t,e){return X(0),!1}getGeographicTransformations(){return this.m_datumTran}getExtendedParamsImpl(){return this.m_params?this.m_params.m_extendedParams:pa().m_extendedParams}getExtendedParamsInternal(){return this.m_params?this.m_params.m_extendedParamsInternal:pa().m_extendedParamsInternal}isIdentityGeogToGeog(){return this.m_bIdentityGeogToGeog}normalizeOutput(){return this.m_bNormalize}updateProjector(){this.m_projector=new qi(this)}}const ya=new Map,Pa=new Map,xa=new Map;function Ca(t){let e=t.getCode();if(e>0){const t=Ma(e);return t||Na(Nm.coordsys(e))}const n=t.getName();if(Pa.has(n)){const e=Pa.get(n);if(e&&e.deref()){const n=e.deref();if(n.m_peCoordSys.isEqual(t))return n}}return e=Nm.getCode(t),Na(e>0?Nm.coordsys(e):t)}function Ea(t){t<=0&&B(t);{const e=Ma(t);if(e)return e}const e=Um(Nm.coordsys(t));e.get()||B(t);const n=Na(e.release());return n.getLatestID()!==t&&ya.set(t,new WeakRef(n)),n}function Sa(t){const e=Um(Nm.fromString(Mm.PE_TYPE_COORDSYS,t));return e.get()||Z(t),Ca(e.release())}function wa(t){Pa.delete(t.m_peCoordSys.getName()),xa.delete(Ls(t.m_peCoordSys,0,!1))}let ba;function Ta(){return ba||(ba=Nm.unit(9001)),ba}function va(t){return null!==Um(Nm.coordsys(t)).get()}const Ia=new Map;function Da(t){if(Ia.has(t))return Ia.get(t);{const e=va(t);return Ia.set(t,e),e}}function Ga(t){return!1}function Na(t){const e=Um(t),n=t.getCode();if(n>0){const t=Ma(n);if(t)return t}const r=t.getName();let i=Pa.get(r);if(i){const e=i.deref();if(e&&e.m_peCoordSys.isEqual(t))return e}const s=new ua(e.release());if(n>0)return s.setCached(),ya.set(n,new WeakRef(s)),Pa.set(r,new WeakRef(s)),s;const o=Ls(t,0,!1);if(i=xa.get(o),i){const t=i.deref();if(t)return t}return s.setCached(),xa.set(o,new WeakRef(s)),s}function Ma(t){const e=ya.get(t);if(e)return e.deref()}class Aa extends Jt{constructor(t){return void 0===t?(super(),this.m_wkid=9001,void(this.m_peUnit=null)):"number"==typeof t?(super(),this.m_factor=t,void(this.m_wkid=0)):(super(t),void(t||(this.m_factor=1,this.m_wkid=9001,this.m_peUnit=Ta())))}getUnitType(){return 0}convertFromMeters(t){return t/this.getUnitToBaseFactor()}convertToMeters(t){return t*this.getUnitToBaseFactor()}}const qa=["0","1","2","3","4","5","6","7","8","9","b","c","d","e","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","y","z"];function Ya(t,e,n){const r=ut(e,"R");let i=0,s=0;for(let o=0;o<e;o++){let n=t[i]>>s&31;if(s+=5,s>31){const e=37-s;n&=(1<<e)-1,s-=32,i++,n|=(t[i]&(1<<s)-1)<<e}const a=qa[n];r[e-1-o]=a}return n>e?r.push(..."0".repeat(n-e)):n<e&&(r.length=n),r.join("")}function Xa(t,e,n,r,i){X(r>>5<i.length);let s=e,o=n;for(let a=r;a>=0;a-=2){const e=31&a,n=.5*(o+s);t>=n?(i[a>>5]|=1<<e,s=n):o=n}}let Ra=new Set;const Fa=2147483645n,Oa=9007199254740990n,La="operation is not supported for unknown coordinate systems";var Ua;function Ha(){return{majorSemiAxis:0,e2:0,minorSemiAxis:0,flattening:0,isSphere(){return 0===this.e2}}}function za(t,e,n){t.majorSemiAxis=e,t.minorSemiAxis=e*(1-n),t.e2=n*(2-n),t.flattening=n}function Va(t){if(Nm)return;jm(t);const e=Ra;Ra=null,e.forEach((t=>{const e=t.deref();e&&e.attachToPe()}))}function ja(t){Vm(t)}function ka(){return!!Nm}function Ba(){return!!Hm}function Za(){return!!Nm||!!Hm}function Ka(t,e,n){return X(Za()),Em(t,void 0===e?0:e,null,!1)}function Wa(t,e){X(Za());const n=new gm;let r;return ka()?(r=Sa(t),n.setHorzProj_(r),n.m_vertcs=null,n.m_userWKID=r.getLatestID()):(r=zm(t),n.m_unit=r.isPCS?new Aa(r.metersOrRadiansPerUnit):new ee(r.metersOrRadiansPerUnit)),Pm(n.m_precisionDescriptor,r,null,1),n.m_bDefaultDescriptor=!0,n.m_userWKT=t,n.calculateHashCode(),n.initDbgName(),n}function Qa(t,e,n,r,i=!0){let s=null;return e&&(s=Ds(e,i)),Ja(t,s,n,r,i)}function Ja(t,e,n,r,i){t||Y("!PE_coord_sys");const s=new gm;let o;return o=i?Ca(t):new ua(t,!1),Pm(s.m_precisionDescriptor,o,e,r),s.m_bDefaultDescriptor=!0,s.setHorzProj_(o),s.m_vertcs=e,s.m_userWKID=o.getLatestID(),s.calculateHashCode(),s.initDbgName(),s}function $a(t,e,n=!1){3===t.getCoordinateSystemType()&&Y("image spatial reference cannot be altered");const r=new gm,i=t;return r.m_peCoordSysVal=i.m_peCoordSysVal,r.m_vertcs=i.m_vertcs,r.m_unit=i.m_unit,r.m_precisionDescriptor.assign(e),r.m_localZToXYFactor=i.m_localZToXYFactor,(Number.isNaN(r.m_precisionDescriptor.m_falseX)||Number.isNaN(r.m_precisionDescriptor.m_falseY))&&(r.m_precisionDescriptor.m_falseX=i.m_precisionDescriptor.m_falseX,r.m_precisionDescriptor.m_falseY=i.m_precisionDescriptor.m_falseY),r.m_precisionDescriptor.snapPrecision(),r.m_precisionDescriptor.fixTolerance(),r.m_userWKID=i.m_userWKID,r.m_precisionDescriptor.equals(i.m_precisionDescriptor)?r.m_bDefaultDescriptor=i.m_bDefaultDescriptor:r.m_bDefaultDescriptor=!1,n&&(r.m_bDefaultDescriptor=!0),r.calculateHashCode(),r.initDbgName(),r}function tm(t,e,n){void 0===e&&(e=1),(e<=0||!Number.isFinite(e))&&Y(""),t||1===e||Y("null Unit has to have z_to_xy_factor equal to 1");const r=new gm;r.m_unit=t;const i=t||new Aa(9001);return void 0===n?(Cm(r.m_precisionDescriptor,i,null,1),r.m_bDefaultDescriptor=!0):(r.m_precisionDescriptor.assign(n),r.m_precisionDescriptor.fixTolerance(),r.m_bDefaultDescriptor=!1),Number.isNaN(r.m_precisionDescriptor.m_falseX)&&Y("NAN false X/Y are not allowed here"),r.m_localZToXYFactor=e,r.calculateHashCode(),r.initDbgName(),r}function em(t,e){return t.snapGeometry(e)}function nm(t){const e=t.getCoordinateSystemType();return 1===e?t:(3===e&&X(0),t.getGCS())}function rm(t){return X(Za()),Ba()?Bm(t):Da(t)}function im(t){return null!==Um(Nm.fromString(Mm.PE_TYPE_COORDSYS,t)).get()}let sm;function om(){return sm||(sm=(()=>{const t=Math.trunc(Math.random()*bt()),e=Date.now();return`|abba_000|${t.toString(16)}|${e.toString(16)}|`})()),sm}!function(t){t[t.utmDefault=0]="utmDefault",t[t.utmNorthSouth=1]="utmNorthSouth"}(Ua||(Ua={}));let am=0;function mm(t=""){let e=`${om()}${am++}`;return""!==t&&(e+=`|${t}`),e}function cm(t){return t.startsWith(om())}let um,lm,hm,gm=class t{destroy(){wa(this.m_peCoordSysVal),1===this.getCoordinateSystemType()||2===this.getCoordinateSystemType()?this.getPECoordSys().destroy():V("SpatialReference.destroy")}constructor(){this.m_vertcs=null,this.m_peCoordSysVal=null,this.m_userWKID=0,this.m_userWKT=null,this.m_geogSpatialReference=null,this.m_srToGcs=null,this.m_gcsToSr=null,this.m_defaultPrecisionSR=null,this.m_localZToXYFactor=-1,this.m_precisionDescriptor=new _m,this.m_hashCode=0,this.m_bDefaultDescriptor=!1,ym(this.m_precisionDescriptor),Ra&&Ra.add(new WeakRef(this))}attachToPe(){(this.m_userWKID>0?Ka(this.m_userWKID):Wa(this.m_userWKT)).copyTo(this,!1)}copyTo(t,e=!0){(e||t.m_bDefaultDescriptor)&&(t.m_bDefaultDescriptor=this.m_bDefaultDescriptor,t.m_precisionDescriptor.assign(this.m_precisionDescriptor)),t.m_defaultPrecisionSR=null,t.m_gcsToSr=this.m_gcsToSr,t.m_geogSpatialReference=this.m_geogSpatialReference,t.m_hashCode=this.m_hashCode,t.m_localZToXYFactor=this.m_localZToXYFactor,t.m_peCoordSysVal=this.m_peCoordSysVal,t.m_srToGcs=this.m_srToGcs,t.m_userWKID=this.m_userWKID,t.m_userWKT=this.m_userWKT,t.m_vertcs=this.m_vertcs,t.m_unit=this.m_unit}getHashCode(){return this.m_hashCode}getHashCodeHorizontal(){let t=0;return t=this.m_peCoordSysVal?this.m_peCoordSysVal.getHashCode():this.m_unit?this.m_unit.getHashCode():305419891,t}updateTransform(t){if(1===this.getCoordinateSystemType())return la(this,this,null);let e=t?this.m_srToGcs:this.m_gcsToSr;if(e)return e;const n=this.getGCS(),r=this;e=t?la(r,n,null):la(n,r,null);const i=e,s=t?this.m_srToGcs:this.m_gcsToSr;return s||(t?this.m_srToGcs=i:this.m_gcsToSr=i,e)}getHashCodeVertical(){return this.m_vertcs?this.m_vertcs.getHashCode():0}calculateHashCode(){let t=this.getHashCodeHorizontal();const e=this.getHashCodeVertical(),n=this.m_precisionDescriptor.getHashCode();t=K(t,e),this.m_hashCode=K(t,n)}initDbgName(){}setHorzProj_(t){this.m_peCoordSysVal=t,this.m_unit=this.m_peCoordSysVal.getUnit()}getTolerance(t=0){return this.m_precisionDescriptor.getTolerance(t)}getResolution(t=0){return this.m_precisionDescriptor.getResolution(t)}getPECoordSys(){return this.m_peCoordSysVal?this.m_peCoordSysVal.m_peCoordSys:null}getPCSInfo(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPCSInfo()}getCentralMeridian(){if(this.throwIfNotGCSOrPCS(),1===this.getCoordinateSystemType())return 0;return this.getPCSInfo().getCentralMeridian()}getCoordinateSystemType(){const t=this.getPECoordSys();if(t){switch(t.getType()){case Mm.PE_TYPE_GEOGCS:return 1;case Mm.PE_TYPE_PROJCS:return 2;default:return 0}}else{if((this.m_userWKID>0||this.m_userWKT)&&this.m_unit instanceof Aa)return 2;if(this.m_unit instanceof ee)return 1}return 0}getID(){return this.m_userWKID}getLatestID(){return this.m_peCoordSysVal?this.m_peCoordSysVal.getLatestID():this.m_userWKID}getOldID(){return this.m_peCoordSysVal?this.m_peCoordSysVal.getOldID():this.m_userWKID}getVerticalID(){return H("vcs not implemented"),0}getLatestVerticalID(){return this.m_vertcs?this.m_vertcs.getLatestID():0}getOldVerticalID(){return H("vcs not implemented"),0}getPEVerticalCoordSys(){return null}getPole(t){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPole(t)}getText(){const t=this.getPECoordSys();return t?Hs(t):this.m_userWKT??""}getTextExtended(t){const e=this.getPECoordSys();return e?this.getPEVerticalCoordSys()?Us(null,e,this.getPEVerticalCoordSys()):Hs(e,t):this.m_userWKT??""}getText2(t=-1){const e=this.getPECoordSys();return e?zs(e,t):this.m_userWKT??""}getUnit(){return this.m_unit}getUnitsPerMillimeter(){return this.m_peCoordSysVal?this.m_peCoordSysVal.getUnitsPerMillimeter():this.m_unit instanceof Aa?.001/this.m_unit.getUnitToBaseFactor():this.m_unit instanceof ee?.001/(zm(this.m_userWKT??this.m_userWKID).semiMajor*this.m_unit.getUnitToBaseFactor()):(k("sr object not in valid state"),0)}getAuthorityName(){return this.getPECoordSys()?Vs():""}getVerticalUnit(){return H("vcs not implemented"),{}}getVCS(){return this.m_vertcs}hasVCS(){return!1}getGCSHorisonIsInclusive(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSHorisonIsInclusive()}getGCSHorizon(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSHorizon()}getGCS(){const t=this.getCoordinateSystemType();if(0===t)k(La);else{if(1===t)return this;3===t&&k("image cs not supported")}if(this.m_geogSpatialReference)return this.m_geogSpatialReference;let e;if(this===fm()||this===pm())e=dm();else{X(this.m_peCoordSysVal);const t=this.m_peCoordSysVal.m_peCoordSys.getGeogcs();t||V(""),e=Qa(t,this.m_vertcs,null,this.m_precisionDescriptor.getPrecision(),this.m_peCoordSysVal.getCached())}return this.m_geogSpatialReference?e=this.m_geogSpatialReference:this.m_geogSpatialReference=e,e}getGCSSplitLines(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSSplitLines()}toGCS(t,e){if(0===t.length)return 0;t.length>e.length&&Y("coordsSrc.size() > coordsDst.size()");const n=this.getCoordinateSystemType();if(0===n&&k(La),1===n)return it(e,t,t.length),t.length;X(this.m_peCoordSysVal);const r=this.getSRToGCSTransform();return(new Ri).transform(r,t,t.length,e)}toGeohash(t,e=8){const n=t.clone();n.scale(9102===this.getGCS().getUnit().getID()?1:this.getGCS().getUnit().getUnitToBaseFactor()/Math.PI*180),n.x<-180?(n.x=rt(n.x,360),n.x<-180&&(n.x+=360)):n.x>180&&(n.x=rt(n.x,360),n.x>180&&(n.x-=360)),n.y>90&&(n.y=90),n.y<-90&&(n.y=-90);const r=5*e,i=new Uint32Array(4);Xa(n.x,-180,180,r-1,i),Xa(n.y,-90,90,r-2,i);return Ya(i,e,e)}isPannable(){const t=this.getCoordinateSystemType();return 0!==t&&3!==t&&(X(this.m_peCoordSysVal),this.m_peCoordSysVal.isPannable())}getPannableExtent(){return this.isPannable()||Y("!is_pannable"),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPannableExtent()}getPannableExtentInGCS(){return this.isPannable()||Y("!is_pannable"),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPannableExtentGCS()}throwIfNotGCSOrPCS(){const t=this.getCoordinateSystemType();1!==t&&2!==t&&Y("Not a GCS or PCS")}getDomainXY(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getDomainXY()}getFullWorldExtent(){return this.throwIfNotGCSOrPCS(),this.isPannable()?this.getPannableExtent():this.getDomainXY()}queryPrecisionDescriptor(t){if(t.assign(this.m_precisionDescriptor),Number.isNaN(t.m_falseX))if(ka()||k("projection engine is not loaded"),X(null!==this.m_peCoordSysVal),2!==this.m_precisionDescriptor.m_precision){const e=this.m_peCoordSysVal.getDomainXY();t.m_falseX=e.xmin,t.m_falseY=e.ymin}else t.m_falseX=-Number.MAX_VALUE,t.m_falseY=-Number.MAX_VALUE}queryPrecisionDescriptorWithoutFalseXY(t){t.assign(this.m_precisionDescriptor),t.m_falseX=Number.NaN,t.m_falseY=Number.NaN}queryDefaultPrecisionDescriptorWithoutFalseXY(t){if(this.m_bDefaultDescriptor)t.assign(this.m_precisionDescriptor);else{const e=this.getCoordinateSystemType();0===e?Cm(t,this.m_unit,this.m_vertcs,this.m_precisionDescriptor.getPrecision()):3===e?H("image cs"):Pm(t,this.m_peCoordSysVal,this.m_vertcs,this.m_precisionDescriptor.getPrecision())}t.m_falseX=Number.NaN,t.m_falseY=Number.NaN}horizontalEqual(t){return ma(this.m_peCoordSysVal,t.m_peCoordSysVal)}verticalEqual(t){return null!==this.m_vertcs==(null!==t.m_vertcs)&&(!this.m_vertcs||this.m_vertcs.equals(t.m_vertcs))}equals(t){const e=t;if(this===e)return!0;if(!this.horizontalEqual(e)||!this.verticalEqual(e))return!1;if(!e.m_peCoordSysVal){if(X(!this.m_peCoordSysVal),null!==this.m_unit!=(null!==e.m_unit))return!1;if(this.m_unit&&!this.m_unit.equals(e.m_unit))return!1;if(this.m_localZToXYFactor!==e.m_localZToXYFactor)return!1}if(!this.m_bDefaultDescriptor||!e.m_bDefaultDescriptor){if(this.m_peCoordSysVal){if(!this.m_precisionDescriptor.equalsWithoutFalseXY(e.m_precisionDescriptor))return!1;X(e.m_peCoordSysVal);let t=this.m_precisionDescriptor.m_falseX,n=this.m_precisionDescriptor.m_falseY;if(Number.isNaN(t)){const e=this.m_peCoordSysVal.getDomainXY();t=e.xmin,n=e.ymin}let r=e.m_precisionDescriptor.m_falseX,i=e.m_precisionDescriptor.m_falseY;if(Number.isNaN(r)){const t=e.m_peCoordSysVal.getDomainXY();r=t.xmin,i=t.ymin}return t===r&&n===i}return this.m_precisionDescriptor.equals(e.m_precisionDescriptor)}return!0}equalForProjection(t,e){if(this===t)return!0;const n=this.getCoordinateSystemType(),r=t.getCoordinateSystemType();if(0===n||0===r)return 0===n&&0===r?(!e||this.getZToXYFactor()===t.getZToXYFactor())&&(!this.getUnit()||!t.getUnit()||this.getUnit().equals(t.getUnit())):3!==n&&3!==r&&(null===this.getUnit()||null===t.getUnit()||(!e||this.getZToXYFactor()===t.getZToXYFactor())&&this.getUnit().equals(t.getUnit()));if(n!==r)return!1;if(3===n)return this.equals(t);if(ca(this.m_peCoordSysVal,t.m_peCoordSysVal)){if(!e)return!0;if(null!==this.m_vertcs==(null!==t.m_vertcs))return!this.m_vertcs||this.m_vertcs.equalForProjection(t.m_vertcs)}return!1}equalHorizontal(t){return this.horizontalEqual(t)}equalVertical(t){return X(0),!1}equalVerticalVCS(t){return X(0),!1}convergenceAngle(t){return X(0),0}getPeCoordsysCopy(){if(this.m_peCoordSysVal){const t=this.m_peCoordSysVal.m_peCoordSys;return t||V("cannot clone coord sys"),t}return null}getPeVertcsCopy(){return X(0),0}throwIfLocal(){0===this.getCoordinateSystemType()&&Y(La)}getPrimeMeridian(){return this.throwIfLocal(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPrimeMeridian()}getSRToGCSTransform(){return this.updateTransform(!0)}getGCSToSRTransform(){return this.updateTransform(!1)}getOneMeter(){return 1e3*this.getUnitsPerMillimeter()}getOneMeterPCSUnit(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getOneMeterPCSUnit()}getDefaultPrecisionSR(){if(this.m_bDefaultDescriptor)return this;if(null===this.m_defaultPrecisionSR){const t=new _m;this.queryDefaultPrecisionDescriptorWithoutFalseXY(t),this.m_defaultPrecisionSR=$a(this,t,!0)}return this.m_defaultPrecisionSR}getPCSHorizon(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPCSHorizon()}getHorzUnitFactor(){return this.m_unit?this.m_unit.getUnitToBaseFactor():1}querySpheroidData(t){this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal);const e=this.getGCS().getPECoordSys().getDatum().getSpheroid(),n=e.getFlattening();za(t,e.getAxis(),n)}getAreaOfUse(){0===this.getCoordinateSystemType()&&k(""),X(this.m_peCoordSysVal);const t=this.m_peCoordSysVal.getAreaOfUse();return null===t?new Qt:new Qt({geom:t.clone(),sr:Ka(4326)})}getZToXYFactor(){return 1}isCustomWkid(){return!1}getOneDegreeGCSUnit(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getOneDegreeGCSUnit()}getGcsUnitFactor(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getGcsUnitFactor()}snapGeometry(t){if(t.isEmpty())return!1;if(2===this.m_precisionDescriptor.getPrecision())return!1;const e=t.getGeometryType();if(z(e))return this.snapMultiVertex_(t);if(e===L.enumPoint)return this.snapPoint_(t);if(e===L.enumEnvelope)return this.snapEnvelope_(t);if(U(e))return this.snapSegment_(t);if(e===L.enumGeometryCollection){const e=t;let n=!1;for(let t=0,r=e.getGeometryCount();t<r;++t)n=this.snapGeometry(e.getGeometry(t))||n;return n}V("what else?")}snapMultiVertex_(t){if(X(!t.isEmpty()),X(2!==this.m_precisionDescriptor.getPrecision()),j(t.getGeometryType())){const e=t;if(e.hasNonLinearSegments())return this.snapGeometryWithCurves_(e)}const e=t.getImpl(),n=e.getDescription();let r=!1;for(let i=0,s=n.getAttributeCount();i<s;i++){const t=n.getSemantics(i),s=e.getAttributeStreamRef(t);r=this.snapAttributes(t,s,0,e.getPointCount())||r}return r&&e.notifyModifiedFlags(2001),r}snapPoint_(t){return!1}snapEnvelope_(t){return!1}snapSegment_(t){X(!t.isEmpty()),X(2!==this.m_precisionDescriptor.getPrecision());const e=new _m;this.queryPrecisionDescriptor(e);const n=t.getStartXY(),r=new Q;r.x=Sm(n.x,e.getFalseX(),e.getGridUnitsXY()),r.y=Sm(n.y,e.getFalseY(),e.getGridUnitsXY());let i=!r.equals(n);const s=t.getEndXY(),o=new Q;o.x=Sm(s.x,e.getFalseX(),e.getGridUnitsXY()),o.y=Sm(s.y,e.getFalseY(),e.getGridUnitsXY()),i||=!o.equals(s),i&&t.changeEndPoints2D(r,o);const a=(e,n,r)=>{let i=!1;{const s=t.getStartAttributeAsDbl(e,0),o=Sm(s,n,r),a=!st(o,s);i||=a,a&&t.setStartAttribute(e,0,o)}{const s=t.getEndAttributeAsDbl(e,0),o=Sm(s,n,r),a=!st(o,s);i||=a,a&&t.setEndAttribute(e,0,o)}return i};let m=i?1:0;return t.hasAttribute(1)&&(m|=a(1,e.getFalseZ(),e.getGridUnitsZ())?1:0),t.hasAttribute(2)&&(m|=a(2,e.getFalseM(),e.getGridUnitsM())?1:0),!!m}snapGeometryWithCurves_(t){X(!t.isEmpty()),X(2!==this.m_precisionDescriptor.getPrecision());const e=t.createInstance(),n=new o;let r=0;for(let s=0,o=t.getPathCount();s<o;++s){const o=t.getSegmentCountPath(s);if(0===o){if(e.addPath(t,s,!0),1===e.getPathSize(s)){const t=new i;e.getPointByVal(e.getPointCount()-1,t),r|=this.snapGeometry(t)?1:0,e.setPointByVal(e.getPointCount()-1,t)}continue}const a=t.isClosedPath(s);for(let i=0,m=a?o-1:o;i<m;++i)t.getSegmentFromPath(s,i,n,!1),r|=this.snapGeometry(n.get())?1:0,e.addSegment(n.get(),0===i);a&&(t.getSegmentFromPath(s,o-1,n,!1),r|=this.snapGeometry(n.get())?1:0,1===o?e.addPathFromClosedSegment(n.get(),!1):e.closeLastPathWithSegment(n.get()))}return r&&e.copyTo(t),!!r}snapAttributes(e,n,r,i){let s=!1;const o=new _m;if(this.queryPrecisionDescriptor(o),0===e){const e=n;for(let n=r;n<i;n++){const r=e.read(2*n),i=t.s_SnapValue(r,o.getFalseX(),o.getGridUnitsXY()),a=e.read(2*n+1),m=t.s_SnapValue(a,o.getFalseY(),o.getGridUnitsXY());s=s||i!==r||m!==a,s&&(e.write(2*n,i),e.write(2*n+1,m))}}else if(1===e){const e=n;for(let n=r;n<i;n++){const r=e.read(n),i=t.s_SnapValue(r,o.getFalseZ(),o.getGridUnitsZ());s=s||!st(i,r),s&&e.write(n,i)}}else if(2===e){const e=n;for(let n=r;n<i;n++){const r=e.read(n),i=t.s_SnapValue(r,o.getFalseM(),o.getGridUnitsM());s=s||!st(i,r),s&&e.write(n,i)}}return s}static s_SnapValue(t,e,n){return ot((t-e)*n)/n+e}};class _m{constructor(){const t=Oa,e=1e-4,n=.001,r=e*Number(t)*.5;this.m_precision=1,this.m_falseX=-r,this.m_falseY=-r,this.m_unitsXY=Number(t)/(2*r),this.m_falseM=-1e5,this.m_unitsM=1/e,this.m_falseZ=-1e5,this.m_unitsZ=1/e,this.m_toleranceXY=n,this.m_toleranceM=n,this.m_toleranceZ=n}getHashCode(){let t=7777,e=7777;return e=K(e,this.m_falseM),e=K(e,this.m_unitsM),t=K(t,this.m_unitsXY),e=K(e,this.m_toleranceXY),t=K(t,this.m_falseZ),e=K(e,this.m_toleranceZ),t=K(t,this.m_unitsZ),e=K(e,this.m_toleranceM),t=K(t,this.m_precision),K(t,e)}clone(){const t=new _m;return t.m_falseX=this.m_falseX,t.m_falseY=this.m_falseY,t.m_unitsXY=this.m_unitsXY,t.m_falseZ=this.m_falseZ,t.m_unitsZ=this.m_unitsZ,t.m_falseM=this.m_falseM,t.m_unitsM=this.m_unitsM,t.m_toleranceXY=this.m_toleranceXY,t.m_toleranceZ=this.m_toleranceZ,t.m_toleranceM=this.m_toleranceM,t.m_precision=this.m_precision,t}assign(t){return this.m_falseX=t.m_falseX,this.m_falseY=t.m_falseY,this.m_unitsXY=t.m_unitsXY,this.m_falseZ=t.m_falseZ,this.m_unitsZ=t.m_unitsZ,this.m_falseM=t.m_falseM,this.m_unitsM=t.m_unitsM,this.m_toleranceXY=t.m_toleranceXY,this.m_toleranceZ=t.m_toleranceZ,this.m_toleranceM=t.m_toleranceM,this.m_precision=t.m_precision,this}initialize2D(t,e){}getTolerance(t){switch(t){case 0:return this.m_toleranceXY;case 1:return this.m_toleranceZ;case 2:return this.m_toleranceM;default:return 0}}getResolution(t){if(2===this.m_precision)return 0;switch(t){case 0:return 1/this.m_unitsXY;case 1:return 1/this.m_unitsZ;case 2:return 1/this.m_unitsM;default:return 0}}getFalseX(){return this.m_falseX}getFalseY(){return this.m_falseY}getFalseZ(){return this.m_falseZ}getFalseM(){return this.m_falseM}getGridUnitsXY(){return this.m_unitsXY}getGridUnitsZ(){return this.m_unitsZ}getGridUnitsM(){return this.m_unitsM}getPrecision(){return this.m_precision}static getLimit32(){return 2147483645}static getLimit64(){return 9007199254740990n}static getLimitFloat(){return 0}getXYGridRange(){const t=new r;switch(this.m_precision){case 0:{const e=_m.getLimit32()/this.getGridUnitsXY();t.setCoords({xmin:this.getFalseX(),ymin:this.getFalseY(),xmax:this.getFalseX()+e,ymax:this.getFalseY()+e})}break;case 1:{const e=Number(_m.getLimit64())/this.getGridUnitsXY();t.setCoords({xmin:this.getFalseX(),ymin:this.getFalseY(),xmax:this.getFalseX()+e,ymax:this.getFalseY()+e})}break;case 2:t.setCoords({xmin:-Number.MAX_VALUE,ymin:-Number.MAX_VALUE,xmax:Number.MAX_VALUE,ymax:Number.MAX_VALUE});break;default:t.setEmpty(),V("")}return t}getZGridRange(){const t=new et;switch(this.m_precision){case 0:{const e=_m.getLimit32()/this.getGridUnitsZ();t.setCoords(this.getFalseZ(),this.getFalseZ()+e)}break;case 1:{const e=Number(_m.getLimit64())/this.getGridUnitsZ();t.setCoords(this.getFalseZ(),this.getFalseZ()+e)}break;case 2:t.setCoords(-Number.MAX_VALUE,Number.MAX_VALUE);break;default:t.setEmpty(),V("")}return t}getMGridRange(){const t=new et;switch(this.m_precision){case 0:{const e=_m.getLimit32()/this.getGridUnitsM();t.setCoords(this.getFalseM(),this.getFalseM()+e)}break;case 1:{const e=Number(_m.getLimit64())/this.getGridUnitsM();t.setCoords(this.getFalseM(),this.getFalseM()+e)}break;case 2:t.setCoords(-Number.MAX_VALUE,Number.MAX_VALUE);break;default:t.setEmpty(),V("")}return t}setTolerance(t,e){switch(e<0&&Y("tol < 0"),Number.isFinite(e)||Y("tol is not finite"),t){case 0:this.m_toleranceXY=e;break;case 1:this.m_toleranceZ=e;break;case 2:this.m_toleranceM=e;break;default:Y("cannot set tolerance for this attribute")}}setGridParams(t,e,n){Number.isFinite(t)&&Number.isFinite(e)&&Number.isFinite(n)||Y("grid params are not finite"),n<1&&Y("grid units cannot be smaller than 1.0"),this.m_falseX=t,this.m_falseY=e,this.m_unitsXY=n}setZParams(t,e){Number.isFinite(t)&&Number.isFinite(e)||Y("grid params are not finite"),e<1&&Y("grid units cannot be smaller than 1.0"),this.m_falseZ=t,this.m_unitsZ=e}setMParams(t,e){Number.isFinite(t)&&Number.isFinite(e)||Y("grid params are not finite"),e<1&&Y("grid units cannot be smaller than 1.0"),this.m_falseM=t,this.m_unitsM=e}setPrecision(t){}equals(t){return this===t||st(this.m_falseX,t.m_falseX)&&st(this.m_falseY,t.m_falseY)&&this.equalsWithoutFalseXY(t)}snapPrecision(){if(2===this.m_precision)return;const t=(t,e,n,r)=>{if(!Number.isFinite(e)||!Number.isFinite(n))return n;if(n<1)return 1;if(!r)return n;const i=Number(t)/n;return Math.trunc((e+i-e)*n)>t&&(n=t/(e+i-e)),Math.max(1,n)},e=Number(0===this.m_precision?Fa:Oa);this.m_unitsXY=t(e,this.m_falseX,this.m_unitsXY,!0),this.m_unitsXY=t(e,this.m_falseY,this.m_unitsXY,!0),this.m_unitsZ=t(e,this.m_falseZ,this.m_unitsZ,!1),this.m_unitsM=t(e,this.m_falseM,this.m_unitsM,!1)}verifyPrecision(){if(2===this.m_precision)return!0;const t=(t,e,n,r)=>{if(n<1)return!1;if(!Number.isFinite(e)||!Number.isFinite(n))return!1;if(!r)return!0;const i=Number(t)/n;return!(BigInt((e+i-e)*n)>t)},e=0===this.m_precision?Fa:Oa;return!!t(e,this.m_falseX,this.m_unitsXY,!0)&&(!!t(e,this.m_falseY,this.m_unitsXY,!0)&&(!!t(e,this.m_falseZ,this.m_unitsZ,!1)&&!!t(e,this.m_falseM,this.m_unitsM,!1)))}fixTolerance(){2!==this.m_precision&&(this.m_toleranceXY=Math.max(2/this.m_unitsXY,this.m_toleranceXY),this.m_toleranceZ=Math.max(2/this.m_unitsZ,this.m_toleranceZ),this.m_toleranceM=Math.max(2/this.m_unitsM,this.m_toleranceM),(Number.isNaN(this.m_falseX)||Number.isNaN(this.m_falseY))&&(this.m_falseX=this.m_falseY=Number.NaN))}equalsWithoutFalseXY(t){return this===t||this.m_unitsXY===t.m_unitsXY&&this.m_falseZ===t.m_falseZ&&this.m_unitsZ===t.m_unitsZ&&this.m_falseM===t.m_falseM&&this.m_unitsM===t.m_unitsM&&this.m_toleranceXY===t.m_toleranceXY&&this.m_toleranceZ===t.m_toleranceZ&&this.m_toleranceM===t.m_toleranceM&&this.m_precision===t.m_precision}setBestXyDomainFromEnvelope(t,e){}setBestZDomainFromZRange(t,e,n){}setBestMDomainFromMRange(t,e,n){}}function fm(){return um||(um=Em(3857,0,null,!0)),um}function pm(){return lm||(lm=Em(102100,0,null,!0)),lm}function dm(){return hm||(hm=Em(4326,0,null,!0)),hm}function ym(t){t.m_falseX=0,t.m_falseY=0,t.m_unitsXY=1,t.m_falseZ=0,t.m_unitsZ=1,t.m_falseM=0,t.m_unitsM=1,t.m_toleranceXY=100*at(),t.m_toleranceZ=100*at(),t.m_toleranceM=100*at(),t.m_precision=2}function Pm(t,e,n,r){const i=e instanceof ua;ym(t),t.m_precision=r,t.m_falseX=Number.NaN,t.m_falseY=Number.NaN;const s=1e-4,o=.001,a=i?e.m_csType:e.isPCS?2:1;if(1===a){const n=(0===r?1/18e5:1e-9)*(i?e.getOneDegreeGCSUnit():Math.PI/e.metersOrRadiansPerUnit/180);t.m_unitsXY=1/n}else if(2===a){const n=(0===r?o:s)*(i?e.getOneMeterPCSUnit():1/e.metersOrRadiansPerUnit);t.m_unitsXY=1/n}else Y("unrecognized cs type");t.m_falseM=-1e5,t.m_unitsM=1/(0===r?o:s),t.m_unitsM=Math.max(1,t.m_unitsM),t.m_unitsXY=Math.max(1,t.m_unitsXY);let m=0,c=0;0!==r&&1!==r||(m=2/t.m_unitsXY,c=2/t.m_unitsM),t.m_toleranceXY=Math.max(m,i?e.getUnitsPerMillimeter():2===a?.001/e.metersOrRadiansPerUnit:.001/(e.semiMajor*e.metersOrRadiansPerUnit)),t.m_toleranceM=Math.max(o,c),xm(t,n)}function xm(t,e){const n=1e-4,r=.001;if(t.m_falseZ=-1e5,e){const i=(0===t.m_precision?r:n)*e.getOneMeter();t.m_unitsZ=1/i}else t.m_unitsZ=1/(0===t.m_precision?r:n);t.m_unitsZ=Math.max(1,t.m_unitsZ);let i=0;0!==t.m_precision&&1!==t.m_precision||(i=2/t.m_unitsZ),t.m_toleranceZ=Math.max(e?e.getOneMeter()*r:r,i)}function Cm(t,e,n,r){ym(t),t.m_precision=r;const i=0===r?Fa:Oa,s=1e-4,o=.001;let a=1,m=1,c=.001;e&&(m=e.getUnitToBaseFactor()),e&&1===e.getUnitType()?(a=400*Math.PI/180,c=8.983152841195215e-9*Math.PI/180/m):(a=(0===r?o:s)*Number(i)*.5,c=o/m),a/=m,t.m_falseX=-a,t.m_falseY=-a,t.m_unitsXY=Number(i)/(2*a),t.m_falseM=-1e5,t.m_unitsM=1/(0===r?o:s),t.m_unitsM=Math.max(1,t.m_unitsM),t.snapPrecision();let u=0,l=0;0!==t.m_precision&&1!==t.m_precision||(l=2/t.m_unitsM,u=2/t.m_unitsXY),t.m_toleranceXY=Math.max(u,c),t.m_toleranceM=Math.max(o,l),xm(t,n)}function Em(t,e,n,r){if(!r&&e<=0&&!n){if(3857===t)return fm();if(102100===t)return pm();if(4326===t)return dm()}const i=new gm;let s,o=null;return ka()?(s=Ea(t),e<=0&&Gs()&&(e=t),e>0?o=null:e=0,i.setHorzProj_(s),i.m_vertcs=o):(s=zm(t),i.m_unit=s.isPCS?new Aa(s.metersOrRadiansPerUnit):new ee(s.metersOrRadiansPerUnit)),Pm(i.m_precisionDescriptor,s,o,1),i.m_bDefaultDescriptor=!0,i.m_userWKID=t,i.calculateHashCode(),i.initDbgName(),i}function Sm(t,e,n){return ot((t-e)*n)/n+e}let wm=null;const bm=3552713678800501e-30;function Tm(t,e,n){return t===e||Math.abs(t-e)<=n*(1+(Math.abs(t)+Math.abs(e))/2)}function vm(t,e){return Tm(t,e,bm)}function Im(t,e){return 0===t||Math.abs(t)<=e}function Dm(t){return Im(t,bm)}let Gm,Nm,Mm,Am,qm,Ym,Xm,Rm,Fm,Om,Lm;function Um(t){return{_this:t,get(){return this._this},reset(t){this._this=t},release(){const t=this._this;return this._this=null,t}}}let Hm=null;function zm(t){X(Hm);const e=Hm(t);return e.semiMajor=e.isPCS?Number.NaN:Wm(t),e}function Vm(t){Hm=t,X(Hm)}function jm(t){const e=t;Nm=e.PeFactory,X(Nm),Lm=e.PeGCSExtent,X(Lm),Fm=e.PeLineType,X(Fm),Om=e.PeMath,X(Om),Gm=e.PeDouble,X(Gm),Mm=e.PeDefs,X(Mm),Am=e.PeCSTransformations,X(Am),qm=e.PeGTTransformations,X(qm),Ym=e.PePCSInfo,X(Ym),Xm=e.PeGTlistExtended,X(Xm),Nm.initialize(),Rm=e.PeGTlistExtendedEntry,X(Rm),Mm.PE_TYPE_ANGUNIT=512,Mm.PE_STR_AUTH_ALL=2,Ym.PE_POLE_LINE_STRAIGHT=2,Ym.PE_POLE_LINE_CURVED=3,Mm.PE_PARM_LAM0=2,Mm.PE_PARM_PHI0=6,Mm.PE_PRJ_AZIMUTHAL_EQUIDISTANT=43032,Mm.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA=43033,Mm.PE_PRJ_ALBERS=43007,Mm.PE_PRJ_CYLINDRICAL_EQAREA=43034,Mm.PE_TYPE_VERTCS=8,Mm.PE_LINETYPE_GEODESIC=0,Mm.PE_LINETYPE_LOXODROME=1,Mm.PE_LINETYPE_GREAT_ELLIPTIC=2,Mm.PE_LINETYPE_NORMAL_SECTION=3,Xm.PE_GTLIST_OPTS_USABLE=1,Hm=null}function km(t,e,n,r){return e<=0?(n[0]=0,r[0]=0,!1):(n[0]=e,r[0]=e,!0)}function Bm(t){X(Ba());return!!Hm(t).isPCS||Zm(t)}function Zm(t){return Nm&&k("pe has been loaded. no-pe methods should not be used at this point."),wm||Qm(),wm.has(t)}const Km=/(?:ELLIPSOID|SPHEROID)\["(?:\w|[-()])+",(\d+\.\d+)/;function Wm(t){if(Nm&&k("pe has been loaded. no-pe methods should not be used at this point."),"string"==typeof t){const e=t.match(Km);e&&2===e.length||Y("bad gcs wkt");const n=Number.parseFloat(e[1]);return Number.isFinite(n)||Y("bad gcs wkt"),n}return wm||Qm(),wm.has(t)||k("gcs wkid not found"),wm.get(t)}function Qm(){wm=new Map;for(const t in $t){const e=Number.parseFloat(t),n=$t[t];if(Array.isArray(n))for(const t of n)wm.set(t,e);else wm.set(n,e)}te()}W(0),W(1);const Jm=Object.freeze(Object.defineProperty({__proto__:null,SpatialReference:gm,SpatialReferencePrecisionDescriptor:_m,create:Ka,createFromWKT:Wa,createImplFromPe:Qa,createLocal:tm,createWithNewPrecision:$a,getGCS:nm,getTempName:mm,hasNoPe:Ba,hasPe:ka,injectNoPe:ja,injectPe:Va,isInitialized:Za,isTempName:cm,isValidWkid:rm,isValidWkt:im,makeSpheroidData:Ha,snapGeometry:em,webMercator:fm,webMercator102100:pm,wgs84:dm},Symbol.toStringTag,{value:"Module"})),$m=Object.freeze(Object.defineProperty({__proto__:null,OperatorProject:Ri},Symbol.toStringTag,{value:"Module"}));export{mm as $,qe as A,Pe as B,Ee as C,fe as D,Co as E,Mm as F,ls as G,vi as H,Ae as I,ye as J,xo as K,aa as L,Xo as M,me as N,Rs as O,vm as P,lo as Q,Am as R,_m as S,eo as T,Eo as U,ka as V,em as W,Re as X,Le as Y,Ys as Z,Xs as _,Wa as a,Nm as a0,Po as a1,Ge as a2,im as a3,rm as a4,Gs as a5,$a as a6,Qt as a7,Jm as a8,$m as a9,qs as b,Ka as c,Fs as d,la as e,Oi as f,Ri as g,mo as h,ja as i,tm as j,ne as k,us as l,ao as m,Li as n,Gm as o,Om as p,Fm as q,dn as r,Ha as s,cs as t,zi as u,Vi as v,Ui as w,Hi as x,po as y,ue as z};
|
|
5
|
+
import{Q as t,g as e,h as n,a as r,P as i,aI as s,S as o,J as a,M as m,b as c,C as u,R as l,aJ as h,n as g,L as _,ac as f,m as p,c as d,aK as y,aL as P,F as x,aM as C,ap as E,aN as S,aO as w,aP as b,aQ as T,aR as v,E as I,t as D,K as G,k as N,aS as M,aT as A,O as q}from"./QuadraticBezier.js";import{t as Y,g as X,p as R,b as F,f as O,G as L,d as U,k as H,i as z,a as V,e as j,u as k,B,C as Z}from"./Geometry.js";import{aw as K,i as W,P as Q,d as J,T as $,c as tt,E as et,s as nt,r as rt,ax as it,Q as st,ay as ot,aa as at,e as mt,y as ct,a as ut,S as lt,v as ht,q as gt,m as _t,l as ft,b as pt,av as dt,D as yt,az as Pt,aA as xt,V as Ct,aB as Et,H as St,aC as wt,o as bt,aD as Tt,p as vt}from"./Transformation2D.js";import{b as It,c as Dt}from"./tslib.es6.js";import{c as Gt,b as Nt}from"./Clipper-a9xfvRaw.js";import{O as Mt}from"./OperatorDensify.js";import{O as At,o as qt,m as Yt}from"./OperatorSimplify.js";import{O as Xt}from"./OperatorClip.js";import{O as Rt}from"./OperatorIntersection.js";import{G as Ft}from"./SimpleGeometryCursor.js";import{m as Ot,d as Lt,b as Ut,e as Ht,l as zt,r as Vt,C as jt,f as kt,u as Bt,v as Zt}from"./CrackAndCluster-CfzXpEle.js";import{O as Kt}from"./OperatorUnion.js";import{O as Wt}from"./OperatorDifference.js";class Qt{constructor(t){if(this.m_geom=this.m_sr=null,t){if(t.move)return this.m_geom=t.move.m_geom,t.move.m_geom=null,this.m_sr=t.move.m_sr,void(t.move.m_sr=null);if(t.copy)return this.m_geom=t.copy.m_geom?t.copy.m_geom.clone():null,void(this.m_sr=t.copy.m_sr);t.geom&&(this.m_geom=t.geom),t.sr&&(this.m_sr=t.sr)}}getGeometry(){return this.m_geom}getSpatialReference(){return this.m_sr}setGeometry(t){this.m_geom=t}setSpatialReference(t){this.m_sr=t}equals(t,e){const n=t;return!(!this.m_sr&&n.m_sr)&&(!(this.m_sr&&!n.m_sr)&&(!(!this.m_geom&&n.m_geom)&&(!(this.m_geom&&!n.m_geom)&&(!(this.m_sr&&n.m_sr&&!this.m_sr.equals(n.m_sr))&&!(this.m_geom&&n.m_geom&&!this.m_geom.equals(n.m_geom,e))))))}clone(){let t=null;return this.m_geom&&(t=this.m_geom.clone()),new Qt({geom:t,sr:this.m_sr})}hasGeom(){return!!this.m_geom}}class Jt{constructor(t){this.m_factor=1,this.m_wkid=0,this.m_peUnit=null,t&&(this.m_peUnit=t,this.m_factor=t.getUnitFactor(),this.m_wkid=t.getCode(),this.m_wkid<0&&(this.m_wkid=0))}getName(){return this.m_peUnit.getName()}getID(){return this.m_wkid}getConversionFactor(t){return this.getUnitType()!==t.getUnitType()&&Y("unit type mismatch"),this.getUnitToBaseFactor()/t.getUnitToBaseFactor()}getUnitToBaseFactor(){return this.m_factor}getHashCode(){return K(W(this.getUnitType()),W(this.getUnitToBaseFactor()))}equals(t){return!!t&&(this.getUnitType()===t.getUnitType()&&this.getUnitToBaseFactor()===t.getUnitToBaseFactor()&&this.getID()===t.getID()&&this.getName()===t.getName())}static isValidWkid(t){return!1}}const $t={330:104878,500:104879,1300:104899,1450:104986,2230:104988,3800:104978,5e3:104919,6200:104906,8200:104909,9500:104927,9600:104977,1e4:[104911,104936],11e3:104941,11080:104872,11100:104907,12e3:104920,12400:104995,13e3:104948,14e3:[104923,104989],15e3:[104913,104954],15100:104976,16e3:[104926,104931],18e3:[104922,104982],21e3:104947,21500:104877,27e3:[104950,104957],29e3:104964,3e4:104921,31e3:104949,33e3:104946,4e4:[104914,104967],40600:104897,41900:104937,42e3:104951,43100:104993,49300:104924,50100:104939,54e3:104955,58200:104981,59500:104930,74e3:104961,77e3:104956,79e3:104962,83500:104910,85e3:104917,88800:104934,89200:104985,96e3:104997,104e3:104963,106500:104898,11e4:104938,133e3:104932,135e3:104983,17e4:104965,198200:104987,198630:104935,208e3:104966,235800:104952,249400:104929,252100:104980,255e3:104973,47e4:104972,529800:104942,531e3:104996,56e4:104928,561400:104979,578900:104945,584700:104959,593e3:104970,606e3:104999,718e3:104933,745700:104984,761400:104953,763500:104994,764e3:104940,788900:104958,1188300:104998,1195e3:104969,1352600:104968,1560800:104874,1562090:104915,1737400:104903,1821460:104918,1821490:104876,2409300:104912,2410300:104873,2439400:104974,2439700:104900,2575e3:104943,2631200:104875,2632345:104916,3393400:104904,3396190:[104905,104971],6051e3:104901,6051800:104902,637e4:104128,6370997:[4052,37008],6371e3:4035,6371007:4047,6371228:[4053,10346],6376045:[8042,8043],6376523:[4027,4901,4902],6376896:37007,6378135:[4122,4322,4324,4720,4985,4987],6378136:[4740,4923,7678,7680,9474,9475,104017,104018],6378137:[3823,3824,3888,3889,4017,4019,4023,4031,4040,4046,4055,4074,4075,4080,4081,4121,4126,4130,4133,4140,4141,4148,4151,4152,4163,4166,4167,4170,4171,4172,4173,4176,4180,4189,4190,4258,4269,4283,4318,4319,4326,4463,4466,4469,4470,4480,4482,4483,4490,4557,4558,4612,4617,4619,4624,4627,4659,4661,4667,4669,4670,4674,4686,4687,4693,4694,4702,4737,4742,4747,4749,4750,4755,4756,4757,4758,4759,4761,4762,4763,4764,4765,4883,4885,4887,4889,4893,4895,4898,4907,4909,4921,4925,4927,4929,4931,4933,4935,4937,4939,4941,4943,4945,4947,4949,4951,4953,4955,4957,4959,4961,4963,4965,4967,4971,4975,4977,4979,4981,4983,4989,4997,4999,5012,5013,5245,5246,5251,5252,5263,5264,5323,5324,5340,5342,5353,5354,5359,5360,5364,5365,5370,5371,5372,5373,5380,5381,5392,5393,5488,5489,5545,5546,5592,5593,5885,5886,6134,6135,6310,6311,6318,6319,6321,6322,6324,6325,6364,6365,6667,6668,6705,6706,6782,6783,6980,6982,6983,6987,6989,6990,7034,7035,7036,7037,7038,7039,7040,7041,7042,7072,7073,7084,7085,7086,7087,7133,7135,7136,7138,7139,7372,7373,7657,7659,7661,7663,7665,7685,7686,7797,7798,7816,7843,7844,7880,7881,7885,7886,7900,7901,7902,7903,7904,7905,7906,7907,7908,7909,7910,7911,7912,7915,7917,7919,7921,7923,7925,7927,7929,7931,8085,8086,8231,8232,8235,8237,8239,8240,8244,8246,8248,8249,8251,8252,8254,8255,8399,8403,8426,8427,8449,8542,8544,8545,8684,8685,8698,8699,8817,8818,8860,8888,8899,8900,8901,8902,8906,8907,8916,8918,8920,8922,8924,8926,8928,8930,8932,8934,8936,8938,8940,8942,8944,8946,8948,8949,8972,8973,8974,8975,8976,8977,8978,8979,8980,8981,8982,8983,8984,8985,8986,8987,8988,8989,8990,8991,8992,8993,8994,8995,8996,8997,8998,8999,9e3,9002,9003,9005,9006,9008,9009,9011,9012,9013,9014,9016,9017,9018,9019,9053,9054,9055,9056,9057,9059,9060,9061,9062,9063,9064,9065,9066,9067,9068,9069,9071,9072,9074,9075,9139,9140,9147,9148,9152,9153,9183,9184,9293,9294,9299,9308,9309,9332,9333,9364,9372,9379,9380,9384,9453,9469,9470,9546,9547,9695,9696,9701,9702,9739,9754,9755,9758,9763,9776,9777,9778,9779,9781,9782,9783,9784,9866,9871,9939,9964,9969,9974,9989,9990,10175,10177,10178,10185,10191,10196,10204,10209,10214,10219,10224,10229,10237,10272,10277,10283,10284,10298,10299,10300,10304,10305,10307,10309,10310,10311,10312,10327,10328,10413,10414,10468,10474,10475,10570,10571,10605,10606,10623,10628,20033,20040,20041,20045,20046,104009,104010,104011,104012,104013,104014,104015,104016,104019,104020,104021,104022,104024,104027,104028,104050,104100,104107,104108,104110,104111,104114,104115,104116,104117,104118,104119,104120,104121,104122,104123,104124,104129,104133,104134,104137,104141,104142,104143,104144,104145,104179,104180,104181,104182,104183,104184,104185,104186,104199,104223,104257,104258,104259,104260,104286,104287,104602,104613,104644,104645,104646,104647,104653,104804,104896,104991],6378140:4610,6378145:[4025,4276,4760,4891,37001],6378150:37003,6378155:[37004,37207],6378160:[3821,4003,4021,4036,4202,4203,4237,4238,4291,4618,4708,5527,37231,104023,104136],6378166:37002,6378200:[4020,4229,4286,4303,4706],6378245:[4024,4147,4164,4178,4179,4191,4200,4205,4214,4284,4317,4555,4676,4677,4678,4991,4993,5560,5561,37257,104135],6378270:[4732,37005,37229],6378273:[4054,10345],6378300:[4029,4168,4174],6378388:[4022,4123,4153,4154,4158,4159,4160,4161,4165,4181,4182,4183,4184,4185,4192,4194,4195,4196,4199,4204,4207,4208,4215,4218,4221,4224,4225,4230,4231,4233,4235,4236,4247,4248,4249,4254,4255,4259,4264,4265,4271,4272,4274,4285,4287,4288,4292,4297,4309,4311,4313,4316,4472,4475,4611,4614,4615,4616,4621,4622,4623,4625,4626,4628,4629,4630,4631,4632,4633,4636,4637,4639,4641,4642,4643,4644,4645,4646,4658,4660,4662,4663,4664,4665,4668,4672,4673,4684,4688,4689,4690,4691,4692,4698,4704,4705,4707,4709,4710,4711,4712,4714,4715,4716,4718,4719,4721,4722,4724,4725,4727,4728,4729,4730,4733,4734,4735,4739,4741,4753,4754,4802,4803,4806,4809,4810,4823,4824,4900,5524,6883,8428,8430,8431,9248,9251,9253,9403,9893,10158,10249,10252,37201,37204,37205,37212,37213,37214,37215,37216,37217,37218,37219,37221,37222,37224,37226,37227,37230,37232,37233,37234,37235,37237,37238,37241,37242,37245,37246,37247,37249,37250,37251,37253,37259,104104,104106,104125,104126,104127,104130,104138,104248],6378523:104786,24764e3:104960,25559e3:104944,60268e3:104925,71492e3:104908,6957e5:104975,6377397.155:[3819,3906,4004,4120,4124,4125,4149,4150,4156,4162,4211,4219,4257,4262,4280,4289,4294,4295,4301,4306,4308,4312,4314,4613,4666,4745,4746,4801,4804,4805,4808,4813,4814,4815,4818,4820,4904,5132,5228,5229,5681,5830,8351,9267,10268,37255,104101,104102,104105,104131,104648,104696,104697,104990,104992],6377563.396:[4001,4188,4277,4278,4279],6377340.189:[4002,4299,4300],6377492.018:[4005,4273,4817],6377483.865280418:[4006,4293],6378293.645208759:[4007,4157,4302,4738,5464],6378206.4:[4008,4127,4128,4129,4135,4136,4137,4138,4139,4169,4216,4242,4253,4267,4608,4609,4638,4675,4683,4695,4717,4723,4726,4995,5451,5467,37220,37239,37243,37252,37260,104e3,104109,104112,104113,104132],6378450.047:[4009,4268],6378300.789:[4010,4281],6378249.2:[4011,4014,4155,4193,4206,4213,4223,4226,4227,4228,4252,4261,4266,4275,4282,4296,4304,4310,4315,4671,4807,4811,4816,4821,37223,37225,104139,104140,104261,104304],6378249.145:[4012,4013,4132,4134,4142,4143,4175,4197,4198,4201,4209,4210,4212,4220,4222,4232,4234,4246,4250,4251,4256,4260,4263,4270,4305,4307,4600,4601,4602,4603,4604,4605,4606,4607,4620,4679,4680,4696,4697,4699,4700,4701,4703,4713,4731,4736,4743,4744,4812,4819,6881,6882,6892,6894,8694,37206,37208,37211,37228,37240,37254,104025,104026,104103,104305],6377276.345:[4015,4131,4144,4239,4240,4244,4682,5233,6207,37202,104256,104664,104693],6377298.556:[4016,4298],6377304.063:[4018,4245],6378298.3:[4028,4903],6378136.2:4032,6378136.3:4033,6378249.144808011:[4034,4241],20922931.8:[4042,4243],6377301.243:[4044,4145,37203],6377299.151:[4045,4146],6377019.27:[4657,10256,10260,10265],6378306.3696:[4748,4752],6377295.664:[4751,37006],6378136.5:[7682,7683],6371008.7714:104047,6378418.941:[104700,104726,104760],6378586.581:[104701,104743],6378505.809:104702,6378544.823:104703,6378490.569:104704,6378470.757:[104705,104776],6378403.701:[104706,104750],6378434.181:[104707,104724,104739,104764],6378454.907:104708,6378400.653:104709,6378567.378:104710,6378546.957:[104711,104717,104780],6378476.853:[104712,104736],6378411.321:[104713,104728],6378647.541:[104714,104715],6378514.953:[104716,104782],6378421.989:[104718,104770],6378481.425:[104719,104753,104774,104781],6378518.001:[104720,104725],6378521.049:[104721,104723,104731,104745,104748],6378464.661:104722,6378436.619:104727,6378574.389:[104729,104730],6378472.281:[104732,104756],6378498.189:[104733,104746],6378449.421:[104734,104766],6378525.621:[104735,104754],6378466.185:104737,6378496.665:104738,6378643.579:104740,6378559.758:104741,6378414.369:[104742,104763,104772],6378441.801:104744,6378502.761:[104747,104759,104773,104775],6378617.061:104749,6378624.681:[104751,104765],6378468.623:104752,6378445.763:[104755,104758,104761],6378670.401:104757,6378438.753:104762,6378543.909:104767,6378605.783:104768,6378540.861:104769,6378443.325:[104771,104784],6378548.481:104777,6378463.746:104778,6378426.561:104779,6378453.688:104783,6378530.193:104785,6378376.271:[104800,104828],6378471.92:104801,6378472.931:104802,6378411.351:104803,6378380.991:104805,6378414.96:104806,6378345.09:[104807,104819,104844,104870],6378412.542:104808,6378470.401:104809,6378376.331:104810,6378379.031:104811,6378407.621:104812,6378376.811:[104813,104827],6378313.92:104814,6378414.93:104815,6378413.021:104816,6378380.381:104817,6378530.851:104818,6378591.521:104820,6378378.881:104821,6378408.481:[104822,104832],6378375.601:[104823,104838],6378408.041:104824,6378655.071:104825,6378409.151:104826,6378315.7:[104829,104840,104845,104851],6378285.86:[104830,104835,104859],6378379.301:104831,6378560.121:104833,6378531.821:104834,6378500.6:104836,6378376.041:104837,6378406.601:104839,6378438.991:104841,6378345.42:104842,6378593.86:104843,6378381.271:[104846,104847],6378413.671:104848,6378344.377:104849,6378563.891:104850,6378408.091:104852,6378377.671:104853,6378472.751:104854,6378412.511:104855,6378407.281:104856,6378534.451:104857,6378406.051:104858,6378532.921:104860,6378380.091:104861,6378408.941:104862,6378624.171:104863,6378377.411:104864,6378474.591:104865,6378407.141:104866,6378376.871:104867,6378375.251:104868,6378405.971:104869,6378437.651:104871};function te(){for(const t in $t)delete $t[t]}class ee extends Jt{constructor(t){if("number"==typeof t)return super(),this.m_factor=t,void(this.m_wkid=0);super(t)}getUnitType(){return 1}convertFromRadians(t){return t/this.getUnitToBaseFactor()}convertToRadians(t){return t*this.getUnitToBaseFactor()}}function ne(t){return new Aa}function re(t){return t.getType()===Mm.PE_TYPE_LINUNIT?new Aa(t):t.getType()===Mm.PE_TYPE_ANGUNIT?new ee(t):void Y("peUnit")}function ie(t){const e=Um(null);return t.getType()===Mm.PE_TYPE_PROJCS||t.getType()===Mm.PE_TYPE_GEOGCS?e.reset(t.getUnit()):Y("PE_coord_sys"),e.get()||V("cannot create units from coord sys"),re(e.get())}class se{constructor(e,n,r){void 0===e?(this.x=new St,this.y=new St,this.z=new St):e instanceof t?(this.x=new St(e.x),this.y=new St(e.y),this.z=new St(e.z)):e instanceof St?(this.x=e.clone(),this.y=n.clone(),this.z=r.clone()):Y("EPoint3D constructor")}dotProduct(t){return this.x.mulE(t.x).addE(this.y.mulE(t.y)).addE(this.z.mulE(t.z))}crossProduct(t){return new se(this.y.mulE(t.z).subE(this.z.mulE(t.y)),this.z.mulE(t.x).subE(this.x.mulE(t.z)),this.x.mulE(t.y).subE(this.y.mulE(t.x)))}crossProductVector(t){const e=this.y.mulE(t.z).subE(t.y.mulE(this.z)),n=t.x.mulE(this.z).subE(this.x.mulE(t.z)),r=this.x.mulE(t.y).subE(t.x.mulE(this.y));return new se(e,n,r)}sqrLength(){return this.x.mulE(this.x).addE(this.y.mulE(this.y)).addE(this.z.mulE(this.z))}length(){return this.sqrLength().sqrt()}static distance(t,e){return t.sub(e).length()}negate(){return new se(this.x.negate(),this.y.negate(),this.z.negate())}add(t){return new se(this.x.addE(t.x),this.y.addE(t.y),this.z.addE(t.z))}sub(t){return new se(this.x.subE(t.x),this.y.subE(t.y),this.z.subE(t.z))}subThis(t){return this.x.subThisE(t.x),this.y.subThisE(t.y),this.z.subThisE(t.z),this}addThis(t){return this.x.addThisE(t.x),this.y.addThisE(t.y),this.z.addThisE(t.z),this}mul(t){return new se(this.x.mulE(t),this.y.mulE(t),this.z.mulE(t))}div(t){return new se(this.x.divE(t),this.y.divE(t),this.z.divE(t))}eq(t){return this.x.eq(t.x)&&this.y.eq(t.y)&&this.z.eq(t.z)}isZero(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()}value(){return t.construct(this.x.value(),this.y.value(),this.z.value())}}class oe{constructor(e){this.m_origin=new t,this.m_normal=new t,this.m_axisX=new t,this.m_axisY=new t,X(0)}assign(t){return X(0),this}set(t,e,n,r){X(0)}setFromPoints(t,e,n){return X(0),!1}getCoord(t,e){return X(0),{}}getCoord2D(t){return X(0),{}}getCoordX(t,e){return X(0),0}getCoordY(t,e){return X(0),0}getCoordZ(t,e){return X(0),0}setPreferredAxisX(t){X(0)}getOrigin(){return X(0),{}}getNormal(){return X(0),{}}getAxisX(){return this.m_axisX.clone()}getAxisY(){return this.m_axisY.clone()}setAxisX(t,e=!1){X(0)}setAxisY(t,e=!1){X(0)}recalculateAxisY(){X(0)}setOrigin(t){X(0)}setNormal(t,e){X(0)}intersect(t,e){return X(0),!1}intersectLine(t){return X(0),0}intersectLineEx(t,e){return X(0),0}closestCoordinate(t){return X(0),{}}projectVector(t){return X(0),{}}signedDistance(t){return X(0),0}distance(t){return X(0),0}}function ae(t,e){return!1}function me(t,e,n,r,i=100,s=ae){let o,a,m,c,u,l,h,g,_;X(r>0);let f,p,d,y=0,P=0;const x=dt();e>n&&(n=pt(e,e=n));const C=t(e),E=t(n);C<E?(o=a=m=e,c=u=l=C):(o=a=m=n,c=u=l=E);let S=0;for(;S<i&&(d=.5*(n-e),_=e+d,f=r*(Math.abs(o)+.25),p=2*f,!(s(o,c)||Math.abs(o-_)<=p-d));++S){if(Math.abs(P)>f){const t=(o-a)*(c-l);let r=(o-m)*(c-u),i=(o-m)*r-(o-a)*t;r=2*(r-t),r>0&&(i=-i),r=Math.abs(r);const s=P;P=y,Math.abs(i)>=Math.abs(r*s*.5)||i<=r*(e-o)||i>=r*(n-o)?(P=o>=_?e-o:n-o,y=dt()*P):(y=i/r,g=o+y,(g-e<p||n-g<p)&&(y=_-o<0?-Math.abs(f):Math.abs(f)))}else P=o>=_?e-o:n-o,y=P*x;g=o+y,h=t(g),h<c?(g>=o?e=o:n=o,m=a,a=o,o=g,l=u,u=c,c=h):(g<o?e=g:n=g,h<=u||a===o?(m=a,a=g,l=u,u=h):(h<=l||m===o||m===a)&&(m=g,l=h))}return J(o,c)}function ce(t,e,n){if(t>n){t-=Math.ceil((t-n)/vt)*vt}else if(t<e){t+=Math.ceil((e-t)/vt)*vt}return t}function ue(t,e,n){return le(t,e,n,0)}function le(t,e,n,r){const i=n.x,s=n.y;return ge(t,e,Math.cos(i),Math.sin(i),Math.cos(s),Math.sin(s),r)}function he(t,e,n,r,i,s){return ge(t,e,n,r,i,s,0)}function ge(e,n,r,i,s,o,a){const m=e/Math.sqrt(1-n*o*o),c=m+a,u=c*s*r,l=c*s*i,h=(m*(1-n)+a)*o;return t.construct(u,l,h)}function _e(t,e,n){const r=new St,i=new St,s=new St,o=new St;r.setCos(n.x),i.setSin(n.x),s.setCos(n.y),o.setSin(n.y);const a=o.negate().mulE(o.mul(e)).add(1).sqrt(),m=new St(t).divE(a),c=m.mulE(s).mulE(r),u=m.mulE(s).mulE(i),l=m.mul(1-e).mulE(o);return new se(c,u,l)}function fe(t,e,n){const r=n.x,i=n.y,s=n.z,o=Math.atan2(i,r),a=Math.sqrt(r*r+i*i),m=Math.atan2(s,(1-e)*a);return Q.construct(o,m)}function pe(t,e,n){const r=1-e,i=t/Math.sqrt(mt(n.x)+mt(n.y)+mt(n.z)/r);return n.mul(i)}function de(e,n,r,i,s){const o=ue(e,n,r),a=ue(e,n,i);return fe(e,n,t.lerp(o,a,s))}function ye(e,n,r){const i=new t;return i.setCrossProductVector(n,r),Math.abs(Math.atan2(i.length(),n.dotProduct(r)))*e}function Pe(e,n,r,i,s){const o=r.getUnitVector(),a=i.getUnitVector(),m=n.getUnitVector(),c=new t;if(c.setCrossProductVector(o,a),!c.isZero()){c.normalizeThis();const t=m.sub(c.mul(c.dotProduct(m)));if(!t.isZero()){t.normalizeThis();const n=o.add(a).mul(.5);if(n.dotProduct(t)>n.dotProduct(o)){const n=Math.abs(c.dotProduct(m)),r=Math.asin(n);return s.assign(t.getUnitVector().mul(e)),r*e}}}const u=ye(1,o,m),l=ye(1,a,m);return u<=l?(s.assign(r),u*e):(s.assign(i),l*e)}function xe(t,e,n,r){const i={stack:[],error:void 0,hasError:!1};try{const s=It(i,new Gm,!1);return Fm.geodeticDistance(t,e,n.x,n.y,r.x,r.y,s,null,null,Mm.PE_LINETYPE_GEODESIC),s.val}catch(s){i.error=s,i.hasError=!0}finally{Dt(i)}}function Ce(e,n,r,i,s){switch(X(r.isFinite()&&i.isFinite()),s){case 0:return xe(e,n,r,i);case 1:return we(e,n,r);case 2:case 3:{const s=ue(e,n,r),o=ue(e,n,i);return t.distance(s,o)}default:H("")}}function Ee(e,n,r,i,s,o=0,a){if(2===o||3===o)return Se(e,n,r,i,s,3===o,a);const m=fe(e,n,r),c=r=>{const a=fe(e,n,t.lerp(i,s,r));return Ce(e,n,m,a,o)},u=t.distance(i,s);if(u>0){const r=Xe(e,u),{first:o,second:m}=me(c,0,1,r);return a&&a.assign(pe(e,n,t.lerp(i,s,o))),J(o,m)}{const t=c(0);return a&&a.assign(i),J(.5,t)}}function Se(e,n,r,i,s,o=!1,a){const m=pe(e,n,r);if(o){const o=new oe({pt0:new t(0,0,0),pt1:i,pt2:s}),c=o.closestCoordinate(r),u=o.closestCoordinate(i),l=o.closestCoordinate(s),h=Q.getClosestCoordinate(u,l,c),g=pe(e,n,t.lerp(i,s,h)),_=t.distance(g,m);return a&&a.assign(g),J(h,_)}const c=r=>{const o=pe(e,n,t.lerp(i,s,r));return t.distance(o,m)},u=t.distance(i,s);if(u>0){const r=Xe(e,u),{first:o,second:m}=me(c,0,1,r);return a&&a.assign(pe(e,n,t.lerp(i,s,o))),J(o,m)}{const e=t.distance(r,i);return a&&a.assign(r),J(.5,e)}}function we(t,e,n,r){const i={stack:[],error:void 0,hasError:!1};try{const r=It(i,new Gm,!1);return Fm.greatEllipticDistance(t,e,n.x,n.y,n.x,n.y,r,null,null),r.val}catch(s){i.error=s,i.hasError=!0}finally{Dt(i)}}function be(e,n,r,i,s){if(Math.abs(r.x-i.x)>Math.PI)return Number.NaN;if(Math.abs(r.y)>gt||Math.abs(i.y)>gt)return Number.NaN;if((Math.abs(r.y)===gt||Math.abs(i.y)===gt)&&r.x!==i.x)return Number.NaN;const{first:o,second:a}=wt(r.x,i.x);let m=s;m=ce(m,o,a);if(!et.construct(r.x,i.x).containsCoordinate(m))return Number.NaN;const c=E.constructPoint2D(r),u=E.constructPoint2D(i),l=_e(1,n,c),h=_e(1,n,u),g=l.crossProductVector(h);if(g.z.isZero()){return r.y}const _=g.x.divE(g.z.negate()),f=g.y.divE(g.z.negate()),p=_.mulE(_).addE(f.mulE(f)).sqrt();if(p.isZero()||_.isZero()&&f.isZero()){return r.y}const d=Math.atan2(f.value(),_.value());let y=Math.atan2(p.value()*Math.cos(d-m),1-n);const P=ue(1,n,Q.construct(m,y)),x=t.construct(P.x,P.y,-P.z),C=g.value().dotProduct(P),S=g.value().dotProduct(x);return Math.abs(S)<Math.abs(C)&&(y=-y),y}function Te(t,e,n,r,i,s){if(s[0]=Number.NaN,s[1]=Number.NaN,Math.abs(n.x-r.x)>Math.PI)return 0;if(Math.abs(n.y)>gt||Math.abs(r.y)>gt)return 0;if((Math.abs(n.y)===gt||Math.abs(r.y)===gt)&&n.x!==r.x)return 0;if(Math.abs(i)>=gt)return 0;if(n.y>0&&r.y>0&&n.y>i&&r.y>i||n.y<0&&r.y<0&&n.y<i&&r.y<i)return 0;const o=E.constructPoint2D(n),a=E.constructPoint2D(r),m=_e(1,e,o),c=_e(1,e,a),u=m.crossProductVector(c);if(u.z.isZero()){return et.construct(n.y,r.y).containsCoordinate(i)?(s[0]=n.x,1):0}const l=u.x.divE(u.z.negate()),h=u.y.divE(u.z.negate()),g=l.mulE(l).addE(h.mulE(h)).sqrt();if(g.isZero()||l.isZero()&&h.isZero())return 0===i?(s[0]=n.x,s[1]=r.x,2):0;const _=(1-e)*Math.tan(i)/g.value();if(Math.abs(_)>1)return 0;const f=Math.acos(_),p=Math.atan2(h.value(),l.value()),d=p-f;let y=p+f;const P=Math.min(n.x,r.x),x=Math.max(n.x,r.x);ce(d,P,x),0!==i?ce(y,P,x):y=d;let C=0;return P<=d&&d<=x&&(s[C]=d,C++),y!==d&&P<=y&&y<=x&&(s[C]=y,C++),C}function ve(t,e){e[0]>.5*Math.PI?(t[0]+=Math.PI,e[0]=Math.PI-e[0]):e[0]<.5*-Math.PI&&(t[0]-=Math.PI,e[0]=-Math.PI-e[0]),X(e[0]>=.5*-Math.PI&&e[0]<=.5*Math.PI)}function Ie(t,e){return t*Math.sqrt(1-e)}function De(t){return 1-t}function Ge(t,e,n,r,i){r=ft(r,-gt,gt),i=ft(i,-gt,gt);const s=gt-.03;let o;o=r>s&&i>s||r<-s&&i<-s?Ne(t,r,i):Me(t,i)-Me(t,r);return.5*(n-e)*o*De(t)}function Ne(t,e,n){let r=1;if(e<0&&(r=-1,e=-e,n=-n),0!==t){const i=t*t,s=i*t,o=[1,(1+11*t)/12,(1+118*t+241*i)/360,(1+1089*t+10419*i+8651*s)/20160,(1+9836*t+318246*i+1027436*s+458881*(s*t))/1814400],a=e=>{let n=0;const r=mt(e)/(t-1);for(let t=o.length-1;t>=0;--t)n=o[t]+n*r;return n*=-mt(e/(1-t)),n},m=a(gt-e);return(a(gt-n)-m)*r}{const t=gt-e,i=gt-n,s=-4*mt(Math.sin(t/2));return(-4*mt(Math.sin(i/2))-s)*r}}function Me(t,e){if(0===e)return 0;const n=Math.sin(e);let r=n,i=n;if(0!==t){r/=1-t*n*n;const e=Math.sqrt(t);i=n*ct(e*n)}return r+i}function Ae(t,e){return t/Math.sqrt(1-e)}function qe(t,e){return(1-e)*t}function Ye(t,e,n){const r=n/(2*qe(t,e)),i=r*r;return n*(1-i*(.16666666666666666-.008333333333333333*i))}function Xe(t,e){if(0!==e){const n=t*Tt()/e;return Math.min(n,1e-10)}return 0}function Re(t,e,n,i,s,o=!0){switch(Le(i)){case 0:break;case 1:Y("relation string length has to be 9 characters");break;default:Y("relation string")}if(o){const r=$e(i,t.getDimension(),e.getDimension());if(0!==r)return dn(t,e,n,r,s)}let m=0;if("number"==typeof n)m=n;else{const i=r.constructEmpty();t.queryEnvelope(i);const s=r.constructEmpty();e.queryEnvelope(s);const o=r.constructEmpty();o.setCoords({env2D:i}),o.mergeEnvelope2D(s),m=a(n,o,!1)}const c=ln(t,m),u=ln(e,m);if(c.isEmpty()||u.isEmpty())return Je(c,u,i);const l=c.getGeometryType(),h=u.getGeometryType();let g=!1;switch(l){case L.enumPolygon:switch(h){case L.enumPolygon:g=Ue(c,u,m,i,s);break;case L.enumPolyline:g=He(c,u,m,i,s);break;case L.enumPoint:g=Be(c,u,m,i);break;case L.enumMultiPoint:g=ze(c,u,m,i,s)}break;case L.enumPolyline:switch(h){case L.enumPolygon:g=He(u,c,m,hn(i),s);break;case L.enumPolyline:g=Ve(c,u,m,i,s);break;case L.enumPoint:g=Ze(c,u,m,i,s);break;case L.enumMultiPoint:g=je(c,u,m,i,s)}break;case L.enumPoint:switch(h){case L.enumPolygon:g=Be(u,c,m,hn(i));break;case L.enumPolyline:g=Ze(u,c,m,hn(i),s);break;case L.enumPoint:g=We(c,u,m,i);break;case L.enumMultiPoint:g=Ke(u,c,m,hn(i))}break;case L.enumMultiPoint:switch(h){case L.enumPolygon:g=ze(u,c,m,hn(i),s);break;case L.enumPolyline:g=je(u,c,m,hn(i),s);break;case L.enumMultiPoint:g=ke(c,u,m,i,s);break;case L.enumPoint:g=Ke(c,u,m,i)}break;default:g=!1}return g}function Fe(t,e,n,i){const s=new cn;s.resetMatrix_(),s.setPredicates_("T*****F**"),s.setAreaAreaPredicates_();const o=r.constructEmpty(),a=r.constructEmpty();t.queryEnvelope(o),e.queryEnvelope(a);let m=!1;if(Cn(o,a,n)&&(s.areaAreaDisjointPredicates_(t,e),m=!0),m||En(t,e),m){return Qe(s.m_matrix,s.m_scl)}let l=new c,h=l.addGeometry(t),_=l.addGeometry(e),f=null,p=0;if(t.hasNonLinearSegments()||e.hasNonLinearSegments()){f=new jt;const t=l.getEnvelope2D(i),e=Lt(n,t);p=kt(e,0),Ut(l,e,n,12e3,f,null,i)}Ht(l,new u(n,0).add(p),i,!1,!1);const d=l.getGeometry(_).getBoundary();if(l.filterClosePoints(0,!0,!0,!1,g),Yt(l,h,-1,!1,g,i),0===l.getPointCount(h))return!1;Yt(l,_,-1,!1,g,i),s.setEditShape_(l,i);const y=0===l.getPointCount(_);if(!y){s.computeMatrixTopoGraphHalfEdges_(h,_),s.m_topoGraph.removeShape();const t=Qe(s.m_matrix,s.m_scl);if(!t)return t}const P=l.getGeometry(h);l=new c,h=l.addGeometry(P),_=l.addGeometry(d),s.setEditShape_(l,i),s.m_predicateCount=0,s.resetMatrix_(),s.setPredicates_(y?"T*****F**":"******F**"),s.setAreaLinePredicates_(),s.computeMatrixTopoGraphHalfEdges_(h,_),s.m_topoGraph.removeShape();return Qe(s.m_matrix,s.m_scl)}function Oe(t,e,n,i){const s=new cn;s.resetMatrix_(),s.setPredicates_("T*****F**"),s.setAreaLinePredicates_();const o=r.constructEmpty(),a=r.constructEmpty();t.queryEnvelope(o),e.queryEnvelope(a);let m=!1;if(Cn(o,a,n)&&(s.areaLineDisjointPredicates_(t,e),m=!0),m||En(t,e),m){return Qe(s.m_matrix,s.m_scl)}const l=new c,h=l.addGeometry(t),g=l.addGeometry(e);if(s.setEditShapeCrackAndCluster_(l,new u(n,0),i),0===l.getPointCount(h))return!1;s.computeMatrixTopoGraphHalfEdges_(h,g),s.m_topoGraph.removeShape();return Qe(s.m_matrix,s.m_scl)}function Le(t){if(9!==t.length)return 1;for(let e=0;e<9;e++){const n=t[e];if("*"!==n&&"T"!==n&&"F"!==n&&"0"!==n&&"1"!==n&&"2"!==n)return 2}return 0}function Ue(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setAreaAreaPredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let l=!1;if(Cn(a,m,n)&&(o.areaAreaDisjointPredicates_(t,e),l=!0),l||En(t,e),!l){const r=new c,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new u(n,0),s),o.computeMatrixTopoGraphHalfEdges_(i,a),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function He(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setAreaLinePredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let l=!1;if(Cn(a,m,n)&&(o.areaLineDisjointPredicates_(t,e),l=!0),l||En(t,e),!l){const r=new c,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new u(n,0),s),o.m_clusterIndexB=o.m_topoGraph.createUserIndexForClusters(),mn(a,o.m_topoGraph,o.m_clusterIndexB),o.computeMatrixTopoGraphHalfEdges_(i,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexB),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function ze(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setAreaPointPredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let l=!1;if(Cn(a,m,n)&&(o.areaPointDisjointPredicates_(t),l=!0),l||En(t,e),!l){const r=new c,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new u(n,0),s),o.computeMatrixTopoGraphClusters_(i,a),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function Ve(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setLineLinePredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let l=!1;if(Cn(a,m,n)&&(o.lineLineDisjointPredicates_(t,e),l=!0),l||En(t,e),!l){const r=new c,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new u(n,0),s),o.m_clusterIndexA=o.m_topoGraph.createUserIndexForClusters(),o.m_clusterIndexB=o.m_topoGraph.createUserIndexForClusters(),mn(i,o.m_topoGraph,o.m_clusterIndexA),mn(a,o.m_topoGraph,o.m_clusterIndexB),o.computeMatrixTopoGraphHalfEdges_(i,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexA),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexB),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function je(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setLinePointPredicates_();const a=r.constructEmpty(),m=r.constructEmpty();t.queryEnvelope(a),e.queryEnvelope(m);let l=!1;if(Cn(a,m,n)&&(o.linePointDisjointPredicates_(t),l=!0),l||En(t,e),!l){const r=new c,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new u(n,0),s),o.m_clusterIndexA=o.m_topoGraph.createUserIndexForClusters(),mn(i,o.m_topoGraph,o.m_clusterIndexA),o.computeMatrixTopoGraphClusters_(i,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexA),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function ke(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setPointPointPredicates_();const a=new r,m=new r;t.queryEnvelope(a),e.queryEnvelope(m);let l=!1;if(Cn(a,m,n)&&(o.pointPointDisjointPredicates_(),l=!0),!l){const r=new c,i=r.addGeometry(t),a=r.addGeometry(e);o.setEditShapeCrackAndCluster_(r,new u(n,0),s),o.computeMatrixTopoGraphClusters_(i,a),o.m_topoGraph.removeShape()}return Qe(o.m_matrix,o.m_scl)}function Be(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setAreaPointPredicates_();const a=r.constructEmpty();t.queryEnvelope(a);const m=e.getXY();let c=!1;if(Sn(m,a,n)&&(o.areaPointDisjointPredicates_(t),c=!0),!c){const e=Ot(t,m,n);if(1===e)o.m_matrix[0]=0,o.m_matrix[2]=2,o.m_matrix[3]=-1,o.m_matrix[5]=1,o.m_matrix[6]=-1;else if(2===e){o.m_matrix[6]=-1;if(0!==t.calculateArea2D())o.m_matrix[0]=-1,o.m_matrix[3]=0,o.m_matrix[2]=2,o.m_matrix[5]=1;else{o.m_matrix[0]=0,o.m_matrix[3]=-1,o.m_matrix[5]=-1;const e=r.constructEmpty();t.queryEnvelope(e),o.m_matrix[2]=e.height()||e.width()?1:-1}}else o.areaPointDisjointPredicates_(t)}return Qe(o.m_matrix,i)}function Ze(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setLinePointPredicates_();const a=r.constructEmpty();t.queryEnvelope(a);let c=!1;if(Sn(e.getXY(),a,n)&&(o.linePointDisjointPredicates_(t),c=!0),!c){let r=null,i=!1,a=!1;if(o.m_performPredicates[0]||o.m_performPredicates[6]){!dn(t,e,n,4,s)?(o.m_performPredicates[0]&&(r=l(t),a=!dn(r,e,n,4,s),i=!0,o.m_matrix[0]=a?-1:0),o.m_matrix[6]=-1):(o.m_matrix[0]=-1,o.m_matrix[6]=0)}if(o.m_performPredicates[3]&&(null!==r&&r.isEmpty()?o.m_matrix[3]=-1:(i||(null==r&&(r=l(t)),a=!dn(r,e,n,4,s),i=!0),o.m_matrix[3]=a?0:-1)),o.m_performPredicates[5])if(null!==r&&r.isEmpty())o.m_matrix[5]=-1;else if(i&&!a)o.m_matrix[5]=0;else{null===r&&(r=l(t));const i=dn(r,e,n,3,s);o.m_matrix[5]=i?-1:0}if(o.m_performPredicates[2]){if(0!==t.calculateLength2D())o.m_matrix[2]=1;else{const r=new m({vd:t.getDescription()});r.addPoints(t,0,t.getPointCount());const i=dn(r,e,n,3,s);o.m_matrix[2]=i?-1:0}}}return Qe(o.m_matrix,o.m_scl)}function Ke(t,e,n,i,s){const o=new cn;o.resetMatrix_(),o.setPredicates_(i),o.setPointPointPredicates_();const a=r.constructEmpty();t.queryEnvelope(a);const m=e.getXY(),c=new Q;let u=!1;if(Sn(m,a,n)&&(o.pointPointDisjointPredicates_(),u=!0),!u){let e=!1,r=!0;const i=n*n;for(let n=0;n<t.getPointCount()&&(t.queryXY(n,c),Q.sqrDistance(c,m)<=i?e=!0:r=!1,!e||r);n++);e?(o.m_matrix[0]=0,o.m_matrix[2]=r?-1:0,o.m_matrix[6]=-1):(o.m_matrix[0]=-1,o.m_matrix[2]=0,o.m_matrix[6]=0)}return Qe(o.m_matrix,i)}function We(t,e,n,r,i){const s=t.getXY(),o=e.getXY(),a=ut(9,-1);Q.sqrDistance(s,o)<=n*n?a[0]=0:(a[2]=0,a[6]=0),a[8]=2;return Qe(a,r)}function Qe(t,e){for(let n=0;n<9;n++)switch(e[n]){case"T":if(-1===t[n])return!1;break;case"F":if(-1!==t[n])return!1;break;case"0":if(0!==t[n])return!1;break;case"1":if(1!==t[n])return!1;break;case"2":if(2!==t[n])return!1}return!0}function Je(t,e,n){const i=ut(9,-1);if(t.isEmpty()&&e.isEmpty())return Qe(i,n);let s,o=!1;t.isEmpty()?(s=e,o=!0):s=t,i[0]=-1,i[1]=-1,i[3]=-1,i[4]=-1,i[6]=-1,i[7]=-1,i[8]=2;const a=s.getGeometryType();if(j(a))if(a===L.enumPolygon){if(0!==s.calculateArea2D())i[2]=2,i[5]=1;else{i[5]=-1;const t=r.constructEmpty();s.queryEnvelope(t),i[2]=t.height()||t.width()?1:0}}else{const t=0!==s.calculateLength2D();i[2]=t?1:0,i[5]=h(s)?0:-1}else i[2]=0,i[5]=-1;return o&&un(i),Qe(i,n)}function $e(t,e,n){return tn(t)?3:en(t)?4:nn(t,e,n)?8:rn(t,e,n)?16:on(t)?64:sn(t)?1:an(t,e,n)?32:0}function tn(t){return"T*F**FFF*"===t}function en(t){return"FF*FF****"===t}function nn(t,e,n){return(0!==e||0!==n)&&(2===e&&2===n?"F***T****"===t:(2===e||1===e)&&0===n&&"F**T*****"===t)}function rn(t,e,n){return e>n?"T*****T**"===t:1===e&&1===n&&"0********"===t}function sn(t){return"T*****FF*"===t}function on(t){return"T**FF*FF*"===t}function an(t,e,n){return e===n&&(1!==e?"T*T***T**"===t:"1*T***T**"===t)}function mn(t,e,n){const r=e.getGeometryID(t);for(let i=e.getFirstCluster();i!==g;i=e.getNextCluster(i)){if(!(e.getClusterParentage(i)&r))continue;const t=e.getClusterHalfEdge(i);if(t===g){e.setClusterUserIndex(i,n,0);continue}let s=t,o=0;do{const t=s;e.getHalfEdgeParentage(t)&r&&o++,s=e.getHalfEdgeNext(e.getHalfEdgeTwin(t))}while(s!==t);e.setClusterUserIndex(i,n,o)}}class cn{nullFunc(){return V("should not be called"),!1}constructor(){this.m_clusterIndexA=-1,this.m_clusterIndexB=-1,this.m_visitedIndex=-1,this.m_topoGraph=new qt,this.m_matrix=ut(9,0),this.m_maxDim=ut(9,0),this.m_performPredicates=ut(9,!1),this.m_scl="",this.m_predicateCount=0,this.m_predicatesHalfEdge=this.nullFunc,this.m_predicatesCluster=this.nullFunc}resetMatrix_(){this.m_matrix.fill(-2),this.m_maxDim.fill(-2)}setPredicates_(t){this.m_scl=t;for(let e=0;e<9;e++)"*"!==this.m_scl[e]?(this.m_performPredicates[e]=!0,this.m_predicateCount++):this.m_performPredicates[e]=!1}setRemainingPredicatesToFalse_(){for(let t=0;t<9;t++)this.m_performPredicates[t]&&-2===this.m_matrix[t]&&(this.m_matrix[t]=-1,this.m_performPredicates[t]=!1)}isPredicateKnown_(t){return-2!==this.m_matrix[t]&&(-1===this.m_matrix[t]?(this.m_performPredicates[t]=!1,this.m_predicateCount--,!0):"T"!==this.m_scl[t]&&"F"!==this.m_scl[t]?!(this.m_matrix[t]<this.m_maxDim[t])&&(this.m_performPredicates[t]=!1,this.m_predicateCount--,!0):(this.m_performPredicates[t]=!1,this.m_predicateCount--,!0))}setAreaAreaPredicates_(){this.m_predicatesHalfEdge=this.areaAreaPredicates_,this.m_maxDim[0]=2,this.m_maxDim[1]=1,this.m_maxDim[2]=2,this.m_maxDim[3]=1,this.m_maxDim[4]=1,this.m_maxDim[5]=1,this.m_maxDim[6]=2,this.m_maxDim[7]=1,this.m_maxDim[8]=2,this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setAreaLinePredicates_(){this.m_predicatesHalfEdge=this.areaLinePredicates_,this.m_predicatesCluster=this.areaPointPredicates_,this.m_maxDim[0]=1,this.m_maxDim[1]=0,this.m_maxDim[2]=2,this.m_maxDim[3]=1,this.m_maxDim[4]=0,this.m_maxDim[5]=1,this.m_maxDim[6]=1,this.m_maxDim[7]=0,this.m_maxDim[8]=2,this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setLineLinePredicates_(){this.m_predicatesHalfEdge=this.lineLinePredicates_,this.m_predicatesCluster=this.linePointPredicates_,this.m_maxDim[0]=1,this.m_maxDim[1]=0,this.m_maxDim[2]=1,this.m_maxDim[3]=0,this.m_maxDim[4]=0,this.m_maxDim[5]=0,this.m_maxDim[6]=1,this.m_maxDim[7]=0,this.m_maxDim[8]=2,this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setAreaPointPredicates_(){this.m_predicatesCluster=this.areaPointPredicates_,this.m_maxDim[0]=0,this.m_maxDim[1]=-1,this.m_maxDim[2]=2,this.m_maxDim[3]=0,this.m_maxDim[4]=-1,this.m_maxDim[5]=1,this.m_maxDim[6]=0,this.m_maxDim[7]=-1,this.m_maxDim[8]=2,this.m_performPredicates[1]&&(this.m_matrix[1]=-1,this.m_performPredicates[1]=!1,this.m_predicateCount--),this.m_performPredicates[4]&&(this.m_matrix[4]=-1,this.m_performPredicates[4]=!1,this.m_predicateCount--),this.m_performPredicates[7]&&(this.m_matrix[7]=-1,this.m_performPredicates[7]=!1,this.m_predicateCount--),this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setLinePointPredicates_(){this.m_predicatesCluster=this.linePointPredicates_,this.m_maxDim[0]=0,this.m_maxDim[1]=-1,this.m_maxDim[2]=1,this.m_maxDim[3]=0,this.m_maxDim[4]=-1,this.m_maxDim[5]=0,this.m_maxDim[6]=0,this.m_maxDim[7]=-1,this.m_maxDim[8]=2,this.m_performPredicates[1]&&(this.m_matrix[1]=-1,this.m_performPredicates[1]=!1,this.m_predicateCount--),this.m_performPredicates[4]&&(this.m_matrix[4]=-1,this.m_performPredicates[4]=!1,this.m_predicateCount--),this.m_performPredicates[7]&&(this.m_matrix[7]=-1,this.m_performPredicates[7]=!1,this.m_predicateCount--),this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}setPointPointPredicates_(){this.m_predicatesCluster=this.pointPointPredicates_,this.m_maxDim[0]=0,this.m_maxDim[1]=-1,this.m_maxDim[2]=0,this.m_maxDim[3]=-1,this.m_maxDim[4]=-1,this.m_maxDim[5]=-1,this.m_maxDim[6]=0,this.m_maxDim[7]=-1,this.m_maxDim[8]=2,this.m_performPredicates[1]&&(this.m_matrix[1]=-1,this.m_performPredicates[1]=!1,this.m_predicateCount--),this.m_performPredicates[3]&&(this.m_matrix[3]=-1,this.m_performPredicates[3]=!1,this.m_predicateCount--),this.m_performPredicates[4]&&(this.m_matrix[4]=-1,this.m_performPredicates[4]=!1,this.m_predicateCount--),this.m_performPredicates[5]&&(this.m_matrix[5]=-1,this.m_performPredicates[5]=!1,this.m_predicateCount--),this.m_performPredicates[7]&&(this.m_matrix[7]=-1,this.m_performPredicates[7]=!1,this.m_predicateCount--),this.m_performPredicates[8]&&(this.m_matrix[8]=2,this.m_performPredicates[8]=!1,this.m_predicateCount--)}areaAreaDisjointPredicates_(t,e){this.m_matrix[0]=-1,this.m_matrix[1]=-1,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.areaGeomContainsOrDisjointPredicates_(t,this.m_performPredicates[2]?2:-1,this.m_scl[2],this.m_performPredicates[5]?5:-1,this.m_scl[5]),this.areaGeomContainsOrDisjointPredicates_(e,this.m_performPredicates[6]?6:-1,this.m_scl[6],this.m_performPredicates[7]?7:-1,this.m_scl[7])}areaGeomContainsOrDisjointPredicates_(t,e,n,i,s){const o=-1!==e,a=-1!==i;if(o||a){if(!("T"!==n&&"F"!==n&&o||"T"!==s&&"F"!==s&&a)||0!==t.calculateArea2D())o&&(this.m_matrix[e]=2),a&&(this.m_matrix[i]=1);else if(a&&(this.m_matrix[i]=-1),o){const n=r.constructEmpty();t.queryEnvelope(n),this.m_matrix[e]=n.height()||n.width()?1:0}}}areaAreaContainsPredicates_(t){this.m_matrix[2]=2,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.m_matrix[5]=1,this.m_matrix[6]=-1,this.m_matrix[7]=-1,this.areaGeomContainsOrDisjointPredicates_(t,this.m_performPredicates[0]?0:-1,this.m_scl[0],this.m_performPredicates[1]?1:-1,this.m_scl[1])}areaAreaWithinPredicates_(t){this.areaAreaContainsPredicates_(t),un(this.m_matrix)}areaLineDisjointPredicates_(t,e){if(this.m_matrix[0]=-1,this.m_matrix[1]=-1,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.m_performPredicates[6]){const t=this.m_scl[6],n="T"===t||"F"===t||0!==e.calculateLength2D();this.m_matrix[6]=n?1:0}if(this.m_performPredicates[7]){const t=h(e);this.m_matrix[7]=t?0:-1}this.areaGeomContainsOrDisjointPredicates_(t,this.m_performPredicates[2]?2:-1,this.m_scl[2],this.m_performPredicates[5]?5:-1,this.m_scl[5])}areaLineContainsPredicates_(t,e){if(this.m_performPredicates[0]){const t=this.m_scl[0],n="T"===t||"F"===t||0!==e.calculateLength2D();this.m_matrix[0]=n?1:0}if(this.m_performPredicates[1]){const t=h(e);this.m_matrix[1]=t?0:-1}this.m_matrix[2]=2,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.m_matrix[5]=1,this.m_matrix[6]=-1,this.m_matrix[7]=-1}areaPointDisjointPredicates_(t){this.m_matrix[0]=-1,this.m_matrix[3]=-1,this.m_matrix[6]=0,this.areaGeomContainsOrDisjointPredicates_(t,this.m_performPredicates[2]?2:-1,this.m_scl[2],this.m_performPredicates[5]?5:-1,this.m_scl[5])}areaPointContainsPredicates_(t){this.m_matrix[0]=0,this.m_matrix[2]=2,this.m_matrix[3]=-1,this.m_matrix[5]=1,this.m_matrix[6]=-1}lineLineDisjointPredicates_(t,e){if(this.m_matrix[0]=-1,this.m_matrix[1]=-1,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.m_performPredicates[2]){const e=this.m_scl[2],n="T"===e||"F"===e||0!==t.calculateLength2D();this.m_matrix[2]=n?1:0}if(this.m_performPredicates[5]){const e=h(t);this.m_matrix[5]=e?0:-1}if(this.m_performPredicates[6]){const t=this.m_scl[6],n="T"===t||"F"===t||0!==e.calculateLength2D();this.m_matrix[6]=n?1:0}if(this.m_performPredicates[7]){const t=h(e);this.m_matrix[7]=t?0:-1}}linePointDisjointPredicates_(t){if(this.m_matrix[0]=-1,this.m_matrix[3]=-1,this.m_performPredicates[2]){const e=this.m_scl[2],n="T"===e||"F"===e||0!==t.calculateLength2D();this.m_matrix[2]=n?1:0}if(this.m_performPredicates[5]){const e=h(t);this.m_matrix[5]=e?0:-1}this.m_matrix[6]=0}pointPointDisjointPredicates_(){this.m_matrix[0]=-1,this.m_matrix[2]=0,this.m_matrix[6]=0}areaAreaPredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorAreaInteriorArea_(t,e,n);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[1]){this.interiorAreaBoundaryArea_(t,e,1);const n=this.isPredicateKnown_(1);r&&=n}if(this.m_performPredicates[2]){this.interiorAreaExteriorArea_(t,e,n,2);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[3]){this.interiorAreaBoundaryArea_(t,n,3);const e=this.isPredicateKnown_(3);r&&=e}if(this.m_performPredicates[4]){this.boundaryAreaBoundaryArea_(t,e,n);const i=this.isPredicateKnown_(4);r&&=i}if(this.m_performPredicates[5]){this.boundaryAreaExteriorArea_(t,e,n,5);const i=this.isPredicateKnown_(5);r&&=i}if(this.m_performPredicates[6]){this.interiorAreaExteriorArea_(t,n,e,6);const i=this.isPredicateKnown_(6);r&&=i}if(this.m_performPredicates[7]){this.boundaryAreaExteriorArea_(t,n,e,7);const i=this.isPredicateKnown_(7);r&&=i}return r}areaLinePredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorAreaInteriorLine_(t,e,n);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[1]){this.interiorAreaBoundaryLine_(t,e,n,this.m_clusterIndexB);const i=this.isPredicateKnown_(1);r&&=i}if(this.m_performPredicates[2]){this.interiorAreaExteriorLine_(t,e,n);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[3]){this.boundaryAreaInteriorLine_(t,e,n,this.m_clusterIndexB);const i=this.isPredicateKnown_(3);r&&=i}if(this.m_performPredicates[4]){this.boundaryAreaBoundaryLine_(t,e,n,this.m_clusterIndexB);const i=this.isPredicateKnown_(4);r&&=i}if(this.m_performPredicates[5]){this.boundaryAreaExteriorLine_(t,e,n);const i=this.isPredicateKnown_(5);r&&=i}if(this.m_performPredicates[6]){this.exteriorAreaInteriorLine_(t,e);const n=this.isPredicateKnown_(6);r&&=n}if(this.m_performPredicates[7]){this.exteriorAreaBoundaryLine_(t,e,n,this.m_clusterIndexB);const i=this.isPredicateKnown_(7);r&&=i}return r}lineLinePredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorLineInteriorLine_(t,e,n,this.m_clusterIndexA,this.m_clusterIndexB);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[1]){this.interiorLineBoundaryLine_(t,e,n,this.m_clusterIndexA,this.m_clusterIndexB,1);const i=this.isPredicateKnown_(1);r&&=i}if(this.m_performPredicates[2]){this.interiorLineExteriorLine_(t,e,n,2);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[3]){this.interiorLineBoundaryLine_(t,n,e,this.m_clusterIndexB,this.m_clusterIndexA,3);const i=this.isPredicateKnown_(3);r&&=i}if(this.m_performPredicates[4]){this.boundaryLineBoundaryLine_(t,e,n,this.m_clusterIndexA,this.m_clusterIndexB);const i=this.isPredicateKnown_(4);r&&=i}if(this.m_performPredicates[5]){this.boundaryLineExteriorLine_(t,e,n,this.m_clusterIndexA,5);const i=this.isPredicateKnown_(5);r&&=i}if(this.m_performPredicates[6]){this.interiorLineExteriorLine_(t,n,e,6);const i=this.isPredicateKnown_(6);r&&=i}if(this.m_performPredicates[7]){this.boundaryLineExteriorLine_(t,n,e,this.m_clusterIndexB,7);const i=this.isPredicateKnown_(7);r&&=i}return r}areaPointPredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorAreaInteriorPoint_(t,e);const n=this.isPredicateKnown_(0);r&&=n}if(this.m_performPredicates[2]){this.interiorAreaExteriorPoint_(t,e);const n=this.isPredicateKnown_(2);r&&=n}if(this.m_performPredicates[3]){this.boundaryAreaInteriorPoint_(t,e,n);const i=this.isPredicateKnown_(3);r&&=i}if(this.m_performPredicates[5]){this.boundaryAreaExteriorPoint_(t,e);const n=this.isPredicateKnown_(5);r&&=n}if(this.m_performPredicates[6]){this.exteriorAreaInteriorPoint_(t,e);const n=this.isPredicateKnown_(6);r&&=n}return r}linePointPredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorLineInteriorPoint_(t,e,n,this.m_clusterIndexA);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[2]){this.interiorLineExteriorPoint_(t,e,n,this.m_clusterIndexA);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[3]){this.boundaryLineInteriorPoint_(t,e,n,this.m_clusterIndexA);const i=this.isPredicateKnown_(3);r&&=i}if(this.m_performPredicates[5]){this.boundaryLineExteriorPoint_(t,e,n,this.m_clusterIndexA);const i=this.isPredicateKnown_(5);r&&=i}if(this.m_performPredicates[6]){this.exteriorLineInteriorPoint_(t,e,n);const i=this.isPredicateKnown_(6);r&&=i}return r}pointPointPredicates_(t,e,n){let r=!0;if(this.m_performPredicates[0]){this.interiorPointInteriorPoint_(t,e,n);const i=this.isPredicateKnown_(0);r&&=i}if(this.m_performPredicates[2]){this.interiorPointExteriorPoint_(t,e,n,2);const i=this.isPredicateKnown_(2);r&&=i}if(this.m_performPredicates[6]){this.interiorPointExteriorPoint_(t,n,e,6);const i=this.isPredicateKnown_(6);r&&=i}return r}interiorAreaInteriorArea_(t,e,n){if(2===this.m_matrix[0])return;const r=this.m_topoGraph.getHalfEdgeFaceParentage(t);r&e&&r&n&&(this.m_matrix[0]=2)}interiorAreaBoundaryArea_(t,e,n){if(1===this.m_matrix[n])return;const r=this.m_topoGraph.getHalfEdgeFaceParentage(t),i=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(t));r&e&&i&e&&(this.m_matrix[n]=1)}interiorAreaExteriorArea_(t,e,n,r){if(2===this.m_matrix[r])return;const i=this.m_topoGraph.getHalfEdgeFaceParentage(t);i&e&&!(i&n)&&(this.m_matrix[r]=2)}boundaryAreaBoundaryArea_(t,e,n){if(1===this.m_matrix[4])return;const r=this.m_topoGraph.getHalfEdgeParentage(t);if(r&e&&r&n)this.m_matrix[4]=1;else if(0!==this.m_matrix[4]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const r=this.m_topoGraph.getHalfEdgeTo(t),i=this.m_topoGraph.getClusterParentage(r);if(i&e&&i&n)return void(this.m_matrix[4]=0)}}boundaryAreaExteriorArea_(t,e,n,r){if(1===this.m_matrix[r])return;const i=this.m_topoGraph.getHalfEdgeFaceParentage(t),s=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(t));i&n||s&n||(this.m_matrix[r]=1)}interiorAreaInteriorLine_(t,e,n){if(1===this.m_matrix[0])return;const r=this.m_topoGraph.getHalfEdgeFaceParentage(t),i=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(t));r&e&&i&e&&(this.m_matrix[0]=1)}interiorAreaBoundaryLine_(t,e,n,r){if(0!==this.m_matrix[1]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(t),s=this.m_topoGraph.getClusterParentage(i);if(!(s&e)){if(this.m_topoGraph.getHalfEdgeFaceParentage(t)&e){const t=this.m_topoGraph.getClusterUserIndex(i,r);if(s&n&&t%2!=0)return void(this.m_matrix[1]=0)}}}}interiorAreaExteriorLine_(t,e,n){if(2===this.m_matrix[2])return;this.m_topoGraph.getHalfEdgeParentage(t)&e&&(this.m_matrix[2]=2)}boundaryAreaInteriorLine_(t,e,n,r){if(1===this.m_matrix[3])return;const i=this.m_topoGraph.getHalfEdgeParentage(t);if(i&e&&i&n)this.m_matrix[3]=1;else if(0!==this.m_matrix[3]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(t),s=this.m_topoGraph.getClusterParentage(i);if(s&e){const t=this.m_topoGraph.getClusterUserIndex(i,r);if(s&n&&t%2==0)return void(this.m_matrix[3]=0)}}}boundaryAreaBoundaryLine_(t,e,n,r){if(0!==this.m_matrix[4]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(t),s=this.m_topoGraph.getClusterParentage(i);if(s&e){const t=this.m_topoGraph.getClusterUserIndex(i,r);if(s&n&&t%2!=0)return void(this.m_matrix[4]=0)}}}boundaryAreaExteriorLine_(t,e,n){if(1===this.m_matrix[5])return;const r=this.m_topoGraph.getHalfEdgeParentage(t);r&e&&!(r&n)&&(this.m_matrix[5]=1)}exteriorAreaInteriorLine_(t,e){if(1===this.m_matrix[6])return;const n=this.m_topoGraph.getHalfEdgeFaceParentage(t),r=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(t));n&e||r&e||(this.m_matrix[6]=1)}exteriorAreaBoundaryLine_(t,e,n,r){if(0!==this.m_matrix[7]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(t),s=this.m_topoGraph.getClusterParentage(i);if(!(s&e)){if(!(this.m_topoGraph.getHalfEdgeFaceParentage(t)&e)){const t=this.m_topoGraph.getClusterUserIndex(i,r);if(s&n&&t%2!=0)return void(this.m_matrix[7]=0)}}}}interiorLineInteriorLine_(t,e,n,r,i){if(1===this.m_matrix[0])return;const s=this.m_topoGraph.getHalfEdgeParentage(t);if(s&e&&s&n)this.m_matrix[0]=1;else if(0!==this.m_matrix[0]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const s=this.m_topoGraph.getHalfEdgeTo(t),o=this.m_topoGraph.getClusterParentage(s);if(o&e&&o&n){const t=this.m_topoGraph.getClusterUserIndex(s,r),e=this.m_topoGraph.getClusterUserIndex(s,i);if(t%2==0&&e%2==0)return void(this.m_matrix[0]=0)}}}interiorLineBoundaryLine_(t,e,n,r,i,s){if(0!==this.m_matrix[s]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const o=this.m_topoGraph.getHalfEdgeTo(t),a=this.m_topoGraph.getClusterParentage(o);if(a&e&&a&n){const t=this.m_topoGraph.getClusterUserIndex(o,r),e=this.m_topoGraph.getClusterUserIndex(o,i);if(t%2==0&&e%2!=0)return void(this.m_matrix[s]=0)}}}interiorLineExteriorLine_(t,e,n,r){if(1===this.m_matrix[r])return;const i=this.m_topoGraph.getHalfEdgeParentage(t);i&e&&!(i&n)&&(this.m_matrix[r]=1)}boundaryLineBoundaryLine_(t,e,n,r,i){if(0!==this.m_matrix[4]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const s=this.m_topoGraph.getHalfEdgeTo(t),o=this.m_topoGraph.getClusterParentage(s);if(o&e&&o&n){const t=this.m_topoGraph.getClusterUserIndex(s,r),e=this.m_topoGraph.getClusterUserIndex(s,i);if(t%2!=0&&e%2!=0)return void(this.m_matrix[4]=0)}}}boundaryLineExteriorLine_(t,e,n,r,i){if(0!==this.m_matrix[i]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(t)),this.m_visitedIndex)){const e=this.m_topoGraph.getHalfEdgeTo(t);if(!(this.m_topoGraph.getClusterParentage(e)&n)){if(this.m_topoGraph.getClusterUserIndex(e,r)%2!=0)return void(this.m_matrix[i]=0)}}}interiorAreaInteriorPoint_(t,e){if(0===this.m_matrix[0])return;if(!(this.m_topoGraph.getClusterParentage(t)&e)){const n=this.m_topoGraph.getClusterChain(t);if(this.m_topoGraph.getChainParentage(n)&e)return void(this.m_matrix[0]=0)}}interiorAreaExteriorPoint_(t,e){if(2===this.m_matrix[2])return;this.m_topoGraph.getClusterParentage(t)&e&&(this.m_matrix[2]=2)}boundaryAreaInteriorPoint_(t,e,n){if(0===this.m_matrix[3])return;const r=this.m_topoGraph.getClusterParentage(t);r&e&&r&n&&(this.m_matrix[3]=0)}boundaryAreaExteriorPoint_(t,e){if(1===this.m_matrix[5])return;this.m_topoGraph.getClusterParentage(t)&e&&(this.m_matrix[5]=1)}exteriorAreaInteriorPoint_(t,e){if(0===this.m_matrix[6])return;if(!(this.m_topoGraph.getClusterParentage(t)&e)){const n=this.m_topoGraph.getClusterChain(t);if(!(this.m_topoGraph.getChainParentage(n)&e))return void(this.m_matrix[6]=0)}}interiorLineInteriorPoint_(t,e,n,r){if(0===this.m_matrix[0])return;const i=this.m_topoGraph.getClusterParentage(t);if(i&e&&i&n){if(this.m_topoGraph.getClusterUserIndex(t,r)%2==0)return void(this.m_matrix[0]=0)}}interiorLineExteriorPoint_(t,e,n,r){if(1===this.m_matrix[2])return;if(-1===this.m_topoGraph.getClusterHalfEdge(t)){if(0!==this.m_matrix[2]){if(!(this.m_topoGraph.getClusterParentage(t)&n))return void(this.m_matrix[2]=0)}}else this.m_matrix[2]=1}boundaryLineInteriorPoint_(t,e,n,r){if(0===this.m_matrix[3])return;const i=this.m_topoGraph.getClusterParentage(t);if(i&e&&i&n){if(this.m_topoGraph.getClusterUserIndex(t,r)%2!=0)return void(this.m_matrix[3]=0)}}boundaryLineExteriorPoint_(t,e,n,r){if(0===this.m_matrix[5])return;const i=this.m_topoGraph.getClusterParentage(t);if(i&e&&!(i&n)){if(this.m_topoGraph.getClusterUserIndex(t,r)%2!=0)return void(this.m_matrix[5]=0)}}exteriorLineInteriorPoint_(t,e,n){if(0===this.m_matrix[6])return;const r=this.m_topoGraph.getClusterParentage(t);r&e||!(r&n)||(this.m_matrix[6]=0)}interiorPointInteriorPoint_(t,e,n){if(0===this.m_matrix[0])return;const r=this.m_topoGraph.getClusterParentage(t);r&e&&r&n&&(this.m_matrix[0]=0)}interiorPointExteriorPoint_(t,e,n,r){if(0===this.m_matrix[r])return;const i=this.m_topoGraph.getClusterParentage(t);!(i&e)||i&n||(this.m_matrix[r]=0)}computeMatrixTopoGraphHalfEdges_(t,e){let n=!1;const r=this.m_topoGraph.getGeometryID(t),i=this.m_topoGraph.getGeometryID(e);this.m_visitedIndex=this.m_topoGraph.createUserIndexForHalfEdges();for(let s=this.m_topoGraph.getFirstCluster();s!==g;s=this.m_topoGraph.getNextCluster(s)){const t=this.m_topoGraph.getClusterHalfEdge(s);if(t===g){if(null!==this.m_predicatesCluster&&(n=this.m_predicatesCluster(s,r,i),n))break;continue}let e=t;do{let t=e;if(1!==this.m_topoGraph.getHalfEdgeUserIndex(t,this.m_visitedIndex))do{if(n=this.m_predicatesHalfEdge(t,r,i),n)break;this.m_topoGraph.setHalfEdgeUserIndex(t,this.m_visitedIndex,1),t=this.m_topoGraph.getHalfEdgeNext(t)}while(t!==e&&!n);if(n)break;e=this.m_topoGraph.getHalfEdgeNext(this.m_topoGraph.getHalfEdgeTwin(t))}while(e!==t);if(n)break}n||this.setRemainingPredicatesToFalse_(),this.m_topoGraph.deleteUserIndexForHalfEdges(this.m_visitedIndex)}computeMatrixTopoGraphClusters_(t,e){let n=!1;const r=this.m_topoGraph.getGeometryID(t),i=this.m_topoGraph.getGeometryID(e);for(let s=this.m_topoGraph.getFirstCluster();s!==g&&(n=this.m_predicatesCluster(s,r,i),!n);s=this.m_topoGraph.getNextCluster(s));n||this.setRemainingPredicatesToFalse_()}setEditShape_(t,e){this.m_topoGraph.setEditShape(t,e)}setEditShapeCrackAndCluster_(t,e,n){let r=0;if(t.hasCurves()){const i=new jt,s=t.getEnvelope2D(n),o=Lt(e.total(),s);r=kt(o,0),Ut(t,o,e.total(),12e3,i,null,n),i.clearStitcher(t)}Ht(t,e.add(r),n,!1,!1),t.filterClosePoints(0,!0,!0,!1,g);for(let i=t.getFirstGeometry();i!==g;i=t.getNextGeometry(i))t.getGeometryType(i)===L.enumPolygon&&Yt(t,i,-1,!1,g,n);this.setEditShape_(t,n)}}function un(t){const e=t[1],n=t[2],r=t[5];t[1]=t[3],t[2]=t[6],t[5]=t[7],t[3]=e,t[6]=n,t[7]=r}function ln(t,s,o){const a=t.getGeometryType();if(U(a)){const e=new n({vd:t.getDescription()});return e.addSegment(t,!0),e}if(a===L.enumEnvelope){const o=t,a=r.constructEmpty();if(t.queryEnvelope(a),a.height()<=s&&a.width()<=s){const e=new i({vd:t.getDescription()});return o.getCenter(e),e}if(a.height()<=s||a.width()<=s){const e=new n({vd:t.getDescription()}),r=new i;return o.queryCornerByVal(0,r),e.startPathPoint(r),o.queryCornerByVal(2,r),e.lineToPoint(r),e}const m=new e({vd:t.getDescription()});return m.addEnvelope(o,!1),m}return t}function hn(t){return`${t[0]}${t[3]}${t[6]}${t[1]}${t[4]}${t[7]}${t[2]}${t[5]}${t[8]}`}class gn{nullFunc(){return V("should not be called"),!1}constructor(t,e,n,i=!1){this.m_bDone=!1,this.m_tolerance=0,this.m_elementHandle=-1,this.m_query=r.constructEmpty(),this.m_envInter=r.constructEmpty(),this.m_quadTree=null,this.m_intersector=null,this.m_function=this.nullFunc;const s=t.getAccelerators();let o=null;null!=s&&(o=i?s.getQuadTreeForPaths():s.getQuadTree());const a=e.getAccelerators();let m=null;if(null!=a&&(m=i?a.getQuadTreeForPaths():a.getQuadTree()),null===o&&null===m&&!i){const i=t.getPointCount(),s=e.getPointCount();if(i>10&&s>10){const a=r.constructEmpty(),c=r.constructEmpty(),u=r.constructEmpty();t.queryLooseEnvelope(a),e.queryLooseEnvelope(c),a.inflateCoords(n,n),c.inflateCoords(n,n),u.setCoords({env2D:a}),u.intersect(c),i>=s?o=j(t.getGeometryType())?f(t,u):S(t,u):m=j(e.getGeometryType())?f(e,u):S(e,u)}}this.construct_(t,o,e,m,n,i)}next(){if(this.m_bQuadTree){if(this.m_bDone)return!1;for(;this.m_function(););return!this.m_bDone}return!!this.m_intersector&&this.m_intersector.next()}getRedElement(){return this.m_bQuadTree?this.m_bSwapElements?this.m_quadTree.getElement(this.m_elementHandle):j(this.m_queryType)?this.m_bPaths?this.m_pathIndex:this.m_segIter.getStartPointIndex():this.m_pointIndex:this.m_bSwapElements?this.m_intersector.getBlueElement(this.m_intersector.getHandleB()):this.m_intersector.getRedElement(this.m_intersector.getHandleA())}getBlueElement(){return this.m_bQuadTree?this.m_bSwapElements?j(this.m_queryType)?this.m_bPaths?this.m_pathIndex:this.m_segIter.getStartPointIndex():this.m_pointIndex:this.m_quadTree.getElement(this.m_elementHandle):this.m_bSwapElements?this.m_intersector.getRedElement(this.m_intersector.getHandleA()):this.m_intersector.getBlueElement(this.m_intersector.getHandleB())}getRedEnvelope(){return this.m_bPaths||k(""),this.m_bQuadTree?this.m_bSwapElements?this.m_quadTree.getElementExtent(this.m_elementHandle):this.m_query:this.m_bSwapElements?this.m_intersector.getBlueEnvelope(this.m_intersector.getHandleB()):this.m_intersector.getRedEnvelope(this.m_intersector.getHandleA())}getBlueEnvelope(){return this.m_bPaths||k(""),this.m_bQuadTree?this.m_bSwapElements?this.m_query:this.m_quadTree.getElementExtent(this.m_elementHandle):this.m_bSwapElements?this.m_intersector.getRedEnvelope(this.m_intersector.getHandleA()):this.m_intersector.getBlueEnvelope(this.m_intersector.getHandleB())}construct_(t,e,n,i,s,o){const a=r.constructEmpty(),m=r.constructEmpty();t.queryLooseEnvelope(a),n.queryLooseEnvelope(m),a.inflateCoords(s,s),m.inflateCoords(s,s),this.m_envInter.setCoords({env2D:a}),this.m_envInter.intersect(m),this.m_multiVertexImplA=t,this.m_multiVertexImplB=n;const c=t.getGeometryType(),u=n.getGeometryType();this.m_bPaths=o,this.m_pathIndex=-1,this.m_pointIndex=-1,this.m_bSwapElements=!1,this.m_queryType=L.enumUnknown,this.m_bQuadTree=!1,null!==e&&(this.m_bDone=!1,this.m_tolerance=s,this.m_quadTree=e,this.m_qtIter=this.m_quadTree.getIteratorForQT(),this.m_bQuadTree=!0,this.m_bSwapElements=!0,j(u)?(this.m_queryType=u,this.m_function=this.nextPath_,o?this.m_pathIndex=n.getPathCount():this.m_segIter=n.querySegmentIterator()):(this.m_queryType=u,this.m_function=this.nextPoint_,this.m_pointIndex=n.getPointCount())),this.m_bQuadTree||null!==i&&(this.m_bDone=!1,this.m_tolerance=s,this.m_quadTree=i,this.m_qtIter=this.m_quadTree.getIteratorForQT(),this.m_bQuadTree=!0,this.m_bSwapElements=!1,j(c)?(this.m_queryType=c,this.m_function=this.nextPath_,o?this.m_pathIndex=t.getPathCount():this.m_segIter=t.querySegmentIterator()):(this.m_queryType=c,this.m_function=this.nextPoint_,this.m_pointIndex=t.getPointCount())),this.m_bQuadTree||(o&&j(c)&&j(u)?this.m_intersector=v(t,n,s):j(c)&&j(u)?(this.m_intersector=w(t,n,s),this.m_bSwapElements=!1):j(c)&&!j(u)?(this.m_intersector=b(t,n,s),this.m_bSwapElements=!1):!j(c)&&j(u)?(this.m_intersector=b(n,t,s),this.m_bSwapElements=!0):(this.m_intersector=T(t,n,s),this.m_bSwapElements=!1))}nextPath_(){return this.m_bPaths?-1==--this.m_pathIndex?(this.m_bDone=!0,!1):(this.m_bSwapElements?this.m_multiVertexImplB.queryPathEnvelope(this.m_pathIndex,this.m_query):this.m_multiVertexImplA.queryPathEnvelope(this.m_pathIndex,this.m_query),this.m_qtIter.resetIterator(this.m_query,this.m_tolerance),this.m_function=this.iterate_,!0):this.m_segIter.nextPath()?(this.m_function=this.nextSegment_,!0):(this.m_bDone=!0,!1)}nextSegment_(){if(!this.m_segIter.hasNextSegment())return this.m_function=this.nextPath_,!0;const t=this.m_segIter.nextSegment(),e=new r;return t.queryLooseEnvelope(e),!e.isIntersecting(this.m_envInter)||(this.m_qtIter.resetIterator(t,this.m_tolerance),this.m_function=this.iterate_,!0)}nextPoint_(){if(-1==--this.m_pointIndex)return this.m_bDone=!0,!1;const t=new Q;if(this.m_bSwapElements){const e=this.m_multiVertexImplB.getXY(this.m_pointIndex);t.setCoordsPoint2D(e)}else{const e=this.m_multiVertexImplA.getXY(this.m_pointIndex);t.setCoordsPoint2D(e)}return!this.m_envInter.contains(t)||(this.m_qtIter.resetIterator(r.construct(t.x,t.y,t.x,t.y),this.m_tolerance),this.m_function=this.iterate_,!0)}iterate_(){return this.m_elementHandle=this.m_qtIter.next(),-1===this.m_elementHandle&&(j(this.m_queryType)?(this.m_function=this.m_bPaths?this.nextPath_:this.nextSegment_,!0):(this.m_function=this.nextPoint_,!0))}}function _n(t){return 2===t?1:1===t?2:128===t?64:64===t?128:t}function fn(t,e,n){let i;if(t instanceof gm||null===t){const s=r.constructEmpty();s.setCoords({pt:e}),s.mergeEnvelope2D(n),i=a(t,s,!1)}else i=t;return i}function pn(t,e,n){let i;if(t instanceof gm||null===t){const s=r.constructEmpty();s.setCoords({env2D:e}),s.mergeEnvelope2D(n),i=a(t,s,!1)}else i=t;return i}function dn(t,e,i,s,o){if(t.isEmpty()||e.isEmpty())return 4===s;F(t),F(e);let a=t.getGeometryType(),m=e.getGeometryType();if(a===L.enumEnvelope){if(m===L.enumEnvelope)return yn(t,e,i,s);if(m===L.enumPoint)return Pn(e,t,i,_n(s))}else if(a===L.enumPoint){if(m===L.enumEnvelope)return Pn(t,e,i,s);if(m===L.enumPoint)return xn(t,e,i,s)}const c=r.constructEmpty();t.queryEnvelope(c);const u=r.constructEmpty();e.queryEnvelope(u);const l=pn(i,c,u);if(Cn(c,u,l))return 4===s;let h=!1,g=null,_=null,f=null,p=null;switch(U(a)?(g=new n({vd:t.getDescription()}),g.addSegment(t,!0),f=g,a=L.enumPolyline):f=t,U(m)?(_=new n({vd:e.getDescription()}),_.addSegment(e,!0),p=_,m=L.enumPolyline):p=e,a!==L.enumEnvelope&&m!==L.enumEnvelope?(f.getDimension()<p.getDimension()||a===L.enumPoint&&m===L.enumMultiPoint)&&(s=_n(s)):a!==L.enumPolygon&&m!==L.enumEnvelope&&(s=_n(s)),a){case L.enumPolygon:switch(m){case L.enumPolygon:h=wn(f,p,l,s,o);break;case L.enumPolyline:h=bn(f,p,l,s,o);break;case L.enumPoint:h=Tn(f,p,l,s);break;case L.enumMultiPoint:h=vn(f,p,l,s);break;case L.enumEnvelope:h=In(f,p,l,s,o)}break;case L.enumPolyline:switch(m){case L.enumPolygon:h=bn(p,f,l,s,o);break;case L.enumPolyline:h=Dn(f,p,l,s,o);break;case L.enumPoint:h=Gn(f,p,l,s);break;case L.enumMultiPoint:h=Nn(f,p,l,s);break;case L.enumEnvelope:h=Mn(f,p,l,s,o)}break;case L.enumPoint:switch(m){case L.enumPolygon:h=Tn(p,f,l,s);break;case L.enumPolyline:h=Gn(p,f,l,s);break;case L.enumMultiPoint:h=qn(p,f,l,s)}break;case L.enumMultiPoint:switch(m){case L.enumPolygon:h=vn(p,f,l,s);break;case L.enumPolyline:h=Nn(p,f,l,s);break;case L.enumMultiPoint:h=An(f,p,l,s);break;case L.enumPoint:h=qn(f,p,l,s);break;case L.enumEnvelope:h=Yn(f,p,l,s)}break;case L.enumEnvelope:switch(m){case L.enumPolygon:h=In(p,f,l,s,o);break;case L.enumPolyline:h=Mn(p,f,l,s,o);break;case L.enumMultiPoint:h=Yn(p,f,l,s)}}return h}function yn(t,e,n,i,s){if(t.isEmpty()||e.isEmpty())return 4===i;const o=r.constructEmpty();t.queryEnvelope(o);const a=r.constructEmpty();e.queryEnvelope(a);const m=pn(n,o,a);switch(i){case 4:return Cn(o,a,m);case 2:return Br(a,o,m,!1);case 128:return Br(a,o,m,!0);case 1:return Br(o,a,m,!1);case 64:return Br(o,a,m,!0);case 3:return Vr(o,a,m);case 8:return jr(o,a,m);case 32:return kr(o,a,m);case 16:return!1}return!1}function Pn(t,e,n,i,s){if(t.isEmpty()||e.isEmpty())return 4===i;const o=t.getXY(),a=r.constructEmpty();e.queryEnvelope(a);const m=fn(n,o,a);switch(i){case 4:return Sn(o,a,m);case 2:case 128:return zr(o,a,m);case 1:case 64:return!1;case 3:return Ur(o,a,m);case 8:return Hr(o,a,m)}return!1}function xn(t,e,n,i,s){if(t.isEmpty()||e.isEmpty())return 4===i;const o=t.getXY(),m=e.getXY();let c;if(n instanceof gm||null===n){const t=r.constructEmpty();t.setCoords({pt:o}),t.merge(m),c=a(n,t,!1)}else c=n;switch(i){case 4:return Or(o,m,c);case 2:case 128:return Lr(m,o,c);case 1:case 64:return Lr(o,m,c);case 3:return Fr(o,m,c)}return!1}function Cn(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:e}),i.inflateCoords(n,n),!t.isIntersecting(i)}function En(t,e,n,r=!1){const i=t.getGeometryType(),s=e.getGeometryType();if(z(i)){const e=t.getImpl().getAccelerators();if(null!==e){const t=e.getRasterizedGeometry();X(null===t)}}if(z(s)){const t=e.getImpl().getAccelerators();if(null!==t){const e=t.getRasterizedGeometry();X(null===e)}}return 0}function Sn(t,e,n,i){const s=r.constructEmpty();return s.setCoords({env2D:e}),s.inflateCoords(n,n),!s.contains(t)}function wn(t,e,n,r,i){switch(r){case 4:return Rn(t,e,n);case 2:return Ln(e,t,n,i);case 128:return Un(e,t,n);case 1:return Ln(t,e,n,i);case 64:return Un(t,e,n);case 3:return Xn(t,e,n,i);case 8:return Fn(t,e,n);case 32:return On(t,e,n,i)}return!1}function bn(t,e,n,r,i){switch(r){case 4:return Hn(t,e,n);case 1:return jn(t,e,n,i);case 64:return kn(t,e,n);case 8:return zn(t,e,n,i);case 16:return Vn(t,e,n)}return!1}function Tn(t,e,n,r,i){switch(r){case 4:return Bn(t,e,n);case 1:case 64:return Kn(t,e,n);case 8:return Zn(t,e,n)}return!1}function vn(t,e,n,r,i){switch(r){case 4:return Wn(t,e,n);case 1:return $n(t,e,n,!1);case 64:return $n(t,e,n,!0);case 8:return Qn(t,e,n);case 16:return Jn(t,e,n)}return!1}function In(t,e,n,r,i){if(er(t,e,n))return 4===r;if(4===r)return!1;switch(r){case 2:return ir(t,e,n,!1);case 128:return ir(t,e,n,!0);case 1:return sr(t,e,n,!1,i);case 64:return sr(t,e,n,!0,i);case 3:return tr(t,e,n,i);case 8:return nr(t,e,n,i);case 32:return rr(t,e,n,i);case 16:return!1}return!1}function Dn(t,e,n,r,i){switch(r){case 4:return ar(t,e,n);case 2:return lr(e,t,n,i);case 128:return hr(e,t,n,i);case 1:return lr(t,e,n,i);case 64:return hr(t,e,n,i);case 3:return or(t,e,n,i);case 8:return mr(t,e,n,i);case 32:return ur(t,e,n,i);case 16:return cr(t,e,n,i)}return!1}function Gn(t,e,n,r,i){switch(r){case 4:return gr(t,e,n);case 1:case 64:return fr(t,e,n);case 8:return _r(t,e,n)}return!1}function Nn(t,e,n,r,i){switch(r){case 4:return pr(t,e,n);case 1:case 64:return Pr(t,e,n);case 8:return dr(t,e,n);case 16:return yr(t,e,n)}return!1}function Mn(t,e,n,r,i){if(Cr(t,e,n))return 4===r;if(4===r)return!1;switch(r){case 2:return Sr(t,e,n,!1);case 128:return Sr(t,e,n,!0);case 1:case 64:case 32:return!1;case 3:return xr(t,e,n);case 8:return Er(t,e,n,i);case 16:return wr(t,e,n)}return!1}function An(t,e,n,r,i){switch(r){case 4:return Tr(t,e,n);case 2:case 128:return Ir(e,t,n);case 1:case 64:return Ir(t,e,n);case 3:return br(t,e,n);case 32:return vr(t,e,n)}return!1}function qn(t,e,n,r,i){switch(r){case 4:return Gr(t,e,n);case 2:case 128:return Nr(t,e,n);case 1:case 64:return Mr(t,e,n);case 3:return Dr(t,e,n)}return!1}function Yn(t,e,n,r,i){switch(r){case 4:return qr(t,e,n);case 2:return Xr(t,e,n,!1);case 128:return Xr(t,e,n,!0);case 1:case 64:return!1;case 3:return Ar(t,e,n);case 8:return Yr(t,e,n);case 16:return Rr(t,e,n)}return!1}function Xn(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),!Vr(s,o,n))return!1;if(En(t,e),ti(t,e,n))return!0;const a=t.calculateLength2D(),m=e.calculateLength2D(),c=Math.max(t.getPointCount(),e.getPointCount());if(Math.abs(a-m)>4*c*n)return!1;if(t.hasNonLinearSegments()||e.hasNonLinearSegments()){return Re(t,e,n,"**F**FFF*",i,!1)}return ri(t,e,n,!0)}function Rn(t,e,n,r){En(t,e,n,!0);return 1===Zr(t,e,n,!0)}function Fn(t,e,n,r){return En(t,e),li(t,e,n,null)}function On(t,e,n,r){return En(t,e),hi(t,e,n,r)}function Ln(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&(En(t,e),gi(t,e,n,i))}function Un(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&(En(t,e),2===Zr(t,e,n,!1))}function Hn(t,e,n,r){En(t,e,n,!0);return 1===Zr(t,e,n,!0)}function zn(t,e,n,r){return En(t,e),_i(t,e,n,r)}function Vn(t,e,n,r){return En(t,e),fi(t,e,n,null)}function jn(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&(En(t,e),pi(t,e,n,i))}function kn(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&(En(t,e),2===Zr(t,e,n,!1))}function Bn(t,e,n,r){return 0===zt(t,e,n)}function Zn(t,e,n,r){return yi(t,e.getXY(),n)}function Kn(t,e,n,r){return di(t,e.getXY(),n)}function Wn(t,e,n,r,i){En(t,e);return 1===Kr(t,e,n)}function Qn(t,n,i,s){En(t,n);const o=r.constructEmpty();t.queryEnvelope(o),o.inflateCoords(i,i);const a=new Q;let m=!1;const c=t.getImpl(),u=new e;let l=t,h=!1;for(let e=0;e<n.getPointCount();e++){if(n.queryXY(e,a),o.contains(a)){const t=Ot(l,a,i);if(2===t)m=!0;else if(1===t)return!1}h||(!Vt(t,n.getPointCount()-1)||null!==c.getAccelerators()&&null!==c.getAccelerators().getQuadTree()?l=t:(t.copyTo(u),u.getImpl().buildQuadTreeAccelerator(1),l=u),h=!0)}return!!m}function Jn(t,n,i,s){En(t,n);const o=new r,a=new r,m=new r;t.queryEnvelope(o),n.queryEnvelope(m),a.setCoords({env2D:o}),a.inflateCoords(i,i);let c=!1,u=!1;const l=new Q,h=t.getImpl(),g=new e;let _=t,f=!1;for(let e=0;e<n.getPointCount();e++){if(n.queryXY(e,l),a.contains(l)){const t=Ot(_,l,i);0===t?u=!0:1===t&&(c=!0)}else u=!0;if(c&&u)return!0;f||(!Vt(t,n.getPointCount()-1)||null!==h.getAccelerators()&&null!==h.getAccelerators().getQuadTree()?_=t:(t.copyTo(g),g.getImpl().buildQuadTreeAccelerator(1),_=g),f=!0)}return!1}function $n(t,n,i,s,o){const a=r.constructEmpty(),m=r.constructEmpty();if(t.queryEnvelope(a),n.queryEnvelope(m),!Qr(a,m,i))return!1;En(t,n);let c=!1;const u=new Q,l=t.getImpl(),h=new e;let g=t,_=!1;for(let e=0;e<n.getPointCount();e++){if(n.queryXY(e,u),!a.contains(u))return!1;const r=Ot(g,u,i);if(1===r)c=!0;else if(0===r)return!1;if(s&&2===r)return!1;_||(!Vt(t,n.getPointCount()-1)||null!==l.getAccelerators()&&null!==l.getAccelerators().getQuadTree()?g=t:(t.copyTo(h),h.getImpl().buildQuadTreeAccelerator(1),g=h),_=!0)}return c}function tr(t,n,i,s){const o=new r,a=new r;if(t.queryEnvelope(o),n.queryEnvelope(a),!Vr(o,a,i))return!1;const m=new e;return m.addEnvelope(n,!1),Xn(t,m,i,s)}function er(t,e,n,i){En(t,e);const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),Qr(o,s,n))return!1;const a=o.getLowerLeft();return 0===Ot(t,a,0)&&(!o.contains(t.getXY(0))&&!ui(t,o,n))}function nr(t,n,i,s){En(t,n);const o=new r,a=new r;if(t.queryEnvelope(o),n.queryEnvelope(a),Qr(a,o,i))return!1;if(a.height()<=i||a.width()<=i)return!1;const m=new e;return m.addEnvelope(n,!1),li(t,m,i,s)}function rr(t,n,i,s){En(t,n);const o=new r,a=new r;if(t.queryEnvelope(o),n.queryEnvelope(a),Qr(a,o,i))return!1;if(a.height()<=i||a.width()<=i)return!1;const m=new e;return m.addEnvelope(n,!1),hi(t,m,i,s)}function ir(t,e,n,i,s){const o=r.constructEmpty(),a=r.constructEmpty();return t.queryEnvelope(o),e.queryEnvelope(a),i?Jr(a,o,n):Qr(a,o,n)}function sr(t,n,i,s,o){const a=r.constructEmpty(),m=r.constructEmpty();if(t.queryEnvelope(a),n.queryEnvelope(m),!Qr(a,m,i))return!1;En(t,n);const c=new e;return c.addEnvelope(n,!1),s?2===Zr(t,c,i,!1):gi(t,c,i,o)}function or(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),!Vr(s,o,n))return!1;if(En(t,e),ti(t,e,n))return!0;if(t.hasNonLinearSegments()||e.hasNonLinearSegments()){return Re(t,e,n,"**F**FFF*",i,!1)}return ri(t,e,n,!1)}function ar(t,e,n,r){En(t,e);const i=t.getImpl(),s=e.getImpl();return!new gn(i,s,n,!0).next()||!si(t,e,n)}function mr(t,e,n,i){En(t,e);const s=[],o=oi(t,e,n,s);if(-2===o){const s=r.constructEmpty(),o=r.constructEmpty(),a=r.constructEmpty();let m,c;if(t.queryEnvelope(s),e.queryEnvelope(o),s.inflateCoords(1e3*n,1e3*n),o.inflateCoords(1e3*n,1e3*n),a.setCoords({env2D:s}),a.intersect(o),t.getPointCount()>10){if(m=Gt(t,a,n,0,i),m.isEmpty())return!1}else m=t;if(e.getPointCount()>10){if(c=Gt(e,a,n,0,i),c.isEmpty())return!1}else c=e;return Re(m,c,n,"F********",i,!1)}if(0!==o)return!1;const a=new m;for(let r=0;r<s.length;r+=2){const t=s[r],e=s[r+1];a.addXY(t,e)}const c=t.getBoundary(),u=e.getBoundary();return c.addPoints(u,0,u.getPointCount()),!c.isEmpty()&&Ir(c,a,n)}function cr(t,e,n,i){En(t,e);const s=[],o=oi(t,e,n,s);if(-2===o){const s=r.constructEmpty(),o=r.constructEmpty(),a=r.constructEmpty();let m,c;if(t.queryEnvelope(s),e.queryEnvelope(o),s.inflateCoords(1e3*n,1e3*n),o.inflateCoords(1e3*n,1e3*n),a.setCoords({env2D:s}),a.intersect(o),t.getPointCount()>10){if(m=Gt(t,a,n,0,i),m.isEmpty())return!1}else m=t;if(e.getPointCount()>10){if(c=Gt(e,a,n,0,i),c.isEmpty())return!1}else c=e;return Re(m,c,n,"0********",i,!1)}if(0!==o)return!1;const a=new m;for(let r=0;r<s.length;r+=2){const t=s[r],e=s[r+1];a.addXY(t,e)}const c=t.getBoundary(),u=e.getBoundary();return c.addPoints(u,0,u.getPointCount()),!!c.isEmpty()||!Ir(c,a,n)}function ur(t,e,n,i){En(t,e);const s=r.constructEmpty(),o=r.constructEmpty();t.queryEnvelope(s),e.queryEnvelope(o);const a=$r(s,o,n),m=$r(o,s,n),c=t.hasNonLinearSegments(),u=e.hasNonLinearSegments(),l=oi(t,e,n,null);if(-1===l)return!1;if(1===l){if(a&&m)return!0;if(!c&&!u)return a&&!m?!ii(e,t,n,!1):m&&!a?!ii(t,e,n,!1):!ii(t,e,n,!1)&&!ii(e,t,n,!1)}const h=r.constructEmpty(),g=r.constructEmpty(),_=r.constructEmpty();let f,p;h.setCoords({env2D:s}),h.inflateCoords(1e3*n,1e3*n),g.setCoords({env2D:o}),g.inflateCoords(1e3*n,1e3*n),_.setCoords({env2D:h}),_.intersect(g);let d="";if(d+="1*",a){if(e.getPointCount()>10){if(p=Gt(e,_,n,0,i),p.isEmpty())return!1}else p=e;d+="****"}else p=e,d+="T***";if(m){if(t.getPointCount()>10){if(f=Gt(t,_,n,0,i),f.isEmpty())return!1}else f=t;d+="***"}else f=t,d+="T**";return Re(f,p,n,d,i,!1)}function lr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),!Qr(s,o,n))return!1;if(En(t,e),t.hasNonLinearSegments()||e.hasNonLinearSegments()){return Re(t,e,n,"******FF*",i,!1)}return ii(e,t,n,!1)}function hr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),!Qr(s,o,n))return!1;En(t,e);return Re(t,e,n,"T**FF*FF*",i,!1)}function gr(t,e,n,r){En(t,e);return!mi(t,e.getXY(),n)}function _r(t,e,n,r){En(t,e);return xi(t,e.getXY(),n)}function fr(t,e,n,r){En(t,e);return ci(t,e.getXY(),n)}function pr(t,e,n,r){return En(t,e),!ai(t,e,n,!1)}function dr(t,e,n,r){En(t,e);const i=t.getImpl(),s=e.getImpl(),o=new m,a=new gn(i,s,n,!1),c=i.querySegmentIterator();let u=!1;for(;a.next();){const t=a.getRedElement(),e=a.getBlueElement();c.resetToVertex(t,-1);const r=c.nextSegment(),i=s.getXY(e);r.isIntersectingPoint(i,n)&&(u=!0,o.addPoint2D(i))}if(!u)return!1;const l=t.getBoundary();return!l.isEmpty()&&Ir(l,o,n)}function yr(t,e,n,r){En(t,e);const i=t.getImpl(),s=e.getImpl(),o=s.getPointCount(),a=ut(o,!1),c=new gn(i,s,n,!1),u=i.querySegmentIterator();let l=!1;for(;c.next();){const t=c.getRedElement(),e=c.getBlueElement();u.resetToVertex(t,-1);const r=u.nextSegment(),i=s.getXY(e);r.isIntersectingPoint(i,n)&&(l=!0,a[e]=!0)}if(!l)return!1;let h=!1;for(let m=0;m<o;m++)if(!a[m]){h=!0;break}if(!h)return!1;const g=t.getBoundary();if(g.isEmpty())return!0;const _=new m;for(let m=0;m<o;m++)a[m]&&_.addPoint2D(s.getXY(m));return!Ir(g,_,n)}function Pr(t,e,n,i,s){const o=r.constructEmpty(),a=r.constructEmpty();if(t.queryEnvelope(o),e.queryEnvelope(a),!Qr(o,a,n))return!1;En(t,e);const m=ai(t,e,n,!0);if(!m)return m;const c=t.getBoundary();return c.isEmpty()?m:!Ir(c,e,n)}function xr(t,e,n,i){const s=new r,o=new r;return t.queryEnvelope(s),e.queryEnvelope(o),!(o.height()>n&&o.width()>n)&&Vr(s,o,n)}function Cr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();t.queryEnvelope(s),e.queryEnvelope(o);const a=Ci(o,s,n);return 0===a?!ui(t,o,n):4===a}function Er(t,n,i,s){const o=new r,a=new r;if(t.queryEnvelope(o),n.queryEnvelope(a),a.height()<=i||a.width()<=i)return!1;const m=new r,c=new r;if(m.setCoords({env2D:a}),c.setCoords({env2D:a}),m.inflateCoords(i,i),c.inflateCoords(-i,-i),c.containsEnvelope(o)||!o.isIntersecting(m))return!1;const u=t.getImpl().querySegmentIterator();u.stripAttributes();const l=t.getImpl().getAccelerators();let h=null,g=null;null!==l&&(h=l.getQuadTree(),null!==h&&(g=h.getIterator(a,i))),g||u.nextPath()||V("relational_operations");let _=!1,f=null;const p=new Q,d=new Q,y=t.hasNonLinearSegments();let P=!1;for(;;){if(null!==g){const t=g.next();if(-1===t)break;u.resetToVertex(h.getElement(t),-1),f=u.nextSegment()}else{for(;!u.hasNextSegment()&&u.nextPath(););if(!u.hasNextSegment())break;f=u.nextSegment()}if(y&&f.getGeometryType()!==L.enumLine){const t=new r;if(f.queryEnvelope(t),c.containsEnvelope(t))return!1;if(m.isIntersecting(t)){P=!0;break}}else{p.assign(f.getStartXY()),d.assign(f.getEndXY());let t=c.clipLine(p,d);if(0!==t)return!1;_||(t=m.clipLine(p,d),0!==t&&(_=!0))}}if(!P)return _;const x=new e;return x.addEnvelope(a,!1),zn(x,t,i,s)}function Sr(t,e,n,i,s){const o=r.constructEmpty(),a=r.constructEmpty();if(t.queryEnvelope(o),e.queryEnvelope(a),a.height()<=n||a.width()<=n)return!1;if(i)return Jr(a,o,n);if(!Qr(a,o,n))return!1;const m=r.constructEmpty();m.setCoords({env2D:a}),m.inflateCoords(-n,-n);const c=r.constructEmpty();if(c.setCoords({env2D:a}),c.inflateCoords(n,n),m.containsEnvelope(o))return!0;const u=t.getImpl().querySegmentIterator();u.stripAttributes(),u.nextPath()||V("relational_operations");let l,h,g,f,p,d,y=!1;const P=t.hasNonLinearSegments();for(P&&(g=new _,f=new _,p=new _,d=new _,m.querySide(0,g),m.querySide(1,f),m.querySide(2,p),m.querySide(3,d));;){for(;!u.hasNextSegment()&&u.nextPath(););if(!u.hasNextSegment())break;const t=u.nextSegment();if(P&&t.getGeometryType()!==L.enumLine){if(t.isIntersecting(g,n)){y=!0;break}if(t.isIntersecting(f,n)){y=!0;break}if(t.isIntersecting(p,n)){y=!0;break}if(t.isIntersecting(d,n)){y=!0;break}}else{l=t.getStartXY(),h=t.getEndXY();if(0!==m.clipLine(l,h)){y=!0;break}}}return y}function wr(t,e,n,i){const s=new r,o=new r;if(t.queryEnvelope(s),e.queryEnvelope(o),o.height()<=n||o.width()<=n)return!1;const a=new r;if(a.setCoords({env2D:o}),a.inflateCoords(n,n),a.containsEnvelope(s))return!1;const m=!0,c=new r;if(c.setCoords({env2D:o}),c.inflateCoords(-n,-n),!c.isIntersecting(s))return!1;const u=t.getImpl().querySegmentIterator();u.stripAttributes();const l=t.getImpl().getAccelerators();let h=null,g=null;if(null!==l&&(h=l.getQuadTree(),null!==h&&(g=h.getIterator(o,n))),!g){const t=u.nextPath();X(t)}let f=!1,p=null;const d=new Q,y=new Q;let P=null,x=null,C=null,E=null;for(t.hasNonLinearSegments()&&(P=new _,x=new _,C=new _,E=new _,c.querySide(0,P),c.querySide(1,x),c.querySide(2,C),c.querySide(3,E));;){if(null!==g){const t=g.next();if(-1===t)break;u.resetToVertex(h.getElement(t),-1),p=u.nextSegment()}else{for(;!u.hasNextSegment()&&u.nextPath(););if(!u.hasNextSegment())break;p=u.nextSegment()}if(p.getGeometryType()===L.enumLine){d.assign(p.getStartXY()),y.assign(p.getEndXY());if(0!==c.clipLine(d,y)){f=!0;break}}else{if(P.isIntersecting(p,n)){f=!0;break}if(x.isIntersecting(p,n)){f=!0;break}if(C.isIntersecting(p,n)){f=!0;break}if(E.isIntersecting(p,n)){f=!0;break}}}return f&&m}function br(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Vr(s,o,n)&&(!!ei(t,e,n)||ni(t,e,n,!1,!0,!1))}function Tr(t,e,n,r){const i=t,s=e,o=new gn(i,s,n,!1),a=n*n,m=new Q,c=new Q;for(;o.next();){const t=o.getRedElement(),e=o.getBlueElement();if(i.queryXY(t,m),s.queryXY(e,c),Q.sqrDistance(m,c)<=a)return!1}return!0}function vr(t,e,n,r){return ni(t,e,n,!1,!1,!0)}function Ir(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),!!Qr(s,o,n)&&ni(e,t,n,!0,!1,!1)}function Dr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();return t.queryEnvelope(s),e.queryEnvelope(o),Vr(s,o,n)}function Gr(t,e,n,r){return Pi(t,e.getXY(),n)}function Nr(t,e,n,r){return Dr(t,e,n)}function Mr(t,e,n,r){return!Gr(t,e,n)}function Ar(t,e,n,i){const s=new r,o=new r;return t.queryEnvelope(s),e.queryEnvelope(o),!(o.height()>n||o.width()>n)&&Vr(s,o,n)}function qr(t,e,n,i){const s=r.constructEmpty(),o=r.constructEmpty();if(t.queryEnvelope(s),e.queryEnvelope(o),Qr(o,s,n))return!1;const a=r.constructEmpty();a.setCoords({env2D:o}),a.inflateCoords(n,n);const m=new Q;for(let r=0;r<t.getPointCount();r++)if(t.queryXY(r,m),a.contains(m))return!1;return!0}function Yr(t,e,n,i){const s=new r,o=new r,a=new r;if(e.queryEnvelope(s),s.height()<=n||s.width()<=n)return!1;o.setCoords({env2D:s}),a.setCoords({env2D:s}),o.inflateCoords(n,n),a.inflateCoords(-n,-n);const m=new Q;let c=!1;for(let r=0;r<t.getPointCount();r++)if(t.queryXY(r,m),o.contains(m)){if(a.containsExclusive(m))return!1;c=!0}return c}function Xr(t,e,n,i,s){const o=r.constructEmpty(),a=r.constructEmpty();if(t.queryEnvelope(o),e.queryEnvelope(a),a.height()<=n||a.width()<=n)return!1;if(i)return Jr(a,o,n);if(!Qr(a,o,n))return!1;let m=!1;const c=r.constructEmpty(),u=r.constructEmpty();c.setCoords({env2D:a}),u.setCoords({env2D:a}),c.inflateCoords(-n,-n),u.inflateCoords(n,n);const l=new Q;for(let r=0;r<t.getPointCount();r++){if(t.queryXY(r,l),!u.contains(l))return!1;c.containsExclusive(l)&&(m=!0)}return m}function Rr(t,e,n,i){const s=new r,o=new r;if(t.queryEnvelope(s),e.queryEnvelope(o),Qr(o,s,n))return!1;if(o.height()<=n||o.width()<=n)return!1;const a=new r,m=new r;a.setCoords({env2D:o}),a.inflateCoords(-n,-n),m.setCoords({env2D:o}),m.inflateCoords(n,n);const c=new Q;let u=!1,l=!1;for(let r=0;r<t.getPointCount();r++)if(t.queryXY(r,c),!u&&a.containsExclusive(c)&&(u=!0),l||m.contains(c)||(l=!0),u&&l)return!0;return!1}function Fr(t,e,n,r){return Q.sqrDistance(t,e)<=n*n}function Or(t,e,n,r){return Q.sqrDistance(t,e)>n*n}function Lr(t,e,n,r){return Fr(t,e,n)}function Ur(t,e,n,i){const s=new r;return s.setCoords({pt:t}),Vr(s,e,n)}function Hr(t,e,n,i){if(e.height()<=n||e.width()<=n)return!1;const s=new r,o=new r;return s.setCoords({env2D:e}),s.inflateCoords(n,n),!!s.contains(t)&&(o.setCoords({env2D:e}),o.inflateCoords(-n,-n),!o.containsExclusive(t))}function zr(t,e,n,i){if(e.height()<=n||e.width()<=n)return!1;const s=r.constructEmpty();s.setCoords({env2D:e}),s.inflateCoords(-n,-n);return s.containsExclusive(t)}function Vr(t,e,n,r){return Qr(t,e,n)&&Qr(e,t,n)}function jr(t,e,n,i){if(t.height()<=n||t.width()<=n||e.height()<=n||e.width()<=n)return!1;const s=new r;return s.setCoords({env2D:t}),s.inflateCoords(-n,-n),s.intersect(e),!(!s.isEmpty()&&s.height()>n&&s.width()>n)&&(s.setCoords({env2D:t}),s.inflateCoords(n,n),s.intersect(e),!s.isEmpty())}function kr(t,e,n,i){if(t.height()<=n||t.width()<=n||e.height()<=n||e.width()<=n)return!1;if(Qr(t,e,n))return!1;if(Qr(e,t,n))return!1;const s=new r;return s.setCoords({env2D:t}),s.inflateCoords(-n,-n),s.intersect(e),!s.isEmpty()&&(s.height()>n||s.width()>n)}function Br(t,e,n,i,s){if(t.height()<=n||t.width()<=n)return!1;if(i)return Jr(t,e,n);if(!Qr(t,e,n))return!1;const o=r.constructEmpty();return o.setCoords({env2D:t}),o.inflateCoords(-n,-n),o.intersect(e),!o.isEmpty()}function Zr(t,n,i,s,o){const a=new Q,m=new Q,c=r.constructEmpty(),u=r.constructEmpty(),l=t.getImpl(),h=n.getImpl(),g=h.getGeometryType(),_=new gn(l,h,i,!0);if(!_.next())return 1;if(si(t,n,i))return s?4:0;const f=new e;let p=t;const d=new e;let y=null;g===L.enumPolygon&&(y=n);const P=g===L.enumPolygon?ut(l.getPathCount(),!1):[],x=ut(h.getPathCount(),!1);let C=!1,E=!1,S=!1,w=!1,b=!1,T=!1;do{if(S&&b||w&&T)break;if(S&&w)break;const e=_.getRedElement(),r=_.getBlueElement();if(!x[r]&&(m.assign(n.getXY(n.getPathStart(r))),c.setCoords({env2D:_.getRedEnvelope()}),c.inflateCoords(i,i),c.contains(m))){if(0!==Ot(p,m,0)){if(w=!0,s)return 4}else T=!0;x[r]=!0}if(g===L.enumPolygon&&!P[e]&&(a.assign(t.getXY(t.getPathStart(e))),u.setCoords({env2D:_.getBlueEnvelope()}),u.inflateCoords(i,i),u.contains(a))){if(0!==Ot(y,a,0)){if(S=!0,s)return 4}else b=!0;P[e]=!0}if(C||(!Vt(t,n.getPathCount()-1)||null!==l.getAccelerators()&&null!==l.getAccelerators().getQuadTree()?p=t:(t.copyTo(f),f.getImpl().buildQuadTreeAccelerator(1),p=f),C=!0),g===L.enumPolygon&&!E){const e=n;!Vt(e,t.getPathCount()-1)||null!==h.getAccelerators()&&null!==h.getAccelerators().getQuadTree()?y=n:(e.copyTo(d),d.getImpl().buildQuadTreeAccelerator(1),y=d),E=!0}}while(_.next());if(!S&&!w)return 1;if(!b||!T){if(g===L.enumPolygon)for(let t=0,e=l.getPathCount();t<e;t++)if(!P[t]){b=!0;break}for(let t=0,e=h.getPathCount();t<e;t++)if(!x[t]){T=!0;break}}return S&&b||w&&T||S&&w?4:w?2:3}function Kr(t,n,i,s,o){const a=r.constructEmpty();t.queryEnvelope(a),a.inflateCoords(i,i);const m=new Q,c=t.getImpl(),u=new e;let l=t,h=!1,g=!1,_=!1;for(let e=0;e<n.getPointCount();e++){if(n.queryXY(e,m),a.contains(m)){const t=Ot(l,m,i);if(1===t)return g=!0,4;if(2===t)return 4;_=!0}else _=!0;h||(!Vt(t,n.getPointCount()-1)||null!==c.getAccelerators()&&null!=c.getAccelerators().getQuadTree()?l=t:(t.copyTo(u),u.getImpl().buildQuadTreeAccelerator(1),l=u),h=!0)}return g?_?4:2:1}function Wr(t,n,i,s,o){s[0]=!1;const a=t.getImpl(),m=n.getImpl(),c=a.querySegmentIterator(),u=m.querySegmentIterator(),l=[0,0],h=[0,0],g=new gn(a,m,i);let _=!1;for(;g.next();){const t=g.getRedElement(),e=g.getBlueElement();c.resetToVertex(t,-1),u.resetToVertex(e,-1);const n=c.nextSegment(),r=u.nextSegment();let o=0;if(Ei(n,r)?!_&&r.isIntersecting(n,i)&&(_=!0):o=r.intersect(n,null,h,l,i),0!==o&&(_=!0,1===o)){const t=l[0],e=h[0];if(t>0&&t<1&&e>0&&e<1)return s[0]=!0,!1}}if(!_){s[0]=!0;const o=r.constructEmpty();t.queryEnvelope(o),o.inflateCoords(i,i);const c=new e;let u=t,l=!1;for(let e=0,i=n.getPathCount();e<i;e++)if(n.getPathSize(e)>0){const i=r.constructEmpty();if(n.queryPathEnvelope(e,i),!o.isIntersecting(i))return!1;{const t=n.getXY(n.getPathStart(e)),r=Bt(u,t,0);if(X(-1!==r),0===r)return!1}l||(!Vt(t,n.getPathCount()-1)||null!==a.getAccelerators()&&null!==a.getAccelerators().getQuadTree()?u=t:(t.copyTo(c),c.getImpl().buildQuadTreeAccelerator(1),u=c),l=!0)}if(1===t.getPathCount()||n.getGeometryType()===L.enumPolyline)return!0;const h=n,g=r.constructEmpty();h.queryEnvelope(g),g.inflateCoords(i,i);const _=new e;let f=h,p=!1;for(let e=0,n=t.getPathCount();e<n;e++)if(t.getPathSize(e)>0){const n=r.constructEmpty();if(t.queryPathEnvelope(e,n),g.isIntersecting(n)){const n=t.getXY(t.getPathStart(e)),r=Bt(f,n,0);if(X(-1!==r),1===r)return!1}p||(!Vt(h,t.getPathCount()-1)||null!==m.getAccelerators()&&null!==m.getAccelerators().getQuadTree()?f=h:(h.copyTo(_),_.getImpl().buildQuadTreeAccelerator(1),f=_),p=!0)}return!0}return!1}function Qr(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:t}),i.inflateCoords(n,n),i.containsEnvelope(e)}function Jr(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:e}),i.inflateCoords(n,n),t.containsExclusiveEnvelope(i)}function $r(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:e}),i.inflateCoords(n,n),!i.contains(t.getLowerLeft())||(!i.contains(t.getLowerRight())||(!i.contains(t.getUpperLeft())||!i.contains(t.getUpperRight())))}function ti(t,e,n,r){if(t.getPathCount()!==e.getPathCount()||t.getPointCount()!==e.getPointCount())return!1;if(t.hasNonLinearSegments()||e.hasNonLinearSegments())return t.equals(e);const i=new Q,s=new Q;let o=!0;const a=n*n;for(let m=0;m<t.getPathCount();m++){if(t.getPathEnd(m)!==e.getPathEnd(m)){o=!1;break}for(let n=t.getPathStart(m);n<e.getPathEnd(m);n++)if(t.queryXY(n,i),e.queryXY(n,s),Q.sqrDistance(i,s)>a){o=!1;break}if(!o)break}return!!o}function ei(t,e,n,r){if(t.getPointCount()!==e.getPointCount())return!1;const i=new Q,s=new Q;let o=!0;const a=n*n;for(let m=0;m<t.getPointCount();m++)if(t.queryXY(m,i),e.queryXY(m,s),Q.sqrDistance(i,s)>a){o=!1;break}return!!o}function ni(t,e,n,r,i,s,o){const a=t.getImpl(),m=e.getImpl(),c=a.getPointCount(),u=m.getPointCount(),l=ut(c,!1),h=i||s?ut(u,!1):[],g=n*n,_=new gn(a,m,n);for(;_.next();){const t=_.getRedElement(),e=_.getBlueElement(),n=a.getXY(t),r=m.getXY(e);Q.sqrDistance(n,r)<=g&&(l[t]=!0,(i||s)&&(h[e]=!0))}let f=!1,p=!1;for(let P=0;P<c;P++){const t=l[P];if(f||=!t,p||=t,(i||r)&&f)return!1}if(r)return!0;let d=!1,y=!1;for(let P=0;P<u;P++){const t=h[P];if(d||=!t,y||=t,i&&d)return!1}return!!i||f&&p&&d&&y}function ri(t,e,n,r){return ii(t,e,n,r)&&ii(e,t,n,r)}function ii(t,e,n,i){if(R(t),R(e),e.isEmpty())return!1;let s=!0;const o=ut(2,Number.NaN),m=ut(2,Number.NaN),c=[],u=new wi;let l;const h=r.constructEmpty(),g=r.constructEmpty(),_=r.constructEmpty();t.queryEnvelope(h),e.queryEnvelope(g),h.inflateCoords(n,n),g.inflateCoords(n,n),_.setCoords({env2D:h}),_.intersect(g);const p=t.getImpl().querySegmentIterator(),d=e.getImpl().querySegmentIterator(),y=e.getImpl().getAccelerators();let P=null,x=null,C=null,E=null;if(null!==y&&(P=y.getQuadTree(),x=y.getQuadTreeForPaths(),null!==x&&(E=x.getIteratorForQT())),null===P){const n=t.getPointCount(),r=e.getPointCount();n>10&&r>10&&(P=f(e.getImpl(),_))}for(null!==P&&(C=P.getIteratorForQT());p.nextPath();)for(;p.hasNextSegment();){let t=p.nextSegment();if(t.queryEnvelope(h),!h.isIntersecting(_))return s=!1,!1;if(null!==E&&(E.resetIterator(h,n),-1===E.next()))continue;let e=0,r=null;if(null!=C)C.resetIterator(t,n);else if(d.resetToFirstPath(),!d.nextPath())return s=!1,!1;do{if(e=0,null!==C){const i=C.next();if(-1===i)return s=!1,!1;d.resetToVertex(P.getElement(i),-1),r=d.nextSegment(),e=t.intersect(r,null,o,m,n)}else{for(;!d.hasNextSegment();)if(!d.nextPath())return s=!1,!1;r=d.nextSegment(),r.queryEnvelope(g),g.inflateCoords(n,n),h.isIntersecting(g)&&(e=t.intersect(r,null,o,m,n))}}while(2!==e||0!==o[0]||i&&!(m[0]<=m[1]));let f=Number.NaN,y=!1;do{let i=!1;if(1===o[1]){if(!p.hasNextSegment()){y=!0;break}t=p.nextSegment(),i=!0}if(1===m[1]&&m[0]<=m[1]){if(-1===f)break;if(f=1,!d.hasNextSegment())break;r=d.nextSegment(),i=!0}if(0===m[1]&&m[0]>m[1]){if(1===f)break;if(Number.isNaN(f)){if(!d.hasPreviousSegment())break;d.previousSegment(),f=-1}if(!d.hasPreviousSegment())break;r=d.previousSegment(),i=!0}if(!i)break;e=t.intersect(r,null,o,m,n)}while(2===e&&(!i||m[0]<=m[1]));if(y)continue;const x=t.calculateLength2D();t.queryEnvelope(h),c.length=0,u.m_overlapEvents.length=0;let S=!1,w=!1,b=0;const T=a(null,h,!0);for(null!==C?C.resetIterator(t,n):(d.resetToFirstPath(),d.nextPath()||V("relational_operations"));;){if(e=0,null!==C){const i=C.next();if(-1===i)break;d.resetToVertex(P.getElement(i),-1),r=d.nextSegment(),e=t.intersect(r,null,o,m,n)}else{for(;!d.hasNextSegment()&&d.nextPath(););if(!d.hasNextSegment())break;r=d.nextSegment(),r.queryEnvelope(g),g.inflateCoords(n,n),h.isIntersecting(g)&&(e=t.intersect(r,null,o,m,n))}if(2===e&&(!i||m[0]<=m[1])){const t=p.getStartPointIndex(),e=p.getPathIndex(),r=d.getStartPointIndex(),i=d.getPathIndex();if(l=Si(t,e,o[0],o[1],r,i,m[0],m[1]),u.m_overlapEvents.push(l),c.push(c.length),!(S||l.m_scalarA0<b&&l.m_scalarA1<b))if(0===b&&x*(l.m_scalarA0-b)>n)S=!0;else if(0!==b&&x*(l.m_scalarA0-b)>T)S=!0;else if(b=l.m_scalarA1,x*(1-b)<=n||1===b){w=!0;break}}}if(!w){if(!S)return s=!1,!1;c.length>1&&c.sort(((t,e)=>u.compareOverlapEvents(t,e))),b=0;for(let t=0;t<u.m_overlapEvents.length;t++)if(l=u.m_overlapEvents[c[t]],!(l.m_scalarA0<b&&l.m_scalarA1<b)){if(0===b&&x*(l.m_scalarA0-b)>n)return s=!1,!1;if(0!==b&&x*(l.m_scalarA0-b)>T)return s=!1,!1;if(b=l.m_scalarA1,x*(1-b)<=n||1===b)break}if(x*(1-b)>n)return s=!1,!1;c.length=0,u.m_overlapEvents.length=0}}return s}function si(t,e,n){const r=t.getImpl(),i=e.getImpl(),s=r.querySegmentIterator(),o=i.querySegmentIterator(),a=new gn(r,i,n);for(;a.next();){const t=a.getRedElement(),e=a.getBlueElement();s.resetToVertex(t,-1),o.resetToVertex(e,-1);const r=s.nextSegment();if(o.nextSegment().isIntersecting(r,n))return!0}return!1}function oi(t,e,n,r){const i=t.getImpl(),s=e.getImpl(),o=i.querySegmentIterator(),a=s.querySegmentIterator(),m=ut(2,Number.NaN),c=new gn(i,s,n);let u=!1,l=-1;for(;c.next();){const t=c.getRedElement(),e=c.getBlueElement();o.resetToVertex(t,-1),a.resetToVertex(e,-1);const i=o.nextSegment(),s=a.nextSegment();let h=0;if(Ei(i,s)){if(s.isIntersecting(i,n))return-2}else h=i.intersect(s,null,m,null,n);if(h)if(2===h){const t=i.calculateLength2D(),e=m[0];if(t*(m[1]-e)>n)return l=1,l;u=!0}else if(l=0,r){const t=m[0],e=new Q;i.queryCoord2D(t,e),r.push(e.x),r.push(e.y)}}return u?-2:l}function ai(t,e,n,r){const i=t.getImpl(),s=e,o=s.getPointCount(),a=r?ut(o,!1):[],m=new gn(i,s,n,!1),c=i.querySegmentIterator();for(;m.next();){const t=m.getRedElement(),e=m.getBlueElement();c.resetToVertex(t,-1);const i=c.nextSegment(),o=s.getXY(e);if(i.isIntersectingPoint(o,n)){if(!r)return!0;a[e]=!0}}if(!r)return!1;for(let u=0;u<o;u++)if(!a[u])return!1;return!0}function mi(t,e,n){const i=new Q,s=n*n,o=t.querySegmentIterator(),a=t.getImpl().getAccelerators();if(null!==a){const t=a.getQuadTree();if(null!==t){const a=r.constructEmpty();a.setCoords({pt:e});const m=t.getIterator(a,n);for(let n=m.next();-1!==n;n=m.next())if(o.resetToVertex(t.getElement(n),-1),o.hasNextSegment()){const t=o.nextSegment(),n=t.getClosestCoordinate(e,!1);if(t.queryCoord2D(n,i),Q.sqrDistance(e,i)<=s)return!0}return!1}}const m=r.constructEmpty();for(;o.nextPath();)for(;o.hasNextSegment();){const t=o.nextSegment();if(t.queryEnvelope(m),m.inflateCoords(n,n),!m.contains(e))continue;const r=t.getClosestCoordinate(e,!1);if(t.queryCoord2D(r,i),Q.sqrDistance(e,i)<=s)return!0}return!1}function ci(t,e,n){return mi(t,e,n)&&!xi(t,e,n)}function ui(t,e,n,i){const s=t.querySegmentIterator(),o=t.getImpl().getAccelerators(),a=t.hasNonLinearSegments();let m=null,c=null,u=null,l=null;if(null!==o){const t=o.getQuadTree();if(null!==t){const i=t.getIterator(e,n);a&&(m=new _,c=new _,u=new _,l=new _,e.querySide(0,m),e.querySide(1,c),e.querySide(2,u),e.querySide(3,l));const o=r.constructEmpty();o.setCoords({env2D:e}),o.inflateCoords(n,n);for(let r=i.next();-1!==r;r=i.next())if(s.resetToVertex(t.getElement(r),-1),s.hasNextSegment()){const t=s.nextSegment();if(t.getGeometryType()===L.enumLine){const e=t.getStartXY(),n=t.getEndXY();if(o.clipLine(e,n))return!0;continue}if(e.contains(t.getStartXY())||e.contains(t.getEndXY()))return!0;if(t.isIntersecting(m,n))return!0;if(t.isIntersecting(c,n))return!0;if(t.isIntersecting(u,n))return!0;if(t.isIntersecting(l,n))return!0}return!1}}if(a){m=new _,c=new _,u=new _,l=new _,e.querySide(0,m),e.querySide(1,c),e.querySide(2,u),e.querySide(3,l);const r=t.querySegmentIterator();for(;r.nextPath();)for(;r.hasNextSegment();){const t=r.nextSegment();if(e.contains(t.getStartXY())||e.contains(t.getEndXY()))return!0;if(t.isIntersecting(m,n))return!0;if(t.isIntersecting(c,n))return!0;if(t.isIntersecting(u,n))return!0;if(t.isIntersecting(l,n))return!0}}else{const i=r.constructEmpty();i.setCoords({env2D:e}),i.inflateCoords(n,n);const s=t.getImpl(),o=s.getAttributeStreamRef(0),a=new Q;for(let t=0,e=s.getPathCount();t<e;t++){let e=!0;const n=new Q,r=new Q,m=new Q,c=s.getPathStart(t),u=new Q;for(let l=c,h=s.getPathEnd(t);l<h;l++)if(e)o.queryPoint2D(2*l,n),u.assign(n),e=!1;else{if(o.queryPoint2D(2*l,a),r.setCoordsPoint2D(n),m.setCoordsPoint2D(a),i.clipLine(r,m))return!0;n.assign(a)}if(s.isClosedPath(t)&&!e&&(r.setCoordsPoint2D(n),m.setCoordsPoint2D(u),i.clipLine(r,m)))return!0}}return!1}function li(t,e,n,i){const s=t.getImpl(),o=e.getImpl(),a=[0],m=p(s.getIsSimple(0,a))&&p(o.getIsSimple(0,a)),c=s.querySegmentIterator(),u=o.querySegmentIterator(),l=ut(2,0),h=ut(2,0),g=new gn(s,o,n);let _=!1;for(;g.next();){const t=g.getRedElement(),e=g.getBlueElement();c.resetToVertex(t,-1),u.resetToVertex(e,-1);const r=c.nextSegment(),i=u.nextSegment();let s=0;if(Ei(r,i)){if(i.isIntersecting(r,n)){_=!0;break}}else s=i.intersect(r,null,h,l,n);if(2===s){const t=l[0],e=l[1],i=r.calculateLength2D();if(m&&(e-t)*i>n)return!1;_=!0}else if(s){const t=l[0],e=h[0];if(t>0&&t<1&&e>0&&e<1)return!1;_=!0}}if(!_)return!1;const f=r.constructEmpty(),d=r.constructEmpty(),y=r.constructEmpty();let P,x;if(t.queryEnvelope(f),e.queryEnvelope(d),f.inflateCoords(1e3*n,1e3*n),d.inflateCoords(1e3*n,1e3*n),y.setCoords({env2D:f}),y.intersect(d),t.getPointCount()>10){if(P=Gt(t,y,n,0,i),P.isEmpty())return!1}else P=t;if(e.getPointCount()>10){if(x=Gt(e,y,n,0,i),x.isEmpty())return!1}else x=e;return Re(P,x,n,"F********",i,!1)}function hi(t,e,n,i){const s=t.getImpl(),o=e.getImpl(),a=[0],m=p(s.getIsSimple(0,a))&&p(o.getIsSimple(0,a)),c=r.constructEmpty(),u=r.constructEmpty(),l=r.constructEmpty();t.queryEnvelope(c),e.queryEnvelope(u);let h=!1;const g=$r(c,u,n),_=$r(u,c,n),f=s.querySegmentIterator(),d=o.querySegmentIterator(),y=ut(2,Number.NaN),P=ut(2,Number.NaN),x=new gn(s,o,n);for(;x.next();){const t=x.getRedElement(),e=x.getBlueElement();f.resetToVertex(t,-1),d.resetToVertex(e,-1);const r=f.nextSegment(),i=d.nextSegment();let s=0;if(Ei(r,i)){if(i.isIntersecting(r,n))break}else s=i.intersect(r,null,P,y,n);if(2===s){const t=y[0],e=y[1],i=r.calculateLength2D();if(m&&(e-t)*i>n&&(h=!0,g&&_))return!0}else if(s){const t=y[0],e=P[0];if(t>0&&t<1&&e>0&&e<1)return!0}}const C=r.constructEmpty(),E=r.constructEmpty();let S,w;C.setCoords({env2D:c}),C.inflateCoords(1e3*n,1e3*n),E.setCoords({env2D:u}),E.inflateCoords(1e3*n,1e3*n),l.setCoords({env2D:C}),l.intersect(E);let b="";if(b+=h?"**":"T*",g){if(e.getPointCount()>10){if(w=Gt(e,l,n,0,i),w.isEmpty())return!1}else w=e;b+="****"}else w=e,b+="T***";if(_){if(t.getPointCount()>10){if(S=Gt(t,l,n,0,i),S.isEmpty())return!1}else S=t;b+="***"}else S=t,b+="T**";return Re(S,w,n,b,i,!1)}function gi(t,e,n,i){const s=[!1],o=Wr(t,e,n,s);if(s[0])return o;const a=r.constructEmpty();let m;if(e.queryEnvelope(a),a.inflateCoords(1e3*n,1e3*n),t.getPointCount()>10){if(m=Gt(t,a,n,0,i),m.isEmpty())return!1}else m=t;return Fe(m,e,n,i)}function _i(t,e,n,i){const s=t.getImpl(),o=e.getImpl(),a=s.querySegmentIterator(),m=o.querySegmentIterator(),c=ut(2,Number.NaN),u=ut(2,Number.NaN),l=new gn(s,o,n);let h=!1;for(;l.next();){const t=l.getRedElement(),e=l.getBlueElement();a.resetToVertex(t,-1),m.resetToVertex(e,-1);const r=a.nextSegment(),i=m.nextSegment();let s=0;if(Ei(r,i)?!h&&i.isIntersecting(r,n)&&(h=!0):s=i.intersect(r,null,u,c,n),2===s)h=!0;else if(s){const t=c[0],e=u[0];if(t>0&&t<1&&e>0&&e<1)return!1;h=!0}}if(!h)return!1;const g=r.constructEmpty(),_=r.constructEmpty(),f=r.constructEmpty();let p,d;if(t.queryEnvelope(g),e.queryEnvelope(_),g.inflateCoords(1e3*n,1e3*n),_.inflateCoords(1e3*n,1e3*n),f.setCoords({env2D:g}),f.intersect(_),t.getPointCount()>10){if(p=Gt(t,f,n,0,i),p.isEmpty())return!1}else p=t;if(e.getPointCount()>10){if(d=Gt(e,f,n,0,i),d.isEmpty())return!1}else d=e;return Re(p,d,n,"F********",i,!1)}function fi(t,e,n,i){const s=t.getImpl(),o=e.getImpl(),a=s.querySegmentIterator(),m=o.querySegmentIterator(),c=ut(2,Number.NaN),u=ut(2,Number.NaN),l=new gn(s,o,n);let h=!1;for(;l.next();){const t=l.getRedElement(),e=l.getBlueElement();a.resetToVertex(t,-1),m.resetToVertex(e,-1);const r=a.nextSegment(),i=m.nextSegment();let s=0;if(Ei(r,i)?!h&&i.isIntersecting(r,n)&&(h=!0):s=i.intersect(r,null,u,c,n),2===s)h=!0;else if(s){const t=c[0],e=u[0];if(t>0&&t<1&&e>0&&e<1)return!0;h=!0}}if(!h)return!1;const g=r.constructEmpty(),_=r.constructEmpty(),f=r.constructEmpty(),p=r.constructEmpty(),d=r.constructEmpty();if(t.queryEnvelope(g),e.queryEnvelope(_),$r(_,g,n)){let r,s;if(f.setCoords({env2D:g}),f.inflateCoords(1e3*n,1e3*n),p.setCoords({env2D:_}),p.inflateCoords(1e3*n,1e3*n),d.setCoords({env2D:f}),d.intersect(p),t.getPointCount()>10){if(r=Gt(t,d,n,0,i),r.isEmpty())return!1}else r=t;if(e.getPointCount()>10){if(s=Gt(e,d,n,0,i),s.isEmpty())return!1}else s=e;return Re(r,s,n,"T********",i,!1)}return Re(t,e,n,"T*****T**",i,!1)}function pi(t,e,n,i){const s=[!1],o=Wr(t,e,n,s);if(s[0])return o;const a=r.constructEmpty();let m;if(e.queryEnvelope(a),a.inflateCoords(1e3*n,1e3*n),t.getPointCount()>10){if(m=Gt(t,a,n,0,i),m.isEmpty())return!1}else m=t;return Oe(m,e,n,i)}function di(t,e,n,r){return 1===Ot(t,e,n)}function yi(t,e,n,r){return 2===Ot(t,e,n)}function Pi(t,e,n,r){const i=new Q,s=n*n;for(let o=0;o<t.getPointCount();o++)if(t.queryXY(o,i),Q.sqrDistance(i,e)<=s)return!1;return!0}function xi(t,e,n){const r=t.getBoundary();return!r.isEmpty()&&!Pi(r,e,n)}function Ci(t,e,n){const i=r.constructEmpty();return i.setCoords({env2D:t}),i.inflateCoords(n,n),i.containsEnvelope(e)?1073741824:i.isIntersecting(e)?t.isIntersecting(e)?t.xmin<e.xmin&&e.xmax<t.xmax?e.ymin<t.ymin&&e.ymax>t.ymax?0:1073741824:t.ymin<e.ymin&&e.ymax<t.ymax?e.xmin<t.xmin&&e.xmax>t.xmax?0:1073741824:0:0:4}function Ei(t,e){return t.getGeometryType()!==L.enumLine||e.getGeometryType()!==L.enumLine}function Si(t,e,n,r,i,s,o,a){return{m_ivertexA:t,m_ipathA:e,m_scalarA0:n,m_scalarA1:r,m_ivertexB:i,m_ipathB:s,m_scalarB0:o,m_scalarB1:a}}class wi{constructor(){this.m_overlapEvents=[]}compareOverlapEvents(t,e){const n=this.m_overlapEvents[t],r=this.m_overlapEvents[e];if(n.m_ipathA<r.m_ipathA)return-1;if(n.m_ipathA===r.m_ipathA){if(n.m_ivertexA<r.m_ivertexA)return-1;if(n.m_ivertexA===r.m_ivertexA){if(n.m_scalarA0<r.m_scalarA0)return-1;if(n.m_scalarA0===r.m_scalarA0){if(n.m_scalarA1<r.m_scalarA1)return-1;if(n.m_scalarA1===r.m_scalarA1&&n.m_ivertexB<r.m_ivertexB)return-1}}}return 1}}function bi(t,e,n){return e.m_projector.project(t,n)}function Ti(t,e,n,r,i){t.m_projector.transformInPlaceZ(e,null,n,r,null,i);const s=r.slice(0,n).filter((t=>!t.isNAN()));for(let o=0,a=s.length;o<a;++o)r[o].assign(s[o]);return s.length}function vi(t,e,n,r,i){return t.m_projector.transformInPlaceZ(e,null,n,r,null,i)}function Ii(t,i,s,o){if(t&&i&&i.isPannable()||Y("fold_into_360_range_geodetic"),t.isEmpty())return t;if(4===s)return Di(t,i,o);let a=t;const m=a.getGeometryType();if(j(m)){a=mo(t,i);const e=new r;a.queryEnvelope(e);const n=d(i,e,!1).total(),o=i.getPannableExtent();let m=Math.floor((e.xmin-o.xmin)/o.width())*o.width()+o.xmin,c=a;for(;m<e.xmax;)m>e.xmin+n&&m<e.xmax-n&&(c=oo(c,i,s,!0,m)),m+=o.width();a=c}else{if(m===L.enumEnvelope){const t=new e({vd:a.getDescription()});return t.addEnvelope(a,!1),Ii(t,i,s,o)}if(U(m)){const t=new n({vd:a.getDescription()});return t.addSegment(a,!0),Ii(t,i,s,o)}}return Di(a,i,o)}function Di(t,r,i){if(t&&r&&r.isPannable()||Y(""),t.isEmpty())return t;let s;const o=t.getGeometryType();if(o===L.enumEnvelope){const n=new e({vd:t.getDescription()});n.addEnvelope(t,!1),s=n}else if(U(o)){const e=new n({vd:t.getDescription()});e.addSegment(t,!0),s=e}else s=t;const a=mo(s,r);return a.isEmpty()?a:$s(a,r,0,a!==t,0,i)}function Gi(t,e,n){if(!e.isPannable()||t.isEmpty())return t;const r=e.getPannableExtent().width(),i=.5*r,s=t.queryInterval(0,0);if(s.width()<i||!z(t.getGeometryType())){if(Number.isNaN(n))return t;const e=s.getCenter();if(Math.abs(e-n)<=i)return t;{const i=new $,s=ot((n-e)/r)*r;i.setShiftCoords(s,0);const o=t.clone();return o.applyTransformation(i),o}}const o=t.getGeometryType(),a=t,m=a.getAttributeStreamRef(0),c=t.clone(),u=c.getAttributeStreamRef(0);let l=0,h=0,g=0,_=j(o)?0:-1;const f=et.constructEmpty();let p=!1;for(let d=0,y=a.getPointCount();d<y;d++){const t=m.read(2*d);d===h&&(j(o)?(0===_&&Number.isNaN(n)&&(p=!0),_>0&&Number.isNaN(n)&&(n=f.getCenter(),p=!1),h=a.getPathEnd(_),_++):h=a.getPointCount(),Number.isNaN(n)?g=t:(g=n,l=0));let e=t-g;Math.abs(e)>i&&(e=ot(e/r)*r,l-=e,Math.abs(l)<.1*r&&(l=0));const s=t+l;u.write(2*d,s),p&&f.mergeCoordinate(s),g=t}return c.notifyModified(),c}const Ni="missing implementation";function Mi(t,e,n,i){const s=e.getCoordinateSystemType();if(0===s){const r=new _m;return e.queryPrecisionDescriptor(r),Ai(t,r,e,n)}let o=t;2!==i&&3!==i||!e.isPannable()||(o=Di(o,e,n));const a=new _m;if(e.queryPrecisionDescriptor(a),o=Ai(o,a,e,n),0===i||o.isEmpty())return o;if(1===s){if(1===i){const t=new r;o.queryLooseEnvelope(t);const i=e.getPannableExtent(),s=.01*i.width();return i.xmin=t.xmin-s,i.xmax=t.xmax+s,(new Xt).execute(o,i,e,n)}return o}if(2===s){const t=e.getPCSHorizon();if(1===i||2===i){const r=(new Rt).execute(o,t,e,n);return r===t?r.clone():r}return o}if(3===s)return o;V(Ni)}function Ai(t,e,n,r){const i=e.getXYGridRange(),s=t.hasAttribute(1),o=t.hasAttribute(2);let a=new et,m=new et;s&&(a=e.getZGridRange()),o&&(m=e.getMGridRange());let c=(new Xt).execute(t,i,n,r);if(s){const e=c.queryInterval(1,0);a.contains(e)||(t===c&&(c=c.clone()),y(c,a,1,0))}if(o){const e=c.queryInterval(2,0);m.contains(e)||(t===c&&(c=c.clone()),y(c,m,2,0))}return c}class qi{constructor(t){this.m_inputPCSHorizonClipOption=0,this.m_outputPCSHorizonClipOption=0,this.m_bDontGeonormalizePolygon=!1,this.m_bClipOutCurvedPoles=!1,this.m_bNormalizeOutputGeometry=!1,this.m_bDontHackPolesInGeogToGeog=!1,this.m_centralMeridianOfOutputGCS=0,this.m_densificationStepInput=0,t||Y(""),this.m_projTransform=t,this.m_bClipOutCurvedPoles=!1;const e=this.m_projTransform.getExtendedParamsImpl();this.m_bNormalizeOutputGeometry=e.normalizeResultGeometry,this.m_bNormalizeOutputGeometry&&(e.legacyHorizonClipping?this.m_bNormalizeOutputGeometry=!1:this.m_projTransform.getOutputSR().isPannable()||(this.m_bNormalizeOutputGeometry=!1)),e.clipWithInputHorizon?(this.m_inputPCSHorizonClipOption=0,!e.legacyHorizonClipping&&this.m_projTransform.getInputSR().isPannable()&&(this.m_inputPCSHorizonClipOption=this.m_bNormalizeOutputGeometry?4:2)):this.m_inputPCSHorizonClipOption=1,e.clipWithOutputHorizon?(this.m_outputPCSHorizonClipOption=0,!e.legacyHorizonClipping&&this.m_projTransform.getOutputSR().isPannable()&&(this.m_outputPCSHorizonClipOption=this.m_bNormalizeOutputGeometry?4:2)):this.m_outputPCSHorizonClipOption=1,this.m_centralMeridianOfOutputGCS=e.centralMeridianOfOutputGCS,this.m_densificationStepInput=e.densificationStep;const n=this.m_projTransform.getExtendedParamsInternal();this.m_bDontGeonormalizePolygon=n.hasFlag(2147483648),this.m_bDontHackPolesInGeogToGeog=n.hasFlag(1073741824),this.m_bClipOutCurvedPoles=n.hasFlag(536870912)}project(t,e){if(this.m_projTransform.isIdentity()||t.isEmpty())return t;const n=t.getGeometryType();if(n===L.enumPoint)return this.projectPoint(t,e);const r=this.m_projTransform.getInputSR().getCoordinateSystemType(),i=this.m_projTransform.getOutputSR().getCoordinateSystemType(),s=this.m_projTransform.getInputSR(),o=this.m_projTransform.getOutputSR();if(0===r&&r===i){const e=Xi(s,o),n=t.clone();return n.applyTransformation(e),n}switch(n){case L.enumPolyline:case L.enumPolygon:return this.projectMultiPath(t,e);case L.enumMultiPoint:return this.projectMultiPoint(t,e);case L.enumEnvelope:return this.projectEnvelope(t,e);case L.enumGeometryCollection:return this.projectGeometryCollection(t,e);default:V("")}}projectPoint(t,e){const n=[t.getXY()];let r,i=null;(r=t.hasAttribute(1))&&(i=[t.getZ()]),this.transformInPlaceZ(n,i,1,n,i,null);const s=t.clone();return s.setXY(n[0]),r&&s.setZ(i[0]),s}projectMultiPoint(t,e){let n=new m({copy:t});const r=this.m_projTransform.getInputSR(),i=this.m_projTransform.getOutputSR(),s=r.getCoordinateSystemType(),o=i.getCoordinateSystemType();if(3===s&&X(0),n=po(n,r,this.m_inputPCSHorizonClipOption,e),n.isEmpty())return n;2===s&&To(r,0,n),Fo(this.m_projTransform,n,!1);let a=0;3===o&&X(0);const c=2===o;return c?a=i.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(a=this.m_centralMeridianOfOutputGCS),c&&0!==this.m_outputPCSHorizonClipOption||(n=$s(n,nm(i),a,!1,0,e)),c&&(n=Zs(n,i,this.m_outputPCSHorizonClipOption,e),So(i,n,this.m_bNormalizeOutputGeometry),n.isEmpty()),n}projectMultiPath(t,e){const n=t.getGeometryType();return n===L.enumPolygon?this.projectPolygon(t,e):n===L.enumPolyline?this.projectPolyline(t,e):void V("project_multi_path_")}projectEnvelope(t,e){this.m_projTransform.getInputSR(),this.m_projTransform.getOutputSR();const n=this.m_projTransform.isVertical()&&t.hasAttribute(1);let r=et.constructEmpty();if(n&&(r=t.queryInterval(1,0)),r.width()>0){const n=t.clone();n.setInterval(1,0,r.vmin,r.vmin);const i=this.projectEnvelopeHelper(n,e);n.setInterval(1,0,r.vmax,r.vmax);const s=this.projectEnvelopeHelper(n,e);return i.merge(s),i}return this.projectEnvelopeHelper(t,e)}projectPolygon(t,i){X(t.getGeometryType()===L.enumPolygon),X(!this.m_projTransform.isIdentity()),X(!t.isEmpty());const s=this.m_projTransform.getInputSR(),o=this.m_projTransform.getOutputSR(),a=s.getCoordinateSystemType(),m=o.getCoordinateSystemType(),c=new e({copy:t});3===a&&X(0),3===m&&X(0);const u=2===a,l=2===m,h=u?s.getGCS():s,g=l?o.getGCS():o,_=!l&&!this.m_bDontHackPolesInGeogToGeog;let f=!1,p=po(c,s,this.m_inputPCSHorizonClipOption,i);if(p.isEmpty())return p;let d=this.m_densificationStepInput;const y=!Number.isNaN(d);let P;y&&(p=(new Mt).execute(p,d,0,0,i));let x=l?o.getPCSInfo():null,C=Number.NaN;u&&(C=s.getCentralMeridian());const E=null!==o.getGCSSplitLines();if(this.m_bDontGeonormalizePolygon){const t=p;if(u&&(Yo(s,C,t),y)){const t=s.getUnitsPerMillimeter();d*=s.getGCS().getUnitsPerMillimeter()/t}if(Lo(this.m_projTransform,t,_),y){const t=s.getGCS().getUnitsPerMillimeter();d*=o.getGCS().getUnitsPerMillimeter()/t}P=t}else{let t=new n({vd:p.getDescription()});if(t.addAndExplicitlyOpenAllPaths(p,!1),u){if(Yo(s,C,t),y){const t=s.getUnitsPerMillimeter();d*=s.getGCS().getUnitsPerMillimeter()/t}if(this.m_bClipOutCurvedPoles){const e=s.getPCSInfo(),n=e.getSouthPoleGeometry()===Ym.PE_POLE_LINE_CURVED,o=e.getNorthPoleGeometry()===Ym.PE_POLE_LINE_CURVED;if(n||o){const e=r.constructEmpty();t.queryLooseEnvelope(e),e.inflateCoords(1,1);const s=89.9999*h.getOneDegreeGCSUnit();n&&(e.ymin=-s),o&&(e.ymax=s),t=Nt(t,e,h,0,0,i)}}}if(Lo(this.m_projTransform,t,_),y){const t=nm(s).getUnitsPerMillimeter();d*=nm(o).getUnitsPerMillimeter()/t}let e=Number.NaN;l?(x=o.getPCSInfo(),e=o.getCentralMeridian()):Number.isNaN(this.m_centralMeridianOfOutputGCS)||(e=this.m_centralMeridianOfOutputGCS);let a=Yi(s)|Yi(o),m=10*g.getTolerance(0);this.m_bDontHackPolesInGeogToGeog&&(a=3,m=10*g.getTolerance(0)),P=io(p,s,t,g,e,i,a,m,this.m_bNormalizeOutputGeometry),a=0}if(E&&(X(!o.isPannable()),P=Os(P,o,i)),l){if(!f){const t=g.getPannableExtent().width();if(P.queryInterval(0,0).width()>=t-10*g.getTolerance(0)){const t=x.getNorthPoleLocation(),e=x.getSouthPoleLocation(),n=x.getNorthPoleGeometry(),r=x.getSouthPoleGeometry();let i=0;n===Ym.PE_POLE_POINT&&t!==Ym.PE_POLE_OUTSIDE_BOUNDARY&&(i=1),r===Ym.PE_POLE_POINT&&e!==Ym.PE_POLE_OUTSIDE_BOUNDARY&&(i|=2),f||=0!==i}}P=Zs(P,o,this.m_outputPCSHorizonClipOption,i),y&&(P=(new Mt).execute(P,d,0,0,i)),bo(o,P,this.m_bNormalizeOutputGeometry)}return P.isEmpty()||f&&(P=(new At).execute(P,o,!1,i)),P}projectPolyline(t,e){X(t.getGeometryType()===L.enumPolyline),X(!this.m_projTransform.isIdentity()),X(!t.isEmpty());const r=this.m_projTransform.getInputSR(),i=this.m_projTransform.getOutputSR(),s=r.getCoordinateSystemType(),o=i.getCoordinateSystemType(),a=new n({copy:t});3===s&&X(0),3===o&&X(0);const m=2===s,c=2===o;m&&r.getGCS();const u=c?i.getGCS():i,l=!c&&!this.m_bDontHackPolesInGeogToGeog;let h=po(a,r,this.m_inputPCSHorizonClipOption,e);if(h.isEmpty())return h;let g=Number.NaN;m&&(g=r.getCentralMeridian());const _=null!==i.getGCSSplitLines();let f=this.m_densificationStepInput;const p=!Number.isNaN(f);let d;if(p&&(h=(new Mt).execute(h,f,0,0,e)),this.m_bDontGeonormalizePolygon){if(m&&(Yo(r,g,h),p)){const t=r.getUnitsPerMillimeter();f*=r.getGCS().getUnitsPerMillimeter()/t}if(Lo(this.m_projTransform,h,l),p){const t=r.getGCS().getUnitsPerMillimeter();f*=i.getGCS().getUnitsPerMillimeter()/t}d=h}else{const t=new n({vd:h.getDescription()});if(t.addAndExplicitlyOpenAllPaths(h,!1),m&&(Yo(r,g,t),p)){const t=r.getUnitsPerMillimeter();f*=r.getGCS().getUnitsPerMillimeter()/t}if(Lo(this.m_projTransform,t,l),p){const t=r.getGCS().getUnitsPerMillimeter();f*=i.getGCS().getUnitsPerMillimeter()/t}let s=Number.NaN;c?s=i.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(s=this.m_centralMeridianOfOutputGCS);let o=Yi(r)|Yi(i),a=10*u.getTolerance(0);this.m_bDontHackPolesInGeogToGeog&&(o=3,a=0),d=so(h,r,t,u,s,e,o,a,this.m_bNormalizeOutputGeometry),o=0}return _&&(X(!i.isPannable()),d=Os(d,i,e)),c&&(d=Zs(d,i,this.m_outputPCSHorizonClipOption,e),p&&(d=(new Mt).execute(d,f,0,0,e)),bo(i,d,this.m_bNormalizeOutputGeometry)),d.isEmpty(),d}projectGeometryCollection(t,e){return X(0),{}}projectEnvelopeHelper(t,e){const s=(t.height()+t.width())/400;if(0!==s){const o=(new Mt).execute(t,s,0,0,e),a=this.projectMultiPath(o,e),c=new I({vd:t.getDescription()});if(a.isEmpty()){const s=Math.min(t.height(),t.width()),a=D(this.m_projTransform.getInputSR(),t,!0).total();if(s>100*a){const t=r.constructEmpty(),e=d(this.m_projTransform.getOutputSR(),t,!0).total(),n=this.m_projTransform.getInputSR().getOneMeter()/this.m_projTransform.getOutputSR().getOneMeter();if(s>100*Math.max(a,e*n))return c}const u=new n;u.addAndExplicitlyOpenAllPaths(o,!1);this.projectMultiPath(u,e).queryEnvelope(c);const l=new m({vd:t.getDescription()});l.reserve(4);const h=new i;for(let e=0;e<4;e++)t.queryCornerByVal(e,h),l.add(h);const g=this.projectMultiPoint(l,e),_=new I;return g.queryEnvelope(_),c.merge(_),c}return a.queryEnvelope(c),c}{const n=t.getCenterXY(),r=new i(n),s=this.projectPoint(r,e),o=new I({vd:t.getDescription()});if(s.isEmpty())o.setEmpty();else{t.copyTo(o);const e=s.getXY();o.setCoords(e.x,e.y,e.x,e.y)}return o}}transformInPlace(t,e,n,r){return X(0),0}transformInPlaceZ(t,e,n,r,i,s){if(this.m_projTransform.isIdentity())return t!==r&&it(r,t,n),e!==i&&yt(i,e,0,0,n),n;const o=this.m_projTransform,a=o.getInputSR(),m=o.getOutputSR(),c=a.getCoordinateSystemType(),u=m.getCoordinateSystemType();if(0===c&&c===u){return Xi(a,m).transformPoints2D(t,n,r),o.isVertical()&&X(0),n}3===c&&H("image: transform_in_place_"),3===u&&H("image: transform_in_place_"),yo(t,n,r,a,this.m_inputPCSHorizonClipOption),i!==e&&yt(i,e,0,0,n),2===c&&Xo(a,0,r,n),Ho(this.m_projTransform,r,i,n,!1);let l=0;const h=2===u;if(h?l=m.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(l=this.m_centralMeridianOfOutputGCS),h&&0!==this.m_outputPCSHorizonClipOption||to(r,n,m.getGCS(),l),h){if(!Js(r,n,m,this.m_outputPCSHorizonClipOption))for(let t=0;t<n;++t)r[t].setNAN();xo(m,r,n,!1)}let g=n;for(let _=0;_<n;++_)r[_].isNAN()&&(i&&(i[_]=Number.NaN),g--);return g}}function Yi(t){if(2!==t.getCoordinateSystemType())return 0;let e=0;const n=t.getPCSInfo(),r=n.getNorthPoleLocation(),i=n.getSouthPoleLocation(),s=n.getNorthPoleGeometry(),o=n.getSouthPoleGeometry();return s===Ym.PE_POLE_POINT&&r!==Ym.PE_POLE_OUTSIDE_BOUNDARY&&(e=1),o===Ym.PE_POLE_POINT&&i!==Ym.PE_POLE_OUTSIDE_BOUNDARY&&(e|=2),e}function Xi(t,e){const n=t.getHorzUnitFactor(),r=e.getHorzUnitFactor();let i=1,s=1;const o=20015077/180;1===t.getUnit().getUnitType()&&(i=o),1===e.getUnit().getUnitType()&&(s=o);const a=n/r*(i!==s?i/s:1),m=new $;return m.setScaleCoords(a,a),m}let Ri=class{getOperatorType(){return 10300}supportsCurves(){return!0}accelerateGeometry(t,e,n){return!1}canAccelerateGeometry(t){return!1}executeMany(t,e,n){return!e||e.isIdentity()?t:new Fi(t,e,n)}execute(t,e,n){return e.isIdentity()?t:bi(t,e,n)}transform(t,e,n,r,i=!0){return i?Ti(t,e,n,r,null):vi(t,e,n,r,null)}transform3D(t,e,n,r,i=!0){return X(0),0}foldInto360Range(t,e){return Di(t,e,null)}foldInto360RangeGeodetic(t,e,n){return Ii(t,e,n,null)}normalizeGeometryEx(t,e,n,r,i=0){return Ts(t,e,n,r,i)}normalizeGeometry(t,e,n){return Gi(t,e,n)}clipToSpatialReference(t,e,n,r=0){return Mi(t,e,n,r)}};class Fi extends Ft{constructor(t,e,n){super(),this.m_projTrans=e,this.m_progressTracker=n,this.m_index=-1,t||Y(""),this.m_inputGeoms=t}next(){const t=this.m_inputGeoms.next();return null!=t?(R(t),F(t),this.m_index=this.m_inputGeoms.getGeometryID(),bi(t,this.m_projTrans,this.m_progressTracker)):null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}}function Oi(t,r,i,s,o,a,m=!1){t||Y("Geometry.Geodetic_densify.densify");let c=t.getGeometryType();if(F(t),R(t),t.isEmpty()||O(c))return t;const u=new ji;u.m_sr=r,u.m_gcs=r.getGCS(),u.m_transform=u.m_gcs!==r?r.getSRToGCSTransform():null,u.m_progressTracker=a;const l=Ha();let h,g,_;if(u.m_gcs.querySpheroidData(l),u.m_a=l.majorSemiAxis,u.m_eSquared=l.e2,u.m_rpu=u.m_gcs.getUnit().getUnitToBaseFactor(),u.m_gcsTolerance=u.m_gcs.getTolerance(0),u.m_radTolerance=u.m_gcsTolerance*u.m_rpu,u.m_maxLength=s,u.m_maxDeviation=o,u.m_curveType=i,c===L.enumEnvelope){const n=new e({vd:t.getDescription()});n.addEnvelope(t,!1),h=n,c=L.enumPolygon}else if(U(c)){const e=new n({vd:t.getDescription()});e.addSegment(t,!0),h=e,c=L.enumPolyline}else h=t;if(4!==u.m_curveType){if(g=u.m_transform&&!u.m_transform.isIdentity()?(new Ri).execute(h,u.m_transform,a):mo(h,u.m_gcs),g.isEmpty())return g;g=Li(u.m_rpu,g);let t=u.geodeticDensify(g);m||(t=(new Ri).foldInto360RangeGeodetic(t,u.m_gcs,u.m_curveType)),_=u.m_transform&&!u.m_transform.isIdentity()?(new Ri).execute(t,u.m_transform.getInverse(),a):t}else{let t;if(r.isPannable())t=mo(h,r);else{const e=r.getPCSHorizon();t=(new Rt).execute(h,e,r,a),t===e&&(t=e.clone())}if(g=t,g.isEmpty())return g;_=u.shapePreservingDensify(g)}return _}function Li(t,e){const n=new r;if(e.queryLooseEnvelope(n),n.width()*t<Math.PI)return e;let s=!1;const o=e.querySegmentIterator(),a=new Q,m=new Q;for(;o.nextPath();)for(;o.hasNextSegment();){const e=o.nextSegment();if(a.setCoordsPoint2D(e.getStartXY()),m.setCoordsPoint2D(e.getEndXY()),a.scale(t),m.scale(t),Math.abs(a.x-m.x)>Math.PI){if(!Hi(a,m)){s=!0;break}if(Math.abs(a.x-m.x)>2*Math.PI){s=!0;break}}}if(!s)return e;const c=e.createInstance();c.reserve(e.getPointCount());const u=e.getDescription().getAttributeCount()>1,l=new Q,h=new Q,g=new Q(0,0),_=new Q(0,0),f=new i;for(o.resetToFirstPath();o.nextPath();){let e=Number.NaN,n=0;for(;o.hasNextSegment();){const r=o.nextSegment();a.setCoordsPoint2D(r.getStartXY()),m.setCoordsPoint2D(r.getEndXY()),a.scale(t),m.scale(t),Number.isNaN(e)?(n=ns(a.x,Number.NaN,n),g.setCoordsPoint2D(a)):g.setCoordsPoint2D(_),e=g.x;if(Hi(a,m)){if(m.x-a.x>2*Math.PI)for(;m.x-a.x>2*Math.PI;)m.x-=2*Math.PI;else if(m.x-a.x<2*-Math.PI)for(;m.x-a.x<2*-Math.PI;)m.x+=2*Math.PI;n=ns(m.x,Number.NaN,n),_.setCoordsPoint2D(m)}else l.setCoordsPoint2D(m),ms(l),n=ns(l.x,e,n),_.setCoords(n+l.x,l.y);if(Math.abs(_.x-m.x)<.5&&_.setCoordsPoint2D(m),u){r.queryCoord(0,f),h.setCoordsPoint2D(g),h.scale(1/t),f.setXY(h);o.isFirstSegmentInPath()?c.startPathPoint(f):c.lineToPoint(f),o.isLastSegmentInPath()&&!o.isPathClosed()&&(r.queryCoord(1,f),h.setCoordsPoint2D(_),h.scale(1/t),f.setXY(h),c.lineToPoint(f))}else{o.isFirstSegmentInPath()&&c.insertPath2D(-1,null,0,0,!0);const e=c.getPathCount()-1;h.setCoordsPoint2D(g),h.scale(1/t),c.insertPoint2D(e,-1,h),o.isLastSegmentInPath()&&!o.isPathClosed()&&(h.setCoordsPoint2D(_),h.scale(1/t),c.insertPoint2D(e,-1,h))}}}return c}function Ui(t,e,n,r,i,s,o,a,m,c,u,l){const h=new Q,g=new Q,_=r.compare(i)>0;ts(_,r,i,h,g);const f=Zi(t,e,n,h,g,s,o,a,m,c,null,u,l);return _&&$i(m,c,null,u),f}function Hi(t,e){return!(!vm(t.y,gt)||!vm(e.y,gt))||!(!vm(t.y,-gt)||!vm(e.y,-gt))}function zi(t,e){return!(!vm(t.y,gt)||vm(e.y,gt))||!(!vm(t.y,-gt)||vm(e.y,-gt))}function Vi(t,e){return!(!vm(e.y,gt)||vm(t.y,gt))||!(!vm(e.y,-gt)||vm(t.y,-gt))}class ji{constructor(){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_progressTracker=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_gcsTolerance=0,this.m_radTolerance=0,this.m_maxLength=0,this.m_maxDeviation=0,this.m_curveType=0}geodeticDensify(t){const e=t.createInstance(),n=t.querySegmentIterator(),r=[],i=[],s=new o,a=t.getDescription().getAttributeCount()>1;for(;n.nextPath();){const t=[0];for(;n.hasNextSegment();){const o=n.nextSegment(),m=o.getStartXY(),c=o.getEndXY();m.scale(this.m_rpu),c.scale(this.m_rpu);const u=new Q,l=new Q,h=m.compare(c)>0;ts(h,m,c,u,l),r.length=0,i.length=0,this.m_maxLength>0?Zi(this.m_a,this.m_eSquared,this.m_curveType,u,l,this.m_maxLength,this.m_maxDeviation,this.m_radTolerance,null,null,a?i:null,r,t):Ki(),h&&$i(null,null,a?i:null,r),r[0].setCoordsPoint2D(o.getStartXY()),r.at(-1).setCoordsPoint2D(o.getEndXY());const g=1/this.m_rpu;for(let t=1,e=r.length-1;t<e;t++)r[t].scale(g);if(a){const t=es(h,o,s);Bi(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),o,t,i,r,e)}else ki(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),r,e)}}return e}shapePreservingDensify(t){const e=t.createInstance(),n=t.querySegmentIterator(),r=[],i=[],s=new o,a=t.getDescription().getAttributeCount()>1;for(;n.nextPath();)for(;n.hasNextSegment();){const t=n.nextSegment(),o=t.getStartXY(),m=t.getEndXY(),c=o.compare(m)>0,u=es(c,t,s);r.length=0,i.length=0,Ji(this.m_a,this.m_eSquared,this.m_rpu,u,this.m_sr,this.m_maxLength,this.m_maxDeviation,a?i:null,r),c&&$i(null,null,a?i:null,r),a?Bi(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),t,u,i,r,e):ki(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),r,e)}return e}}function ki(t,e,n,r){t&&r.insertPath2D(-1,null,0,0,!0);const i=r.getPathCount()-1;r.insertPointsFromPoints(i,-1,n,0,n.length-1,!0),e&&r.insertPoint2D(i,-1,n.at(-1))}function Bi(t,e,n,r,s,o,a){a.reserve(a.getPointCount()+o.length-1);const m=new i;if(n.queryStart(m),t?a.startPathPoint(m):a.lineToPoint(m),o.length>2){const t=r.calculateLength2D();for(let e=1;e<o.length-1;e++){const n=r.lengthToT(s[e]*t);r.queryCoord(n,m),m.setXY(o[e]),a.lineToPoint(m)}}e&&(n.queryEnd(m),a.lineToPoint(m))}function Zi(t,e,n,r,i,s,o,a,m,c,u,l,h){const g={stack:[],error:void 0,hasError:!1};try{const _=It(g,new Gm,!1),f=It(g,new Gm,!1),p=It(g,new Gm,!1);Fm.geodeticDistance(t,e,r.x,r.y,i.x,i.y,p,_,f,n);const d=p.val,y=_.val,P=f.val;let x=y,C=P;x<0&&(x+=2*Math.PI),C<0&&(C+=2*Math.PI),m&&(m[0]=x),c&&(c[0]=C);let E=Number.NaN,S=Number.NaN;if(null!==u){const n=Om.q90(t,e),i=Om.q(t,e,r.y);E=(n-i)/d,S=(n+i)/d}const w=zi(r,i),b=Vi(r,i),T=w||b,v=os(r,i,a),I=It(g,new lt(new Gm,new Gm),!1),D=new Q,G=new Q,N=new Q;h[0]=ns(r.x,Number.NaN,h[0]);let M=h[0];if(d<=s)return l.push(r.clone()),h[0]=ns(i.x,Number.NaN,h[0]),null!=u&&u.push(0),T?(w&&rs(r,i,u,l),b&&is(r,i,u,l)):v?ss(r,i,y,E,S,u,l):o>0&&(G.setCoords(r.x-M,r.y),D.setCoords(i.x-h[0],i.y),M=Wi()),l.push(i.clone()),d;const A=1+Math.ceil(d/s),q=d/(A-1),Y=new Q;l.push(r.clone()),Y.setCoordsPoint2D(r),G.setCoords(r.x-h[0],r.y),null!==u&&u.push(0);for(let s=1;s<A;s++){let m;if(s<A-1){const i=s*q;Fm.geodeticCoordinate(t,e,r.x,r.y,i,y,I.at(0),I.at(1),n),D.setCoords(I.at(0).val,I.at(1).val),h[0]=ns(D.x,Y.x,h[0]),N.setCoords(h[0]+D.x,D.y),m=s/(A-1)}else h[0]=ns(i.x,Number.NaN,h[0]),D.setCoords(i.x-h[0],i.y),N.setCoordsPoint2D(i),m=1;T?(1===s&&w&&rs(r,N,u,l),s===A-1&&b&&is(Y,i,u,l)):v?as(Y,N,a)&&(r.x<i.x?Y.x>N.x&&(h[0]+=2*Math.PI,N.setCoords(h[0]+D.x,D.y)):Y.x<N.x&&(h[0]-=2*Math.PI,N.setCoords(h[0]+D.x,D.y)),ss(Y,N,y,E,S,u,l)):o>0&&Wi(),l.push(N.clone()),null!=u&&u.push(m),Y.setCoordsPoint2D(N),G.setCoordsPoint2D(D),M=h[0]}return d}catch(_){g.error=_,g.hasError=!0}finally{Dt(g)}}function Ki(t,e,n,r,i,s,o,a,m,c){X(0)}function Wi(t,e,n,r,i,s,o,a,m,c,u,l,h,g,_){return X(0),0}function Qi(e,n,r,i){const s=ue(e,n,r),o=ue(e,n,i);return t.distance(s,o)}function Ji(t,e,n,r,i,s,o,a,m){const c=r.isCurve(),u=Ie(t,e)*Math.PI*179/180;let l=s;s>0&&!(s>u)||(l=u),l=Ye(t,e,l);let h=o;!c||h>0||(h=.001);const g=h>0;let _=Number.NaN;g&&(_=Ye(t,e,h));const f=i.getPECoordSys(),p=1===i.getCoordinateSystemType(),d=i.getTolerance(0),y=r.getStartXY(),P=r.getEndXY(),x=new Q,C=new Q;if(p)x.setCoordsPoint2D(y),x.scale(n),C.setCoordsPoint2D(P),C.scale(n);else{const t=[y.x,y.y,P.x,P.y];Am.projToGeog(f,2,t),x.setCoords(t[0],t[1]),x.scale(n),C.setCoords(t[2],t[3]),C.scale(n)}let E=0,S=0;const w=[],b=[],T=[];w.push(P.clone()),b.push(C.clone()),T.push(1),m.push(y.clone()),null!==a&&a.push(S);const v=i.isPannable(),I=y.clone(),D=[.5,.33333333333333337,.6666666666666666,.16666666666666669,.8333333333333333];let G=5;for(c||(g?(D[0]=.5,D[1]=.25,D[2]=.75,G=3):G=1);b.length>0;){const s=w.at(-1).clone();C.assign(b.at(-1));const o=T.at(-1);let u=!1,h=Number.NaN;const y=Qi(t,e,x,C);let P=l>=y&&Math.abs(x.y-C.y)<.9*Math.PI;p&&P&&(P=Math.abs(x.x-C.x)<.9*Math.PI);const N=new Q,M=new Q;let A=!1;if(c||g||!P||P&&(A=!0),r.calculateSubLength(S,o)<=d&&(A=!0),!A)for(let a=0;a<G;a++){const s=ht(S,o,D[a]),m=new Q;r.queryCoord2D(s,m);const c=new Q;if(p)c.setCoords(m.x*n,m.y*n);else{const t=[m.x,m.y];Am.projToGeog(f,1,t),c.setCoords(t[0]*n,t[1]*n)}if(0===a&&(h=s,N.setCoordsPoint2D(m),M.setCoordsPoint2D(c),!P)){u=!0;break}if(p&&Math.abs(x.x-c.x)>=Math.PI){u=!0;break}if(l<Qi(t,e,x,c)){u=!0;break}if(g){const s=de(t,e,x,C,D[a]),m=s.clone();if(p?(m.x/=n,m.y/=n):(m.x/=n,m.y/=n,vi(i.getGCSToSRTransform(),[m],1,[m],null)),m.isNAN()){const n=ue(t,e,c),r=ue(t,e,x),i=ue(t,e,C),{first:s,second:o}=Ee(t,e,n,r,i,2,null);if(o>_){u=!0;break}}else{if(v){const t=i.getPannableExtent().width(),e=ht(r.getStartX(),r.getEndX(),.5);for(;m.x<e-.5*t;)m.x+=t;for(;m.x>=e+.5*t;)m.x-=t}const a=r.getClosestCoordinateOnInterval(m,new et(S,o),-1),c=r.getCoord2D(a);if(!p){const t=[c.x,c.y];Am.projToGeog(f,1,t),c.x=t[0],c.y=t[1]}c.x*=n,c.y*=n;let l=Qi(t,e,c,s);if(l>_){if(l<4*_){const n=ue(t,e,c),r=ue(t,e,x),i=ue(t,e,C),{first:s,second:o}=Ee(t,e,n,r,i,2,null);l=o}if(l>_){u=!0;break}}}}}u?(w.push(N.clone()),b.push(M.clone()),T.push(h)):(w.pop(),b.pop(),T.pop(),m.push(s.clone()),E+=y,null!==a&&a.push(E),I.setCoordsPoint2D(s),x.setCoordsPoint2D(C),S=o)}if(null!==a){const t=1/E;for(let e=0;e<a.length;e++)a[e]*=t}}function $i(t,e,n,r){if(r.reverse(),null!==n&&n.reverse(),t){const n=t[0],r=e[0];t[0]=r,e[0]=n}}function ts(t,e,n,r,i){t?(r.setCoordsPoint2D(n),i.setCoordsPoint2D(e)):(r.setCoordsPoint2D(e),i.setCoordsPoint2D(n))}function es(t,e,n){return t?(n.create(e.getGeometryType()),e.copyTo(n.get()),n.get().reverse(),n.get()):e}function ns(t,e,n){if(Number.isNaN(e)){for(;n-t>Math.PI;)n-=2*Math.PI;for(;t-n>Math.PI;)n+=2*Math.PI;return n}return n+t-e>Math.PI?n-=2*Math.PI:e-(n+t)>Math.PI&&(n+=2*Math.PI),n}function rs(t,e,n,r){if(t.y>0){const i=new Q;i.setCoords(e.x,gt),vm(t.x,i.x)||vm(e.y,i.y)||(r.push(i),null!==n&&n.push(0))}else{const i=new Q;i.setCoords(e.x,-gt),vm(t.x,i.x)||vm(e.y,i.y)||(r.push(i),null!==n&&n.push(0))}}function is(t,e,n,r){if(e.y>0){const i=new Q;i.setCoords(t.x,gt),vm(e.x,i.x)||vm(t.y,i.y)||(r.push(i),null!==n&&n.push(1))}else{const i=new Q;i.setCoords(t.x,-gt),vm(e.x,i.x)||vm(t.y,i.y)||(r.push(i),null!==n&&n.push(1))}}function ss(t,e,n,r,i,s,o){if(Dm(n)){if(gt-t.y>0){const e=new Q;e.setCoords(t.x,gt),o.push(e),null!==s&&s.push(r)}if(gt-e.y>0){const t=new Q;t.setCoords(e.x,gt),o.push(t),null!==s&&s.push(r)}}else{if(gt+t.y>0){const e=new Q;e.setCoords(t.x,-gt),o.push(e),null!==s&&s.push(i)}if(gt+e.y>0){const t=new Q;t.setCoords(e.x,-gt),o.push(t),null!==s&&s.push(i)}}}function os(t,e,n){return!(!as(t,e,n)||vm(t.y,gt)||vm(t.y,-gt)||vm(e.y,gt)||vm(e.y,-gt))}function as(t,e,n){return Math.abs(Math.abs(t.x-e.x)-Math.PI)<=n}function ms(t){if(t.x<-Math.PI)for(;t.x<-Math.PI;)t.x+=2*Math.PI;else if(t.x>Math.PI)for(;t.x>Math.PI;)t.x-=2*Math.PI}function cs(t,e,n,r){const i={stack:[],error:void 0,hasError:!1};try{const s=[n.x],o=[n.y-r],a=[n.x],m=[n.y+r];ve(s,o),ve(a,m);const c=It(i,new Gm,!1),u=It(i,new Gm,!1);Fm.greatEllipticDistance(t,e,n.x,n.y,s[0],o[0],c,null,null),Fm.greatEllipticDistance(t,e,n.x,n.y,a[0],m[0],u,null,null);return Math.min(c.val,u.val)}catch(s){i.error=s,i.hasError=!0}finally{Dt(i)}}function us(t,e,n,i,s){const o=new r;n.queryEnvelope(o);const a=D(null,n,!0).total();if(e.xmin-o.xmin<=a&&o.xmax-e.xmax<=a)return n;const m=e.width();let c=0;for(;e.xmin+c*m<o.xmin;)c++;for(;e.xmin+c*m>o.xmin;)c--;const u=c*m,l=new $;l.setShiftCoords(-u,0);const h=n;h.applyTransformation(l);const g=new r;h.queryEnvelope(g);let _=null;if(g.xmax>e.xmax){let n=0;const i=new r;i.setCoords({env2D:e}),i.ymin-=1,i.ymax+=1;let o=h;for(;i.xmin<g.xmax;){g.xmax>i.xmax&&(o=oo(o,t,2,!0,i.xmax));const r=G(o,i),a=d(null,r,!0).total(),c=Gt(o,i,a,Number.NaN,s);null===_?_=c===o?c.clone():c:(l.setShiftCoords(-n*m,0),c.applyTransformation(l),_.add(c,!1)),n++,i.xmin=i.xmax,i.xmax=e.xmax+n*m}}else _=h;return _}class ls{constructor(e,n){this.m_basisX=new t,this.m_basisY=new t,this.m_normal=new t,X(1===e.getCoordinateSystemType()),this.m_gcs=e;const r=Ha();e.querySpheroidData(r),this.m_a=r.majorSemiAxis,this.m_e2=r.e2,this.m_rpu=e.getUnit().getUnitToBaseFactor(),this.m_curvCenterRad=n.mul(this.m_rpu);const i=this.m_curvCenterRad.x,s=this.m_curvCenterRad.y,o=Math.cos(i),a=Math.sin(i),m=Math.cos(s),c=Math.sin(s);this.m_cartCenter3D=he(this.m_a,this.m_e2,o,a,m,c),this.m_normal.setCoordsPoint3D(this.m_cartCenter3D),this.m_d=this.m_cartCenter3D.length(),this.m_normal.divThis(this.m_d),t.selectRightHandedBasisFromNormal(this.m_normal,this.m_basisX,this.m_basisY),this.m_northPolePcs=this.projectPoint(Q.construct(0,.5*Math.PI/this.m_rpu)),this.m_southPolePcs=this.projectPoint(Q.construct(0,.5*-Math.PI/this.m_rpu))}project(t){const e=t.getGeometryType();if(z(e)){R(t);const e=t;return this.projectMultiVertex(e)}Y("Gnomonic.project")}unproject(t,e,n){const r=t.getGeometryType();if(z(r)){R(t);let i=t;const s=[];if(r===L.enumPolygon){const t=i.getPathCount();for(let e=0;e<t;e++){const t=i.calculateRingArea2D(e);s.push(t)}}return this.unprojectMultiVertex(e,i),j(r)?(xs(this.m_gcs,0,i),hs(s,this.m_gcs,0,i,n)):i=$s(i,this.m_gcs,0,!0,0,n),i}Y("Gnomonic.unproject")}projectPoint(t){const e=t.mul(this.m_rpu),n=ue(this.m_a,this.m_e2,e),r=this.m_normal.dotProduct(n);if(r<=0)return Q.construct(Number.NaN,Number.NaN);const i=this.m_d/r,s=n.mul(i).sub(this.m_cartCenter3D),o=new Q;return o.x=this.m_basisX.dotProduct(s),o.y=this.m_basisY.dotProduct(s),o}unprojectPoint(t){const e=this.m_cartCenter3D.add(this.m_basisX.mul(t.x).add(this.m_basisY.mul(t.y)));return fe(this.m_a,this.m_e2,e).divide(this.m_rpu)}projectMultiVertex(t){const e=t.getImpl();let n=!0;const r=new Q,i=new Q;for(let s=0,o=e.getPointCount();s<o;s++)e.queryXY(s,r),r.y*this.m_rpu>.5*Math.PI?i.assign(this.m_northPolePcs):r.y*this.m_rpu<.5*-Math.PI?i.assign(this.m_southPolePcs):i.assign(this.projectPoint(r)),e.setXY(s,i),i.isNAN()&&(n=!1);return e.notifyModifiedFlags(2001),n}unprojectMultiVertex(t,e){const n=e.getImpl(),r=t*t,i=!this.m_northPolePcs.isNAN(),s=!this.m_southPolePcs.isNAN();for(let o=0,a=n.getPointCount();o<a;o++){const t=n.getXY(o);let e=new Q;i&&Q.sqrDistance(t,this.m_northPolePcs)<=r?(e.setCoords(this.m_curvCenterRad.x,.5*Math.PI),e.scale(1/this.m_rpu)):s&&Q.sqrDistance(t,this.m_southPolePcs)<=r?(e.setCoords(this.m_curvCenterRad.x,.5*-Math.PI),e.scale(1/this.m_rpu)):e=this.unprojectPoint(t),n.setXY(o,e)}n.notifyModifiedFlags(2001)}}function hs(t,e,n,i,s){const o=i.getGeometryType(),a=e.getPannableExtent();let m=i,c=!1,u=!1;if(o===L.enumPolygon){const i=new r,o=Q.construct(n,0);i.setCoords({env2D:a}),i.centerAt(o),c=gs(t,e,i,m,s);const l=Ps(e,i,m,s);l!==m&&(u=!0),m=l}else m=(new Ri).foldInto360RangeGeodetic(m,e,2);o===L.enumPolygon&&(c||u)&&(m=(new At).execute(m,e,!1,s)),m!==i&&(i.setEmpty(),i.add(m,!1))}function gs(t,e,n,r,i){const s=_s(n,r),o=fs(t,e,n,r,i);return s||o}function _s(t,e){const n=new r;e.queryEnvelope(n);const i=vm(t.ymax,n.ymax),s=vm(t.ymin,n.ymin),o=i||s;return!!o&&(ps(t,e),o)}function fs(t,n,r,i,s){const o=[],a=[],m=.5*r.width();for(let e=0;e<i.getPathCount();e++){const c=i.getXY(i.getPathStart(e)),u=i.getXY(i.getPathEnd(e)-1),l=t[e]<0;if(Math.abs(c.x-u.x)>m){const t=ds(l,n,r,e,i,s);o.push(t),a.push(e)}else if(!l){if(i.calculateRingArea2D(e)<0){const t=ys(n,r,e,i,s);o.push(t),a.push(e)}}}if(0===o.length)return!1;const c=new e({vd:i.getDescription()});let u=0,l=a[u];for(let e=0;e<i.getPathCount();e++)e===l?(c.add(o[u],!1),u++,u<a.length&&(l=a[u])):c.addPath(i,e,!0);return i.setEmpty(),i.add(c,!1),!0}function ps(t,n){const i=new e,s=new r;for(let e=0;e<n.getPathCount();e++){n.queryPathEnvelope(e,s);let r=vm(t.ymax,s.ymax),o=vm(t.ymin,s.ymin);if(!(r||o)){i.addPath(n,e,!0);continue}i.insertPath2D(-1,null,0,0,!0);const a=n.getPathStart(e),m=n.getPathEnd(e),c=m-a;let u=-1;for(u=a;u<m;u++){const e=n.getXY(u);if(r=vm(t.ymax,e.y),o=vm(t.ymin,e.y),!r&&!o)break}let l=u,h=!1,g=Number.NaN;do{const s=n.getXY(l);r=vm(t.ymax,s.y),o=vm(t.ymin,s.y);const m=a+(l+1-a)%c;if(r||o){let r=Q.construct(g,s.y);i.insertPoint2D(e,-1,r);const o=n.getXY(m),a=vm(t.ymax,o.y),c=vm(t.ymin,o.y);a||c||(r=Q.construct(o.x,s.y),h?i.setXY(i.getPointCount()-1,r):i.insertPoint2D(e,-1,r)),h=!0}else i.insertPoint2D(e,-1,s),g=s.x,h=!1;l=m}while(l!==u)}n.setEmpty(),n.add(i,!1)}function ds(t,n,s,o,a,m){const u=new e,l=new e,h=new $,g=a.getXY(a.getPathStart(o)),_=a.getXY(a.getPathEnd(o)-1),f=s.width(),p=.5*f,y=new r;a.queryEnvelope(y);const P=Math.ceil(y.width()/f)+1;let x,C;g.x>_.x?(x=-f,C=t?s.ymin:s.ymax):(x=f,C=t?s.ymax:s.ymin),h.setShiftCoords(x,0),u.addPath(a,o,!0),l.add(u,!1);const E=new i;for(let e=0;e<P;e++)l.applyTransformation(h),l.getPointByVal(0,E),u.lineToPoint(E),u.addSegmentsFromPath(l,0,0,l.getSegmentCount()-1,!1);const S=u.getXY(0),w=u.getXY(u.getPointCount()-1);S.y=C,w.y=C,u.lineTo(w);const b=new Q;for(b.setCoordsPoint2D(w),b.x-=.5*x;Math.abs(b.x-S.x)>p;)u.lineTo(b),b.x-=.5*x;u.lineTo(S);const T=s.getCenter().x,v=new r;u.queryEnvelope(v);let I=0;const D=v.getCenter().x;D-T>p?I=-Math.ceil((D-T-p)/f):T-D>p&&(I=Math.ceil((T-D-p)/f)),0!==I&&(h.setShiftCoords(I*f,0),u.applyTransformation(h));const N=new c,M=N.addGeometry(u);ao(N,M,n,0,2,!0,s.xmin),ao(N,M,n,0,2,!0,s.xmax);const A=N.getGeometry(M),q=G(A,s);q.inflateCoords(0,1);const Y=d(null,q,!0);return Gt(A,s,Y.total(),Number.NaN,m)}function ys(t,e,n,i,s){const o=e.width(),a=.5*o,m=e.getCenter().x,u=new r;i.queryPathEnvelope(n,u);let l,h=0,g=u.getCenter().x;if(g-m>a?h=-Math.ceil((g-m-a)/o):m-g>a&&(h=Math.ceil((m-g-a)/o)),0!==h){const t=new $;t.setShiftCoords(h*o,0),i.getImpl().applyTransformationToPath(t,n),i.queryPathEnvelope(n,u),g=u.getCenter().x}const _=new r;e.containsExclusiveEnvelope(u)?(l=!1,_.setCoords({env2D:e})):(l=!0,_.setCoords({env2D:e}),_.xmin-=o,_.xmax+=o);let f=i.createInstance();f.addPathPoint2D(null,0,!0);const p=new Q;if(p.setCoords(_.xmin,_.ymin),f.insertPoint2D(0,-1,p),p.setCoords(_.xmin,_.ymax),f.insertPoint2D(0,-1,p),p.setCoords(.5*(_.xmin+_.xmax),_.ymax),f.insertPoint2D(0,-1,p),p.setCoords(_.xmax,_.ymax),f.insertPoint2D(0,-1,p),p.setCoords(_.xmax,_.ymin),f.insertPoint2D(0,-1,p),p.setCoords(.5*(_.xmin+_.xmax),_.ymin),f.insertPoint2D(0,-1,p),l){f.addPath(i,n,!0);const r=new $;g<m?r.setShiftCoords(o,0):r.setShiftCoords(-o,0),i.getImpl().applyTransformationToPath(r,n),f.addPath(i,n,!0);const a=new c,u=a.addGeometry(f);ao(a,u,t,0,2,!0,e.xmin),ao(a,u,t,0,2,!0,e.xmax),f=a.getGeometry(u);const l=G(f,e);l.inflateCoords(0,1);const h=d(null,l,!0).total();f=Gt(f,e,h,Number.NaN,s)}else f.addPath(i,n,!0);return f}function Ps(t,e,n,i){const s=new r;n.queryEnvelope(s);const o=D(null,n,!0).total();if(e.xmin-s.xmin<=o&&s.xmax-e.xmax<=o)return n;const a=n.createInstance();let m=n.createInstance();const c=new r,u=n.getPathCount();for(let r=0;r<u;r++)n.queryPathEnvelope(r,c),e.xmin-c.xmin<=o&&c.xmax-e.xmax<=o?a.addPath(n,r,!0):(m.setEmpty(),m.addPath(n,r,!0),m=us(t,e,m,!0,i),a.add(m,!0));return a}function xs(t,e,n){const r=t.getPannableExtent(),i=Q.construct(e,0);r.centerAt(i);const s=r.width(),o=.5*s,a=new Q;a.setNAN();let m=Number.NaN;for(let c=0;c<n.getPathCount();c++)for(let t=n.getPathStart(c);t<n.getPathEnd(c);t++){const e=n.getXY(t),i=vm(e.y,r.ymax)||vm(r.ymin,e.y);t===n.getPathStart(c)?(a.setNAN(),m=0):a.isNAN()||i||(m=Cs(e.x,a.x,o,s,m)),e.x+=m,n.setXY(t,e),i||a.setCoordsPoint2D(e)}n.getImpl().notifyModifiedFlags(2001)}function Cs(t,e,n,r,i){return i+t-e>n?i-=r:e-(i+t)>n&&(i+=r),i}function Es(t,e,n,r,s,o){const a=e.getAttributeStreamRef(0),m=e.getPointCount();let u=!1;const l=new Q;for(let i=0;i<m;++i){if(a.queryPoint2D(2*i,l),1&o&&l.y>=n){u=!0;break}if(2&o&&l.y<=-n){u=!0;break}}if(!u)return!1;let h=!1;t&&(h=e.getImpl().isClosedPathInXYPlane(0));const _=new c,f=_.addGeometry(e),p=_.getFirstPath(f);let d=-1,y=!0;const P=new Q,x=new i;let C=g;const E=vs*s/360;for(let i=_.getFirstVertex(p);i!==g;i=_.getNextVertex(i)){_.queryXY(i,l);let t=1&o&&l.y>=n?1:0;if(t|=2&o&&l.y<=-n?2:0,d>0&&d!==t){if(P.x!==l.x){const t=_.getPrevVertex(i);_.queryPoint(t,x);const e=_.insertVertex(p,i,x);P.x=l.x,_.setXY(e,P)}if(h){let t=C!==g?_.getNextVertex(C):_.getFirstVertex(p);const e=_.getPrevVertex(i);for(;t!==e;)t=_.removeVertex(t,!1);if(C!==g){const t=_.getXY(C),n=_.getXY(e);if(Math.abs(t.x-n.x)>E){_.queryPoint(C,x);const r=_.insertVertex(p,e,x);t.x=ht(t.x,n.x,.5),_.setXY(r,t)}}}C=g}if(t&&(l.y=tt(r,l.y),_.setXY(i,l),!y&&d!==t))if(l.x!==P.x){_.queryPoint(i,x);const t=_.insertVertex(p,i,x);_.setXYCoords(t,P.x,l.y),C=t}else C=i;d=t,P.assign(l),y=!1}if(h){if(C!==g){let t=_.getNextVertex(C);for(;t!==g;)t=_.removeVertex(t,!1)}const t=_.getFirstVertex(p);let e=_.getLastVertex(p);const n=_.getXY(t),r=_.getXY(e);if(!n.equals(r)&&(_.queryPoint(t,x),e=_.insertVertex(p,g,x),Math.abs(n.x-r.x)>E)){const t=_.insertVertex(p,e,x);n.x=ht(n.x,r.x,.5),_.setXY(t,n)}}return e.assignCopy(_.getGeometry(f)),!0}function Ss(t,n){let r=new e({vd:t});r.addEnvelope(n,!1);const i=n.width()/180;return r=(new Mt).execute(r,i,0,0,null),r}function ws(t,e){const n=t.getPannableExtent();return Number.isNaN(e)||n.centerAtCoords(e,0),n}function bs(e,n,r){const i=Ha();n.querySpheroidData(i);const s=n.getGCS()!==n?n.getSRToGCSTransform():null,o=_t(Q,100),a=new t(0,0,0),m=e.getPointCount(),c=n.getGCS().getUnit().getUnitToBaseFactor();for(let t=0,g=m;t<g;){const n=Math.min(100,g-t);e.queryCoordinates(o,n,t,t+n),s&&(new Ri).transform(s,o,n,o,!1);for(let t=0;t<n;t++){if(o[t].isNAN())continue;o[t].scale(c);const e=ue(i.majorSemiAxis,i.e2,o[t]);a.addThis(e)}t+=n}const u=fe(i.majorSemiAxis,i.e2,a);u.scale(1/c);const l=e;if(!new ls(n.getGCS(),u).project(l))return 0;r.length=e.getPathCount();const h=l.calculateArea2D()<0;for(let t=0,g=e.getPathCount();t<g;t++){const e=l.calculateRingArea2D(t),n=h?e<0:e>0;r[t]=n}return h?-1:1}function Ts(t,r,i,s,o){if(!r.isPannable()||t.isEmpty())return t;const a=t.getGeometryType();a===L.enumGeometryCollection&&H("not yet impl for geometry collection");const m=r.getPannableExtent();Number.isNaN(i)&&(i=m.getCenterX());const c=m.width(),u=.5*c,l=o>0,h=t.queryInterval(0,0);if(!l&&h.width()<u||!z(t.getGeometryType())){const e=h.getCenter();if(Math.abs(e-i)<=u)return t;{const n=new $,r=ot((i-e)/c)*c;n.setShiftCoords(r,0);const s=t.clone();return s.applyTransformation(n),s}}if(a===L.enumPolygon){let a=new n({vd:t.getDescription()});a.addAndExplicitlyOpenAllPaths(t,!1),l&&(a=Oi(a,r,2,o,Number.NaN,null,!0));const m=[];if(!s){{let n=t;l&&(n=new e,n.add(a,!1));const i=bs(t,r,m);if(i)i<0&&a.reverseAllPaths();else{const t=n.getPathCount();for(let e=0;e<t;e++)m.push(n.calculateRingArea2D(e)>0)}}s=m}return new Is(null,s,a,null,r,i,3,0,null).geoNormalizePolygonGeometry(!0)}if(a===L.enumPolyline){let e=new n({vd:t.getDescription()});e.addAndExplicitlyOpenAllPaths(t,!1),l&&(e=Oi(e,r,2,o,Number.NaN,null,!0));return new Is(null,null,e,null,r,i,3,0,null).geoNormalizePolylineGeometry(!0)}if(a===L.enumMultiPoint){const e=t,n=e.getAttributeStreamRef(0);let r,s=null,o=i,a=0;const m=.1*c;for(let i=0,l=e.getPointCount();i<l;i++){const e=n.read(2*i);let l=e-o;if(Math.abs(l)>u&&(l=ot(l/c)*c,a-=l,Math.abs(a)<m&&(a=0)),0!==a){s||(r=t.clone(),s=r.getAttributeStreamRef(0));const n=e+a;s.write(2*i,n)}o=e}return s?(r.notifyModified(),r):t}V("")}const vs=210;class Is{constructor(t,e,n,r,i,s,o,a,m){this.m_bAdjustedAtPoles=0,this.m_inputPoly=n,this.m_progressTracker=m,this.m_originalGeometry=t,this.m_originalSR=r,this.m_polygonRingFlags=e,this.m_pannableSR=i,this.m_poleSnappingTolerance=a,this.m_poleFlags=o,this.m_bAdjustedAtPoles=0,this.m_pannableExtent=ws(this.m_pannableSR,s),this.m_centralLongitude=Number.isNaN(s)?this.m_pannableExtent.getCenterX():s,this.m_width360=this.m_pannableExtent.width(),this.m_degree=this.m_width360/360,this.m_GCSLargeDelta=vs*this.m_degree,X(null===this.m_originalGeometry&&null===this.m_originalSR||null!==this.m_originalGeometry&&null!==this.m_originalSR)}geonormalizeRing(t,e,r,i,o,a,m){let c=r;const u=new n({vd:this.m_inputPoly.getDescription()});u.addPath(this.m_inputPoly,t,!0),0!==this.m_poleFlags&&(this.m_bAdjustedAtPoles|=Es(!0,u,this.m_pannableExtent.ymax-this.m_poleSnappingTolerance,this.m_pannableExtent.ymax,this.m_pannableExtent.width(),this.m_poleFlags)?1:0,this.m_bAdjustedAtPoles&&(c=!1));let l=-1;c&&(l=this.m_originalGeometry.getPathStart(t));const h=u.getAttributeStreamRef(0),g=u.getPointCount();let _=0,f=h.read(0),p=0;const d=3*this.m_pannableSR.getTolerance(0);let y=!1;const P=new Q,x=new Q;let C=!1;const E=u.hasNonLinearSegments(),S=new Q;for(let n=1;n<g;++n){h.queryPoint2D(2*n,S);const t=S.x;let e=t+_;const r=e-f;if(S.x=e,Math.abs(r)>this.m_GCSLargeDelta){if(c){const t=l+n-1,e=l+(n+1<g?n:0),s=a.read(2*t),o=(a.read(2*e)-s)*i;Math.abs(r-o)>1*this.m_degree&&(c=!1)}if(!c){_-=tt(this.m_width360,e-f),e=t+_,++p,C=0!==_,S.x=e}}else y||s(P,x,S,d)&&(y=!0);C&&(E&&V("error in geonormalize_ring_ for curves"),h.write(2*n,e)),f=e,P.setCoordsPoint2D(x),x.setCoordsPoint2D(S)}p&&u.notifyModified();const w=u.getXY(0),b=u.getXY(g-1);if(Q.distance(w,b)<d){const t=this.finalizeGeoNormalizeClosedRing(u,y,o);m.add(t,!1)}else{if(e<0)if(null!==this.m_originalGeometry){X(null!==this.m_originalGeometry);e=this.m_originalGeometry.calculateRingArea2D(t)>0?1:0}else e=1;const n=this.finalizeGeoNormalizeOpenedRing(e>0,u);m.add(n,!1)}}geoNormalizePolygonGeometry(t){X(this.m_originalSR&&this.m_originalGeometry||!this.m_originalGeometry&&!this.m_originalSR),X(this.m_pannableSR.isPannable());let n=null,i=Number.NaN;const s=!!this.m_originalSR&&this.m_originalSR.isPannable();s&&(n=this.m_originalGeometry.getAttributeStreamRef(0),i=this.m_width360/this.m_originalSR.getPannableExtent().width()),this.m_bAdjustedAtPoles=0;const o=new e({vd:this.m_inputPoly.getDescription()});for(let e=0,r=this.m_inputPoly.getPathCount();e<r;++e){const r=this.m_polygonRingFlags?this.m_polygonRingFlags[e]?1:0:-1;this.geonormalizeRing(e,r,s,i,t,n,o)}const a=this.m_pannableSR.getTolerance(0),m=this.m_pannableExtent.width()/180;go(o,this.m_pannableExtent,.1*a,!1);const c=r.constructEmpty();if(c.setCoords({env2D:this.m_pannableExtent}),t){let t=!0;for(let e=0;e<2;e++){t=!0;const e=r.constructEmpty();for(let n=0,r=o.getPathCount();n<r;n++)if(o.queryPathEnvelope(n,e),!(c.xmin<=e.xmin&&c.xmax>=e.xmax||e.xmin>=c.xmax||e.xmax<=c.xmin)){t=!1;break}if(t)break;c.move(.5*this.m_width360,0)}t||c.setCoords({env2D:this.m_pannableExtent})}let u=Gt(o,c,a,m,this.m_progressTracker),l=o!==u;const h=this.m_originalGeometry?this.m_originalGeometry.calculateArea2D():1,g=u.calculateArea2D();let _=0;if(g>0&&h<0)_=1;else if(g<=0&&h>0)if(0===g){if(this.m_originalSR){let t=Number.NaN;2===this.m_originalSR.getCoordinateSystemType()?t=this.m_originalSR.getPCSHorizon().calculateArea2D():1===this.m_originalSR.getCoordinateSystemType()&&(t=this.m_originalSR.getPannableExtent().getArea()),h>.99*t&&(_=-1)}}else _=-1;if(0!==_){const t=Ss(u.getDescription(),c);t.add(u,!1),l=!0,u=t}return l&&(u=(new At).execute(u,this.m_pannableSR,!1,this.m_progressTracker)),u}geoNormalizePolylineGeometry(t){X(this.m_pannableSR.isPannable());let e=null;const i=this.m_originalSR&&this.m_originalSR.isPannable();let s=1;i&&(X(this.m_originalGeometry),s=this.m_width360/this.m_originalSR.getPannableExtent().width(),e=this.m_originalGeometry.getAttributeStreamRef(0));const o=this.m_pannableExtent.width(),a=o*at()*4;let m=t,c=Number.NaN;const u=et.constructEmpty();this.m_bAdjustedAtPoles=0;let l=new n({vd:this.m_inputPoly.getDescription()});for(let _=0,f=this.m_inputPoly.getPathCount();_<f;++_){let t=i;const h=new n({vd:this.m_inputPoly.getDescription()});h.addPath(this.m_inputPoly,_,!0);const g=this.m_inputPoly.isClosedPath(_);0!==this.m_poleFlags&&(this.m_bAdjustedAtPoles|=Es(g,h,this.m_pannableExtent.ymax-this.m_poleSnappingTolerance,this.m_pannableExtent.ymax,o,this.m_poleFlags)?1:0,this.m_bAdjustedAtPoles&&(t=!1));let f=-1;const p=h.getPointCount();let d=!1;t&&(f=this.m_originalGeometry.getPathStart(_),d=this.m_originalGeometry.isClosedPath(_));const y=h.getAttributeStreamRef(0);let P=0,x=y.read(0),C=0;const E=new Q,S=new Q;let w=!1;const b=h.hasNonLinearSegments(),T=new Q;for(let n=1;n<p;++n){y.queryPoint2D(2*n,T);const r=T.x;let i=r+P;const o=i-x;if(T.x=i,Math.abs(o)>this.m_GCSLargeDelta){if(t){const r=f+n-1;let i=f;(!d||n+1<p)&&(i+=n);const a=e.read(2*r),m=(e.read(2*i)-a)*s;Math.abs(o-m)>1*this.m_degree&&(t=!1)}if(!t){P-=tt(this.m_width360,i-x),i=r+P,++C,w=0!==P,T.x=i}}w&&(b&&V("error in geonormalize_ring_ for curves"),y.write(2*n,i)),x=i,E.setCoordsPoint2D(S),S.setCoordsPoint2D(T)}if(C&&h.notifyModified(),m){let t=!1;if(!h.isEmpty()){const e=r.constructEmpty();if(h.queryEnvelope(e),e.width()>=o||e.ymin<=this.m_pannableExtent.ymin||e.ymax>=this.m_pannableExtent.ymax)t=!0;else{if(Number.isNaN(c)){const t=this.m_centralLongitude-.5*o;c=e.xmin,c+=Math.round((t-e.xmin)/o)*o,c>t&&(c-=o),X(c<=t),c<t&&(c+=o),X(c>=t)}let n=Math.round((c-e.xmin)/o)*o;if(e.xmin+n>c+a&&(n-=o),e.xmin+n<c-a&&(n+=o),u.mergeCoordinate(e.xmin+n),u.mergeCoordinate(e.xmax+n),t=u.width()>=o,!t){const t=new $;t.setShiftCoords(n,0),h.applyTransformation(t)}}}l.add(h,!1),t&&(l=(()=>{const t=new n({vd:l.getDescription()});for(let e=0,r=l.getPathCount();e<r;++e){const r=new n({vd:l.getDescription()});r.addPath(l,e,!0);const i=$s(r,this.m_pannableSR,this.m_centralLongitude,!0,0,this.m_progressTracker);t.add(i,!1)}return t})(),m=!1)}else{const t=$s(h,this.m_pannableSR,this.m_centralLongitude,!0,0,this.m_progressTracker);l.add(t,!1)}}if(m)return l;const h=this.m_pannableSR.getTolerance(0),g=this.m_pannableExtent.width()/180;go(l,this.m_pannableExtent,.1*h,!1);return Gt(l,this.m_pannableExtent,h,g,this.m_progressTracker)}finalizeGeoNormalizeOpenedRing(t,i){const s=i.getPointCount(),o=i.getXY(0),a=i.getXY(s-1);{const t=Math.abs(a.x-o.x),e=Math.round(t/this.m_width360)*this.m_width360;X(Math.abs(t-e)<this.m_pannableSR.getTolerance(0))}const m=nt(a.x-o.x),c=r.constructEmpty();i.queryLooseEnvelope(c);const u=this.m_pannableExtent.getCenterX();let l=0,h=u-this.m_width360,g=u+this.m_width360;if(m>=0){let t=Math.ceil((h-c.xmin)/this.m_width360);for(t*=this.m_width360;h>c.xmin+t;)t+=this.m_width360;for(;h<c.xmax+t;)t-=this.m_width360;for(l=t,c.width()>720&&(g=h+360*Math.ceil(c.width()/360));g<c.xmax;)g+=this.m_width360}else{let t=Math.ceil((g-c.xmax)/this.m_width360);for(t*=this.m_width360;g<c.xmax+t;)t-=this.m_width360;for(;g>c.xmin+t;)t+=this.m_width360;for(l=t,c.width()>720&&(h=g-360*Math.ceil(c.width()/360));h>c.xmin;)h-=this.m_width360}const _=Math.round(Math.abs(a.x-o.x)/this.m_width360)*this.m_width360,f=m*_,p=c.clone();p.move(l,0);const d=new Q(0,0),y=new $;y.setShiftCoords(l,0),i.applyTransformation(y);const P=new n({vd:i.getDescription()});P.add(i,!1),d.assign(i.getXY(s-1));let x=0,C=P.getXY(0).x;for(;m>0?p.xmax<g:p.xmin>h;)p.move(f,0),y.xd=f,i.applyTransformation(y),C+=f,this.m_pannableExtent.xmin<=C&&this.m_pannableExtent.xmax>=C&&(x=P.getPointCount()-1),i.setXY(0,d),d.assign(i.getXY(s-1)),P.addSegmentsFromPath(i,0,0,s-1,!1);const E=new e({vd:P.getDescription()});E.add(P,!1);const S=P.getXY(0),w=P.getXY(P.getPointCount()-1),b=m<0?t:!t,T=E.getPointCount()-1;if(b){const t=new Q(w.x,this.m_pannableExtent.ymax);E.lineTo(t);const e=new Q(this.m_pannableExtent.getCenterX(),this.m_pannableExtent.ymax);E.lineTo(e);const n=new Q(S.x,this.m_pannableExtent.ymax);E.lineTo(n)}else{const t=new Q(w.x,this.m_pannableExtent.ymin);E.lineTo(t);const e=new Q(this.m_pannableExtent.getCenterX(),this.m_pannableExtent.ymin);E.lineTo(e);const n=new Q(S.x,this.m_pannableExtent.ymin);E.lineTo(n)}if(E.interpolateAttributesPath(0,T,0),E.getImpl().changeRingStartPoint(x),_>this.m_width360){const t=new e({copy:E});y.setShiftCoords(this.m_width360,0),t.applyTransformation(y),E.add(t,!1)}return E}finalizeGeoNormalizeClosedRing(t,n,i){const s=new e({vd:t.getDescription()});s.add(t,!1);const a=()=>{const t=s.getPointCount()-2;return s.getSegmentType(t)!==L.enumLine};if(s.hasNonLinearSegments()&&a()){const t=new o,e=s.getPointCount()-2;s.getSegmentBuffer(e,t,!1),s.removePointFromPath(0,e+1),s.closeLastPathWithSegment(t.get())}else s.removePointFromPath(0,s.getPointCount()-1);const m=r.constructEmpty();s.queryLooseEnvelope(m);let c=Math.ceil((this.m_pannableExtent.xmin-m.xmin)/this.m_width360);for(c*=this.m_width360;this.m_pannableExtent.xmin>m.xmin+c;)c+=this.m_width360;for(;this.m_pannableExtent.xmin<m.xmax+c;)c-=this.m_width360;if(c+=this.m_width360,0!==c){m.move(c,0);const t=new $;t.setShiftCoords(c,0),s.applyTransformation(t)}if(this.m_pannableExtent.xmin<=m.xmin&&this.m_pannableExtent.xmax>=m.xmax){if(n){const t=s.calculateArea2D(),e=(new At).execute(s,this.m_pannableSR,!0,this.m_progressTracker);if(e!==s){const n=e.calculateArea2D();nt(t)!==nt(n)&&e.reverseAllPaths(),s.assignMove(e)}}let t;if(t=new e(i?{copy:s}:{move:s}),i)for(;m.xmin<this.m_pannableExtent.xmax;){m.move(this.m_width360,0);const e=new $;e.setShiftCoords(this.m_width360,0),s.applyTransformation(e),t.add(s,!1)}return t}let u=new e({vd:t.getDescription()});u.add(s,!1);const l=n||m.width()>this.m_width360-10*this.m_pannableSR.getTolerance(0);for(;m.xmin<this.m_pannableExtent.xmax;){m.move(this.m_width360,0);const t=new $;t.setShiftCoords(this.m_width360,0),s.applyTransformation(t),u.add(s,!1)}if(l){const t=u.calculateArea2D();u.setFillRule(1),u=(new At).execute(u,this.m_pannableSR,!0,this.m_progressTracker);const e=u.calculateArea2D();nt(t)!==nt(e)&&u.reverseAllPaths()}return u}geonormalize_ring_(t,e,n,r,i,s,o){X(0)}}function Ds(t,e=!0){return X(0),{}}function Gs(t){return Ga()}function Ns(t,e,n,r,i){if(t.equals(e))return!1;if(r){let n=1,s=0,o=1,a=1,m=0,c=1;Number.isNaN(t.m_heightMetersPerUnit)||(n=t.m_heightMetersPerUnit,s=t.m_heightZ0,o=t.m_heightSign,a=e.m_heightMetersPerUnit,m=e.m_heightZ0,c=e.m_heightSign);const u=o*c*n/a;for(let t=0;t<i;t++)r[t]=(r[t]-s)*u+m}let s=1,o=0;if(Number.isNaN(t.m_XYToRadians)||(s=t.m_XYToRadians/e.m_XYToRadians,o=t.m_PrimeMeridianDegrees-e.m_PrimeMeridianDegrees,0!==o&&(o=q(o),o/=e.m_XYToRadians)),Array.isArray(n)){const t=n;for(let e=0;e<i;e++)t[e][0]=t[e][0]*s+o,t[e][1]=t[e][1]*s}else{const t=n;for(let e=0;e<i;e++){const n=e<<1;t[n]=t[n]*s+o,t[n+1]=t[n+1]*s}}return!0}function Ms(){return{m_heightMetersPerUnit:0,m_heightSign:0,m_heightZ0:0,m_XYToRadians:0,m_PrimeMeridianDegrees:0,assign(t){this.m_heightMetersPerUnit=t.m_heightMetersPerUnit,this.m_heightSign=t.m_heightSign,this.m_heightZ0=t.m_heightZ0,this.m_XYToRadians=t.m_XYToRadians,this.m_PrimeMeridianDegrees=t.m_PrimeMeridianDegrees},equals(t){return st(this.m_heightSign,t.m_heightSign)&&st(this.m_heightMetersPerUnit,t.m_heightMetersPerUnit)&&st(this.m_heightZ0,t.m_heightZ0)&&st(this.m_XYToRadians,t.m_XYToRadians)&&st(this.m_PrimeMeridianDegrees,t.m_PrimeMeridianDegrees)},initFromGcsAndVcsPe(t,e){this.m_heightSign=1,this.m_heightMetersPerUnit=Number.NaN,this.m_heightZ0=0,this.m_XYToRadians=Number.NaN,this.m_PrimeMeridianDegrees=Number.NaN,e&&X(0),t&&(this.m_XYToRadians=t.getUnit().getUnitFactor(),this.m_PrimeMeridianDegrees=t.getPrimem().getLongitude())},initFromGcsAndVcs(t,e){const n=t?t.getPECoordSys():null,r=e?e.getPEVerticalCoordSys():null;this.initFromGcsAndVcsPe(n,r)},processUnitParams(t){Number.isNaN(this.m_heightMetersPerUnit)&&(this.m_heightMetersPerUnit=t.m_heightMetersPerUnit,this.m_heightSign=t.m_heightSign,this.m_heightZ0=t.m_heightZ0),Number.isNaN(this.m_XYToRadians)&&(this.m_XYToRadians=t.m_XYToRadians,this.m_PrimeMeridianDegrees=t.m_PrimeMeridianDegrees)}}}function As(t,e,n,r,i,s,o){let a=null;if(e){a=e.getPEVerticalCoordSys()}let m=null;if(t){m=t.getPECoordSys()}let c=null;if(r){c=r.getPEVerticalCoordSys()}let u=null;if(n){u=n.getPECoordSys()}if(!(m||a||u||c))return!1;const l=Ms();l.initFromGcsAndVcsPe(m,a);const h=Ms();return h.initFromGcsAndVcsPe(u,c),Ns(l,h,i,s,o)}class qs{supportsCurves(){return!0}accelerateGeometry(t,e,n){return Ys(t,e,n)}canAccelerateGeometry(t){return Xs(t)}}function Ys(t,e,n){if(!Xs(t))return!1;P(e,t,!1);let r=0;const i=t.getGeometryType();return j(i)&&x(t)&&0!==n&&(r|=t.getImpl().buildQuadTreeAccelerator(n)?1:0),j(i)&&C(t)&&0!==n&&(r|=t.getImpl().buildQuadTreeForPathsAccelerator(n)?1:0),r>0}function Xs(t){return x(t)||C(t)}class Rs extends qs{getOperatorType(){return 8}execute(t,e,n,r){return dn(t,e,n,1,r)}}class Fs extends qs{getOperatorType(){return 3}execute(t,e,n,r=null){return dn(t,e,n,4,r)}}function Os(t,e,i){const s=e.getGCSSplitLines();if(null===s)return t;const o=e.getGCS(),a=o.getPannableExtent().width(),m=r.constructEmpty();t.queryLooseEnvelope(m);const c=et.constructEmpty();m.queryIntervalX(c);const u=s.querySegmentIterator();let l=null;const h=new $;for(;u.nextPath();)for(;u.hasNextSegment();){const t=u.nextSegment(),e=t.queryInterval(0,0),r=et.constructEmpty();r.setCoordsFromEnvelope(e);let i=0;for(;r.vmax>c.vmin;)r.move(-a),i--;for(;r.vmin<=c.vmax;){if(r.isIntersecting(c)){null===l&&(l=new n);const e=new _({start:t.getStartXY(),end:t.getEndXY()});0!==i&&(h.setShiftCoords(i*a,0),e.applyTransformation(h)),l.addSegment(e,!0)}r.move(a),++i}}if(null!==l){const e=D(o,l,!0),n=N(e);return Zt(t,l,n,i)}return t}function Ls(t,e,n){let r=t.getName();return cm(r)||(n||e>0?(r=t.toString(Mm.PE_STR_NAME_CANON|Mm.PE_STR_AUTH_NONE),r=js(r)):r=t.toString(Mm.PE_STR_AUTH_TOP)),r}function Us(t,e,n,r){return X(0),""}function Hs(t,e=-1){if((e>1||e<-1)&&Y("verbosity"),-1===e)return t.toString();{const n=0===e?Mm.PE_STR_AUTH_TOP:Mm.PE_STR_AUTH_ALL;return t.toString(n)}}function zs(t,e){(e>1||e<-1)&&Y("verbosity");let n=Mm.PE_STR_FMT_WKT2;return-1!==e&&(n|=0===e?Mm.PE_STR_AUTH_TOP:Mm.PE_STR_AUTH_ALL),t.toString(n)}function Vs(t){return X(0),""}function js(t){return t.toLocaleUpperCase("en-US")}function ks(t,e,n){const r=t.getPCSHorizon();if(r.getGeometryType()!==L.enumPolygon)if(r.getGeometryType()!==L.enumEnvelope)Y("");else{const t=r;for(let r=0;r<n;r++)t.contains(e[r])||e[r].setNAN()}else{const i=t.getDefaultPrecisionSR().getTolerance(0),s=r;for(let t=0;t<n;t++)1!==Ot(s,e[t],i)&&e[t].setNAN()}}function Bs(t,e,n,r){for(let i=0;i<e;i++){if(t[i].y<n.ymin||t[i].y>n.ymax){t[i].setNAN();continue}const e=t[i].x;t[i].x=no(e,n,r)}}function Zs(t,e,n,s){if(t.isEmpty()||1===n)return t;const o=t.getGeometryType();if(o===L.enumPoint){const r=t,i=r.getXY();return 0===Js([i],1,e,n)||i.isNAN()?r.setEmpty():r.setXY(i),t}if(o===L.enumMultiPoint){const r=t,s=t.createInstance(),o=r.getPointCount();s.reserve(o);const a=r.getAttributeStreamRef(0),m=r.getDescription().getAttributeCount()>1,c=new i,u=Float64Array.from(a.getArray());if(Js(u,o,e,n)>0)for(let t=0,e=2*o;t<e;t+=2)Number.isNaN(u[t])||(m?(r.getPointByVal(t>>1,c),c.setXYCoords(u[t],u[t+1]),s.add(c)):s.addXY(u[t],u[t+1]));return s}let a=t;const m=e.getOneDegreeGCSUnit(),c=90*m,u=180*m,l=360*m,h=e.getCentralMeridian(),g=.5*m,_=r.constructEmpty();a.queryEnvelope(_);const f=e.getGCSHorizon(),p=e.getGCSHorisonIsInclusive(),d=f.getGeometryType()===L.enumEnvelope,y=r.constructEmpty();f.queryEnvelope(y);const x=e.getGCS();if(2!==n&&4!==n||(y.xmin=h-u,y.xmax=y.xmin+l),4===n){if(!(_.width()>l-m)){const t=r.constructEmpty();t.setCoords({xmin:_.xmin-m,ymin:y.ymin,xmax:_.xmax+m,ymax:y.ymax}),a=(new Xt).execute(a,t,x,s);let e=Math.floor((h-_.getCenterX())/l);for(_.move(e*l,0);_.xmin>y.xmax;)e-=1,_.move(-l,0);for(;_.xmin<y.xmin;)e+=1,_.move(l,0);if(0!==e){const t=new $;t.setShiftCoords(e*l,0),a.applyTransformation(t)}return a}n=2}if(2===n&&(y.xmin=h-u,y.xmax=y.xmin+l),_.ymin<-c||_.ymax>c){const t=r.constructEmpty();if(t.setCoords({xmin:_.xmin-m,ymin:-c,xmax:_.xmax+m,ymax:c}),a=(new Xt).execute(a,t,x,s),a.isEmpty())return a;a.queryEnvelope(_)}if(p&&(y.ymax<_.ymin||y.ymin>_.ymax))return a.createInstance();_.width()>l&&(a=lo(a,h-u,l,x,!0,0,!0,s),a.queryEnvelope(_));let C=uo(_.xmin,_.xmax,y.xmin,y.xmax,l);if(0!==C&&_.move(C,0),_.xmax>y.xmax||_.xmin<y.xmin){if(_.xmax>y.xmax)for(;_.xmin>=y.xmax;)_.move(-l,0),C-=l;for(;_.xmin<y.xmax-l;)_.move(l,0),C+=l}const E=P(x,f,!1);if(0!==C){const t=new $;t.setShiftCoords(C,0),a.applyTransformation(t),C=0}if(p){if(d&&y.containsEnvelope(_))return a;const t=new Array(2);for(let e=0;e<2;e++){let n;if(d?n=j(o)?Gt(a,y,E,g,s):Gt(a,y,E,0,s):(n=(new Rt).execute(a,f,x,s),n===f&&(n=n.clone())),y.xmin<=_.xmin&&y.xmax>=_.xmax)return n;if(y.xmin>=_.xmin&&y.xmax<=_.xmax)return n;if(t[e]=n,0===e){_.move(-l,0);const t=new $;t.setShiftCoords(-l,0),a.applyTransformation(t)}}return j(o)?t[0].add(t[1],!1):V("intersect_with_GCS_horizon: unexpected geometry type"),t[0]}{if(y.ymax<_.ymin||y.ymin>_.ymax)return a;let t=0;for(;!a.isEmpty()&&_.xmax>y.xmin;){if(0!==t){const e=new $;e.setShiftCoords(t,0),a.applyTransformation(e)}if(!(new Fs).execute(a,f,x,s)){a=(new Wt).execute(a,f,x,s),f===a&&(a=a.clone())}if(0!==t){const e=new $;e.setShiftCoords(-t,0),a.applyTransformation(e)}t-=l,_.move(-l,0)}return a}}function Ks(t,e,n,r,i,s){const o={stack:[],error:void 0,hasError:!1};try{if(2===s){return be(t,e,n,r,i)}if(Math.abs(n.x-r.x)>=Math.PI||!ia(n.x,r.x,i))return Number.NaN;n.x>r.x&&(r=pt(n,n=r));const a=It(o,new Gm,!1),m=It(o,new Gm,!1),c=It(o,new Gm,!1),u=n.clone();Fm.geodeticDistance(t,e,n.x,n.y,r.x,r.y,m,a,null,s);const l=m.val;let h=0,g=1;for(;l*(g-h)>1e-12*t;){const o=.5*(h+g);if(Fm.geodeticCoordinate(t,e,n.x,n.y,l*o,a.val,m,c,s),u.x=m.val,u.y=c.val,u.x===i)return u.y;if(ia(n.x,u.x,i))g=o;else{if(!ia(r.x,u.x,i))return Number.NaN;h=o}}return u.y}catch(a){o.error=a,o.hasError=!0}finally{Dt(o)}}function Ws(t,e){let n;if(Array.isArray(t)){const r=t;n=new Float64Array(2*e);for(let t=0,i=0;t<e;t++,i+=2)n[i]=r[t].x,n[i+1]=r[t].y}else n=t;return n}function Qs(t,e,n,r){for(let i=0,s=0;i<r;i++,s+=2)e[n+i].x=t[s],e[n+i].y=t[s+1]}function Js(t,e,n,i){if(0===e||1===i)return e;const s=Ws(t,e);if(2===i){const r=n.getPannableExtentInGCS();let i=e;for(let t=0,n=2*e;t<n;t+=2)(s[t+1]>r.ymax||s[t+1]<r.ymin)&&(s[t]=Number.NaN,i--);return i?(ho(s,e,r.xmin,r.width(),!0),t!==s&&Qs(s,t,0,e),i):0}const o=n.getOneDegreeGCSUnit(),a=90*o,m=180*o,c=360*o;let u=e;for(let r=0,p=2*e;r<p;r+=2)(s[r+1]>a||s[r+1]<-a)&&(s[r]=Number.NaN,u--);if(!u)return 0;const l=r.constructEmpty();l.setFromPoints(s,e);const h=n.getGCSHorizon(),g=n.getGCSHorisonIsInclusive(),_=h.getGeometryType()===L.enumEnvelope,f=r.constructEmpty();if(h.queryEnvelope(f),g&&(f.ymax<l.ymin||f.ymin>l.ymax))return 0;if(g){if(ho(s,e,f.getCenterX()-m,c,!0),u=e,_)for(let t=0,n=2*e;t<n;t+=2)f.containsCoords(s[t],s[t+1])||(s[t]=Number.NaN,u--);else{const t=P(n.getGCS(),h,!1),r=new Q;for(let n=0,i=2*e;n<i;n+=2){r.setCoords(s[n],s[n+1]);0!==Ot(h,r,t)||(s[n]=Number.NaN,u--)}}}else{ho(s,e,-m,c,!0),u=e;const t=P(n.getGCS(),h,!1),r=new Q;for(let n=0,i=2*e;n<i;n+=2){r.setCoords(s[n],s[n+1]),r.isNAN()&&u--;const e=co(r.x,f.xmin,f.xmax,c);r.x+=e;0!==Ot(h,r,t)&&(s[n]=Number.NaN,u--)}}return u>0&&Array.isArray(t)&&Qs(s,t,0,e),u}function $s(t,e,n,r,i,s){if(e.isPannable()||Y("fold_into_360_degree_range"),t.isEmpty())return t;let o,a;if(2===e.getCoordinateSystemType()){const t=e.getPannableExtent();a=t.xmin,o=t.width()}else{const t=e.getOneDegreeGCSUnit();o=360*t,a=n-180*t}return lo(t,a,o,e,r,i,!0,s)}function to(t,e,n,r){let i,s;if(2===n.getCoordinateSystemType()){const t=n.getPannableExtent();i=t.xmin,s=t.width()}else{const t=n.getOneDegreeGCSUnit();s=360*t,i=r-180*t}ho(t,e,i,s)}function eo(t,e){const n=e.width();let r=rt(t-e.vmin,n);r<0&&(r+=n);return e.snapClip(r+e.vmin)}function no(t,e,n){return t>e.xmax&&t-e.xmax<n?e.xmax:t<e.xmin&&e.xmin-t<n?e.xmin:t}function ro(t,e,n){if(t[0]<e.vmin||t[0]>e.vmax||n&&t[0]===e.vmax){const n=e.width();return t[0]+=Math.ceil((e.vmin-t[0])/n)*n,t[0]=e.snapClip(t[0]),!0}return!1}function io(t,e,n,r,i,s,o,a,m){return new Is(t,null,n,e,r,i,o,a,s).geoNormalizePolygonGeometry(m)}function so(t,e,n,r,i,s,o,a,m){return new Is(t,null,n,e,r,i,o,a,s).geoNormalizePolylineGeometry(m)}function oo(t,e,n,r,i){const s=new c,o=s.addGeometry(t);return ao(s,o,e,P(e,t,!1),n,r,i),s.getGeometry(o)}function ao(t,e,n,r,i,s,o){const a={stack:[],error:void 0,hasError:!1};try{X(ka()),n.isPannable()||k("insert_geodetic_points");const m=n.getPannableExtent(),c=n.getGCS(),u=Ha();c.querySpheroidData(u);const l=c.getUnit().getUnitToBaseFactor(),h=u.majorSemiAxis,_=u.e2;let f=0;const p=new et;m.queryIntervalX(p);let d=null;const y=new Array(4);2===n.getCoordinateSystemType()?(d=n.getPECoordSys(),s?(y[0]=eo(o,p),y[1]=m.getCenterY(),Am.projToGeog(d,1,y),f=y[0]*l):(y[0]=m.getCenterX(),y[1]=o,Am.projToGeog(d,1,y),f=y[1]*l)):f=o*l,s||0===f||2===i||k("insert_geodetic_points: 1");const P=It(a,new Gm,!1),x=new Q,C=new Q,E=new Q,S=new Q,w=new Q,b=new Q;for(let a=t.getFirstPath(e);a!==g;a=t.getNextPath(a)){const e=t.getFirstVertex(a);t.queryXY(e,E);let m=!1;const c=t.getNextVertex(e);for(let a=c;a!==g;a=t.getNextVertex(a)){if(a===c){if(m)break;m=!0}if(t.queryXY(a,S),s&&(r<o-E.x&&S.x-o>r||r<o-S.x&&E.x-o>r)||!s&&(0!==o||r<-E.y&&S.y>r||r<-S.y&&E.y>r))do{if(Math.abs(E.x-S.x)>=.5*p.width())break;2===n.getCoordinateSystemType()?(y[0]=eo(E.x,p),y[1]=E.y,y[2]=eo(S.x,p),y[3]=S.y,qo(d,2,y,0),w.x=y[0]*l,w.y=y[1]*l,b.y=y[3]*l):(w.x=E.x*l,w.y=E.y*l,b.y=S.y*l),b.x=(S.x-E.x)*Math.PI*2/p.width()+w.x;let e=0;const r=_t(Q,2);if(s){if(C.x=f,C.y=Ks(h,_,w,b,f,i),Number.isNaN(C.y))break;r[0]=C,e=1}else if(2===i){const t=[0,0];if(e=Te(h,_,w,b,f,t),!e)break;r[0].x=t[0],r[0].y=f,2===e&&(r[1].x=t[1],r[1].y=f)}else{if(C.x=sa(h,_,w,b,i),Number.isNaN(C.x))break;C.y=0,r[0]=C,e=1}let m=-1;for(let c=0;c<e;c++){Fm.geodeticDistance(h,_,w.x,w.y,b.x,b.y,P,null,null,i);const e=P.val;Fm.geodeticDistance(h,_,w.x,w.y,r[c].x,r[c].y,P,null,null,i);const u=P.val;2===n.getCoordinateSystemType()?(y[0]=r[c].x/l,y[1]=r[c].y/l,Am.geogToProj(d,1,y),s?(x.y=y[1],x.x=o):(x.x=oa(y[0],E.x,S.x,p),x.y=o)):s?(x.x=o,x.y=r[c].y/l):(x.x=oa(r[c].x/l,E.x,S.x,p),x.y=o);const g=e>0?ft(u/e,0,1):.5;if(0===g||1===g)continue;if(m>g)continue;const f=t.getPrevVertex(a);t.splitSegment(f,[g],1);const C=t.getNextVertex(f);t.setXYCoords(C,x.x,x.y),m=g}}while(0);E.setCoordsPoint2D(S)}}}catch(m){a.error=m,a.hasError=!0}finally{Dt(a)}}function mo(t,e){X(e.isPannable());const n=e.getPannableExtent();if(t.getGeometryType()===L.enumPoint){const e=t.getY();return n.ymin<=e&&e<=n.ymax?t:t.createInstance()}const i=r.constructEmpty();t.queryEnvelope(i);const s=r.constructEmpty();s.setCoords({env2D:n}),s.xmin=i.xmin,s.xmax=i.xmax,s.inflateCoords(.01*s.height(),0);const o=a(e,i,!1);let m;return m=s.containsEnvelope(i)?t:Gt(t,s,o,0,null),m}function co(t,e,n,r){return ot((.5*(n+e)-t)/r)*r}function uo(t,e,n,r,i){if(t>=n&&e<=r)return 0;return co(.5*(e+t),n,r,i)}function lo(t,i,s,o,a,m,c,u){const l=t.getGeometryType(),h=et.constructEmpty();h.setCoords(i,i+s);const g=[0];if(l===L.enumPoint){const e=t;if(g[0]=e.getX(),ro(g,h,c)){const e=a?t:t.clone();return e.setX(g[0]),e}return t}const _=r.constructEmpty();if(t.queryEnvelope(_),_.isEmpty())return t;if(l===L.enumMultiPoint){const e=a?t:t.clone(),n=e.getImpl(),r=n.getAttributeStreamRef(0),i=2*n.getPointCount();let s=!1;for(let t=0;t<i;t+=2)g[0]=r.read(t),ro(g,h,c)&&(r.write(t,g[0]),s=!0);return s&&n.notifyModifiedFlags(2001),e}const f=et.constructEmpty();if(_.queryIntervalX(f),h.contains(f))return h.vmax,f.vmax,t;const p=r.constructEmpty();if(p.setCoords({env2D:_}),0===f.width()){let e=f.vmin;e+=Math.ceil((h.vmin-e)/s)*s,e=h.snapClip(e);const n=a?t:t.clone();return n.setAttributeBasic(0,0,e),n}if(l===L.enumEnvelope){const e=a?t:t.clone();return _.intersect(p),e.setEnvelope(_),e}const d=.1*Math.max(_.height(),_.width())*1;p.inflateCoords(0,d);let y=t;const P=o.getTolerance(0),x=new $;for(;;){const t=Math.floor((f.vmin-i)/s),e=Math.ceil((f.vmax-i)/s);if(!(e-t>3))break;{const n=Math.floor(.5*(e+t));p.xmin=_.xmin-d,p.xmax=i+s*n;const r=Gt(y,p,P,m,u);p.xmin=p.xmax,p.xmax=_.xmax+d;const a=Gt(y,p,P,m,u);x.setShiftCoords((n-e)*s,0),a.applyTransformation(x),l===L.enumPolygon?y=(new Kt).execute(r,a,o,u):(y=r,y.add(a,!1)),y.queryEnvelope(_),_.queryIntervalX(f)}}p.xmin=i,p.xmax=i+s;const C=r.constructEmpty();C.setCoords({env2D:p}),C.inflateCoords(P,0);const E=Math.floor((_.xmin-p.xmin)/s)*s;let S;E?(p.move(E,0),x.setShiftCoords(-E,0)):x.setIdentity(),S=l===L.enumPolyline?new n({vd:y.getDescription()}):new e({vd:y.getDescription()});const w=r.constructEmpty(),b=r.constructEmpty();for(;_.xmax>p.xmin;){const t=Gt(y,p,P,0,u);t.queryEnvelope(b);let e=!1;e=l===L.enumPolyline?!t.isEmpty()&&(b.width()>P||b.height()>P):!t.isEmpty()&&(l!==L.enumPolygon||b.width()>P),e&&(t.applyTransformation(x),t.queryEnvelope(b),S.queryEnvelope(w),w.inflateCoords(P,P),w.isIntersecting(b)&&l===L.enumPolygon?S=(new Kt).execute(S,t,o,u):S.add(t,!1)),p.move(s,0),x.shiftCoords(-s,0)}return S}function ho(t,e,n,r,i=!0){const s=new et;s.setCoords(n,n+r);const o=[0];if(Array.isArray(t)){const n=t;for(let t=0;t<e;t++)s.containsRightExclusive(n[t].x)||(o[0]=n[t].x,ro(o,s,i),n[t].x=o[0])}else{const n=t;for(let t=0;t<e;t++){const e=t<<1;s.containsRightExclusive(n[e])||(o[0]=n[e],ro(o,s,i),n[e]=o[0])}}}function go(t,e,n,i=!0){if(t.isEmpty())return;const s=t.getGeometryType();if(!i||s!==L.enumPolygon)if(z(s)){let r=!1;if(j(s)&&t.hasNonLinearSegments()){const i=t.getImpl(),s=i.getAttributeStreamRef(0),o=i.getSegmentFlagsStreamRef();X(null!==o);for(let t=0,a=i.getPathCount();t<a;t++){let a=!0;const m=i.isClosedPath(t),c=i.getPathEnd(t);if(m&&i.getPathSize(t)>0){a=1===(31&o.read(c-1))}for(let u=i.getPathStart(t);u<c;u++){if(1===(31&o.read(u))){if(a){const t=s.read(2*u),i=no(t,e,n);i!==t&&(r=!0,s.write(2*u,i))}a=!0}else a=!1}}}else{const i=t.getImpl(),s=i.getAttributeStreamRef(0);for(let t=0,o=i.getPointCount();t<o;t++){const i=s.read(2*t),o=no(i,e,n);o!==i&&(r=!0,s.write(2*t,o))}}r&&t.getImpl().notifyModifiedFlags(2001)}else if(s===L.enumEnvelope){const i=t,s=r.constructEmpty();i.queryEnvelope(s),s.xmin=no(s.xmin,e,n),s.xmax=no(s.xmax,e,n),i.setEnvelope(s)}else if(s===L.enumPoint){const r=t;r.setX(no(r.getX(),e,n))}else V("")}function _o(t,e,n){const r=new Q;return r.x=no(t.x,e,n),r.y=t.y,r}function fo(t,e){if(e.isEmpty())return 0;const n=t.getPECoordSys();if(n.getProjection().getCode()===Mm.PE_PRJ_AZIMUTHAL_EQUIDISTANT){const i=Ha();t.querySpheroidData(i);const s=n.getParameters();if(null===s[Mm.PE_PARM_LAM0])return 0;if(null===s[Mm.PE_PARM_PHI0])return 0;const o=[s[Mm.PE_PARM_LAM0].getValue(),s[Mm.PE_PARM_PHI0].getValue()];Am.geogToProj(n,1,o);const a=new Q(o[0],o[1]),m=r.constructEmpty();e.queryEnvelope(m);const c=_t(Q,4);m.queryCorners(c);let u=0;const l=t.getOneMeter();let h=Math.max(i.majorSemiAxis,i.minorSemiAxis)*Math.PI,g=Math.min(i.majorSemiAxis,i.minorSemiAxis)*Math.PI;g-=h/180,h*=l,g*=l;for(let t=0;t<4;t++){const e=Q.distance(c[t],a);if(e>h)u++;else if(e>g)return-1}if(0===u)return 1;if(4===u){const t=r.constructEmpty();return t.setCoords({center:a,width:h,height:h}),m.isIntersectingNe(t)?-1:0}return-1}return-1}function po(t,e,n,i){const s=t.getGeometryType();X(s===L.enumPolygon||s===L.enumPolyline||s===L.enumMultiPoint);const o=e.getCoordinateSystemType();if(2===o){let o=t;if(0===n){const n=fo(e,t);if(0===n)return t.createInstance();if(1===n)return t;const s=e.getPCSHorizon(),m=s.getGeometryType(),c=e.getDefaultPrecisionSR();if(m===L.enumEnvelope){const n=r.constructEmpty();s.queryEnvelope(n);const m=a(c,n,!1);o=Gt(t,n,m,5e4*e.getOneMeterPCSUnit(),i)}else(new Rs).execute(s,t,c,i)||(o=(new Rt).execute(o,s,c,i),o===s&&(o=o.clone()))}else if(e.isPannable()){const t=r.constructEmpty();o.queryEnvelope(t);const a=e.getPannableExtent();a.containsEnvelope(t)||(go(o,a,e.getTolerance(0)),2!==n&&4!==n||(o=mo(o,e)),4!==n?o=$s(o,e,0,!0,1e5*e.getOneMeterPCSUnit(),i):s===L.enumPolygon&&t.width()>2*a.width()&&(o=lo(o,-2*a.width(),2*a.width(),e,!0,0,!0,i)))}return o}if(X(1===o),s===L.enumMultiPoint)return go(t,e.getPannableExtent(),e.getTolerance(0)),t;{const n=r.constructEmpty();t.queryEnvelope(n);let o=t;const a=e.getPannableExtent();if(n.ymin<a.ymin||n.ymax>a.ymax){const t=Math.max(1,n.calculateToleranceFromEnvelope()),s=new r(n.xmin-t,a.ymin,n.xmax+t,a.ymax);if(o=(new Xt).execute(o,s,e,i),o.isEmpty())return o}return s===L.enumPolygon&&n.width()>2*a.width()&&(o=lo(o,-2*a.width(),2*a.width(),e,!0,0,!0,i)),o}}function yo(t,e,n,r,i,s){const o=r.getCoordinateSystemType();if(2===o){if(0===i)n!==t&&it(n,t,e),ks(r,n,e);else if(n!==t&&it(n,t,e),r.isPannable()){const t=r.getTolerance(0);Bs(n,e,r.getPannableExtent(),t),to(n,e,r,0)}}else{X(1===o);const i=r.getTolerance(0),s=r.getPannableExtent();for(let r=0;r<e;r++)n[r].assign(_o(t[r],s,i))}}function Po(t,e){const n=e.getPointCount();if(!n)return;const r=e.getImpl(),i=r.getAttributeStreamRef(0),s=t;Am.geogToProj(s,n,i.getArray()),r.notifyModifiedFlags(2001)}function xo(t,e,n,r){if(!n)return;const i=t.getPECoordSys();if(1===n){const n=[e[0].x,e[0].y];if(Am.geogToProj(i,1,n),r){const{first:r,second:i}=t.m_peCoordSysVal.getGeogToProjFactors();n[0]=r*(e[0].x-t.getCentralMeridian())+i}return void e[0].setCoords(n[0],n[1])}const s=t.isPannable(),o=s?t.getPannableExtent().width():0,a=179*o/360;let m=0;s&&(m=t.getCentralMeridian());const c=256,u=new Float64Array(2*c);for(let l=0;l<n;){for(let t=l;t<n&&e[t].isNAN();++t)l++;let h=Math.min(c,n-l);if(h>0){for(let t=1,n=l+1;t<h;++t,++n)if(e[n].isNAN()){h=t;break}for(let t=0;t<h;++t){const n=t<<1;u[n]=e[l+t].x,u[n+1]=e[l+t].y}if(Am.geogToProj(i,h,u),r){const{first:n,second:r}=t.m_peCoordSysVal.getGeogToProjFactors();for(let t=0;t<h;++t){u[t<<1]=n*(e[l+t].x-m)+r}}if(s)for(let t=0,n=l;t<h;t++,n++){const r=t<<1,i=u[r],s=nt(i),c=e[n].x-m;s*nt(c)<0&&Math.abs(i)>a&&(u[r]-=s*o)}Qs(u,e,l,h),l+=h}}}function Co(t,e,n,r){const i=t.getSRToGCSTransform();return(new Ri).transform(i,e,n,r,!1)}function Eo(t,e,n,i){const s=new m({vd:e.getDescription()});let o;s.addPoints(e,0,-1),o=(new Ri).execute(s,t,i);const a=e.getPointCount();if(n.setEmpty(),t.getInputSR().isPannable()){if(a!==o.getPointCount())return!1;const i=new r;e.queryEnvelope(i);const s=new r;o.queryEnvelope(s);const m=i.width(),c=s.width();if(0!==m&&0!==c){const e=c/m,n=t.getOutputSR().getPannableExtent().width()/t.getInputSR().getPannableExtent().width();if(Math.abs(e/n-1)>1e-10)return!1}else if(0!==m||0!==c)return!1;n.add(e,!1);for(let t=0;t<a;t++){const e=o.getXY(t);n.setXY(t,e)}return!0}return!1}function So(t,e,n){X(!n||t.isPannable());const r=e.getPointCount();if(!r)return;const i=e.getImpl(),s=i.getAttributeStreamRef(0),o=t.getPECoordSys();let a=0;const m=s.readRange(0,2*r);let c=()=>{Am.geogToProj(o,r,m)};const u=t.isPannable()&&!n,l=u?t.getPannableExtent().width():0,h=179*l/360;if(t.isPannable()&&(a=t.getCentralMeridian(),n)){const e=t.m_peCoordSysVal.getGeogToProjFactors(),n=e.first,i=e.second;c=()=>{Am.geogToProj(o,r,m);for(let t=0;t<r;t++){const e=t<<1,r=s.read(e),o=n*(r-a)+i;m[e]=o}}}if(c(),u)for(let g=0;g<r;g++){const t=g<<1,e=m[t],n=nt(e),r=s.read(t)-a;n*nt(r)<0&&Math.abs(e)>h&&(m[t]+=-n*l)}s.writeRangeFromArray(0,2*r,m,!0,1),i.notifyModifiedFlags(2001)}function wo(t,e,n){switch(e.getGeometryType()){case L.enumLine:return void Ko(t,e,n);case L.enumBezier:return void ea(t,e,n);case L.enumEllipticArc:return void Qo(t,e,n);case L.enumBezier2:return void na();case L.enumRationalBezier2:return void ra();default:V("")}}function bo(t,e,n){if(!e.hasNonLinearSegments())return void So(t,e,n);if(X(!n||t.isPannable()),e.isEmpty())return;const r=0,s=t.getPECoordSys(),a=t.isPannable(),m=a?t.getPannableExtent().width():0,c=179*m/360;let u=0;a&&(u=t.getCentralMeridian());const l=e.createInstance();l.reserveParts(e.getPointCount(),e.getPathCount());const h=e.getImpl(),g=new o;for(let o=0,_=e.getPathCount();o<_;++o)if(h.hasNonLinearSegmentsPath(o)){let e=!0,r=-1;const s=h.getPathStart(o),a=s+h.getSegmentCountPath(o);h.isClosedPath(o)&&(r=a-1);const m=new Q;for(let o=s;o<a;++o){if(h.getSegmentBuffer(o,g,!1),wo(t,g.get(),n),!e){g.get().getStartXY().equals(m)||g.get().moveTo(m)}if(o!==r)l.addSegment(g.get(),e);else{if(e){const t=new i;g.get().queryStart(t),l.startPathPoint(t)}l.closeLastPathWithSegment(g.get())}m.assign(g.get().getEndXY()),e=!1}}else{const t=1024;let n,i=h.getPathSize(o),g=Math.min(i,t);l.insertPath(-1,e,o,!0);const _=h.getAttributeStreamRef(0),f=l.getAttributeStreamRef(0);for(let e=h.getPathStart(o),l=h.getPathEnd(o);e<l;){if(n=_.readRange(e,g),Am.geogToProj(s,g,n),a)for(let t=0;t<g;t++){const e=t<<1,i=n[e],s=nt(i),o=_.read(2*(r+t))-u;s*nt(o)<0&&Math.abs(i)>c&&(n[e]+=-s*m)}f.writeRangeFromArray(e,g,n,!0,1),e+=g,i-=g,g=Math.min(i,t)}}e.assignMove(l)}function To(t,e,n){const r=1e3;let i=n.getPointCount();if(!i)return;const s=n.getImpl(),o=s.getAttributeStreamRef(0);let a=Math.min(i,r),m=0;const c=t.getPECoordSys();Number.isNaN(e)&&(e=0);const u=t.isPannable(),l=t.getOneDegreeGCSUnit(),h=360*l,g=179*l;let _;for(;i;){if(_=o.readRange(2*m,2*a),qo(c,a,_,e),u)for(let t=0;t<a;t++){const n=t<<1,r=_[n]-e,i=nt(r),s=o.read(2*(m+t));i*nt(s)<0&&Math.abs(r)>g&&(_[n]+=-i*h)}o.writeRangeFromArray(2*m,2*a,_,!0,1),m+=a,i-=a,a=Math.min(i,r)}s.notifyModifiedFlags(2001)}function vo(t,e,n){switch(n.getGeometryType()){case L.enumLine:return void Io(t,e,n);case L.enumBezier:return void No(t,e,n);case L.enumEllipticArc:return void Do(t,e,n);case L.enumBezier2:return void Mo();case L.enumRationalBezier2:return void Ao();default:V("")}}function Io(t,e,n){const r=[n.getStartXY(),n.getEndXY()];Xo(t,e,r,2),n.setStartXY(r[0]),n.setEndXY(r[1]),n.normalizeAfterEndpointChange()}function Do(t,e,n){if(0===n.projectionBehavior())Go(t,e,n);else{const r=n.isClosed()&&n.isMajor(),i=[n.getStartXY(),r?n.getCenter():n.getEndXY()],s=[i[0].clone(),i[1].clone()];Jo(t,e,s,2);const o=new $;o.initializeFromTwoPointsArray(i,s),n.applyTransformation(o);const a=r?0:1;n.setCoordsForIntersector(s[0],s[a],!1)}}function Go(t,e,n){$o(!1,t,e,n,!1)}function No(t,e,n){const r=_t(Q,4);n.queryControlPoints(r),Jo(t,e,r,4),n.setControlPoints(r)}function Mo(t,e,n){X(0)}function Ao(t,e,n){X(0)}function qo(t,e,n,r){const i=Am.projToGeogCenter(t,e,n,r);for(let s=0;s<e;++s){const t=s<<1;X(Number.isFinite(n[t]+n[t+1]))}return i}function Yo(t,e,n){if(!n.hasNonLinearSegments())return void To(t,e,n);if(n.isEmpty())return;const r=t.getPECoordSys();Number.isNaN(e)&&(e=0);const s=t.isPannable(),a=t.getOneDegreeGCSUnit(),m=360*a,c=179*a,u=n.createInstance();u.reserveParts(n.getPointCount(),n.getPathCount());const l=n.getImpl(),h=new o;for(let o=0,g=n.getPathCount();o<g;++o)if(l.hasNonLinearSegmentsPath(o)){let n=!0,r=-1;const s=l.getPathStart(o),a=s+l.getSegmentCountPath(o);l.isClosedPath(o)&&(r=a-1);const m=new Q;for(let o=s;o<a;++o){if(l.getSegmentBuffer(o,h,!1),vo(t,e,h.get()),!n){h.get().getStartXY().equals(m)||h.get().moveTo(m)}if(o!==r)u.addSegment(h.get(),n);else{if(n){const t=new i;h.get().queryStart(t),u.startPathPoint(t)}u.closeLastPathWithSegment(h.get())}m.assign(h.get().getEndXY()),n=!1}}else{const t=1e3;let i,a=l.getPathSize(o),h=Math.min(a,t);u.insertPath(-1,n,o,!0);const g=l.getAttributeStreamRef(0),_=u.getAttributeStreamRef(0);for(let n=l.getPathStart(o),u=l.getPathEnd(o);n<u;){if(i=g.readRange(2*n,2*h),qo(r,h,i,e),s)for(let t=0;t<h;t++){const r=t<<1,s=i[r]-e,o=nt(s),a=g.read(2*n);o*nt(a)<0&&Math.abs(s)>c&&(i[r]+=-o*m)}_.writeRangeFromArray(2*n,2*h,i,!0,1),n+=h,a-=h,h=Math.min(a,t)}}n.assignMove(u)}function Xo(t,e,n,r){const i=t.getPECoordSys();Number.isNaN(e)&&(e=0);const s=t.isPannable(),o=t.getOneDegreeGCSUnit(),a=360*o,m=179*o,c=256,u=new Float64Array(2*c);for(let l=0;l<r;){for(let e=l;e<r&&n[e].isNAN();++e)l++;let t=Math.min(c,r-l);if(t>0){for(let e=1,r=l+1;e<t;++e,++r)if(n[r].isNAN()){t=e;break}for(let e=0;e<t;e++){const t=e<<1;u[t]=n[l+e].x,u[t+1]=n[l+e].y}if(qo(i,t,u,e),s)for(let r=0,i=l;r<t;++r,++i){const t=r<<1,s=n[i].x,o=u[t]-e,c=nt(o);c*nt(s)<0&&Math.abs(o)>m&&(u[t]-=c*a)}for(let e=0;e<t;e++){const t=e<<1;n[l+e].x=u[t],n[l+e].y=u[t+1]}l+=t}}}function Ro(t,e,n,r){X(0)}function Fo(t,e,n){let r=e.getPointCount();if(!r)return!1;const i=e.getImpl(),s=i.getAttributeStreamRef(0);let o=null;const a=t.getInputSR(),m=t.getOutputSR();a.getVCS(),m.getVCS();const c=a.getOneDegreeGCSUnit(),u=m.getOneDegreeGCSUnit(),l=t.isVertical();l&&e.hasAttribute(1)&&(o=i.getAttributeStreamRef(1));const h=t.getDatumTransformation(),g=!!h&&1===h.getType();if(g||null===o||(Ro(o.getArray()),o=null),!h||0===h.count()){const t=a.getGcsUnitFactor()/m.getGcsUnitFactor(),e=(a.getPrimeMeridian()-m.getPrimeMeridian())*u,n=-90*c,o=90*c;let l=0;const h=s.getArray(),g=[0];for(let i=1,s=2*r;i<s;)g[0]=h[i],l|=Pt(g,n,o)?1:0,h[i]=g[0],i+=2;if(0!==e||1!==t){l=1;const n=s.getArray();for(let i=0,s=2*r;i<s;){let r=n[i];r*=t,r+=e,n[i]=r,n[i+1]*=t,i+=2}}return 0!==l&&i.notifyModifiedFlags(2001),!!l}const _=1e3;let f=Math.min(r,_);const p=new Array(f),d=new Array(f);let y=null;null!==o&&(y=new Float64Array(f));let P=0,x=Number.NaN,C=Number.NaN;const E=360*u,S=u/c;n&&(C=90*u,x=89.9*c,d.fill(0));let w=!0,b=0;for(;r;){let t=!1;const e=s.readRange(2*P,2*f);for(let n=0;n<f;n++)p[n]=e[n<<1];if(n)for(let n=0;n<f;n++){const r=1+(n<<1),i=Math.abs(e[r])-x;if(i>0){const s=e[r];e[r]=tt(x,s),d[n]=tt(i,s),t=!0}}const i=e[0];if(g){const t=h;y&&o.queryRange(P,f,y,!0,1),t.transform(!1,e,y,f),y&&o.writeRangeFromArray(P,f,y,!0,1)}else{h.transform(!1,e,f)}w&&(b=e[0]-S*i,w=!1);for(let n=0;n<f;n++){const t=n<<1,r=e[t]-p[n]*S-b;Math.abs(r)>200&&(e[t]+=r>0?-E:E)}if(t){for(let t=0;t<f;t++)if(d[t]){const n=1+(t<<1);e[n]+=S*d[t],e[n]>C?e[n]=C:e[n]<-C&&(e[n]=-C)}d.fill(0)}s.writeRangeFromArray(2*P,2*f,e,!0,1),l&&o&&o.writeRangeFromArray(P,f,y,!0,1),P+=f,r-=f,f=Math.min(r,_)}return i.notifyModifiedFlags(2001),!0}function Oo(t,e,n){switch(e.getGeometryType()){case L.enumLine:return zo(t,e,n);case L.enumBezier:return ko(t,e,n);case L.enumEllipticArc:return Vo(t,e,n);case L.enumBezier2:return Bo();case L.enumRationalBezier2:return Zo();default:V("")}}function Lo(t,e,n){if(!e.hasNonLinearSegments())return Fo(t,e,n);if(e.isEmpty())return!1;const r=e.createInstance();r.reserveParts(e.getPointCount(),e.getPathCount());const s=e.getImpl(),a=new o;for(let o=0,m=e.getPathCount();o<m;++o){let e=!0,m=-1;const c=s.getPathStart(o),u=c+s.getSegmentCountPath(o);s.isClosedPath(o)&&(m=u-1);const l=new Q;for(let o=c;o<u;++o){if(s.getSegmentBuffer(o,a,!1),Oo(t,a.get(),n),!e){a.get().getStartXY().equals(l)||a.get().moveTo(l)}if(o!==m)r.addSegment(a.get(),e);else{if(e){const t=new i;a.get().queryStart(t),r.startPathPoint(t)}r.closeLastPathWithSegment(a.get())}l.assign(a.get().getEndXY()),e=!1}}return e.assignMove(r),!0}function Uo(t,e,n,r,i,s){if(t.isIdentityGeogToGeog()){const n=90*t.getInputSR().getOneDegreeGCSUnit();let i=0;const s=[0];for(let t=0;t<r;t++)s[0]=e[t].y,i|=Pt(s,-n,n)?1:0,e[t].y=s[0];return i}const o=t.getInputSR(),a=t.getOutputSR(),m=o.getVCS(),c=a.getVCS(),u=o.getOneDegreeGCSUnit(),l=90*u,h=a.getOneDegreeGCSUnit(),g=t.isVertical(),_=t.getDatumTransformation(),f=!!_&&1===_.getType();if(g||(n=null),!_||0===_.count()){let t=0;const i=[0];for(let n=0;n<r;n++)i[0]=e[n].y,t|=Pt(i,-l,l)?1:0,e[n].y=i[0];return t|=As(o.getGCS(),m,a.getGCS(),c,e,n,r)?1:0,t}f||null===n||Ro();const p=1024;let d=Math.min(r,p);const y=new Array(d),P=ut(d,0);let x=0,C=Number.NaN,E=Number.NaN;const S=360*h,w=h/u;i&&(E=90*h,C=89.9*u);let b=!0,T=0,v=r;for(;v;){let t=!1;for(let n=0;n<d;n++)y[n]=e[n+x].x;if(i)for(let n=0;n<d;n++){const r=Math.abs(e[n+x].y)-C;if(r>0){const i=e[n+x].y;e[n+x].y=tt(C,i),P[n]=tt(r,i),t=!0}}const r=e[0].x;if(f){_.transform(!1,e,n,d)}else{_.transform(!1,e,d)}b&&(T=e[0].x-w*r,b=!1);for(let n=0;n<d;n++){const t=e[x+n].x-y[n]*w-T;Math.abs(t)>200&&(t>0?e[x+n].x-=S:e[x+n].x+=S)}if(t){for(let t=0;t<d;t++)P[t]&&(e[x+t].y+=w*P[t],e[x+t].y>E?e[x+t].y=E:e[x+t].y<-E&&(e[x+t].y=-E));P.fill(0,0,d)}x+=d,v-=d,d=Math.min(v,p)}return 1}function Ho(t,e,n,r,i,s){let o=0,a=!0,m=0;for(let c=0;c<r;++c)e[c].isNAN()?a||(o|=Uo(t,e.slice(m,c-m),n?n.slice(m,c-m):null,c-m,i),m=c,a=!0):a&&(m=c,a=!1);return a||(o|=Uo(t,0===m?e:e.slice(m),n?0===m?n:n.slice(m):null,r-m,i)),0!==o}function zo(t,e,n){const r=[e.getStartXY(),e.getEndXY()],i=[0,0];let s=null;e.hasAttribute(1)&&(s=i,s[0]=e.getAttributeAsDbl(0,1,0),s[1]=e.getAttributeAsDbl(1,1,0));const o=Ho(t,r,s,2,n);return e.setStartXY(r[0]),e.setEndXY(r[1]),s&&(e.setStartAttribute(1,0,s[0]),e.setEndAttribute(1,0,s[1])),e.normalizeAfterEndpointChange(),o}function Vo(t,e,n){if(0===e.projectionBehavior())return jo(t,e,n);const r=e.getStartXY().equals(e.getEndXY()),i=_t(Q,3),s=_t(Q,3),o=[0,0,0];let a=null;i[0].assign(e.getStartXY()),i[1].assign(r?e.getCenter():e.getEndXY());let m=!1;e.hasAttribute(1)&&(a=o,a[0]=e.getAttributeAsDbl(0,1,0),a[1]=e.getAttributeAsDbl(1,1,0),a[2]=ht(a[0],a[1],.5),r&&(a[1]=a[2])),s[0].setCoordsPoint2D(i[0]),s[1].setCoordsPoint2D(i[1]);const c=new $;if(r||e.isDegenerateToLine())m=Ho(t,s,a,2,n),c.initializeFromTwoPoints(i[0],i[1],s[0],s[1]);else{const r=new Q;e.queryCoord2D(.5,r),i[2].setCoordsPoint2D(r),s[2].setCoordsPoint2D(r),m=Ho(t,s,a,3,n),c.setFromTwoTriangles(i,s)}return c.isIdentity()||(e.applyTransformation(c),e.setStartXY(s[0]),e.setEndXY(r?s[0]:s[1]),e.normalizeAfterEndpointChange()),a&&(e.setStartAttribute(1,0,a[0]),e.setEndAttribute(1,0,r?a[0]:a[1])),m}function jo(t,e,n){const r=[e.getStartXY(),e.getEndXY(),e.getInteriorPoint(),e.getCenter()];let i=4;e.isDegenerateToLine()&&(i=2);const s=[0,0,0,0];let o=null;if(e.hasAttribute(1)){o=s,o[0]=e.getAttributeAsDbl(0,1,0),o[1]=e.getAttributeAsDbl(1,1,0);const t=ht(o[0],o[1],.5);o[2]=t,o[3]=t}const a=e.getStartXY().equals(e.getEndXY())&&!e.isDegenerateToLine(),m=Ho(t,r,o,i,n);return a?e.constructCircleCenterAndPoint(r[3],r[0],!e.isClockwise()):e.isDegenerateToLine()?e.constructLineCircularArc(r[0],r[1]):e.constructCircularArcThreePoint(r[0],r[1],r[2]),o&&(e.setStartAttribute(1,0,o[0]),e.setEndAttribute(1,0,o[1])),m}function ko(t,e,n){const r=_t(Q,4);e.queryControlPoints(r);const i=[0,0,0,0];let s=null;e.hasAttribute(1)&&(s=i,s[0]=e.getAttributeAsDbl(0,1,0),s[3]=e.getAttributeAsDbl(1,1,0),s[1]=ht(s[0],s[3],.5),s[2]=s[1]);const o=Ho(t,r,s||null,r.length,n);return e.setControlPoints(r),s&&(e.setStartAttribute(1,0,s[0]),e.setEndAttribute(1,0,s[3])),e.normalizeAfterEndpointChange(),o}function Bo(t,e,n){return X(0),!1}function Zo(t,e,n){return X(0),!1}function Ko(t,e,n){const r=[e.getStartXY(),e.getEndXY()];xo(t,r,2,n),e.setStartXY(r[0]),e.setEndXY(r[1]),e.normalizeAfterEndpointChange()}function Wo(t,e,n,r){xo(t,e,n,r)}function Qo(t,e,n){if(0===e.projectionBehavior())ta(t,e,n);else{const r=e.isClosed()&&e.isMajor(),i=[e.getStartXY(),r?e.getCenter():e.getEndXY()],s=[i[0].clone(),i[1].clone()];Wo(t,s,2,n);const o=new $;o.initializeFromTwoPointsArray(i,s),e.applyTransformation(o);const a=r?0:1;e.setCoordsForIntersector(s[0],s[a],!1)}}function Jo(t,e,n,i){Xo(t,e,n,i);const s=new r;s.setFromPoints(n,i);const o=t.getOneDegreeGCSUnit(),a=360*o,m=180*o;if(s.width()>m){for(let t=0;t<i;t++)for(;n[t].x<e;)n[t].x+=a;if(s.setFromPoints(n,i),s.xmax>m+e)for(let t=0;t<i;t++)n[t].x-=a}}function $o(t,e,n,r,i){const s=_t(Q,3);let o=0,a=!1,m=!1;const c=r.isDegenerateToLine();c?(s[0].assign(r.getStartXY()),s[1].assign(r.getEndXY()),s[2].setCoords(0,0),o=2):r.isClosed()&&r.isMajor()?(a=!0,m=!r.isClockwise(),s[0].assign(r.getStartXY()),s[1].assign(r.getCenter()),s[2].setCoords(0,0),o=2):(s[0].assign(r.getStartXY()),s[1].assign(r.getEndXY()),s[2].assign(r.getInteriorPoint()),o=3),t?Wo(e,s,o,i):Jo(e,n,s,o),c?r.constructLineCircularArc(s[0],s[1]):a?r.constructCircleCenterAndPoint(s[1],s[0],m):r.constructCircularArcThreePoint(s[0],s[1],s[2])}function ta(t,e,n){$o(!0,t,0,e,n)}function ea(t,e,n){const r=_t(Q,4);e.queryControlPoints(r),Wo(t,r,4,n),e.setControlPoints(r)}function na(t,e,n){X(0)}function ra(t,e,n){X(0)}function ia(t,e,n){const r=A(t),i=A(e),s=M(r,i),o=M(r,A(n));return 0===o||(s>0&&o>0&&o<=s||s<0&&o<0&&o>=s)}function sa(t,e,n,r,i){const s={stack:[],error:void 0,hasError:!1};try{const o=n.clone(),a=r.clone();if(2===i){const n=[0,0];return Te(t,e,o,a,0,n),n[0]}if(o.y>a.y){const t=new Q;t.assign(o),o.assign(a),a.assign(t)}const m=It(s,new Gm,!1),c=It(s,new Gm,!1),u=It(s,new Gm,!1),l=new et;if(l.setCoords(o.y,a.y),!l.containsCoordinate(0)||Math.abs(o.x-a.x)>=Math.PI)return Number.NaN;if(o.x===a.x)return o.x;Fm.geodeticDistance(t,e,o.x,o.y,a.x,a.y,c,m,null,i);const h=c.val;let g=0,_=1;const f=o.clone();for(;h*(_-g)>1e-12*t;){const n=.5*(g+_);if(Fm.geodeticCoordinate(t,e,o.x,o.y,h*n,m.val,c,u,i),f.x=c.val,f.y=u.val,l.setCoords(o.y,f.y),0===f.y)return f.x;if(l.containsCoordinate(0))_=n;else{if(l.setCoords(a.y,f.y),!l.containsCoordinate(0))return X(!1),Number.NaN;g=n}}return f.x}catch(o){s.error=o,s.hasError=!0}finally{Dt(s)}}function oa(t,e,n,r){const i=new et;i.setCoords(e,n);const s=r.width();let o=Math.floor((t-e)/s)*s+t;const a=i.getCenter();for(;Math.abs(o-a)>Math.abs(o+s-a);)o+=s;return o}class aa extends Ft{constructor(){super(),this.m_geometryDeque=[],this.m_index=-1}next(){if(this.m_geometryDeque.length>0){this.m_index++;const t=this.m_geometryDeque[0];return this.m_geometryDeque.shift(),t}return null}getGeometryID(){return this.m_index}tick(t){this.m_geometryDeque.push(t)}tock(){return!0}getRank(){return 1}}function ma(t,e){return t===e||null!==t&&null!==e&&(t.m_csType===e.m_csType&&(0===t.m_WKID&&0===e.m_WKID?t.m_hashCode===e.m_hashCode&&t.m_canonicalWkt===e.m_canonicalWkt:t.m_WKID===e.m_WKID))}function ca(t,e){return t===e||null!==t&&null!==e&&(t.m_csType===e.m_csType&&(0===t.m_WKID&&0===e.m_WKID?1===t.m_csType?t.m_peCoordSys.isEqual(e.m_peCoordSys):t.m_peCoordSys===e.m_peCoordSys:t.m_WKID===e.m_WKID))}class ua{constructor(t,e=!0){this.m_PCSHorizon=null,this.m_GCSHorizon=null,this.m_GCSSplitLines=null,this.m_bGCSHorisonIsInclusive=!1,this.m_oneMeterPCS=0,this.m_oneDegreeGCS=0,this.m_gcsUnitFactor=0,this.m_northPole=Q.getNAN(),this.m_southPole=Q.getNAN(),this.m_polesUpdated=0,this.m_domain=r.constructEmpty(),this.m_primeMeridian=Number.NaN,this.m_geogToProjFactor=1,this.m_geogToProjOffset=0,this.m_geogToProjFactorsUpdated=0,this.m_oneMillimeter=0,this.m_centralMeridian=0,this.m_pPCSInfoNoDomain=null,this.m_oldWKID=-1973,this.m_vcsWKID=-1,this.m_bIsPannable=!1,this.m_bCached=!1,this.m_pannableExtent=r.constructEmpty(),this.m_pannableExtentGCS=r.constructEmpty(),this.m_areaOfUse=null,this.m_canonicalWkt="",this.m_peCoordSys=t,this.m_WKID=Nm.getCode(t),this.m_WKID<=0?(this.m_WKID=0,this.m_canonicalWkt=Ls(t,0,!0),this.m_hashCode=xt(this.m_canonicalWkt)):this.m_hashCode=Ct(this.m_WKID);const n=this.m_peCoordSys.getType();this.m_csType=n===Mm.PE_TYPE_PROJCS?2:1,X(n===Mm.PE_TYPE_PROJCS||n===Mm.PE_TYPE_GEOGCS),n===Mm.PE_TYPE_PROJCS&&(t.loadConstants()||Y("PeProjcs.loadConstants failed"));const i=n===Mm.PE_TYPE_GEOGCS?this.m_peCoordSys:this.m_peCoordSys.getGeogcs();n!==Mm.PE_TYPE_GEOGCS&&Nm.getCode(i),this.m_unit=ie(t),this.m_primeMeridian=i.getPrimem().getLongitude();{const t=i.getUnit().getUnitFactor();this.m_gcsUnitFactor=t;let e=Math.PI/(180*t);Math.abs(e-1)<1e-10&&(e=1),this.m_oneDegreeGCS=e}if(n===Mm.PE_TYPE_PROJCS){const t=this.m_peCoordSys,e=t.getUnit().getUnitFactor();this.m_oneMeterPCS=1/e,this.m_oneMillimeter=.001/e,this.m_pPCSInfoNoDomain=Ym.generate(t,Ym.PE_PCSINFO_OPTION_NONE),this.m_pPCSInfoNoDomain||V("cannot create pcs info"),this.m_bIsPannable=this.m_pPCSInfoNoDomain.isPannableRectangle(),this.m_centralMeridian=this.m_pPCSInfoNoDomain.getCentralMeridian()}else{this.m_bIsPannable=!0,this.m_polesUpdated=1,this.m_oneMeterPCS=0;const t=1/i.getUnit().getUnitFactor(),e=i.getDatum().getSpheroid().getAxis();this.m_oneMillimeter=.001/e*t,this.m_centralMeridian=0}this.m_bIsPannable&&(this.updateGCSHorizon(),this.updatePCSHorizon(),this.updatePoles(),this.updateDomain(),this.updatePannableExtent(),this.updatePannableExtentGCS())}[Symbol.dispose](){}getHashCode(){return this.m_hashCode}getPCSHorizonPannable(){return this.m_PCSHorizon}getGCSHorizonPannable(){return this.m_GCSHorizon}getPCSInfo(){return X(this.m_pPCSInfoNoDomain),this.m_pPCSInfoNoDomain}getCentralMeridian(){return this.m_centralMeridian}updateGCSHorizon(){if(this.m_peCoordSys.getType()!==Mm.PE_TYPE_PROJCS)return;let t=!0;const i=this.m_peCoordSys,s=i.getGeogcs(),o=i.horizonGcsGenerate();if(!o)return;X(o.length>0);const a=o[0].getNump(),m=o[0].getKind();let c,u;t=o[0].getInclusive()>0;const l=this.getOneDegreeGCSUnit(),h=90*l,g=360*l,_=370*l,f=180*l*Mm.PE_HORIZON_DELTA/Math.PI,p=r.constructEmpty();let d=null;if(a>1)for(let e=1;e<a;e++)if(o[e].getKind()===Mm.PE_HORIZON_LINE){d||(d=new n);const t=o[e].getCoord();d.startPathCoords(t[0][0],t[0][1]),d.lineToCoords(t[1][0],t[1][1])}if(m===Mm.PE_HORIZON_RECT){const e=o[0].getCoord();if(p.setFromPoints([new Q(e[0][0],e[0][1]),new Q(e[1][0],e[1][1])],2),Math.abs(p.ymax-h)<1e-7*f&&(p.ymax=h),Math.abs(p.ymin+h)<1e-7*f&&(p.ymin=-h),p.width()>_){const t=-400*l,e=t+5*g;p.setCoords({xmin:t,ymin:p.ymin,xmax:e,ymax:p.ymax})}const n=new I({env2D:p});this.m_GCSHorizon||(this.m_GCSHorizon=n,this.m_bGCSHorisonIsInclusive=t)}else{let n=this.getPCSInfo().isGcsHorizonMultiOverlap();const i=Qa(s,null,null,1),m=[],_=new et;for(let t=0;t<a;t++){if(o[t].getKind()!==Mm.PE_HORIZON_POLY)continue;c=o[t].getSize();const e=o[t].getCoord(),n=r.constructEmpty();n.setFromPoints(Et(e),c),m.push(new et(n.xmin,n.xmax)),n.width(),_.merge(m.at(-1))}let f=!1;const p=new et;_.width()>g&&m.length>1?(p.vmin=this.getCentralMeridian()-g,p.vmax=p.vmin+2*g,f=!0,n=!0):(p.vmin=_.vmin,p.vmax=p.vmin+g);const y=t=>{let e=0;for(;m[t].vmin+e<p.vmin;)e+=g;for(;m[t].vmax+e-g>p.vmin;)e-=g;return e};let P=new e;if(n){const t=new aa,n=(new Kt).executeMany(t,i,null);for(let r=0;r<a;r++){if(o[r].getKind()!==Mm.PE_HORIZON_POLY)continue;c=o[r].getSize();const i=o[r].getCoord();u=o[r].getInclusive()>0;const s=new e;if(s.addPathPoint2D(Et(i),c-1,!0),f){const e=y(r),n=m[r].clone();n.move(e);let i=e;const o=new $;do{o.setShiftCoords(i,0);const e=s.clone();e.applyTransformation(o),t.tick(e),t.tock(),i+=g,n.move(g)}while(n.vmin<p.vmax)}else t.tick(s),n.tock()}P=n.next()}else{P=new e;for(let n=0;n<a;n++){if(o[n].getKind()!==Mm.PE_HORIZON_POLY)continue;c=o[n].getSize();const r=o[n].getCoord();if(u=o[n].getInclusive()>0,X(u===t),f){const t=new e;t.addPathPoint2D(Et(r),c-1,!0);const i=y(n),s=m[n].clone();s.move(i);let o=i;const a=new $;do{if(0!==o){a.setShiftCoords(o,0);const n=new e({copy:t});n.applyTransformation(a),P.addPath(n,0,!0)}else P.addPath(t,0,!0);o+=g,s.move(g)}while(s.vmin<p.vmax)}else P.addPathPoint2D(Et(r),c-1,!0)}}f&&(P=(new Xt).execute(P,new r(p.vmin,-h-l,p.vmax,h+l),i,null)),t?(new Rt).accelerateGeometry(P,i,1):(new Wt).accelerateGeometry(P,i,1),(new Fs).accelerateGeometry(P,i,1),null===this.m_GCSHorizon&&(this.m_GCSHorizon=P,this.m_bGCSHorisonIsInclusive=t,this.m_GCSSplitLines=d)}}updateAreaOfUse(){return null}updatePCSHorizon(){if(this.m_peCoordSys.getType()!==Mm.PE_TYPE_PROJCS)return;const t=this.m_peCoordSys.horizonPcsGenerate();if(!t)return;let n;this.getPCSInfo();const i=t[0].getKind();t[0].getInclusive();const s=r.constructEmpty(),o=t[0].getNump();let a=!1;if(i===Mm.PE_HORIZON_RECT){const e=t[0].getCoord();s.setFromPoints(Et(e),2),n=new I({env2D:s})}else{let r=-1;for(let e=0;e<o;e++)t[e].getKind()===Mm.PE_HORIZON_POLY&&(r=e);X(r>=0);const i=t[r].getSize()-1,s=t[r].getCoord(),m=new e;n=m,m.addPathPoint2D(Et(s),i,!0),a=!0}if(this.getPCSInfo().isDensificationNeeded()){X(i!==Mm.PE_HORIZON_RECT);const t=1e5*this.getOneMeterPCSUnit();n=(new Mt).execute(n,t,0,0,null)}if(a){{const t=new I;n.queryEnvelope(t),n.calculateArea2D(),n.calculateLength2D(),n.getExteriorRingCount()}(new Rt).accelerateGeometry(n,null,1)}null===this.m_PCSHorizon&&(this.m_PCSHorizon=n)}updatePannableExtent(){const t=this.m_peCoordSys.getType();if(t===Mm.PE_TYPE_PROJCS){const t=this.m_peCoordSys,e=this.getPCSInfo().getCentralMeridian(),n=t.getGeogcs();n||V("");const i=[e+1/n.getUnit().getUnitFactor()*Math.PI,0];Am.geogToProj(t,1,i);const s=i[0],o=t.getParameters()[Mm.PE_PARM_X0].getValue(),a=this.getPCSHorizon(),m=r.constructEmpty();a.queryEnvelope(m);const c=Math.abs(s-o),u=c+o,l=-1*c+o,h=m.ymax,g=m.ymin;this.m_pannableExtent.setCoords({xmin:l,ymin:g,xmax:u,ymax:h})}else if(t===Mm.PE_TYPE_GEOGCS){const t=1/this.m_peCoordSys.getUnit().getUnitFactor()*Math.PI;this.m_pannableExtent.setCoords({xmin:-t,ymin:-t/2,xmax:t,ymax:t/2})}else V("")}updatePannableExtentGCS(){const t=this.m_peCoordSys.getType();if(t===Mm.PE_TYPE_PROJCS){const t=this.m_peCoordSys,e=this.m_centralMeridian,n=t.getGeogcs();n||V("");const i=1/n.getUnit().getUnitFactor()*Math.PI,s=this.getGCSHorizon(),o=r.constructEmpty();s.queryEnvelope(o),this.m_pannableExtentGCS.setCoords({xmin:e-i,ymin:o.ymin,xmax:e+i,ymax:o.ymax})}else if(t===Mm.PE_TYPE_GEOGCS){const t=1/this.m_peCoordSys.getUnit().getUnitFactor()*Math.PI;this.m_pannableExtentGCS.setCoords({xmin:-t,ymin:-t/2,xmax:t,ymax:t/2})}else V("")}updateDomain(){if(1===this.m_csType){const t=400*this.getOneDegreeGCSUnit();this.m_domain=r.construct(-t,-t,t,t)}else{X(2===this.m_csType);const t=Ym.generate(this.m_peCoordSys,Ym.PE_PCSINFO_OPTION_DOMAIN);t||V("generate pcs info failed");const e=new r(t.getDomainMinx(),t.getDomainMiny(),t.getDomainMaxx(),t.getDomainMaxy());this.m_domain.isEmpty()&&this.m_domain.setCoords({env2D:e})}}updatePoles(){if(this.m_peCoordSys.getType()===Mm.PE_TYPE_PROJCS){const t=90*this.getOneDegreeGCSUnit(),e=[[0,t],[0,-t]];Am.geogToProj(this.m_peCoordSys,2,e);const n=this.getPCSInfo().getNorthPoleLocation()!==Ym.PE_POLE_OUTSIDE_BOUNDARY,r=this.getPCSInfo().getSouthPoleLocation()!==Ym.PE_POLE_OUTSIDE_BOUNDARY;this.m_polesUpdated||(n&&this.m_northPole.setCoords(e[0][0],e[0][1]),r&&this.m_southPole.setCoords(e[1][0],e[1][1]),this.m_polesUpdated=1)}else this.m_polesUpdated=1}updateGeogToProjFactors(){if(this.m_peCoordSys.getType()===Mm.PE_TYPE_PROJCS){const t=this.getOneDegreeGCSUnit(),e=this.m_pPCSInfoNoDomain.getCentralMeridian(),n=[0,0,0,0];n[0]=e,n[1]=0,n[2]=e+t,n[3]=0;const r=Am.geogToProj(this.m_peCoordSys,2,n);X(2===r);const i=(n[2]-n[0])/t,s=n[0];0===this.m_geogToProjFactorsUpdated&&(this.m_geogToProjFactor=i,this.m_geogToProjOffset=s,this.m_geogToProjFactorsUpdated=1)}else this.m_geogToProjFactorsUpdated=1}getOneMeterPCSUnit(){return this.m_oneMeterPCS}getOneDegreeGCSUnit(){return this.m_oneDegreeGCS}getGcsUnitFactor(){return this.m_gcsUnitFactor}getUnitsPerMillimeter(){return this.m_oneMillimeter}getGCSSplitLines(){return this.m_bIsPannable?null:(this.m_GCSHorizon||this.updateGCSHorizon(),this.m_GCSSplitLines)}getGCSHorizon(){return this.m_bIsPannable?this.getGCSHorizonPannable():(null!==this.m_GCSHorizon||this.updateGCSHorizon(),this.m_GCSHorizon)}getGCSHorisonIsInclusive(){return this.m_bIsPannable||this.getGCSHorizon(),this.m_bGCSHorisonIsInclusive}getPCSHorizon(){return this.m_bIsPannable?this.getPCSHorizonPannable():(null!==this.m_PCSHorizon||this.updatePCSHorizon(),this.m_PCSHorizon)}getPole(t){return this.m_bIsPannable||0!==this.m_polesUpdated||this.updatePoles(),t?this.m_southPole:this.m_northPole}getGeogToProjFactors(){return 0===this.m_geogToProjFactorsUpdated&&this.updateGeogToProjFactors(),J(this.m_geogToProjFactor,this.m_geogToProjOffset)}getDomainXY(){if(this.m_bIsPannable)return this.m_domain.clone();let t=!1;return t=this.m_domain.isEmpty(),t&&this.updateDomain(),this.m_domain.clone()}getPrimeMeridian(){return this.m_primeMeridian}getLatestID(){return this.m_WKID}getOldID(){let t=this.m_oldWKID;if(t<0){if(t=0,this.m_WKID>0){const e=[0],n=[0];km(this.m_peCoordSys.getType(),this.m_WKID,e,n)||V("query_code_change"),t=e[0]}this.m_oldWKID=t}return t}isCustomWkid(){return!1}isPannable(){return this.m_bIsPannable}getPannableExtent(){return this.m_pannableExtent.clone()}getPannableExtentGCS(){return this.m_pannableExtentGCS.clone()}getAreaOfUse(){return null!==this.m_areaOfUse?this.m_areaOfUse:this.updateAreaOfUse()}getVcsCode(){return 0}saveMemory(){}getCSType(){return this.m_csType}getUnit(){return this.m_unit}setCached(){this.m_bCached=!0}getCached(){return this.m_bCached}static equal(t,e){return!1}static equal_for_projection(t,e){return!1}}function la(t,e,n,r){return ha(!0,t,e,n,r)}function ha(t,e,n,r,i,s){return new da(2,e,n,r,i,s)}function ga(){return{centralMeridianOfOutputGCS:Number.NaN,densificationStep:Number.NaN,clipWithInputHorizon:!0,clipWithOutputHorizon:!0,legacyHorizonClipping:!1,normalizeResultGeometry:!1,equals(t){return st(this.centralMeridianOfOutputGCS,t.centralMeridianOfOutputGCS)&&st(this.densificationStep,t.densificationStep)&&this.clipWithInputHorizon===t.clipWithInputHorizon&&this.clipWithOutputHorizon===t.clipWithOutputHorizon&&this.legacyHorizonClipping===t.legacyHorizonClipping&&this.normalizeResultGeometry===t.normalizeResultGeometry}}}function _a(){return{flagsMask:0,setFlag(t,e){e?this.flagsMask|=t:this.flagsMask&=~t},hasFlag(t){return!!(this.flagsMask&t)}}}function fa(){return{m_extendedParams:ga(),m_extendedParamsInternal:_a()}}function pa(){return fa()}class da{constructor(t,e,n,r,i,s){let o,a;this.m_datumTran=null,this.m_bIdentity=!0,this.m_bIdentityGeogToGeog=!0,this.m_bVertical=!1,this.m_bNormalize=!1,e&&n||Y("!inputSR || !outputSR"),r&&0===r.getType()&&(r.m_bReadOnly=!0),this.m_bNormalize=!1,1!==t&&(o=e.getVCS(),a=n.getVCS(),this.m_bVertical=null!=o&&null!=a),this.m_inputSR=e,this.m_outputSR=n,this.m_bIdentity=!1,this.m_bIdentityGeogToGeog=!1,X(!this.m_params),i&&(this.m_params=fa(),this.m_params.m_extendedParams=i),s&&(this.m_params||(this.m_params=fa()),this.m_params.m_extendedParamsInternal=s);let m=!1;const c=null!=r,u=e.getCoordinateSystemType(),l=n.getCoordinateSystemType();if(n.isPannable()&&0!==u&&i){const t=i.centralMeridianOfOutputGCS;if(!Number.isNaN(t)&&n.isPannable()){const e=n.getPannableExtent(),r=e.getCenterX();if(r!==t){const n=Math.ceil(e.width());t+n!==r+n&&(m=!0)}}}const h=i&&i.normalizeResultGeometry;if(e.equals(n))return this.m_bIdentity=!m,this.m_bIdentityGeogToGeog=!0,void this.updateProjector();const g=!c&&e.equalForProjection(n,this.m_bVertical);this.m_bIdentity=g&&!m,this.m_bIdentity?this.m_bIdentityGeogToGeog=!0:0!==u&&0!==l&&(h&&this.m_outputSR.isPannable()&&(this.m_bNormalize=h),this.m_datumTran=r||null,this.m_bIdentityGeogToGeog=(!this.m_datumTran||0===this.m_datumTran.count())&&this.m_inputSR.getGCS().equalForProjection(this.m_outputSR.getGCS(),this.m_bVertical)),this.updateProjector()}getInputSR(){return this.m_inputSR}getOutputSR(){return this.m_outputSR}getDatumTransformation(){return this.m_datumTran}getInverse(){const t=new da(1,this.m_outputSR,this.m_inputSR,this.m_datumTran?.createInverse());return t.m_bIdentity=this.m_bIdentity,t.m_bVertical=this.m_bVertical,t.m_bIdentityGeogToGeog=this.m_bIdentityGeogToGeog,t.updateProjector(),t}isIdentity(){return this.m_bIdentity}getExtendedParams(){return this.m_params?this.m_params.m_extendedParams:pa().m_extendedParams}equals(t){return X(0),!1}isVertical(){return this.m_bVertical}isMatchingTransformation(t,e){return X(0),!1}getGeographicTransformations(){return this.m_datumTran}getExtendedParamsImpl(){return this.m_params?this.m_params.m_extendedParams:pa().m_extendedParams}getExtendedParamsInternal(){return this.m_params?this.m_params.m_extendedParamsInternal:pa().m_extendedParamsInternal}isIdentityGeogToGeog(){return this.m_bIdentityGeogToGeog}normalizeOutput(){return this.m_bNormalize}updateProjector(){this.m_projector=new qi(this)}}const ya=new Map,Pa=new Map,xa=new Map;function Ca(t){let e=t.getCode();if(e>0){const t=Ma(e);return t||Na(Nm.coordsys(e))}const n=t.getName();if(Pa.has(n)){const e=Pa.get(n);if(e&&e.deref()){const n=e.deref();if(n.m_peCoordSys.isEqual(t))return n}}return e=Nm.getCode(t),Na(e>0?Nm.coordsys(e):t)}function Ea(t){t<=0&&B(t);{const e=Ma(t);if(e)return e}const e=Um(Nm.coordsys(t));e.get()||B(t);const n=Na(e.release());return n.getLatestID()!==t&&ya.set(t,new WeakRef(n)),n}function Sa(t){const e=Um(Nm.fromString(Mm.PE_TYPE_COORDSYS,t));return e.get()||Z(t),Ca(e.release())}function wa(t){Pa.delete(t.m_peCoordSys.getName()),xa.delete(Ls(t.m_peCoordSys,0,!1))}let ba;function Ta(){return ba||(ba=Nm.unit(9001)),ba}function va(t){return null!==Um(Nm.coordsys(t)).get()}const Ia=new Map;function Da(t){if(Ia.has(t))return Ia.get(t);{const e=va(t);return Ia.set(t,e),e}}function Ga(t){return!1}function Na(t){const e=Um(t),n=t.getCode();if(n>0){const t=Ma(n);if(t)return t}const r=t.getName();let i=Pa.get(r);if(i){const e=i.deref();if(e&&e.m_peCoordSys.isEqual(t))return e}const s=new ua(e.release());if(n>0)return s.setCached(),ya.set(n,new WeakRef(s)),Pa.set(r,new WeakRef(s)),s;const o=Ls(t,0,!1);if(i=xa.get(o),i){const t=i.deref();if(t)return t}return s.setCached(),xa.set(o,new WeakRef(s)),s}function Ma(t){const e=ya.get(t);if(e)return e.deref()}class Aa extends Jt{constructor(t){return void 0===t?(super(),this.m_wkid=9001,void(this.m_peUnit=null)):"number"==typeof t?(super(),this.m_factor=t,void(this.m_wkid=0)):(super(t),void(t||(this.m_factor=1,this.m_wkid=9001,this.m_peUnit=Ta())))}getUnitType(){return 0}convertFromMeters(t){return t/this.getUnitToBaseFactor()}convertToMeters(t){return t*this.getUnitToBaseFactor()}}const qa=["0","1","2","3","4","5","6","7","8","9","b","c","d","e","f","g","h","j","k","m","n","p","q","r","s","t","u","v","w","x","y","z"];function Ya(t,e,n){const r=ut(e,"R");let i=0,s=0;for(let o=0;o<e;o++){let n=t[i]>>s&31;if(s+=5,s>31){const e=37-s;n&=(1<<e)-1,s-=32,i++,n|=(t[i]&(1<<s)-1)<<e}const a=qa[n];r[e-1-o]=a}return n>e?r.push(..."0".repeat(n-e)):n<e&&(r.length=n),r.join("")}function Xa(t,e,n,r,i){X(r>>5<i.length);let s=e,o=n;for(let a=r;a>=0;a-=2){const e=31&a,n=.5*(o+s);t>=n?(i[a>>5]|=1<<e,s=n):o=n}}let Ra=new Set;const Fa=2147483645n,Oa=9007199254740990n,La="operation is not supported for unknown coordinate systems";var Ua;function Ha(){return{majorSemiAxis:0,e2:0,minorSemiAxis:0,flattening:0,isSphere(){return 0===this.e2}}}function za(t,e,n){t.majorSemiAxis=e,t.minorSemiAxis=e*(1-n),t.e2=n*(2-n),t.flattening=n}function Va(t){if(Nm)return;jm(t);const e=Ra;Ra=null,e.forEach((t=>{const e=t.deref();e&&e.attachToPe()}))}function ja(t){Vm(t)}function ka(){return!!Nm}function Ba(){return!!Hm}function Za(){return!!Nm||!!Hm}function Ka(t,e,n){return X(Za()),Em(t,void 0===e?0:e,null,!1)}function Wa(t,e){X(Za());const n=new gm;let r;return ka()?(r=Sa(t),n.setHorzProj_(r),n.m_vertcs=null,n.m_userWKID=r.getLatestID()):(r=zm(t),n.m_unit=r.isPCS?new Aa(r.metersOrRadiansPerUnit):new ee(r.metersOrRadiansPerUnit)),Pm(n.m_precisionDescriptor,r,null,1),n.m_bDefaultDescriptor=!0,n.m_userWKT=t,n.calculateHashCode(),n.initDbgName(),n}function Qa(t,e,n,r,i=!0){let s=null;return e&&(s=Ds(e,i)),Ja(t,s,n,r,i)}function Ja(t,e,n,r,i){t||Y("!PE_coord_sys");const s=new gm;let o;return o=i?Ca(t):new ua(t,!1),Pm(s.m_precisionDescriptor,o,e,r),s.m_bDefaultDescriptor=!0,s.setHorzProj_(o),s.m_vertcs=e,s.m_userWKID=o.getLatestID(),s.calculateHashCode(),s.initDbgName(),s}function $a(t,e,n=!1){3===t.getCoordinateSystemType()&&Y("image spatial reference cannot be altered");const r=new gm,i=t;return r.m_peCoordSysVal=i.m_peCoordSysVal,r.m_vertcs=i.m_vertcs,r.m_unit=i.m_unit,r.m_precisionDescriptor.assign(e),r.m_localZToXYFactor=i.m_localZToXYFactor,(Number.isNaN(r.m_precisionDescriptor.m_falseX)||Number.isNaN(r.m_precisionDescriptor.m_falseY))&&(r.m_precisionDescriptor.m_falseX=i.m_precisionDescriptor.m_falseX,r.m_precisionDescriptor.m_falseY=i.m_precisionDescriptor.m_falseY),r.m_precisionDescriptor.snapPrecision(),r.m_precisionDescriptor.fixTolerance(),r.m_userWKID=i.m_userWKID,r.m_precisionDescriptor.equals(i.m_precisionDescriptor)?r.m_bDefaultDescriptor=i.m_bDefaultDescriptor:r.m_bDefaultDescriptor=!1,n&&(r.m_bDefaultDescriptor=!0),r.calculateHashCode(),r.initDbgName(),r}function tm(t,e,n){void 0===e&&(e=1),(e<=0||!Number.isFinite(e))&&Y(""),t||1===e||Y("null Unit has to have z_to_xy_factor equal to 1");const r=new gm;r.m_unit=t;const i=t||new Aa(9001);return void 0===n?(Cm(r.m_precisionDescriptor,i,null,1),r.m_bDefaultDescriptor=!0):(r.m_precisionDescriptor.assign(n),r.m_precisionDescriptor.fixTolerance(),r.m_bDefaultDescriptor=!1),Number.isNaN(r.m_precisionDescriptor.m_falseX)&&Y("NAN false X/Y are not allowed here"),r.m_localZToXYFactor=e,r.calculateHashCode(),r.initDbgName(),r}function em(t,e){return t.snapGeometry(e)}function nm(t){const e=t.getCoordinateSystemType();return 1===e?t:(3===e&&X(0),t.getGCS())}function rm(t){return X(Za()),Ba()?Bm(t):Da(t)}function im(t){return null!==Um(Nm.fromString(Mm.PE_TYPE_COORDSYS,t)).get()}let sm;function om(){return sm||(sm=(()=>{const t=Math.trunc(Math.random()*bt()),e=Date.now();return`|abba_000|${t.toString(16)}|${e.toString(16)}|`})()),sm}!function(t){t[t.utmDefault=0]="utmDefault",t[t.utmNorthSouth=1]="utmNorthSouth"}(Ua||(Ua={}));let am=0;function mm(t=""){let e=`${om()}${am++}`;return""!==t&&(e+=`|${t}`),e}function cm(t){return t.startsWith(om())}let um,lm,hm,gm=class t{destroy(){wa(this.m_peCoordSysVal),1===this.getCoordinateSystemType()||2===this.getCoordinateSystemType()?this.getPECoordSys().destroy():V("SpatialReference.destroy")}constructor(){this.m_vertcs=null,this.m_peCoordSysVal=null,this.m_userWKID=0,this.m_userWKT=null,this.m_geogSpatialReference=null,this.m_srToGcs=null,this.m_gcsToSr=null,this.m_defaultPrecisionSR=null,this.m_localZToXYFactor=-1,this.m_precisionDescriptor=new _m,this.m_hashCode=0,this.m_bDefaultDescriptor=!1,ym(this.m_precisionDescriptor),Ra&&Ra.add(new WeakRef(this))}attachToPe(){(this.m_userWKID>0?Ka(this.m_userWKID):Wa(this.m_userWKT)).copyTo(this,!1)}copyTo(t,e=!0){(e||t.m_bDefaultDescriptor)&&(t.m_bDefaultDescriptor=this.m_bDefaultDescriptor,t.m_precisionDescriptor.assign(this.m_precisionDescriptor)),t.m_defaultPrecisionSR=null,t.m_gcsToSr=this.m_gcsToSr,t.m_geogSpatialReference=this.m_geogSpatialReference,t.m_hashCode=this.m_hashCode,t.m_localZToXYFactor=this.m_localZToXYFactor,t.m_peCoordSysVal=this.m_peCoordSysVal,t.m_srToGcs=this.m_srToGcs,t.m_userWKID=this.m_userWKID,t.m_userWKT=this.m_userWKT,t.m_vertcs=this.m_vertcs,t.m_unit=this.m_unit}getHashCode(){return this.m_hashCode}getHashCodeHorizontal(){let t=0;return t=this.m_peCoordSysVal?this.m_peCoordSysVal.getHashCode():this.m_unit?this.m_unit.getHashCode():305419891,t}updateTransform(t){if(1===this.getCoordinateSystemType())return la(this,this,null);let e=t?this.m_srToGcs:this.m_gcsToSr;if(e)return e;const n=this.getGCS(),r=this;e=t?la(r,n,null):la(n,r,null);const i=e,s=t?this.m_srToGcs:this.m_gcsToSr;return s||(t?this.m_srToGcs=i:this.m_gcsToSr=i,e)}getHashCodeVertical(){return this.m_vertcs?this.m_vertcs.getHashCode():0}calculateHashCode(){let t=this.getHashCodeHorizontal();const e=this.getHashCodeVertical(),n=this.m_precisionDescriptor.getHashCode();t=K(t,e),this.m_hashCode=K(t,n)}initDbgName(){}setHorzProj_(t){this.m_peCoordSysVal=t,this.m_unit=this.m_peCoordSysVal.getUnit()}getTolerance(t=0){return this.m_precisionDescriptor.getTolerance(t)}getResolution(t=0){return this.m_precisionDescriptor.getResolution(t)}getPECoordSys(){return this.m_peCoordSysVal?this.m_peCoordSysVal.m_peCoordSys:null}getPCSInfo(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPCSInfo()}getCentralMeridian(){if(this.throwIfNotGCSOrPCS(),1===this.getCoordinateSystemType())return 0;return this.getPCSInfo().getCentralMeridian()}getCoordinateSystemType(){const t=this.getPECoordSys();if(t){switch(t.getType()){case Mm.PE_TYPE_GEOGCS:return 1;case Mm.PE_TYPE_PROJCS:return 2;default:return 0}}else{if((this.m_userWKID>0||this.m_userWKT)&&this.m_unit instanceof Aa)return 2;if(this.m_unit instanceof ee)return 1}return 0}getID(){return this.m_userWKID}getLatestID(){return this.m_peCoordSysVal?this.m_peCoordSysVal.getLatestID():this.m_userWKID}getOldID(){return this.m_peCoordSysVal?this.m_peCoordSysVal.getOldID():this.m_userWKID}getVerticalID(){return H("vcs not implemented"),0}getLatestVerticalID(){return this.m_vertcs?this.m_vertcs.getLatestID():0}getOldVerticalID(){return H("vcs not implemented"),0}getPEVerticalCoordSys(){return null}getPole(t){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPole(t)}getText(){const t=this.getPECoordSys();return t?Hs(t):this.m_userWKT??""}getTextExtended(t){const e=this.getPECoordSys();return e?this.getPEVerticalCoordSys()?Us(null,e,this.getPEVerticalCoordSys()):Hs(e,t):this.m_userWKT??""}getText2(t=-1){const e=this.getPECoordSys();return e?zs(e,t):this.m_userWKT??""}getUnit(){return this.m_unit}getUnitsPerMillimeter(){return this.m_peCoordSysVal?this.m_peCoordSysVal.getUnitsPerMillimeter():this.m_unit instanceof Aa?.001/this.m_unit.getUnitToBaseFactor():this.m_unit instanceof ee?.001/(zm(this.m_userWKT??this.m_userWKID).semiMajor*this.m_unit.getUnitToBaseFactor()):(k("sr object not in valid state"),0)}getAuthorityName(){return this.getPECoordSys()?Vs():""}getVerticalUnit(){return H("vcs not implemented"),{}}getVCS(){return this.m_vertcs}hasVCS(){return!1}getGCSHorisonIsInclusive(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSHorisonIsInclusive()}getGCSHorizon(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSHorizon()}getGCS(){const t=this.getCoordinateSystemType();if(0===t)k(La);else{if(1===t)return this;3===t&&k("image cs not supported")}if(this.m_geogSpatialReference)return this.m_geogSpatialReference;let e;if(this===fm()||this===pm())e=dm();else{X(this.m_peCoordSysVal);const t=this.m_peCoordSysVal.m_peCoordSys.getGeogcs();t||V(""),e=Qa(t,this.m_vertcs,null,this.m_precisionDescriptor.getPrecision(),this.m_peCoordSysVal.getCached())}return this.m_geogSpatialReference?e=this.m_geogSpatialReference:this.m_geogSpatialReference=e,e}getGCSSplitLines(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSSplitLines()}toGCS(t,e){if(0===t.length)return 0;t.length>e.length&&Y("coordsSrc.size() > coordsDst.size()");const n=this.getCoordinateSystemType();if(0===n&&k(La),1===n)return it(e,t,t.length),t.length;X(this.m_peCoordSysVal);const r=this.getSRToGCSTransform();return(new Ri).transform(r,t,t.length,e)}toGeohash(t,e=8){const n=t.clone();n.scale(9102===this.getGCS().getUnit().getID()?1:this.getGCS().getUnit().getUnitToBaseFactor()/Math.PI*180),n.x<-180?(n.x=rt(n.x,360),n.x<-180&&(n.x+=360)):n.x>180&&(n.x=rt(n.x,360),n.x>180&&(n.x-=360)),n.y>90&&(n.y=90),n.y<-90&&(n.y=-90);const r=5*e,i=new Uint32Array(4);Xa(n.x,-180,180,r-1,i),Xa(n.y,-90,90,r-2,i);return Ya(i,e,e)}isPannable(){const t=this.getCoordinateSystemType();return 0!==t&&3!==t&&(X(this.m_peCoordSysVal),this.m_peCoordSysVal.isPannable())}getPannableExtent(){return this.isPannable()||Y("!is_pannable"),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPannableExtent()}getPannableExtentInGCS(){return this.isPannable()||Y("!is_pannable"),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPannableExtentGCS()}throwIfNotGCSOrPCS(){const t=this.getCoordinateSystemType();1!==t&&2!==t&&Y("Not a GCS or PCS")}getDomainXY(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getDomainXY()}getFullWorldExtent(){return this.throwIfNotGCSOrPCS(),this.isPannable()?this.getPannableExtent():this.getDomainXY()}queryPrecisionDescriptor(t){if(t.assign(this.m_precisionDescriptor),Number.isNaN(t.m_falseX))if(ka()||k("projection engine is not loaded"),X(null!==this.m_peCoordSysVal),2!==this.m_precisionDescriptor.m_precision){const e=this.m_peCoordSysVal.getDomainXY();t.m_falseX=e.xmin,t.m_falseY=e.ymin}else t.m_falseX=-Number.MAX_VALUE,t.m_falseY=-Number.MAX_VALUE}queryPrecisionDescriptorWithoutFalseXY(t){t.assign(this.m_precisionDescriptor),t.m_falseX=Number.NaN,t.m_falseY=Number.NaN}queryDefaultPrecisionDescriptorWithoutFalseXY(t){if(this.m_bDefaultDescriptor)t.assign(this.m_precisionDescriptor);else{const e=this.getCoordinateSystemType();0===e?Cm(t,this.m_unit,this.m_vertcs,this.m_precisionDescriptor.getPrecision()):3===e?H("image cs"):Pm(t,this.m_peCoordSysVal,this.m_vertcs,this.m_precisionDescriptor.getPrecision())}t.m_falseX=Number.NaN,t.m_falseY=Number.NaN}horizontalEqual(t){return ma(this.m_peCoordSysVal,t.m_peCoordSysVal)}verticalEqual(t){return null!==this.m_vertcs==(null!==t.m_vertcs)&&(!this.m_vertcs||this.m_vertcs.equals(t.m_vertcs))}equals(t){const e=t;if(this===e)return!0;if(!this.horizontalEqual(e)||!this.verticalEqual(e))return!1;if(!e.m_peCoordSysVal){if(X(!this.m_peCoordSysVal),null!==this.m_unit!=(null!==e.m_unit))return!1;if(this.m_unit&&!this.m_unit.equals(e.m_unit))return!1;if(this.m_localZToXYFactor!==e.m_localZToXYFactor)return!1}if(!this.m_bDefaultDescriptor||!e.m_bDefaultDescriptor){if(this.m_peCoordSysVal){if(!this.m_precisionDescriptor.equalsWithoutFalseXY(e.m_precisionDescriptor))return!1;X(e.m_peCoordSysVal);let t=this.m_precisionDescriptor.m_falseX,n=this.m_precisionDescriptor.m_falseY;if(Number.isNaN(t)){const e=this.m_peCoordSysVal.getDomainXY();t=e.xmin,n=e.ymin}let r=e.m_precisionDescriptor.m_falseX,i=e.m_precisionDescriptor.m_falseY;if(Number.isNaN(r)){const t=e.m_peCoordSysVal.getDomainXY();r=t.xmin,i=t.ymin}return t===r&&n===i}return this.m_precisionDescriptor.equals(e.m_precisionDescriptor)}return!0}equalForProjection(t,e){if(this===t)return!0;const n=this.getCoordinateSystemType(),r=t.getCoordinateSystemType();if(0===n||0===r)return 0===n&&0===r?(!e||this.getZToXYFactor()===t.getZToXYFactor())&&(!this.getUnit()||!t.getUnit()||this.getUnit().equals(t.getUnit())):3!==n&&3!==r&&(null===this.getUnit()||null===t.getUnit()||(!e||this.getZToXYFactor()===t.getZToXYFactor())&&this.getUnit().equals(t.getUnit()));if(n!==r)return!1;if(3===n)return this.equals(t);if(ca(this.m_peCoordSysVal,t.m_peCoordSysVal)){if(!e)return!0;if(null!==this.m_vertcs==(null!==t.m_vertcs))return!this.m_vertcs||this.m_vertcs.equalForProjection(t.m_vertcs)}return!1}equalHorizontal(t){return this.horizontalEqual(t)}equalVertical(t){return X(0),!1}equalVerticalVCS(t){return X(0),!1}convergenceAngle(t){return X(0),0}getPeCoordsysCopy(){if(this.m_peCoordSysVal){const t=this.m_peCoordSysVal.m_peCoordSys;return t||V("cannot clone coord sys"),t}return null}getPeVertcsCopy(){return X(0),0}throwIfLocal(){0===this.getCoordinateSystemType()&&Y(La)}getPrimeMeridian(){return this.throwIfLocal(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPrimeMeridian()}getSRToGCSTransform(){return this.updateTransform(!0)}getGCSToSRTransform(){return this.updateTransform(!1)}getOneMeter(){return 1e3*this.getUnitsPerMillimeter()}getOneMeterPCSUnit(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getOneMeterPCSUnit()}getDefaultPrecisionSR(){if(this.m_bDefaultDescriptor)return this;if(null===this.m_defaultPrecisionSR){const t=new _m;this.queryDefaultPrecisionDescriptorWithoutFalseXY(t),this.m_defaultPrecisionSR=$a(this,t,!0)}return this.m_defaultPrecisionSR}getPCSHorizon(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getPCSHorizon()}getHorzUnitFactor(){return this.m_unit?this.m_unit.getUnitToBaseFactor():1}querySpheroidData(t){this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal);const e=this.getGCS().getPECoordSys().getDatum().getSpheroid(),n=e.getFlattening();za(t,e.getAxis(),n)}getAreaOfUse(){0===this.getCoordinateSystemType()&&k(""),X(this.m_peCoordSysVal);const t=this.m_peCoordSysVal.getAreaOfUse();return null===t?new Qt:new Qt({geom:t.clone(),sr:Ka(4326)})}getZToXYFactor(){return 1}isCustomWkid(){return!1}getOneDegreeGCSUnit(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getOneDegreeGCSUnit()}getGcsUnitFactor(){return this.throwIfNotGCSOrPCS(),X(this.m_peCoordSysVal),this.m_peCoordSysVal.getGcsUnitFactor()}snapGeometry(t){if(t.isEmpty())return!1;if(2===this.m_precisionDescriptor.getPrecision())return!1;const e=t.getGeometryType();if(z(e))return this.snapMultiVertex_(t);if(e===L.enumPoint)return this.snapPoint_(t);if(e===L.enumEnvelope)return this.snapEnvelope_(t);if(U(e))return this.snapSegment_(t);if(e===L.enumGeometryCollection){const e=t;let n=!1;for(let t=0,r=e.getGeometryCount();t<r;++t)n=this.snapGeometry(e.getGeometry(t))||n;return n}V("what else?")}snapMultiVertex_(t){if(X(!t.isEmpty()),X(2!==this.m_precisionDescriptor.getPrecision()),j(t.getGeometryType())){const e=t;if(e.hasNonLinearSegments())return this.snapGeometryWithCurves_(e)}const e=t.getImpl(),n=e.getDescription();let r=!1;for(let i=0,s=n.getAttributeCount();i<s;i++){const t=n.getSemantics(i),s=e.getAttributeStreamRef(t);r=this.snapAttributes(t,s,0,e.getPointCount())||r}return r&&e.notifyModifiedFlags(2001),r}snapPoint_(t){return!1}snapEnvelope_(t){return!1}snapSegment_(t){X(!t.isEmpty()),X(2!==this.m_precisionDescriptor.getPrecision());const e=new _m;this.queryPrecisionDescriptor(e);const n=t.getStartXY(),r=new Q;r.x=Sm(n.x,e.getFalseX(),e.getGridUnitsXY()),r.y=Sm(n.y,e.getFalseY(),e.getGridUnitsXY());let i=!r.equals(n);const s=t.getEndXY(),o=new Q;o.x=Sm(s.x,e.getFalseX(),e.getGridUnitsXY()),o.y=Sm(s.y,e.getFalseY(),e.getGridUnitsXY()),i||=!o.equals(s),i&&t.changeEndPoints2D(r,o);const a=(e,n,r)=>{let i=!1;{const s=t.getStartAttributeAsDbl(e,0),o=Sm(s,n,r),a=!st(o,s);i||=a,a&&t.setStartAttribute(e,0,o)}{const s=t.getEndAttributeAsDbl(e,0),o=Sm(s,n,r),a=!st(o,s);i||=a,a&&t.setEndAttribute(e,0,o)}return i};let m=i?1:0;return t.hasAttribute(1)&&(m|=a(1,e.getFalseZ(),e.getGridUnitsZ())?1:0),t.hasAttribute(2)&&(m|=a(2,e.getFalseM(),e.getGridUnitsM())?1:0),!!m}snapGeometryWithCurves_(t){X(!t.isEmpty()),X(2!==this.m_precisionDescriptor.getPrecision());const e=t.createInstance(),n=new o;let r=0;for(let s=0,o=t.getPathCount();s<o;++s){const o=t.getSegmentCountPath(s);if(0===o){if(e.addPath(t,s,!0),1===e.getPathSize(s)){const t=new i;e.getPointByVal(e.getPointCount()-1,t),r|=this.snapGeometry(t)?1:0,e.setPointByVal(e.getPointCount()-1,t)}continue}const a=t.isClosedPath(s);for(let i=0,m=a?o-1:o;i<m;++i)t.getSegmentFromPath(s,i,n,!1),r|=this.snapGeometry(n.get())?1:0,e.addSegment(n.get(),0===i);a&&(t.getSegmentFromPath(s,o-1,n,!1),r|=this.snapGeometry(n.get())?1:0,1===o?e.addPathFromClosedSegment(n.get(),!1):e.closeLastPathWithSegment(n.get()))}return r&&e.copyTo(t),!!r}snapAttributes(e,n,r,i){let s=!1;const o=new _m;if(this.queryPrecisionDescriptor(o),0===e){const e=n;for(let n=r;n<i;n++){const r=e.read(2*n),i=t.s_SnapValue(r,o.getFalseX(),o.getGridUnitsXY()),a=e.read(2*n+1),m=t.s_SnapValue(a,o.getFalseY(),o.getGridUnitsXY());s=s||i!==r||m!==a,s&&(e.write(2*n,i),e.write(2*n+1,m))}}else if(1===e){const e=n;for(let n=r;n<i;n++){const r=e.read(n),i=t.s_SnapValue(r,o.getFalseZ(),o.getGridUnitsZ());s=s||!st(i,r),s&&e.write(n,i)}}else if(2===e){const e=n;for(let n=r;n<i;n++){const r=e.read(n),i=t.s_SnapValue(r,o.getFalseM(),o.getGridUnitsM());s=s||!st(i,r),s&&e.write(n,i)}}return s}static s_SnapValue(t,e,n){return ot((t-e)*n)/n+e}};class _m{constructor(){const t=Oa,e=1e-4,n=.001,r=e*Number(t)*.5;this.m_precision=1,this.m_falseX=-r,this.m_falseY=-r,this.m_unitsXY=Number(t)/(2*r),this.m_falseM=-1e5,this.m_unitsM=1/e,this.m_falseZ=-1e5,this.m_unitsZ=1/e,this.m_toleranceXY=n,this.m_toleranceM=n,this.m_toleranceZ=n}getHashCode(){let t=7777,e=7777;return e=K(e,this.m_falseM),e=K(e,this.m_unitsM),t=K(t,this.m_unitsXY),e=K(e,this.m_toleranceXY),t=K(t,this.m_falseZ),e=K(e,this.m_toleranceZ),t=K(t,this.m_unitsZ),e=K(e,this.m_toleranceM),t=K(t,this.m_precision),K(t,e)}clone(){const t=new _m;return t.m_falseX=this.m_falseX,t.m_falseY=this.m_falseY,t.m_unitsXY=this.m_unitsXY,t.m_falseZ=this.m_falseZ,t.m_unitsZ=this.m_unitsZ,t.m_falseM=this.m_falseM,t.m_unitsM=this.m_unitsM,t.m_toleranceXY=this.m_toleranceXY,t.m_toleranceZ=this.m_toleranceZ,t.m_toleranceM=this.m_toleranceM,t.m_precision=this.m_precision,t}assign(t){return this.m_falseX=t.m_falseX,this.m_falseY=t.m_falseY,this.m_unitsXY=t.m_unitsXY,this.m_falseZ=t.m_falseZ,this.m_unitsZ=t.m_unitsZ,this.m_falseM=t.m_falseM,this.m_unitsM=t.m_unitsM,this.m_toleranceXY=t.m_toleranceXY,this.m_toleranceZ=t.m_toleranceZ,this.m_toleranceM=t.m_toleranceM,this.m_precision=t.m_precision,this}initialize2D(t,e){}getTolerance(t){switch(t){case 0:return this.m_toleranceXY;case 1:return this.m_toleranceZ;case 2:return this.m_toleranceM;default:return 0}}getResolution(t){if(2===this.m_precision)return 0;switch(t){case 0:return 1/this.m_unitsXY;case 1:return 1/this.m_unitsZ;case 2:return 1/this.m_unitsM;default:return 0}}getFalseX(){return this.m_falseX}getFalseY(){return this.m_falseY}getFalseZ(){return this.m_falseZ}getFalseM(){return this.m_falseM}getGridUnitsXY(){return this.m_unitsXY}getGridUnitsZ(){return this.m_unitsZ}getGridUnitsM(){return this.m_unitsM}getPrecision(){return this.m_precision}static getLimit32(){return 2147483645}static getLimit64(){return 9007199254740990n}static getLimitFloat(){return 0}getXYGridRange(){const t=new r;switch(this.m_precision){case 0:{const e=_m.getLimit32()/this.getGridUnitsXY();t.setCoords({xmin:this.getFalseX(),ymin:this.getFalseY(),xmax:this.getFalseX()+e,ymax:this.getFalseY()+e})}break;case 1:{const e=Number(_m.getLimit64())/this.getGridUnitsXY();t.setCoords({xmin:this.getFalseX(),ymin:this.getFalseY(),xmax:this.getFalseX()+e,ymax:this.getFalseY()+e})}break;case 2:t.setCoords({xmin:-Number.MAX_VALUE,ymin:-Number.MAX_VALUE,xmax:Number.MAX_VALUE,ymax:Number.MAX_VALUE});break;default:t.setEmpty(),V("")}return t}getZGridRange(){const t=new et;switch(this.m_precision){case 0:{const e=_m.getLimit32()/this.getGridUnitsZ();t.setCoords(this.getFalseZ(),this.getFalseZ()+e)}break;case 1:{const e=Number(_m.getLimit64())/this.getGridUnitsZ();t.setCoords(this.getFalseZ(),this.getFalseZ()+e)}break;case 2:t.setCoords(-Number.MAX_VALUE,Number.MAX_VALUE);break;default:t.setEmpty(),V("")}return t}getMGridRange(){const t=new et;switch(this.m_precision){case 0:{const e=_m.getLimit32()/this.getGridUnitsM();t.setCoords(this.getFalseM(),this.getFalseM()+e)}break;case 1:{const e=Number(_m.getLimit64())/this.getGridUnitsM();t.setCoords(this.getFalseM(),this.getFalseM()+e)}break;case 2:t.setCoords(-Number.MAX_VALUE,Number.MAX_VALUE);break;default:t.setEmpty(),V("")}return t}setTolerance(t,e){switch(e<0&&Y("tol < 0"),Number.isFinite(e)||Y("tol is not finite"),t){case 0:this.m_toleranceXY=e;break;case 1:this.m_toleranceZ=e;break;case 2:this.m_toleranceM=e;break;default:Y("cannot set tolerance for this attribute")}}setGridParams(t,e,n){Number.isFinite(t)&&Number.isFinite(e)&&Number.isFinite(n)||Y("grid params are not finite"),n<1&&Y("grid units cannot be smaller than 1.0"),this.m_falseX=t,this.m_falseY=e,this.m_unitsXY=n}setZParams(t,e){Number.isFinite(t)&&Number.isFinite(e)||Y("grid params are not finite"),e<1&&Y("grid units cannot be smaller than 1.0"),this.m_falseZ=t,this.m_unitsZ=e}setMParams(t,e){Number.isFinite(t)&&Number.isFinite(e)||Y("grid params are not finite"),e<1&&Y("grid units cannot be smaller than 1.0"),this.m_falseM=t,this.m_unitsM=e}setPrecision(t){}equals(t){return this===t||st(this.m_falseX,t.m_falseX)&&st(this.m_falseY,t.m_falseY)&&this.equalsWithoutFalseXY(t)}snapPrecision(){if(2===this.m_precision)return;const t=(t,e,n,r)=>{if(!Number.isFinite(e)||!Number.isFinite(n))return n;if(n<1)return 1;if(!r)return n;const i=Number(t)/n;return Math.trunc((e+i-e)*n)>t&&(n=t/(e+i-e)),Math.max(1,n)},e=Number(0===this.m_precision?Fa:Oa);this.m_unitsXY=t(e,this.m_falseX,this.m_unitsXY,!0),this.m_unitsXY=t(e,this.m_falseY,this.m_unitsXY,!0),this.m_unitsZ=t(e,this.m_falseZ,this.m_unitsZ,!1),this.m_unitsM=t(e,this.m_falseM,this.m_unitsM,!1)}verifyPrecision(){if(2===this.m_precision)return!0;const t=(t,e,n,r)=>{if(n<1)return!1;if(!Number.isFinite(e)||!Number.isFinite(n))return!1;if(!r)return!0;const i=Number(t)/n;return!(BigInt((e+i-e)*n)>t)},e=0===this.m_precision?Fa:Oa;return!!t(e,this.m_falseX,this.m_unitsXY,!0)&&(!!t(e,this.m_falseY,this.m_unitsXY,!0)&&(!!t(e,this.m_falseZ,this.m_unitsZ,!1)&&!!t(e,this.m_falseM,this.m_unitsM,!1)))}fixTolerance(){2!==this.m_precision&&(this.m_toleranceXY=Math.max(2/this.m_unitsXY,this.m_toleranceXY),this.m_toleranceZ=Math.max(2/this.m_unitsZ,this.m_toleranceZ),this.m_toleranceM=Math.max(2/this.m_unitsM,this.m_toleranceM),(Number.isNaN(this.m_falseX)||Number.isNaN(this.m_falseY))&&(this.m_falseX=this.m_falseY=Number.NaN))}equalsWithoutFalseXY(t){return this===t||this.m_unitsXY===t.m_unitsXY&&this.m_falseZ===t.m_falseZ&&this.m_unitsZ===t.m_unitsZ&&this.m_falseM===t.m_falseM&&this.m_unitsM===t.m_unitsM&&this.m_toleranceXY===t.m_toleranceXY&&this.m_toleranceZ===t.m_toleranceZ&&this.m_toleranceM===t.m_toleranceM&&this.m_precision===t.m_precision}setBestXyDomainFromEnvelope(t,e){}setBestZDomainFromZRange(t,e,n){}setBestMDomainFromMRange(t,e,n){}}function fm(){return um||(um=Em(3857,0,null,!0)),um}function pm(){return lm||(lm=Em(102100,0,null,!0)),lm}function dm(){return hm||(hm=Em(4326,0,null,!0)),hm}function ym(t){t.m_falseX=0,t.m_falseY=0,t.m_unitsXY=1,t.m_falseZ=0,t.m_unitsZ=1,t.m_falseM=0,t.m_unitsM=1,t.m_toleranceXY=100*at(),t.m_toleranceZ=100*at(),t.m_toleranceM=100*at(),t.m_precision=2}function Pm(t,e,n,r){const i=e instanceof ua;ym(t),t.m_precision=r,t.m_falseX=Number.NaN,t.m_falseY=Number.NaN;const s=1e-4,o=.001,a=i?e.m_csType:e.isPCS?2:1;if(1===a){const n=(0===r?1/18e5:1e-9)*(i?e.getOneDegreeGCSUnit():Math.PI/e.metersOrRadiansPerUnit/180);t.m_unitsXY=1/n}else if(2===a){const n=(0===r?o:s)*(i?e.getOneMeterPCSUnit():1/e.metersOrRadiansPerUnit);t.m_unitsXY=1/n}else Y("unrecognized cs type");t.m_falseM=-1e5,t.m_unitsM=1/(0===r?o:s),t.m_unitsM=Math.max(1,t.m_unitsM),t.m_unitsXY=Math.max(1,t.m_unitsXY);let m=0,c=0;0!==r&&1!==r||(m=2/t.m_unitsXY,c=2/t.m_unitsM),t.m_toleranceXY=Math.max(m,i?e.getUnitsPerMillimeter():2===a?.001/e.metersOrRadiansPerUnit:.001/(e.semiMajor*e.metersOrRadiansPerUnit)),t.m_toleranceM=Math.max(o,c),xm(t,n)}function xm(t,e){const n=1e-4,r=.001;if(t.m_falseZ=-1e5,e){const i=(0===t.m_precision?r:n)*e.getOneMeter();t.m_unitsZ=1/i}else t.m_unitsZ=1/(0===t.m_precision?r:n);t.m_unitsZ=Math.max(1,t.m_unitsZ);let i=0;0!==t.m_precision&&1!==t.m_precision||(i=2/t.m_unitsZ),t.m_toleranceZ=Math.max(e?e.getOneMeter()*r:r,i)}function Cm(t,e,n,r){ym(t),t.m_precision=r;const i=0===r?Fa:Oa,s=1e-4,o=.001;let a=1,m=1,c=.001;e&&(m=e.getUnitToBaseFactor()),e&&1===e.getUnitType()?(a=400*Math.PI/180,c=8.983152841195215e-9*Math.PI/180/m):(a=(0===r?o:s)*Number(i)*.5,c=o/m),a/=m,t.m_falseX=-a,t.m_falseY=-a,t.m_unitsXY=Number(i)/(2*a),t.m_falseM=-1e5,t.m_unitsM=1/(0===r?o:s),t.m_unitsM=Math.max(1,t.m_unitsM),t.snapPrecision();let u=0,l=0;0!==t.m_precision&&1!==t.m_precision||(l=2/t.m_unitsM,u=2/t.m_unitsXY),t.m_toleranceXY=Math.max(u,c),t.m_toleranceM=Math.max(o,l),xm(t,n)}function Em(t,e,n,r){if(!r&&e<=0&&!n){if(3857===t)return fm();if(102100===t)return pm();if(4326===t)return dm()}const i=new gm;let s,o=null;return ka()?(s=Ea(t),e<=0&&Gs()&&(e=t),e>0?o=null:e=0,i.setHorzProj_(s),i.m_vertcs=o):(s=zm(t),i.m_unit=s.isPCS?new Aa(s.metersOrRadiansPerUnit):new ee(s.metersOrRadiansPerUnit)),Pm(i.m_precisionDescriptor,s,o,1),i.m_bDefaultDescriptor=!0,i.m_userWKID=t,i.calculateHashCode(),i.initDbgName(),i}function Sm(t,e,n){return ot((t-e)*n)/n+e}let wm=null;const bm=3552713678800501e-30;function Tm(t,e,n){return t===e||Math.abs(t-e)<=n*(1+(Math.abs(t)+Math.abs(e))/2)}function vm(t,e){return Tm(t,e,bm)}function Im(t,e){return 0===t||Math.abs(t)<=e}function Dm(t){return Im(t,bm)}let Gm,Nm,Mm,Am,qm,Ym,Xm,Rm,Fm,Om,Lm;function Um(t){return{_this:t,get(){return this._this},reset(t){this._this=t},release(){const t=this._this;return this._this=null,t}}}let Hm=null;function zm(t){X(Hm);const e=Hm(t);return e.semiMajor=e.isPCS?Number.NaN:Wm(t),e}function Vm(t){Hm=t,X(Hm)}function jm(t){const e=t;Nm=e.PeFactory,X(Nm),Lm=e.PeGCSExtent,X(Lm),Fm=e.PeLineType,X(Fm),Om=e.PeMath,X(Om),Gm=e.PeDouble,X(Gm),Mm=e.PeDefs,X(Mm),Am=e.PeCSTransformations,X(Am),qm=e.PeGTTransformations,X(qm),Ym=e.PePCSInfo,X(Ym),Xm=e.PeGTlistExtended,X(Xm),Nm.initialize(),Rm=e.PeGTlistExtendedEntry,X(Rm),Mm.PE_TYPE_ANGUNIT=512,Mm.PE_STR_AUTH_ALL=2,Ym.PE_POLE_LINE_STRAIGHT=2,Ym.PE_POLE_LINE_CURVED=3,Mm.PE_PARM_LAM0=2,Mm.PE_PARM_PHI0=6,Mm.PE_PRJ_AZIMUTHAL_EQUIDISTANT=43032,Mm.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA=43033,Mm.PE_PRJ_ALBERS=43007,Mm.PE_PRJ_CYLINDRICAL_EQAREA=43034,Mm.PE_TYPE_VERTCS=8,Mm.PE_LINETYPE_GEODESIC=0,Mm.PE_LINETYPE_LOXODROME=1,Mm.PE_LINETYPE_GREAT_ELLIPTIC=2,Mm.PE_LINETYPE_NORMAL_SECTION=3,Xm.PE_GTLIST_OPTS_USABLE=1,Hm=null}function km(t,e,n,r){return e<=0?(n[0]=0,r[0]=0,!1):(n[0]=e,r[0]=e,!0)}function Bm(t){X(Ba());return!!Hm(t).isPCS||Zm(t)}function Zm(t){return Nm&&k("pe has been loaded. no-pe methods should not be used at this point."),wm||Qm(),wm.has(t)}const Km=/(?:ELLIPSOID|SPHEROID)\["(?:\w|[-()])+",(\d+\.\d+)/;function Wm(t){if(Nm&&k("pe has been loaded. no-pe methods should not be used at this point."),"string"==typeof t){const e=t.match(Km);e&&2===e.length||Y("bad gcs wkt");const n=Number.parseFloat(e[1]);return Number.isFinite(n)||Y("bad gcs wkt"),n}return wm||Qm(),wm.has(t)||k("gcs wkid not found"),wm.get(t)}function Qm(){wm=new Map;for(const t in $t){const e=Number.parseFloat(t),n=$t[t];if(Array.isArray(n))for(const t of n)wm.set(t,e);else wm.set(n,e)}te()}W(0),W(1);const Jm=Object.freeze(Object.defineProperty({__proto__:null,SpatialReference:gm,SpatialReferencePrecisionDescriptor:_m,create:Ka,createFromWKT:Wa,createImplFromPe:Qa,createLocal:tm,createWithNewPrecision:$a,getGCS:nm,getTempName:mm,hasNoPe:Ba,hasPe:ka,injectNoPe:ja,injectPe:Va,isInitialized:Za,isTempName:cm,isValidWkid:rm,isValidWkt:im,makeSpheroidData:Ha,snapGeometry:em,webMercator:fm,webMercator102100:pm,wgs84:dm},Symbol.toStringTag,{value:"Module"})),$m=Object.freeze(Object.defineProperty({__proto__:null,OperatorProject:Ri},Symbol.toStringTag,{value:"Module"}));export{mm as $,qe as A,Pe as B,Ee as C,fe as D,Co as E,Mm as F,ls as G,vi as H,Ae as I,ye as J,xo as K,aa as L,Xo as M,me as N,Rs as O,vm as P,lo as Q,Am as R,_m as S,eo as T,Eo as U,ka as V,em as W,Re as X,Le as Y,Ys as Z,Xs as _,Wa as a,Nm as a0,Po as a1,Ge as a2,im as a3,rm as a4,Gs as a5,$a as a6,Qt as a7,Jm as a8,$m as a9,qs as b,Ka as c,Fs as d,la as e,Oi as f,Ri as g,mo as h,ja as i,tm as j,ne as k,us as l,ao as m,Li as n,Gm as o,Om as p,Fm as q,dn as r,Ha as s,cs as t,zi as u,Vi as v,Ui as w,Hi as x,po as y,ue as z};
|