@arcgis/core 4.32.0-next.20250128 → 4.32.0-next.20250130
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/TrackGraphic.js +1 -1
- package/applications/Components/SelectionOperation.d.ts +1 -2
- package/applications/Components/SketchTooltipControls.d.ts +1 -2
- package/applications/Components/basemapUtils.d.ts +1 -2
- package/applications/Components/drawUtils.d.ts +1 -2
- package/applications/Components/fontUtils.d.ts +1 -2
- package/applications/Components/getDefaultUnits.d.ts +1 -2
- package/applications/Components/gfxUtils.d.ts +1 -2
- package/applications/Components/layerOriginUtils.d.ts +4 -2
- package/applications/Components/layersEffectsJsonUtils.d.ts +1 -2
- package/applications/Components/previewSymbol2D.d.ts +1 -2
- package/applications/Components/reactiveUtils.d.ts +1 -2
- package/applications/Components/styleUtils.d.ts +1 -2
- package/applications/Components/svgUtils.d.ts +3 -2
- package/applications/Components/webStyleSymbolUtils.d.ts +1 -2
- package/applications/Excalibur/videoViewUtils.d.ts +1 -2
- package/applications/ExperienceBuilder/sketchUtils.d.ts +3 -2
- package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +2 -2
- package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +3 -2
- package/applications/KnowledgeStudio/resourceSerializationUtils.d.ts +4 -2
- package/applications/MapViewer/mediaUtils.d.ts +2 -2
- package/applications/MapViewer/templateUtils.d.ts +4 -2
- package/applications/SceneViewer/colorUtils.d.ts +1 -2
- package/applications/SceneViewer/devEnvironmentUtils.d.ts +3 -2
- package/applications/SceneViewer/layerUtils.d.ts +2 -2
- package/applications/SceneViewer/sceneViewerUtils.d.ts +15 -2
- package/applications/SceneViewer/symbolUtils.d.ts +1 -2
- package/applications/Urban/meshUtils.d.ts +1 -2
- package/applications/WebEditor/sketchUtils.d.ts +2 -2
- package/arcade.d.ts +2 -2
- package/assets/components/assets/icon/hammerCoin16.json +1 -0
- package/assets/components/assets/icon/hammerCoin24.json +1 -0
- package/assets/components/assets/icon/hammerCoin32.json +1 -0
- package/assets/components/assets/icon/hammerLock16.json +1 -0
- package/assets/components/assets/icon/hammerLock24.json +1 -0
- package/assets/components/assets/icon/hammerLock32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/06d72622590dbd38c5de.js +1 -0
- package/assets/esri/core/workers/chunks/07c5f3fc475c57f5a7a7.js +1 -0
- package/assets/esri/core/workers/chunks/08c4b585290efc98ca5d.js +1 -0
- package/assets/esri/core/workers/chunks/{41f7287832d407f13ce5.js → 09b77f82c22530b44daa.js} +1 -1
- package/assets/esri/core/workers/chunks/0b62871b89dcb4c70457.js +1 -0
- package/assets/esri/core/workers/chunks/0bafa546602b776caf2f.js +1 -0
- package/assets/esri/core/workers/chunks/0ebdf0d1fd2034b24519.js +972 -0
- package/assets/esri/core/workers/chunks/{e89439cc20b7f4c6a9d1.js → 0ef5b0f8aa8a09acd6e0.js} +1 -1
- package/assets/esri/core/workers/chunks/117e7a12af77c761efb5.js +1 -0
- package/assets/esri/core/workers/chunks/122ed10cac9f192e1eec.js +1 -0
- package/assets/esri/core/workers/chunks/12964a4b16113cdc9c93.js +1 -0
- package/assets/esri/core/workers/chunks/149bad940feb0764b350.js +1 -0
- package/assets/esri/core/workers/chunks/1891c9aa162c5df1d27c.js +1 -0
- package/assets/esri/core/workers/chunks/1ab83753d9eec0463461.js +1 -0
- package/assets/esri/core/workers/chunks/{304722106439951da6e1.js → 1accbc048b74857269e4.js} +1 -1
- package/assets/esri/core/workers/chunks/{0edf5cd5d004631c3959.js → 1cbeac3301b6943bb28a.js} +1 -1
- package/assets/esri/core/workers/chunks/1d51c064045e9c47bd2e.js +1 -0
- package/assets/esri/core/workers/chunks/1f443b99653708470f31.js +1 -0
- package/assets/esri/core/workers/chunks/{7d49b5bc9eb102e467ab.js → 220b12654b94c94f8d8a.js} +1 -1
- package/assets/esri/core/workers/chunks/22e11a8abc70b6571a2b.js +1 -0
- package/assets/esri/core/workers/chunks/2345344be4b0e487d3a6.js +1 -0
- package/assets/esri/core/workers/chunks/{6eb829a7959df2269b0e.js → 24c94f97a76646d415ae.js} +1 -1
- package/assets/esri/core/workers/chunks/258b46b58a4860942f7c.js +1 -0
- package/assets/esri/core/workers/chunks/25c8cc30faade043c8dc.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/2c6f2fdf274c0258621e.js +1 -0
- package/assets/esri/core/workers/chunks/2ff63a71213f618377d6.js +1 -0
- package/assets/esri/core/workers/chunks/308ec51ff4a66f7fcb0d.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{985ae30627429832b2a9.js → 32f5f00aab55ef16dcf1.js} +1 -1
- package/assets/esri/core/workers/chunks/380d37ceb8cf52bad190.js +1 -0
- package/assets/esri/core/workers/chunks/3984bf01f055fc42bfbf.js +1 -0
- package/assets/esri/core/workers/chunks/3e872e5e528dca7bee0c.js +1 -0
- package/assets/esri/core/workers/chunks/3ec51b75d1a86dad6cb1.js +1 -0
- package/assets/esri/core/workers/chunks/4263eee3247aaf4e64bf.js +1 -0
- package/assets/esri/core/workers/chunks/448ee44c7f594e5b2551.js +1 -0
- package/assets/esri/core/workers/chunks/476205ee4414ed80666a.js +1 -0
- package/assets/esri/core/workers/chunks/4b56c0c109e10d7409b8.js +1 -0
- package/assets/esri/core/workers/chunks/{95e786366bc471bd0730.js → 4c5279fedf982a174706.js} +1 -1
- package/assets/esri/core/workers/chunks/4cab082b8432ddc05345.js +1 -0
- package/assets/esri/core/workers/chunks/{1e1306527fb38c5894eb.js → 5a536de1ecae424bad05.js} +1 -1
- package/assets/esri/core/workers/chunks/5adeb979f178944b9ce5.js +1 -0
- package/assets/esri/core/workers/chunks/5be7cf1564e756c24066.js +1 -0
- package/assets/esri/core/workers/chunks/{f09c95c3d79205ee5a84.js → 5e9bf6d0db82526b8a8c.js} +5 -5
- package/assets/esri/core/workers/chunks/{57ebfa7f163a1b40cd1e.js → 61795bde00f2e16d04f1.js} +1 -1
- package/assets/esri/core/workers/chunks/{568fe969e8f914f042ca.js → 627cbe662d58cda62e7e.js} +1 -1
- package/assets/esri/core/workers/chunks/{6d179eb8edcefb91d5d7.js → 69ab4b780f7223cfd7dd.js} +1 -1
- package/assets/esri/core/workers/chunks/6d79ec15d1858839f576.js +1 -0
- package/assets/esri/core/workers/chunks/6e25742ceedea7fb1b97.js +1 -0
- package/assets/esri/core/workers/chunks/6e8905f20101c1f4509d.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/6ef2514a6b7bbfb8e37d.js +1 -0
- package/assets/esri/core/workers/chunks/72cf9192292e5c85c6df.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{50beab30e120ba39d212.js → 76794184ba8c2e66745e.js} +1 -1
- package/assets/esri/core/workers/chunks/7810579a5a780933cdc9.js +1 -0
- package/assets/esri/core/workers/chunks/{e45dba512ebee97f0af2.js → 78242f2bf742b33d99fa.js} +1 -1
- package/assets/esri/core/workers/chunks/7966c245a073c85f04b1.js +1 -0
- package/assets/esri/core/workers/chunks/{fa0d968733d581bc2e4d.js → 7d120f8b01fe719eb257.js} +1 -1
- package/assets/esri/core/workers/chunks/7e23c15b2a02116f7189.js +1 -0
- package/assets/esri/core/workers/chunks/7f87cf3d6a365d987f69.js +1 -0
- package/assets/esri/core/workers/chunks/83edac97a52b26ead1ea.js +314 -0
- package/assets/esri/core/workers/chunks/881ddbdeb40336208e90.js +1 -0
- package/assets/esri/core/workers/chunks/{ec9d5af8887854e821c8.js → 88cbaa91c495d86f4bb0.js} +1 -1
- package/assets/esri/core/workers/chunks/{11c999b976ed805b0608.js → 89e3f7880abd014a62c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{a3ae5ea96898de327147.js → 8bd51b5b392dfacc922f.js} +1 -1
- package/assets/esri/core/workers/chunks/8e6301006abdf47cc88d.js +1 -0
- package/assets/esri/core/workers/chunks/{9466e53ff270f6eb42c9.js → 9011704b258ecbfb6d9b.js} +2 -2
- package/assets/esri/core/workers/chunks/{9466e53ff270f6eb42c9.js.LICENSE.txt → 9011704b258ecbfb6d9b.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/92984981afcbb95828cd.js +1 -0
- package/assets/esri/core/workers/chunks/934857de20f6f5c15188.js +1 -0
- package/assets/esri/core/workers/chunks/95ad76e58452b60fb79f.js +1 -0
- package/assets/esri/core/workers/chunks/9725398f6d56c8ba54ae.js +1 -0
- package/assets/esri/core/workers/chunks/97310e6eec87eeaf58f0.js +1 -0
- package/assets/esri/core/workers/chunks/9ffa27d0517bad84572e.js +1 -0
- package/assets/esri/core/workers/chunks/a39977478a6c57d2e8fb.js +1 -0
- package/assets/esri/core/workers/chunks/{f355ca70abadb2155839.js → a61d05354348385f41b5.js} +1 -1
- package/assets/esri/core/workers/chunks/af917f69d9c6e9937263.js +1 -0
- package/assets/esri/core/workers/chunks/b18620fc15707e4413a1.js +1 -0
- package/assets/esri/core/workers/chunks/b1baf39daf5725404be5.js +1 -0
- package/assets/esri/core/workers/chunks/b21b152fa15896577242.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{39a6fe4cdb205f4925fb.js → b68bddd0c4ca91493543.js} +1 -1
- package/assets/esri/core/workers/chunks/bc50585615f07d5ec1a9.js +1 -0
- package/assets/esri/core/workers/chunks/bf9bc52a3c559108c19a.js +2 -0
- package/assets/esri/core/workers/chunks/{b5d4255db21dfd3b3b13.js.LICENSE.txt → bf9bc52a3c559108c19a.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/c04091eea7089dc2e864.js +1 -0
- package/assets/esri/core/workers/chunks/{b9369c5415f5b3bda5cf.js → c1d80a709148e3373a82.js} +1 -1
- package/assets/esri/core/workers/chunks/c249ad935f54d3b49ae3.js +1 -0
- package/assets/esri/core/workers/chunks/{759618564e68fc09dc36.js → c57b9f2b9c229e68919d.js} +1 -1
- package/assets/esri/core/workers/chunks/c74441fbe0f63633796f.js +1 -0
- package/assets/esri/core/workers/chunks/{7fd48f0a2b35779e680a.js → c7a94e569c905f97244a.js} +1 -1
- package/assets/esri/core/workers/chunks/c80d542935803bf869f8.js +1 -0
- package/assets/esri/core/workers/chunks/{bc0183350841e09d71fa.js → c8a0089e080140db9076.js} +1 -1
- package/assets/esri/core/workers/chunks/{d71a5c029fc9f4820589.js → cee3a38b92a48a58c4d0.js} +1 -1
- package/assets/esri/core/workers/chunks/d1678945cf6a58f76863.js +1 -0
- package/assets/esri/core/workers/chunks/{9ed1691eab19dfb1cf04.js → d1718ad93e3271b0525e.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5b373fe244e5dce1548.js → d27a199fd8e2ade69254.js} +1 -1
- package/assets/esri/core/workers/chunks/d3a8aabdbfb59dd433e3.js +1 -0
- package/assets/esri/core/workers/chunks/d599ba865da87b487b1b.js +1 -0
- package/assets/esri/core/workers/chunks/da1157e288dbc6ba842a.js +1 -0
- package/assets/esri/core/workers/chunks/{8584ccce34972e28c040.js → da77eefaad83c0644380.js} +1 -1
- package/assets/esri/core/workers/chunks/dd46ec81cebe1a0a7b9c.js +1 -0
- package/assets/esri/core/workers/chunks/dd9be173cddc16a354ed.js +1 -0
- package/assets/esri/core/workers/chunks/debfb75a94b66b58cbbc.js +1 -0
- package/assets/esri/core/workers/chunks/{5a83f90b55a5efbe1ef2.js → df3d1a8d3f11d52eb30d.js} +1 -1
- package/assets/esri/core/workers/chunks/e0de91eacf3a3b7eda55.js +51 -0
- package/assets/esri/core/workers/chunks/e444ec05a8a1dfbd21a8.js +1 -0
- package/assets/esri/core/workers/chunks/e4651d577d297386268e.js +1 -0
- package/assets/esri/core/workers/chunks/e468bf4ec7402942ad8c.js +1 -0
- package/assets/esri/core/workers/chunks/f200dca22f9f9bbb8670.js +1 -0
- package/assets/esri/core/workers/chunks/f2fae056a81f12b56b04.js +1 -0
- package/assets/esri/core/workers/chunks/f429d95eb986f3d215f3.js +1 -0
- package/assets/esri/core/workers/chunks/f8367c21fa91435c7c53.js +1 -0
- package/assets/esri/themes/base/_Ui.scss +6 -0
- package/assets/esri/themes/base/_mixins.scss +0 -7
- package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +0 -2
- package/assets/esri/themes/base/widgets/_Bookmarks.scss +0 -5
- package/assets/esri/themes/base/widgets/_CatalogLayerList.scss +0 -2
- package/assets/esri/themes/base/widgets/_Features.scss +0 -5
- package/assets/esri/themes/base/widgets/_LayerList.scss +0 -2
- package/assets/esri/themes/base/widgets/_TableList.scss +0 -2
- 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/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ar.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bg.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_bs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ca.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_cs.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_da.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_de.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_el.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_en.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_es.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_et.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_fr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_he.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_hu.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_id.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_it.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ja.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ko.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lt.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_lv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_nl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_no.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ro.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_ru.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sl.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_sv.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_th.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_tr.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_uk.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_vi.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureForm/t9n/FeatureForm_zh-TW.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ar.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bg.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_bs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ca.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_cs.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_da.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_de.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_el.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_es.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_et.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_fr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_he.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_hu.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_id.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_it.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ja.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ko.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lt.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_lv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_nl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_no.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-BR.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_pt-PT.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ro.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_ru.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sl.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_sv.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_th.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_tr.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_uk.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_vi.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-CN.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-HK.json +1 -1
- package/assets/esri/widgets/OrientedImageryViewer/t9n/OrientedImageryViewer_zh-TW.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ar.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bg.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_bs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ca.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_cs.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_da.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_de.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_el.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_es.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_et.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_fr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_he.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_hu.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_id.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_it.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ja.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ko.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lt.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_lv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_nl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_no.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-BR.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_pt-PT.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ro.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_ru.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sl.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_sv.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_th.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_tr.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_uk.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_vi.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-CN.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-HK.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_zh-TW.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_no.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkTrace/t9n/UtilityNetworkTrace_zh-TW.json +1 -1
- package/chunks/AtmosphereCompositing.glsl.js +2 -2
- package/chunks/BlendLayers.glsl.js +1 -1
- package/chunks/BlendWeights.glsl.js +1 -1
- package/chunks/BloomBlur.glsl.js +23 -23
- package/chunks/BloomComposition.glsl.js +3 -3
- package/chunks/BloomDepthAdjust.glsl.js +2 -2
- package/chunks/Blur.glsl.js +1 -1
- package/chunks/Bufferer-DjC-SKTJ.js +5 -0
- package/chunks/ChapmanAtmosphere.glsl.js +2 -2
- package/chunks/CheckerBoard.glsl.js +2 -2
- package/chunks/Clouds.glsl.js +14 -14
- package/chunks/CloudsComposition.glsl.js +1 -1
- package/chunks/ColorMaterial.glsl.js +1 -1
- package/chunks/ComponentShader.glsl.js +4 -4
- package/chunks/Compositing.glsl.js +2 -2
- package/chunks/DefaultMaterial.glsl.js +16 -15
- package/chunks/{Distance2DCalculator-C9BrfErD.js → Distance2DCalculator-8-JrFGHH.js} +1 -1
- package/chunks/EdgeDetect.glsl.js +2 -2
- package/chunks/EdgeShader.glsl.js +2 -2
- package/chunks/Envelope.js +1 -1
- package/chunks/FocusAreaColor.glsl.js +2 -2
- package/chunks/FocusAreaMask.glsl.js +1 -1
- package/chunks/Fog.glsl.js +3 -3
- package/chunks/GeodeticDistanceCalculator-BsWHOuqE.js +5 -0
- package/chunks/Geometry.js +1 -1
- package/chunks/HUDCompositing.glsl.js +1 -1
- package/chunks/HUDMaterial.glsl.js +24 -24
- package/chunks/Haze.glsl.js +3 -3
- package/chunks/HazeCompositing.glsl.js +2 -2
- package/chunks/Heatmap.glsl.js +1 -1
- package/chunks/HeatmapDensity.glsl.js +5 -5
- package/chunks/HighlightApply.glsl.js +2 -2
- package/chunks/HighlightDownsample.glsl.js +2 -2
- package/chunks/HighlightToSingle.glsl.js +2 -2
- package/chunks/ImageMaterial.glsl.js +4 -4
- package/chunks/LaserlinePath.glsl.js +1 -1
- package/chunks/Laserlines.glsl.js +1 -1
- package/chunks/LineCallout.glsl.js +1 -1
- package/chunks/LineMarker.glsl.js +8 -8
- package/chunks/Magnifier.glsl.js +4 -4
- package/chunks/MeasurementArrow.glsl.js +2 -2
- package/chunks/NativeLine.glsl.js +4 -4
- package/chunks/NoiseTextureAtlas.glsl.js +34 -34
- package/chunks/OITBlend.glsl.js +3 -3
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OverlayCompositing.glsl.js +1 -1
- package/chunks/Path.glsl.js +9 -9
- package/chunks/Pattern.glsl.js +3 -3
- package/chunks/Point2D.js +1 -1
- package/chunks/PointRenderer.glsl.js +1 -1
- package/chunks/Precipitation.glsl.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/RasterColorizer.glsl.js +9 -9
- package/chunks/RealisticTree.glsl.js +3 -3
- package/chunks/RibbonLine.glsl.js +32 -32
- package/chunks/SSAO.glsl.js +2 -2
- package/chunks/SSAOBlur.glsl.js +1 -1
- package/chunks/ShadedColorMaterial.glsl.js +3 -3
- package/chunks/ShadowCastAccumulate.glsl.js +2 -2
- package/chunks/ShadowCastVisualize.glsl.js +4 -4
- package/chunks/ShadowHighlight.glsl.js +2 -2
- package/chunks/{SideCalculator2D-Bf4QCxCR.js → SideCalculator2D-BNwb5gvz.js} +1 -1
- package/chunks/SimpleAtmosphere.glsl.js +8 -8
- package/chunks/SingleHighlightApply.glsl.js +1 -1
- package/chunks/SingleHighlightBlur.glsl.js +6 -7
- package/chunks/SlicePlaneMaterial.glsl.js +2 -2
- package/chunks/Stars.glsl.js +2 -2
- package/chunks/Terrain.glsl.js +2 -2
- package/chunks/TextureOnly.glsl.js +2 -2
- package/chunks/Viewshed.glsl.js +2 -2
- package/chunks/WaterSurface.glsl.js +7 -7
- package/chunks/distanceOperator.js +1 -1
- package/chunks/relateOperator.js +1 -1
- package/core/QueueProcessor.js +5 -0
- package/core/accessorSupport/decorators.d.ts +4 -2
- package/core/has.js +1 -1
- package/core/jsonMap.js +1 -1
- package/core/lang.d.ts +1 -2
- package/core/libs/gl-matrix-2/factories/vec2f64.js +1 -1
- package/core/mathUtils.js +1 -1
- package/core/promiseUtils.d.ts +5 -2
- package/core/quantity.d.ts +3 -2
- package/core/reactiveUtils.d.ts +5 -2
- package/core/scheduling.d.ts +2 -2
- package/core/sql/WhereClauseCache.js +1 -1
- package/core/sql.d.ts +1 -2
- package/core/sql.js +1 -1
- package/core/units.d.ts +9 -2
- package/core/urlUtils.d.ts +5 -2
- package/core/workers.d.ts +1 -2
- package/editing/sharedTemplates/executor/builders/bufferLineToPolygon.js +1 -1
- package/editing/sharedTemplates/executor/builders/bufferPointToPolygon.js +1 -1
- package/editing/sharedTemplates/executor/builders/bufferPolygonToPolygon.js +1 -1
- package/editing/sharedTemplates/executor/builders/connectionPoint.js +1 -1
- package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
- package/editing/sharedTemplates/executor/builders/offsetLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/offsetPrimaryLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtAllVerticesOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtBeginningOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtBeginningOfRadial.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtEndOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtInteriorVertices.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtNotBeginningOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtNotEndOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtPolygonCentroid.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtPolygonNotStart.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtPolygonStart.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointIdentity.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointPrimaryIdentity.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonBoundary.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonBoundaryTwoPoint.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonIdentity.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonPrimaryIdentity.js +1 -1
- package/editing/sharedTemplates/executor/builders/polygonVertices.js +1 -1
- package/editing/sharedTemplates/executor/builders/radialLines.js +1 -1
- package/editing/sharedTemplates/executor/builders/twoPointLines.js +1 -1
- package/editing/sharedTemplates/executor/createTemplateExecutor.js +5 -0
- package/editing/sharedTemplates/executor/support/createServiceEdit.js +1 -1
- package/editing/sharedTemplates/executor/support/executorUtils.js +1 -1
- package/editing/sharedTemplates/executor/support/getBuilder.js +5 -0
- package/editing/templateUtils.js +1 -1
- package/form/elements/inputs.d.ts +11 -2
- package/form/elements.d.ts +7 -2
- package/geometry/coordinateFormatter.d.ts +11 -2
- package/geometry/geometryEngine.d.ts +37 -2
- package/geometry/geometryEngineAsync.d.ts +37 -2
- package/geometry/operators/affineTransformOperator.d.ts +3 -2
- package/geometry/operators/alphaShapeOperator.d.ts +3 -2
- package/geometry/operators/areaOperator.d.ts +2 -2
- package/geometry/operators/autoCompleteOperator.d.ts +2 -2
- package/geometry/operators/boundaryOperator.d.ts +3 -2
- package/geometry/operators/bufferOperator.d.ts +3 -2
- package/geometry/operators/centroidOperator.d.ts +2 -2
- package/geometry/operators/clipOperator.d.ts +3 -2
- package/geometry/operators/containsOperator.d.ts +3 -2
- package/geometry/operators/convexHullOperator.d.ts +4 -2
- package/geometry/operators/crossesOperator.d.ts +3 -2
- package/geometry/operators/cutOperator.d.ts +2 -2
- package/geometry/operators/densifyOperator.d.ts +3 -2
- package/geometry/operators/differenceOperator.d.ts +3 -2
- package/geometry/operators/disjointOperator.d.ts +3 -2
- package/geometry/operators/distanceOperator.d.ts +2 -2
- package/geometry/operators/equalsOperator.d.ts +3 -2
- package/geometry/operators/extendOperator.d.ts +2 -2
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/generalizeOperator.d.ts +3 -2
- package/geometry/operators/geodesicBufferOperator.d.ts +5 -2
- package/geometry/operators/geodesicProximityOperator.d.ts +6 -2
- package/geometry/operators/geodeticAreaOperator.d.ts +4 -2
- package/geometry/operators/geodeticDensifyOperator.d.ts +5 -2
- package/geometry/operators/geodeticDistanceOperator.d.ts +4 -2
- package/geometry/operators/geodeticLengthOperator.d.ts +4 -2
- package/geometry/operators/graphicBufferOperator.d.ts +2 -2
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBoundary.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorConvexHull.js +1 -1
- package/geometry/operators/gx/operatorDifference.js +1 -1
- package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
- package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDensify.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
- package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorIntersection.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorProject.js +1 -1
- package/geometry/operators/gx/operatorProximityGeodesic.js +1 -1
- package/geometry/operators/gx/operatorShapePreservingProject.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/integrateOperator.d.ts +2 -2
- package/geometry/operators/intersectionOperator.d.ts +4 -2
- package/geometry/operators/intersectsOperator.d.ts +3 -2
- package/geometry/operators/isNearOperator.d.ts +2 -2
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/labelPointOperator.d.ts +3 -2
- package/geometry/operators/lengthOperator.d.ts +2 -2
- package/geometry/operators/linesToPolygonsOperator.d.ts +2 -2
- package/geometry/operators/locateBetweenOperator.d.ts +2 -2
- package/geometry/operators/minimumBoundingCircleOperator.d.ts +3 -2
- package/geometry/operators/multiPartToSinglePartOperator.d.ts +2 -2
- package/geometry/operators/offsetOperator.d.ts +3 -2
- package/geometry/operators/overlapsOperator.d.ts +3 -2
- package/geometry/operators/polygonOverlayOperator.d.ts +2 -2
- package/geometry/operators/polygonSlicerOperator.d.ts +4 -2
- package/geometry/operators/projectOperator.d.ts +5 -2
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/proximityOperator.d.ts +4 -2
- package/geometry/operators/relateOperator.d.ts +4 -2
- package/geometry/operators/reshapeOperator.d.ts +2 -2
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/shapePreservingProjectOperator.d.ts +5 -2
- package/geometry/operators/shapePreservingProjectOperator.js +1 -1
- package/geometry/operators/simplifyOperator.d.ts +4 -2
- package/geometry/operators/support/geographicTransformationUtils.d.ts +4 -2
- package/geometry/operators/support/geographicTransformationUtils.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/operators/symmetricDifferenceOperator.d.ts +3 -2
- package/geometry/operators/touchesOperator.d.ts +3 -2
- package/geometry/operators/unionOperator.d.ts +3 -2
- package/geometry/operators/withinOperator.d.ts +3 -2
- package/geometry/projection.d.ts +5 -2
- package/geometry/support/geodesicUtils.d.ts +5 -2
- package/geometry/support/jsonUtils.d.ts +2 -2
- package/geometry/support/meshUtils.d.ts +6 -2
- package/geometry/support/normalizeUtils.d.ts +2 -2
- package/geometry/support/scaleUtils.js +1 -1
- package/geometry/support/webMercatorUtils.d.ts +6 -2
- package/geometry.d.ts +7 -2
- package/interfaces.d.ts +72 -94
- package/intl.d.ts +16 -2
- package/kernel.d.ts +2 -2
- package/layers/ImageryLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/catalog/catalogUtils.d.ts +2 -2
- package/layers/graphics/OptimizedGeometry.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/knowledgeGraph/cypherUtils.d.ts +1 -2
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/knowledgeGraph/supportUtils.d.ts +4 -2
- package/layers/mixins/APIKeyMixin.d.ts +1 -1
- package/layers/mixins/ArcGISCachedService.d.ts +1 -1
- package/layers/mixins/ArcGISImageService.d.ts +1 -1
- package/layers/mixins/ArcGISMapService.d.ts +1 -1
- package/layers/mixins/BlendLayer.d.ts +1 -1
- package/layers/mixins/CustomParametersMixin.d.ts +1 -1
- package/layers/mixins/DisplayFilteredLayer.d.ts +1 -1
- package/layers/mixins/FeatureEffectLayer.d.ts +1 -1
- package/layers/mixins/FeatureLayerBase.d.ts +1 -1
- package/layers/mixins/FeatureReductionLayer.d.ts +1 -1
- package/layers/mixins/ImageryTileMixin.d.ts +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/OperationalLayer.d.ts +1 -1
- package/layers/mixins/OrderedLayer.d.ts +1 -1
- package/layers/mixins/PortalLayer.d.ts +1 -1
- package/layers/mixins/PublishableLayer.d.ts +1 -1
- package/layers/mixins/RasterPresetRendererMixin.d.ts +1 -1
- package/layers/mixins/RefreshableLayer.d.ts +1 -1
- package/layers/mixins/ScaleRangeLayer.d.ts +1 -1
- package/layers/mixins/SceneService.d.ts +1 -1
- package/layers/mixins/SublayersOwner.d.ts +1 -1
- package/layers/mixins/TemporalLayer.d.ts +1 -1
- package/layers/mixins/TemporalSceneLayer.d.ts +1 -1
- package/layers/ogc/wcsUtils.d.ts +1 -2
- package/layers/ogc/wfsUtils.d.ts +2 -2
- package/layers/orientedImagery/transformations/imageToWorld.d.ts +1 -2
- package/layers/orientedImagery/transformations/worldToImage.d.ts +1 -2
- package/layers/support/DisplayFilterInfo.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/TrackInfo.js +1 -1
- package/layers/support/TrackPartInfo.js +5 -0
- package/layers/support/arcadeUtils.d.ts +1 -2
- package/layers/support/arcadeUtils.js +1 -1
- package/layers/support/csvUtils.d.ts +1 -2
- package/layers/support/displayFilterUtils.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/layers/support/fieldUtils.d.ts +8 -2
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/layerOriginUtils.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterFieldUtils.js +1 -1
- package/layers/support/rasterFunctionConstants.d.ts +15 -2
- package/layers/support/rasterFunctionUtils.d.ts +105 -2
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/libs/linkchartlayout/LinkChartLayout.js +1 -1
- package/package.json +3 -3
- package/pointCloudRenderers.d.ts +5 -2
- package/popup/content.d.ts +9 -2
- package/rasterRenderers.d.ts +7 -2
- package/renderers/mixins/VisualVariablesMixin.d.ts +1 -1
- package/renderers/support/jsonUtils.d.ts +1 -2
- package/renderers/support/utils.d.ts +2 -2
- package/renderers.d.ts +9 -2
- package/request.js +1 -1
- package/rest/closestFacility.d.ts +1 -2
- package/rest/featureService/utils.d.ts +1 -2
- package/rest/find.d.ts +1 -2
- package/rest/geometryService.d.ts +21 -2
- package/rest/geoprocessor.d.ts +2 -2
- package/rest/identify.d.ts +1 -2
- package/rest/imageService.d.ts +19 -2
- package/rest/knowledgeGraphService.d.ts +11 -2
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/locator.d.ts +4 -2
- package/rest/networkService.d.ts +1 -2
- package/rest/networks/queryAssociations.d.ts +1 -2
- package/rest/networks/synthesizeAssociationGeometries.d.ts +1 -2
- package/rest/networks/trace.d.ts +1 -2
- package/rest/places.d.ts +3 -2
- package/rest/print.d.ts +2 -2
- package/rest/query.d.ts +11 -2
- package/rest/route.d.ts +1 -2
- package/rest/serviceArea.d.ts +1 -2
- package/rest/symbolService.d.ts +1 -2
- package/smartMapping/labels/bins.d.ts +1 -2
- package/smartMapping/labels/clusters.d.ts +1 -2
- package/smartMapping/popup/clusters.d.ts +1 -2
- package/smartMapping/popup/templates.d.ts +1 -2
- package/smartMapping/raster/renderers/classBreaks.d.ts +1 -2
- package/smartMapping/raster/renderers/colormap.d.ts +1 -2
- package/smartMapping/raster/renderers/flow.d.ts +1 -2
- package/smartMapping/raster/renderers/rgb.d.ts +1 -2
- package/smartMapping/raster/renderers/shadedRelief.d.ts +1 -2
- package/smartMapping/raster/renderers/stretch.d.ts +1 -2
- package/smartMapping/raster/renderers/uniqueValue.d.ts +1 -2
- package/smartMapping/raster/renderers/vectorField.d.ts +1 -2
- package/smartMapping/raster/support/colorRamps.d.ts +5 -2
- package/smartMapping/raster/support/utils.d.ts +2 -2
- package/smartMapping/renderers/color.d.ts +6 -2
- package/smartMapping/renderers/dotDensity.d.ts +1 -2
- package/smartMapping/renderers/dotDensity.js +1 -1
- package/smartMapping/renderers/heatmap.d.ts +2 -2
- package/smartMapping/renderers/heatmap.js +1 -1
- package/smartMapping/renderers/location.d.ts +1 -2
- package/smartMapping/renderers/opacity.d.ts +1 -2
- package/smartMapping/renderers/pieChart.d.ts +2 -2
- package/smartMapping/renderers/predominance.d.ts +1 -2
- package/smartMapping/renderers/relationship.d.ts +2 -2
- package/smartMapping/renderers/size.d.ts +5 -2
- package/smartMapping/renderers/support/rendererUtils.d.ts +1 -2
- package/smartMapping/renderers/type.d.ts +2 -2
- package/smartMapping/renderers/univariateColorSize.d.ts +2 -2
- package/smartMapping/statistics/heatmapStatistics.js +1 -1
- package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
- package/smartMapping/statistics/support/ageUtils.d.ts +1 -2
- package/smartMapping/statistics/support/predominanceUtils.d.ts +1 -2
- package/smartMapping/support/adapters/CSVLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerBinningAdapter.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/LayerAdapter.js +1 -1
- package/smartMapping/support/adapters/OGCFeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/PointCloudLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/StreamLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/histogramUtils.js +5 -0
- package/smartMapping/support/adapters/support/layerUtils.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/symbology/color.d.ts +7 -2
- package/smartMapping/symbology/dotDensity.d.ts +4 -2
- package/smartMapping/symbology/flow.d.ts +5 -2
- package/smartMapping/symbology/heatmap.d.ts +5 -2
- package/smartMapping/symbology/location.d.ts +3 -2
- package/smartMapping/symbology/pieChart.d.ts +5 -2
- package/smartMapping/symbology/predominance.d.ts +5 -2
- package/smartMapping/symbology/relationship.d.ts +5 -2
- package/smartMapping/symbology/size.d.ts +3 -2
- package/smartMapping/symbology/support/colorRamps.d.ts +4 -2
- package/smartMapping/symbology/type.d.ts +5 -2
- package/support/LayersMixin.d.ts +1 -1
- package/support/TablesMixin.d.ts +1 -1
- package/support/featureFlags.js +1 -1
- package/support/popupUtils.d.ts +4 -2
- package/support/revision.js +1 -1
- package/support/timeUtils.d.ts +3 -2
- package/symbols/support/cimConversionUtils.d.ts +1 -2
- package/symbols/support/cimSymbolUtils.d.ts +6 -2
- package/symbols/support/jsonUtils.d.ts +1 -2
- package/symbols/support/symbolUtils.d.ts +7 -2
- package/symbols.d.ts +29 -2
- package/tables/elements.d.ts +5 -2
- package/unionTypes.d.ts +12 -2
- package/versionManagement/utils.d.ts +2 -2
- package/versionManagement/versionAdapters/utils.d.ts +2 -2
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/mesh/factories/FeatureMeshFactory.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPolygonShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapResolveShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OpacityShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OverlayShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TestShader.js +1 -1
- package/views/2d/engine/webgl/util/LabelMatcher.js +1 -1
- package/views/2d/engine/webgl/util/Matcher.js +1 -1
- package/views/2d/engine/webgl/util/createMatcher.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/SubtypeGroupLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/ProcessorTileMessageQueue.js +1 -1
- package/views/2d/layers/features/aggregation/AAggregateSpatialIndex.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/AAggregateStrategy.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/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/StorageSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/SubtypeProcessorSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/DrillDownTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/PagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/SnapshotLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureFilterEvaluator.js +5 -0
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/features/support/whereUtils.js +1 -1
- package/views/2d/layers/support/FeatureCommandQueue.js +1 -1
- package/views/2d/tiling/TileQueue.js +1 -1
- package/views/3d/environment/ChapmanApproximation.glsl.js +3 -3
- package/views/3d/environment/ChapmanAtmosphere.glsl.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/ChapmanRaymarching.glsl.js +4 -4
- package/views/3d/environment/Clouds.glsl.js +1 -1
- package/views/3d/environment/CloudsComposition.glsl.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/Fog.glsl.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/environment/MarsAtmosphere.js +1 -1
- package/views/3d/environment/NoiseTextureAtlas.glsl.js +1 -1
- package/views/3d/environment/Precipitation.glsl.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/PrecipitationTechnique.js +1 -1
- package/views/3d/environment/SimpleAtmosphere.glsl.js +1 -1
- package/views/3d/interactive/visualElements/LaserlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureData.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureDataStore.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
- package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/support/PBFDecoder.js +1 -1
- package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
- package/views/3d/webgl/RenderNode.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +10 -10
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/DecodeSymbolColor.glsl.js +2 -2
- package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
- package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ForwardLinearDepth.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/HighlightCellGridScreenSpacePass.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/HighlightReadBitmap.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/NormalFromDepth.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Offset.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/ScreenSizeScaling.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +9 -9
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTangent.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexTextureCoordinates.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VerticalOffset.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/AlignPixel.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDOcclusionPass.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUDVisibility.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/Emissions.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/raster/Colormap.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/raster/Common.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/raster/Projection.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/raster/RasterColorizer.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/AnalyticalSkyModel.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeMaterialColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/FoamRendering.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Gamma.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MultipassGeometryTest.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +7 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadBaseColorTexture.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/TerrainDepthTest.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/TextureTransformUV.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/VisualVariables.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/BackgroundGrid.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CameraSpace.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/DoublePrecision.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/IsNaN.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/util/LocalFromScreenSpace.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/util/MixExternalColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloat16Encoding.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/TextureAtlasLookup.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/TextureOnly.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/BooleanBindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/BooleanPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float2DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float3BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float3DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Float4sPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatDrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/FloatsPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Integer2BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Integer2PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/IntegerBindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/IntegerDrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/IntegerPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix3DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix3PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4sDrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Matrix4sPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Texture2DBindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Texture2DDrawUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/TextureCubeBindUniform.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/glsl.js +5 -0
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/effects/OpaqueEnvironment.js +1 -1
- package/views/3d/webgl-engine/effects/TransparentEnvironment.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomDepthAdjust.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaColorNode.js +5 -0
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +5 -0
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/effects/haze/HazeCompositing.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightPassParameters.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlineTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAAPassParameters.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAOParameters.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/effects/stars/StarsTechnique.js +1 -1
- package/views/3d/webgl-engine/effects/transparency/OITBlend.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureCompressionWorker.js +1 -1
- package/views/3d/webgl-engine/lib/TextureCompressionWorkerHandle.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/AtmosphereCompositing.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/BlendWeights.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Blur.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Compositing.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/EdgeDetect.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/FocusAreaColor.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/FocusAreaMask.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDCompositing.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightToSingle.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LaserlinePath.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Laserlines.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Magnifier.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/NativeLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +7 -7
- package/views/3d/webgl-engine/shaders/OverlayCompositing.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/SSAO.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/SSAOBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ScreenSpacePassAtmosphere.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadedColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/SingleHighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/SingleHighlightBlur.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/SphereIntersect.glsl.js +2 -2
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ToneMapping.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/WaterSurface.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/AdjustProjectedPosition.glsl.js +2 -2
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DiscardNonSilhouetteEdges.glsl.js +4 -4
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DistanceFalloff.glsl.js +2 -2
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShader.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeUtil.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +3 -3
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +7 -7
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/UnpackAttributes.glsl.js +7 -7
- package/views/3d/webgl.d.ts +3 -2
- package/views/BreakpointsOwner.d.ts +1 -1
- package/views/DOMContainer.d.ts +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/FocusAreas.js +1 -1
- package/views/PopupView.d.ts +1 -1
- package/views/View.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/support/WhereClauseVisitor.js +5 -0
- package/views/support/DefaultsFromMap.js +1 -1
- package/views/support/{QueueProcessor.js → ScheduledQueueProcessor.js} +1 -1
- package/views/support/colorUtils.d.ts +2 -2
- package/views/webgl/NoParameters.js +5 -0
- package/views/webgl/ShaderBuilder.js +5 -0
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/Uniform.js +5 -0
- package/views/webgl/testAppleAmdDrawArrays.js +1 -1
- package/widgets/Attachments/AttachmentsViewModel.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/UpdateWorkflowData.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/support/profileUtils.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationSettings.js +5 -0
- package/widgets/FeatureForm/UtilityNetworkAssociationInput.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/LinkChartLayoutSwitcher/LinkChartLayoutSwitcherViewModel.js +5 -0
- package/widgets/Print.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/TimeSlider/TimeSliderViewModel.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/smartMapping/support/utils.d.ts +3 -2
- package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
- package/widgets/support/widget.d.ts +8 -2
- package/assets/esri/core/workers/chunks/02be905f7e9185de78c3.js +0 -1
- package/assets/esri/core/workers/chunks/0b66fee87863e5775a6a.js +0 -1
- package/assets/esri/core/workers/chunks/1557446aa4525705a5b2.js +0 -1
- package/assets/esri/core/workers/chunks/1a8aaa92ccb90f646a8b.js +0 -1
- package/assets/esri/core/workers/chunks/1dc6b5b177022b80c473.js +0 -1
- package/assets/esri/core/workers/chunks/2118e9ffb24178ed7f59.js +0 -1
- package/assets/esri/core/workers/chunks/25a6641938a9ccab39b7.js +0 -1
- package/assets/esri/core/workers/chunks/2840705ae7fa909ab4ed.js +0 -1
- package/assets/esri/core/workers/chunks/2a4c6c2e9ba103720e22.js +0 -314
- package/assets/esri/core/workers/chunks/2e4f861c78ef820c0a3e.js +0 -1
- package/assets/esri/core/workers/chunks/349f31a1fb489fbfe60d.js +0 -1
- package/assets/esri/core/workers/chunks/34b31091e172e910d750.js +0 -1
- package/assets/esri/core/workers/chunks/371c2fd9d767612bbeb2.js +0 -1
- package/assets/esri/core/workers/chunks/37658a4e83a5b18acd37.js +0 -1
- package/assets/esri/core/workers/chunks/39f3e202d95725f405ec.js +0 -1
- package/assets/esri/core/workers/chunks/3cb56f509d8f7f340c45.js +0 -1
- package/assets/esri/core/workers/chunks/4086698137db0795187f.js +0 -1
- package/assets/esri/core/workers/chunks/454034bad60414a9ab7f.js +0 -1
- package/assets/esri/core/workers/chunks/483787099d2ba8b8022d.js +0 -1
- package/assets/esri/core/workers/chunks/4b38c008872bb9e10278.js +0 -1
- package/assets/esri/core/workers/chunks/4cccca778b060d8dcd06.js +0 -1
- package/assets/esri/core/workers/chunks/4e5cf2d489db2a57d3bd.js +0 -1
- package/assets/esri/core/workers/chunks/4eda602a909a4773cb27.js +0 -1
- package/assets/esri/core/workers/chunks/5595f19c1f332f504a81.js +0 -1
- package/assets/esri/core/workers/chunks/55da04abc8e1ea93caa9.js +0 -1
- package/assets/esri/core/workers/chunks/561fc48b06a43abe1cd0.js +0 -1
- package/assets/esri/core/workers/chunks/576b7961fe7771dacfd9.js +0 -1
- package/assets/esri/core/workers/chunks/5bb175106aee21025bc2.js +0 -1
- package/assets/esri/core/workers/chunks/5c57aa9fdc4e1bab61ac.js +0 -1
- package/assets/esri/core/workers/chunks/602c67fe1061ec5a3fa5.js +0 -1
- package/assets/esri/core/workers/chunks/61f985a9a393803e5350.js +0 -1
- package/assets/esri/core/workers/chunks/644e83f48752a34f0d1a.js +0 -1
- package/assets/esri/core/workers/chunks/64f1355f7f51ecb3af95.js +0 -1
- package/assets/esri/core/workers/chunks/68f5b077fc1f6f7636dd.js +0 -1
- package/assets/esri/core/workers/chunks/7388b57de8926acd1fc2.js +0 -1
- package/assets/esri/core/workers/chunks/76b8aa593a5279569267.js +0 -1
- package/assets/esri/core/workers/chunks/7705ca2cc8ac3307d4cd.js +0 -1
- package/assets/esri/core/workers/chunks/7719fe672ea74cdc87be.js +0 -1
- package/assets/esri/core/workers/chunks/7ae1f26ded268099f429.js +0 -1
- package/assets/esri/core/workers/chunks/7c95721c077c70f31b53.js +0 -1
- package/assets/esri/core/workers/chunks/82a69eba9bacca8437bd.js +0 -1
- package/assets/esri/core/workers/chunks/8a13cd313d309281dbb9.js +0 -1
- package/assets/esri/core/workers/chunks/933089d069853f6e509a.js +0 -1
- package/assets/esri/core/workers/chunks/9848e9b9cc62328bfeb4.js +0 -1
- package/assets/esri/core/workers/chunks/9a30ad773c22bde61c64.js +0 -1
- package/assets/esri/core/workers/chunks/9bcead430045cbd9941c.js +0 -1
- package/assets/esri/core/workers/chunks/9bd22cdf6eb158555906.js +0 -1
- package/assets/esri/core/workers/chunks/a418af538ee98de7822a.js +0 -1
- package/assets/esri/core/workers/chunks/b1ce435e3850255e0b24.js +0 -1
- package/assets/esri/core/workers/chunks/b31096f20b9ed1446c3a.js +0 -1
- package/assets/esri/core/workers/chunks/b5d4255db21dfd3b3b13.js +0 -2
- package/assets/esri/core/workers/chunks/b5ee6c203f536bdb6708.js +0 -1
- package/assets/esri/core/workers/chunks/b882f921387e21fb263d.js +0 -1
- package/assets/esri/core/workers/chunks/bf9144a5d1fdebec6c4d.js +0 -1
- package/assets/esri/core/workers/chunks/c12bdf6fd7f631e3f79e.js +0 -971
- package/assets/esri/core/workers/chunks/c14afb5a090c58e66235.js +0 -1
- package/assets/esri/core/workers/chunks/c58f559eb68035ebe3da.js +0 -1
- package/assets/esri/core/workers/chunks/c62614bf6ba530924ca1.js +0 -1
- package/assets/esri/core/workers/chunks/c67322bb54dcf699fe23.js +0 -1
- package/assets/esri/core/workers/chunks/d0672714fffe04d5632a.js +0 -51
- package/assets/esri/core/workers/chunks/d5ca87a4ecf096430a21.js +0 -1
- package/assets/esri/core/workers/chunks/d9c34e07627d93d4670b.js +0 -1
- package/assets/esri/core/workers/chunks/e21259a75af746895d6c.js +0 -1
- package/assets/esri/core/workers/chunks/e2c49c1dc02249cf6fd2.js +0 -1
- package/assets/esri/core/workers/chunks/e36a4a049ea8b5589d28.js +0 -1
- package/assets/esri/core/workers/chunks/f43277fdbdbb0f49fe52.js +0 -1
- package/assets/esri/core/workers/chunks/f73bbf3a08adaa37581d.js +0 -1
- package/assets/esri/core/workers/chunks/f9656b0d3c1df8ad19af.js +0 -1
- package/chunks/Bufferer-BhfWVXPl.js +0 -5
- package/chunks/Clipper-a9xfvRaw.js +0 -5
- package/chunks/CrackAndCluster-CHWFqqYQ.js +0 -5
- package/chunks/GeodeticDistanceCalculator-Cnd3ZMKD.js +0 -5
- package/chunks/Intersector-K1VmdfQW.js +0 -5
- package/chunks/OperatorDifference.js +0 -5
- package/chunks/OperatorIntersection.js +0 -5
- package/chunks/OperatorSimplify.js +0 -5
- package/chunks/OperatorUnion.js +0 -5
- package/layers/support/TrackLabelClass.js +0 -5
- package/views/2d/engine/webgl/shaderGraph/ShaderBuilder2D.js +0 -5
- package/views/2d/layers/features/support/FeatureFilter.js +0 -5
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +0 -5
- package/views/3d/webgl-engine/core/shaderModules/Uniform.js +0 -5
- package/views/3d/webgl-engine/core/shaderModules/interfaces.js +0 -5
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaRenderNode.js +0 -5
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaRenderNodeColorEffects.js +0 -5
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaRenderNodeGeometryMasking.js +0 -5
- /package/chunks/{GeometryCleaner-DVgW95-D.js → GeometryCleaner-BEJM7I4l.js} +0 -0
- /package/views/{3d/webgl-engine/core/shaderTechnique → webgl}/BindType.js +0 -0
|
@@ -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{Envelope2D as t}from"./Envelope2D.js";import{t as e,g as n,q as r,d as i,j as s,G as o,f as a,b as m,i as u,c,h as l,r as h,B as g,C as _,s as p}from"./Geometry.js";import{P as f,a as d,S as y,M as P,a4 as x,E as C,b as E,a5 as S,n as b,L as w,c as T,a6 as I,T as v,e as D,a7 as G,a8 as N}from"./QuadraticBezier.js";import{v as M,P as A,$ as q,c as R,E as Y,C as U,w as O,h as X,a as F,a0 as L,m as H,a1 as V,f as z,a2 as j,a3 as k,a4 as B,a5 as W,a6 as Z,t as K}from"./Envelope.js";import{av as Q,l as J,P as $,h as tt,e as et,E as nt,d as rt,u as it,aw as st,ax as ot,a6 as at,ay as mt,a5 as ut,s as ct,A as lt,f as ht,a as gt,S as _t,w as pt,t as ft,m as dt,az as yt,c as Pt,aA as xt,aB as Ct,aC as Et,q as St,b as bt,as as wt,N as Tt,aD as It,I as vt,aE as Dt,aF as Gt,r as Nt}from"./Point2D.js";import{b as Mt,c as At}from"./tslib.es6.js";import{T as qt}from"./Transformation2D.js";import{c as Rt,b as Yt}from"./Clipper-a9xfvRaw.js";import{O as Ut}from"./OperatorDensify.js";import{O as Ot,q as Xt,n as Ft}from"./OperatorSimplify.js";import{O as Lt}from"./OperatorClip.js";import{O as Ht}from"./OperatorIntersection.js";import{G as Vt}from"./SimpleGeometryCursor.js";import{i as zt,d as jt,b as kt,e as Bt,m as Wt,r as Zt,u as Kt,C as Qt,f as Jt,v as $t}from"./CrackAndCluster-CHWFqqYQ.js";import{O as te}from"./OperatorUnion.js";import{O as ee}from"./OperatorDifference.js";class ne{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 ne({geom:t,sr:this.m_sr})}hasGeom(){return!!this.m_geom}}class re{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()&&e("unit type mismatch"),this.getUnitToBaseFactor()/t.getUnitToBaseFactor()}getUnitToBaseFactor(){return this.m_factor}getHashCode(){return Q(J(this.getUnitType()),J(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 ie={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 se(){for(const t in ie)delete ie[t]}class oe extends re{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 ae(t){return new cm}function me(t){return t.getType()===cu.PE_TYPE_LINUNIT?new cm(t):t.getType()===cu.PE_TYPE_ANGUNIT?new oe(t):void e("peUnit")}function ue(t){const n=Pu(null);return t.getType()===cu.PE_TYPE_PROJCS||t.getType()===cu.PE_TYPE_GEOGCS?n.reset(t.getUnit()):e("PE_coord_sys"),n.get()||c("cannot create units from coord sys"),me(n.get())}class ce{constructor(t,n,r){void 0===t?(this.x=new vt,this.y=new vt,this.z=new vt):t instanceof M?(this.x=new vt(t.x),this.y=new vt(t.y),this.z=new vt(t.z)):t instanceof vt?(this.x=t.clone(),this.y=n.clone(),this.z=r.clone()):e("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 ce(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 ce(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 ce(this.x.negate(),this.y.negate(),this.z.negate())}add(t){return new ce(this.x.addE(t.x),this.y.addE(t.y),this.z.addE(t.z))}sub(t){return new ce(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 ce(this.x.mulE(t),this.y.mulE(t),this.z.mulE(t))}div(t){return new ce(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 M.construct(this.x.value(),this.y.value(),this.z.value())}}class le{constructor(t){this.m_origin=new M,this.m_normal=new M,this.m_axisX=new M,this.m_axisY=new M,n(0)}assign(t){return n(0),this}set(t,e,r,i){n(0)}setFromPoints(t,e,r){return n(0),!1}getCoord(t,e){return n(0),{}}getCoord2D(t){return n(0),{}}getCoordX(t,e){return n(0),0}getCoordY(t,e){return n(0),0}getCoordZ(t,e){return n(0),0}setPreferredAxisX(t){n(0)}getOrigin(){return n(0),{}}getNormal(){return n(0),{}}getAxisX(){return this.m_axisX.clone()}getAxisY(){return this.m_axisY.clone()}setAxisX(t,e=!1){n(0)}setAxisY(t,e=!1){n(0)}recalculateAxisY(){n(0)}setOrigin(t){n(0)}setNormal(t,e){n(0)}intersect(t,e){return n(0),!1}intersectLine(t){return n(0),0}intersectLineEx(t,e){return n(0),0}closestCoordinate(t){return n(0),{}}projectVector(t){return n(0),{}}signedDistance(t){return n(0),0}distance(t){return n(0),0}}function he(t,e){return!1}function ge(t,e,r,i,s=100,o=he){let a,m,u,c,l,h,g,_,p;n(i>0);let f,d,y,P=0,x=0;const C=wt();e>r&&(r=bt(e,e=r));const E=t(e),S=t(r);E<S?(a=m=u=e,c=l=h=E):(a=m=u=r,c=l=h=S);let b=0;for(;b<s&&(y=.5*(r-e),p=e+y,f=i*(Math.abs(a)+.25),d=2*f,!(o(a,c)||Math.abs(a-p)<=d-y));++b){if(Math.abs(x)>f){const t=(a-m)*(c-h);let n=(a-u)*(c-l),i=(a-u)*n-(a-m)*t;n=2*(n-t),n>0&&(i=-i),n=Math.abs(n);const s=x;x=P,Math.abs(i)>=Math.abs(n*s*.5)||i<=n*(e-a)||i>=n*(r-a)?(x=a>=p?e-a:r-a,P=wt()*x):(P=i/n,_=a+P,(_-e<d||r-_<d)&&(P=p-a<0?-Math.abs(f):Math.abs(f)))}else x=a>=p?e-a:r-a,P=x*C;_=a+P,g=t(_),g<c?(_>=a?e=a:r=a,u=m,m=a,a=_,h=l,l=c,c=g):(_<a?e=_:r=_,g<=l||m===a?(u=m,m=_,h=l,l=g):(g<=h||u===a||u===m)&&(u=_,h=g))}return tt(a,c)}function _e(t,e,n){if(t>n){t-=Math.ceil((t-n)/Nt)*Nt}else if(t<e){t+=Math.ceil((e-t)/Nt)*Nt}return t}function pe(t,e,n){return fe(t,e,n,0)}function fe(t,e,n,r){const i=n.x,s=n.y;return ye(t,e,Math.cos(i),Math.sin(i),Math.cos(s),Math.sin(s),r)}function de(t,e,n,r,i,s){return ye(t,e,n,r,i,s,0)}function ye(t,e,n,r,i,s,o){const a=t/Math.sqrt(1-e*s*s),m=a+o,u=m*i*n,c=m*i*r,l=(a*(1-e)+o)*s;return M.construct(u,c,l)}function Pe(t,e,n){const r=new vt,i=new vt,s=new vt,o=new vt;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 vt(t).divE(a),u=m.mulE(s).mulE(r),c=m.mulE(s).mulE(i),l=m.mul(1-e).mulE(o);return new ce(u,c,l)}function xe(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 $.construct(o,m)}function Ce(t,e,n){const r=1-e,i=t/Math.sqrt(ct(n.x)+ct(n.y)+ct(n.z)/r);return n.mul(i)}function Ee(t,e,n,r,i){const s=pe(t,e,n),o=pe(t,e,r);return xe(t,e,M.lerp(s,o,i))}function Se(t,e,n){const r=new M;return r.setCrossProductVector(e,n),Math.abs(Math.atan2(r.length(),e.dotProduct(n)))*t}function be(t,e,n,r,i){const s=n.getUnitVector(),o=r.getUnitVector(),a=e.getUnitVector(),m=new M;if(m.setCrossProductVector(s,o),!m.isZero()){m.normalizeThis();const e=a.sub(m.mul(m.dotProduct(a)));if(!e.isZero()){e.normalizeThis();const n=s.add(o).mul(.5);if(n.dotProduct(e)>n.dotProduct(s)){const n=Math.abs(m.dotProduct(a)),r=Math.asin(n);return i.assign(e.getUnitVector().mul(t)),r*t}}}const u=Se(1,s,a),c=Se(1,o,a);return u<=c?(i.assign(n),u*t):(i.assign(r),c*t)}function we(t,e,n,r){const i={stack:[],error:void 0,hasError:!1};try{const s=Mt(i,new mu,!1);return fu.geodeticDistance(t,e,n.x,n.y,r.x,r.y,s,null,null,cu.PE_LINETYPE_GEODESIC),s.val}catch(s){i.error=s,i.hasError=!0}finally{At(i)}}function Te(t,e,r,i,s){switch(n(r.isFinite()&&i.isFinite()),s){case 0:return we(t,e,r,i);case 1:return De(t,e,r);case 2:case 3:{const n=pe(t,e,r),s=pe(t,e,i);return M.distance(n,s)}default:m("")}}function Ie(t,e,n,r,i,s=0,o){if(2===s||3===s)return ve(t,e,n,r,i,3===s,o);const a=xe(t,e,n),m=n=>{const o=xe(t,e,M.lerp(r,i,n));return Te(t,e,a,o,s)},u=M.distance(r,i);if(u>0){const n=Le(t,u),{first:s,second:a}=ge(m,0,1,n);return o&&o.assign(Ce(t,e,M.lerp(r,i,s))),tt(s,a)}{const t=m(0);return o&&o.assign(r),tt(.5,t)}}function ve(t,e,n,r,i,s=!1,o){const a=Ce(t,e,n);if(s){const s=new le({pt0:new M(0,0,0),pt1:r,pt2:i}),m=s.closestCoordinate(n),u=s.closestCoordinate(r),c=s.closestCoordinate(i),l=$.getClosestCoordinate(u,c,m),h=Ce(t,e,M.lerp(r,i,l)),g=M.distance(h,a);return o&&o.assign(h),tt(l,g)}const m=n=>{const s=Ce(t,e,M.lerp(r,i,n));return M.distance(s,a)},u=M.distance(r,i);if(u>0){const n=Le(t,u),{first:s,second:a}=ge(m,0,1,n);return o&&o.assign(Ce(t,e,M.lerp(r,i,s))),tt(s,a)}{const t=M.distance(n,r);return o&&o.assign(n),tt(.5,t)}}function De(t,e,n,r){const i={stack:[],error:void 0,hasError:!1};try{const r=Mt(i,new mu,!1);return fu.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{At(i)}}function Ge(t,e,n,r,i){if(Math.abs(n.x-r.x)>Math.PI)return Number.NaN;if(Math.abs(n.y)>ft||Math.abs(r.y)>ft)return Number.NaN;if((Math.abs(n.y)===ft||Math.abs(r.y)===ft)&&n.x!==r.x)return Number.NaN;const{first:s,second:o}=Dt(n.x,r.x);let a=i;a=_e(a,s,o);if(!nt.construct(n.x,r.x).containsCoordinate(a))return Number.NaN;const m=v.constructPoint2D(n),u=v.constructPoint2D(r),c=Pe(1,e,m),l=Pe(1,e,u),h=c.crossProductVector(l);if(h.z.isZero()){return n.y}const g=h.x.divE(h.z.negate()),_=h.y.divE(h.z.negate()),p=g.mulE(g).addE(_.mulE(_)).sqrt();if(p.isZero()||g.isZero()&&_.isZero()){return n.y}const f=Math.atan2(_.value(),g.value());let d=Math.atan2(p.value()*Math.cos(f-a),1-e);const y=pe(1,e,$.construct(a,d)),P=M.construct(y.x,y.y,-y.z),x=h.value().dotProduct(y),C=h.value().dotProduct(P);return Math.abs(C)<Math.abs(x)&&(d=-d),d}function Ne(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)>ft||Math.abs(r.y)>ft)return 0;if((Math.abs(n.y)===ft||Math.abs(r.y)===ft)&&n.x!==r.x)return 0;if(Math.abs(i)>=ft)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=v.constructPoint2D(n),a=v.constructPoint2D(r),m=Pe(1,e,o),u=Pe(1,e,a),c=m.crossProductVector(u);if(c.z.isZero()){return nt.construct(n.y,r.y).containsCoordinate(i)?(s[0]=n.x,1):0}const l=c.x.divE(c.z.negate()),h=c.y.divE(c.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 p=Math.acos(_),f=Math.atan2(h.value(),l.value()),d=f-p;let y=f+p;const P=Math.min(n.x,r.x),x=Math.max(n.x,r.x);_e(d,P,x),0!==i?_e(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 Me(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]),n(e[0]>=.5*-Math.PI&&e[0]<=.5*Math.PI)}function Ae(t,e){return t*Math.sqrt(1-e)}function qe(t){return 1-t}function Re(t,e,n,r,i){r=Pt(r,-ft,ft),i=Pt(i,-ft,ft);const s=ft-.03;let o;o=r>s&&i>s||r<-s&&i<-s?Ye(t,r,i):Ue(t,i)-Ue(t,r);return.5*(n-e)*o*qe(t)}function Ye(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=ct(e)/(t-1);for(let t=o.length-1;t>=0;--t)n=o[t]+n*r;return n*=-ct(e/(1-t)),n},m=a(ft-e);return(a(ft-n)-m)*r}{const t=ft-e,i=ft-n,s=-4*ct(Math.sin(t/2));return(-4*ct(Math.sin(i/2))-s)*r}}function Ue(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*lt(e*n)}return r+i}function Oe(t,e){return t/Math.sqrt(1-e)}function Xe(t,e){return(1-e)*t}function Fe(t,e,n){const r=n/(2*Xe(t,e)),i=r*r;return n*(1-i*(.16666666666666666-.008333333333333333*i))}function Le(t,e){if(0!==e){const n=t*Gt()/e;return Math.min(n,1e-10)}return 0}function He(n,r,i,s,a,m=!0){switch(je(s)){case 0:break;case 1:e("relation string length has to be 9 characters");break;default:e("relation string")}if(m){const t=sn(s,n.getDimension(),r.getDimension());if(0!==t)return En(n,r,i,t,a)}let u=0;if("number"==typeof i)u=i;else{const e=t.constructEmpty();n.queryEnvelope(e);const s=t.constructEmpty();r.queryEnvelope(s);const o=t.constructEmpty();o.setCoords({env2D:e}),o.mergeEnvelope2D(s),u=R(i,o,!1)}const c=fn(n,u),l=fn(r,u);if(c.isEmpty()||l.isEmpty())return rn(c,l,s);const h=c.getGeometryType(),g=l.getGeometryType();let _=!1;switch(h){case o.enumPolygon:switch(g){case o.enumPolygon:_=ke(c,l,u,s,a);break;case o.enumPolyline:_=Be(c,l,u,s,a);break;case o.enumPoint:_=Je(c,l,u,s);break;case o.enumMultiPoint:_=We(c,l,u,s,a)}break;case o.enumPolyline:switch(g){case o.enumPolygon:_=Be(l,c,u,dn(s),a);break;case o.enumPolyline:_=Ze(c,l,u,s,a);break;case o.enumPoint:_=$e(c,l,u,s,a);break;case o.enumMultiPoint:_=Ke(c,l,u,s,a)}break;case o.enumPoint:switch(g){case o.enumPolygon:_=Je(l,c,u,dn(s));break;case o.enumPolyline:_=$e(l,c,u,dn(s),a);break;case o.enumPoint:_=en(c,l,u,s);break;case o.enumMultiPoint:_=tn(l,c,u,dn(s))}break;case o.enumMultiPoint:switch(g){case o.enumPolygon:_=We(l,c,u,dn(s),a);break;case o.enumPolyline:_=Ke(l,c,u,dn(s),a);break;case o.enumMultiPoint:_=Qe(c,l,u,s,a);break;case o.enumPoint:_=tn(c,l,u,s)}break;default:_=!1}return _}function Ve(e,n,r,i){const s=new _n;s.resetMatrix_(),s.setPredicates_("T*****F**"),s.setAreaAreaPredicates_();const o=t.constructEmpty(),a=t.constructEmpty();e.queryEnvelope(o),n.queryEnvelope(a);let m=!1;if(Tn(o,a,r)&&(s.areaAreaDisjointPredicates_(e,n),m=!0),m||In(e,n),m){return nn(s.m_matrix,s.m_scl)}let u=new C,c=u.addGeometry(e),l=u.addGeometry(n),h=null,g=0;if(e.hasNonLinearSegments()||n.hasNonLinearSegments()){h=new Qt;const t=u.getEnvelope2D(i),e=jt(r,t);g=Jt(e,0),kt(u,e,r,12e3,h,null,i)}Bt(u,new U(r,0).add(g),i,!1,!1);const _=u.getGeometry(l).getBoundary();if(u.filterClosePoints(0,!0,!0,!1,b),Ft(u,c,-1,!1,b,i),0===u.getPointCount(c))return!1;Ft(u,l,-1,!1,b,i),s.setEditShape_(u,i);const p=0===u.getPointCount(l);if(!p){s.computeMatrixTopoGraphHalfEdges_(c,l),s.m_topoGraph.removeShape();const t=nn(s.m_matrix,s.m_scl);if(!t)return t}const f=u.getGeometry(c);u=new C,c=u.addGeometry(f),l=u.addGeometry(_),s.setEditShape_(u,i),s.m_predicateCount=0,s.resetMatrix_(),s.setPredicates_(p?"T*****F**":"******F**"),s.setAreaLinePredicates_(),s.computeMatrixTopoGraphHalfEdges_(c,l),s.m_topoGraph.removeShape();return nn(s.m_matrix,s.m_scl)}function ze(e,n,r,i){const s=new _n;s.resetMatrix_(),s.setPredicates_("T*****F**"),s.setAreaLinePredicates_();const o=t.constructEmpty(),a=t.constructEmpty();e.queryEnvelope(o),n.queryEnvelope(a);let m=!1;if(Tn(o,a,r)&&(s.areaLineDisjointPredicates_(e,n),m=!0),m||In(e,n),m){return nn(s.m_matrix,s.m_scl)}const u=new C,c=u.addGeometry(e),l=u.addGeometry(n);if(s.setEditShapeCrackAndCluster_(u,new U(r,0),i),0===u.getPointCount(c))return!1;s.computeMatrixTopoGraphHalfEdges_(c,l),s.m_topoGraph.removeShape();return nn(s.m_matrix,s.m_scl)}function je(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 ke(e,n,r,i,s){const o=new _n;o.resetMatrix_(),o.setPredicates_(i),o.setAreaAreaPredicates_();const a=t.constructEmpty(),m=t.constructEmpty();e.queryEnvelope(a),n.queryEnvelope(m);let u=!1;if(Tn(a,m,r)&&(o.areaAreaDisjointPredicates_(e,n),u=!0),u||In(e,n),!u){const t=new C,i=t.addGeometry(e),a=t.addGeometry(n);o.setEditShapeCrackAndCluster_(t,new U(r,0),s),o.computeMatrixTopoGraphHalfEdges_(i,a),o.m_topoGraph.removeShape()}return nn(o.m_matrix,o.m_scl)}function Be(e,n,r,i,s){const o=new _n;o.resetMatrix_(),o.setPredicates_(i),o.setAreaLinePredicates_();const a=t.constructEmpty(),m=t.constructEmpty();e.queryEnvelope(a),n.queryEnvelope(m);let u=!1;if(Tn(a,m,r)&&(o.areaLineDisjointPredicates_(e,n),u=!0),u||In(e,n),!u){const t=new C,i=t.addGeometry(e),a=t.addGeometry(n);o.setEditShapeCrackAndCluster_(t,new U(r,0),s),o.m_clusterIndexB=o.m_topoGraph.createUserIndexForClusters(),gn(a,o.m_topoGraph,o.m_clusterIndexB),o.computeMatrixTopoGraphHalfEdges_(i,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexB),o.m_topoGraph.removeShape()}return nn(o.m_matrix,o.m_scl)}function We(e,n,r,i,s){const o=new _n;o.resetMatrix_(),o.setPredicates_(i),o.setAreaPointPredicates_();const a=t.constructEmpty(),m=t.constructEmpty();e.queryEnvelope(a),n.queryEnvelope(m);let u=!1;if(Tn(a,m,r)&&(o.areaPointDisjointPredicates_(e),u=!0),u||In(e,n),!u){const t=new C,i=t.addGeometry(e),a=t.addGeometry(n);o.setEditShapeCrackAndCluster_(t,new U(r,0),s),o.computeMatrixTopoGraphClusters_(i,a),o.m_topoGraph.removeShape()}return nn(o.m_matrix,o.m_scl)}function Ze(e,n,r,i,s){const o=new _n;o.resetMatrix_(),o.setPredicates_(i),o.setLineLinePredicates_();const a=t.constructEmpty(),m=t.constructEmpty();e.queryEnvelope(a),n.queryEnvelope(m);let u=!1;if(Tn(a,m,r)&&(o.lineLineDisjointPredicates_(e,n),u=!0),u||In(e,n),!u){const t=new C,i=t.addGeometry(e),a=t.addGeometry(n);o.setEditShapeCrackAndCluster_(t,new U(r,0),s),o.m_clusterIndexA=o.m_topoGraph.createUserIndexForClusters(),o.m_clusterIndexB=o.m_topoGraph.createUserIndexForClusters(),gn(i,o.m_topoGraph,o.m_clusterIndexA),gn(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 nn(o.m_matrix,o.m_scl)}function Ke(e,n,r,i,s){const o=new _n;o.resetMatrix_(),o.setPredicates_(i),o.setLinePointPredicates_();const a=t.constructEmpty(),m=t.constructEmpty();e.queryEnvelope(a),n.queryEnvelope(m);let u=!1;if(Tn(a,m,r)&&(o.linePointDisjointPredicates_(e),u=!0),u||In(e,n),!u){const t=new C,i=t.addGeometry(e),a=t.addGeometry(n);o.setEditShapeCrackAndCluster_(t,new U(r,0),s),o.m_clusterIndexA=o.m_topoGraph.createUserIndexForClusters(),gn(i,o.m_topoGraph,o.m_clusterIndexA),o.computeMatrixTopoGraphClusters_(i,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexA),o.m_topoGraph.removeShape()}return nn(o.m_matrix,o.m_scl)}function Qe(e,n,r,i,s){const o=new _n;o.resetMatrix_(),o.setPredicates_(i),o.setPointPointPredicates_();const a=new t,m=new t;e.queryEnvelope(a),n.queryEnvelope(m);let u=!1;if(Tn(a,m,r)&&(o.pointPointDisjointPredicates_(),u=!0),!u){const t=new C,i=t.addGeometry(e),a=t.addGeometry(n);o.setEditShapeCrackAndCluster_(t,new U(r,0),s),o.computeMatrixTopoGraphClusters_(i,a),o.m_topoGraph.removeShape()}return nn(o.m_matrix,o.m_scl)}function Je(e,n,r,i,s){const o=new _n;o.resetMatrix_(),o.setPredicates_(i),o.setAreaPointPredicates_();const a=t.constructEmpty();e.queryEnvelope(a);const m=n.getXY();let u=!1;if(vn(m,a,r)&&(o.areaPointDisjointPredicates_(e),u=!0),!u){const n=zt(e,m,r);if(1===n)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===n){o.m_matrix[6]=-1;if(0!==e.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 n=t.constructEmpty();e.queryEnvelope(n),o.m_matrix[2]=n.height()||n.width()?1:-1}}else o.areaPointDisjointPredicates_(e)}return nn(o.m_matrix,i)}function $e(e,n,r,i,s){const o=new _n;o.resetMatrix_(),o.setPredicates_(i),o.setLinePointPredicates_();const a=t.constructEmpty();e.queryEnvelope(a);let m=!1;if(vn(n.getXY(),a,r)&&(o.linePointDisjointPredicates_(e),m=!0),!m){let t=null,i=!1,a=!1;if(o.m_performPredicates[0]||o.m_performPredicates[6]){!En(e,n,r,4,s)?(o.m_performPredicates[0]&&(t=E(e),a=!En(t,n,r,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!==t&&t.isEmpty()?o.m_matrix[3]=-1:(i||(null==t&&(t=E(e)),a=!En(t,n,r,4,s),i=!0),o.m_matrix[3]=a?0:-1)),o.m_performPredicates[5])if(null!==t&&t.isEmpty())o.m_matrix[5]=-1;else if(i&&!a)o.m_matrix[5]=0;else{null===t&&(t=E(e));const i=En(t,n,r,3,s);o.m_matrix[5]=i?-1:0}if(o.m_performPredicates[2]){if(0!==e.calculateLength2D())o.m_matrix[2]=1;else{const t=new P({vd:e.getDescription()});t.addPoints(e,0,e.getPointCount());const i=En(t,n,r,3,s);o.m_matrix[2]=i?-1:0}}}return nn(o.m_matrix,o.m_scl)}function tn(e,n,r,i,s){const o=new _n;o.resetMatrix_(),o.setPredicates_(i),o.setPointPointPredicates_();const a=t.constructEmpty();e.queryEnvelope(a);const m=n.getXY(),u=new $;let c=!1;if(vn(m,a,r)&&(o.pointPointDisjointPredicates_(),c=!0),!c){let t=!1,n=!0;const i=r*r;for(let r=0;r<e.getPointCount()&&(e.queryXY(r,u),$.sqrDistance(u,m)<=i?t=!0:n=!1,!t||n);r++);t?(o.m_matrix[0]=0,o.m_matrix[2]=n?-1:0,o.m_matrix[6]=-1):(o.m_matrix[0]=-1,o.m_matrix[2]=0,o.m_matrix[6]=0)}return nn(o.m_matrix,i)}function en(t,e,n,r,i){const s=t.getXY(),o=e.getXY(),a=ht(9,-1);$.sqrDistance(s,o)<=n*n?a[0]=0:(a[2]=0,a[6]=0),a[8]=2;return nn(a,r)}function nn(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 rn(e,n,r){const i=ht(9,-1);if(e.isEmpty()&&n.isEmpty())return nn(i,r);let s,a=!1;e.isEmpty()?(s=n,a=!0):s=e,i[0]=-1,i[1]=-1,i[3]=-1,i[4]=-1,i[6]=-1,i[7]=-1,i[8]=2;const m=s.getGeometryType();if(l(m))if(m===o.enumPolygon){if(0!==s.calculateArea2D())i[2]=2,i[5]=1;else{i[5]=-1;const e=t.constructEmpty();s.queryEnvelope(e),i[2]=e.height()||e.width()?1:0}}else{const t=0!==s.calculateLength2D();i[2]=t?1:0,i[5]=S(s)?0:-1}else i[2]=0,i[5]=-1;return a&&pn(i),nn(i,r)}function sn(t,e,n){return on(t)?3:an(t)?4:mn(t,e,n)?8:un(t,e,n)?16:ln(t)?64:cn(t)?1:hn(t,e,n)?32:0}function on(t){return"T*F**FFF*"===t}function an(t){return"FF*FF****"===t}function mn(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 un(t,e,n){return e>n?"T*****T**"===t:1===e&&1===n&&"0********"===t}function cn(t){return"T*****FF*"===t}function ln(t){return"T**FF*FF*"===t}function hn(t,e,n){return e===n&&(1!==e?"T*T***T**"===t:"1*T***T**"===t)}function gn(t,e,n){const r=e.getGeometryID(t);for(let i=e.getFirstCluster();i!==b;i=e.getNextCluster(i)){if(!(e.getClusterParentage(i)&r))continue;const t=e.getClusterHalfEdge(i);if(t===b){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 _n{nullFunc(){return c("should not be called"),!1}constructor(){this.m_clusterIndexA=-1,this.m_clusterIndexB=-1,this.m_visitedIndex=-1,this.m_topoGraph=new Xt,this.m_matrix=ht(9,0),this.m_maxDim=ht(9,0),this.m_performPredicates=ht(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_(e,n,r,i,s){const o=-1!==n,a=-1!==i;if(o||a){if(!("T"!==r&&"F"!==r&&o||"T"!==s&&"F"!==s&&a)||0!==e.calculateArea2D())o&&(this.m_matrix[n]=2),a&&(this.m_matrix[i]=1);else if(a&&(this.m_matrix[i]=-1),o){const r=t.constructEmpty();e.queryEnvelope(r),this.m_matrix[n]=r.height()||r.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),pn(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=S(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=S(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=S(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=S(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=S(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!==b;s=this.m_topoGraph.getNextCluster(s)){const t=this.m_topoGraph.getClusterHalfEdge(s);if(t===b){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!==b&&(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 Qt,s=t.getEnvelope2D(n),o=jt(e.total(),s);r=Jt(o,0),kt(t,o,e.total(),12e3,i,null,n),i.clearStitcher(t)}Bt(t,e.add(r),n,!1,!1),t.filterClosePoints(0,!0,!0,!1,b);for(let i=t.getFirstGeometry();i!==b;i=t.getNextGeometry(i))t.getGeometryType(i)===o.enumPolygon&&Ft(t,i,-1,!1,b,n);this.setEditShape_(t,n)}}function pn(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 fn(e,n,r){const i=e.getGeometryType();if(a(i)){const t=new d({vd:e.getDescription()});return t.addSegment(e,!0),t}if(i===o.enumEnvelope){const r=e,i=t.constructEmpty();if(e.queryEnvelope(i),i.height()<=n&&i.width()<=n){const t=new A({vd:e.getDescription()});return r.getCenter(t),t}if(i.height()<=n||i.width()<=n){const t=new d({vd:e.getDescription()}),n=new A;return r.queryCornerByVal(0,n),t.startPathPoint(n),r.queryCornerByVal(2,n),t.lineToPoint(n),t}const s=new f({vd:e.getDescription()});return s.addEnvelope(r,!1),s}return e}function dn(t){return`${t[0]}${t[3]}${t[6]}${t[1]}${t[4]}${t[7]}${t[2]}${t[5]}${t[8]}`}class yn{nullFunc(){return c("should not be called"),!1}constructor(e,n,r,i=!1){this.m_bDone=!1,this.m_tolerance=0,this.m_elementHandle=-1,this.m_query=t.constructEmpty(),this.m_envInter=t.constructEmpty(),this.m_quadTree=null,this.m_intersector=null,this.m_function=this.nullFunc;const s=e.getAccelerators();let o=null;null!=s&&(o=i?s.getQuadTreeForPaths():s.getQuadTree());const a=n.getAccelerators();let m=null;if(null!=a&&(m=i?a.getQuadTreeForPaths():a.getQuadTree()),null===o&&null===m&&!i){const i=e.getPointCount(),s=n.getPointCount();if(i>10&&s>10){const a=t.constructEmpty(),u=t.constructEmpty(),c=t.constructEmpty();e.queryLooseEnvelope(a),n.queryLooseEnvelope(u),a.inflateCoords(r,r),u.inflateCoords(r,r),c.setCoords({env2D:a}),c.intersect(u),i>=s?o=l(e.getGeometryType())?O(e,c):j(e,c):m=l(n.getGeometryType())?O(n,c):j(n,c)}}this.construct_(e,o,n,m,r,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):l(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?l(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||h(""),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||h(""),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_(e,n,r,i,s,a){const m=t.constructEmpty(),u=t.constructEmpty();e.queryLooseEnvelope(m),r.queryLooseEnvelope(u),m.inflateCoords(s,s),u.inflateCoords(s,s),this.m_envInter.setCoords({env2D:m}),this.m_envInter.intersect(u),this.m_multiVertexImplA=e,this.m_multiVertexImplB=r;const c=e.getGeometryType(),h=r.getGeometryType();this.m_bPaths=a,this.m_pathIndex=-1,this.m_pointIndex=-1,this.m_bSwapElements=!1,this.m_queryType=o.enumUnknown,this.m_bQuadTree=!1,null!==n&&(this.m_bDone=!1,this.m_tolerance=s,this.m_quadTree=n,this.m_qtIter=this.m_quadTree.getIteratorForQT(),this.m_bQuadTree=!0,this.m_bSwapElements=!0,l(h)?(this.m_queryType=h,this.m_function=this.nextPath_,a?this.m_pathIndex=r.getPathCount():this.m_segIter=r.querySegmentIterator()):(this.m_queryType=h,this.m_function=this.nextPoint_,this.m_pointIndex=r.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,l(c)?(this.m_queryType=c,this.m_function=this.nextPath_,a?this.m_pathIndex=e.getPathCount():this.m_segIter=e.querySegmentIterator()):(this.m_queryType=c,this.m_function=this.nextPoint_,this.m_pointIndex=e.getPointCount())),this.m_bQuadTree||(a&&l(c)&&l(h)?this.m_intersector=Z(e,r,s):l(c)&&l(h)?(this.m_intersector=k(e,r,s),this.m_bSwapElements=!1):l(c)&&!l(h)?(this.m_intersector=B(e,r,s),this.m_bSwapElements=!1):!l(c)&&l(h)?(this.m_intersector=B(r,e,s),this.m_bSwapElements=!0):(this.m_intersector=W(e,r,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 e=this.m_segIter.nextSegment(),n=new t;return e.queryLooseEnvelope(n),!n.isIntersecting(this.m_envInter)||(this.m_qtIter.resetIterator(e,this.m_tolerance),this.m_function=this.iterate_,!0)}nextPoint_(){if(-1==--this.m_pointIndex)return this.m_bDone=!0,!1;const e=new $;if(this.m_bSwapElements){const t=this.m_multiVertexImplB.getXY(this.m_pointIndex);e.setCoordsPoint2D(t)}else{const t=this.m_multiVertexImplA.getXY(this.m_pointIndex);e.setCoordsPoint2D(t)}return!this.m_envInter.contains(e)||(this.m_qtIter.resetIterator(t.construct(e.x,e.y,e.x,e.y),this.m_tolerance),this.m_function=this.iterate_,!0)}iterate_(){return this.m_elementHandle=this.m_qtIter.next(),-1===this.m_elementHandle&&(l(this.m_queryType)?(this.m_function=this.m_bPaths?this.nextPath_:this.nextSegment_,!0):(this.m_function=this.nextPoint_,!0))}}function Pn(t){return 2===t?1:1===t?2:128===t?64:64===t?128:t}function xn(e,n,r){let i;if(e instanceof jm||null===e){const s=t.constructEmpty();s.setCoords({pt:n}),s.mergeEnvelope2D(r),i=R(e,s,!1)}else i=e;return i}function Cn(e,n,r){let i;if(e instanceof jm||null===e){const s=t.constructEmpty();s.setCoords({env2D:n}),s.mergeEnvelope2D(r),i=R(e,s,!1)}else i=e;return i}function En(e,n,r,s,m){if(e.isEmpty()||n.isEmpty())return 4===s;i(e),i(n);let u=e.getGeometryType(),c=n.getGeometryType();if(u===o.enumEnvelope){if(c===o.enumEnvelope)return Sn(e,n,r,s);if(c===o.enumPoint)return bn(n,e,r,Pn(s))}else if(u===o.enumPoint){if(c===o.enumEnvelope)return bn(e,n,r,s);if(c===o.enumPoint)return wn(e,n,r,s)}const l=t.constructEmpty();e.queryEnvelope(l);const h=t.constructEmpty();n.queryEnvelope(h);const g=Cn(r,l,h);if(Tn(l,h,g))return 4===s;let _=!1,p=null,f=null,y=null,P=null;switch(a(u)?(p=new d({vd:e.getDescription()}),p.addSegment(e,!0),y=p,u=o.enumPolyline):y=e,a(c)?(f=new d({vd:n.getDescription()}),f.addSegment(n,!0),P=f,c=o.enumPolyline):P=n,u!==o.enumEnvelope&&c!==o.enumEnvelope?(y.getDimension()<P.getDimension()||u===o.enumPoint&&c===o.enumMultiPoint)&&(s=Pn(s)):u!==o.enumPolygon&&c!==o.enumEnvelope&&(s=Pn(s)),u){case o.enumPolygon:switch(c){case o.enumPolygon:_=Dn(y,P,g,s,m);break;case o.enumPolyline:_=Gn(y,P,g,s,m);break;case o.enumPoint:_=Nn(y,P,g,s);break;case o.enumMultiPoint:_=Mn(y,P,g,s);break;case o.enumEnvelope:_=An(y,P,g,s,m)}break;case o.enumPolyline:switch(c){case o.enumPolygon:_=Gn(P,y,g,s,m);break;case o.enumPolyline:_=qn(y,P,g,s,m);break;case o.enumPoint:_=Rn(y,P,g,s);break;case o.enumMultiPoint:_=Yn(y,P,g,s);break;case o.enumEnvelope:_=Un(y,P,g,s,m)}break;case o.enumPoint:switch(c){case o.enumPolygon:_=Nn(P,y,g,s);break;case o.enumPolyline:_=Rn(P,y,g,s);break;case o.enumMultiPoint:_=Xn(P,y,g,s)}break;case o.enumMultiPoint:switch(c){case o.enumPolygon:_=Mn(P,y,g,s);break;case o.enumPolyline:_=Yn(P,y,g,s);break;case o.enumMultiPoint:_=On(y,P,g,s);break;case o.enumPoint:_=Xn(y,P,g,s);break;case o.enumEnvelope:_=Fn(y,P,g,s)}break;case o.enumEnvelope:switch(c){case o.enumPolygon:_=An(P,y,g,s,m);break;case o.enumPolyline:_=Un(P,y,g,s,m);break;case o.enumMultiPoint:_=Fn(P,y,g,s)}}return _}function Sn(e,n,r,i,s){if(e.isEmpty()||n.isEmpty())return 4===i;const o=t.constructEmpty();e.queryEnvelope(o);const a=t.constructEmpty();n.queryEnvelope(a);const m=Cn(r,o,a);switch(i){case 4:return Tn(o,a,m);case 2:return Jr(a,o,m,!1);case 128:return Jr(a,o,m,!0);case 1:return Jr(o,a,m,!1);case 64:return Jr(o,a,m,!0);case 3:return Zr(o,a,m);case 8:return Kr(o,a,m);case 32:return Qr(o,a,m);case 16:return!1}return!1}function bn(e,n,r,i,s){if(e.isEmpty()||n.isEmpty())return 4===i;const o=e.getXY(),a=t.constructEmpty();n.queryEnvelope(a);const m=xn(r,o,a);switch(i){case 4:return vn(o,a,m);case 2:case 128:return Wr(o,a,m);case 1:case 64:return!1;case 3:return kr(o,a,m);case 8:return Br(o,a,m)}return!1}function wn(e,n,r,i,s){if(e.isEmpty()||n.isEmpty())return 4===i;const o=e.getXY(),a=n.getXY();let m;if(r instanceof jm||null===r){const e=t.constructEmpty();e.setCoords({pt:o}),e.merge(a),m=R(r,e,!1)}else m=r;switch(i){case 4:return zr(o,a,m);case 2:case 128:return jr(a,o,m);case 1:case 64:return jr(o,a,m);case 3:return Vr(o,a,m)}return!1}function Tn(e,n,r){const i=t.constructEmpty();return i.setCoords({env2D:n}),i.inflateCoords(r,r),!e.isIntersecting(i)}function In(t,e,r,i=!1){const s=t.getGeometryType(),o=e.getGeometryType();if(u(s)){const e=t.getImpl().getAccelerators();if(null!==e){const t=e.getRasterizedGeometry();n(null===t)}}if(u(o)){const t=e.getImpl().getAccelerators();if(null!==t){const e=t.getRasterizedGeometry();n(null===e)}}return 0}function vn(e,n,r,i){const s=t.constructEmpty();return s.setCoords({env2D:n}),s.inflateCoords(r,r),!s.contains(e)}function Dn(t,e,n,r,i){switch(r){case 4:return Hn(t,e,n);case 2:return jn(e,t,n,i);case 128:return kn(e,t,n);case 1:return jn(t,e,n,i);case 64:return kn(t,e,n);case 3:return Ln(t,e,n,i);case 8:return Vn(t,e,n);case 32:return zn(t,e,n,i)}return!1}function Gn(t,e,n,r,i){switch(r){case 4:return Bn(t,e,n);case 1:return Kn(t,e,n,i);case 64:return Qn(t,e,n);case 8:return Wn(t,e,n,i);case 16:return Zn(t,e,n)}return!1}function Nn(t,e,n,r,i){switch(r){case 4:return Jn(t,e,n);case 1:case 64:return tr(t,e,n);case 8:return $n(t,e,n)}return!1}function Mn(t,e,n,r,i){switch(r){case 4:return er(t,e,n);case 1:return ir(t,e,n,!1);case 64:return ir(t,e,n,!0);case 8:return nr(t,e,n);case 16:return rr(t,e,n)}return!1}function An(t,e,n,r,i){if(or(t,e,n))return 4===r;if(4===r)return!1;switch(r){case 2:return ur(t,e,n,!1);case 128:return ur(t,e,n,!0);case 1:return cr(t,e,n,!1,i);case 64:return cr(t,e,n,!0,i);case 3:return sr(t,e,n,i);case 8:return ar(t,e,n,i);case 32:return mr(t,e,n,i);case 16:return!1}return!1}function qn(t,e,n,r,i){switch(r){case 4:return hr(t,e,n);case 2:return fr(e,t,n,i);case 128:return dr(e,t,n,i);case 1:return fr(t,e,n,i);case 64:return dr(t,e,n,i);case 3:return lr(t,e,n,i);case 8:return gr(t,e,n,i);case 32:return pr(t,e,n,i);case 16:return _r(t,e,n,i)}return!1}function Rn(t,e,n,r,i){switch(r){case 4:return yr(t,e,n);case 1:case 64:return xr(t,e,n);case 8:return Pr(t,e,n)}return!1}function Yn(t,e,n,r,i){switch(r){case 4:return Cr(t,e,n);case 1:case 64:return br(t,e,n);case 8:return Er(t,e,n);case 16:return Sr(t,e,n)}return!1}function Un(t,e,n,r,i){if(Tr(t,e,n))return 4===r;if(4===r)return!1;switch(r){case 2:return vr(t,e,n,!1);case 128:return vr(t,e,n,!0);case 1:case 64:case 32:return!1;case 3:return wr(t,e,n);case 8:return Ir(t,e,n,i);case 16:return Dr(t,e,n)}return!1}function On(t,e,n,r,i){switch(r){case 4:return Nr(t,e,n);case 2:case 128:return Ar(e,t,n);case 1:case 64:return Ar(t,e,n);case 3:return Gr(t,e,n);case 32:return Mr(t,e,n)}return!1}function Xn(t,e,n,r,i){switch(r){case 4:return Rr(t,e,n);case 2:case 128:return Yr(t,e,n);case 1:case 64:return Ur(t,e,n);case 3:return qr(t,e,n)}return!1}function Fn(t,e,n,r,i){switch(r){case 4:return Xr(t,e,n);case 2:return Lr(t,e,n,!1);case 128:return Lr(t,e,n,!0);case 1:case 64:return!1;case 3:return Or(t,e,n);case 8:return Fr(t,e,n);case 16:return Hr(t,e,n)}return!1}function Ln(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();if(e.queryEnvelope(s),n.queryEnvelope(o),!Zr(s,o,r))return!1;if(In(e,n),si(e,n,r))return!0;const a=e.calculateLength2D(),m=n.calculateLength2D(),u=Math.max(e.getPointCount(),n.getPointCount());if(Math.abs(a-m)>4*u*r)return!1;if(e.hasNonLinearSegments()||n.hasNonLinearSegments()){return He(e,n,r,"**F**FFF*",i,!1)}return mi(e,n,r,!0)}function Hn(t,e,n,r){In(t,e,n,!0);return 1===$r(t,e,n,!0)}function Vn(t,e,n,r){return In(t,e),fi(t,e,n,null)}function zn(t,e,n,r){return In(t,e),di(t,e,n,r)}function jn(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();return e.queryEnvelope(s),n.queryEnvelope(o),!!ni(s,o,r)&&(In(e,n),yi(e,n,r,i))}function kn(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();return e.queryEnvelope(s),n.queryEnvelope(o),!!ni(s,o,r)&&(In(e,n),2===$r(e,n,r,!1))}function Bn(t,e,n,r){In(t,e,n,!0);return 1===$r(t,e,n,!0)}function Wn(t,e,n,r){return In(t,e),Pi(t,e,n,r)}function Zn(t,e,n,r){return In(t,e),xi(t,e,n,null)}function Kn(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();return e.queryEnvelope(s),n.queryEnvelope(o),!!ni(s,o,r)&&(In(e,n),Ci(e,n,r,i))}function Qn(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();return e.queryEnvelope(s),n.queryEnvelope(o),!!ni(s,o,r)&&(In(e,n),2===$r(e,n,r,!1))}function Jn(t,e,n,r){return 0===Wt(t,e,n)}function $n(t,e,n,r){return Si(t,e.getXY(),n)}function tr(t,e,n,r){return Ei(t,e.getXY(),n)}function er(t,e,n,r,i){In(t,e);return 1===ti(t,e,n)}function nr(e,n,r,i){In(e,n);const s=t.constructEmpty();e.queryEnvelope(s),s.inflateCoords(r,r);const o=new $;let a=!1;const m=e.getImpl(),u=new f;let c=e,l=!1;for(let t=0;t<n.getPointCount();t++){if(n.queryXY(t,o),s.contains(o)){const t=zt(c,o,r);if(2===t)a=!0;else if(1===t)return!1}l||(!Zt(e,n.getPointCount()-1)||null!==m.getAccelerators()&&null!==m.getAccelerators().getQuadTree()?c=e:(e.copyTo(u),u.getImpl().buildQuadTreeAccelerator(1),c=u),l=!0)}return!!a}function rr(e,n,r,i){In(e,n);const s=new t,o=new t,a=new t;e.queryEnvelope(s),n.queryEnvelope(a),o.setCoords({env2D:s}),o.inflateCoords(r,r);let m=!1,u=!1;const c=new $,l=e.getImpl(),h=new f;let g=e,_=!1;for(let t=0;t<n.getPointCount();t++){if(n.queryXY(t,c),o.contains(c)){const t=zt(g,c,r);0===t?u=!0:1===t&&(m=!0)}else u=!0;if(m&&u)return!0;_||(!Zt(e,n.getPointCount()-1)||null!==l.getAccelerators()&&null!==l.getAccelerators().getQuadTree()?g=e:(e.copyTo(h),h.getImpl().buildQuadTreeAccelerator(1),g=h),_=!0)}return!1}function ir(e,n,r,i,s){const o=t.constructEmpty(),a=t.constructEmpty();if(e.queryEnvelope(o),n.queryEnvelope(a),!ni(o,a,r))return!1;In(e,n);let m=!1;const u=new $,c=e.getImpl(),l=new f;let h=e,g=!1;for(let t=0;t<n.getPointCount();t++){if(n.queryXY(t,u),!o.contains(u))return!1;const s=zt(h,u,r);if(1===s)m=!0;else if(0===s)return!1;if(i&&2===s)return!1;g||(!Zt(e,n.getPointCount()-1)||null!==c.getAccelerators()&&null!==c.getAccelerators().getQuadTree()?h=e:(e.copyTo(l),l.getImpl().buildQuadTreeAccelerator(1),h=l),g=!0)}return m}function sr(e,n,r,i){const s=new t,o=new t;if(e.queryEnvelope(s),n.queryEnvelope(o),!Zr(s,o,r))return!1;const a=new f;return a.addEnvelope(n,!1),Ln(e,a,r,i)}function or(e,n,r,i){In(e,n);const s=t.constructEmpty(),o=t.constructEmpty();if(e.queryEnvelope(s),n.queryEnvelope(o),ni(o,s,r))return!1;const a=o.getLowerLeft();return 0===zt(e,a,0)&&(!o.contains(e.getXY(0))&&!pi(e,o,r))}function ar(e,n,r,i){In(e,n);const s=new t,o=new t;if(e.queryEnvelope(s),n.queryEnvelope(o),ni(o,s,r))return!1;if(o.height()<=r||o.width()<=r)return!1;const a=new f;return a.addEnvelope(n,!1),fi(e,a,r,i)}function mr(e,n,r,i){In(e,n);const s=new t,o=new t;if(e.queryEnvelope(s),n.queryEnvelope(o),ni(o,s,r))return!1;if(o.height()<=r||o.width()<=r)return!1;const a=new f;return a.addEnvelope(n,!1),di(e,a,r,i)}function ur(e,n,r,i,s){const o=t.constructEmpty(),a=t.constructEmpty();return e.queryEnvelope(o),n.queryEnvelope(a),i?ri(a,o,r):ni(a,o,r)}function cr(e,n,r,i,s){const o=t.constructEmpty(),a=t.constructEmpty();if(e.queryEnvelope(o),n.queryEnvelope(a),!ni(o,a,r))return!1;In(e,n);const m=new f;return m.addEnvelope(n,!1),i?2===$r(e,m,r,!1):yi(e,m,r,s)}function lr(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();if(e.queryEnvelope(s),n.queryEnvelope(o),!Zr(s,o,r))return!1;if(In(e,n),si(e,n,r))return!0;if(e.hasNonLinearSegments()||n.hasNonLinearSegments()){return He(e,n,r,"**F**FFF*",i,!1)}return mi(e,n,r,!1)}function hr(t,e,n,r){In(t,e);const i=t.getImpl(),s=e.getImpl();return!new yn(i,s,n,!0).next()||!ci(t,e,n)}function gr(e,n,r,i){In(e,n);const s=[],o=li(e,n,r,s);if(-2===o){const s=t.constructEmpty(),o=t.constructEmpty(),a=t.constructEmpty();let m,u;if(e.queryEnvelope(s),n.queryEnvelope(o),s.inflateCoords(1e3*r,1e3*r),o.inflateCoords(1e3*r,1e3*r),a.setCoords({env2D:s}),a.intersect(o),e.getPointCount()>10){if(m=Rt(e,a,r,0,i),m.isEmpty())return!1}else m=e;if(n.getPointCount()>10){if(u=Rt(n,a,r,0,i),u.isEmpty())return!1}else u=n;return He(m,u,r,"F********",i,!1)}if(0!==o)return!1;const a=new P;for(let t=0;t<s.length;t+=2){const e=s[t],n=s[t+1];a.addXY(e,n)}const m=e.getBoundary(),u=n.getBoundary();return m.addPoints(u,0,u.getPointCount()),!m.isEmpty()&&Ar(m,a,r)}function _r(e,n,r,i){In(e,n);const s=[],o=li(e,n,r,s);if(-2===o){const s=t.constructEmpty(),o=t.constructEmpty(),a=t.constructEmpty();let m,u;if(e.queryEnvelope(s),n.queryEnvelope(o),s.inflateCoords(1e3*r,1e3*r),o.inflateCoords(1e3*r,1e3*r),a.setCoords({env2D:s}),a.intersect(o),e.getPointCount()>10){if(m=Rt(e,a,r,0,i),m.isEmpty())return!1}else m=e;if(n.getPointCount()>10){if(u=Rt(n,a,r,0,i),u.isEmpty())return!1}else u=n;return He(m,u,r,"0********",i,!1)}if(0!==o)return!1;const a=new P;for(let t=0;t<s.length;t+=2){const e=s[t],n=s[t+1];a.addXY(e,n)}const m=e.getBoundary(),u=n.getBoundary();return m.addPoints(u,0,u.getPointCount()),!!m.isEmpty()||!Ar(m,a,r)}function pr(e,n,r,i){In(e,n);const s=t.constructEmpty(),o=t.constructEmpty();e.queryEnvelope(s),n.queryEnvelope(o);const a=ii(s,o,r),m=ii(o,s,r),u=e.hasNonLinearSegments(),c=n.hasNonLinearSegments(),l=li(e,n,r,null);if(-1===l)return!1;if(1===l){if(a&&m)return!0;if(!u&&!c)return a&&!m?!ui(n,e,r,!1):m&&!a?!ui(e,n,r,!1):!ui(e,n,r,!1)&&!ui(n,e,r,!1)}const h=t.constructEmpty(),g=t.constructEmpty(),_=t.constructEmpty();let p,f;h.setCoords({env2D:s}),h.inflateCoords(1e3*r,1e3*r),g.setCoords({env2D:o}),g.inflateCoords(1e3*r,1e3*r),_.setCoords({env2D:h}),_.intersect(g);let d="";if(d+="1*",a){if(n.getPointCount()>10){if(f=Rt(n,_,r,0,i),f.isEmpty())return!1}else f=n;d+="****"}else f=n,d+="T***";if(m){if(e.getPointCount()>10){if(p=Rt(e,_,r,0,i),p.isEmpty())return!1}else p=e;d+="***"}else p=e,d+="T**";return He(p,f,r,d,i,!1)}function fr(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();if(e.queryEnvelope(s),n.queryEnvelope(o),!ni(s,o,r))return!1;if(In(e,n),e.hasNonLinearSegments()||n.hasNonLinearSegments()){return He(e,n,r,"******FF*",i,!1)}return ui(n,e,r,!1)}function dr(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();if(e.queryEnvelope(s),n.queryEnvelope(o),!ni(s,o,r))return!1;In(e,n);return He(e,n,r,"T**FF*FF*",i,!1)}function yr(t,e,n,r){In(t,e);return!gi(t,e.getXY(),n)}function Pr(t,e,n,r){In(t,e);return wi(t,e.getXY(),n)}function xr(t,e,n,r){In(t,e);return _i(t,e.getXY(),n)}function Cr(t,e,n,r){return In(t,e),!hi(t,e,n,!1)}function Er(t,e,n,r){In(t,e);const i=t.getImpl(),s=e.getImpl(),o=new P,a=new yn(i,s,n,!1),m=i.querySegmentIterator();let u=!1;for(;a.next();){const t=a.getRedElement(),e=a.getBlueElement();m.resetToVertex(t,-1);const r=m.nextSegment(),i=s.getXY(e);r.isIntersectingPoint(i,n)&&(u=!0,o.addPoint2D(i))}if(!u)return!1;const c=t.getBoundary();return!c.isEmpty()&&Ar(c,o,n)}function Sr(t,e,n,r){In(t,e);const i=t.getImpl(),s=e.getImpl(),o=s.getPointCount(),a=ht(o,!1),m=new yn(i,s,n,!1),u=i.querySegmentIterator();let c=!1;for(;m.next();){const t=m.getRedElement(),e=m.getBlueElement();u.resetToVertex(t,-1);const r=u.nextSegment(),i=s.getXY(e);r.isIntersectingPoint(i,n)&&(c=!0,a[e]=!0)}if(!c)return!1;let l=!1;for(let _=0;_<o;_++)if(!a[_]){l=!0;break}if(!l)return!1;const h=t.getBoundary();if(h.isEmpty())return!0;const g=new P;for(let _=0;_<o;_++)a[_]&&g.addPoint2D(s.getXY(_));return!Ar(h,g,n)}function br(e,n,r,i,s){const o=t.constructEmpty(),a=t.constructEmpty();if(e.queryEnvelope(o),n.queryEnvelope(a),!ni(o,a,r))return!1;In(e,n);const m=hi(e,n,r,!0);if(!m)return m;const u=e.getBoundary();return u.isEmpty()?m:!Ar(u,n,r)}function wr(e,n,r,i){const s=new t,o=new t;return e.queryEnvelope(s),n.queryEnvelope(o),!(o.height()>r&&o.width()>r)&&Zr(s,o,r)}function Tr(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();e.queryEnvelope(s),n.queryEnvelope(o);const a=Ti(o,s,r);return 0===a?!pi(e,o,r):4===a}function Ir(e,n,r,i){const s=new t,a=new t;if(e.queryEnvelope(s),n.queryEnvelope(a),a.height()<=r||a.width()<=r)return!1;const m=new t,u=new t;if(m.setCoords({env2D:a}),u.setCoords({env2D:a}),m.inflateCoords(r,r),u.inflateCoords(-r,-r),u.containsEnvelope(s)||!s.isIntersecting(m))return!1;const l=e.getImpl().querySegmentIterator();l.stripAttributes();const h=e.getImpl().getAccelerators();let g=null,_=null;null!==h&&(g=h.getQuadTree(),null!==g&&(_=g.getIterator(a,r))),_||l.nextPath()||c("relational_operations");let p=!1,d=null;const y=new $,P=new $,x=e.hasNonLinearSegments();let C=!1;for(;;){if(null!==_){const t=_.next();if(-1===t)break;l.resetToVertex(g.getElement(t),-1),d=l.nextSegment()}else{for(;!l.hasNextSegment()&&l.nextPath(););if(!l.hasNextSegment())break;d=l.nextSegment()}if(x&&d.getGeometryType()!==o.enumLine){const e=new t;if(d.queryEnvelope(e),u.containsEnvelope(e))return!1;if(m.isIntersecting(e)){C=!0;break}}else{y.assign(d.getStartXY()),P.assign(d.getEndXY());let t=u.clipLine(y,P);if(0!==t)return!1;p||(t=m.clipLine(y,P),0!==t&&(p=!0))}}if(!C)return p;const E=new f;return E.addEnvelope(a,!1),Wn(E,e,r,i)}function vr(e,n,r,i,s){const a=t.constructEmpty(),m=t.constructEmpty();if(e.queryEnvelope(a),n.queryEnvelope(m),m.height()<=r||m.width()<=r)return!1;if(i)return ri(m,a,r);if(!ni(m,a,r))return!1;const u=t.constructEmpty();u.setCoords({env2D:m}),u.inflateCoords(-r,-r);const l=t.constructEmpty();if(l.setCoords({env2D:m}),l.inflateCoords(r,r),u.containsEnvelope(a))return!0;const h=e.getImpl().querySegmentIterator();h.stripAttributes(),h.nextPath()||c("relational_operations");let g,_,p,f,d,y,P=!1;const x=e.hasNonLinearSegments();for(x&&(p=new w,f=new w,d=new w,y=new w,u.querySide(0,p),u.querySide(1,f),u.querySide(2,d),u.querySide(3,y));;){for(;!h.hasNextSegment()&&h.nextPath(););if(!h.hasNextSegment())break;const t=h.nextSegment();if(x&&t.getGeometryType()!==o.enumLine){if(t.isIntersecting(p,r)){P=!0;break}if(t.isIntersecting(f,r)){P=!0;break}if(t.isIntersecting(d,r)){P=!0;break}if(t.isIntersecting(y,r)){P=!0;break}}else{g=t.getStartXY(),_=t.getEndXY();if(0!==u.clipLine(g,_)){P=!0;break}}}return P}function Dr(e,r,i,s){const a=new t,m=new t;if(e.queryEnvelope(a),r.queryEnvelope(m),m.height()<=i||m.width()<=i)return!1;const u=new t;if(u.setCoords({env2D:m}),u.inflateCoords(i,i),u.containsEnvelope(a))return!1;const c=!0,l=new t;if(l.setCoords({env2D:m}),l.inflateCoords(-i,-i),!l.isIntersecting(a))return!1;const h=e.getImpl().querySegmentIterator();h.stripAttributes();const g=e.getImpl().getAccelerators();let _=null,p=null;if(null!==g&&(_=g.getQuadTree(),null!==_&&(p=_.getIterator(m,i))),!p){const t=h.nextPath();n(t)}let f=!1,d=null;const y=new $,P=new $;let x=null,C=null,E=null,S=null;for(e.hasNonLinearSegments()&&(x=new w,C=new w,E=new w,S=new w,l.querySide(0,x),l.querySide(1,C),l.querySide(2,E),l.querySide(3,S));;){if(null!==p){const t=p.next();if(-1===t)break;h.resetToVertex(_.getElement(t),-1),d=h.nextSegment()}else{for(;!h.hasNextSegment()&&h.nextPath(););if(!h.hasNextSegment())break;d=h.nextSegment()}if(d.getGeometryType()===o.enumLine){y.assign(d.getStartXY()),P.assign(d.getEndXY());if(0!==l.clipLine(y,P)){f=!0;break}}else{if(x.isIntersecting(d,i)){f=!0;break}if(C.isIntersecting(d,i)){f=!0;break}if(E.isIntersecting(d,i)){f=!0;break}if(S.isIntersecting(d,i)){f=!0;break}}}return f&&c}function Gr(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();return e.queryEnvelope(s),n.queryEnvelope(o),!!Zr(s,o,r)&&(!!oi(e,n,r)||ai(e,n,r,!1,!0,!1))}function Nr(t,e,n,r){const i=t,s=e,o=new yn(i,s,n,!1),a=n*n,m=new $,u=new $;for(;o.next();){const t=o.getRedElement(),e=o.getBlueElement();if(i.queryXY(t,m),s.queryXY(e,u),$.sqrDistance(m,u)<=a)return!1}return!0}function Mr(t,e,n,r){return ai(t,e,n,!1,!1,!0)}function Ar(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();return e.queryEnvelope(s),n.queryEnvelope(o),!!ni(s,o,r)&&ai(n,e,r,!0,!1,!1)}function qr(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();return e.queryEnvelope(s),n.queryEnvelope(o),Zr(s,o,r)}function Rr(t,e,n,r){return bi(t,e.getXY(),n)}function Yr(t,e,n,r){return qr(t,e,n)}function Ur(t,e,n,r){return!Rr(t,e,n)}function Or(e,n,r,i){const s=new t,o=new t;return e.queryEnvelope(s),n.queryEnvelope(o),!(o.height()>r||o.width()>r)&&Zr(s,o,r)}function Xr(e,n,r,i){const s=t.constructEmpty(),o=t.constructEmpty();if(e.queryEnvelope(s),n.queryEnvelope(o),ni(o,s,r))return!1;const a=t.constructEmpty();a.setCoords({env2D:o}),a.inflateCoords(r,r);const m=new $;for(let t=0;t<e.getPointCount();t++)if(e.queryXY(t,m),a.contains(m))return!1;return!0}function Fr(e,n,r,i){const s=new t,o=new t,a=new t;if(n.queryEnvelope(s),s.height()<=r||s.width()<=r)return!1;o.setCoords({env2D:s}),a.setCoords({env2D:s}),o.inflateCoords(r,r),a.inflateCoords(-r,-r);const m=new $;let u=!1;for(let t=0;t<e.getPointCount();t++)if(e.queryXY(t,m),o.contains(m)){if(a.containsExclusive(m))return!1;u=!0}return u}function Lr(e,n,r,i,s){const o=t.constructEmpty(),a=t.constructEmpty();if(e.queryEnvelope(o),n.queryEnvelope(a),a.height()<=r||a.width()<=r)return!1;if(i)return ri(a,o,r);if(!ni(a,o,r))return!1;let m=!1;const u=t.constructEmpty(),c=t.constructEmpty();u.setCoords({env2D:a}),c.setCoords({env2D:a}),u.inflateCoords(-r,-r),c.inflateCoords(r,r);const l=new $;for(let t=0;t<e.getPointCount();t++){if(e.queryXY(t,l),!c.contains(l))return!1;u.containsExclusive(l)&&(m=!0)}return m}function Hr(e,n,r,i){const s=new t,o=new t;if(e.queryEnvelope(s),n.queryEnvelope(o),ni(o,s,r))return!1;if(o.height()<=r||o.width()<=r)return!1;const a=new t,m=new t;a.setCoords({env2D:o}),a.inflateCoords(-r,-r),m.setCoords({env2D:o}),m.inflateCoords(r,r);const u=new $;let c=!1,l=!1;for(let t=0;t<e.getPointCount();t++)if(e.queryXY(t,u),!c&&a.containsExclusive(u)&&(c=!0),l||m.contains(u)||(l=!0),c&&l)return!0;return!1}function Vr(t,e,n,r){return $.sqrDistance(t,e)<=n*n}function zr(t,e,n,r){return $.sqrDistance(t,e)>n*n}function jr(t,e,n,r){return Vr(t,e,n)}function kr(e,n,r,i){const s=new t;return s.setCoords({pt:e}),Zr(s,n,r)}function Br(e,n,r,i){if(n.height()<=r||n.width()<=r)return!1;const s=new t,o=new t;return s.setCoords({env2D:n}),s.inflateCoords(r,r),!!s.contains(e)&&(o.setCoords({env2D:n}),o.inflateCoords(-r,-r),!o.containsExclusive(e))}function Wr(e,n,r,i){if(n.height()<=r||n.width()<=r)return!1;const s=t.constructEmpty();s.setCoords({env2D:n}),s.inflateCoords(-r,-r);return s.containsExclusive(e)}function Zr(t,e,n,r){return ni(t,e,n)&&ni(e,t,n)}function Kr(e,n,r,i){if(e.height()<=r||e.width()<=r||n.height()<=r||n.width()<=r)return!1;const s=new t;return s.setCoords({env2D:e}),s.inflateCoords(-r,-r),s.intersect(n),!(!s.isEmpty()&&s.height()>r&&s.width()>r)&&(s.setCoords({env2D:e}),s.inflateCoords(r,r),s.intersect(n),!s.isEmpty())}function Qr(e,n,r,i){if(e.height()<=r||e.width()<=r||n.height()<=r||n.width()<=r)return!1;if(ni(e,n,r))return!1;if(ni(n,e,r))return!1;const s=new t;return s.setCoords({env2D:e}),s.inflateCoords(-r,-r),s.intersect(n),!s.isEmpty()&&(s.height()>r||s.width()>r)}function Jr(e,n,r,i,s){if(e.height()<=r||e.width()<=r)return!1;if(i)return ri(e,n,r);if(!ni(e,n,r))return!1;const o=t.constructEmpty();return o.setCoords({env2D:e}),o.inflateCoords(-r,-r),o.intersect(n),!o.isEmpty()}function $r(e,n,r,i,s){const a=new $,m=new $,u=t.constructEmpty(),c=t.constructEmpty(),l=e.getImpl(),h=n.getImpl(),g=h.getGeometryType(),_=new yn(l,h,r,!0);if(!_.next())return 1;if(ci(e,n,r))return i?4:0;const p=new f;let d=e;const y=new f;let P=null;g===o.enumPolygon&&(P=n);const x=g===o.enumPolygon?ht(l.getPathCount(),!1):[],C=ht(h.getPathCount(),!1);let E=!1,S=!1,b=!1,w=!1,T=!1,I=!1;do{if(b&&T||w&&I)break;if(b&&w)break;const t=_.getRedElement(),s=_.getBlueElement();if(!C[s]&&(m.assign(n.getXY(n.getPathStart(s))),u.setCoords({env2D:_.getRedEnvelope()}),u.inflateCoords(r,r),u.contains(m))){if(0!==zt(d,m,0)){if(w=!0,i)return 4}else I=!0;C[s]=!0}if(g===o.enumPolygon&&!x[t]&&(a.assign(e.getXY(e.getPathStart(t))),c.setCoords({env2D:_.getBlueEnvelope()}),c.inflateCoords(r,r),c.contains(a))){if(0!==zt(P,a,0)){if(b=!0,i)return 4}else T=!0;x[t]=!0}if(E||(!Zt(e,n.getPathCount()-1)||null!==l.getAccelerators()&&null!==l.getAccelerators().getQuadTree()?d=e:(e.copyTo(p),p.getImpl().buildQuadTreeAccelerator(1),d=p),E=!0),g===o.enumPolygon&&!S){const t=n;!Zt(t,e.getPathCount()-1)||null!==h.getAccelerators()&&null!==h.getAccelerators().getQuadTree()?P=n:(t.copyTo(y),y.getImpl().buildQuadTreeAccelerator(1),P=y),S=!0}}while(_.next());if(!b&&!w)return 1;if(!T||!I){if(g===o.enumPolygon)for(let t=0,e=l.getPathCount();t<e;t++)if(!x[t]){T=!0;break}for(let t=0,e=h.getPathCount();t<e;t++)if(!C[t]){I=!0;break}}return b&&T||w&&I||b&&w?4:w?2:3}function ti(e,n,r,i,s){const o=t.constructEmpty();e.queryEnvelope(o),o.inflateCoords(r,r);const a=new $,m=e.getImpl(),u=new f;let c=e,l=!1,h=!1,g=!1;for(let t=0;t<n.getPointCount();t++){if(n.queryXY(t,a),o.contains(a)){const t=zt(c,a,r);if(1===t)return h=!0,4;if(2===t)return 4;g=!0}else g=!0;l||(!Zt(e,n.getPointCount()-1)||null!==m.getAccelerators()&&null!=m.getAccelerators().getQuadTree()?c=e:(e.copyTo(u),u.getImpl().buildQuadTreeAccelerator(1),c=u),l=!0)}return h?g?4:2:1}function ei(e,r,i,s,a){s[0]=!1;const m=e.getImpl(),u=r.getImpl(),c=m.querySegmentIterator(),l=u.querySegmentIterator(),h=[0,0],g=[0,0],_=new yn(m,u,i);let p=!1;for(;_.next();){const t=_.getRedElement(),e=_.getBlueElement();c.resetToVertex(t,-1),l.resetToVertex(e,-1);const n=c.nextSegment(),r=l.nextSegment();let o=0;if(Ii(n,r)?!p&&r.isIntersecting(n,i)&&(p=!0):o=r.intersect(n,null,g,h,i),0!==o&&(p=!0,1===o)){const t=h[0],e=g[0];if(t>0&&t<1&&e>0&&e<1)return s[0]=!0,!1}}if(!p){s[0]=!0;const a=t.constructEmpty();e.queryEnvelope(a),a.inflateCoords(i,i);const c=new f;let l=e,h=!1;for(let i=0,s=r.getPathCount();i<s;i++)if(r.getPathSize(i)>0){const s=t.constructEmpty();if(r.queryPathEnvelope(i,s),!a.isIntersecting(s))return!1;{const t=r.getXY(r.getPathStart(i)),e=$t(l,t,0);if(n(-1!==e),0===e)return!1}h||(!Zt(e,r.getPathCount()-1)||null!==m.getAccelerators()&&null!==m.getAccelerators().getQuadTree()?l=e:(e.copyTo(c),c.getImpl().buildQuadTreeAccelerator(1),l=c),h=!0)}if(1===e.getPathCount()||r.getGeometryType()===o.enumPolyline)return!0;const g=r,_=t.constructEmpty();g.queryEnvelope(_),_.inflateCoords(i,i);const p=new f;let d=g,y=!1;for(let r=0,i=e.getPathCount();r<i;r++)if(e.getPathSize(r)>0){const i=t.constructEmpty();if(e.queryPathEnvelope(r,i),_.isIntersecting(i)){const t=e.getXY(e.getPathStart(r)),i=$t(d,t,0);if(n(-1!==i),1===i)return!1}y||(!Zt(g,e.getPathCount()-1)||null!==u.getAccelerators()&&null!==u.getAccelerators().getQuadTree()?d=g:(g.copyTo(p),p.getImpl().buildQuadTreeAccelerator(1),d=p),y=!0)}return!0}return!1}function ni(e,n,r){const i=t.constructEmpty();return i.setCoords({env2D:e}),i.inflateCoords(r,r),i.containsEnvelope(n)}function ri(e,n,r){const i=t.constructEmpty();return i.setCoords({env2D:n}),i.inflateCoords(r,r),e.containsExclusiveEnvelope(i)}function ii(e,n,r){const i=t.constructEmpty();return i.setCoords({env2D:n}),i.inflateCoords(r,r),!i.contains(e.getLowerLeft())||(!i.contains(e.getLowerRight())||(!i.contains(e.getUpperLeft())||!i.contains(e.getUpperRight())))}function si(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 $,s=new $;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),$.sqrDistance(i,s)>a){o=!1;break}if(!o)break}return!!o}function oi(t,e,n,r){if(t.getPointCount()!==e.getPointCount())return!1;const i=new $,s=new $;let o=!0;const a=n*n;for(let m=0;m<t.getPointCount();m++)if(t.queryXY(m,i),e.queryXY(m,s),$.sqrDistance(i,s)>a){o=!1;break}return!!o}function ai(t,e,n,r,i,s,o){const a=t.getImpl(),m=e.getImpl(),u=a.getPointCount(),c=m.getPointCount(),l=ht(u,!1),h=i||s?ht(c,!1):[],g=n*n,_=new yn(a,m,n);for(;_.next();){const t=_.getRedElement(),e=_.getBlueElement(),n=a.getXY(t),r=m.getXY(e);$.sqrDistance(n,r)<=g&&(l[t]=!0,(i||s)&&(h[e]=!0))}let p=!1,f=!1;for(let P=0;P<u;P++){const t=l[P];if(p||=!t,f||=t,(i||r)&&p)return!1}if(r)return!0;let d=!1,y=!1;for(let P=0;P<c;P++){const t=h[P];if(d||=!t,y||=t,i&&d)return!1}return!!i||p&&f&&d&&y}function mi(t,e,n,r){return ui(t,e,n,r)&&ui(e,t,n,r)}function ui(e,n,i,s){if(r(e),r(n),n.isEmpty())return!1;let o=!0;const a=ht(2,Number.NaN),m=ht(2,Number.NaN),u=[],l=new Di;let h;const g=t.constructEmpty(),_=t.constructEmpty(),p=t.constructEmpty();e.queryEnvelope(g),n.queryEnvelope(_),g.inflateCoords(i,i),_.inflateCoords(i,i),p.setCoords({env2D:g}),p.intersect(_);const f=e.getImpl().querySegmentIterator(),d=n.getImpl().querySegmentIterator(),y=n.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 t=e.getPointCount(),r=n.getPointCount();t>10&&r>10&&(P=O(n.getImpl(),p))}for(null!==P&&(C=P.getIteratorForQT());f.nextPath();)for(;f.hasNextSegment();){let t=f.nextSegment();if(t.queryEnvelope(g),!g.isIntersecting(p))return o=!1,!1;if(null!==E&&(E.resetIterator(g,i),-1===E.next()))continue;let e=0,n=null;if(null!=C)C.resetIterator(t,i);else if(d.resetToFirstPath(),!d.nextPath())return o=!1,!1;do{if(e=0,null!==C){const r=C.next();if(-1===r)return o=!1,!1;d.resetToVertex(P.getElement(r),-1),n=d.nextSegment(),e=t.intersect(n,null,a,m,i)}else{for(;!d.hasNextSegment();)if(!d.nextPath())return o=!1,!1;n=d.nextSegment(),n.queryEnvelope(_),_.inflateCoords(i,i),g.isIntersecting(_)&&(e=t.intersect(n,null,a,m,i))}}while(2!==e||0!==a[0]||s&&!(m[0]<=m[1]));let r=Number.NaN,y=!1;do{let s=!1;if(1===a[1]){if(!f.hasNextSegment()){y=!0;break}t=f.nextSegment(),s=!0}if(1===m[1]&&m[0]<=m[1]){if(-1===r)break;if(r=1,!d.hasNextSegment())break;n=d.nextSegment(),s=!0}if(0===m[1]&&m[0]>m[1]){if(1===r)break;if(Number.isNaN(r)){if(!d.hasPreviousSegment())break;d.previousSegment(),r=-1}if(!d.hasPreviousSegment())break;n=d.previousSegment(),s=!0}if(!s)break;e=t.intersect(n,null,a,m,i)}while(2===e&&(!s||m[0]<=m[1]));if(y)continue;const x=t.calculateLength2D();t.queryEnvelope(g),u.length=0,l.m_overlapEvents.length=0;let S=!1,b=!1,w=0;const T=R(null,g,!0);for(null!==C?C.resetIterator(t,i):(d.resetToFirstPath(),d.nextPath()||c("relational_operations"));;){if(e=0,null!==C){const r=C.next();if(-1===r)break;d.resetToVertex(P.getElement(r),-1),n=d.nextSegment(),e=t.intersect(n,null,a,m,i)}else{for(;!d.hasNextSegment()&&d.nextPath(););if(!d.hasNextSegment())break;n=d.nextSegment(),n.queryEnvelope(_),_.inflateCoords(i,i),g.isIntersecting(_)&&(e=t.intersect(n,null,a,m,i))}if(2===e&&(!s||m[0]<=m[1])){const t=f.getStartPointIndex(),e=f.getPathIndex(),n=d.getStartPointIndex(),r=d.getPathIndex();if(h=vi(t,e,a[0],a[1],n,r,m[0],m[1]),l.m_overlapEvents.push(h),u.push(u.length),!(S||h.m_scalarA0<w&&h.m_scalarA1<w))if(0===w&&x*(h.m_scalarA0-w)>i)S=!0;else if(0!==w&&x*(h.m_scalarA0-w)>T)S=!0;else if(w=h.m_scalarA1,x*(1-w)<=i||1===w){b=!0;break}}}if(!b){if(!S)return o=!1,!1;u.length>1&&u.sort(((t,e)=>l.compareOverlapEvents(t,e))),w=0;for(let t=0;t<l.m_overlapEvents.length;t++)if(h=l.m_overlapEvents[u[t]],!(h.m_scalarA0<w&&h.m_scalarA1<w)){if(0===w&&x*(h.m_scalarA0-w)>i)return o=!1,!1;if(0!==w&&x*(h.m_scalarA0-w)>T)return o=!1,!1;if(w=h.m_scalarA1,x*(1-w)<=i||1===w)break}if(x*(1-w)>i)return o=!1,!1;u.length=0,l.m_overlapEvents.length=0}}return o}function ci(t,e,n){const r=t.getImpl(),i=e.getImpl(),s=r.querySegmentIterator(),o=i.querySegmentIterator(),a=new yn(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 li(t,e,n,r){const i=t.getImpl(),s=e.getImpl(),o=i.querySegmentIterator(),a=s.querySegmentIterator(),m=ht(2,Number.NaN),u=new yn(i,s,n);let c=!1,l=-1;for(;u.next();){const t=u.getRedElement(),e=u.getBlueElement();o.resetToVertex(t,-1),a.resetToVertex(e,-1);const i=o.nextSegment(),s=a.nextSegment();let h=0;if(Ii(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;c=!0}else if(l=0,r){const t=m[0],e=new $;i.queryCoord2D(t,e),r.push(e.x),r.push(e.y)}}return c?-2:l}function hi(t,e,n,r){const i=t.getImpl(),s=e,o=s.getPointCount(),a=r?ht(o,!1):[],m=new yn(i,s,n,!1),u=i.querySegmentIterator();for(;m.next();){const t=m.getRedElement(),e=m.getBlueElement();u.resetToVertex(t,-1);const i=u.nextSegment(),o=s.getXY(e);if(i.isIntersectingPoint(o,n)){if(!r)return!0;a[e]=!0}}if(!r)return!1;for(let c=0;c<o;c++)if(!a[c])return!1;return!0}function gi(e,n,r){const i=new $,s=r*r,o=e.querySegmentIterator(),a=e.getImpl().getAccelerators();if(null!==a){const e=a.getQuadTree();if(null!==e){const a=t.constructEmpty();a.setCoords({pt:n});const m=e.getIterator(a,r);for(let t=m.next();-1!==t;t=m.next())if(o.resetToVertex(e.getElement(t),-1),o.hasNextSegment()){const t=o.nextSegment(),e=t.getClosestCoordinate(n,!1);if(t.queryCoord2D(e,i),$.sqrDistance(n,i)<=s)return!0}return!1}}const m=t.constructEmpty();for(;o.nextPath();)for(;o.hasNextSegment();){const t=o.nextSegment();if(t.queryEnvelope(m),m.inflateCoords(r,r),!m.contains(n))continue;const e=t.getClosestCoordinate(n,!1);if(t.queryCoord2D(e,i),$.sqrDistance(n,i)<=s)return!0}return!1}function _i(t,e,n){return gi(t,e,n)&&!wi(t,e,n)}function pi(e,n,r,i){const s=e.querySegmentIterator(),a=e.getImpl().getAccelerators(),m=e.hasNonLinearSegments();let u=null,c=null,l=null,h=null;if(null!==a){const e=a.getQuadTree();if(null!==e){const i=e.getIterator(n,r);m&&(u=new w,c=new w,l=new w,h=new w,n.querySide(0,u),n.querySide(1,c),n.querySide(2,l),n.querySide(3,h));const a=t.constructEmpty();a.setCoords({env2D:n}),a.inflateCoords(r,r);for(let t=i.next();-1!==t;t=i.next())if(s.resetToVertex(e.getElement(t),-1),s.hasNextSegment()){const t=s.nextSegment();if(t.getGeometryType()===o.enumLine){const e=t.getStartXY(),n=t.getEndXY();if(a.clipLine(e,n))return!0;continue}if(n.contains(t.getStartXY())||n.contains(t.getEndXY()))return!0;if(t.isIntersecting(u,r))return!0;if(t.isIntersecting(c,r))return!0;if(t.isIntersecting(l,r))return!0;if(t.isIntersecting(h,r))return!0}return!1}}if(m){u=new w,c=new w,l=new w,h=new w,n.querySide(0,u),n.querySide(1,c),n.querySide(2,l),n.querySide(3,h);const t=e.querySegmentIterator();for(;t.nextPath();)for(;t.hasNextSegment();){const e=t.nextSegment();if(n.contains(e.getStartXY())||n.contains(e.getEndXY()))return!0;if(e.isIntersecting(u,r))return!0;if(e.isIntersecting(c,r))return!0;if(e.isIntersecting(l,r))return!0;if(e.isIntersecting(h,r))return!0}}else{const i=t.constructEmpty();i.setCoords({env2D:n}),i.inflateCoords(r,r);const s=e.getImpl(),o=s.getAttributeStreamRef(0),a=new $;for(let t=0,e=s.getPathCount();t<e;t++){let e=!0;const n=new $,r=new $,m=new $,u=s.getPathStart(t),c=new $;for(let l=u,h=s.getPathEnd(t);l<h;l++)if(e)o.queryPoint2D(2*l,n),c.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(c),i.clipLine(r,m)))return!0}}return!1}function fi(e,n,r,i){const s=e.getImpl(),o=n.getImpl(),a=[0],m=X(s.getIsSimple(0,a))&&X(o.getIsSimple(0,a)),u=s.querySegmentIterator(),c=o.querySegmentIterator(),l=ht(2,0),h=ht(2,0),g=new yn(s,o,r);let _=!1;for(;g.next();){const t=g.getRedElement(),e=g.getBlueElement();u.resetToVertex(t,-1),c.resetToVertex(e,-1);const n=u.nextSegment(),i=c.nextSegment();let s=0;if(Ii(n,i)){if(i.isIntersecting(n,r)){_=!0;break}}else s=i.intersect(n,null,h,l,r);if(2===s){const t=l[0],e=l[1],i=n.calculateLength2D();if(m&&(e-t)*i>r)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 p=t.constructEmpty(),f=t.constructEmpty(),d=t.constructEmpty();let y,P;if(e.queryEnvelope(p),n.queryEnvelope(f),p.inflateCoords(1e3*r,1e3*r),f.inflateCoords(1e3*r,1e3*r),d.setCoords({env2D:p}),d.intersect(f),e.getPointCount()>10){if(y=Rt(e,d,r,0,i),y.isEmpty())return!1}else y=e;if(n.getPointCount()>10){if(P=Rt(n,d,r,0,i),P.isEmpty())return!1}else P=n;return He(y,P,r,"F********",i,!1)}function di(e,n,r,i){const s=e.getImpl(),o=n.getImpl(),a=[0],m=X(s.getIsSimple(0,a))&&X(o.getIsSimple(0,a)),u=t.constructEmpty(),c=t.constructEmpty(),l=t.constructEmpty();e.queryEnvelope(u),n.queryEnvelope(c);let h=!1;const g=ii(u,c,r),_=ii(c,u,r),p=s.querySegmentIterator(),f=o.querySegmentIterator(),d=ht(2,Number.NaN),y=ht(2,Number.NaN),P=new yn(s,o,r);for(;P.next();){const t=P.getRedElement(),e=P.getBlueElement();p.resetToVertex(t,-1),f.resetToVertex(e,-1);const n=p.nextSegment(),i=f.nextSegment();let s=0;if(Ii(n,i)){if(i.isIntersecting(n,r))break}else s=i.intersect(n,null,y,d,r);if(2===s){const t=d[0],e=d[1],i=n.calculateLength2D();if(m&&(e-t)*i>r&&(h=!0,g&&_))return!0}else if(s){const t=d[0],e=y[0];if(t>0&&t<1&&e>0&&e<1)return!0}}const x=t.constructEmpty(),C=t.constructEmpty();let E,S;x.setCoords({env2D:u}),x.inflateCoords(1e3*r,1e3*r),C.setCoords({env2D:c}),C.inflateCoords(1e3*r,1e3*r),l.setCoords({env2D:x}),l.intersect(C);let b="";if(b+=h?"**":"T*",g){if(n.getPointCount()>10){if(S=Rt(n,l,r,0,i),S.isEmpty())return!1}else S=n;b+="****"}else S=n,b+="T***";if(_){if(e.getPointCount()>10){if(E=Rt(e,l,r,0,i),E.isEmpty())return!1}else E=e;b+="***"}else E=e,b+="T**";return He(E,S,r,b,i,!1)}function yi(e,n,r,i){const s=[!1],o=ei(e,n,r,s);if(s[0])return o;const a=t.constructEmpty();let m;if(n.queryEnvelope(a),a.inflateCoords(1e3*r,1e3*r),e.getPointCount()>10){if(m=Rt(e,a,r,0,i),m.isEmpty())return!1}else m=e;return Ve(m,n,r,i)}function Pi(e,n,r,i){const s=e.getImpl(),o=n.getImpl(),a=s.querySegmentIterator(),m=o.querySegmentIterator(),u=ht(2,Number.NaN),c=ht(2,Number.NaN),l=new yn(s,o,r);let h=!1;for(;l.next();){const t=l.getRedElement(),e=l.getBlueElement();a.resetToVertex(t,-1),m.resetToVertex(e,-1);const n=a.nextSegment(),i=m.nextSegment();let s=0;if(Ii(n,i)?!h&&i.isIntersecting(n,r)&&(h=!0):s=i.intersect(n,null,c,u,r),2===s)h=!0;else if(s){const t=u[0],e=c[0];if(t>0&&t<1&&e>0&&e<1)return!1;h=!0}}if(!h)return!1;const g=t.constructEmpty(),_=t.constructEmpty(),p=t.constructEmpty();let f,d;if(e.queryEnvelope(g),n.queryEnvelope(_),g.inflateCoords(1e3*r,1e3*r),_.inflateCoords(1e3*r,1e3*r),p.setCoords({env2D:g}),p.intersect(_),e.getPointCount()>10){if(f=Rt(e,p,r,0,i),f.isEmpty())return!1}else f=e;if(n.getPointCount()>10){if(d=Rt(n,p,r,0,i),d.isEmpty())return!1}else d=n;return He(f,d,r,"F********",i,!1)}function xi(e,n,r,i){const s=e.getImpl(),o=n.getImpl(),a=s.querySegmentIterator(),m=o.querySegmentIterator(),u=ht(2,Number.NaN),c=ht(2,Number.NaN),l=new yn(s,o,r);let h=!1;for(;l.next();){const t=l.getRedElement(),e=l.getBlueElement();a.resetToVertex(t,-1),m.resetToVertex(e,-1);const n=a.nextSegment(),i=m.nextSegment();let s=0;if(Ii(n,i)?!h&&i.isIntersecting(n,r)&&(h=!0):s=i.intersect(n,null,c,u,r),2===s)h=!0;else if(s){const t=u[0],e=c[0];if(t>0&&t<1&&e>0&&e<1)return!0;h=!0}}if(!h)return!1;const g=t.constructEmpty(),_=t.constructEmpty(),p=t.constructEmpty(),f=t.constructEmpty(),d=t.constructEmpty();if(e.queryEnvelope(g),n.queryEnvelope(_),ii(_,g,r)){let t,s;if(p.setCoords({env2D:g}),p.inflateCoords(1e3*r,1e3*r),f.setCoords({env2D:_}),f.inflateCoords(1e3*r,1e3*r),d.setCoords({env2D:p}),d.intersect(f),e.getPointCount()>10){if(t=Rt(e,d,r,0,i),t.isEmpty())return!1}else t=e;if(n.getPointCount()>10){if(s=Rt(n,d,r,0,i),s.isEmpty())return!1}else s=n;return He(t,s,r,"T********",i,!1)}return He(e,n,r,"T*****T**",i,!1)}function Ci(e,n,r,i){const s=[!1],o=ei(e,n,r,s);if(s[0])return o;const a=t.constructEmpty();let m;if(n.queryEnvelope(a),a.inflateCoords(1e3*r,1e3*r),e.getPointCount()>10){if(m=Rt(e,a,r,0,i),m.isEmpty())return!1}else m=e;return ze(m,n,r,i)}function Ei(t,e,n,r){return 1===zt(t,e,n)}function Si(t,e,n,r){return 2===zt(t,e,n)}function bi(t,e,n,r){const i=new $,s=n*n;for(let o=0;o<t.getPointCount();o++)if(t.queryXY(o,i),$.sqrDistance(i,e)<=s)return!1;return!0}function wi(t,e,n){const r=t.getBoundary();return!r.isEmpty()&&!bi(r,e,n)}function Ti(e,n,r){const i=t.constructEmpty();return i.setCoords({env2D:e}),i.inflateCoords(r,r),i.containsEnvelope(n)?1073741824:i.isIntersecting(n)?e.isIntersecting(n)?e.xmin<n.xmin&&n.xmax<e.xmax?n.ymin<e.ymin&&n.ymax>e.ymax?0:1073741824:e.ymin<n.ymin&&n.ymax<e.ymax?n.xmin<e.xmin&&n.xmax>e.xmax?0:1073741824:0:0:4}function Ii(t,e){return t.getGeometryType()!==o.enumLine||e.getGeometryType()!==o.enumLine}function vi(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 Di{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 Gi(t,e,n){return e.m_projector.project(t,n)}function Ni(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 Mi(t,e,n,r,i){return t.m_projector.transformInPlaceZ(e,null,n,r,null,i)}function Ai(n,r,i,s){if(n&&r&&r.isPannable()||e("fold_into_360_range_geodetic"),n.isEmpty())return n;if(4===i)return qi(n,r,s);let m=n;const u=m.getGeometryType();if(l(u)){m=Eo(n,r);const e=new t;m.queryEnvelope(e);const s=F(r,e,!1).total(),o=r.getPannableExtent();let a=Math.floor((e.xmin-o.xmin)/o.width())*o.width()+o.xmin,u=m;for(;a<e.xmax;)a>e.xmin+s&&a<e.xmax-s&&(u=xo(u,r,i,!0,a)),a+=o.width();m=u}else{if(u===o.enumEnvelope){const t=new f({vd:m.getDescription()});return t.addEnvelope(m,!1),Ai(t,r,i,s)}if(a(u)){const t=new d({vd:m.getDescription()});return t.addSegment(m,!0),Ai(t,r,i,s)}}return qi(m,r,s)}function qi(t,n,r){if(t&&n&&n.isPannable()||e(""),t.isEmpty())return t;let i;const s=t.getGeometryType();if(s===o.enumEnvelope){const e=new f({vd:t.getDescription()});e.addEnvelope(t,!1),i=e}else if(a(s)){const e=new d({vd:t.getDescription()});e.addSegment(t,!0),i=e}else i=t;const m=Eo(i,n);return m.isEmpty()?m:ho(m,n,0,m!==t,0,r)}function Ri(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||!u(t.getGeometryType())){if(Number.isNaN(n))return t;const e=s.getCenter();if(Math.abs(e-n)<=i)return t;{const i=new qt,s=mt((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(),h=c.getAttributeStreamRef(0);let g=0,_=0,p=0,f=l(o)?0:-1;const d=nt.constructEmpty();let y=!1;for(let u=0,P=a.getPointCount();u<P;u++){const t=m.read(2*u);u===_&&(l(o)?(0===f&&Number.isNaN(n)&&(y=!0),f>0&&Number.isNaN(n)&&(n=d.getCenter(),y=!1),_=a.getPathEnd(f),f++):_=a.getPointCount(),Number.isNaN(n)?p=t:(p=n,g=0));let e=t-p;Math.abs(e)>i&&(e=mt(e/r)*r,g-=e,Math.abs(g)<.1*r&&(g=0));const s=t+g;h.write(2*u,s),y&&d.mergeCoordinate(s),p=t}return c.notifyModified(),c}const Yi="missing implementation";function Ui(e,n,r,i){const s=n.getCoordinateSystemType();if(0===s){const t=new km;return n.queryPrecisionDescriptor(t),Oi(e,t,n,r)}let o=e;2!==i&&3!==i||!n.isPannable()||(o=qi(o,n,r));const a=new km;if(n.queryPrecisionDescriptor(a),o=Oi(o,a,n,r),0===i||o.isEmpty())return o;if(1===s){if(1===i){const e=new t;o.queryLooseEnvelope(e);const i=n.getPannableExtent(),s=.01*i.width();return i.xmin=e.xmin-s,i.xmax=e.xmax+s,(new Lt).execute(o,i,n,r)}return o}if(2===s){const t=n.getPCSHorizon();if(1===i||2===i){const e=(new Ht).execute(o,t,n,r);return e===t?e.clone():e}return o}if(3===s)return o;c(Yi)}function Oi(t,e,n,r){const i=e.getXYGridRange(),s=t.hasAttribute(1),o=t.hasAttribute(2);let a=new nt,m=new nt;s&&(a=e.getZGridRange()),o&&(m=e.getMGridRange());let u=(new Lt).execute(t,i,n,r);if(s){const e=u.queryInterval(1,0);a.contains(e)||(t===u&&(u=u.clone()),L(u,a,1,0))}if(o){const e=u.queryInterval(2,0);m.contains(e)||(t===u&&(u=u.clone()),L(u,m,2,0))}return u}class Xi{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||e(""),this.m_projTransform=t,this.m_bClipOutCurvedPoles=!1;const n=this.m_projTransform.getExtendedParamsImpl();this.m_bNormalizeOutputGeometry=n.normalizeResultGeometry,this.m_bNormalizeOutputGeometry&&(n.legacyHorizonClipping?this.m_bNormalizeOutputGeometry=!1:this.m_projTransform.getOutputSR().isPannable()||(this.m_bNormalizeOutputGeometry=!1)),n.clipWithInputHorizon?(this.m_inputPCSHorizonClipOption=0,!n.legacyHorizonClipping&&this.m_projTransform.getInputSR().isPannable()&&(this.m_inputPCSHorizonClipOption=this.m_bNormalizeOutputGeometry?4:2)):this.m_inputPCSHorizonClipOption=1,n.clipWithOutputHorizon?(this.m_outputPCSHorizonClipOption=0,!n.legacyHorizonClipping&&this.m_projTransform.getOutputSR().isPannable()&&(this.m_outputPCSHorizonClipOption=this.m_bNormalizeOutputGeometry?4:2)):this.m_outputPCSHorizonClipOption=1,this.m_centralMeridianOfOutputGCS=n.centralMeridianOfOutputGCS,this.m_densificationStepInput=n.densificationStep;const r=this.m_projTransform.getExtendedParamsInternal();this.m_bDontGeonormalizePolygon=r.hasFlag(2147483648),this.m_bDontHackPolesInGeogToGeog=r.hasFlag(1073741824),this.m_bClipOutCurvedPoles=r.hasFlag(536870912)}project(t,e){if(this.m_projTransform.isIdentity()||t.isEmpty())return t;const n=t.getGeometryType();if(n===o.enumPoint)return this.projectPoint(t,e);const r=this.m_projTransform.getInputSR().getCoordinateSystemType(),i=this.m_projTransform.getOutputSR().getCoordinateSystemType(),s=this.m_projTransform.getInputSR(),a=this.m_projTransform.getOutputSR();if(0===r&&r===i){const e=Li(s,a),n=t.clone();return n.applyTransformation(e),n}switch(n){case o.enumPolyline:case o.enumPolygon:return this.projectMultiPath(t,e);case o.enumMultiPoint:return this.projectMultiPoint(t,e);case o.enumEnvelope:return this.projectEnvelope(t,e);case o.enumGeometryCollection:return this.projectGeometryCollection(t,e);default:c("")}}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 r=new P({copy:t});const i=this.m_projTransform.getInputSR(),s=this.m_projTransform.getOutputSR(),o=i.getCoordinateSystemType(),a=s.getCoordinateSystemType();if(3===o&&n(0),r=Go(r,i,this.m_inputPCSHorizonClipOption,e),r.isEmpty())return r;2===o&&Xo(i,0,r),Qo(this.m_projTransform,r,!1);let m=0;3===a&&n(0);const u=2===a;return u?m=s.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(m=this.m_centralMeridianOfOutputGCS),u&&0!==this.m_outputPCSHorizonClipOption||(r=ho(r,qm(s),m,!1,0,e)),u&&(r=ao(r,s,this.m_outputPCSHorizonClipOption,e),Yo(s,r,this.m_bNormalizeOutputGeometry),r.isEmpty()),r}projectMultiPath(t,e){const n=t.getGeometryType();return n===o.enumPolygon?this.projectPolygon(t,e):n===o.enumPolyline?this.projectPolyline(t,e):void c("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=nt.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(e,r){n(e.getGeometryType()===o.enumPolygon),n(!this.m_projTransform.isIdentity()),n(!e.isEmpty());const i=this.m_projTransform.getInputSR(),s=this.m_projTransform.getOutputSR(),a=i.getCoordinateSystemType(),m=s.getCoordinateSystemType(),u=new f({copy:e});3===a&&n(0),3===m&&n(0);const c=2===a,l=2===m,h=c?i.getGCS():i,g=l?s.getGCS():s,_=!l&&!this.m_bDontHackPolesInGeogToGeog;let p=!1,y=Go(u,i,this.m_inputPCSHorizonClipOption,r);if(y.isEmpty())return y;let P=this.m_densificationStepInput;const x=!Number.isNaN(P);let C;x&&(y=(new Ut).execute(y,P,0,0,r));let E=l?s.getPCSInfo():null,S=Number.NaN;c&&(S=i.getCentralMeridian());const b=null!==s.getGCSSplitLines();if(this.m_bDontGeonormalizePolygon){const t=y;if(c&&(Wo(i,S,t),x)){const t=i.getUnitsPerMillimeter();P*=i.getGCS().getUnitsPerMillimeter()/t}if($o(this.m_projTransform,t,_),x){const t=i.getGCS().getUnitsPerMillimeter();P*=s.getGCS().getUnitsPerMillimeter()/t}C=t}else{let e=new d({vd:y.getDescription()});if(e.addAndExplicitlyOpenAllPaths(y,!1),c){if(Wo(i,S,e),x){const t=i.getUnitsPerMillimeter();P*=i.getGCS().getUnitsPerMillimeter()/t}if(this.m_bClipOutCurvedPoles){const n=i.getPCSInfo(),s=n.getSouthPoleGeometry()===gu.PE_POLE_LINE_CURVED,o=n.getNorthPoleGeometry()===gu.PE_POLE_LINE_CURVED;if(s||o){const n=t.constructEmpty();e.queryLooseEnvelope(n),n.inflateCoords(1,1);const i=89.9999*h.getOneDegreeGCSUnit();s&&(n.ymin=-i),o&&(n.ymax=i),e=Yt(e,n,h,0,0,r)}}}if($o(this.m_projTransform,e,_),x){const t=qm(i).getUnitsPerMillimeter();P*=qm(s).getUnitsPerMillimeter()/t}let n=Number.NaN;l?(E=s.getPCSInfo(),n=s.getCentralMeridian()):Number.isNaN(this.m_centralMeridianOfOutputGCS)||(n=this.m_centralMeridianOfOutputGCS);let o=Fi(i)|Fi(s),a=10*g.getTolerance(0);this.m_bDontHackPolesInGeogToGeog&&(o=3,a=10*g.getTolerance(0)),C=yo(y,i,e,g,n,r,o,a,this.m_bNormalizeOutputGeometry),o=0}if(b&&(n(!s.isPannable()),C=Js(C,s,r)),l){if(!p){const t=g.getPannableExtent().width();if(C.queryInterval(0,0).width()>=t-10*g.getTolerance(0)){const t=E.getNorthPoleLocation(),e=E.getSouthPoleLocation(),n=E.getNorthPoleGeometry(),r=E.getSouthPoleGeometry();let i=0;n===gu.PE_POLE_POINT&&t!==gu.PE_POLE_OUTSIDE_BOUNDARY&&(i=1),r===gu.PE_POLE_POINT&&e!==gu.PE_POLE_OUTSIDE_BOUNDARY&&(i|=2),p||=0!==i}}C=ao(C,s,this.m_outputPCSHorizonClipOption,r),x&&(C=(new Ut).execute(C,P,0,0,r)),Oo(s,C,this.m_bNormalizeOutputGeometry)}return C.isEmpty()||p&&(C=(new Ot).execute(C,s,!1,r)),C}projectPolyline(t,e){n(t.getGeometryType()===o.enumPolyline),n(!this.m_projTransform.isIdentity()),n(!t.isEmpty());const r=this.m_projTransform.getInputSR(),i=this.m_projTransform.getOutputSR(),s=r.getCoordinateSystemType(),a=i.getCoordinateSystemType(),m=new d({copy:t});3===s&&n(0),3===a&&n(0);const u=2===s,c=2===a;u&&r.getGCS();const l=c?i.getGCS():i,h=!c&&!this.m_bDontHackPolesInGeogToGeog;let g=Go(m,r,this.m_inputPCSHorizonClipOption,e);if(g.isEmpty())return g;let _=Number.NaN;u&&(_=r.getCentralMeridian());const p=null!==i.getGCSSplitLines();let f=this.m_densificationStepInput;const y=!Number.isNaN(f);let P;if(y&&(g=(new Ut).execute(g,f,0,0,e)),this.m_bDontGeonormalizePolygon){if(u&&(Wo(r,_,g),y)){const t=r.getUnitsPerMillimeter();f*=r.getGCS().getUnitsPerMillimeter()/t}if($o(this.m_projTransform,g,h),y){const t=r.getGCS().getUnitsPerMillimeter();f*=i.getGCS().getUnitsPerMillimeter()/t}P=g}else{const t=new d({vd:g.getDescription()});if(t.addAndExplicitlyOpenAllPaths(g,!1),u&&(Wo(r,_,t),y)){const t=r.getUnitsPerMillimeter();f*=r.getGCS().getUnitsPerMillimeter()/t}if($o(this.m_projTransform,t,h),y){const t=r.getGCS().getUnitsPerMillimeter();f*=i.getGCS().getUnitsPerMillimeter()/t}let n=Number.NaN;c?n=i.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(n=this.m_centralMeridianOfOutputGCS);let s=Fi(r)|Fi(i),o=10*l.getTolerance(0);this.m_bDontHackPolesInGeogToGeog&&(s=3,o=0),P=Po(g,r,t,l,n,e,s,o,this.m_bNormalizeOutputGeometry),s=0}return p&&(n(!i.isPannable()),P=Js(P,i,e)),c&&(P=ao(P,i,this.m_outputPCSHorizonClipOption,e),y&&(P=(new Ut).execute(P,f,0,0,e)),Oo(i,P,this.m_bNormalizeOutputGeometry)),P.isEmpty(),P}projectGeometryCollection(t,e){return n(0),{}}projectEnvelopeHelper(e,n){const r=(e.height()+e.width())/400;if(0!==r){const i=(new Ut).execute(e,r,0,0,n),s=this.projectMultiPath(i,n),o=new Y({vd:e.getDescription()});if(s.isEmpty()){const r=Math.min(e.height(),e.width()),s=H(this.m_projTransform.getInputSR(),e,!0).total();if(r>100*s){const e=t.constructEmpty(),n=F(this.m_projTransform.getOutputSR(),e,!0).total(),i=this.m_projTransform.getInputSR().getOneMeter()/this.m_projTransform.getOutputSR().getOneMeter();if(r>100*Math.max(s,n*i))return o}const a=new d;a.addAndExplicitlyOpenAllPaths(i,!1);this.projectMultiPath(a,n).queryEnvelope(o);const m=new P({vd:e.getDescription()});m.reserve(4);const u=new A;for(let t=0;t<4;t++)e.queryCornerByVal(t,u),m.add(u);const c=this.projectMultiPoint(m,n),l=new Y;return c.queryEnvelope(l),o.merge(l),o}return s.queryEnvelope(o),o}{const t=e.getCenterXY(),r=new A(t),i=this.projectPoint(r,n),s=new Y({vd:e.getDescription()});if(i.isEmpty())s.setEmpty();else{e.copyTo(s);const t=i.getXY();s.setCoords(t.x,t.y,t.x,t.y)}return s}}transformInPlace(t,e,r,i){return n(0),0}transformInPlaceZ(t,e,r,i,s,o){if(this.m_projTransform.isIdentity())return t!==i&&ot(i,t,r),e!==s&>(s,e,0,0,r),r;const a=this.m_projTransform,u=a.getInputSR(),c=a.getOutputSR(),l=u.getCoordinateSystemType(),h=c.getCoordinateSystemType();if(0===l&&l===h){return Li(u,c).transformPoints2D(t,r,i),a.isVertical()&&n(0),r}3===l&&m("image: transform_in_place_"),3===h&&m("image: transform_in_place_"),No(t,r,i,u,this.m_inputPCSHorizonClipOption),s!==e&>(s,e,0,0,r),2===l&&Zo(u,0,i,r),ra(this.m_projTransform,i,s,r,!1);let g=0;const _=2===h;if(_?g=c.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(g=this.m_centralMeridianOfOutputGCS),_&&0!==this.m_outputPCSHorizonClipOption||go(i,r,c.getGCS(),g),_){if(!lo(i,r,c,this.m_outputPCSHorizonClipOption))for(let t=0;t<r;++t)i[t].setNAN();Ao(c,i,r,!1)}let p=r;for(let n=0;n<r;++n)i[n].isNAN()&&(s&&(s[n]=Number.NaN),p--);return p}}function Fi(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===gu.PE_POLE_POINT&&r!==gu.PE_POLE_OUTSIDE_BOUNDARY&&(e=1),o===gu.PE_POLE_POINT&&i!==gu.PE_POLE_OUTSIDE_BOUNDARY&&(e|=2),e}function Li(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 qt;return m.setScaleCoords(a,a),m}let Hi=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 Vi(t,e,n)}execute(t,e,n){return e.isIdentity()?t:Gi(t,e,n)}transform(t,e,n,r,i=!0){return i?Ni(t,e,n,r,null):Mi(t,e,n,r,null)}transform3D(t,e,r,i,s=!0){return n(0),0}foldInto360Range(t,e){return qi(t,e,null)}foldInto360RangeGeodetic(t,e,n){return Ai(t,e,n,null)}normalizeGeometryEx(t,e,n,r,i=0){return Ns(t,e,n,r,i)}normalizeGeometry(t,e,n){return Ri(t,e,n)}clipToSpatialReference(t,e,n,r=0){return Ui(t,e,n,r)}};class Vi extends Vt{constructor(t,n,r){super(),this.m_projTrans=n,this.m_progressTracker=r,this.m_index=-1,t||e(""),this.m_inputGeoms=t}next(){const t=this.m_inputGeoms.next();return null!=t?(r(t),i(t),this.m_index=this.m_inputGeoms.getGeometryID(),Gi(t,this.m_projTrans,this.m_progressTracker)):null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}}function zi(t,n,m,u,c,l,h=!1){t||e("Geometry.Geodetic_densify.densify");let g=t.getGeometryType();if(i(t),r(t),t.isEmpty()||s(g))return t;const _=new Ki;_.m_sr=n,_.m_gcs=n.getGCS(),_.m_transform=_.m_gcs!==n?n.getSRToGCSTransform():null,_.m_progressTracker=l;const p=Pm();let y,P,x;if(_.m_gcs.querySpheroidData(p),_.m_a=p.majorSemiAxis,_.m_eSquared=p.e2,_.m_rpu=_.m_gcs.getUnit().getUnitToBaseFactor(),_.m_gcsTolerance=_.m_gcs.getTolerance(0),_.m_radTolerance=_.m_gcsTolerance*_.m_rpu,_.m_maxLength=u,_.m_maxDeviation=c,_.m_curveType=m,g===o.enumEnvelope){const e=new f({vd:t.getDescription()});e.addEnvelope(t,!1),y=e,g=o.enumPolygon}else if(a(g)){const e=new d({vd:t.getDescription()});e.addSegment(t,!0),y=e,g=o.enumPolyline}else y=t;if(4!==_.m_curveType){if(P=_.m_transform&&!_.m_transform.isIdentity()?(new Hi).execute(y,_.m_transform,l):Eo(y,_.m_gcs),P.isEmpty())return P;P=ji(_.m_rpu,P);let t=_.geodeticDensify(P);h||(t=(new Hi).foldInto360RangeGeodetic(t,_.m_gcs,_.m_curveType)),x=_.m_transform&&!_.m_transform.isIdentity()?(new Hi).execute(t,_.m_transform.getInverse(),l):t}else{let t;if(n.isPannable())t=Eo(y,n);else{const e=n.getPCSHorizon();t=(new Ht).execute(y,e,n,l),t===e&&(t=e.clone())}if(P=t,P.isEmpty())return P;x=_.shapePreservingDensify(P)}return x}function ji(e,n){const r=new t;if(n.queryLooseEnvelope(r),r.width()*e<Math.PI)return n;let i=!1;const s=n.querySegmentIterator(),o=new $,a=new $;for(;s.nextPath();)for(;s.hasNextSegment();){const t=s.nextSegment();if(o.setCoordsPoint2D(t.getStartXY()),a.setCoordsPoint2D(t.getEndXY()),o.scale(e),a.scale(e),Math.abs(o.x-a.x)>Math.PI){if(!Bi(o,a)){i=!0;break}if(Math.abs(o.x-a.x)>2*Math.PI){i=!0;break}}}if(!i)return n;const m=n.createInstance();m.reserve(n.getPointCount());const u=n.getDescription().getAttributeCount()>1,c=new $,l=new $,h=new $(0,0),g=new $(0,0),_=new A;for(s.resetToFirstPath();s.nextPath();){let t=Number.NaN,n=0;for(;s.hasNextSegment();){const r=s.nextSegment();o.setCoordsPoint2D(r.getStartXY()),a.setCoordsPoint2D(r.getEndXY()),o.scale(e),a.scale(e),Number.isNaN(t)?(n=as(o.x,Number.NaN,n),h.setCoordsPoint2D(o)):h.setCoordsPoint2D(g),t=h.x;if(Bi(o,a)){if(a.x-o.x>2*Math.PI)for(;a.x-o.x>2*Math.PI;)a.x-=2*Math.PI;else if(a.x-o.x<2*-Math.PI)for(;a.x-o.x<2*-Math.PI;)a.x+=2*Math.PI;n=as(a.x,Number.NaN,n),g.setCoordsPoint2D(a)}else c.setCoordsPoint2D(a),gs(c),n=as(c.x,t,n),g.setCoords(n+c.x,c.y);if(Math.abs(g.x-a.x)<.5&&g.setCoordsPoint2D(a),u){r.queryCoord(0,_),l.setCoordsPoint2D(h),l.scale(1/e),_.setXY(l);s.isFirstSegmentInPath()?m.startPathPoint(_):m.lineToPoint(_),s.isLastSegmentInPath()&&!s.isPathClosed()&&(r.queryCoord(1,_),l.setCoordsPoint2D(g),l.scale(1/e),_.setXY(l),m.lineToPoint(_))}else{s.isFirstSegmentInPath()&&m.insertPath2D(-1,null,0,0,!0);const t=m.getPathCount()-1;l.setCoordsPoint2D(h),l.scale(1/e),m.insertPoint2D(t,-1,l),s.isLastSegmentInPath()&&!s.isPathClosed()&&(l.setCoordsPoint2D(g),l.scale(1/e),m.insertPoint2D(t,-1,l))}}}return m}function ki(t,e,n,r,i,s,o,a,m,u,c,l){const h=new $,g=new $,_=r.compare(i)>0;ss(_,r,i,h,g);const p=$i(t,e,n,h,g,s,o,a,m,u,null,c,l);return _&&is(m,u,null,c),p}function Bi(t,e){return!(!su(t.y,ft)||!su(e.y,ft))||!(!su(t.y,-ft)||!su(e.y,-ft))}function Wi(t,e){return!(!su(t.y,ft)||su(e.y,ft))||!(!su(t.y,-ft)||su(e.y,-ft))}function Zi(t,e){return!(!su(e.y,ft)||su(t.y,ft))||!(!su(e.y,-ft)||su(t.y,-ft))}class Ki{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 y,o=t.getDescription().getAttributeCount()>1;for(;n.nextPath();){const t=[0];for(;n.hasNextSegment();){const a=n.nextSegment(),m=a.getStartXY(),u=a.getEndXY();m.scale(this.m_rpu),u.scale(this.m_rpu);const c=new $,l=new $,h=m.compare(u)>0;ss(h,m,u,c,l),r.length=0,i.length=0,this.m_maxLength>0?$i(this.m_a,this.m_eSquared,this.m_curveType,c,l,this.m_maxLength,this.m_maxDeviation,this.m_radTolerance,null,null,o?i:null,r,t):ts(),h&&is(null,null,o?i:null,r),r[0].setCoordsPoint2D(a.getStartXY()),r.at(-1).setCoordsPoint2D(a.getEndXY());const g=1/this.m_rpu;for(let t=1,e=r.length-1;t<e;t++)r[t].scale(g);if(o){const t=os(h,a,s);Ji(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),a,t,i,r,e)}else Qi(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),r,e)}}return e}shapePreservingDensify(t){const e=t.createInstance(),n=t.querySegmentIterator(),r=[],i=[],s=new y,o=t.getDescription().getAttributeCount()>1;for(;n.nextPath();)for(;n.hasNextSegment();){const t=n.nextSegment(),a=t.getStartXY(),m=t.getEndXY(),u=a.compare(m)>0,c=os(u,t,s);r.length=0,i.length=0,rs(this.m_a,this.m_eSquared,this.m_rpu,c,this.m_sr,this.m_maxLength,this.m_maxDeviation,o?i:null,r),u&&is(null,null,o?i:null,r),o?Ji(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),t,c,i,r,e):Qi(n.isFirstSegmentInPath(),n.isLastSegmentInPath()&&!n.isPathClosed(),r,e)}return e}}function Qi(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 Ji(t,e,n,r,i,s,o){o.reserve(o.getPointCount()+s.length-1);const a=new A;if(n.queryStart(a),t?o.startPathPoint(a):o.lineToPoint(a),s.length>2){const t=r.calculateLength2D();for(let e=1;e<s.length-1;e++){const n=r.lengthToT(i[e]*t);r.queryCoord(n,a),a.setXY(s[e]),o.lineToPoint(a)}}e&&(n.queryEnd(a),o.lineToPoint(a))}function $i(t,e,n,r,i,s,o,a,m,u,c,l,h){const g={stack:[],error:void 0,hasError:!1};try{const _=Mt(g,new mu,!1),p=Mt(g,new mu,!1),f=Mt(g,new mu,!1);fu.geodeticDistance(t,e,r.x,r.y,i.x,i.y,f,_,p,n);const d=f.val,y=_.val,P=p.val;let x=y,C=P;x<0&&(x+=2*Math.PI),C<0&&(C+=2*Math.PI),m&&(m[0]=x),u&&(u[0]=C);let E=Number.NaN,S=Number.NaN;if(null!==c){const n=du.q90(t,e),i=du.q(t,e,r.y);E=(n-i)/d,S=(n+i)/d}const b=Wi(r,i),w=Zi(r,i),T=b||w,I=ls(r,i,a),v=Mt(g,new _t(new mu,new mu),!1),D=new $,G=new $,N=new $;h[0]=as(r.x,Number.NaN,h[0]);let M=h[0];if(d<=s)return l.push(r.clone()),h[0]=as(i.x,Number.NaN,h[0]),null!=c&&c.push(0),T?(b&&ms(r,i,c,l),w&&us(r,i,c,l)):I?cs(r,i,y,E,S,c,l):o>0&&(G.setCoords(r.x-M,r.y),D.setCoords(i.x-h[0],i.y),M=es()),l.push(i.clone()),d;const A=1+Math.ceil(d/s),q=d/(A-1),R=new $;l.push(r.clone()),R.setCoordsPoint2D(r),G.setCoords(r.x-h[0],r.y),null!==c&&c.push(0);for(let s=1;s<A;s++){let m;if(s<A-1){const i=s*q;fu.geodeticCoordinate(t,e,r.x,r.y,i,y,v.at(0),v.at(1),n),D.setCoords(v.at(0).val,v.at(1).val),h[0]=as(D.x,R.x,h[0]),N.setCoords(h[0]+D.x,D.y),m=s/(A-1)}else h[0]=as(i.x,Number.NaN,h[0]),D.setCoords(i.x-h[0],i.y),N.setCoordsPoint2D(i),m=1;T?(1===s&&b&&ms(r,N,c,l),s===A-1&&w&&us(R,i,c,l)):I?hs(R,N,a)&&(r.x<i.x?R.x>N.x&&(h[0]+=2*Math.PI,N.setCoords(h[0]+D.x,D.y)):R.x<N.x&&(h[0]-=2*Math.PI,N.setCoords(h[0]+D.x,D.y)),cs(R,N,y,E,S,c,l)):o>0&&es(),l.push(N.clone()),null!=c&&c.push(m),R.setCoordsPoint2D(N),G.setCoordsPoint2D(D),M=h[0]}return d}catch(_){g.error=_,g.hasError=!0}finally{At(g)}}function ts(t,e,r,i,s,o,a,m,u,c){n(0)}function es(t,e,r,i,s,o,a,m,u,c,l,h,g,_,p){return n(0),0}function ns(t,e,n,r){const i=pe(t,e,n),s=pe(t,e,r);return M.distance(i,s)}function rs(t,e,n,r,i,s,o,a,m){const u=r.isCurve(),c=Ae(t,e)*Math.PI*179/180;let l=s;s>0&&!(s>c)||(l=c),l=Fe(t,e,l);let h=o;!u||h>0||(h=.001);const g=h>0;let _=Number.NaN;g&&(_=Fe(t,e,h));const p=i.getPECoordSys(),f=1===i.getCoordinateSystemType(),d=i.getTolerance(0),y=r.getStartXY(),P=r.getEndXY(),x=new $,C=new $;if(f)x.setCoordsPoint2D(y),x.scale(n),C.setCoordsPoint2D(P),C.scale(n);else{const t=[y.x,y.y,P.x,P.y];lu.projToGeog(p,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 b=[],w=[],T=[];b.push(P.clone()),w.push(C.clone()),T.push(1),m.push(y.clone()),null!==a&&a.push(S);const I=i.isPannable(),v=y.clone(),D=[.5,.33333333333333337,.6666666666666666,.16666666666666669,.8333333333333333];let G=5;for(u||(g?(D[0]=.5,D[1]=.25,D[2]=.75,G=3):G=1);w.length>0;){const s=b.at(-1).clone();C.assign(w.at(-1));const o=T.at(-1);let c=!1,h=Number.NaN;const y=ns(t,e,x,C);let P=l>=y&&Math.abs(x.y-C.y)<.9*Math.PI;f&&P&&(P=Math.abs(x.x-C.x)<.9*Math.PI);const N=new $,M=new $;let A=!1;if(u||g||!P||P&&(A=!0),r.calculateSubLength(S,o)<=d&&(A=!0),!A)for(let a=0;a<G;a++){const s=pt(S,o,D[a]),m=new $;r.queryCoord2D(s,m);const u=new $;if(f)u.setCoords(m.x*n,m.y*n);else{const t=[m.x,m.y];lu.projToGeog(p,1,t),u.setCoords(t[0]*n,t[1]*n)}if(0===a&&(h=s,N.setCoordsPoint2D(m),M.setCoordsPoint2D(u),!P)){c=!0;break}if(f&&Math.abs(x.x-u.x)>=Math.PI){c=!0;break}if(l<ns(t,e,x,u)){c=!0;break}if(g){const s=Ee(t,e,x,C,D[a]),m=s.clone();if(f?(m.x/=n,m.y/=n):(m.x/=n,m.y/=n,Mi(i.getGCSToSRTransform(),[m],1,[m],null)),m.isNAN()){const n=pe(t,e,u),r=pe(t,e,x),i=pe(t,e,C),{first:s,second:o}=Ie(t,e,n,r,i,2,null);if(o>_){c=!0;break}}else{if(I){const t=i.getPannableExtent().width(),e=pt(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 nt(S,o),-1),u=r.getCoord2D(a);if(!f){const t=[u.x,u.y];lu.projToGeog(p,1,t),u.x=t[0],u.y=t[1]}u.x*=n,u.y*=n;let l=ns(t,e,u,s);if(l>_){if(l<4*_){const n=pe(t,e,u),r=pe(t,e,x),i=pe(t,e,C),{first:s,second:o}=Ie(t,e,n,r,i,2,null);l=o}if(l>_){c=!0;break}}}}}c?(b.push(N.clone()),w.push(M.clone()),T.push(h)):(b.pop(),w.pop(),T.pop(),m.push(s.clone()),E+=y,null!==a&&a.push(E),v.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 is(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 ss(t,e,n,r,i){t?(r.setCoordsPoint2D(n),i.setCoordsPoint2D(e)):(r.setCoordsPoint2D(e),i.setCoordsPoint2D(n))}function os(t,e,n){return t?(n.create(e.getGeometryType()),e.copyTo(n.get()),n.get().reverse(),n.get()):e}function as(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 ms(t,e,n,r){if(t.y>0){const i=new $;i.setCoords(e.x,ft),su(t.x,i.x)||su(e.y,i.y)||(r.push(i),null!==n&&n.push(0))}else{const i=new $;i.setCoords(e.x,-ft),su(t.x,i.x)||su(e.y,i.y)||(r.push(i),null!==n&&n.push(0))}}function us(t,e,n,r){if(e.y>0){const i=new $;i.setCoords(t.x,ft),su(e.x,i.x)||su(t.y,i.y)||(r.push(i),null!==n&&n.push(1))}else{const i=new $;i.setCoords(t.x,-ft),su(e.x,i.x)||su(t.y,i.y)||(r.push(i),null!==n&&n.push(1))}}function cs(t,e,n,r,i,s,o){if(au(n)){if(ft-t.y>0){const e=new $;e.setCoords(t.x,ft),o.push(e),null!==s&&s.push(r)}if(ft-e.y>0){const t=new $;t.setCoords(e.x,ft),o.push(t),null!==s&&s.push(r)}}else{if(ft+t.y>0){const e=new $;e.setCoords(t.x,-ft),o.push(e),null!==s&&s.push(i)}if(ft+e.y>0){const t=new $;t.setCoords(e.x,-ft),o.push(t),null!==s&&s.push(i)}}}function ls(t,e,n){return!(!hs(t,e,n)||su(t.y,ft)||su(t.y,-ft)||su(e.y,ft)||su(e.y,-ft))}function hs(t,e,n){return Math.abs(Math.abs(t.x-e.x)-Math.PI)<=n}function gs(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 _s(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];Me(s,o),Me(a,m);const u=Mt(i,new mu,!1),c=Mt(i,new mu,!1);fu.greatEllipticDistance(t,e,n.x,n.y,s[0],o[0],u,null,null),fu.greatEllipticDistance(t,e,n.x,n.y,a[0],m[0],c,null,null);return Math.min(u.val,c.val)}catch(s){i.error=s,i.hasError=!0}finally{At(i)}}function ps(e,n,r,i,s){const o=new t;r.queryEnvelope(o);const a=H(null,r,!0).total();if(n.xmin-o.xmin<=a&&o.xmax-n.xmax<=a)return r;const m=n.width();let u=0;for(;n.xmin+u*m<o.xmin;)u++;for(;n.xmin+u*m>o.xmin;)u--;const c=u*m,l=new qt;l.setShiftCoords(-c,0);const h=r;h.applyTransformation(l);const g=new t;h.queryEnvelope(g);let _=null;if(g.xmax>n.xmax){let r=0;const i=new t;i.setCoords({env2D:n}),i.ymin-=1,i.ymax+=1;let o=h;for(;i.xmin<g.xmax;){g.xmax>i.xmax&&(o=xo(o,e,2,!0,i.xmax));const t=K(o,i),a=F(null,t,!0).total(),u=Rt(o,i,a,Number.NaN,s);null===_?_=u===o?u.clone():u:(l.setShiftCoords(-r*m,0),u.applyTransformation(l),_.add(u,!1)),r++,i.xmin=i.xmax,i.xmax=n.xmax+r*m}}else _=h;return _}class fs{constructor(t,e){this.m_basisX=new M,this.m_basisY=new M,this.m_normal=new M,n(1===t.getCoordinateSystemType()),this.m_gcs=t;const r=Pm();t.querySpheroidData(r),this.m_a=r.majorSemiAxis,this.m_e2=r.e2,this.m_rpu=t.getUnit().getUnitToBaseFactor(),this.m_curvCenterRad=e.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),u=Math.sin(s);this.m_cartCenter3D=de(this.m_a,this.m_e2,o,a,m,u),this.m_normal.setCoordsPoint3D(this.m_cartCenter3D),this.m_d=this.m_cartCenter3D.length(),this.m_normal.divThis(this.m_d),M.selectRightHandedBasisFromNormal(this.m_normal,this.m_basisX,this.m_basisY),this.m_northPolePcs=this.projectPoint($.construct(0,.5*Math.PI/this.m_rpu)),this.m_southPolePcs=this.projectPoint($.construct(0,.5*-Math.PI/this.m_rpu))}project(t){const n=t.getGeometryType();if(u(n)){r(t);const e=t;return this.projectMultiVertex(e)}e("Gnomonic.project")}unproject(t,n,i){const s=t.getGeometryType();if(u(s)){r(t);let e=t;const a=[];if(s===o.enumPolygon){const t=e.getPathCount();for(let n=0;n<t;n++){const t=e.calculateRingArea2D(n);a.push(t)}}return this.unprojectMultiVertex(n,e),l(s)?(ws(this.m_gcs,0,e),ds(a,this.m_gcs,0,e,i)):e=ho(e,this.m_gcs,0,!0,0,i),e}e("Gnomonic.unproject")}projectPoint(t){const e=t.mul(this.m_rpu),n=pe(this.m_a,this.m_e2,e),r=this.m_normal.dotProduct(n);if(r<=0)return $.construct(Number.NaN,Number.NaN);const i=this.m_d/r,s=n.mul(i).sub(this.m_cartCenter3D),o=new $;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 xe(this.m_a,this.m_e2,e).divide(this.m_rpu)}projectMultiVertex(t){const e=t.getImpl();let n=!0;const r=new $,i=new $;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 $;i&&$.sqrDistance(t,this.m_northPolePcs)<=r?(e.setCoords(this.m_curvCenterRad.x,.5*Math.PI),e.scale(1/this.m_rpu)):s&&$.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 ds(e,n,r,i,s){const a=i.getGeometryType(),m=n.getPannableExtent();let u=i,c=!1,l=!1;if(a===o.enumPolygon){const i=new t,o=$.construct(r,0);i.setCoords({env2D:m}),i.centerAt(o),c=ys(e,n,i,u,s);const a=bs(n,i,u,s);a!==u&&(l=!0),u=a}else u=(new Hi).foldInto360RangeGeodetic(u,n,2);a===o.enumPolygon&&(c||l)&&(u=(new Ot).execute(u,n,!1,s)),u!==i&&(i.setEmpty(),i.add(u,!1))}function ys(t,e,n,r,i){const s=Ps(n,r),o=xs(t,e,n,r,i);return s||o}function Ps(e,n){const r=new t;n.queryEnvelope(r);const i=su(e.ymax,r.ymax),s=su(e.ymin,r.ymin),o=i||s;return!!o&&(Cs(e,n),o)}function xs(t,e,n,r,i){const s=[],o=[],a=.5*n.width();for(let l=0;l<r.getPathCount();l++){const m=r.getXY(r.getPathStart(l)),u=r.getXY(r.getPathEnd(l)-1),c=t[l]<0;if(Math.abs(m.x-u.x)>a){const t=Es(c,e,n,l,r,i);s.push(t),o.push(l)}else if(!c){if(r.calculateRingArea2D(l)<0){const t=Ss(e,n,l,r,i);s.push(t),o.push(l)}}}if(0===s.length)return!1;const m=new f({vd:r.getDescription()});let u=0,c=o[u];for(let l=0;l<r.getPathCount();l++)l===c?(m.add(s[u],!1),u++,u<o.length&&(c=o[u])):m.addPath(r,l,!0);return r.setEmpty(),r.add(m,!1),!0}function Cs(e,n){const r=new f,i=new t;for(let t=0;t<n.getPathCount();t++){n.queryPathEnvelope(t,i);let s=su(e.ymax,i.ymax),o=su(e.ymin,i.ymin);if(!(s||o)){r.addPath(n,t,!0);continue}r.insertPath2D(-1,null,0,0,!0);const a=n.getPathStart(t),m=n.getPathEnd(t),u=m-a;let c=-1;for(c=a;c<m;c++){const t=n.getXY(c);if(s=su(e.ymax,t.y),o=su(e.ymin,t.y),!s&&!o)break}let l=c,h=!1,g=Number.NaN;do{const i=n.getXY(l);s=su(e.ymax,i.y),o=su(e.ymin,i.y);const m=a+(l+1-a)%u;if(s||o){let s=$.construct(g,i.y);r.insertPoint2D(t,-1,s);const o=n.getXY(m),a=su(e.ymax,o.y),u=su(e.ymin,o.y);a||u||(s=$.construct(o.x,i.y),h?r.setXY(r.getPointCount()-1,s):r.insertPoint2D(t,-1,s)),h=!0}else r.insertPoint2D(t,-1,i),g=i.x,h=!1;l=m}while(l!==c)}n.setEmpty(),n.add(r,!1)}function Es(e,n,r,i,s,o){const a=new f,m=new f,u=new qt,c=s.getXY(s.getPathStart(i)),l=s.getXY(s.getPathEnd(i)-1),h=r.width(),g=.5*h,_=new t;s.queryEnvelope(_);const p=Math.ceil(_.width()/h)+1;let d,y;c.x>l.x?(d=-h,y=e?r.ymin:r.ymax):(d=h,y=e?r.ymax:r.ymin),u.setShiftCoords(d,0),a.addPath(s,i,!0),m.add(a,!1);const P=new A;for(let t=0;t<p;t++)m.applyTransformation(u),m.getPointByVal(0,P),a.lineToPoint(P),a.addSegmentsFromPath(m,0,0,m.getSegmentCount()-1,!1);const x=a.getXY(0),E=a.getXY(a.getPointCount()-1);x.y=y,E.y=y,a.lineTo(E);const S=new $;for(S.setCoordsPoint2D(E),S.x-=.5*d;Math.abs(S.x-x.x)>g;)a.lineTo(S),S.x-=.5*d;a.lineTo(x);const b=r.getCenter().x,w=new t;a.queryEnvelope(w);let T=0;const I=w.getCenter().x;I-b>g?T=-Math.ceil((I-b-g)/h):b-I>g&&(T=Math.ceil((b-I-g)/h)),0!==T&&(u.setShiftCoords(T*h,0),a.applyTransformation(u));const v=new C,D=v.addGeometry(a);Co(v,D,n,0,2,!0,r.xmin),Co(v,D,n,0,2,!0,r.xmax);const G=v.getGeometry(D),N=K(G,r);N.inflateCoords(0,1);const M=F(null,N,!0);return Rt(G,r,M.total(),Number.NaN,o)}function Ss(e,n,r,i,s){const o=n.width(),a=.5*o,m=n.getCenter().x,u=new t;i.queryPathEnvelope(r,u);let c,l=0,h=u.getCenter().x;if(h-m>a?l=-Math.ceil((h-m-a)/o):m-h>a&&(l=Math.ceil((m-h-a)/o)),0!==l){const t=new qt;t.setShiftCoords(l*o,0),i.getImpl().applyTransformationToPath(t,r),i.queryPathEnvelope(r,u),h=u.getCenter().x}const g=new t;n.containsExclusiveEnvelope(u)?(c=!1,g.setCoords({env2D:n})):(c=!0,g.setCoords({env2D:n}),g.xmin-=o,g.xmax+=o);let _=i.createInstance();_.addPathPoint2D(null,0,!0);const p=new $;if(p.setCoords(g.xmin,g.ymin),_.insertPoint2D(0,-1,p),p.setCoords(g.xmin,g.ymax),_.insertPoint2D(0,-1,p),p.setCoords(.5*(g.xmin+g.xmax),g.ymax),_.insertPoint2D(0,-1,p),p.setCoords(g.xmax,g.ymax),_.insertPoint2D(0,-1,p),p.setCoords(g.xmax,g.ymin),_.insertPoint2D(0,-1,p),p.setCoords(.5*(g.xmin+g.xmax),g.ymin),_.insertPoint2D(0,-1,p),c){_.addPath(i,r,!0);const t=new qt;h<m?t.setShiftCoords(o,0):t.setShiftCoords(-o,0),i.getImpl().applyTransformationToPath(t,r),_.addPath(i,r,!0);const a=new C,u=a.addGeometry(_);Co(a,u,e,0,2,!0,n.xmin),Co(a,u,e,0,2,!0,n.xmax),_=a.getGeometry(u);const c=K(_,n);c.inflateCoords(0,1);const l=F(null,c,!0).total();_=Rt(_,n,l,Number.NaN,s)}else _.addPath(i,r,!0);return _}function bs(e,n,r,i){const s=new t;r.queryEnvelope(s);const o=H(null,r,!0).total();if(n.xmin-s.xmin<=o&&s.xmax-n.xmax<=o)return r;const a=r.createInstance();let m=r.createInstance();const u=new t,c=r.getPathCount();for(let t=0;t<c;t++)r.queryPathEnvelope(t,u),n.xmin-u.xmin<=o&&u.xmax-n.xmax<=o?a.addPath(r,t,!0):(m.setEmpty(),m.addPath(r,t,!0),m=ps(e,n,m,!0,i),a.add(m,!0));return a}function ws(t,e,n){const r=t.getPannableExtent(),i=$.construct(e,0);r.centerAt(i);const s=r.width(),o=.5*s,a=new $;a.setNAN();let m=Number.NaN;for(let u=0;u<n.getPathCount();u++)for(let t=n.getPathStart(u);t<n.getPathEnd(u);t++){const e=n.getXY(t),i=su(e.y,r.ymax)||su(r.ymin,e.y);t===n.getPathStart(u)?(a.setNAN(),m=0):a.isNAN()||i||(m=Ts(e.x,a.x,o,s,m)),e.x+=m,n.setXY(t,e),i||a.setCoordsPoint2D(e)}n.getImpl().notifyModifiedFlags(2001)}function Ts(t,e,n,r,i){return i+t-e>n?i-=r:e-(i+t)>n&&(i+=r),i}function Is(t,e,n,r,i,s){const o=e.getAttributeStreamRef(0),a=e.getPointCount();let m=!1;const u=new $;for(let x=0;x<a;++x){if(o.queryPoint2D(2*x,u),1&s&&u.y>=n){m=!0;break}if(2&s&&u.y<=-n){m=!0;break}}if(!m)return!1;let c=!1;t&&(c=e.getImpl().isClosedPathInXYPlane(0));const l=new C,h=l.addGeometry(e),g=l.getFirstPath(h);let _=-1,p=!0;const f=new $,d=new A;let y=b;const P=Ms*i/360;for(let x=l.getFirstVertex(g);x!==b;x=l.getNextVertex(x)){l.queryXY(x,u);let t=1&s&&u.y>=n?1:0;if(t|=2&s&&u.y<=-n?2:0,_>0&&_!==t){if(f.x!==u.x){const t=l.getPrevVertex(x);l.queryPoint(t,d);const e=l.insertVertex(g,x,d);f.x=u.x,l.setXY(e,f)}if(c){let t=y!==b?l.getNextVertex(y):l.getFirstVertex(g);const e=l.getPrevVertex(x);for(;t!==e;)t=l.removeVertex(t,!1);if(y!==b){const t=l.getXY(y),n=l.getXY(e);if(Math.abs(t.x-n.x)>P){l.queryPoint(y,d);const r=l.insertVertex(g,e,d);t.x=pt(t.x,n.x,.5),l.setXY(r,t)}}}y=b}if(t&&(u.y=et(r,u.y),l.setXY(x,u),!p&&_!==t))if(u.x!==f.x){l.queryPoint(x,d);const t=l.insertVertex(g,x,d);l.setXYCoords(t,f.x,u.y),y=t}else y=x;_=t,f.assign(u),p=!1}if(c){if(y!==b){let t=l.getNextVertex(y);for(;t!==b;)t=l.removeVertex(t,!1)}const t=l.getFirstVertex(g);let e=l.getLastVertex(g);const n=l.getXY(t),r=l.getXY(e);if(!n.equals(r)&&(l.queryPoint(t,d),e=l.insertVertex(g,b,d),Math.abs(n.x-r.x)>P)){const t=l.insertVertex(g,e,d);n.x=pt(n.x,r.x,.5),l.setXY(t,n)}}return e.assignCopy(l.getGeometry(h)),!0}function vs(t,e){let n=new f({vd:t});n.addEnvelope(e,!1);const r=e.width()/180;return n=(new Ut).execute(n,r,0,0,null),n}function Ds(t,e){const n=t.getPannableExtent();return Number.isNaN(e)||n.centerAtCoords(e,0),n}function Gs(t,e,n){const r=Pm();e.querySpheroidData(r);const i=e.getGCS()!==e?e.getSRToGCSTransform():null,s=dt($,100),o=new M(0,0,0),a=t.getPointCount(),m=e.getGCS().getUnit().getUnitToBaseFactor();for(let h=0,g=a;h<g;){const e=Math.min(100,g-h);t.queryCoordinates(s,e,h,h+e),i&&(new Hi).transform(i,s,e,s,!1);for(let t=0;t<e;t++){if(s[t].isNAN())continue;s[t].scale(m);const e=pe(r.majorSemiAxis,r.e2,s[t]);o.addThis(e)}h+=e}const u=xe(r.majorSemiAxis,r.e2,o);u.scale(1/m);const c=t;if(!new fs(e.getGCS(),u).project(c))return 0;n.length=t.getPathCount();const l=c.calculateArea2D()<0;for(let h=0,g=t.getPathCount();h<g;h++){const t=c.calculateRingArea2D(h),e=l?t<0:t>0;n[h]=e}return l?-1:1}function Ns(t,e,n,r,i){if(!e.isPannable()||t.isEmpty())return t;const s=t.getGeometryType();s===o.enumGeometryCollection&&m("not yet impl for geometry collection");const a=e.getPannableExtent();Number.isNaN(n)&&(n=a.getCenterX());const l=a.width(),h=.5*l,g=i>0,_=t.queryInterval(0,0);if(!g&&_.width()<h||!u(t.getGeometryType())){const e=_.getCenter();if(Math.abs(e-n)<=h)return t;{const r=new qt,i=mt((n-e)/l)*l;r.setShiftCoords(i,0);const s=t.clone();return s.applyTransformation(r),s}}if(s===o.enumPolygon){let s=new d({vd:t.getDescription()});s.addAndExplicitlyOpenAllPaths(t,!1),g&&(s=zi(s,e,2,i,Number.NaN,null,!0));const o=[];if(!r){{let n=t;g&&(n=new f,n.add(s,!1));const r=Gs(t,e,o);if(r)r<0&&s.reverseAllPaths();else{const t=n.getPathCount();for(let e=0;e<t;e++)o.push(n.calculateRingArea2D(e)>0)}}r=o}return new As(null,r,s,null,e,n,3,0,null).geoNormalizePolygonGeometry(!0)}if(s===o.enumPolyline){let r=new d({vd:t.getDescription()});r.addAndExplicitlyOpenAllPaths(t,!1),g&&(r=zi(r,e,2,i,Number.NaN,null,!0));return new As(null,null,r,null,e,n,3,0,null).geoNormalizePolylineGeometry(!0)}if(s===o.enumMultiPoint){const e=t,r=e.getAttributeStreamRef(0);let i,s=null,o=n,a=0;const m=.1*l;for(let n=0,u=e.getPointCount();n<u;n++){const e=r.read(2*n);let u=e-o;if(Math.abs(u)>h&&(u=mt(u/l)*l,a-=u,Math.abs(a)<m&&(a=0)),0!==a){s||(i=t.clone(),s=i.getAttributeStreamRef(0));const r=e+a;s.write(2*n,r)}o=e}return s?(i.notifyModified(),i):t}c("")}const Ms=210;class As{constructor(t,e,r,i,s,o,a,m,u){this.m_bAdjustedAtPoles=0,this.m_inputPoly=r,this.m_progressTracker=u,this.m_originalGeometry=t,this.m_originalSR=i,this.m_polygonRingFlags=e,this.m_pannableSR=s,this.m_poleSnappingTolerance=m,this.m_poleFlags=a,this.m_bAdjustedAtPoles=0,this.m_pannableExtent=Ds(this.m_pannableSR,o),this.m_centralLongitude=Number.isNaN(o)?this.m_pannableExtent.getCenterX():o,this.m_width360=this.m_pannableExtent.width(),this.m_degree=this.m_width360/360,this.m_GCSLargeDelta=Ms*this.m_degree,n(null===this.m_originalGeometry&&null===this.m_originalSR||null!==this.m_originalGeometry&&null!==this.m_originalSR)}geonormalizeRing(t,e,r,i,s,o,a){let m=r;const u=new d({vd:this.m_inputPoly.getDescription()});u.addPath(this.m_inputPoly,t,!0),0!==this.m_poleFlags&&(this.m_bAdjustedAtPoles|=Is(!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&&(m=!1));let l=-1;m&&(l=this.m_originalGeometry.getPathStart(t));const h=u.getAttributeStreamRef(0),g=u.getPointCount();let _=0,p=h.read(0),f=0;const y=3*this.m_pannableSR.getTolerance(0);let P=!1;const x=new $,C=new $;let E=!1;const S=u.hasNonLinearSegments(),b=new $;for(let n=1;n<g;++n){h.queryPoint2D(2*n,b);const t=b.x;let e=t+_;const r=e-p;if(b.x=e,Math.abs(r)>this.m_GCSLargeDelta){if(m){const t=l+n-1,e=l+(n+1<g?n:0),s=o.read(2*t),a=(o.read(2*e)-s)*i;Math.abs(r-a)>1*this.m_degree&&(m=!1)}if(!m){_-=et(this.m_width360,e-p),e=t+_,++f,E=0!==_,b.x=e}}else P||q(x,C,b,y)&&(P=!0);E&&(S&&c("error in geonormalize_ring_ for curves"),h.write(2*n,e)),p=e,x.setCoordsPoint2D(C),C.setCoordsPoint2D(b)}f&&u.notifyModified();const w=u.getXY(0),T=u.getXY(g-1);if($.distance(w,T)<y){const t=this.finalizeGeoNormalizeClosedRing(u,P,s);a.add(t,!1)}else{if(e<0)if(null!==this.m_originalGeometry){n(null!==this.m_originalGeometry);e=this.m_originalGeometry.calculateRingArea2D(t)>0?1:0}else e=1;const r=this.finalizeGeoNormalizeOpenedRing(e>0,u);a.add(r,!1)}}geoNormalizePolygonGeometry(e){n(this.m_originalSR&&this.m_originalGeometry||!this.m_originalGeometry&&!this.m_originalSR),n(this.m_pannableSR.isPannable());let r=null,i=Number.NaN;const s=!!this.m_originalSR&&this.m_originalSR.isPannable();s&&(r=this.m_originalGeometry.getAttributeStreamRef(0),i=this.m_width360/this.m_originalSR.getPannableExtent().width()),this.m_bAdjustedAtPoles=0;const o=new f({vd:this.m_inputPoly.getDescription()});for(let t=0,n=this.m_inputPoly.getPathCount();t<n;++t){const n=this.m_polygonRingFlags?this.m_polygonRingFlags[t]?1:0:-1;this.geonormalizeRing(t,n,s,i,e,r,o)}const a=this.m_pannableSR.getTolerance(0),m=this.m_pannableExtent.width()/180;Io(o,this.m_pannableExtent,.1*a,!1);const u=t.constructEmpty();if(u.setCoords({env2D:this.m_pannableExtent}),e){let e=!0;for(let n=0;n<2;n++){e=!0;const n=t.constructEmpty();for(let t=0,r=o.getPathCount();t<r;t++)if(o.queryPathEnvelope(t,n),!(u.xmin<=n.xmin&&u.xmax>=n.xmax||n.xmin>=u.xmax||n.xmax<=u.xmin)){e=!1;break}if(e)break;u.move(.5*this.m_width360,0)}e||u.setCoords({env2D:this.m_pannableExtent})}let c=Rt(o,u,a,m,this.m_progressTracker),l=o!==c;const h=this.m_originalGeometry?this.m_originalGeometry.calculateArea2D():1,g=c.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=vs(c.getDescription(),u);t.add(c,!1),l=!0,c=t}return l&&(c=(new Ot).execute(c,this.m_pannableSR,!1,this.m_progressTracker)),c}geoNormalizePolylineGeometry(e){n(this.m_pannableSR.isPannable());let r=null;const i=this.m_originalSR&&this.m_originalSR.isPannable();let s=1;i&&(n(this.m_originalGeometry),s=this.m_width360/this.m_originalSR.getPannableExtent().width(),r=this.m_originalGeometry.getAttributeStreamRef(0));const o=this.m_pannableExtent.width(),a=o*ut()*4;let m=e,u=Number.NaN;const l=nt.constructEmpty();this.m_bAdjustedAtPoles=0;let h=new d({vd:this.m_inputPoly.getDescription()});for(let p=0,f=this.m_inputPoly.getPathCount();p<f;++p){let e=i;const g=new d({vd:this.m_inputPoly.getDescription()});g.addPath(this.m_inputPoly,p,!0);const _=this.m_inputPoly.isClosedPath(p);0!==this.m_poleFlags&&(this.m_bAdjustedAtPoles|=Is(_,g,this.m_pannableExtent.ymax-this.m_poleSnappingTolerance,this.m_pannableExtent.ymax,o,this.m_poleFlags)?1:0,this.m_bAdjustedAtPoles&&(e=!1));let f=-1;const y=g.getPointCount();let P=!1;e&&(f=this.m_originalGeometry.getPathStart(p),P=this.m_originalGeometry.isClosedPath(p));const x=g.getAttributeStreamRef(0);let C=0,E=x.read(0),S=0;const b=new $,w=new $;let T=!1;const I=g.hasNonLinearSegments(),v=new $;for(let t=1;t<y;++t){x.queryPoint2D(2*t,v);const n=v.x;let i=n+C;const o=i-E;if(v.x=i,Math.abs(o)>this.m_GCSLargeDelta){if(e){const n=f+t-1;let i=f;(!P||t+1<y)&&(i+=t);const a=r.read(2*n),m=(r.read(2*i)-a)*s;Math.abs(o-m)>1*this.m_degree&&(e=!1)}if(!e){C-=et(this.m_width360,i-E),i=n+C,++S,T=0!==C,v.x=i}}T&&(I&&c("error in geonormalize_ring_ for curves"),x.write(2*t,i)),E=i,b.setCoordsPoint2D(w),w.setCoordsPoint2D(v)}if(S&&g.notifyModified(),m){let e=!1;if(!g.isEmpty()){const r=t.constructEmpty();if(g.queryEnvelope(r),r.width()>=o||r.ymin<=this.m_pannableExtent.ymin||r.ymax>=this.m_pannableExtent.ymax)e=!0;else{if(Number.isNaN(u)){const t=this.m_centralLongitude-.5*o;u=r.xmin,u+=Math.round((t-r.xmin)/o)*o,u>t&&(u-=o),n(u<=t),u<t&&(u+=o),n(u>=t)}let t=Math.round((u-r.xmin)/o)*o;if(r.xmin+t>u+a&&(t-=o),r.xmin+t<u-a&&(t+=o),l.mergeCoordinate(r.xmin+t),l.mergeCoordinate(r.xmax+t),e=l.width()>=o,!e){const e=new qt;e.setShiftCoords(t,0),g.applyTransformation(e)}}}h.add(g,!1),e&&(h=(()=>{const t=new d({vd:h.getDescription()});for(let e=0,n=h.getPathCount();e<n;++e){const n=new d({vd:h.getDescription()});n.addPath(h,e,!0);const r=ho(n,this.m_pannableSR,this.m_centralLongitude,!0,0,this.m_progressTracker);t.add(r,!1)}return t})(),m=!1)}else{const t=ho(g,this.m_pannableSR,this.m_centralLongitude,!0,0,this.m_progressTracker);h.add(t,!1)}}if(m)return h;const g=this.m_pannableSR.getTolerance(0),_=this.m_pannableExtent.width()/180;Io(h,this.m_pannableExtent,.1*g,!1);return Rt(h,this.m_pannableExtent,g,_,this.m_progressTracker)}finalizeGeoNormalizeOpenedRing(e,r){const i=r.getPointCount(),s=r.getXY(0),o=r.getXY(i-1);{const t=Math.abs(o.x-s.x),e=Math.round(t/this.m_width360)*this.m_width360;n(Math.abs(t-e)<this.m_pannableSR.getTolerance(0))}const a=rt(o.x-s.x),m=t.constructEmpty();r.queryLooseEnvelope(m);const u=this.m_pannableExtent.getCenterX();let c=0,l=u-this.m_width360,h=u+this.m_width360;if(a>=0){let t=Math.ceil((l-m.xmin)/this.m_width360);for(t*=this.m_width360;l>m.xmin+t;)t+=this.m_width360;for(;l<m.xmax+t;)t-=this.m_width360;for(c=t,m.width()>720&&(h=l+360*Math.ceil(m.width()/360));h<m.xmax;)h+=this.m_width360}else{let t=Math.ceil((h-m.xmax)/this.m_width360);for(t*=this.m_width360;h<m.xmax+t;)t-=this.m_width360;for(;h>m.xmin+t;)t+=this.m_width360;for(c=t,m.width()>720&&(l=h-360*Math.ceil(m.width()/360));l>m.xmin;)l-=this.m_width360}const g=Math.round(Math.abs(o.x-s.x)/this.m_width360)*this.m_width360,_=a*g,p=m.clone();p.move(c,0);const y=new $(0,0),P=new qt;P.setShiftCoords(c,0),r.applyTransformation(P);const x=new d({vd:r.getDescription()});x.add(r,!1),y.assign(r.getXY(i-1));let C=0,E=x.getXY(0).x;for(;a>0?p.xmax<h:p.xmin>l;)p.move(_,0),P.xd=_,r.applyTransformation(P),E+=_,this.m_pannableExtent.xmin<=E&&this.m_pannableExtent.xmax>=E&&(C=x.getPointCount()-1),r.setXY(0,y),y.assign(r.getXY(i-1)),x.addSegmentsFromPath(r,0,0,i-1,!1);const S=new f({vd:x.getDescription()});S.add(x,!1);const b=x.getXY(0),w=x.getXY(x.getPointCount()-1),T=a<0?e:!e,I=S.getPointCount()-1;if(T){const t=new $(w.x,this.m_pannableExtent.ymax);S.lineTo(t);const e=new $(this.m_pannableExtent.getCenterX(),this.m_pannableExtent.ymax);S.lineTo(e);const n=new $(b.x,this.m_pannableExtent.ymax);S.lineTo(n)}else{const t=new $(w.x,this.m_pannableExtent.ymin);S.lineTo(t);const e=new $(this.m_pannableExtent.getCenterX(),this.m_pannableExtent.ymin);S.lineTo(e);const n=new $(b.x,this.m_pannableExtent.ymin);S.lineTo(n)}if(S.interpolateAttributesPath(0,I,0),S.getImpl().changeRingStartPoint(C),g>this.m_width360){const t=new f({copy:S});P.setShiftCoords(this.m_width360,0),t.applyTransformation(P),S.add(t,!1)}return S}finalizeGeoNormalizeClosedRing(e,n,r){const i=new f({vd:e.getDescription()});i.add(e,!1);const s=()=>{const t=i.getPointCount()-2;return i.getSegmentType(t)!==o.enumLine};if(i.hasNonLinearSegments()&&s()){const t=new y,e=i.getPointCount()-2;i.getSegmentBuffer(e,t,!1),i.removePointFromPath(0,e+1),i.closeLastPathWithSegment(t.get())}else i.removePointFromPath(0,i.getPointCount()-1);const a=t.constructEmpty();i.queryLooseEnvelope(a);let m=Math.ceil((this.m_pannableExtent.xmin-a.xmin)/this.m_width360);for(m*=this.m_width360;this.m_pannableExtent.xmin>a.xmin+m;)m+=this.m_width360;for(;this.m_pannableExtent.xmin<a.xmax+m;)m-=this.m_width360;if(m+=this.m_width360,0!==m){a.move(m,0);const t=new qt;t.setShiftCoords(m,0),i.applyTransformation(t)}if(this.m_pannableExtent.xmin<=a.xmin&&this.m_pannableExtent.xmax>=a.xmax){if(n){const t=i.calculateArea2D(),e=(new Ot).execute(i,this.m_pannableSR,!0,this.m_progressTracker);if(e!==i){const n=e.calculateArea2D();rt(t)!==rt(n)&&e.reverseAllPaths(),i.assignMove(e)}}let t;if(t=new f(r?{copy:i}:{move:i}),r)for(;a.xmin<this.m_pannableExtent.xmax;){a.move(this.m_width360,0);const e=new qt;e.setShiftCoords(this.m_width360,0),i.applyTransformation(e),t.add(i,!1)}return t}let u=new f({vd:e.getDescription()});u.add(i,!1);const c=n||a.width()>this.m_width360-10*this.m_pannableSR.getTolerance(0);for(;a.xmin<this.m_pannableExtent.xmax;){a.move(this.m_width360,0);const t=new qt;t.setShiftCoords(this.m_width360,0),i.applyTransformation(t),u.add(i,!1)}if(c){const t=u.calculateArea2D();u.setFillRule(1),u=(new Ot).execute(u,this.m_pannableSR,!0,this.m_progressTracker);const e=u.calculateArea2D();rt(t)!==rt(e)&&u.reverseAllPaths()}return u}geonormalize_ring_(t,e,r,i,s,o,a){n(0)}}function qs(t){n(0);const e=ja(t),r=new Us;return r.setVertProj_(e),r}function Rs(t,e=!0){return n(0),{}}function Ys(t){return am()}class Us{constructor(){this.m_hashCode=0,this.m_peVertSysVal=null,this.m_verticalUnit=new cm,this.m_verticalShift=0,this.m_userVerticalWKID=0,this.m_bIsDepth=!1}getType(){return n(0),0}getID(){return n(0),0}getLatestID(){return this.m_peVertSysVal?this.m_peVertSysVal.getLatestID():0}getOldID(){return this.m_peVertSysVal?this.m_peVertSysVal.getOldID():0}getText(){return n(0),""}getTextExtended(t){return n(0),""}getText2(t){return n(0),""}getUnit(){return n(0),{}}equals(t){return n(0),!1}equalForProjection(t){return n(0),!1}getPeVertcsCopy(){return n(0),{}}getOneMeter(){return 1/this.m_verticalUnit.getUnitToBaseFactor()}getUnitToBaseFactor(){return n(0),0}isDepth(){return n(0),!1}getVerticalShift(){return n(0),0}isCustomWkid(){return!!this.m_peVertSysVal&&this.m_peVertSysVal.isCustomWkid()}getHashCode(){return this.m_hashCode}setVertProj_(t){this.m_peVertSysVal=t}getPEVerticalCoordSys(){return this.m_peVertSysVal?this.m_peVertSysVal.m_peVertcs:null}}function Os(t,e,n,r,i){if(t.equals(e))return!1;if(r){let n=1,s=0,o=1,a=1,m=0,u=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,u=e.m_heightSign);const c=o*u*n/a;for(let t=0;t<i;t++)r[t]=(r[t]-s)*c+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=D(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 Xs(){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 at(this.m_heightSign,t.m_heightSign)&&at(this.m_heightMetersPerUnit,t.m_heightMetersPerUnit)&&at(this.m_heightZ0,t.m_heightZ0)&&at(this.m_XYToRadians,t.m_XYToRadians)&&at(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&&n(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)}}}class Fs{constructor(t){this.m_constantsLoaded=-1,this.m_isUsable=-1,this.m_inputSR=null,this.m_outputSR=null,this.m_inputSRHorz=null,this.m_outputSRHorz=null,this.m_inputVCS=null,this.m_outputVCS=null,this.m_hashCode=0,this.m_areaOfUse=new Y,this.m_inputUnitParams=Xs(),this.m_outputUnitParams=Xs(),n(t),this.m_geogTran=t,this.m_vertTran=null,this.m_latestID=uu.getCode(this.m_geogTran),this.m_latestID<0&&(this.m_latestID=0);const e=this.m_geogTran.getGeogcs1();uu.getCode(e);const r=this.m_geogTran.getGeogcs2();uu.getCode(r),this.initUnitParams()}getLatestId(){return this.m_latestID}getText(){return this.m_geogTran?this.m_geogTran.toString():(n(0),"")}getGeogtran(){return this.m_geogTran}getVerttran(){return null}loadConstants(t){let e=this.m_constantsLoaded;if(-1===e){if(!t){this.m_geogTran||c("vcs not impl");const e=this.m_geogTran.getParameters();null!==e[cu.PE_PARM_ND]&&(t=0===e[cu.PE_PARM_ND].getValue())}e=this.m_geogTran.loadConstants()?1:0,this.m_constantsLoaded=e}return 0!==e}isUsable(){let t=this.m_isUsable;return-1===t&&(this.m_geogTran?this.m_isUsable=t=this.m_geogTran?1:0:this.m_isUsable=t=this.m_vertTran?1:0),1===t}getInputSr(t){return this.updateSrs(),t?this.m_inputSR:this.m_inputSRHorz}getOutputSr(t){return this.updateSrs(),t?this.m_outputSR:this.m_outputSRHorz}getHashCode(){let t=this.m_hashCode;return 0===t&&(t=this.m_latestID>0?J(this.m_latestID):yt(this.getText()),0===t&&(t=345),this.m_hashCode=t),t}isGeogtran(){return null!==this.m_geogTran}prepareOrThrow(){}getName(){return this.isGeogtran()?this.getGeogtran().getName():(m("vcs not impl"),"")}updateSrs(){if(this.m_inputSR||this.m_inputVCS)return;let t,e,r,i,s,o;if(this.m_geogTran){const n=this.m_geogTran.getGeogcs1(),a=Va(n),m=this.m_geogTran.getGeogcs2(),u=Va(m);let c=-1,l=-1;c=a.getVcsCode(),l=u.getVcsCode(),r=vm(n,null,null,1),i=vm(m,null,null,1),c>0&&l>0?(s=qs(c),o=qs(l),t=Nm(),e=Nm()):(t=r,e=i)}else n(0);this.m_inputSR||this.m_inputVCS||(this.m_inputSR=t,this.m_outputSR=e,this.m_inputSRHorz=r,this.m_outputSRHorz=i,this.m_inputVCS=s,this.m_outputVCS=o)}initUnitParams(){if(this.m_inputUnitParams.m_heightSign=1,this.m_inputUnitParams.m_heightMetersPerUnit=Number.NaN,this.m_inputUnitParams.m_heightZ0=0,this.m_outputUnitParams.m_heightSign=1,this.m_outputUnitParams.m_heightMetersPerUnit=Number.NaN,this.m_outputUnitParams.m_heightZ0=0,this.m_inputUnitParams.m_XYToRadians=Number.NaN,this.m_inputUnitParams.m_PrimeMeridianDegrees=Number.NaN,this.m_outputUnitParams.m_XYToRadians=Number.NaN,this.m_outputUnitParams.m_PrimeMeridianDegrees=Number.NaN,this.m_vertTran)n(0);else if(this.m_geogTran){const t=this.m_geogTran;let e=t.getGeogcs1();this.m_inputUnitParams.m_XYToRadians=e.getUnit().getUnitFactor(),this.m_inputUnitParams.m_PrimeMeridianDegrees=e.getPrimem().getLongitude(),e=t.getGeogcs2(),this.m_outputUnitParams.m_XYToRadians=e.getUnit().getUnitFactor(),this.m_outputUnitParams.m_PrimeMeridianDegrees=e.getPrimem().getLongitude()}}}function Ls(t,e,n,r,i,s,o){let a=null;if(e){a=e.getPEVerticalCoordSys()}let m=null;if(t){m=t.getPECoordSys()}let u=null;if(r){u=r.getPEVerticalCoordSys()}let c=null;if(n){c=n.getPECoordSys()}if(!(m||a||c||u))return!1;const l=Xs();l.initFromGcsAndVcsPe(m,a);const h=Xs();return h.initFromGcsAndVcsPe(c,u),Os(l,h,i,s,o)}function Hs(t,e,n,r,i,s,o,a){const m=e,u=t,c=Xs();c.initFromGcsAndVcsPe(u,m),a.assign(r?n.m_outputUnitParams:n.m_inputUnitParams),a.processUnitParams(c),c.processUnitParams(a),o>0&&Os(c,a,i,s,o)}function Vs(t,e,n,r,i,s,o,a){const m=Xs();m.assign(n?e.m_inputUnitParams:e.m_outputUnitParams),m.processUnitParams(t);let u=null,c=null;if(r){c=r.getPECoordSys()}const l=Xs();l.initFromGcsAndVcsPe(c,u),l.processUnitParams(m),m.processUnitParams(l),a>0&&Os(m,l,s,o,a)}function zs(t,e,n,r,i,s,o,a,m){const u=Xs(),c=Xs();u.assign(n?e.m_inputUnitParams:e.m_outputUnitParams),c.assign(i?r.m_outputUnitParams:r.m_inputUnitParams),u.processUnitParams(t),c.processUnitParams(u),u.processUnitParams(c),a>0&&Os(u,c,s,o,a),m.assign(c)}function js(t,e,n,r,i,s,o){const a=e.getVerttran(),m=e.getGeogtran();if(o.assign(n?e.m_inputUnitParams:e.m_outputUnitParams),o.processUnitParams(t),s>0){e.prepareOrThrow();const t=n?cu.PE_TRANSFORM_2_TO_1:cu.PE_TRANSFORM_1_TO_2;a?ea():na(m,s,r,i,t)}}function ks(t,e,n,r,i){const s=t.getVerttran(),o=t.getGeogtran();if(i>0){t.prepareOrThrow();const a=e?cu.PE_TRANSFORM_2_TO_1:cu.PE_TRANSFORM_1_TO_2;s?ea():na(o,i,n,r,a)}}class Bs{supportsCurves(){return!0}accelerateGeometry(t,e,n){return Ws(t,e,n)}canAccelerateGeometry(t){return Zs(t)}}function Ws(t,e,n){if(!Zs(t))return!1;V(e,t,!1);let r=0;const i=t.getGeometryType();return l(i)&&T(t)&&0!==n&&(r|=t.getImpl().buildQuadTreeAccelerator(n)?1:0),l(i)&&I(t)&&0!==n&&(r|=t.getImpl().buildQuadTreeForPathsAccelerator(n)?1:0),r>0}function Zs(t){return T(t)||I(t)}class Ks extends Bs{getOperatorType(){return 8}execute(t,e,n,r){return En(t,e,n,1,r)}}class Qs extends Bs{getOperatorType(){return 3}execute(t,e,n,r=null){return En(t,e,n,4,r)}}function Js(e,n,r){const i=n.getGCSSplitLines();if(null===i)return e;const s=n.getGCS(),o=s.getPannableExtent().width(),a=t.constructEmpty();e.queryLooseEnvelope(a);const m=nt.constructEmpty();a.queryIntervalX(m);const u=i.querySegmentIterator();let c=null;const l=new qt;for(;u.nextPath();)for(;u.hasNextSegment();){const t=u.nextSegment(),e=t.queryInterval(0,0),n=nt.constructEmpty();n.setCoordsFromEnvelope(e);let r=0;for(;n.vmax>m.vmin;)n.move(-o),r--;for(;n.vmin<=m.vmax;){if(n.isIntersecting(m)){null===c&&(c=new d);const e=new w({start:t.getStartXY(),end:t.getEndXY()});0!==r&&(l.setShiftCoords(r*o,0),e.applyTransformation(l)),c.addSegment(e,!0)}n.move(o),++r}}if(null!==c){const t=H(s,c,!0),n=z(t);return Kt(e,c,n,r)}return e}function $s(t,e,n){let r=t.getName();return Lm(r)||(n||e>0?(r=t.toString(cu.PE_STR_NAME_CANON|cu.PE_STR_AUTH_NONE),r=io(r)):r=t.toString(cu.PE_STR_AUTH_TOP)),r}function to(t,e,r,i){return n(0),""}function eo(t,n=-1){if((n>1||n<-1)&&e("verbosity"),-1===n)return t.toString();{const e=0===n?cu.PE_STR_AUTH_TOP:cu.PE_STR_AUTH_ALL;return t.toString(e)}}function no(t,n){(n>1||n<-1)&&e("verbosity");let r=cu.PE_STR_FMT_WKT2;return-1!==n&&(r|=0===n?cu.PE_STR_AUTH_TOP:cu.PE_STR_AUTH_ALL),t.toString(r)}function ro(t){return n(0),""}function io(t){return t.toLocaleUpperCase("en-US")}function so(t,n,r){const i=t.getPCSHorizon();if(i.getGeometryType()!==o.enumPolygon)if(i.getGeometryType()!==o.enumEnvelope)e("");else{const t=i;for(let e=0;e<r;e++)t.contains(n[e])||n[e].setNAN()}else{const e=t.getDefaultPrecisionSR().getTolerance(0),s=i;for(let t=0;t<r;t++)1!==zt(s,n[t],e)&&n[t].setNAN()}}function oo(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=po(e,n,r)}}function ao(e,n,r,i){if(e.isEmpty()||1===r)return e;const s=e.getGeometryType();if(s===o.enumPoint){const t=e,i=t.getXY();return 0===lo([i],1,n,r)||i.isNAN()?t.setEmpty():t.setXY(i),e}if(s===o.enumMultiPoint){const t=e,i=e.createInstance(),s=t.getPointCount();i.reserve(s);const o=t.getAttributeStreamRef(0),a=t.getDescription().getAttributeCount()>1,m=new A,u=Float64Array.from(o.getArray());if(lo(u,s,n,r)>0)for(let e=0,n=2*s;e<n;e+=2)Number.isNaN(u[e])||(a?(t.getPointByVal(e>>1,m),m.setXYCoords(u[e],u[e+1]),i.add(m)):i.addXY(u[e],u[e+1]));return i}let a=e;const m=n.getOneDegreeGCSUnit(),u=90*m,h=180*m,g=360*m,_=n.getCentralMeridian(),p=.5*m,f=t.constructEmpty();a.queryEnvelope(f);const d=n.getGCSHorizon(),y=n.getGCSHorisonIsInclusive(),P=d.getGeometryType()===o.enumEnvelope,x=t.constructEmpty();d.queryEnvelope(x);const C=n.getGCS();if(2!==r&&4!==r||(x.xmin=_-h,x.xmax=x.xmin+g),4===r){if(!(f.width()>g-m)){const e=t.constructEmpty();e.setCoords({xmin:f.xmin-m,ymin:x.ymin,xmax:f.xmax+m,ymax:x.ymax}),a=(new Lt).execute(a,e,C,i);let n=Math.floor((_-f.getCenterX())/g);for(f.move(n*g,0);f.xmin>x.xmax;)n-=1,f.move(-g,0);for(;f.xmin<x.xmin;)n+=1,f.move(g,0);if(0!==n){const t=new qt;t.setShiftCoords(n*g,0),a.applyTransformation(t)}return a}r=2}if(2===r&&(x.xmin=_-h,x.xmax=x.xmin+g),f.ymin<-u||f.ymax>u){const e=t.constructEmpty();if(e.setCoords({xmin:f.xmin-m,ymin:-u,xmax:f.xmax+m,ymax:u}),a=(new Lt).execute(a,e,C,i),a.isEmpty())return a;a.queryEnvelope(f)}if(y&&(x.ymax<f.ymin||x.ymin>f.ymax))return a.createInstance();f.width()>g&&(a=wo(a,_-h,g,C,!0,0,!0,i),a.queryEnvelope(f));let E=bo(f.xmin,f.xmax,x.xmin,x.xmax,g);if(0!==E&&f.move(E,0),f.xmax>x.xmax||f.xmin<x.xmin){if(f.xmax>x.xmax)for(;f.xmin>=x.xmax;)f.move(-g,0),E-=g;for(;f.xmin<x.xmax-g;)f.move(g,0),E+=g}const S=V(C,d,!1);if(0!==E){const t=new qt;t.setShiftCoords(E,0),a.applyTransformation(t),E=0}if(y){if(P&&x.containsEnvelope(f))return a;const t=new Array(2);for(let e=0;e<2;e++){let n;if(P?n=l(s)?Rt(a,x,S,p,i):Rt(a,x,S,0,i):(n=(new Ht).execute(a,d,C,i),n===d&&(n=n.clone())),x.xmin<=f.xmin&&x.xmax>=f.xmax)return n;if(x.xmin>=f.xmin&&x.xmax<=f.xmax)return n;if(t[e]=n,0===e){f.move(-g,0);const t=new qt;t.setShiftCoords(-g,0),a.applyTransformation(t)}}return l(s)?t[0].add(t[1],!1):c("intersect_with_GCS_horizon: unexpected geometry type"),t[0]}{if(x.ymax<f.ymin||x.ymin>f.ymax)return a;let t=0;for(;!a.isEmpty()&&f.xmax>x.xmin;){if(0!==t){const e=new qt;e.setShiftCoords(t,0),a.applyTransformation(e)}if(!(new Qs).execute(a,d,C,i)){a=(new ee).execute(a,d,C,i),d===a&&(a=a.clone())}if(0!==t){const e=new qt;e.setShiftCoords(-t,0),a.applyTransformation(e)}t-=g,f.move(-g,0)}return a}}function mo(t,e,n,r,i,s){const o={stack:[],error:void 0,hasError:!1};try{if(2===s){return Ge(t,e,n,r,i)}if(Math.abs(n.x-r.x)>=Math.PI||!Pa(n.x,r.x,i))return Number.NaN;n.x>r.x&&(r=bt(n,n=r));const a=Mt(o,new mu,!1),m=Mt(o,new mu,!1),u=Mt(o,new mu,!1),c=n.clone();fu.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(fu.geodeticCoordinate(t,e,n.x,n.y,l*o,a.val,m,u,s),c.x=m.val,c.y=u.val,c.x===i)return c.y;if(Pa(n.x,c.x,i))g=o;else{if(!Pa(r.x,c.x,i))return Number.NaN;h=o}}return c.y}catch(a){o.error=a,o.hasError=!0}finally{At(o)}}function uo(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 co(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 lo(e,n,r,i){if(0===n||1===i)return n;const s=uo(e,n);if(2===i){const t=r.getPannableExtentInGCS();let i=n;for(let e=0,r=2*n;e<r;e+=2)(s[e+1]>t.ymax||s[e+1]<t.ymin)&&(s[e]=Number.NaN,i--);return i?(To(s,n,t.xmin,t.width(),!0),e!==s&&co(s,e,0,n),i):0}const a=r.getOneDegreeGCSUnit(),m=90*a,u=180*a,c=360*a;let l=n;for(let t=0,o=2*n;t<o;t+=2)(s[t+1]>m||s[t+1]<-m)&&(s[t]=Number.NaN,l--);if(!l)return 0;const h=t.constructEmpty();h.setFromPoints(s,n);const g=r.getGCSHorizon(),_=r.getGCSHorisonIsInclusive(),p=g.getGeometryType()===o.enumEnvelope,f=t.constructEmpty();if(g.queryEnvelope(f),_&&(f.ymax<h.ymin||f.ymin>h.ymax))return 0;if(_){if(To(s,n,f.getCenterX()-u,c,!0),l=n,p)for(let t=0,e=2*n;t<e;t+=2)f.containsCoords(s[t],s[t+1])||(s[t]=Number.NaN,l--);else{const t=V(r.getGCS(),g,!1),e=new $;for(let r=0,i=2*n;r<i;r+=2){e.setCoords(s[r],s[r+1]);0!==zt(g,e,t)||(s[r]=Number.NaN,l--)}}}else{To(s,n,-u,c,!0),l=n;const t=V(r.getGCS(),g,!1),e=new $;for(let r=0,i=2*n;r<i;r+=2){e.setCoords(s[r],s[r+1]),e.isNAN()&&l--;const n=So(e.x,f.xmin,f.xmax,c);e.x+=n;0!==zt(g,e,t)&&(s[r]=Number.NaN,l--)}}return l>0&&Array.isArray(e)&&co(s,e,0,n),l}function ho(t,n,r,i,s,o){if(n.isPannable()||e("fold_into_360_degree_range"),t.isEmpty())return t;let a,m;if(2===n.getCoordinateSystemType()){const t=n.getPannableExtent();m=t.xmin,a=t.width()}else{const t=n.getOneDegreeGCSUnit();a=360*t,m=r-180*t}return wo(t,m,a,n,i,s,!0,o)}function go(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}To(t,e,i,s)}function _o(t,e){const n=e.width();let r=it(t-e.vmin,n);r<0&&(r+=n);return e.snapClip(r+e.vmin)}function po(t,e,n){return t>e.xmax&&t-e.xmax<n?e.xmax:t<e.xmin&&e.xmin-t<n?e.xmin:t}function fo(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 yo(t,e,n,r,i,s,o,a,m){return new As(t,null,n,e,r,i,o,a,s).geoNormalizePolygonGeometry(m)}function Po(t,e,n,r,i,s,o,a,m){return new As(t,null,n,e,r,i,o,a,s).geoNormalizePolylineGeometry(m)}function xo(t,e,n,r,i){const s=new C,o=s.addGeometry(t);return Co(s,o,e,V(e,t,!1),n,r,i),s.getGeometry(o)}function Co(t,e,r,i,s,o,a){const m={stack:[],error:void 0,hasError:!1};try{n(Sm()),r.isPannable()||h("insert_geodetic_points");const u=r.getPannableExtent(),c=r.getGCS(),l=Pm();c.querySpheroidData(l);const g=c.getUnit().getUnitToBaseFactor(),_=l.majorSemiAxis,p=l.e2;let f=0;const d=new nt;u.queryIntervalX(d);let y=null;const P=new Array(4);2===r.getCoordinateSystemType()?(y=r.getPECoordSys(),o?(P[0]=_o(a,d),P[1]=u.getCenterY(),lu.projToGeog(y,1,P),f=P[0]*g):(P[0]=u.getCenterX(),P[1]=a,lu.projToGeog(y,1,P),f=P[1]*g)):f=a*g,o||0===f||2===s||h("insert_geodetic_points: 1");const x=Mt(m,new mu,!1),C=new $,E=new $,S=new $,w=new $,T=new $,I=new $;for(let n=t.getFirstPath(e);n!==b;n=t.getNextPath(n)){const e=t.getFirstVertex(n);t.queryXY(e,S);let m=!1;const u=t.getNextVertex(e);for(let n=u;n!==b;n=t.getNextVertex(n)){if(n===u){if(m)break;m=!0}if(t.queryXY(n,w),o&&(i<a-S.x&&w.x-a>i||i<a-w.x&&S.x-a>i)||!o&&(0!==a||i<-S.y&&w.y>i||i<-w.y&&S.y>i))do{if(Math.abs(S.x-w.x)>=.5*d.width())break;2===r.getCoordinateSystemType()?(P[0]=_o(S.x,d),P[1]=S.y,P[2]=_o(w.x,d),P[3]=w.y,Bo(y,2,P,0),T.x=P[0]*g,T.y=P[1]*g,I.y=P[3]*g):(T.x=S.x*g,T.y=S.y*g,I.y=w.y*g),I.x=(w.x-S.x)*Math.PI*2/d.width()+T.x;let e=0;const i=dt($,2);if(o){if(E.x=f,E.y=mo(_,p,T,I,f,s),Number.isNaN(E.y))break;i[0]=E,e=1}else if(2===s){const t=[0,0];if(e=Ne(_,p,T,I,f,t),!e)break;i[0].x=t[0],i[0].y=f,2===e&&(i[1].x=t[1],i[1].y=f)}else{if(E.x=xa(_,p,T,I,s),Number.isNaN(E.x))break;E.y=0,i[0]=E,e=1}let m=-1;for(let u=0;u<e;u++){fu.geodeticDistance(_,p,T.x,T.y,I.x,I.y,x,null,null,s);const e=x.val;fu.geodeticDistance(_,p,T.x,T.y,i[u].x,i[u].y,x,null,null,s);const c=x.val;2===r.getCoordinateSystemType()?(P[0]=i[u].x/g,P[1]=i[u].y/g,lu.geogToProj(y,1,P),o?(C.y=P[1],C.x=a):(C.x=Ca(P[0],S.x,w.x,d),C.y=a)):o?(C.x=a,C.y=i[u].y/g):(C.x=Ca(i[u].x/g,S.x,w.x,d),C.y=a);const l=e>0?Pt(c/e,0,1):.5;if(0===l||1===l)continue;if(m>l)continue;const h=t.getPrevVertex(n);t.splitSegment(h,[l],1);const f=t.getNextVertex(h);t.setXYCoords(f,C.x,C.y),m=l}}while(0);S.setCoordsPoint2D(w)}}}catch(u){m.error=u,m.hasError=!0}finally{At(m)}}function Eo(e,r){n(r.isPannable());const i=r.getPannableExtent();if(e.getGeometryType()===o.enumPoint){const t=e.getY();return i.ymin<=t&&t<=i.ymax?e:e.createInstance()}const s=t.constructEmpty();e.queryEnvelope(s);const a=t.constructEmpty();a.setCoords({env2D:i}),a.xmin=s.xmin,a.xmax=s.xmax,a.inflateCoords(.01*a.height(),0);const m=R(r,s,!1);let u;return u=a.containsEnvelope(s)?e:Rt(e,a,m,0,null),u}function So(t,e,n,r){return mt((.5*(n+e)-t)/r)*r}function bo(t,e,n,r,i){if(t>=n&&e<=r)return 0;return So(.5*(e+t),n,r,i)}function wo(e,n,r,i,s,a,m,u){const c=e.getGeometryType(),l=nt.constructEmpty();l.setCoords(n,n+r);const h=[0];if(c===o.enumPoint){const t=e;if(h[0]=t.getX(),fo(h,l,m)){const t=s?e:e.clone();return t.setX(h[0]),t}return e}const g=t.constructEmpty();if(e.queryEnvelope(g),g.isEmpty())return e;if(c===o.enumMultiPoint){const t=s?e:e.clone(),n=t.getImpl(),r=n.getAttributeStreamRef(0),i=2*n.getPointCount();let o=!1;for(let e=0;e<i;e+=2)h[0]=r.read(e),fo(h,l,m)&&(r.write(e,h[0]),o=!0);return o&&n.notifyModifiedFlags(2001),t}const _=nt.constructEmpty();if(g.queryIntervalX(_),l.contains(_))return l.vmax,_.vmax,e;const p=t.constructEmpty();if(p.setCoords({env2D:g}),0===_.width()){let t=_.vmin;t+=Math.ceil((l.vmin-t)/r)*r,t=l.snapClip(t);const n=s?e:e.clone();return n.setAttributeBasic(0,0,t),n}if(c===o.enumEnvelope){const t=s?e:e.clone();return g.intersect(p),t.setEnvelope(g),t}const y=.1*Math.max(g.height(),g.width())*1;p.inflateCoords(0,y);let P=e;const x=i.getTolerance(0),C=new qt;for(;;){const t=Math.floor((_.vmin-n)/r),e=Math.ceil((_.vmax-n)/r);if(!(e-t>3))break;{const s=Math.floor(.5*(e+t));p.xmin=g.xmin-y,p.xmax=n+r*s;const m=Rt(P,p,x,a,u);p.xmin=p.xmax,p.xmax=g.xmax+y;const l=Rt(P,p,x,a,u);C.setShiftCoords((s-e)*r,0),l.applyTransformation(C),c===o.enumPolygon?P=(new te).execute(m,l,i,u):(P=m,P.add(l,!1)),P.queryEnvelope(g),g.queryIntervalX(_)}}p.xmin=n,p.xmax=n+r;const E=t.constructEmpty();E.setCoords({env2D:p}),E.inflateCoords(x,0);const S=Math.floor((g.xmin-p.xmin)/r)*r;let b;S?(p.move(S,0),C.setShiftCoords(-S,0)):C.setIdentity(),b=c===o.enumPolyline?new d({vd:P.getDescription()}):new f({vd:P.getDescription()});const w=t.constructEmpty(),T=t.constructEmpty();for(;g.xmax>p.xmin;){const t=Rt(P,p,x,0,u);t.queryEnvelope(T);let e=!1;e=c===o.enumPolyline?!t.isEmpty()&&(T.width()>x||T.height()>x):!t.isEmpty()&&(c!==o.enumPolygon||T.width()>x),e&&(t.applyTransformation(C),t.queryEnvelope(T),b.queryEnvelope(w),w.inflateCoords(x,x),w.isIntersecting(T)&&c===o.enumPolygon?b=(new te).execute(b,t,i,u):b.add(t,!1)),p.move(r,0),C.shiftCoords(-r,0)}return b}function To(t,e,n,r,i=!0){const s=new nt;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,fo(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],fo(o,s,i),n[e]=o[0])}}}function Io(e,r,i,s=!0){if(e.isEmpty())return;const a=e.getGeometryType();if(!s||a!==o.enumPolygon)if(u(a)){let t=!1;if(l(a)&&e.hasNonLinearSegments()){const s=e.getImpl(),o=s.getAttributeStreamRef(0),a=s.getSegmentFlagsStreamRef();n(null!==a);for(let e=0,n=s.getPathCount();e<n;e++){let n=!0;const m=s.isClosedPath(e),u=s.getPathEnd(e);if(m&&s.getPathSize(e)>0){n=1===(31&a.read(u-1))}for(let c=s.getPathStart(e);c<u;c++){if(1===(31&a.read(c))){if(n){const e=o.read(2*c),n=po(e,r,i);n!==e&&(t=!0,o.write(2*c,n))}n=!0}else n=!1}}}else{const n=e.getImpl(),s=n.getAttributeStreamRef(0);for(let e=0,o=n.getPointCount();e<o;e++){const n=s.read(2*e),o=po(n,r,i);o!==n&&(t=!0,s.write(2*e,o))}}t&&e.getImpl().notifyModifiedFlags(2001)}else if(a===o.enumEnvelope){const n=e,s=t.constructEmpty();n.queryEnvelope(s),s.xmin=po(s.xmin,r,i),s.xmax=po(s.xmax,r,i),n.setEnvelope(s)}else if(a===o.enumPoint){const t=e;t.setX(po(t.getX(),r,i))}else c("")}function vo(t,e,n){const r=new $;return r.x=po(t.x,e,n),r.y=t.y,r}function Do(e,n){if(n.isEmpty())return 0;const r=e.getPECoordSys();if(r.getProjection().getCode()===cu.PE_PRJ_AZIMUTHAL_EQUIDISTANT){const i=Pm();e.querySpheroidData(i);const s=r.getParameters();if(null===s[cu.PE_PARM_LAM0])return 0;if(null===s[cu.PE_PARM_PHI0])return 0;const o=[s[cu.PE_PARM_LAM0].getValue(),s[cu.PE_PARM_PHI0].getValue()];lu.geogToProj(r,1,o);const a=new $(o[0],o[1]),m=t.constructEmpty();n.queryEnvelope(m);const u=dt($,4);m.queryCorners(u);let c=0;const l=e.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=$.distance(u[t],a);if(e>h)c++;else if(e>g)return-1}if(0===c)return 1;if(4===c){const e=t.constructEmpty();return e.setCoords({center:a,width:h,height:h}),m.isIntersectingNe(e)?-1:0}return-1}return-1}function Go(e,r,i,s){const a=e.getGeometryType();n(a===o.enumPolygon||a===o.enumPolyline||a===o.enumMultiPoint);const m=r.getCoordinateSystemType();if(2===m){let n=e;if(0===i){const i=Do(r,e);if(0===i)return e.createInstance();if(1===i)return e;const a=r.getPCSHorizon(),m=a.getGeometryType(),u=r.getDefaultPrecisionSR();if(m===o.enumEnvelope){const i=t.constructEmpty();a.queryEnvelope(i);const o=R(u,i,!1);n=Rt(e,i,o,5e4*r.getOneMeterPCSUnit(),s)}else(new Ks).execute(a,e,u,s)||(n=(new Ht).execute(n,a,u,s),n===a&&(n=n.clone()))}else if(r.isPannable()){const e=t.constructEmpty();n.queryEnvelope(e);const m=r.getPannableExtent();m.containsEnvelope(e)||(Io(n,m,r.getTolerance(0)),2!==i&&4!==i||(n=Eo(n,r)),4!==i?n=ho(n,r,0,!0,1e5*r.getOneMeterPCSUnit(),s):a===o.enumPolygon&&e.width()>2*m.width()&&(n=wo(n,-2*m.width(),2*m.width(),r,!0,0,!0,s)))}return n}if(n(1===m),a===o.enumMultiPoint)return Io(e,r.getPannableExtent(),r.getTolerance(0)),e;{const n=t.constructEmpty();e.queryEnvelope(n);let i=e;const m=r.getPannableExtent();if(n.ymin<m.ymin||n.ymax>m.ymax){const e=Math.max(1,n.calculateToleranceFromEnvelope()),o=new t(n.xmin-e,m.ymin,n.xmax+e,m.ymax);if(i=(new Lt).execute(i,o,r,s),i.isEmpty())return i}return a===o.enumPolygon&&n.width()>2*m.width()&&(i=wo(i,-2*m.width(),2*m.width(),r,!0,0,!0,s)),i}}function No(t,e,r,i,s,o){const a=i.getCoordinateSystemType();if(2===a){if(0===s)r!==t&&ot(r,t,e),so(i,r,e);else if(r!==t&&ot(r,t,e),i.isPannable()){const t=i.getTolerance(0);oo(r,e,i.getPannableExtent(),t),go(r,e,i,0)}}else{n(1===a);const s=i.getTolerance(0),o=i.getPannableExtent();for(let n=0;n<e;n++)r[n].assign(vo(t[n],o,s))}}function Mo(t,e){const n=e.getPointCount();if(!n)return;const r=e.getImpl(),i=r.getAttributeStreamRef(0),s=t;lu.geogToProj(s,n,i.getArray()),r.notifyModifiedFlags(2001)}function Ao(t,e,n,r){if(!n)return;const i=t.getPECoordSys();if(1===n){const n=[e[0].x,e[0].y];if(lu.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 u=256,c=new Float64Array(2*u);for(let l=0;l<n;){for(let t=l;t<n&&e[t].isNAN();++t)l++;let h=Math.min(u,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;c[n]=e[l+t].x,c[n+1]=e[l+t].y}if(lu.geogToProj(i,h,c),r){const{first:n,second:r}=t.m_peCoordSysVal.getGeogToProjFactors();for(let t=0;t<h;++t){c[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=c[r],s=rt(i),u=e[n].x-m;s*rt(u)<0&&Math.abs(i)>a&&(c[r]-=s*o)}co(c,e,l,h),l+=h}}}function qo(t,e,n,r){const i=t.getSRToGCSTransform();return(new Hi).transform(i,e,n,r,!1)}function Ro(e,n,r,i){const s=new P({vd:n.getDescription()});let o;s.addPoints(n,0,-1),o=(new Hi).execute(s,e,i);const a=n.getPointCount();if(r.setEmpty(),e.getInputSR().isPannable()){if(a!==o.getPointCount())return!1;const i=new t;n.queryEnvelope(i);const s=new t;o.queryEnvelope(s);const m=i.width(),u=s.width();if(0!==m&&0!==u){const t=u/m,n=e.getOutputSR().getPannableExtent().width()/e.getInputSR().getPannableExtent().width();if(Math.abs(t/n-1)>1e-10)return!1}else if(0!==m||0!==u)return!1;r.add(n,!1);for(let t=0;t<a;t++){const e=o.getXY(t);r.setXY(t,e)}return!0}return!1}function Yo(t,e,r){n(!r||t.isPannable());const i=e.getPointCount();if(!i)return;const s=e.getImpl(),o=s.getAttributeStreamRef(0),a=t.getPECoordSys();let m=0;const u=o.readRange(0,2*i);let c=()=>{lu.geogToProj(a,i,u)};const l=t.isPannable()&&!r,h=l?t.getPannableExtent().width():0,g=179*h/360;if(t.isPannable()&&(m=t.getCentralMeridian(),r)){const e=t.m_peCoordSysVal.getGeogToProjFactors(),n=e.first,r=e.second;c=()=>{lu.geogToProj(a,i,u);for(let t=0;t<i;t++){const e=t<<1,i=o.read(e),s=n*(i-m)+r;u[e]=s}}}if(c(),l)for(let n=0;n<i;n++){const t=n<<1,e=u[t],r=rt(e),i=o.read(t)-m;r*rt(i)<0&&Math.abs(e)>g&&(u[t]+=-r*h)}o.writeRangeFromArray(0,2*i,u,!0,1),s.notifyModifiedFlags(2001)}function Uo(t,e,n){switch(e.getGeometryType()){case o.enumLine:return void ca(t,e,n);case o.enumBezier:return void fa(t,e,n);case o.enumEllipticArc:return void ha(t,e,n);case o.enumBezier2:return void da();case o.enumRationalBezier2:return void ya();default:c("")}}function Oo(t,e,r){if(!e.hasNonLinearSegments())return void Yo(t,e,r);if(n(!r||t.isPannable()),e.isEmpty())return;const i=0,s=t.getPECoordSys(),o=t.isPannable(),a=o?t.getPannableExtent().width():0,m=179*a/360;let u=0;o&&(u=t.getCentralMeridian());const c=e.createInstance();c.reserveParts(e.getPointCount(),e.getPathCount());const l=e.getImpl(),h=new y;for(let n=0,g=e.getPathCount();n<g;++n)if(l.hasNonLinearSegmentsPath(n)){let e=!0,i=-1;const s=l.getPathStart(n),o=s+l.getSegmentCountPath(n);l.isClosedPath(n)&&(i=o-1);const a=new $;for(let n=s;n<o;++n){if(l.getSegmentBuffer(n,h,!1),Uo(t,h.get(),r),!e){h.get().getStartXY().equals(a)||h.get().moveTo(a)}if(n!==i)c.addSegment(h.get(),e);else{if(e){const t=new A;h.get().queryStart(t),c.startPathPoint(t)}c.closeLastPathWithSegment(h.get())}a.assign(h.get().getEndXY()),e=!1}}else{const t=1024;let r,h=l.getPathSize(n),g=Math.min(h,t);c.insertPath(-1,e,n,!0);const _=l.getAttributeStreamRef(0),p=c.getAttributeStreamRef(0);for(let e=l.getPathStart(n),c=l.getPathEnd(n);e<c;){if(r=_.readRange(e,g),lu.geogToProj(s,g,r),o)for(let t=0;t<g;t++){const e=t<<1,n=r[e],s=rt(n),o=_.read(2*(i+t))-u;s*rt(o)<0&&Math.abs(n)>m&&(r[e]+=-s*a)}p.writeRangeFromArray(e,g,r,!0,1),e+=g,h-=g,g=Math.min(h,t)}}e.assignMove(c)}function Xo(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 u=t.getPECoordSys();Number.isNaN(e)&&(e=0);const c=t.isPannable(),l=t.getOneDegreeGCSUnit(),h=360*l,g=179*l;let _;for(;i;){if(_=o.readRange(2*m,2*a),Bo(u,a,_,e),c)for(let t=0;t<a;t++){const n=t<<1,r=_[n]-e,i=rt(r),s=o.read(2*(m+t));i*rt(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 Fo(t,e,n){switch(n.getGeometryType()){case o.enumLine:return void Lo(t,e,n);case o.enumBezier:return void zo(t,e,n);case o.enumEllipticArc:return void Ho(t,e,n);case o.enumBezier2:return void jo();case o.enumRationalBezier2:return void ko();default:c("")}}function Lo(t,e,n){const r=[n.getStartXY(),n.getEndXY()];Zo(t,e,r,2),n.setStartXY(r[0]),n.setEndXY(r[1]),n.normalizeAfterEndpointChange()}function Ho(t,e,n){if(0===n.projectionBehavior())Vo(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()];ga(t,e,s,2);const o=new qt;o.initializeFromTwoPointsArray(i,s),n.applyTransformation(o);const a=r?0:1;n.setCoordsForIntersector(s[0],s[a],!1)}}function Vo(t,e,n){_a(!1,t,e,n,!1)}function zo(t,e,n){const r=dt($,4);n.queryControlPoints(r),ga(t,e,r,4),n.setControlPoints(r)}function jo(t,e,r){n(0)}function ko(t,e,r){n(0)}function Bo(t,e,r,i){const s=lu.projToGeogCenter(t,e,r,i);for(let o=0;o<e;++o){const t=o<<1;n(Number.isFinite(r[t]+r[t+1]))}return s}function Wo(t,e,n){if(!n.hasNonLinearSegments())return void Xo(t,e,n);if(n.isEmpty())return;const r=t.getPECoordSys();Number.isNaN(e)&&(e=0);const i=t.isPannable(),s=t.getOneDegreeGCSUnit(),o=360*s,a=179*s,m=n.createInstance();m.reserveParts(n.getPointCount(),n.getPathCount());const u=n.getImpl(),c=new y;for(let l=0,h=n.getPathCount();l<h;++l)if(u.hasNonLinearSegmentsPath(l)){let n=!0,r=-1;const i=u.getPathStart(l),s=i+u.getSegmentCountPath(l);u.isClosedPath(l)&&(r=s-1);const o=new $;for(let a=i;a<s;++a){if(u.getSegmentBuffer(a,c,!1),Fo(t,e,c.get()),!n){c.get().getStartXY().equals(o)||c.get().moveTo(o)}if(a!==r)m.addSegment(c.get(),n);else{if(n){const t=new A;c.get().queryStart(t),m.startPathPoint(t)}m.closeLastPathWithSegment(c.get())}o.assign(c.get().getEndXY()),n=!1}}else{const t=1e3;let s,c=u.getPathSize(l),h=Math.min(c,t);m.insertPath(-1,n,l,!0);const g=u.getAttributeStreamRef(0),_=m.getAttributeStreamRef(0);for(let n=u.getPathStart(l),m=u.getPathEnd(l);n<m;){if(s=g.readRange(2*n,2*h),Bo(r,h,s,e),i)for(let t=0;t<h;t++){const r=t<<1,i=s[r]-e,m=rt(i),u=g.read(2*n);m*rt(u)<0&&Math.abs(i)>a&&(s[r]+=-m*o)}_.writeRangeFromArray(2*n,2*h,s,!0,1),n+=h,c-=h,h=Math.min(c,t)}}n.assignMove(m)}function Zo(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,u=256,c=new Float64Array(2*u);for(let l=0;l<r;){for(let e=l;e<r&&n[e].isNAN();++e)l++;let t=Math.min(u,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;c[t]=n[l+e].x,c[t+1]=n[l+e].y}if(Bo(i,t,c,e),s)for(let r=0,i=l;r<t;++r,++i){const t=r<<1,s=n[i].x,o=c[t]-e,u=rt(o);u*rt(s)<0&&Math.abs(o)>m&&(c[t]-=u*a)}for(let e=0;e<t;e++){const t=e<<1;n[l+e].x=c[t],n[l+e].y=c[t+1]}l+=t}}}function Ko(t,e,r,i){n(0)}function Qo(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 u=a.getOneDegreeGCSUnit(),c=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||(Ko(o.getArray()),o=null),!h||0===h.count()){const t=a.getGcsUnitFactor()/m.getGcsUnitFactor(),e=(a.getPrimeMeridian()-m.getPrimeMeridian())*c,n=-90*u,o=90*u;let l=0;const h=s.getArray(),g=[0];for(let i=1,s=2*r;i<s;)g[0]=h[i],l|=xt(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 p=Math.min(r,_);const f=new Array(p),d=new Array(p);let y=null;null!==o&&(y=new Float64Array(p));let P=0,x=Number.NaN,C=Number.NaN;const E=360*c,S=c/u;n&&(C=90*c,x=89.9*u,d.fill(0));let b=!0,w=0;for(;r;){let t=!1;const e=s.readRange(2*P,2*p);for(let n=0;n<p;n++)f[n]=e[n<<1];if(n)for(let n=0;n<p;n++){const r=1+(n<<1),i=Math.abs(e[r])-x;if(i>0){const s=e[r];e[r]=et(x,s),d[n]=et(i,s),t=!0}}const i=e[0];if(g){const t=h;y&&o.queryRange(P,p,y,!0,1),t.transform(!1,e,y,p),y&&o.writeRangeFromArray(P,p,y,!0,1)}else{h.transform(!1,e,p)}b&&(w=e[0]-S*i,b=!1);for(let n=0;n<p;n++){const t=n<<1,r=e[t]-f[n]*S-w;Math.abs(r)>200&&(e[t]+=r>0?-E:E)}if(t){for(let t=0;t<p;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*p,e,!0,1),l&&o&&o.writeRangeFromArray(P,p,y,!0,1),P+=p,r-=p,p=Math.min(r,_)}return i.notifyModifiedFlags(2001),!0}function Jo(t,e,n){switch(e.getGeometryType()){case o.enumLine:return ia(t,e,n);case o.enumBezier:return aa(t,e,n);case o.enumEllipticArc:return sa(t,e,n);case o.enumBezier2:return ma();case o.enumRationalBezier2:return ua();default:c("")}}function $o(t,e,n){if(!e.hasNonLinearSegments())return Qo(t,e,n);if(e.isEmpty())return!1;const r=e.createInstance();r.reserveParts(e.getPointCount(),e.getPathCount());const i=e.getImpl(),s=new y;for(let o=0,a=e.getPathCount();o<a;++o){let e=!0,a=-1;const m=i.getPathStart(o),u=m+i.getSegmentCountPath(o);i.isClosedPath(o)&&(a=u-1);const c=new $;for(let o=m;o<u;++o){if(i.getSegmentBuffer(o,s,!1),Jo(t,s.get(),n),!e){s.get().getStartXY().equals(c)||s.get().moveTo(c)}if(o!==a)r.addSegment(s.get(),e);else{if(e){const t=new A;s.get().queryStart(t),r.startPathPoint(t)}r.closeLastPathWithSegment(s.get())}c.assign(s.get().getEndXY()),e=!1}}return e.assignMove(r),!0}function ta(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|=xt(s,-n,n)?1:0,e[t].y=s[0];return i}const o=t.getInputSR(),a=t.getOutputSR(),m=o.getVCS(),u=a.getVCS(),c=o.getOneDegreeGCSUnit(),l=90*c,h=a.getOneDegreeGCSUnit(),g=t.isVertical(),_=t.getDatumTransformation(),p=!!_&&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|=xt(i,-l,l)?1:0,e[n].y=i[0];return t|=Ls(o.getGCS(),m,a.getGCS(),u,e,n,r)?1:0,t}p||null===n||Ko();const f=1024;let d=Math.min(r,f);const y=new Array(d),P=ht(d,0);let x=0,C=Number.NaN,E=Number.NaN;const S=360*h,b=h/c;i&&(E=90*h,C=89.9*c);let w=!0,T=0,I=r;for(;I;){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=et(C,i),P[n]=et(r,i),t=!0}}const r=e[0].x;if(p){_.transform(!1,e,n,d)}else{_.transform(!1,e,d)}w&&(T=e[0].x-b*r,w=!1);for(let n=0;n<d;n++){const t=e[x+n].x-y[n]*b-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+=b*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,I-=d,d=Math.min(I,f)}return 1}function ea(t,e,r,i,s){return n(0),0}function na(t,e,r,i,s){n(null===i),n(e<2147483647);const o=Array.isArray(r);let a;a=o?Ct(r):r;const m=hu.geogToGeog(t,e,a,null,s);return o&&Et(a,r),m}function ra(t,e,n,r,i,s){let o=0,a=!0,m=0;for(let u=0;u<r;++u)e[u].isNAN()?a||(o|=ta(t,e.slice(m,u-m),n?n.slice(m,u-m):null,u-m,i),m=u,a=!0):a&&(m=u,a=!1);return a||(o|=ta(t,0===m?e:e.slice(m),n?0===m?n:n.slice(m):null,r-m,i)),0!==o}function ia(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=ra(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 sa(t,e,n){if(0===e.projectionBehavior())return oa(t,e,n);const r=e.getStartXY().equals(e.getEndXY()),i=dt($,3),s=dt($,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]=pt(a[0],a[1],.5),r&&(a[1]=a[2])),s[0].setCoordsPoint2D(i[0]),s[1].setCoordsPoint2D(i[1]);const u=new qt;if(r||e.isDegenerateToLine())m=ra(t,s,a,2,n),u.initializeFromTwoPoints(i[0],i[1],s[0],s[1]);else{const r=new $;e.queryCoord2D(.5,r),i[2].setCoordsPoint2D(r),s[2].setCoordsPoint2D(r),m=ra(t,s,a,3,n),u.setFromTwoTriangles(i,s)}return u.isIdentity()||(e.applyTransformation(u),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 oa(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=pt(o[0],o[1],.5);o[2]=t,o[3]=t}const a=e.getStartXY().equals(e.getEndXY())&&!e.isDegenerateToLine(),m=ra(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 aa(t,e,n){const r=dt($,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]=pt(s[0],s[3],.5),s[2]=s[1]);const o=ra(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 ma(t,e,r){return n(0),!1}function ua(t,e,r){return n(0),!1}function ca(t,e,n){const r=[e.getStartXY(),e.getEndXY()];Ao(t,r,2,n),e.setStartXY(r[0]),e.setEndXY(r[1]),e.normalizeAfterEndpointChange()}function la(t,e,n,r){Ao(t,e,n,r)}function ha(t,e,n){if(0===e.projectionBehavior())pa(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()];la(t,s,2,n);const o=new qt;o.initializeFromTwoPointsArray(i,s),e.applyTransformation(o);const a=r?0:1;e.setCoordsForIntersector(s[0],s[a],!1)}}function ga(e,n,r,i){Zo(e,n,r,i);const s=new t;s.setFromPoints(r,i);const o=e.getOneDegreeGCSUnit(),a=360*o,m=180*o;if(s.width()>m){for(let t=0;t<i;t++)for(;r[t].x<n;)r[t].x+=a;if(s.setFromPoints(r,i),s.xmax>m+n)for(let t=0;t<i;t++)r[t].x-=a}}function _a(t,e,n,r,i){const s=dt($,3);let o=0,a=!1,m=!1;const u=r.isDegenerateToLine();u?(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?la(e,s,o,i):ga(e,n,s,o),u?r.constructLineCircularArc(s[0],s[1]):a?r.constructCircleCenterAndPoint(s[1],s[0],m):r.constructCircularArcThreePoint(s[0],s[1],s[2])}function pa(t,e,n){_a(!0,t,0,e,n)}function fa(t,e,n){const r=dt($,4);e.queryControlPoints(r),la(t,r,4,n),e.setControlPoints(r)}function da(t,e,r){n(0)}function ya(t,e,r){n(0)}function Pa(t,e,n){const r=N(t),i=N(e),s=G(r,i),o=G(r,N(n));return 0===o||(s>0&&o>0&&o<=s||s<0&&o<0&&o>=s)}function xa(t,e,r,i,s){const o={stack:[],error:void 0,hasError:!1};try{const a=r.clone(),m=i.clone();if(2===s){const n=[0,0];return Ne(t,e,a,m,0,n),n[0]}if(a.y>m.y){const t=new $;t.assign(a),a.assign(m),m.assign(t)}const u=Mt(o,new mu,!1),c=Mt(o,new mu,!1),l=Mt(o,new mu,!1),h=new nt;if(h.setCoords(a.y,m.y),!h.containsCoordinate(0)||Math.abs(a.x-m.x)>=Math.PI)return Number.NaN;if(a.x===m.x)return a.x;fu.geodeticDistance(t,e,a.x,a.y,m.x,m.y,c,u,null,s);const g=c.val;let _=0,p=1;const f=a.clone();for(;g*(p-_)>1e-12*t;){const r=.5*(_+p);if(fu.geodeticCoordinate(t,e,a.x,a.y,g*r,u.val,c,l,s),f.x=c.val,f.y=l.val,h.setCoords(a.y,f.y),0===f.y)return f.x;if(h.containsCoordinate(0))p=r;else{if(h.setCoords(m.y,f.y),!h.containsCoordinate(0))return n(!1),Number.NaN;_=r}}return f.x}catch(a){o.error=a,o.hasError=!0}finally{At(o)}}function Ca(t,e,n,r){const i=new nt;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 Ea extends Vt{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 Sa(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 ba(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 wa{constructor(r,i=!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=$.getNAN(),this.m_southPole=$.getNAN(),this.m_polesUpdated=0,this.m_domain=t.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=t.constructEmpty(),this.m_pannableExtentGCS=t.constructEmpty(),this.m_areaOfUse=null,this.m_canonicalWkt="",this.m_peCoordSys=r,this.m_WKID=uu.getCode(r),this.m_WKID<=0?(this.m_WKID=0,this.m_canonicalWkt=$s(r,0,!0),this.m_hashCode=yt(this.m_canonicalWkt)):this.m_hashCode=Tt(this.m_WKID);const s=this.m_peCoordSys.getType();this.m_csType=s===cu.PE_TYPE_PROJCS?2:1,n(s===cu.PE_TYPE_PROJCS||s===cu.PE_TYPE_GEOGCS),s===cu.PE_TYPE_PROJCS&&(r.loadConstants()||e("PeProjcs.loadConstants failed"));const o=s===cu.PE_TYPE_GEOGCS?this.m_peCoordSys:this.m_peCoordSys.getGeogcs();s!==cu.PE_TYPE_GEOGCS&&uu.getCode(o),this.m_unit=ue(r),this.m_primeMeridian=o.getPrimem().getLongitude();{const t=o.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(s===cu.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=gu.generate(t,gu.PE_PCSINFO_OPTION_NONE),this.m_pPCSInfoNoDomain||c("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/o.getUnit().getUnitFactor(),e=o.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 n(this.m_pPCSInfoNoDomain),this.m_pPCSInfoNoDomain}getCentralMeridian(){return this.m_centralMeridian}updateGCSHorizon(){if(this.m_peCoordSys.getType()!==cu.PE_TYPE_PROJCS)return;let e=!0;const r=this.m_peCoordSys,i=r.getGeogcs(),s=r.horizonGcsGenerate();if(!s)return;n(s.length>0);const o=s[0].getNump(),a=s[0].getKind();let m,u;e=s[0].getInclusive()>0;const c=this.getOneDegreeGCSUnit(),l=90*c,h=360*c,g=370*c,_=180*c*cu.PE_HORIZON_DELTA/Math.PI,p=t.constructEmpty();let y=null;if(o>1)for(let t=1;t<o;t++)if(s[t].getKind()===cu.PE_HORIZON_LINE){y||(y=new d);const e=s[t].getCoord();y.startPathCoords(e[0][0],e[0][1]),y.lineToCoords(e[1][0],e[1][1])}if(a===cu.PE_HORIZON_RECT){const t=s[0].getCoord();if(p.setFromPoints([new $(t[0][0],t[0][1]),new $(t[1][0],t[1][1])],2),Math.abs(p.ymax-l)<1e-7*_&&(p.ymax=l),Math.abs(p.ymin+l)<1e-7*_&&(p.ymin=-l),p.width()>g){const t=-400*c,e=t+5*h;p.setCoords({xmin:t,ymin:p.ymin,xmax:e,ymax:p.ymax})}const n=new Y({env2D:p});this.m_GCSHorizon||(this.m_GCSHorizon=n,this.m_bGCSHorisonIsInclusive=e)}else{let r=this.getPCSInfo().isGcsHorizonMultiOverlap();const a=vm(i,null,null,1),g=[],_=new nt;for(let e=0;e<o;e++){if(s[e].getKind()!==cu.PE_HORIZON_POLY)continue;m=s[e].getSize();const n=s[e].getCoord(),r=t.constructEmpty();r.setFromPoints(It(n),m),g.push(new nt(r.xmin,r.xmax)),r.width(),_.merge(g.at(-1))}let p=!1;const d=new nt;_.width()>h&&g.length>1?(d.vmin=this.getCentralMeridian()-h,d.vmax=d.vmin+2*h,p=!0,r=!0):(d.vmin=_.vmin,d.vmax=d.vmin+h);const P=t=>{let e=0;for(;g[t].vmin+e<d.vmin;)e+=h;for(;g[t].vmax+e-h>d.vmin;)e-=h;return e};let x=new f;if(r){const t=new Ea,e=(new te).executeMany(t,a,null);for(let n=0;n<o;n++){if(s[n].getKind()!==cu.PE_HORIZON_POLY)continue;m=s[n].getSize();const r=s[n].getCoord();u=s[n].getInclusive()>0;const i=new f;if(i.addPathPoint2D(It(r),m-1,!0),p){const e=P(n),r=g[n].clone();r.move(e);let s=e;const o=new qt;do{o.setShiftCoords(s,0);const e=i.clone();e.applyTransformation(o),t.tick(e),t.tock(),s+=h,r.move(h)}while(r.vmin<d.vmax)}else t.tick(i),e.tock()}x=e.next()}else{x=new f;for(let t=0;t<o;t++){if(s[t].getKind()!==cu.PE_HORIZON_POLY)continue;m=s[t].getSize();const r=s[t].getCoord();if(u=s[t].getInclusive()>0,n(u===e),p){const e=new f;e.addPathPoint2D(It(r),m-1,!0);const n=P(t),i=g[t].clone();i.move(n);let s=n;const o=new qt;do{if(0!==s){o.setShiftCoords(s,0);const t=new f({copy:e});t.applyTransformation(o),x.addPath(t,0,!0)}else x.addPath(e,0,!0);s+=h,i.move(h)}while(i.vmin<d.vmax)}else x.addPathPoint2D(It(r),m-1,!0)}}p&&(x=(new Lt).execute(x,new t(d.vmin,-l-c,d.vmax,l+c),a,null)),e?(new Ht).accelerateGeometry(x,a,1):(new ee).accelerateGeometry(x,a,1),(new Qs).accelerateGeometry(x,a,1),null===this.m_GCSHorizon&&(this.m_GCSHorizon=x,this.m_bGCSHorisonIsInclusive=e,this.m_GCSSplitLines=y)}}updateAreaOfUse(){return null}updatePCSHorizon(){if(this.m_peCoordSys.getType()!==cu.PE_TYPE_PROJCS)return;const e=this.m_peCoordSys.horizonPcsGenerate();if(!e)return;let r;this.getPCSInfo();const i=e[0].getKind();e[0].getInclusive();const s=t.constructEmpty(),o=e[0].getNump();let a=!1;if(i===cu.PE_HORIZON_RECT){const t=e[0].getCoord();s.setFromPoints(It(t),2),r=new Y({env2D:s})}else{let t=-1;for(let n=0;n<o;n++)e[n].getKind()===cu.PE_HORIZON_POLY&&(t=n);n(t>=0);const i=e[t].getSize()-1,s=e[t].getCoord(),m=new f;r=m,m.addPathPoint2D(It(s),i,!0),a=!0}if(this.getPCSInfo().isDensificationNeeded()){n(i!==cu.PE_HORIZON_RECT);const t=1e5*this.getOneMeterPCSUnit();r=(new Ut).execute(r,t,0,0,null)}if(a){{const t=new Y;r.queryEnvelope(t),r.calculateArea2D(),r.calculateLength2D(),r.getExteriorRingCount()}(new Ht).accelerateGeometry(r,null,1)}null===this.m_PCSHorizon&&(this.m_PCSHorizon=r)}updatePannableExtent(){const e=this.m_peCoordSys.getType();if(e===cu.PE_TYPE_PROJCS){const e=this.m_peCoordSys,n=this.getPCSInfo().getCentralMeridian(),r=e.getGeogcs();r||c("");const i=[n+1/r.getUnit().getUnitFactor()*Math.PI,0];lu.geogToProj(e,1,i);const s=i[0],o=e.getParameters()[cu.PE_PARM_X0].getValue(),a=this.getPCSHorizon(),m=t.constructEmpty();a.queryEnvelope(m);const u=Math.abs(s-o),l=u+o,h=-1*u+o,g=m.ymax,_=m.ymin;this.m_pannableExtent.setCoords({xmin:h,ymin:_,xmax:l,ymax:g})}else if(e===cu.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 c("")}updatePannableExtentGCS(){const e=this.m_peCoordSys.getType();if(e===cu.PE_TYPE_PROJCS){const e=this.m_peCoordSys,n=this.m_centralMeridian,r=e.getGeogcs();r||c("");const i=1/r.getUnit().getUnitFactor()*Math.PI,s=this.getGCSHorizon(),o=t.constructEmpty();s.queryEnvelope(o),this.m_pannableExtentGCS.setCoords({xmin:n-i,ymin:o.ymin,xmax:n+i,ymax:o.ymax})}else if(e===cu.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 c("")}updateDomain(){if(1===this.m_csType){const e=400*this.getOneDegreeGCSUnit();this.m_domain=t.construct(-e,-e,e,e)}else{n(2===this.m_csType);const e=gu.generate(this.m_peCoordSys,gu.PE_PCSINFO_OPTION_DOMAIN);e||c("generate pcs info failed");const r=new t(e.getDomainMinx(),e.getDomainMiny(),e.getDomainMaxx(),e.getDomainMaxy());this.m_domain.isEmpty()&&this.m_domain.setCoords({env2D:r})}}updatePoles(){if(this.m_peCoordSys.getType()===cu.PE_TYPE_PROJCS){const t=90*this.getOneDegreeGCSUnit(),e=[[0,t],[0,-t]];lu.geogToProj(this.m_peCoordSys,2,e);const n=this.getPCSInfo().getNorthPoleLocation()!==gu.PE_POLE_OUTSIDE_BOUNDARY,r=this.getPCSInfo().getSouthPoleLocation()!==gu.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()===cu.PE_TYPE_PROJCS){const t=this.getOneDegreeGCSUnit(),e=this.m_pPCSInfoNoDomain.getCentralMeridian(),r=[0,0,0,0];r[0]=e,r[1]=0,r[2]=e+t,r[3]=0;const i=lu.geogToProj(this.m_peCoordSys,2,r);n(2===i);const s=(r[2]-r[0])/t,o=r[0];0===this.m_geogToProjFactorsUpdated&&(this.m_geogToProjFactor=s,this.m_geogToProjOffset=o,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(),tt(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];bu(this.m_peCoordSys.getType(),this.m_WKID,e,n)||c("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}}class Ta{constructor(t,e=!0){this.m_oneMeter=0,this.m_WKID=-1,this.m_oldWKID=-1,this.m_canonicalWkt="not yet implemented",this.m_model=0,this.m_unit=new cm,this.m_cached=!1}setCached(t=!0){this.m_cached=t}getCached(){return this.m_cached}getOneMeterUnit(){return 0}getLatestID(){return this.m_WKID}getOldID(){let t=this.m_oldWKID;return t<0&&(t=0,this.m_WKID>0&&(t=this.m_WKID),this.m_oldWKID=t),t}getModel(){return 0}isCustomWkid(){return!1}getVerticalUnit(){return this.m_unit}static equal(t,e){return!1}static equal_for_projection(t,e){return!1}}function Ia(t,e,n,r){return Da(!0,t,e,n,r)}function va(t,e,n,r){return Ga(!0,t,e,n,r)}function Da(t,e,n,r,i){return e.hasVCS()&&n.hasVCS()?Aa():qa(e,n,r,i)}function Ga(t,e,n,r,i,s){return new Xa(t?2:1,e,n,r,i,s)}function Na(t,n,r,i,s,o=!1){n&&r||e("");if(1===t&&n.hasVCS()&&r.hasVCS())return m("hv xform not impl"),[];{const t=Yu(n,r,i,s,o),e=[];for(const n of t)e.push(n);return e}}function Ma(){return{centralMeridianOfOutputGCS:Number.NaN,densificationStep:Number.NaN,clipWithInputHorizon:!0,clipWithOutputHorizon:!0,legacyHorizonClipping:!1,normalizeResultGeometry:!1,equals(t){return at(this.centralMeridianOfOutputGCS,t.centralMeridianOfOutputGCS)&&at(this.densificationStep,t.densificationStep)&&this.clipWithInputHorizon===t.clipWithInputHorizon&&this.clipWithOutputHorizon===t.clipWithOutputHorizon&&this.legacyHorizonClipping===t.legacyHorizonClipping&&this.normalizeResultGeometry===t.normalizeResultGeometry}}}function Aa(t,e,r,i){return n(0),{}}function qa(n,r,i,s){n&&r||e("!inputSR || !outputSR");const o=n.getLatestID(),a=r.getLatestID();if(3857===o&&4326===a){if(n.m_bDefaultDescriptor&&r.m_bDefaultDescriptor)return em()}else if(4326===o&&3857===a&&n.m_bDefaultDescriptor&&r.m_bDefaultDescriptor)return nm();const m=t.constructEmpty();m.setCoords({env2D:i});const u=n.getCoordinateSystemType(),c=r.getCoordinateSystemType();if(0===u||0===c)return Ra(n,r);if(s){const t=s.find(0,n.getGCS(),r.getGCS());if(t)return Ra(n,r,t)}const l=n.getGCS().getLatestID(),h=r.getGCS().getLatestID();if(l>0&&l===h)return Ra(n,r);const g=new Wa(n,r,i);{const t=Ka(g);if(t)return t}if(!m.isEmpty()&&1!==u){n.getGCS();let t=new Y({env2D:m});const e=n.getSRToGCSTransform();t=(new Hi).execute(t,e,null),t.queryEnvelope(m)}let _=null;if(!i.isEmpty()){const t=n.getGCS().getPECoordSys(),e=r.getGCS().getPECoordSys();let i=null;if(!m.isEmpty()){const e=t.getPrimem().getLongitude(),n=t.getUnit().getUnitFactor();i=new yu(m.xmin,m.ymin,m.xmax,m.ymax,e,n)}const s=1;let o=_u.getGTlist(t,e,2,_u.PE_GTLIST_OPTS_COMMON,i,s);o&&(_=Uu(o),o=null),i&&i.destroy()}i.isEmpty(),null!==_&&0===_.count()&&(_=null);return Qa(g,Ra(n,r,_||void 0))}function Ra(t,e,n,r,i){return new Xa(1,t,e,n,r,i)}function Ya(){return{flagsMask:0,setFlag(t,e){e?this.flagsMask|=t:this.flagsMask&=~t},hasFlag(t){return!!(this.flagsMask&t)}}}function Ua(){return{m_extendedParams:Ma(),m_extendedParamsInternal:Ya()}}function Oa(){return Ua()}let Xa=class t{constructor(t,r,i,s,o,a){let m,u;this.m_datumTran=null,this.m_bIdentity=!0,this.m_bIdentityGeogToGeog=!0,this.m_bVertical=!1,this.m_bNormalize=!1,r&&i||e("!inputSR || !outputSR"),s&&0===s.getType()&&(s.m_bReadOnly=!0),this.m_bNormalize=!1,1!==t&&(m=r.getVCS(),u=i.getVCS(),this.m_bVertical=null!=m&&null!=u),this.m_inputSR=r,this.m_outputSR=i,this.m_bIdentity=!1,this.m_bIdentityGeogToGeog=!1,n(!this.m_params),o&&(this.m_params=Ua(),this.m_params.m_extendedParams=o),a&&(this.m_params||(this.m_params=Ua()),this.m_params.m_extendedParamsInternal=a);let c=!1;const l=null!=s,h=r.getCoordinateSystemType(),g=i.getCoordinateSystemType();if(i.isPannable()&&0!==h&&o){const t=o.centralMeridianOfOutputGCS;if(!Number.isNaN(t)&&i.isPannable()){const e=i.getPannableExtent(),n=e.getCenterX();if(n!==t){const r=Math.ceil(e.width());t+r!==n+r&&(c=!0)}}}const _=o&&o.normalizeResultGeometry;if(r.equals(i))return this.m_bIdentity=!c,this.m_bIdentityGeogToGeog=!0,void this.updateProjector();const p=!l&&r.equalForProjection(i,this.m_bVertical);this.m_bIdentity=p&&!c,this.m_bIdentity?this.m_bIdentityGeogToGeog=!0:0!==h&&0!==g&&(_&&this.m_outputSR.isPannable()&&(this.m_bNormalize=_),this.m_datumTran=s||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 e=new t(1,this.m_outputSR,this.m_inputSR,this.m_datumTran?.createInverse());return e.m_bIdentity=this.m_bIdentity,e.m_bVertical=this.m_bVertical,e.m_bIdentityGeogToGeog=this.m_bIdentityGeogToGeog,e.updateProjector(),e}isIdentity(){return this.m_bIdentity}getExtendedParams(){return this.m_params?this.m_params.m_extendedParams:Oa().m_extendedParams}equals(t){return n(0),!1}isVertical(){return this.m_bVertical}isMatchingTransformation(t,e){return n(0),!1}getGeographicTransformations(){return this.m_datumTran}getExtendedParamsImpl(){return this.m_params?this.m_params.m_extendedParams:Oa().m_extendedParams}getExtendedParamsInternal(){return this.m_params?this.m_params.m_extendedParamsInternal:Oa().m_extendedParamsInternal}isIdentityGeogToGeog(){return this.m_bIdentityGeogToGeog}normalizeOutput(){return this.m_bNormalize}updateProjector(){this.m_projector=new Xi(this)}};const Fa=new Map,La=new Map,Ha=new Map;function Va(t){let e=t.getCode();if(e>0){const t=um(e);return t||mm(uu.coordsys(e))}const n=t.getName();if(La.has(n)){const e=La.get(n);if(e&&e.deref()){const n=e.deref();if(n.m_peCoordSys.isEqual(t))return n}}return e=uu.getCode(t),mm(e>0?uu.coordsys(e):t)}function za(t){t<=0&&g(t);{const e=um(t);if(e)return e}const e=Pu(uu.coordsys(t));e.get()||g(t);const n=mm(e.release());return n.getLatestID()!==t&&Fa.set(t,new WeakRef(n)),n}function ja(t){const e=new Ta({},!0);return e.m_WKID=t,e}function ka(t){const e=Pu(uu.fromString(cu.PE_TYPE_COORDSYS,t));return e.get()||_(t),Va(e.release())}function Ba(t){La.delete(t.m_peCoordSys.getName()),Ha.delete($s(t.m_peCoordSys,0,!1))}class Wa{constructor(t,e,n){this.m_hashCode=-1,t&&(this.m_inputSR=t,this.m_outputSR=e,this.m_env=n.clone(),this.m_hashCode=this.m_inputSR.getHashCode(),this.m_hashCode=Q(this.m_hashCode,this.m_outputSR.getHashCode()),this.m_env.isEmpty()||(this.m_hashCode=Q(this.m_hashCode,st(this.m_env.xmin)),this.m_hashCode=Q(this.m_hashCode,st(this.m_env.xmax)),this.m_hashCode=Q(this.m_hashCode,st(this.m_env.ymin)),this.m_hashCode=Q(this.m_hashCode,st(this.m_env.ymax))))}getHashCode(){return this.m_hashCode}equals(t){return!(this.m_inputSR&&!t.m_inputSR||!this.m_inputSR&&t.m_inputSR)&&(this.m_env.equals(t.m_env)&&this.m_inputSR.equals(t.m_inputSR)&&this.m_outputSR.equals(t.m_outputSR))}clear(){this.m_inputSR=void 0,this.m_outputSR=void 0,this.m_hashCode=-1,this.m_env=void 0}}const Za=new Map;function Ka(t){if(Za.has(t.getHashCode()))return Za.get(t.getHashCode())}function Qa(t,e){return Za.set(t.getHashCode(),e),e}let Ja,$a,tm;function em(){return Ja||(Ja=va(Bm(),Zm())),Ja}function nm(){return $a||($a=em().getInverse()),$a}function rm(){return tm||(tm=uu.unit(9001)),tm}function im(t){return null!==Pu(uu.coordsys(t)).get()}const sm=new Map;function om(t){if(sm.has(t))return sm.get(t);{const e=im(t);return sm.set(t,e),e}}function am(t){return!1}function mm(t){const e=Pu(t),n=t.getCode();if(n>0){const t=um(n);if(t)return t}const r=t.getName();let i=La.get(r);if(i){const e=i.deref();if(e&&e.m_peCoordSys.isEqual(t))return e}const s=new wa(e.release());if(n>0)return s.setCached(),Fa.set(n,new WeakRef(s)),La.set(r,new WeakRef(s)),s;const o=$s(t,0,!1);if(i=Ha.get(o),i){const t=i.deref();if(t)return t}return s.setCached(),Ha.set(o,new WeakRef(s)),s}function um(t){const e=Fa.get(t);if(e)return e.deref()}class cm extends re{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=rm())))}getUnitType(){return 0}convertFromMeters(t){return t/this.getUnitToBaseFactor()}convertToMeters(t){return t*this.getUnitToBaseFactor()}}const lm=["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 hm(t,e,n){const r=ht(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=lm[n];r[e-1-o]=a}return n>e?r.push(..."0".repeat(n-e)):n<e&&(r.length=n),r.join("")}function gm(t,e,r,i,s){n(i>>5<s.length);let o=e,a=r;for(let n=i;n>=0;n-=2){const e=31&n,r=.5*(a+o);t>=r?(s[n>>5]|=1<<e,o=r):a=r}}let _m=new Set;const pm=2147483645n,fm=9007199254740990n,dm="operation is not supported for unknown coordinate systems";var ym;function Pm(){return{majorSemiAxis:0,e2:0,minorSemiAxis:0,flattening:0,isSphere(){return 0===this.e2}}}function xm(t,e,n){t.majorSemiAxis=e,t.minorSemiAxis=e*(1-n),t.e2=n*(2-n),t.flattening=n}function Cm(t){if(uu)return;Su(t);const e=_m;_m=null,e.forEach((t=>{const e=t.deref();e&&e.attachToPe()}))}function Em(t){Eu(t)}function Sm(){return!!uu}function bm(){return!!xu}function wm(){return!!uu||!!xu}function Tm(t,e,r){return n(wm()),tu(t,void 0===e?0:e,null,!1)}function Im(t,e){n(wm());const r=new jm;let i;return Sm()?(i=ka(t),r.setHorzProj_(i),r.m_vertcs=null,r.m_userWKID=i.getLatestID()):(i=Cu(t),r.m_unit=i.isPCS?new cm(i.metersOrRadiansPerUnit):new oe(i.metersOrRadiansPerUnit)),Qm(r.m_precisionDescriptor,i,null,1),r.m_bDefaultDescriptor=!0,r.m_userWKT=t,r.calculateHashCode(),r.initDbgName(),r}function vm(t,e,n,r,i=!0){let s=null;return e&&(s=Rs(e,i)),Dm(t,s,n,r,i)}function Dm(t,n,r,i,s){t||e("!PE_coord_sys");const o=new jm;let a;return a=s?Va(t):new wa(t,!1),Qm(o.m_precisionDescriptor,a,n,i),o.m_bDefaultDescriptor=!0,o.setHorzProj_(a),o.m_vertcs=n,o.m_userWKID=a.getLatestID(),o.calculateHashCode(),o.initDbgName(),o}function Gm(t,n,r=!1){3===t.getCoordinateSystemType()&&e("image spatial reference cannot be altered");const i=new jm,s=t;return i.m_peCoordSysVal=s.m_peCoordSysVal,i.m_vertcs=s.m_vertcs,i.m_unit=s.m_unit,i.m_precisionDescriptor.assign(n),i.m_localZToXYFactor=s.m_localZToXYFactor,(Number.isNaN(i.m_precisionDescriptor.m_falseX)||Number.isNaN(i.m_precisionDescriptor.m_falseY))&&(i.m_precisionDescriptor.m_falseX=s.m_precisionDescriptor.m_falseX,i.m_precisionDescriptor.m_falseY=s.m_precisionDescriptor.m_falseY),i.m_precisionDescriptor.snapPrecision(),i.m_precisionDescriptor.fixTolerance(),i.m_userWKID=s.m_userWKID,i.m_precisionDescriptor.equals(s.m_precisionDescriptor)?i.m_bDefaultDescriptor=s.m_bDefaultDescriptor:i.m_bDefaultDescriptor=!1,r&&(i.m_bDefaultDescriptor=!0),i.calculateHashCode(),i.initDbgName(),i}function Nm(t,e,n){return{}}function Mm(t,n,r){void 0===n&&(n=1),(n<=0||!Number.isFinite(n))&&e(""),t||1===n||e("null Unit has to have z_to_xy_factor equal to 1");const i=new jm;i.m_unit=t;const s=t||new cm(9001);return $m(i.m_precisionDescriptor,s,null,1),i.m_bDefaultDescriptor=!0,Number.isNaN(i.m_precisionDescriptor.m_falseX)&&e("NAN false X/Y are not allowed here"),i.m_localZToXYFactor=n,i.calculateHashCode(),i.initDbgName(),i}function Am(t,e){return t.snapGeometry(e)}function qm(t){const e=t.getCoordinateSystemType();return 1===e?t:(3===e&&n(0),t.getGCS())}function Rm(t){return n(wm()),bm()?wu(t):om(t)}function Ym(t){return null!==Pu(uu.fromString(cu.PE_TYPE_COORDSYS,t)).get()}let Um;function Om(){return Um||(Um=(()=>{const t=Math.trunc(Math.random()*St()),e=Date.now();return`|abba_000|${t.toString(16)}|${e.toString(16)}|`})()),Um}!function(t){t[t.utmDefault=0]="utmDefault",t[t.utmNorthSouth=1]="utmNorthSouth"}(ym||(ym={}));let Xm=0;function Fm(t=""){let e=`${Om()}${Xm++}`;return""!==t&&(e+=`|${t}`),e}function Lm(t){return t.startsWith(Om())}let Hm,Vm,zm,jm=class t{destroy(){Ba(this.m_peCoordSysVal),1===this.getCoordinateSystemType()||2===this.getCoordinateSystemType()?this.getPECoordSys().destroy():c("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 km,this.m_hashCode=0,this.m_bDefaultDescriptor=!1,Km(this.m_precisionDescriptor),_m&&_m.add(new WeakRef(this))}attachToPe(){(this.m_userWKID>0?Tm(this.m_userWKID):Im(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 va(this,this,null);let e=t?this.m_srToGcs:this.m_gcsToSr;if(e)return e;const n=this.getGCS(),r=this;e=t?va(r,n,null):va(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=Q(t,e),this.m_hashCode=Q(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(),n(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 cu.PE_TYPE_GEOGCS:return 1;case cu.PE_TYPE_PROJCS:return 2;default:return 0}}else{if((this.m_userWKID>0||this.m_userWKT)&&this.m_unit instanceof cm)return 2;if(this.m_unit instanceof oe)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 m("vcs not implemented"),0}getLatestVerticalID(){return this.m_vertcs?this.m_vertcs.getLatestID():0}getOldVerticalID(){return m("vcs not implemented"),0}getPEVerticalCoordSys(){return null}getPole(t){return this.throwIfNotGCSOrPCS(),n(this.m_peCoordSysVal),this.m_peCoordSysVal.getPole(t)}getText(){const t=this.getPECoordSys();return t?eo(t):this.m_userWKT??""}getTextExtended(t){const e=this.getPECoordSys();return e?this.getPEVerticalCoordSys()?to(null,e,this.getPEVerticalCoordSys()):eo(e,t):this.m_userWKT??""}getText2(t=-1){const e=this.getPECoordSys();return e?no(e,t):this.m_userWKT??""}getUnit(){return this.m_unit}getUnitsPerMillimeter(){return this.m_peCoordSysVal?this.m_peCoordSysVal.getUnitsPerMillimeter():this.m_unit instanceof cm?.001/this.m_unit.getUnitToBaseFactor():this.m_unit instanceof oe?.001/(Cu(this.m_userWKT??this.m_userWKID).semiMajor*this.m_unit.getUnitToBaseFactor()):(h("sr object not in valid state"),0)}getAuthorityName(){return this.getPECoordSys()?ro():""}getVerticalUnit(){return m("vcs not implemented"),{}}getVCS(){return this.m_vertcs}hasVCS(){return!1}getGCSHorisonIsInclusive(){return this.throwIfNotGCSOrPCS(),n(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSHorisonIsInclusive()}getGCSHorizon(){return this.throwIfNotGCSOrPCS(),n(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSHorizon()}getGCS(){const t=this.getCoordinateSystemType();if(0===t)h(dm);else{if(1===t)return this;3===t&&h("image cs not supported")}if(this.m_geogSpatialReference)return this.m_geogSpatialReference;let e;if(this===Bm()||this===Wm())e=Zm();else{n(this.m_peCoordSysVal);const t=this.m_peCoordSysVal.m_peCoordSys.getGeogcs();t||c(""),e=vm(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(),n(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSSplitLines()}toGCS(t,r){if(0===t.length)return 0;t.length>r.length&&e("coordsSrc.size() > coordsDst.size()");const i=this.getCoordinateSystemType();if(0===i&&h(dm),1===i)return ot(r,t,t.length),t.length;n(this.m_peCoordSysVal);const s=this.getSRToGCSTransform();return(new Hi).transform(s,t,t.length,r)}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=it(n.x,360),n.x<-180&&(n.x+=360)):n.x>180&&(n.x=it(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);gm(n.x,-180,180,r-1,i),gm(n.y,-90,90,r-2,i);return hm(i,e,e)}isPannable(){const t=this.getCoordinateSystemType();return 0!==t&&3!==t&&(n(this.m_peCoordSysVal),this.m_peCoordSysVal.isPannable())}getPannableExtent(){return this.isPannable()||e("!is_pannable"),n(this.m_peCoordSysVal),this.m_peCoordSysVal.getPannableExtent()}getPannableExtentInGCS(){return this.isPannable()||e("!is_pannable"),n(this.m_peCoordSysVal),this.m_peCoordSysVal.getPannableExtentGCS()}throwIfNotGCSOrPCS(){const t=this.getCoordinateSystemType();1!==t&&2!==t&&e("Not a GCS or PCS")}getDomainXY(){return this.throwIfNotGCSOrPCS(),n(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(Sm()||h("projection engine is not loaded"),n(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?$m(t,this.m_unit,this.m_vertcs,this.m_precisionDescriptor.getPrecision()):3===e?m("image cs"):Qm(t,this.m_peCoordSysVal,this.m_vertcs,this.m_precisionDescriptor.getPrecision())}t.m_falseX=Number.NaN,t.m_falseY=Number.NaN}horizontalEqual(t){return Sa(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(n(!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;n(e.m_peCoordSysVal);let t=this.m_precisionDescriptor.m_falseX,r=this.m_precisionDescriptor.m_falseY;if(Number.isNaN(t)){const e=this.m_peCoordSysVal.getDomainXY();t=e.xmin,r=e.ymin}let i=e.m_precisionDescriptor.m_falseX,s=e.m_precisionDescriptor.m_falseY;if(Number.isNaN(i)){const t=e.m_peCoordSysVal.getDomainXY();i=t.xmin,s=t.ymin}return t===i&&r===s}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(ba(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 n(0),!1}equalVerticalVCS(t){return n(0),!1}convergenceAngle(t){return n(0),0}getPeCoordsysCopy(){if(this.m_peCoordSysVal){const t=this.m_peCoordSysVal.m_peCoordSys;return t||c("cannot clone coord sys"),t}return null}getPeVertcsCopy(){return n(0),0}throwIfLocal(){0===this.getCoordinateSystemType()&&e(dm)}getPrimeMeridian(){return this.throwIfLocal(),n(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(),n(this.m_peCoordSysVal),this.m_peCoordSysVal.getOneMeterPCSUnit()}getDefaultPrecisionSR(){if(this.m_bDefaultDescriptor)return this;if(null===this.m_defaultPrecisionSR){const t=new km;this.queryDefaultPrecisionDescriptorWithoutFalseXY(t),this.m_defaultPrecisionSR=Gm(this,t,!0)}return this.m_defaultPrecisionSR}getPCSHorizon(){return this.throwIfNotGCSOrPCS(),n(this.m_peCoordSysVal),this.m_peCoordSysVal.getPCSHorizon()}getHorzUnitFactor(){return this.m_unit?this.m_unit.getUnitToBaseFactor():1}querySpheroidData(t){this.throwIfNotGCSOrPCS(),n(this.m_peCoordSysVal);const e=this.getGCS().getPECoordSys().getDatum().getSpheroid(),r=e.getFlattening();xm(t,e.getAxis(),r)}getAreaOfUse(){0===this.getCoordinateSystemType()&&h(""),n(this.m_peCoordSysVal);const t=this.m_peCoordSysVal.getAreaOfUse();return null===t?new ne:new ne({geom:t.clone(),sr:Tm(4326)})}getZToXYFactor(){return 1}isCustomWkid(){return!1}getOneDegreeGCSUnit(){return this.throwIfNotGCSOrPCS(),n(this.m_peCoordSysVal),this.m_peCoordSysVal.getOneDegreeGCSUnit()}getGcsUnitFactor(){return this.throwIfNotGCSOrPCS(),n(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(u(e))return this.snapMultiVertex_(t);if(e===o.enumPoint)return this.snapPoint_(t);if(e===o.enumEnvelope)return this.snapEnvelope_(t);if(a(e))return this.snapSegment_(t);if(e===o.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}c("what else?")}snapMultiVertex_(t){if(n(!t.isEmpty()),n(2!==this.m_precisionDescriptor.getPrecision()),l(t.getGeometryType())){const e=t;if(e.hasNonLinearSegments())return this.snapGeometryWithCurves_(e)}const e=t.getImpl(),r=e.getDescription();let i=!1;for(let n=0,s=r.getAttributeCount();n<s;n++){const t=r.getSemantics(n),s=e.getAttributeStreamRef(t);i=this.snapAttributes(t,s,0,e.getPointCount())||i}return i&&e.notifyModifiedFlags(2001),i}snapPoint_(t){return!1}snapEnvelope_(t){return!1}snapSegment_(t){n(!t.isEmpty()),n(2!==this.m_precisionDescriptor.getPrecision());const e=new km;this.queryPrecisionDescriptor(e);const r=t.getStartXY(),i=new $;i.x=eu(r.x,e.getFalseX(),e.getGridUnitsXY()),i.y=eu(r.y,e.getFalseY(),e.getGridUnitsXY());let s=!i.equals(r);const o=t.getEndXY(),a=new $;a.x=eu(o.x,e.getFalseX(),e.getGridUnitsXY()),a.y=eu(o.y,e.getFalseY(),e.getGridUnitsXY()),s||=!a.equals(o),s&&t.changeEndPoints2D(i,a);const m=(e,n,r)=>{let i=!1;{const s=t.getStartAttributeAsDbl(e,0),o=eu(s,n,r),a=!at(o,s);i||=a,a&&t.setStartAttribute(e,0,o)}{const s=t.getEndAttributeAsDbl(e,0),o=eu(s,n,r),a=!at(o,s);i||=a,a&&t.setEndAttribute(e,0,o)}return i};let u=s?1:0;return t.hasAttribute(1)&&(u|=m(1,e.getFalseZ(),e.getGridUnitsZ())?1:0),t.hasAttribute(2)&&(u|=m(2,e.getFalseM(),e.getGridUnitsM())?1:0),!!u}snapGeometryWithCurves_(t){n(!t.isEmpty()),n(2!==this.m_precisionDescriptor.getPrecision());const e=t.createInstance(),r=new y;let i=0;for(let n=0,s=t.getPathCount();n<s;++n){const s=t.getSegmentCountPath(n);if(0===s){if(e.addPath(t,n,!0),1===e.getPathSize(n)){const t=new A;e.getPointByVal(e.getPointCount()-1,t),i|=this.snapGeometry(t)?1:0,e.setPointByVal(e.getPointCount()-1,t)}continue}const o=t.isClosedPath(n);for(let a=0,m=o?s-1:s;a<m;++a)t.getSegmentFromPath(n,a,r,!1),i|=this.snapGeometry(r.get())?1:0,e.addSegment(r.get(),0===a);o&&(t.getSegmentFromPath(n,s-1,r,!1),i|=this.snapGeometry(r.get())?1:0,1===s?e.addPathFromClosedSegment(r.get(),!1):e.closeLastPathWithSegment(r.get()))}return i&&e.copyTo(t),!!i}snapAttributes(e,n,r,i){let s=!1;const o=new km;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||!at(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||!at(i,r),s&&e.write(n,i)}}return s}static s_SnapValue(t,e,n){return mt((t-e)*n)/n+e}};class km{constructor(){const t=fm,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=Q(e,this.m_falseM),e=Q(e,this.m_unitsM),t=Q(t,this.m_unitsXY),e=Q(e,this.m_toleranceXY),t=Q(t,this.m_falseZ),e=Q(e,this.m_toleranceZ),t=Q(t,this.m_unitsZ),e=Q(e,this.m_toleranceM),t=Q(t,this.m_precision),Q(t,e)}clone(){const t=new km;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 e=new t;switch(this.m_precision){case 0:{const t=km.getLimit32()/this.getGridUnitsXY();e.setCoords({xmin:this.getFalseX(),ymin:this.getFalseY(),xmax:this.getFalseX()+t,ymax:this.getFalseY()+t})}break;case 1:{const t=Number(km.getLimit64())/this.getGridUnitsXY();e.setCoords({xmin:this.getFalseX(),ymin:this.getFalseY(),xmax:this.getFalseX()+t,ymax:this.getFalseY()+t})}break;case 2:e.setCoords({xmin:-Number.MAX_VALUE,ymin:-Number.MAX_VALUE,xmax:Number.MAX_VALUE,ymax:Number.MAX_VALUE});break;default:e.setEmpty(),c("")}return e}getZGridRange(){const t=new nt;switch(this.m_precision){case 0:{const e=km.getLimit32()/this.getGridUnitsZ();t.setCoords(this.getFalseZ(),this.getFalseZ()+e)}break;case 1:{const e=Number(km.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(),c("")}return t}getMGridRange(){const t=new nt;switch(this.m_precision){case 0:{const e=km.getLimit32()/this.getGridUnitsM();t.setCoords(this.getFalseM(),this.getFalseM()+e)}break;case 1:{const e=Number(km.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(),c("")}return t}setTolerance(t,n){switch(n<0&&e("tol < 0"),Number.isFinite(n)||e("tol is not finite"),t){case 0:this.m_toleranceXY=n;break;case 1:this.m_toleranceZ=n;break;case 2:this.m_toleranceM=n;break;default:e("cannot set tolerance for this attribute")}}setGridParams(t,n,r){Number.isFinite(t)&&Number.isFinite(n)&&Number.isFinite(r)||e("grid params are not finite"),r<1&&e("grid units cannot be smaller than 1.0"),this.m_falseX=t,this.m_falseY=n,this.m_unitsXY=r}setZParams(t,n){Number.isFinite(t)&&Number.isFinite(n)||e("grid params are not finite"),n<1&&e("grid units cannot be smaller than 1.0"),this.m_falseZ=t,this.m_unitsZ=n}setMParams(t,n){Number.isFinite(t)&&Number.isFinite(n)||e("grid params are not finite"),n<1&&e("grid units cannot be smaller than 1.0"),this.m_falseM=t,this.m_unitsM=n}setPrecision(t){}equals(t){return this===t||at(this.m_falseX,t.m_falseX)&&at(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?pm:fm);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?pm:fm;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 Bm(){return(!Hm||Sm()&&null===Hm.getPECoordSys())&&(Hm=tu(3857,0,null,!0)),Hm}function Wm(){return(!Vm||Sm()&&null===Vm.getPECoordSys())&&(Vm=tu(102100,0,null,!0)),Vm}function Zm(){return(!zm||Sm()&&null===zm.getPECoordSys())&&(zm=tu(4326,0,null,!0)),zm}function Km(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*ut(),t.m_toleranceZ=100*ut(),t.m_toleranceM=100*ut(),t.m_precision=2}function Qm(t,n,r,i){const s=n instanceof wa;Km(t),t.m_precision=i,t.m_falseX=Number.NaN,t.m_falseY=Number.NaN;const o=1e-4,a=.001,m=s?n.m_csType:n.isPCS?2:1;if(1===m){const e=(0===i?1/18e5:1e-9)*(s?n.getOneDegreeGCSUnit():Math.PI/n.metersOrRadiansPerUnit/180);t.m_unitsXY=1/e}else if(2===m){const e=(0===i?a:o)*(s?n.getOneMeterPCSUnit():1/n.metersOrRadiansPerUnit);t.m_unitsXY=1/e}else e("unrecognized cs type");t.m_falseM=-1e5,t.m_unitsM=1/(0===i?a:o),t.m_unitsM=Math.max(1,t.m_unitsM),t.m_unitsXY=Math.max(1,t.m_unitsXY);let u=0,c=0;0!==i&&1!==i||(u=2/t.m_unitsXY,c=2/t.m_unitsM),t.m_toleranceXY=Math.max(u,s?n.getUnitsPerMillimeter():2===m?.001/n.metersOrRadiansPerUnit:.001/(n.semiMajor*n.metersOrRadiansPerUnit)),t.m_toleranceM=Math.max(a,c),Jm(t,r)}function Jm(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 $m(t,e,n,r){Km(t),t.m_precision=r;const i=0===r?pm:fm,s=1e-4,o=.001;let a=1,m=1,u=.001;e&&(m=e.getUnitToBaseFactor()),e&&1===e.getUnitType()?(a=400*Math.PI/180,u=8.983152841195215e-9*Math.PI/180/m):(a=(0===r?o:s)*Number(i)*.5,u=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 c=0,l=0;0!==t.m_precision&&1!==t.m_precision||(l=2/t.m_unitsM,c=2/t.m_unitsXY),t.m_toleranceXY=Math.max(c,u),t.m_toleranceM=Math.max(o,l),Jm(t,n)}function tu(t,e,n,r){if(!r&&e<=0){if(3857===t)return Bm();if(102100===t)return Wm();if(4326===t)return Zm()}const i=new jm;let s,o=null;return Sm()?(s=za(t),e>0?o=null:e=0,i.setHorzProj_(s),i.m_vertcs=o):(s=Cu(t),i.m_unit=s.isPCS?new cm(s.metersOrRadiansPerUnit):new oe(s.metersOrRadiansPerUnit)),Qm(i.m_precisionDescriptor,s,o,1),i.m_bDefaultDescriptor=!0,i.m_userWKID=t,i.calculateHashCode(),i.initDbgName(),i}function eu(t,e,n){return mt((t-e)*n)/n+e}let nu=null;const ru=3552713678800501e-30;function iu(t,e,n){return t===e||Math.abs(t-e)<=n*(1+(Math.abs(t)+Math.abs(e))/2)}function su(t,e){return iu(t,e,ru)}function ou(t,e){return 0===t||Math.abs(t)<=e}function au(t){return ou(t,ru)}let mu,uu,cu,lu,hu,gu,_u,pu,fu,du,yu;function Pu(t){return{_this:t,get(){return this._this},reset(t){this._this=t},release(){const t=this._this;return this._this=null,t}}}let xu=null;function Cu(t){n(xu);const e=xu(t);return e.semiMajor=e.isPCS?Number.NaN:vu(t),e}function Eu(t){xu=t,n(xu)}function Su(t){const e=t;uu=e.PeFactory,n(uu),yu=e.PeGCSExtent,n(yu),fu=e.PeLineType,n(fu),du=e.PeMath,n(du),mu=e.PeDouble,n(mu),cu=e.PeDefs,n(cu),lu=e.PeCSTransformations,n(lu),hu=e.PeGTTransformations,n(hu),gu=e.PePCSInfo,n(gu),_u=e.PeGTlistExtended,n(_u),uu.initialize(),pu=e.PeGTlistExtendedEntry,n(pu),cu.PE_TYPE_ANGUNIT=512,cu.PE_STR_AUTH_ALL=2,gu.PE_POLE_LINE_STRAIGHT=2,gu.PE_POLE_LINE_CURVED=3,cu.PE_PARM_LAM0=2,cu.PE_PARM_PHI0=6,cu.PE_PRJ_AZIMUTHAL_EQUIDISTANT=43032,cu.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA=43033,cu.PE_PRJ_ALBERS=43007,cu.PE_PRJ_CYLINDRICAL_EQAREA=43034,cu.PE_TYPE_VERTCS=8,cu.PE_LINETYPE_GEODESIC=0,cu.PE_LINETYPE_LOXODROME=1,cu.PE_LINETYPE_GREAT_ELLIPTIC=2,cu.PE_LINETYPE_NORMAL_SECTION=3,_u.PE_GTLIST_OPTS_USABLE=1,xu=null}function bu(t,e,n,r){return e<=0?(n[0]=0,r[0]=0,!1):(n[0]=e,r[0]=e,!0)}function wu(t){n(bm());return!!xu(t).isPCS||Tu(t)}function Tu(t){return uu&&h("pe has been loaded. no-pe methods should not be used at this point."),nu||Du(),nu.has(t)}const Iu=/(?:ELLIPSOID|SPHEROID)\["(?:\w|[-()])+",(\d+\.\d+)/;function vu(t){if(uu&&h("pe has been loaded. no-pe methods should not be used at this point."),"string"==typeof t){const n=t.match(Iu);n&&2===n.length||e("bad gcs wkt");const r=Number.parseFloat(n[1]);return Number.isFinite(r)||e("bad gcs wkt"),r}return nu||Du(),nu.has(t)||h("gcs wkid not found"),nu.get(t)}function Du(){nu=new Map;for(const t in ie){const e=Number.parseFloat(t),n=ie[t];if(Array.isArray(n))for(const t of n)nu.set(t,e);else nu.set(n,e)}se()}function Gu(t,e){const n=uu.geogtran(t);n||g(t);return new Ru(n,e)}function Nu(t,e){const n=uu.fromString(cu.PE_TYPE_GEOGTRAN,t);n||_(t);return new Ru(n,e)}function Mu(t,e){return new Ru(t,e)}const Au=J(0),qu=J(1);let Ru=class t{constructor(e,n){if(e instanceof t)return this.m_geogTranWrapper=e.m_geogTranWrapper,this.m_bInverted=n?!e.m_bInverted:e.m_bInverted,void(this.m_hashCode=Q(this.m_geogTranWrapper.getHashCode(),this.m_bInverted?qu:Au));this.m_geogTranWrapper=new Fs(e),this.m_bInverted=n,this.m_hashCode=Q(this.m_geogTranWrapper.getHashCode(),this.m_bInverted?qu:Au)}getID(){return this.m_geogTranWrapper.getLatestId()}getLatestID(){return this.m_geogTranWrapper.getLatestId()}getText(){return this.m_geogTranWrapper.getText()}getTextExtended(t){if(!this.m_geogTranWrapper.getGeogtran())return"";if(-1===t)return this.m_geogTranWrapper.getGeogtran().toString();{const e=0===t?cu.PE_STR_AUTH_TOP:cu.PE_STR_AUTH_ALL;return this.m_geogTranWrapper.getGeogtran().toString(e)}}getText2(t=-1){let e=cu.PE_STR_FMT_WKT2;return-1!==t&&(e|=0===t?cu.PE_STR_AUTH_TOP:cu.PE_STR_AUTH_ALL),this.m_geogTranWrapper.getGeogtran().toString(e)}getName(){return this.m_geogTranWrapper&&this.m_geogTranWrapper.getGeogtran()?this.m_geogTranWrapper.getGeogtran().getName():""}getInputSpatialReference(){return this.m_bInverted?this.m_geogTranWrapper.getOutputSr(!1):this.m_geogTranWrapper.getInputSr(!1)}getOutputSpatialReference(){return this.m_bInverted?this.m_geogTranWrapper.getInputSr(!1):this.m_geogTranWrapper.getOutputSr(!1)}getInverse(){return new t(this,!0)}isInverted(){return this.m_bInverted}getHashCode(){return this.m_hashCode}GetPeGeogtran(){return this.m_geogTranWrapper.getGeogtran()}equals(t){const e=t;return e===this||this.m_bInverted===e.m_bInverted&&(this.GetPeGeogtran()===e.GetPeGeogtran()||this.getID()===e.getID()&&!(0===this.getID()&&!this.GetPeGeogtran().isEqual(e.GetPeGeogtran())))}referencesMissingData(){return!!this.m_geogTranWrapper&&!this.m_geogTranWrapper.isUsable()}getWrapper(){return this.m_geogTranWrapper}};function Yu(t,e,r,i,s){const o=t.getGCS(),a=e.getGCS(),m=o.getPECoordSys(),u=a.getPECoordSys();let c=null;if(!r.isEmpty()){const e=r.clone();if(!e.isEmpty()&&2===t.getCoordinateSystemType()){let n=new Y({env2D:e});const r=va(t,o,null);n=(new Hi).execute(n,r,null),n.queryEnvelope(e)}if(!e.isEmpty()){const t=m.getPrimem().getLongitude(),n=m.getUnit().getUnitFactor();c=new yu(e.xmin,e.ymin,e.xmax,e.ymax,t,n)}}let l=i;l>=St()&&(l=0);const h=[];let g=_u.PE_GTLIST_OPTS_COMMON;s||(g&=~_u.PE_GTLIST_OPTS_USABLE);for(let _=0;_<2;_++){h.length=0;const t=l,e=_u.getGTlist(m,u,2,g,c,t);let r=!1;if(e&&e.length>0)for(let o=0,a=e.length;o<a;o++){const t=Uu([e[o]]);if(n(t),s&&t.referencesMissingData())r=!0;else if(h.push(t),i>0&&h.length===i)break}if(!r)break;0===l||(l=0)}return c&&c.destroy(),h}function Uu(t){n(null!==t);const e=new Xu,r=t[0].getSteps();if(r){const n=t[0].getEntries();for(let t=0;t<r;t++){const r=0!==n[t].getDirection(),i=Mu(n[t].getGeogtran(),r);e.add(i)}return e.create()}return null}let Ou=class{constructor(t,e,n,r){this.m_bReadOnly=!0,this.m_name="",this.m_fastTrack=-1,this.m_bNameIsSet=!1,this.m_transforms=t,e&&(this.m_name=e,this.m_bNameIsSet=!0),this.m_inputSr=n,this.m_outputSr=r}getType(){return 0}getName(){if(this.m_bNameIsSet)return this.m_name;if(0===this.m_transforms.length)return"";let t="";for(const e of this.m_transforms)t.length>0&&(t+=" + "),e.isInverted()&&(t+="~"),t+=e.getName();return t}count(){return this.m_transforms.length}createInverse(){return this.getInverse()}getHashCode(){let t=1973;for(let e=0;e<this.m_transforms.length;e++)t=Q(t,this.m_transforms[e].getHashCode());return t}equals(t){return n(0),!1}referencesMissingData(){if(0===this.m_transforms.length)return!1;for(const t of this.m_transforms)if(t.referencesMissingData())return!0;return!1}isMatchingTransformation(t,e){return n(0),!1}validateTransformation(t,e){return n(0),!1}nameIsSet(){return n(0),!1}getInputSpatialReference(){return this.m_inputSr}getOutputSpatialReference(){return this.m_outputSr}getStep(t){return(t<0||t>this.count())&&p(""),this.m_transforms[t]}getInverse(){const t=new Xu;return t.addSteps(this,!0),t.setInputSpatialReference(this.m_outputSr),t.setOutputSpatialReference(this.m_inputSr),t.create()}transform(t,e,n){if(0===this.count())return;let r=this.m_inputSr,i=this.m_outputSr;if(t&&(i=bt(r,r=i)),0===this.m_transforms.length)return void Ls(r,null,i,null,e,null,n);let s=this.m_fastTrack;if(1===s)return void x(t,this.m_transforms,(r=>{ks(r.getWrapper(),t!==r.isInverted(),e,null,n)}));const o=Xs();-1===s&&o.initFromGcsAndVcs(r,null);const a=Xs();let m=t?this.m_transforms.length-1:0;const u=t?-1:1;for(let l=0,h=this.m_transforms.length;l<h;l++,m+=u){if(0===l){const i=this.m_transforms[m];Hs(r.getPECoordSys(),null,i.getWrapper(),t!==i.isInverted(),e,null,n,a),-1===s&&(o.equals(a)||(s=0)),o.assign(a)}else{const r=this.m_transforms[m-u],i=this.m_transforms[m];zs(o,r.getWrapper(),t!==r.isInverted(),i.getWrapper(),t!==i.isInverted(),e,null,n,a),-1===s&&(o.equals(a)||(s=0)),o.assign(a)}const i=this.m_transforms[m];js(o,i.getWrapper(),t!==i.isInverted(),e,null,n,a),o.assign(a)}const c=this.m_transforms[m-u];Vs(o,c.getWrapper(),t!==c.isInverted(),i,null,e,null,n),-1===s&&(a.initFromGcsAndVcs(i,null),o.equals(a)||(s=0)),this.m_fastTrack=0===s?0:1}};class Xu{constructor(){this.m_transforms=[],this.m_inputGCS=null,this.m_outputGCS=null,this.m_name="",this.m_bNameIsSet=!1}getInputSpatialReference(){return null!==this.m_inputGCS?this.m_inputGCS:this.count()>0?this.m_transforms[0].getInputSpatialReference():null}setInputSpatialReference(t){this.m_inputGCS=t?t.getGCS():null}getOutputSpatialReference(){return null!==this.m_outputGCS?this.m_outputGCS:this.count()>0?this.m_transforms.at(-1).getOutputSpatialReference():null}setOutputSpatialReference(t){this.m_outputGCS=t?t.getGCS():null}getName(){if(this.m_bNameIsSet)return this.m_name;if(0===this.m_transforms.length)return"";let t="";for(const e of this.m_transforms)t.length>0&&(t+=" + "),e.isInverted()&&(t+="~"),t+=e.getName();return t}count(){return this.m_transforms.length}getStep(t){return(t<0||t>this.count())&&p(""),this.m_transforms[t]}setStep(t,e){n(0)}add(t){this.m_transforms.push(t)}addSteps(t,e){if(e)for(let n=t.count()-1;n>=0;--n)this.add(t.getStep(n).getInverse());else for(let n=0;n<t.count();++n)this.add(t.getStep(n))}clear(){this.m_transforms=[],this.m_name="",this.m_bNameIsSet=!1,this.m_inputGCS=null,this.m_outputGCS=null}remove(t){n(0)}create(){const t=this.getInputSpatialReference(),e=this.getOutputSpatialReference(),n=new Ou(this.m_transforms,this.m_bNameIsSet?this.m_name:null,t,e);return n.m_bReadOnly=!0,this.clear(),n}}const Fu=Object.freeze(Object.defineProperty({__proto__:null,SpatialReference:jm,SpatialReferencePrecisionDescriptor:km,create:Tm,createFromWKT:Im,createImplFromPe:vm,createLocal:Mm,createWithNewPrecision:Gm,createWithNewVCS:Nm,getGCS:qm,getTempName:Fm,hasNoPe:bm,hasPe:Sm,injectNoPe:Em,injectPe:Cm,isInitialized:wm,isTempName:Lm,isValidWkid:Rm,isValidWkt:Ym,makeSpheroidData:Pm,snapGeometry:Am,webMercator:Bm,webMercator102100:Wm,wgs84:Zm},Symbol.toStringTag,{value:"Module"})),Lu=Object.freeze(Object.defineProperty({__proto__:null,OperatorProject:Hi},Symbol.toStringTag,{value:"Module"})),Hu=Object.freeze(Object.defineProperty({__proto__:null,CompositeGeographicTransformation:Ou,CompositeGeographicTransformationEditor:Xu,createImpl:Uu,queryGtListImpl:Yu},Symbol.toStringTag,{value:"Module"})),Vu=Object.freeze(Object.defineProperty({__proto__:null,GeographicTransformation:Ru,create:Gu,createFromPe:Mu,createFromWKT:Nu},Symbol.toStringTag,{value:"Module"})),zu=Object.freeze(Object.defineProperty({__proto__:null,ProjectionTransformation:Xa,createEx:va,createFromAoi:Ia,createImpl:Da,createImplEx:Ga,makeExtendedParams:Ma,makeExtendedParamsInternal:Ya,queryTransformationList:Na},Symbol.toStringTag,{value:"Module"}));export{Ws as $,Zo as A,ge as B,Go as C,wo as D,xe as E,lu as F,fs as G,_o as H,Ro as I,Xe as J,be as K,Ea as L,Ie as M,qo as N,Ks as O,su as P,cu as Q,Mi as R,Oe as S,Se as T,Ga as U,Js as V,Ya as W,Ma as X,ra as Y,He as Z,je as _,Qs as a,Zs as a0,Sm as a1,Am as a2,Fm as a3,uu as a4,Mo as a5,Re as a6,Ym as a7,Rm as a8,Ys as a9,Gm as aa,km as ab,ne as ac,Fu as ad,Lu as ae,Hu as af,Vu as ag,zu as ah,Im as b,Tm as c,Bs as d,va as e,zi as f,Hi as g,Eo as h,Em as i,Mm as j,ae as k,ps as l,Co as m,ji as n,mu as o,du as p,fu as q,En as r,Pm as s,_s as t,Wi as u,Zi as v,ki as w,Bi as x,pe as y,Ao as z};
|
|
5
|
+
import{Envelope2D as e}from"./Envelope2D.js";import{t,g as s,l as n,d as r,e as i,G as o,f as a,b as h,i as m,c as l,v as g,w as u,h as c,m as _,x as d,y as p,n as f,q as x,z as y,A as P,B as E,C as S}from"./Geometry.js";import{a as C,P as I,S as b,M as w,I as v,E as T,c as N,J as G,n as D,L as V,K as F,N as H,y as k,Q as A,l as M,O as U,R as q,T as O,g as B,U as R,V as Y,W as X,X as L,Y as z,Z as W,_ as j,b as Z,$ as K,a0 as Q,a1 as J,a2 as $,a3 as ee,a4 as te,a5 as se,a6 as ne,a7 as re,a8 as ie}from"./QuadraticBezier.js";import{h as oe,P as ae,L as he,i as me,c as le,E as ge,C as ue,G as ce,M as _e,n as de,a as pe,N as fe,f as xe,d as ye,Q as Pe,R as Ee,b as Se,U as Ce,W as Ie,S as be,A as we,x as ve,T as Te,X as Ne,Y as Ge,Z as De,_ as Ve,$ as Fe,a0 as He,a1 as ke,a2 as Ae,B as Me,a3 as Ue,a4 as qe,a5 as Oe,V as Be,g as Re,e as Ye,a6 as Xe}from"./Envelope.js";import{ao as Le,ap as ze,P as We,n as je,e as Ze,E as Ke,d as Qe,aq as Je,j as $e,v as et,o as tt,ar as st,as as nt,_ as rt,at as it,Z as ot,s as at,x as ht,q as mt,m as lt,b as gt,a as ut,S as ct,l as _t,au as dt,c as pt,av as ft,aw as xt,ax as yt,i as Pt,al as Et,ay as St,f as Ct,M as It,a7 as bt,K as wt,r as vt,z as Tt,az as Nt,I as Gt,aA as Dt,aB as Vt,T as Ft,h as Ht,p as kt,Q as At,aC as Mt,aD as Ut,aE as qt,k as Ot,aF as Bt}from"./Point2D.js";import{b as Rt,c as Yt}from"./tslib.es6.js";import{T as Xt}from"./Transformation2D.js";import{c as Lt,O as zt,a as Wt}from"./OperatorClip.js";import{O as jt}from"./OperatorDensify.js";import{G as Zt,S as Kt}from"./SimpleGeometryCursor.js";class Qt{constructor(e){if(this.m_geom=this.m_sr=null,e){if(e.move)return this.m_geom=e.move.m_geom,e.move.m_geom=null,this.m_sr=e.move.m_sr,void(e.move.m_sr=null);if(e.copy)return this.m_geom=e.copy.m_geom?e.copy.m_geom.clone():null,void(this.m_sr=e.copy.m_sr);e.geom&&(this.m_geom=e.geom),e.sr&&(this.m_sr=e.sr)}}getGeometry(){return this.m_geom}getSpatialReference(){return this.m_sr}setGeometry(e){this.m_geom=e}setSpatialReference(e){this.m_sr=e}equals(e,t){const s=e;return!(!this.m_sr&&s.m_sr)&&(!(this.m_sr&&!s.m_sr)&&(!(!this.m_geom&&s.m_geom)&&(!(this.m_geom&&!s.m_geom)&&(!(this.m_sr&&s.m_sr&&!this.m_sr.equals(s.m_sr))&&!(this.m_geom&&s.m_geom&&!this.m_geom.equals(s.m_geom,t))))))}clone(){let e=null;return this.m_geom&&(e=this.m_geom.clone()),new Qt({geom:e,sr:this.m_sr})}hasGeom(){return!!this.m_geom}}class Jt{constructor(e){this.m_factor=1,this.m_wkid=0,this.m_peUnit=null,e&&(this.m_peUnit=e,this.m_factor=e.getUnitFactor(),this.m_wkid=e.getCode(),this.m_wkid<0&&(this.m_wkid=0))}getName(){return this.m_peUnit.getName()}getID(){return this.m_wkid}getConversionFactor(e){return this.getUnitType()!==e.getUnitType()&&t("unit type mismatch"),this.getUnitToBaseFactor()/e.getUnitToBaseFactor()}getUnitToBaseFactor(){return this.m_factor}getHashCode(){return Le(ze(this.getUnitType()),ze(this.getUnitToBaseFactor()))}equals(e){return!!e&&(this.getUnitType()===e.getUnitType()&&this.getUnitToBaseFactor()===e.getUnitToBaseFactor()&&this.getID()===e.getID()&&this.getName()===e.getName())}static isValidWkid(e){return!1}}class $t{assign(e){this.m_reason=e.m_reason,this.m_vertexIndex1=e.m_vertexIndex1,this.m_vertexIndex2=e.m_vertexIndex2}constructor(e,t,s){void 0!==e?(this.m_reason=e,this.m_vertexIndex1=t,this.m_vertexIndex2=s):(this.m_reason=0,this.m_vertexIndex1=-1,this.m_vertexIndex2=-2)}clear(){this.m_reason=0,this.m_vertexIndex1=-1,this.m_vertexIndex2=-1}}const es={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 ts(){for(const e in es)delete es[e]}class ss extends Jt{constructor(e){if("number"==typeof e)return super(),this.m_factor=e,void(this.m_wkid=0);super(e)}getUnitType(){return 1}convertFromRadians(e){return e/this.getUnitToBaseFactor()}convertToRadians(e){return e*this.getUnitToBaseFactor()}}function ns(e){return new xu}function rs(e){return e.getType()===xc.PE_TYPE_LINUNIT?new xu(e):e.getType()===xc.PE_TYPE_ANGUNIT?new ss(e):void t("peUnit")}function is(e){const s=vc(null);return e.getType()===xc.PE_TYPE_PROJCS||e.getType()===xc.PE_TYPE_GEOGCS?s.reset(e.getUnit()):t("PE_coord_sys"),s.get()||l("cannot create units from coord sys"),rs(s.get())}class os{constructor(e,s,n){void 0===e?(this.x=new Gt,this.y=new Gt,this.z=new Gt):e instanceof oe?(this.x=new Gt(e.x),this.y=new Gt(e.y),this.z=new Gt(e.z)):e instanceof Gt?(this.x=e.clone(),this.y=s.clone(),this.z=n.clone()):t("EPoint3D constructor")}dotProduct(e){return this.x.mulE(e.x).addE(this.y.mulE(e.y)).addE(this.z.mulE(e.z))}crossProduct(e){return new os(this.y.mulE(e.z).subE(this.z.mulE(e.y)),this.z.mulE(e.x).subE(this.x.mulE(e.z)),this.x.mulE(e.y).subE(this.y.mulE(e.x)))}crossProductVector(e){const t=this.y.mulE(e.z).subE(e.y.mulE(this.z)),s=e.x.mulE(this.z).subE(this.x.mulE(e.z)),n=this.x.mulE(e.y).subE(e.x.mulE(this.y));return new os(t,s,n)}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(e,t){return e.sub(t).length()}negate(){return new os(this.x.negate(),this.y.negate(),this.z.negate())}add(e){return new os(this.x.addE(e.x),this.y.addE(e.y),this.z.addE(e.z))}sub(e){return new os(this.x.subE(e.x),this.y.subE(e.y),this.z.subE(e.z))}subThis(e){return this.x.subThisE(e.x),this.y.subThisE(e.y),this.z.subThisE(e.z),this}addThis(e){return this.x.addThisE(e.x),this.y.addThisE(e.y),this.z.addThisE(e.z),this}mul(e){return new os(this.x.mulE(e),this.y.mulE(e),this.z.mulE(e))}div(e){return new os(this.x.divE(e),this.y.divE(e),this.z.divE(e))}eq(e){return this.x.eq(e.x)&&this.y.eq(e.y)&&this.z.eq(e.z)}isZero(){return this.x.isZero()&&this.y.isZero()&&this.z.isZero()}value(){return oe.construct(this.x.value(),this.y.value(),this.z.value())}}class as{constructor(e){this.m_origin=new oe,this.m_normal=new oe,this.m_axisX=new oe,this.m_axisY=new oe,s(0)}assign(e){return s(0),this}set(e,t,n,r){s(0)}setFromPoints(e,t,n){return s(0),!1}getCoord(e,t){return s(0),{}}getCoord2D(e){return s(0),{}}getCoordX(e,t){return s(0),0}getCoordY(e,t){return s(0),0}getCoordZ(e,t){return s(0),0}setPreferredAxisX(e){s(0)}getOrigin(){return s(0),{}}getNormal(){return s(0),{}}getAxisX(){return this.m_axisX.clone()}getAxisY(){return this.m_axisY.clone()}setAxisX(e,t=!1){s(0)}setAxisY(e,t=!1){s(0)}recalculateAxisY(){s(0)}setOrigin(e){s(0)}setNormal(e,t){s(0)}intersect(e,t){return s(0),!1}intersectLine(e){return s(0),0}intersectLineEx(e,t){return s(0),0}closestCoordinate(e){return s(0),{}}projectVector(e){return s(0),{}}signedDistance(e){return s(0),0}distance(e){return s(0),0}}function hs(e,t){return!1}function ms(e,t,n,r,i=100,o=hs){let a,h,m,l,g,u,c,_,d;s(r>0);let p,f,x,y=0,P=0;const E=Et();t>n&&(n=gt(t,t=n));const S=e(t),C=e(n);S<C?(a=h=m=t,l=g=u=S):(a=h=m=n,l=g=u=C);let I=0;for(;I<i&&(x=.5*(n-t),d=t+x,p=r*(Math.abs(a)+.25),f=2*p,!(o(a,l)||Math.abs(a-d)<=f-x));++I){if(Math.abs(P)>p){const e=(a-h)*(l-u);let s=(a-m)*(l-g),r=(a-m)*s-(a-h)*e;s=2*(s-e),s>0&&(r=-r),s=Math.abs(s);const i=P;P=y,Math.abs(r)>=Math.abs(s*i*.5)||r<=s*(t-a)||r>=s*(n-a)?(P=a>=d?t-a:n-a,y=Et()*P):(y=r/s,_=a+y,(_-t<f||n-_<f)&&(y=d-a<0?-Math.abs(p):Math.abs(p)))}else P=a>=d?t-a:n-a,y=P*E;_=a+y,c=e(_),c<l?(_>=a?t=a:n=a,m=h,h=a,a=_,u=g,g=l,l=c):(_<a?t=_:n=_,c<=g||h===a?(m=h,h=_,u=g,g=c):(c<=u||m===a||m===h)&&(m=_,u=c))}return je(a,l)}function ls(e,t,s){if(e>s){e-=Math.ceil((e-s)/Ot)*Ot}else if(e<t){e+=Math.ceil((t-e)/Ot)*Ot}return e}function gs(e,t,s){return us(e,t,s,0)}function us(e,t,s,n){const r=s.x,i=s.y;return _s(e,t,Math.cos(r),Math.sin(r),Math.cos(i),Math.sin(i),n)}function cs(e,t,s,n,r,i){return _s(e,t,s,n,r,i,0)}function _s(e,t,s,n,r,i,o){const a=e/Math.sqrt(1-t*i*i),h=a+o,m=h*r*s,l=h*r*n,g=(a*(1-t)+o)*i;return oe.construct(m,l,g)}function ds(e,t,s){const n=new Gt,r=new Gt,i=new Gt,o=new Gt;n.setCos(s.x),r.setSin(s.x),i.setCos(s.y),o.setSin(s.y);const a=o.negate().mulE(o.mul(t)).add(1).sqrt(),h=new Gt(e).divE(a),m=h.mulE(i).mulE(n),l=h.mulE(i).mulE(r),g=h.mul(1-t).mulE(o);return new os(m,l,g)}function ps(e,t,s){const n=s.x,r=s.y,i=s.z,o=Math.atan2(r,n),a=Math.sqrt(n*n+r*r),h=Math.atan2(i,(1-t)*a);return We.construct(o,h)}function fs(e,t,s){const n=1-t,r=e/Math.sqrt(at(s.x)+at(s.y)+at(s.z)/n);return s.mul(r)}function xs(e,t,s,n,r){const i=gs(e,t,s),o=gs(e,t,n);return ps(e,t,oe.lerp(i,o,r))}function ys(e,t,s){const n=new oe;return n.setCrossProductVector(t,s),Math.abs(Math.atan2(n.length(),t.dotProduct(s)))*e}function Ps(e,t,s,n,r){const i=s.getUnitVector(),o=n.getUnitVector(),a=t.getUnitVector(),h=new oe;if(h.setCrossProductVector(i,o),!h.isZero()){h.normalizeThis();const t=a.sub(h.mul(h.dotProduct(a)));if(!t.isZero()){t.normalizeThis();const s=i.add(o).mul(.5);if(s.dotProduct(t)>s.dotProduct(i)){const s=Math.abs(h.dotProduct(a)),n=Math.asin(s);return r.assign(t.getUnitVector().mul(e)),n*e}}}const m=ys(1,i,a),l=ys(1,o,a);return m<=l?(r.assign(s),m*e):(r.assign(n),l*e)}function Es(e,t,s,n){const r={stack:[],error:void 0,hasError:!1};try{const i=Rt(r,new pc,!1);return Ic.geodeticDistance(e,t,s.x,s.y,n.x,n.y,i,null,null,xc.PE_LINETYPE_GEODESIC),i.val}catch(i){r.error=i,r.hasError=!0}finally{Yt(r)}}function Ss(e,t,n,r,i){switch(s(n.isFinite()&&r.isFinite()),i){case 0:return Es(e,t,n,r);case 1:return bs(e,t,n);case 2:case 3:{const s=gs(e,t,n),i=gs(e,t,r);return oe.distance(s,i)}default:h("")}}function Cs(e,t,s,n,r,i=0,o){if(2===i||3===i)return Is(e,t,s,n,r,3===i,o);const a=ps(e,t,s),h=s=>{const o=ps(e,t,oe.lerp(n,r,s));return Ss(e,t,a,o,i)},m=oe.distance(n,r);if(m>0){const s=Ms(e,m),{first:i,second:a}=ms(h,0,1,s);return o&&o.assign(fs(e,t,oe.lerp(n,r,i))),je(i,a)}{const e=h(0);return o&&o.assign(n),je(.5,e)}}function Is(e,t,s,n,r,i=!1,o){const a=fs(e,t,s);if(i){const i=new as({pt0:new oe(0,0,0),pt1:n,pt2:r}),h=i.closestCoordinate(s),m=i.closestCoordinate(n),l=i.closestCoordinate(r),g=We.getClosestCoordinate(m,l,h),u=fs(e,t,oe.lerp(n,r,g)),c=oe.distance(u,a);return o&&o.assign(u),je(g,c)}const h=s=>{const i=fs(e,t,oe.lerp(n,r,s));return oe.distance(i,a)},m=oe.distance(n,r);if(m>0){const s=Ms(e,m),{first:i,second:a}=ms(h,0,1,s);return o&&o.assign(fs(e,t,oe.lerp(n,r,i))),je(i,a)}{const e=oe.distance(s,n);return o&&o.assign(s),je(.5,e)}}function bs(e,t,s,n){const r={stack:[],error:void 0,hasError:!1};try{const n=Rt(r,new pc,!1);return Ic.greatEllipticDistance(e,t,s.x,s.y,s.x,s.y,n,null,null),n.val}catch(i){r.error=i,r.hasError=!0}finally{Yt(r)}}function ws(e,t,s,n,r){if(Math.abs(s.x-n.x)>Math.PI)return Number.NaN;if(Math.abs(s.y)>_t||Math.abs(n.y)>_t)return Number.NaN;if((Math.abs(s.y)===_t||Math.abs(n.y)===_t)&&s.x!==n.x)return Number.NaN;const{first:i,second:o}=Dt(s.x,n.x);let a=r;a=ls(a,i,o);if(!Ke.construct(s.x,n.x).containsCoordinate(a))return Number.NaN;const h=X.constructPoint2D(s),m=X.constructPoint2D(n),l=ds(1,t,h),g=ds(1,t,m),u=l.crossProductVector(g);if(u.z.isZero()){return s.y}const c=u.x.divE(u.z.negate()),_=u.y.divE(u.z.negate()),d=c.mulE(c).addE(_.mulE(_)).sqrt();if(d.isZero()||c.isZero()&&_.isZero()){return s.y}const p=Math.atan2(_.value(),c.value());let f=Math.atan2(d.value()*Math.cos(p-a),1-t);const x=gs(1,t,We.construct(a,f)),y=oe.construct(x.x,x.y,-x.z),P=u.value().dotProduct(x),E=u.value().dotProduct(y);return Math.abs(E)<Math.abs(P)&&(f=-f),f}function vs(e,t,s,n,r,i){if(i[0]=Number.NaN,i[1]=Number.NaN,Math.abs(s.x-n.x)>Math.PI)return 0;if(Math.abs(s.y)>_t||Math.abs(n.y)>_t)return 0;if((Math.abs(s.y)===_t||Math.abs(n.y)===_t)&&s.x!==n.x)return 0;if(Math.abs(r)>=_t)return 0;if(s.y>0&&n.y>0&&s.y>r&&n.y>r||s.y<0&&n.y<0&&s.y<r&&n.y<r)return 0;const o=X.constructPoint2D(s),a=X.constructPoint2D(n),h=ds(1,t,o),m=ds(1,t,a),l=h.crossProductVector(m);if(l.z.isZero()){return Ke.construct(s.y,n.y).containsCoordinate(r)?(i[0]=s.x,1):0}const g=l.x.divE(l.z.negate()),u=l.y.divE(l.z.negate()),c=g.mulE(g).addE(u.mulE(u)).sqrt();if(c.isZero()||g.isZero()&&u.isZero())return 0===r?(i[0]=s.x,i[1]=n.x,2):0;const _=(1-t)*Math.tan(r)/c.value();if(Math.abs(_)>1)return 0;const d=Math.acos(_),p=Math.atan2(u.value(),g.value()),f=p-d;let x=p+d;const y=Math.min(s.x,n.x),P=Math.max(s.x,n.x);ls(f,y,P),0!==r?ls(x,y,P):x=f;let E=0;return y<=f&&f<=P&&(i[E]=f,E++),x!==f&&y<=x&&x<=P&&(i[E]=x,E++),E}function Ts(e,t){t[0]>.5*Math.PI?(e[0]+=Math.PI,t[0]=Math.PI-t[0]):t[0]<.5*-Math.PI&&(e[0]-=Math.PI,t[0]=-Math.PI-t[0]),s(t[0]>=.5*-Math.PI&&t[0]<=.5*Math.PI)}function Ns(e,t){return e*Math.sqrt(1-t)}function Gs(e){return 1-e}function Ds(e,t,s,n,r){n=pt(n,-_t,_t),r=pt(r,-_t,_t);const i=_t-.03;let o;o=n>i&&r>i||n<-i&&r<-i?Vs(e,n,r):Fs(e,r)-Fs(e,n);return.5*(s-t)*o*Gs(e)}function Vs(e,t,s){let n=1;if(t<0&&(n=-1,t=-t,s=-s),0!==e){const r=e*e,i=r*e,o=[1,(1+11*e)/12,(1+118*e+241*r)/360,(1+1089*e+10419*r+8651*i)/20160,(1+9836*e+318246*r+1027436*i+458881*(i*e))/1814400],a=t=>{let s=0;const n=at(t)/(e-1);for(let e=o.length-1;e>=0;--e)s=o[e]+s*n;return s*=-at(t/(1-e)),s},h=a(_t-t);return(a(_t-s)-h)*n}{const e=_t-t,r=_t-s,i=-4*at(Math.sin(e/2));return(-4*at(Math.sin(r/2))-i)*n}}function Fs(e,t){if(0===t)return 0;const s=Math.sin(t);let n=s,r=s;if(0!==e){n/=1-e*s*s;const t=Math.sqrt(e);r=s*ht(t*s)}return n+r}function Hs(e,t){return e/Math.sqrt(1-t)}function ks(e,t){return(1-t)*e}function As(e,t,s){const n=s/(2*ks(e,t)),r=n*n;return s*(1-r*(.16666666666666666-.008333333333333333*r))}function Ms(e,t){if(0!==t){const s=e*Ut()/t;return Math.min(s,1e-10)}return 0}class Us{constructor(e){this.m_currentShift=63n,this.m_currentElt=0n,this.m_iCurrentElt=-1,this.m_parent=e,this.m_aiSetElts=e.m_bits.flatMap(((e,t)=>t))}next(){if(this.m_currentShift++,64n===this.m_currentShift){if(this.m_iCurrentElt++,this.m_iCurrentElt===this.m_aiSetElts.length)return Us.npos();this.m_currentShift=0n,this.m_currentElt=this.m_parent.m_bits[this.m_aiSetElts[this.m_iCurrentElt]]}for(;this.m_currentShift<63n&&!(this.m_currentElt&1n<<this.m_currentShift);)this.m_currentShift++;return this.m_currentElt&1n<<this.m_currentShift?64*this.m_aiSetElts[this.m_iCurrentElt]+Number(this.m_currentShift):this.next()}static npos(){return Number.MAX_SAFE_INTEGER}}function qs(e){return 1n<<(0x3fn&BigInt(e))}function Os(e){return e>>6}class Bs{constructor(e){this.m_bits=[],void 0!==e&&e.copy&&(this.m_bits=e.copy.m_bits.slice())}assignMove(){return this}assignCopy(){return this}hasBit(e){const t=qs(e),s=Os(e);return void 0!==this.m_bits[s]&&!!(this.m_bits[s]&t)}setBit(e){const t=qs(e),s=Os(e);void 0===this.m_bits[s]&&(this.m_bits[s]=0n),this.m_bits[s]|=t}clearBit(e){}flipBit(e){const t=qs(e),s=Os(e);return void 0===this.m_bits[s]&&(this.m_bits[s]=0n),this.m_bits[s]^=t,0n!==(this.m_bits[s]&t)}clear(){this.m_bits.length=0}isZero(){let e=0;return this.m_bits.forEach((t=>{e|=t?2:1})),!(2&e)}equals(e){if(this===e)return!0;if(this.m_bits.length!==e.m_bits.length)return!1;let t=0;return this.m_bits.forEach(((s,n)=>{t|=s===e.m_bits[n]?2:1})),!(1&t)&&(e.m_bits.forEach(((e,s)=>{t|=e===this.m_bits[s]?2:1})),!(1&t))}notEquals(e){return!this.equals(e)}assignOr(e){return e.m_bits.forEach(((e,t)=>{void 0===this.m_bits[t]?this.m_bits[t]=e:this.m_bits[t]|=e})),this}assignSubtract(e){return e.m_bits.forEach(((e,t)=>{void 0!==this.m_bits[t]&&(this.m_bits[t]&=~e)})),this}assignAnd(e){return e.m_bits.forEach(((e,t)=>{void 0!==this.m_bits[t]&&(this.m_bits[t]&=e)})),this}assignXor(e){return e.m_bits.forEach(((e,t)=>{void 0===this.m_bits[t]?this.m_bits[t]=e:this.m_bits[t]^=e})),this}getHashCode(){return this.m_bits.reduce(((e,t)=>Vt(e,t)),ze(0))}getUnorderedBitIterator(){return new Us(this)}}class Rs{constructor(e,t){this.m_map=new Map,this.m_hf=e,this.m_ef=t}add(e){const t=this.m_hf(e);if(!this.m_map.has(t))return this.m_map.set(t,e),this;const s=this.m_map.get(t);return s instanceof Array?s.find((t=>this.m_ef(t,e)))||s.push(e):this.m_ef(s,e)||this.m_map.set(t,[s,e]),this}clear(){this.m_map.clear()}delete(e){return!1}has(e){const t=this.m_hf(e);if(!this.m_map.has(t))return!1;const s=this.m_map.get(t);return s instanceof Array?void 0!==s.find((t=>this.m_ef(t,e))):this.m_ef(s,e)}get(e){const t=this.m_hf(e),s=this.m_map.get(t);if(void 0!==s)return s instanceof Array?s.find((t=>this.m_ef(t,e))):s}get size(){let e=0;for(const t of this.m_map.values())e+=t instanceof Array?t.length:1;return e}forEach(e,t){}[Symbol.iterator](){return(new Set)[Symbol.iterator]()}entries(){return(new Set).entries()}keys(){return(new Set).keys()}values(){return(new Set).values()}get[Symbol.toStringTag](){return"ValueSet"}}class Ys extends Xe{constructor(e){super(),this.m_bufferLeft=new b,this.m_bufferRight=new b,this.m_intervalLeft=Ke.constructEmpty(),this.m_intervalRight=Ke.constructEmpty(),this.m_yScanline=Number.NaN,this.m_helper=e}compare(e,t,s){const n=t,r=e.getElement(s);this.m_helper.querySegmentXY(n,this.m_bufferLeft),this.m_helper.querySegmentXY(r,this.m_bufferRight);const i=this.m_bufferLeft.get(),o=this.m_bufferRight.get();if(this.m_intervalLeft.setCoords(i.getStartX(),i.getEndX()),this.m_intervalRight.setCoords(o.getStartX(),o.getEndX()),this.m_intervalLeft.vmax<this.m_intervalRight.vmin)return-1;if(this.m_intervalLeft.vmin>this.m_intervalRight.vmax)return 1;const a=i.getStartY()===i.getEndY(),h=o.getStartY()===o.getEndY();if(a||h){if(a&&h)return 0;if(i.getStartY()===o.getStartY()&&i.getStartX()===o.getStartX())return a?1:-1;if(i.getEndY()===o.getEndY()&&i.getEndX()===o.getEndX())return a?-1:1}let m=i.intersectionOfYMonotonicWithAxisX(this.m_yScanline,this.m_intervalLeft.vmin),l=o.intersectionOfYMonotonicWithAxisX(this.m_yScanline,this.m_intervalRight.vmin);if(m===l){const e=i.getEndY(),t=o.getEndY(),s=Math.min(e,t);let n=.5*(s+this.m_yScanline);n===this.m_yScanline&&(n=s),m=i.intersectionOfYMonotonicWithAxisX(n,this.m_intervalLeft.vmin),l=o.intersectionOfYMonotonicWithAxisX(n,this.m_intervalRight.vmin)}return m<l?-1:m>l?1:0}setY(e){this.m_yScanline=e}}class Xs{constructor(e){this.m_segmentBuffer=new b,this.m_point=We.getNAN(),this.m_parent=e}setPointXY(e){this.m_point.assign(e)}compare(e,t){const s=e.getElement(t);this.m_parent.querySegmentXY(s,this.m_segmentBuffer);const n=this.m_segmentBuffer.get(),r=new Ke;if(r.setCoords(n.getStartX(),n.getEndX()),this.m_point.x<r.vmin)return-1;if(this.m_point.x>r.vmax)return 1;const i=n.intersectionOfYMonotonicWithAxisX(this.m_point.y,this.m_point.x);return this.m_point.x<i?-1:this.m_point.x>i?1:0}}var Ls,zs;function Ws(e,t){return{parentage:e,rank:t}}function js(e,t){const s=e.length;if(s!==t.length)return!1;const n=e[0].parentage;if(n!==t[0].parentage)return!1;if(-1===n)return!0;for(let r=1;r<s;++r)if(e[r].parentage!==t[r].parentage)return!1;return!0}function Zs(e,t,s){s.length=0;let n=!1;{let r=e.getHalfEdgeVertexIterator(t);for(;r!==D;){const t=e.getVertexFromVertexIterator(r),i=e.getShape().getSegmentRank(t),o=e.getShape().getSegmentParentage(t);n||=o>=0,s.push(Ws(o,i)),r=e.incrementVertexIterator(r)}}{let r=e.getHalfEdgeVertexIterator(e.getHalfEdgeTwin(t));for(;r!==D;){const t=e.getVertexFromVertexIterator(r),i=e.getShape().getSegmentRank(t),o=e.getShape().getSegmentParentage(t);n||=o>=0,s.push(Ws(o,i)),r=e.incrementVertexIterator(r)}}n&&s.sort(((e,t)=>e.rank>t.rank?-1:e.rank<t.rank?1:e.parentage<t.parentage?-1:e.parentage>t.parentage?1:0)),-1===s[0].parentage&&(s.length=1)}function Ks(){return new Rs((e=>e.getHashCode()),((e,t)=>e.equals(t)))}!function(e){e[e.enumInputModeBuildGraph=0]="enumInputModeBuildGraph",e[e.enumInputModeSimplifyAlternate=1]="enumInputModeSimplifyAlternate",e[e.enumInputModeSimplifyWinding=2]="enumInputModeSimplifyWinding"}(Ls||(Ls={})),function(e){e[e.enumSegmentParentageBreakNode=1]="enumSegmentParentageBreakNode",e[e.enumPathBreakNode=2]="enumPathBreakNode"}(zs||(zs={}));class Qs{constructor(){this.m_shape=null,this.m_clusterData=new be(8),this.m_clusterVertices=new be(2),this.m_firstCluster=D,this.m_lastCluster=D,this.m_halfEdgeData=new be(8),this.m_chainData=new be(8),this.m_chainAreas=null,this.m_chainPerimeters=null,this.m_universeChain=-1,this.m_simplifiedGeometry=-1,this.m_edgeIndices=[],this.m_clusterIndices=[],this.m_chainIndices=[],this.m_bBuildGeometryParentageSets=!1,this.m_chainBitSetIndex=-1,this.m_edgeBitSetIndex=-1,this.m_edgeBitSetIndexLeft=-1,this.m_emptyBitSet=null,this.m_geometryMapID=null,this.m_uniqueBitSets=null,this.m_chainBitSets=[],this.m_edgeBitSets=[],this.m_checkDirtyPlanesweepTolerance=Number.NaN,this.m_geometryIDIndex=-1,this.m_clusterIndex=-1,this.m_halfEdgeIndex=-1,this.m_tmpHalfEdgeParentageIndex=-1,this.m_tmpHalfEdgeParentageIndexLeft=-1,this.m_tmpHalfEdgeWindingNumberIndex=-1,this.m_tmpHalfEdgeOddEvenNumberIndex=-1,this.m_segmentParentageIndex=-1,this.m_segmentIndexHe=-1,this.m_clusterBreakNodeIndex=-1,this.m_universeGeomID=-1,this.m_pointCount=0,this.m_progressCounter=0,this.m_bBuildChains=!0,this.m_bDirtyCheckFailed=!1}setCheckDirtyPlanesweepTolerance(e){this.m_checkDirtyPlanesweepTolerance=e}dirtyCheckFailed(){return this.m_bDirtyCheckFailed}getShape(){return this.m_shape}setEditShape(e,t,s=!0,n=!1){n?this.setEditShapeImpl3D_(e,Ls.enumInputModeBuildGraph,null,t,!1):this.setEditShapeImpl_(e,Ls.enumInputModeBuildGraph,null,t,s)}setAndSimplifyEditShapeAlternate(e,t,s=null,n=!1){const r=[];r.push(t),this.m_simplifiedGeometry=t,n?this.setEditShapeImpl3D_(e,Ls.enumInputModeSimplifyAlternate,r,s,!1):this.setEditShapeImpl_(e,Ls.enumInputModeSimplifyAlternate,r,s,e.getGeometryType(t)===o.enumPolygon)}setAndSimplifyEditShapeWinding(e,t,s=null){const n=[];n.push(t),this.m_simplifiedGeometry=t,this.setEditShapeImpl_(e,Ls.enumInputModeSimplifyWinding,n,s,!0)}removeShape(){null!==this.m_shape&&(-1!==this.m_geometryIDIndex&&(this.m_shape.removeGeometryUserIndex(this.m_geometryIDIndex),this.m_geometryIDIndex=-1),-1!==this.m_clusterIndex&&(this.m_shape.removeUserIndex(this.m_clusterIndex),this.m_clusterIndex=-1),-1!==this.m_halfEdgeIndex&&(this.m_shape.removeUserIndex(this.m_halfEdgeIndex),this.m_halfEdgeIndex=-1),-1!==this.m_tmpHalfEdgeParentageIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeParentageIndex),this.m_tmpHalfEdgeParentageIndex=-1),-1!==this.m_tmpHalfEdgeParentageIndexLeft&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeParentageIndexLeft),this.m_tmpHalfEdgeParentageIndexLeft=-1),-1!==this.m_tmpHalfEdgeWindingNumberIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeWindingNumberIndex),this.m_tmpHalfEdgeWindingNumberIndex=-1),-1!==this.m_tmpHalfEdgeOddEvenNumberIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeOddEvenNumberIndex),this.m_tmpHalfEdgeOddEvenNumberIndex=-1),-1!==this.m_segmentParentageIndex&&(this.deleteUserIndexForHalfEdges(this.m_segmentParentageIndex),this.m_segmentParentageIndex=-1),-1!==this.m_segmentIndexHe&&(this.deleteUserIndexForHalfEdges(this.m_segmentIndexHe),this.m_segmentIndexHe=-1),-1!==this.m_clusterBreakNodeIndex&&(this.deleteUserIndexForClusters(this.m_clusterBreakNodeIndex),this.m_clusterBreakNodeIndex=-1),this.deleteEdgeBitSets_(),this.deleteChainBitSets_(),this.m_emptyBitSet=null,this.m_geometryMapID=null,this.m_shape=null,this.m_clusterData.deleteAll(!0),this.m_clusterVertices.deleteAll(!0),this.m_firstCluster=D,this.m_lastCluster=D,this.m_halfEdgeData.deleteAll(!0),this.m_edgeIndices.length=0,this.m_clusterIndices.length=0,this.m_chainIndices.length=0,this.m_chainData.deleteAll(!0),this.m_universeChain=D,this.m_chainAreas=null)}getClusterHalfEdge(e){return this.m_clusterData.getField(e,2)}queryXY(e,t){const s=this.getClusterVertexIndex_(e);t.assign(this.m_shape.getXYWithIndex(s))}queryXYZ(e,t){s(0)}getClusterParentage(e){return this.m_clusterData.getField(e,1)}getFirstCluster(){return this.m_firstCluster}getPrevCluster(e){return this.m_clusterData.getField(e,3)}getNextCluster(e){return this.m_clusterData.getField(e,4)}getClusterChain(e){return this.m_clusterData.getField(e,6)}getClusterVertexIterator(e){return this.m_clusterData.getField(e,7)}incrementVertexIterator(e){return this.m_clusterVertices.getField(e,1)}getVertexFromVertexIterator(e){return this.m_clusterVertices.getField(e,0)}getClusterUserIndex(e,t){const s=this.getClusterIndex_(e),n=this.m_clusterIndices[t];return n.size()<=s?-1:n.read(s)}setClusterUserIndex(e,t,s){const n=this.getClusterIndex_(e),r=this.m_clusterIndices[t];r.size()<=n&&r.resize(this.m_clusterData.size(),-1),r.write(n,s)}hasClusterUserIndexFlags(e,t,s){if(-1===t)return!1;const n=this.getClusterUserIndex(e,t);return-1!==n&&!!(s&n)}setClusterUserIndexFlags(e,t,s){const n=this.getClusterIndex_(e),r=this.m_clusterIndices[t];r.size()<=n&&r.resize(this.m_clusterData.size(),-1);let i=r.read(n);-1===i&&(i=0),r.write(n,s|i)}clearClusterUserIndexFlags(e,t,s){const n=this.getClusterIndex_(e),r=this.m_clusterIndices[t];r.size()<=n&&r.resize(this.m_clusterData.size(),-1);let i=r.read(n);-1===i&&(i=0),r.write(n,~s&i)}createUserIndexForClusters(e=-1){const t=new we(this.m_clusterData.capacity(),e);for(let s=0,n=this.m_clusterIndices.length;s<n;s++)if(null===this.m_clusterIndices[s])return this.m_clusterIndices[s]=t,s;this.m_clusterIndices.push(t);return this.m_clusterIndices.length-1}deleteUserIndexForClusters(e){this.m_clusterIndices[e]=null}getHalfEdgeOrigin(e){return this.m_halfEdgeData.getField(e,1)}getHalfEdgeTo(e){return this.getHalfEdgeOrigin(this.getHalfEdgeTwin(e))}getHalfEdgeTwin(e){return this.m_halfEdgeData.getField(e,4)}getHalfEdgePrev(e){return this.m_halfEdgeData.getField(e,5)}getHalfEdgeNext(e){return this.m_halfEdgeData.getField(e,6)}getHalfEdgeChain(e){return this.m_halfEdgeData.getField(e,2)}getHalfEdgeFaceParentage(e){return this.getChainParentage(this.getHalfEdgeChain(e))}getHalfEdgeVertexIterator(e){return this.m_halfEdgeData.getField(e,7)}getHalfEdgeFromXY(e,t){this.queryXY(this.getHalfEdgeOrigin(e),t)}getHalfEdgeToXY(e,t){this.queryXY(this.getHalfEdgeTo(e),t)}isHalfEdgeCurve(e){if(-1!==this.m_segmentIndexHe){return-1!==this.getHalfEdgeUserIndex(e,this.m_segmentIndexHe)}return!1}getHalfEdgeFromXYZ(e,t){s(0)}getHalfEdgeToXYZ(e,t){s(0)}getHalfEdgeParentage(e){return this.m_halfEdgeData.getField(e,3)&Qs.c_EdgeParentageMask}getHalfEdgeUserIndex(e,t){const s=this.getHalfEdgeIndex_(e),n=this.m_edgeIndices[t];return n.size()<=s?-1:n.read(s)}setHalfEdgeUserIndex(e,t,s){const n=this.getHalfEdgeIndex_(e),r=this.m_edgeIndices[t];r.size()<=n&&r.resize(this.m_halfEdgeData.size(),-1),r.write(n,s)}createUserIndexForHalfEdges(e){void 0===e&&(e=-1);const t=new we(this.m_halfEdgeData.capacity(),e);for(let s=0,r=this.m_edgeIndices.length;s<r;s++)if(null===this.m_edgeIndices[s])return this.m_edgeIndices[s]=t,s;this.m_edgeIndices.push(t);const n=this.m_edgeIndices.length-1;return s(n>=0&&n<=Number.MAX_SAFE_INTEGER),n}deleteUserIndexForHalfEdges(e){this.m_edgeIndices[e]=null}deleteEdgesBreakFaces_(e){for(let t=0,s=e.length;t<s;t++){const s=e[t],n=this.getHalfEdgeChain(s),r=this.getHalfEdgeTwin(s),i=this.getHalfEdgeChain(r);this.setChainHalfEdge_(n,D),this.setChainHalfEdge_(i,D),this.updateVertexToHalfEdgeConnection_(s,!0),this.deleteEdgeImpl_(s)}}doesHalfEdgeBelongToAPolygonInterior(e,t){return s(0),!1}doesHalfEdgeBelongToAPolygonExterior(e,t){return s(0),!1}doesHalfEdgeBelongToAPolygonBoundary(e,t){return s(0),!1}doesHalfEdgeBelongToAPolylineInterior(e,t){return s(0),!1}doesHalfEdgeBelongToAPolylineExterior(e,t){return s(0),!1}doesClusterBelongToAPolygonInterior(e,t){return s(0),!1}doesClusterBelongToAPolygonExterior(e,t){return s(0),!1}doesClusterBelongToAPolygonBoundary(e,t){return s(0),!1}getFirstChain(){return this.m_universeChain}getChainHalfEdge(e){return this.m_chainData.getField(e,1)}getChainParentage(e){return this.m_chainData.getField(e,2)}getChainParent(e){return this.m_chainData.getField(e,3)}getChainFirstIsland(e){return this.m_chainData.getField(e,4)}getChainNextInParent(e){return this.m_chainData.getField(e,5)}getChainNext(e){return this.m_chainData.getField(e,7)}getChainArea(e){const t=this.getChainIndex_(e);let s=this.m_chainAreas.read(t);return Number.isNaN(s)&&(this.updateChainAreaAndPerimeter_(e),s=this.m_chainAreas.read(t)),s}getChainPerimeter(e){return s(0),0}getChainUserIndex(e,t){const s=this.getChainIndex_(e),n=this.m_chainIndices[t];return n.size()<=s?-1:n.read(s)}setChainUserIndex(e,t,s){const n=this.getChainIndex_(e),r=this.m_chainIndices[t];r.size()<=n&&r.resize(this.m_chainData.size(),-1),r.write(n,s)}createUserIndexForChains(){const e=new we(this.m_chainData.capacity(),-1);for(let t=0,s=this.m_chainIndices.length;t<s;t++)if(null===this.m_chainIndices[t])return this.m_chainIndices[t]=e,t;this.m_chainIndices.push(e);return this.m_chainIndices.length-1}deleteUserIndexForChains(e){this.m_chainIndices[e]=null}extractPolygonFromChainAndIslands(e,t,s,n){const r=t===D?e.createGeometry(o.enumPolygon):t,i=new b;this.extractPolygonPathFromChain_(e,r,s,n,i);for(let o=this.getChainFirstIsland(s);o!==D;o=this.getChainNextInParent(o))this.extractPolygonPathFromChain_(e,r,o,n,i);return r}getGeometryID(e){const t=this.m_shape.getGeometryUserIndex(e,this.m_geometryIDIndex);return s(t>=0),1<<Math.min(t,31)}getClusterFromVertex(e){return this.m_shape.getUserIndex(e,this.m_clusterIndex)}getHalfEdgeFromVertex(e){return this.m_shape.getUserIndex(e,this.m_halfEdgeIndex)}buildGeometryParentageSets(){this.m_bBuildGeometryParentageSets=!0}getChainBitSet(e){if(s(this.m_bBuildGeometryParentageSets),-1===this.m_chainBitSetIndex)return this.getEmptySet();const t=this.getChainUserIndex(e,this.m_chainBitSetIndex);s(t>=0);let n=this.m_chainBitSets.at(t);return n||(n=this.getEmptySet()),n}getChainBoundaryBitSet(e){s(this.m_bBuildGeometryParentageSets);const t=new Bs,n=e=>{const s=this.getChainHalfEdge(e);let n=s;do{const e=this.getEdgeBitSet_(n);null!==e&&t.assignOr(e);const s=this.getEdgeBitSet_(this.getHalfEdgeTwin(n));null!==s&&t.assignOr(s),n=this.getHalfEdgeNext(n)}while(n!==s)};n(e);for(let s=this.getChainFirstIsland(e);s!==D;s=this.getChainNextInParent(s))n(e);return t}getChainPolygons(e){return s(0),[]}getGeometriesFromBits(e){if(!this.m_bBuildGeometryParentageSets||null===e)return[];if(null===this.m_geometryMapID){this.m_geometryMapID=new Map;for(let e=this.m_shape.getFirstGeometry();e!==D;e=this.m_shape.getNextGeometry(e))this.m_geometryMapID.set(this.m_shape.getGeometryUserIndex(e,this.m_geometryIDIndex),e)}const t=[],n=e.getUnorderedBitIterator();for(let r=n.next();r!==Us.npos();r=n.next())s(this.m_geometryMapID.has(r)),t.push(this.m_geometryMapID.get(r));return t}getVertexDominant(e,t){if(t===D)return e;const s=this.getClusterFromVertex(e);return this.getVertexDominantFromCluster(s,t)}getVertexDominantFromCluster(e,t){if(t!==D){let s=D;for(let n=this.getClusterVertexIterator(e);n!==D;n=this.incrementVertexIterator(n)){const e=this.getVertexFromVertexIterator(n);s===D&&(s=e);const r=this.m_shape.getPathFromVertex(e);if(this.m_shape.getGeometryFromPath(r)===t){s=e;break}}return s}{const t=this.getClusterVertexIterator(e);if(t!==D){return this.getVertexFromVertexIterator(t)}return D}}isBreakNode(e){return this.hasClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,zs.enumSegmentParentageBreakNode)}setBreakNode(e,t){s(-1!==this.m_clusterBreakNodeIndex),t?this.setClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,zs.enumSegmentParentageBreakNode):this.clearClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,zs.enumSegmentParentageBreakNode)}isStrongPathNode(e){return this.hasClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,zs.enumPathBreakNode)}setStrongPathNode(e,t){if(-1===this.m_clusterBreakNodeIndex){if(!t)return;this.m_clusterBreakNodeIndex=this.createUserIndexForClusters()}t?this.setClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,zs.enumPathBreakNode):this.clearClusterUserIndexFlags(e,this.m_clusterBreakNodeIndex,zs.enumPathBreakNode)}getSegmentParentage(e){if(-1===this.m_segmentParentageIndex)return-1;const t=this.getHalfEdgeUserIndex(e,this.m_segmentParentageIndex);return t>=0?t:-1}isCrossroadAhead(e){const t=this.getHalfEdgeNext(e);if(this.isStrongPathNode(this.getHalfEdgeOrigin(t)))return!0;const s=this.getHalfEdgeTwin(t),n=this.getHalfEdgeNext(s);return e!==this.getHalfEdgeTwin(n)}isCrossroadBehind(e){return s(0),!1}getHalfEdgeConnector(e,t){const s=this.getClusterHalfEdge(e);if(s===D)return D;let n=s,r=D,i=D;do{if(this.getHalfEdgeTo(n)===t)return n;if(r===D){if(r=this.getClusterHalfEdge(t),r===D)return D;i=r}if(this.getHalfEdgeTo(i)===e)return n=this.getHalfEdgeTwin(i),n;n=this.getHalfEdgeNext(this.getHalfEdgeTwin(n)),i=this.getHalfEdgeNext(this.getHalfEdgeTwin(i))}while(n!==s&&i!==r);return D}querySegmentXY(e,t){if(-1!==this.m_segmentIndexHe){let s=this.getHalfEdgeUserIndex(e,this.m_segmentIndexHe);if(-1!==s){if(-2!==s){const e=this.m_shape.getSegmentFromIndex(s);t.copyFrom(e,!0)}else{s=this.getHalfEdgeUserIndex(this.getHalfEdgeTwin(e),this.m_segmentIndexHe);const n=this.m_shape.getSegmentFromIndex(s);t.copyFrom(n,!0),t.get().reverse()}return}}t.createLine();const s=t.get(),n=We.getNAN();this.getHalfEdgeFromXY(e,n),s.setStartXY(n),this.getHalfEdgeToXY(e,n),s.setEndXY(n)}isCurveEdge(e){if(-1!==this.m_segmentIndexHe){return-1!==this.getHalfEdgeUserIndex(e,this.m_segmentIndexHe)}return!1}compareEdgeAnglesCurveHelper_(e,t,n){const r=new b,i=new b;this.querySegmentXY(e,r),this.querySegmentXY(t,i);const o=r.get(),a=i.get();if(o.equals(a))return 0;const h=new We;this.getHalfEdgeFromXY(e,h);const m=new We;this.getHalfEdgeToXY(e,m);const l=new We;this.getHalfEdgeToXY(t,l),s(!m.isEqualPoint2D(l));const g=o.getTangent(0),u=a.getTangent(0);return We.compareVectors(g,u)}compareEdgeAnglesHelper_(e,t,s){if(e===t)return 0;if(this.isHalfEdgeCurve(e)||this.isHalfEdgeCurve(t))return this.compareEdgeAnglesCurveHelper_(e,t,s);const n=We.getNAN();this.getHalfEdgeToXY(e,n);const r=We.getNAN();if(this.getHalfEdgeToXY(t,r),n.isEqualPoint2D(r))return 0;const i=We.getNAN();this.getHalfEdgeFromXY(e,i);const o=We.getNAN();o.setSub(n,i);const a=We.getNAN();if(a.setSub(r,i),!s||a.y>=0&&o.y>0){return We.compareVectors(o,a)}return 0}compareEdgeAngles_(e,t){return this.compareEdgeAnglesHelper_(e,t,!1)}compareEdgeAnglesForPair_(e,t){return this.compareEdgeAnglesHelper_(e,t,!0)}compareEdgeAngles3D_(e,t){return s(0),0}compareEdgeAnglesForPair3D_(e,t){return s(0),0}dbgDumpChains_(){}dbgDumpChainToPolygon_(e,t){}deleteEdgeInternal_(e){const t=this.getHalfEdgeChain(e),n=this.getHalfEdgeTwin(e),r=this.getHalfEdgeChain(n);s(r===t),s(e===this.getHalfEdgeNext(n)||n===this.getHalfEdgeNext(e));let i=this.getHalfEdgeNext(e);i===n&&(i=this.getHalfEdgeNext(i),i===e&&(i=D));const o=this.getChainIndex_(t),a=this.m_chainAreas.read(o);Number.isNaN(a)||(this.setChainArea_(t,Number.NaN),this.setChainPerimeter_(t,Number.NaN));const h=this.getChainHalfEdge(t);h!==e&&h!==n||this.setChainHalfEdge_(t,i),this.updateVertexToHalfEdgeConnection_(e,!0),this.deleteEdgeImpl_(e)}getFirstUnvisitedHalfEdgeOnCluster_(e,t,s){let n=t!==D?t:this.getClusterHalfEdge(e);if(n===D)return D;const r=n;for(;;){if(1!==this.getHalfEdgeUserIndex(n,s))return n;const e=this.getHalfEdgeNext(this.getHalfEdgeTwin(n));if(e===r)return D;n=e}}removeSpikes_(){let e=!1;const t=this.createUserIndexForHalfEdges();for(let s=this.getFirstCluster();s!==D;s=this.getNextCluster(s)){let n=D;for(;;){let r=this.getFirstUnvisitedHalfEdgeOnCluster_(s,n,t);if(r===D)break;n=this.getHalfEdgeNext(this.getHalfEdgeTwin(r));let i=r;for(;;){const s=this.getHalfEdgeNext(i),o=this.getHalfEdgePrev(i),a=this.getHalfEdgeTwin(i);if(o===a){if(this.deleteEdgeInternal_(i),e=!0,n!==i&&n!==a||(n=D),i===r||o===r){if(r=s,i===r||o===r)break;i=s;continue}}else this.setHalfEdgeUserIndex(i,t,1);if(i=s,i===r)break}}}return this.deleteUserIndexForHalfEdges(t),e}progress_(e,t=!1){}newCluster_(){const e=this.m_clusterData.newElement();return this.m_clusterData.setField(e,1,0),e}newHalfEdgePair_(){const e=this.m_halfEdgeData.newElement();this.m_halfEdgeData.setField(e,2,0),this.m_halfEdgeData.setField(e,3,0);const t=this.m_halfEdgeData.newElement();return this.m_halfEdgeData.setField(t,2,0),this.m_halfEdgeData.setField(t,3,0),this.setHalfEdgeTwin_(e,t),this.setHalfEdgeTwin_(t,e),e}newChain_(){const e=this.m_chainData.newElement();return this.m_chainData.setField(e,2,0),e}deleteChain_(e){return s(0),0}getClusterIndex_(e){return this.m_clusterData.elementToIndex(e)}setClusterVertexIterator_(e,t){this.m_clusterData.setField(e,7,t)}setClusterHalfEdge_(e,t){this.m_clusterData.setField(e,2,t)}setClusterParentage_(e,t){this.m_clusterData.setField(e,1,t)}setPrevCluster_(e,t){this.m_clusterData.setField(e,3,t)}setNextCluster_(e,t){this.m_clusterData.setField(e,4,t)}setClusterVertexIndex_(e,t){this.m_clusterData.setField(e,5,t)}getClusterVertexIndex_(e){return this.m_clusterData.getField(e,5)}setClusterChain_(e,t){this.m_clusterData.setField(e,6,t)}addClusterToExteriorChain_(e,t){this.setClusterChain_(t,e)}getHalfEdgeIndex_(e){return this.m_halfEdgeData.elementToIndex(e)}setHalfEdgeOrigin_(e,t){this.m_halfEdgeData.setField(e,1,t)}setHalfEdgeTwin_(e,t){this.m_halfEdgeData.setField(e,4,t)}setHalfEdgePrev_(e,t){this.m_halfEdgeData.setField(e,5,t)}setHalfEdgeNext_(e,t){this.m_halfEdgeData.setField(e,6,t)}setHalfEdgeChain_(e,t){this.m_halfEdgeData.setField(e,2,t)}setHalfEdgeParentage_(e,t){this.m_halfEdgeData.setField(e,3,t)}getHalfEdgeParentageMask_(e){return this.m_halfEdgeData.getField(e,3)}setHalfEdgeVertexIterator_(e,t){this.m_halfEdgeData.setField(e,7,t)}updateVertexToHalfEdgeConnectionHelper_(e,t){const s=t?D:e;for(let n=this.getHalfEdgeVertexIterator(e);n!==D;n=this.incrementVertexIterator(n)){const e=this.getVertexFromVertexIterator(n);this.m_shape.setUserIndex(e,this.m_halfEdgeIndex,s)}}updateVertexToHalfEdgeConnection_(e,t){e!==D&&(this.updateVertexToHalfEdgeConnectionHelper_(e,t),this.updateVertexToHalfEdgeConnectionHelper_(this.getHalfEdgeTwin(e),t))}getChainIndex_(e){return this.m_chainData.elementToIndex(e)}setChainHalfEdge_(e,t){this.m_chainData.setField(e,1,t)}setChainParentage_(e,t){this.m_chainData.setField(e,2,t)}setChainParent_(e,t){this.m_chainData.setField(e,3,t);const s=this.getChainFirstIsland(t);this.setChainNextInParent_(e,s),this.setChainFirstIsland_(t,e)}setChainFirstIsland_(e,t){this.m_chainData.setField(e,4,t)}setChainNextInParent_(e,t){this.m_chainData.setField(e,5,t)}setChainPrev_(e,t){this.m_chainData.setField(e,6,t)}setChainNext_(e,t){this.m_chainData.setField(e,7,t)}setChainArea_(e,t){const s=this.getChainIndex_(e);this.m_chainAreas.write(s,t)}setChainPerimeter_(e,t){const s=this.getChainIndex_(e);this.m_chainPerimeters.write(s,t)}updateChainAreaAndPerimeter_(e){const t=this.m_shape.hasCurves(),s=new wt(0),n=new wt(0),r=this.getChainHalfEdge(e),i=We.getNAN(),o=We.getNAN(),a=We.getNAN();this.getHalfEdgeFromXY(r,i),o.setCoordsPoint2D(i);let h=r;do{this.getHalfEdgeToXY(h,a),t&&this.isCurveEdge(h)||n.pe(We.distance(o,a));this.getHalfEdgeChain(this.getHalfEdgeTwin(h))!==e&&s.pe((a.x-i.x-(o.x-i.x))*(a.y-i.y+(o.y-i.y))*.5),o.setCoordsPoint2D(a),h=this.getHalfEdgeNext(h)}while(h!==r);if(t){const t=new b;h=r;do{this.getHalfEdgeToXY(h,a);const r=this.isCurveEdge(h);r&&(this.querySegmentXY(h,t),n.pe(t.get().calculateLength2D()));if(this.getHalfEdgeChain(this.getHalfEdgeTwin(h))!==e&&r){const e=t.get().calculateArea2DHelper();s.pe(e)}h=this.getHalfEdgeNext(h)}while(h!==r)}const m=this.getChainIndex_(e);this.m_chainAreas.write(m,s.getResult()),this.m_chainPerimeters.write(m,n.getResult())}getChainTopmostEdge_(e){return s(0),0}planeSweepParentage_(e,t){const s=new Ys(this),n=new Te;n.setCapacity(Math.trunc(this.m_pointCount/2)),n.setComparator(s);const r=[],i=this.createUserIndexForHalfEdges();let o=null;const a=We.getNAN();for(let h=this.getFirstCluster();h!==D;h=this.getNextCluster(h)){this.progress_(t);const m=this.getClusterHalfEdge(h);if(m!==D){if(r.length=0,!this.tryOptimizedInsertion_(n,i,r,h,m)){this.queryXY(h,a),s.setY(a.y);let e=m;do{const t=this.getHalfEdgeUserIndex(e,i);-1!==t&&(n.deleteNode(t),this.setHalfEdgeUserIndex(e,i,be.impossibleIndex2())),e=this.getHalfEdgeNext(this.getHalfEdgeTwin(e))}while(m!==e);e=m;do{if(-1===this.getHalfEdgeUserIndex(e,i)){const t=n.addElement(e);r.push(t)}e=this.getHalfEdgeNext(this.getHalfEdgeTwin(e))}while(m!==e)}for(let t=r.length-1;t>=0;t--){const s=r[t],o=n.getElement(s),a=this.getHalfEdgeTwin(o);this.setHalfEdgeUserIndex(a,i,s),this.planeSweepParentagePropagateParentage_(n,s,e)}}else if(this.getClusterChain(h)===D){null===o&&(o=new Xs(this)),this.queryXY(h,a),o.setPointXY(a);const e=n.searchLowerBound(o);let t=this.m_universeChain;if(-1!==e){let s=n.getElement(e);this.getHalfEdgeChain(s)===this.getHalfEdgeChain(this.getHalfEdgeTwin(s))&&(s=this.getLeftSkipPolylines_(n,e)),s!==D&&(t=this.getHalfEdgeChain(s))}this.addClusterToExteriorChain_(t,h)}}this.deleteUserIndexForHalfEdges(i)}planeSweepParentagePropagateParentage_(e,t,n){const r=e.getElement(t),i=this.getHalfEdgeChain(r);if(this.getChainParent(i)!==D)return;const o=this.getLeftSkipPolylines_(e,t),a=this.getHalfEdgeTwin(r),h=this.getHalfEdgeChain(a);let m=this.getChainParent(i),l=this.getChainParent(h);if(o===D)m===D&&(h===i?(this.setChainParent_(h,this.m_universeChain),l=this.m_universeChain,m=l):(l===D&&(this.setChainParent_(h,this.m_universeChain),l=this.m_universeChain),this.setChainParent_(i,h),m=h));else{const e=this.getHalfEdgeChain(o);if(l===D){if(this.getChainArea(e)<=0){const t=this.getChainParent(e);this.setChainParent_(h,t),l=t}else this.setChainParent_(h,e),l=e;h===i&&(m=l)}}m===D&&(this.trySetChainParentFromTwin_(i,h),m=this.getChainParent(i)),s(m!==D),n===Ls.enumInputModeBuildGraph?this.propagateParentageBuildGraph_(e,t,r,o):n===Ls.enumInputModeSimplifyWinding?this.propagateParentageWinding_(e,t,r,o,a,i,h):n===Ls.enumInputModeSimplifyAlternate&&this.propagateParentageAlternate_(e,t,r,o,a,i,h)}propagateParentageBuildGraph_(e,t,s,n){let r,i=t;n===D?(i=e.getNext(i),r=this.getHalfEdgeChain(s)):r=this.getHalfEdgeChain(n);let o=null,a=this.getChainParentage(r);for(this.m_bBuildGeometryParentageSets&&(o=this.getChainBitSet(r));-1!==i;i=e.getNext(i)){const t=e.getElement(i),s=this.getHalfEdgeTwin(t);r=this.getHalfEdgeChain(t);const n=this.getHalfEdgeChain(s);if(this.m_bBuildGeometryParentageSets){let e=this.getChainBitSet(n);e=new Bs({copy:e}),e.assignOr(o),this.setChainBitSet_(n,e);let s=this.getChainBitSet(r);const i=this.getLeftEdgeBitSet_(t),a=new Bs({copy:o});if(a.assignSubtract(i),a.isZero())break;s=new Bs({copy:s}),s.assignOr(a),this.setChainBitSet_(r,s),o=s}const h=this.getChainParentage(n),m=h|a;m!==h&&this.setChainParentage_(n,m);let l=this.getChainParentage(r);const g=a&~this.getHalfEdgeUserIndex(t,this.m_tmpHalfEdgeParentageIndexLeft);if(g&&(l|=g,this.setChainParentage_(r,l)),0===g)break;a=l}}propagateParentageWinding_(e,t,n,r,i,o,a){if(o===a)return;let h=this.getHalfEdgeUserIndex(n,this.m_tmpHalfEdgeWindingNumberIndex);h+=this.getHalfEdgeUserIndex(i,this.m_tmpHalfEdgeWindingNumberIndex);let m=0;const l=[],g=[];g.push(0);for(let u=e.getFirst();u!==t;u=e.getNext(u)){const t=e.getElement(u),n=this.getHalfEdgeTwin(t),r=this.getHalfEdgeChain(t),i=this.getHalfEdgeChain(n);if(r!==i){let e=this.getHalfEdgeUserIndex(t,this.m_tmpHalfEdgeWindingNumberIndex);e+=this.getHalfEdgeUserIndex(n,this.m_tmpHalfEdgeWindingNumberIndex),m+=e;let o=!1;0!==l.length&&l.at(-1)===i&&(g.pop(),l.pop(),o=!0),s(this.getChainParent(i)!==D),o&&this.getChainParent(i)===r||(g.push(m),l.push(r))}}if(m+=h,0!==l.length&&l.at(-1)===a&&(g.pop(),l.pop()),0!==m){if(0===g.at(-1)){const e=this.m_simplifiedGeometry,t=this.getGeometryID(e);this.setChainParentage_(o,t)}}else if(0!==g.at(-1)){const e=this.m_simplifiedGeometry,t=this.getGeometryID(e);this.setChainParentage_(o,t)}}propagateParentageAlternate_(e,t,s,n,r,i,o){const a=this.m_simplifiedGeometry,h=this.getGeometryID(a);if(n===D){this.setChainParentage_(o,this.m_universeGeomID);1&this.getHalfEdgeUserIndex(s,this.m_tmpHalfEdgeOddEvenNumberIndex)?this.setChainParentage_(i,h):this.setChainParentage_(i,this.m_universeGeomID)}else{const e=this.getChainParentage(o);if(0===e){const e=this.getHalfEdgeChain(n),t=this.getChainParentage(e);this.setChainParentage_(o,t);1&this.getHalfEdgeUserIndex(s,this.m_tmpHalfEdgeOddEvenNumberIndex)?this.setChainParentage_(i,t===h?this.m_universeGeomID:h):this.setChainParentage_(i,t)}else{1&this.getHalfEdgeUserIndex(s,this.m_tmpHalfEdgeOddEvenNumberIndex)?this.setChainParentage_(i,e===h?this.m_universeGeomID:h):this.setChainParentage_(i,e)}}}tryOptimizedInsertion_(e,t,s,n,r){let i=r,o=-1,a=D,h=0;do{if(2===h)return!1;const e=this.getHalfEdgeUserIndex(i,t);if(-1!==e){if(-1!==o)return!1;o=e}else{if(a!==D)return!1;a=i}h++,i=this.getHalfEdgeNext(this.getHalfEdgeTwin(i))}while(r!==i);return a!==D&&-1!==o&&(this.setHalfEdgeUserIndex(e.getElement(o),t,be.impossibleIndex2()),e.setElement(o,a),s.push(o),!0)}trySetChainParentFromTwin_(e,t){const s=this.getChainArea(e);if(0===s)return!1;const n=this.getChainArea(t);if(s>0&&n<0||s<0&&n>0)return this.setChainParent_(e,t),!0;{const s=this.getChainParent(t);if(s!==D)return this.setChainParent_(e,s),!0}return!1}createHalfEdges_(e,t){this.m_halfEdgeIndex=this.m_shape.createUserIndex();for(let s=0,n=t.size();s<n;s++){const n=t.read(s),r=this.m_shape.getUserIndex(n,this.m_clusterIndex),i=this.m_shape.getPathFromVertex(n),a=this.m_shape.getGeometryFromPath(i),h=this.m_shape.getGeometryType(a);if(c(h)){const t=this.m_shape.getNextVertex(n);if(t===D)continue;const s=this.m_shape.getUserIndex(t,this.m_clusterIndex);if(r===s)continue;const i=this.newHalfEdgePair_(),m=this.getHalfEdgeTwin(i),l=this.m_clusterVertices.newElement();this.m_clusterVertices.setField(l,0,n),this.m_clusterVertices.setField(l,1,-1),this.setHalfEdgeVertexIterator_(i,l),this.m_shape.setUserIndex(n,this.m_halfEdgeIndex,i),this.setHalfEdgeOrigin_(i,r);const g=this.getClusterHalfEdge(r);if(g===D)this.setClusterHalfEdge_(r,i),this.setHalfEdgePrev_(i,m),this.setHalfEdgeNext_(m,i);else{const e=this.getHalfEdgePrev(g);this.setHalfEdgePrev_(g,m),this.setHalfEdgeNext_(m,g),this.setHalfEdgeNext_(e,i),this.setHalfEdgePrev_(i,e)}this.setHalfEdgeOrigin_(m,s);const u=this.getClusterHalfEdge(s);if(u===D)this.setClusterHalfEdge_(s,m),this.setHalfEdgeNext_(i,m),this.setHalfEdgePrev_(m,i);else{const e=this.getHalfEdgePrev(u);this.setHalfEdgePrev_(u,i),this.setHalfEdgeNext_(i,u),this.setHalfEdgeNext_(e,m),this.setHalfEdgePrev_(m,e)}const c=this.getGeometryID(a);if(e===Ls.enumInputModeBuildGraph){const e=h===o.enumPolygon?c:0;if(this.setHalfEdgeUserIndex(m,this.m_tmpHalfEdgeParentageIndex,0),this.setHalfEdgeUserIndex(i,this.m_tmpHalfEdgeParentageIndex,e),this.setHalfEdgeUserIndex(m,this.m_tmpHalfEdgeParentageIndexLeft,e),this.setHalfEdgeUserIndex(i,this.m_tmpHalfEdgeParentageIndexLeft,0),this.m_bBuildGeometryParentageSets){const e=new Bs,t=this.m_shape.getGeometryUserIndex(a,this.m_geometryIDIndex);e.setBit(t),this.setEdgeBitSet_(i,e),this.setEdgeBitSet_(m,null),this.setLeftEdgeBitSet_(m,e),this.setLeftEdgeBitSet_(i,null)}}else if(e===Ls.enumInputModeSimplifyWinding){const e=this.m_shape.getXY(n),s=this.m_shape.getXY(t);let r=0,o=0;e.compare(s)<0?r=1:o=-1,this.setHalfEdgeUserIndex(i,this.m_tmpHalfEdgeWindingNumberIndex,r),this.setHalfEdgeUserIndex(m,this.m_tmpHalfEdgeWindingNumberIndex,o)}else e===Ls.enumInputModeSimplifyAlternate&&(this.setHalfEdgeUserIndex(i,this.m_tmpHalfEdgeOddEvenNumberIndex,1),this.setHalfEdgeUserIndex(m,this.m_tmpHalfEdgeOddEvenNumberIndex,1));const _=h===o.enumPolygon?Qs.c_EdgeBitMask:0;this.setHalfEdgeParentage_(i,c|_),this.setHalfEdgeParentage_(m,c|_)}}if(this.m_shape.hasCurves()){this.m_segmentIndexHe=this.createUserIndexForHalfEdges();for(let e=0,s=t.size();e<s;e++){const s=t.read(e);if(this.m_shape.getSegment(s)){const e=this.m_shape.getUserIndex(s,this.m_halfEdgeIndex);e!==D&&(this.setHalfEdgeUserIndex(e,this.m_segmentIndexHe,this.m_shape.getVertexIndex(s)),this.setHalfEdgeUserIndex(this.getHalfEdgeTwin(e),this.m_segmentIndexHe,-2))}}}}mergeVertexListsOfEdges_(e,t){{const s=this.getHalfEdgeVertexIterator(t);if(s!==D){const n=this.getHalfEdgeVertexIterator(e);this.m_clusterVertices.setField(s,1,n),this.setHalfEdgeVertexIterator_(e,s),this.setHalfEdgeVertexIterator_(t,D)}}const s=this.getHalfEdgeTwin(e),n=this.getHalfEdgeTwin(t);{const e=this.getHalfEdgeVertexIterator(n);if(e!==D){const t=this.getHalfEdgeVertexIterator(s);this.m_clusterVertices.setField(e,1,t),this.setHalfEdgeVertexIterator_(s,e),this.setHalfEdgeVertexIterator_(n,D)}}if(-1!==this.m_segmentIndexHe){let r=this.getHalfEdgeUserIndex(e,this.m_segmentIndexHe);if(-1!==r){if(-2===r){const s=this.getHalfEdgeUserIndex(t,this.m_segmentIndexHe);this.setHalfEdgeUserIndex(e,this.m_segmentIndexHe,s)}if(r=this.getHalfEdgeUserIndex(s,this.m_segmentIndexHe),-2===r){const e=this.getHalfEdgeUserIndex(n,this.m_segmentIndexHe);this.setHalfEdgeUserIndex(s,this.m_segmentIndexHe,e)}}}}sortHalfEdgesByAngle_(e){const t=[];for(let s=this.getFirstCluster();s!==D;s=this.getNextCluster(s)){t.length=0;const n=this.getClusterHalfEdge(s);if(n!==D){let r=n;do{t.push(r),r=this.getHalfEdgeNext(this.getHalfEdgeTwin(r))}while(r!==n);if(t.length>1){let r=!0;t.length>2?(t.sort(((e,t)=>this.compareEdgeAngles_(e,t))),t.push(t[0])):this.compareEdgeAnglesForPair_(t[0],t[1])>0?t[1]=gt(t[0],t[0]=t[1]):r=!1;let i=t[0],o=i,a=this.getHalfEdgeTo(o),h=this.getHalfEdgeTwin(o),m=D;for(let s=1,n=t.length;s<n;s++){const n=t[s],r=this.getHalfEdgeTwin(n),l=this.getHalfEdgeOrigin(r);if(l!==a||n===o)this.updateVertexToHalfEdgeConnection_(m,!1),m=D,o=n,a=l,h=r;else{if(e===Ls.enumInputModeBuildGraph){const e=this.getHalfEdgeParentageMask_(o)|this.getHalfEdgeParentageMask_(n);if(this.setHalfEdgeParentage_(o,e),this.setHalfEdgeParentage_(h,e),this.setHalfEdgeUserIndex(o,this.m_tmpHalfEdgeParentageIndex,this.getHalfEdgeUserIndex(o,this.m_tmpHalfEdgeParentageIndex)|this.getHalfEdgeUserIndex(n,this.m_tmpHalfEdgeParentageIndex)),this.setHalfEdgeUserIndex(h,this.m_tmpHalfEdgeParentageIndex,this.getHalfEdgeUserIndex(h,this.m_tmpHalfEdgeParentageIndex)|this.getHalfEdgeUserIndex(r,this.m_tmpHalfEdgeParentageIndex)),this.setHalfEdgeUserIndex(o,this.m_tmpHalfEdgeParentageIndexLeft,this.getHalfEdgeUserIndex(o,this.m_tmpHalfEdgeParentageIndexLeft)|this.getHalfEdgeUserIndex(n,this.m_tmpHalfEdgeParentageIndexLeft)),this.setHalfEdgeUserIndex(h,this.m_tmpHalfEdgeParentageIndexLeft,this.getHalfEdgeUserIndex(h,this.m_tmpHalfEdgeParentageIndexLeft)|this.getHalfEdgeUserIndex(r,this.m_tmpHalfEdgeParentageIndexLeft)),this.m_bBuildGeometryParentageSets){let e,t,s;e=this.getEdgeBitSet_(o),t=this.getEdgeBitSet_(n),s=new Bs({copy:e}),s.assignOr(t),this.setEdgeBitSet_(o,s),e=this.getEdgeBitSet_(h),t=this.getEdgeBitSet_(r),s=new Bs({copy:e}),s.assignOr(t),this.setEdgeBitSet_(h,s),e=this.getLeftEdgeBitSet_(o),t=this.getLeftEdgeBitSet_(n),s=new Bs({copy:e}),s.assignOr(t),this.setLeftEdgeBitSet_(o,s),e=this.getLeftEdgeBitSet_(h),t=this.getLeftEdgeBitSet_(r),s=new Bs({copy:e}),s.assignOr(t),this.setLeftEdgeBitSet_(h,s)}}else if(-1!==this.m_tmpHalfEdgeWindingNumberIndex){const e=this.getHalfEdgeUserIndex(o,this.m_tmpHalfEdgeWindingNumberIndex)+this.getHalfEdgeUserIndex(n,this.m_tmpHalfEdgeWindingNumberIndex),t=this.getHalfEdgeUserIndex(h,this.m_tmpHalfEdgeWindingNumberIndex)+this.getHalfEdgeUserIndex(r,this.m_tmpHalfEdgeWindingNumberIndex);this.setHalfEdgeUserIndex(o,this.m_tmpHalfEdgeWindingNumberIndex,e),this.setHalfEdgeUserIndex(h,this.m_tmpHalfEdgeWindingNumberIndex,t)}else if(-1!==this.m_tmpHalfEdgeOddEvenNumberIndex){const e=this.getHalfEdgeUserIndex(o,this.m_tmpHalfEdgeOddEvenNumberIndex)+this.getHalfEdgeUserIndex(n,this.m_tmpHalfEdgeOddEvenNumberIndex),t=this.getHalfEdgeUserIndex(h,this.m_tmpHalfEdgeOddEvenNumberIndex)+this.getHalfEdgeUserIndex(r,this.m_tmpHalfEdgeOddEvenNumberIndex);this.setHalfEdgeUserIndex(o,this.m_tmpHalfEdgeOddEvenNumberIndex,e),this.setHalfEdgeUserIndex(h,this.m_tmpHalfEdgeOddEvenNumberIndex,t)}this.mergeVertexListsOfEdges_(o,n),this.deleteEdgeImpl_(n),m=o,t[s]=D,n===i&&(t[0]=D,i=D)}}if(this.updateVertexToHalfEdgeConnection_(m,!1),m=D,!r){i=D;for(let e=0,s=t.length;e<s;e++){const s=t[e];if(s!==D){i=s;break}}n!==i&&this.setClusterHalfEdge_(s,i);continue}i=D;for(let e=0,s=t.length;e<s;e++){const s=t[e];if(s===D)continue;if(i===D){i=s,o=i,a=this.getHalfEdgeTo(o),h=this.getHalfEdgeTwin(o);continue}if(s===o)continue;const n=this.getHalfEdgeTwin(s),r=this.getHalfEdgeOrigin(n);this.setHalfEdgeNext_(h,s),this.setHalfEdgePrev_(s,h),o=s,a=r,h=n}this.setClusterHalfEdge_(s,i)}}}}sortHalfEdgesByAngle3D_(e){s(0)}buildChains_(e){this.m_universeChain=this.newChain_(),this.setChainHalfEdge_(this.m_universeChain,D);let t=this.m_universeChain;const s=this.createUserIndexForHalfEdges();for(let n=this.getFirstCluster();n!==D;n=this.getNextCluster(n)){const e=this.getClusterHalfEdge(n);if(e!==D){let n=e;do{if(1!==this.getHalfEdgeUserIndex(n,s)){const e=this.newChain_();this.setChainHalfEdge_(e,n),this.setChainPrev_(e,t),this.setChainNext_(t,e);let r=null;this.m_bBuildGeometryParentageSets&&(r=new Bs),t=e;let i=0,o=n;do{-1!==this.m_tmpHalfEdgeParentageIndex&&(i|=this.getHalfEdgeUserIndex(o,this.m_tmpHalfEdgeParentageIndex)),this.m_bBuildGeometryParentageSets&&r.assignOr(this.getEdgeBitSet_(o)),this.setHalfEdgeChain_(o,e),this.setHalfEdgeUserIndex(o,s,1),o=this.getHalfEdgeNext(o)}while(o!==n);this.m_bBuildGeometryParentageSets&&this.setChainBitSet_(e,r),this.setChainParentage_(e,i)}n=this.getHalfEdgeNext(this.getHalfEdgeTwin(n))}while(n!==e)}}this.m_chainAreas=new ve(this.m_chainData.size(),Number.NaN),this.m_chainPerimeters=new ve(this.m_chainData.size(),Number.NaN),this.setChainArea_(this.m_universeChain,Number.POSITIVE_INFINITY),this.setChainPerimeter_(this.m_universeChain,Number.POSITIVE_INFINITY),this.deleteUserIndexForHalfEdges(s)}simplify_(e){s(0)}simplifyAlternate_(){s(0)}simplifyWinding_(){s(0)}setEditShapeImpl_(e,t,s,n,r){this.removeShape(),this.m_bBuildChains=r,this.m_shape=e,this.m_geometryIDIndex=this.m_shape.createGeometryUserIndex();let o=this.m_shape.getTotalPointCount();if(s){o=0;for(let e=0,t=s.length;e<t;e++)o+=this.m_shape.getPointCount(s[e])}const a=new we(0);let h=0,m=0;{let e=null!=s?s[0]:this.m_shape.getFirstGeometry(),t=1;for(;e!==D;){this.m_shape.setGeometryUserIndex(e,this.m_geometryIDIndex,m++);for(let t=this.m_shape.getFirstPath(e);t!==D;t=this.m_shape.getNextPath(t)){let e=this.m_shape.getFirstVertex(t);for(let s=0,n=this.m_shape.getPathSize(t);s<n;s++)a.add(e),e=this.m_shape.getNextVertex(e)}i(this.m_shape.getGeometryType(e))||(h+=this.m_shape.getPathCount(e)),null!=s?(e=t<s.length?s[t]:D,t++):e=this.m_shape.getNextGeometry(e)}}this.m_universeGeomID=1<<Math.min(m,31),this.m_pointCount=a.size(),this.m_shape.sortVerticesSimpleByY(a,0,this.m_pointCount),this.m_clusterVertices.setCapacity(this.m_pointCount),this.progress_(n,!0),this.m_clusterData.setCapacity(this.m_pointCount+10),this.m_halfEdgeData.setCapacity(2*this.m_pointCount+32),this.m_chainData.setCapacity(Math.max(32,h)),this.m_clusterIndex=this.m_shape.createUserIndex();const l=We.getNAN();let g=0;const u=We.getNAN();for(let i=0;i<=this.m_pointCount;i++){if(i<this.m_pointCount){const e=a.read(i);this.m_shape.queryXY(e,u)}else u.setNAN();if(!l.isEqualPoint2D(u)){if(g<i){const e=this.newCluster_();let t=D,s=-1;for(let n=g;n<i;n++){s=a.read(n),this.m_shape.setUserIndex(s,this.m_clusterIndex,e);const r=this.m_clusterVertices.newElement();this.m_clusterVertices.setField(r,0,s),this.m_clusterVertices.setField(r,1,t),t=r;const i=this.m_shape.getPathFromVertex(s),o=this.m_shape.getGeometryFromPath(i),h=this.getGeometryID(o);this.setClusterParentage_(e,this.getClusterParentage(e)|h)}this.setClusterVertexIterator_(e,t),this.setClusterVertexIndex_(e,this.m_shape.getVertexIndex(s)),this.m_lastCluster!==D&&this.setNextCluster_(this.m_lastCluster,e),this.setPrevCluster_(e,this.m_lastCluster),this.m_lastCluster=e,this.m_firstCluster===D&&(this.m_firstCluster=e)}g=i,l.setCoordsPoint2D(u)}}if(this.m_shape.hasSegmentParentage()){-1===this.m_clusterBreakNodeIndex&&(this.m_clusterBreakNodeIndex=this.createUserIndexForClusters());for(let e=0;e<this.m_pointCount;e++){const t=a.read(e);if(this.m_shape.getSegmentParentageBreakVertex(t)){const e=this.getClusterFromVertex(t);this.setBreakNode(e,!0)}}}this.progress_(n,!0);{let e=null!=s?s[0]:this.m_shape.getFirstGeometry(),t=1;for(;e!==D;){for(let t=this.m_shape.getFirstPath(e);t!==D;t=this.m_shape.getNextPath(t)){if(this.m_shape.isStrongPathStart(t)){const e=this.m_shape.getFirstVertex(t),s=this.getClusterFromVertex(e);this.setStrongPathNode(s,!0)}if(this.m_shape.isStrongPathEnd(t)){const e=this.m_shape.isClosedPath(t)?this.m_shape.getFirstVertex(t):this.m_shape.getLastVertex(t),s=this.getClusterFromVertex(e);this.setStrongPathNode(s,!0)}}null!=s?(e=t<s.length?s[t]:D,t++):e=this.m_shape.getNextGeometry(e)}}if(t===Ls.enumInputModeBuildGraph&&(this.m_tmpHalfEdgeParentageIndex=this.createUserIndexForHalfEdges(),this.m_tmpHalfEdgeParentageIndexLeft=this.createUserIndexForHalfEdges()),t===Ls.enumInputModeSimplifyWinding&&(this.m_tmpHalfEdgeWindingNumberIndex=this.createUserIndexForHalfEdges()),t===Ls.enumInputModeSimplifyAlternate&&(this.m_tmpHalfEdgeOddEvenNumberIndex=this.createUserIndexForHalfEdges()),this.createHalfEdges_(t,a),this.dbgNavigate_(),this.sortHalfEdgesByAngle_(t),!Number.isNaN(this.m_checkDirtyPlanesweepTolerance)&&!this.checkStructureAfterDirtySweep_())return this.m_bDirtyCheckFailed=!0,void this.cleanSetEditShapeImpl_();this.buildChains_(t),-1!==this.m_tmpHalfEdgeParentageIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeParentageIndex),this.m_tmpHalfEdgeParentageIndex=-1),this.m_bBuildChains&&this.planeSweepParentage_(t,n),-1!==this.m_tmpHalfEdgeParentageIndexLeft&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeParentageIndexLeft),this.m_tmpHalfEdgeParentageIndexLeft=-1),this.dbgChkChainParents_(),this.dbgDumpChains_(),this.mergeSegmentParentage_(),this.dbgNavigate_(),this.dbgDumpChains_(),this.cleanSetEditShapeImpl_()}setEditShapeImpl3D_(e,t,n,r,i){s(0)}cleanSetEditShapeImpl_(){-1!==this.m_tmpHalfEdgeParentageIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeParentageIndex),this.m_tmpHalfEdgeParentageIndex=-1),-1!==this.m_tmpHalfEdgeParentageIndexLeft&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeParentageIndexLeft),this.m_tmpHalfEdgeParentageIndexLeft=-1),-1!==this.m_tmpHalfEdgeWindingNumberIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeWindingNumberIndex),this.m_tmpHalfEdgeWindingNumberIndex=-1),-1!==this.m_tmpHalfEdgeOddEvenNumberIndex&&(this.deleteUserIndexForHalfEdges(this.m_tmpHalfEdgeOddEvenNumberIndex),this.m_tmpHalfEdgeOddEvenNumberIndex=-1)}cleanSetEditShapeImpl3D_(){s(0)}dbgNavigate_(){}dbgChkChainParents_(){}deleteEdgeImpl_(e){const t=this.getHalfEdgeNext(e),s=this.getHalfEdgePrev(e),n=this.getHalfEdgeTwin(e),r=this.getHalfEdgeNext(n),i=this.getHalfEdgePrev(n);t!==n&&(this.setHalfEdgeNext_(i,t),this.setHalfEdgePrev_(t,i)),s!==n&&(this.setHalfEdgeNext_(s,r),this.setHalfEdgePrev_(r,s));const o=this.getHalfEdgeOrigin(e);this.getClusterHalfEdge(o)===e&&(r!==e?this.setClusterHalfEdge_(o,r):this.setClusterHalfEdge_(o,D));const a=this.getHalfEdgeOrigin(n);this.getClusterHalfEdge(a)===n&&(t!==n?this.setClusterHalfEdge_(a,t):this.setClusterHalfEdge_(a,D)),this.m_halfEdgeData.deleteElement(e),this.m_halfEdgeData.deleteElement(n)}getLeftSkipPolylines_(e,t){let s=t;for(;;){if(s=e.getPrev(s),-1===s)return D;{const t=e.getElement(s);if(this.getHalfEdgeChain(t)!==this.getHalfEdgeChain(this.getHalfEdgeTwin(t)))return t}}}checkStructureAfterDirtySweep_(){const e=at(this.m_checkDirtyPlanesweepTolerance),t=new We,s=new We,n=new We,r=new We,i=new We;for(let o=this.getFirstCluster();o!==D;o=this.getNextCluster(o)){const a=this.getClusterHalfEdge(o);if(a!==D){let o=a;this.getHalfEdgeFromXY(o,t),this.getHalfEdgeToXY(o,s),n.setSub(s,t);let h=n.sqrLength();do{const a=o;if(o=this.getHalfEdgeNext(this.getHalfEdgeTwin(o)),o!==a){this.getHalfEdgeToXY(o,r),i.setSub(r,t);const a=i.sqrLength(),m=i.crossProduct(n),l=m*m/(a*h);if(Math.min(a,h)*l<=e){if(i.dotProduct(n)>=0)return!1}n.assign(i),h=a,s.assign(r)}}while(o!==a)}}return!0}extractPolygonPathFromChain_(e,t,s,n,r){const i=this.m_shape.hasSegmentParentage(),o=this.getChainHalfEdge(s);let a=o,h=D;const m=new ae;do{const o=this.getHalfEdgeTwin(a);if(this.getHalfEdgeChain(o)!==s){let s=D;const o=this.getHalfEdgeOrigin(a);if(n===D){const e=this.getClusterVertexIterator(o);s=this.getVertexFromVertexIterator(e)}else for(let e=this.getClusterVertexIterator(o);e!==D;e=this.incrementVertexIterator(e)){const t=this.getVertexFromVertexIterator(e);s===D&&(s=t);const r=this.m_shape.getPathFromVertex(t);if(this.m_shape.getGeometryFromPath(r)===n){s=t;break}}let l;if(h===D&&(h=e.insertPath(t,D),e.setClosedPath(h,!0)),this.m_shape===e?l=e.addVertex(h,s):(this.m_shape.queryPoint(s,m),l=e.addPoint(h,m)),this.isHalfEdgeCurve(a)&&(this.querySegmentXY(a,r),e.setSegmentToIndex(e.getVertexIndex(l),r.get().clone())),i){const t=this.getSegmentParentage(a);e.setSegmentParentageAndBreak(l,t,this.isBreakNode(o))}}a=this.getHalfEdgeNext(a)}while(a!==o)}mergeSegmentParentage_(){if(!this.m_shape.hasSegmentParentage())return;s(-1!==this.m_clusterBreakNodeIndex),s(-1===this.m_segmentParentageIndex);for(let s=this.getFirstCluster();s!==D;s=this.getNextCluster(s)){let e=0;const t=this.getClusterHalfEdge(s);if(t!==D){let s=t;do{e++,s=this.getHalfEdgeNext(this.getHalfEdgeTwin(s))}while(s!==t&&e<3)}2!==e&&this.setBreakNode(s,!0)}let e=[],t=[];this.m_segmentParentageIndex=this.createUserIndexForHalfEdges();const n=this.createUserIndexForHalfEdges();for(let s=this.getFirstCluster();s!==D;s=this.getNextCluster(s)){const r=this.getClusterHalfEdge(s);if(r!==D){let s=!1,i=r;do{let r=i;for(;-1===this.getHalfEdgeUserIndex(r,n);){const i=this.getHalfEdgeNext(r),o=this.getHalfEdgeTwin(r);Zs(this,r,t);const a=t.at(-1).parentage;if(!s){const t=this.getHalfEdgeOrigin(r);if(!this.isBreakNode(t)){const t=this.getHalfEdgePrev(r);r!==t&&(Zs(this,t,e),s=!0)}}if(s&&!js(t,e)){const e=this.getHalfEdgeOrigin(r);this.setBreakNode(e,!0)}e=gt(t,t=e),s=!0;const h=this.getHalfEdgeOrigin(i);this.isBreakNode(h)&&(s=!1),this.setHalfEdgeUserIndex(r,this.m_segmentParentageIndex,a),this.setHalfEdgeUserIndex(o,this.m_segmentParentageIndex,a),this.setHalfEdgeUserIndex(r,n,1),this.setHalfEdgeUserIndex(o,n,1),r=i}i=this.getHalfEdgeNext(this.getHalfEdgeTwin(i))}while(i!==r)}}this.deleteUserIndexForHalfEdges(n)}registerNewBitSet(e){if(null===this.m_uniqueBitSets&&(this.m_uniqueBitSets=Ks(),this.m_uniqueBitSets.add(this.getEmptySet())),null===e)return this.getEmptySet();return this.m_uniqueBitSets.has(e)?this.m_uniqueBitSets.get(e):(this.m_uniqueBitSets.add(e),e)}getLeftEdgeBitSet_(e){const t=this.getHalfEdgeUserIndex(e,this.m_edgeBitSetIndexLeft);return s(t>=0),s(this.m_edgeBitSets.at(t)),this.m_edgeBitSets.at(t)}getEdgeBitSet_(e){const t=this.getHalfEdgeUserIndex(e,this.m_edgeBitSetIndex);return s(t>=0),this.m_edgeBitSets.at(t)}setEdgeBitSet_(e,t){s(this.m_bBuildGeometryParentageSets),t=this.registerNewBitSet(t),-1===this.m_edgeBitSetIndex&&(this.m_edgeBitSetIndex=this.createUserIndexForHalfEdges());const n=this.getHalfEdgeUserIndex(e,this.m_edgeBitSetIndex);-1!==n?this.m_edgeBitSets[n]=t:(this.setHalfEdgeUserIndex(e,this.m_edgeBitSetIndex,this.m_edgeBitSets.length),this.m_edgeBitSets.push(t))}setLeftEdgeBitSet_(e,t){s(this.m_bBuildGeometryParentageSets),t=this.registerNewBitSet(t),-1===this.m_edgeBitSetIndexLeft&&(this.m_edgeBitSetIndexLeft=this.createUserIndexForHalfEdges());const n=this.getHalfEdgeUserIndex(e,this.m_edgeBitSetIndexLeft);-1!==n?this.m_edgeBitSets[n]=t:(this.setHalfEdgeUserIndex(e,this.m_edgeBitSetIndexLeft,this.m_edgeBitSets.length),this.m_edgeBitSets.push(t))}setChainBitSet_(e,t){s(this.m_bBuildGeometryParentageSets),t=this.registerNewBitSet(t),-1===this.m_chainBitSetIndex&&(this.m_chainBitSetIndex=this.createUserIndexForChains());const n=this.getChainUserIndex(e,this.m_chainBitSetIndex);-1!==n?this.m_chainBitSets[n]=t:(this.setChainUserIndex(e,this.m_chainBitSetIndex,this.m_chainBitSets.length),this.m_chainBitSets.push(t))}getEmptySet(){return this.m_emptyBitSet||(this.m_emptyBitSet=new Bs),this.m_emptyBitSet}deleteEdgeBitSets_(){-1!==this.m_edgeBitSetIndex&&(this.deleteUserIndexForHalfEdges(this.m_edgeBitSetIndex),this.m_edgeBitSetIndex=-1),-1!==this.m_edgeBitSetIndexLeft&&(this.deleteUserIndexForHalfEdges(this.m_edgeBitSetIndexLeft),this.m_edgeBitSetIndexLeft=-1),this.m_edgeBitSets.length=0,this.m_uniqueBitSets=null}deleteChainBitSets_(){-1!==this.m_chainBitSetIndex&&(this.deleteUserIndexForChains(this.m_chainBitSetIndex),this.m_chainBitSetIndex=-1,this.m_chainBitSets.length=0)}dbgPrintEdge_(e){}dbgVerifyEdgeSegment(e){}}Qs.c_EdgeParentageMask=~(1<<31),Qs.c_EdgeBitMask=1<<31;class Js{freeNode_(e){this.m_listNodes.deleteElement(e)}newNode_(){return this.m_listNodes.newElement()}freeList_(e){this.m_lists.deleteElement(e)}newList_(){return this.m_lists.newElement()}Init_(e){s(0)}constructor(e){this.m_listNodes=new be(2),this.m_listOfLists=Js.st_nullNode(),this.m_bAllowNavigationBetweenLists=!0,void 0===e&&(e=!0),this.m_bAllowNavigationBetweenLists=e,this.m_lists=new be(this.m_bAllowNavigationBetweenLists?4:2)}createList(){const e=this.newList_();return this.m_bAllowNavigationBetweenLists&&(this.m_lists.setField(e,3,this.m_listOfLists),this.m_listOfLists!==Js.st_nullNode()&&this.m_lists.setField(this.m_listOfLists,2,e),this.m_listOfLists=e),e}deleteList(e){let t=this.getFirst(e);for(;t!==Js.st_nullNode();){const e=t;t=this.getNext(t),this.freeNode_(e)}if(this.m_bAllowNavigationBetweenLists){const t=this.m_lists.getField(e,2),s=this.m_lists.getField(e,3);t!==Js.st_nullNode()?this.m_lists.setField(t,3,s):this.m_listOfLists=s,s!==Js.st_nullNode()&&this.m_lists.setField(s,2,t)}this.freeList_(e)}reserveLists(e){this.m_lists.setCapacity(e)}addElement(e,t){this.m_lists.getField(e,0);const s=this.m_lists.getField(e,1),n=this.newNode_();return s!==Js.st_nullNode()?(this.m_listNodes.setField(s,1,n),this.m_lists.setField(e,1,n)):(this.m_lists.setField(e,0,n),this.m_lists.setField(e,1,n)),this.m_listNodes.setField(n,0,t),n}reserveNodes(e){this.m_listNodes.setCapacity(e)}deleteElementDirect(e,t,s){t!==Js.st_nullNode()?(this.m_listNodes.setField(t,1,this.m_listNodes.getField(s,1)),this.m_lists.getField(e,1)===s&&this.m_lists.setField(e,1,t)):(this.m_lists.setField(e,0,this.m_listNodes.getField(s,1)),this.m_lists.getField(e,1)===s&&this.m_lists.setField(e,1,Js.st_nullNode())),this.freeNode_(s)}deleteElementSearch(e,t){let s=-1,n=this.getFirst(e);for(;n!==t;)s=n,n=this.getNext(n);this.deleteElementDirect(e,s,t)}concatenateLists(e,t){const s=this.m_lists.getField(e,1),n=this.m_lists.getField(t,0);if(n!==Js.st_nullNode()&&(s!==Js.st_nullNode()?(this.m_listNodes.setField(s,1,n),this.m_lists.setField(e,1,this.m_lists.getField(t,1))):(this.m_lists.setField(e,0,n),this.m_lists.setField(e,1,this.m_lists.getField(t,1)))),this.m_bAllowNavigationBetweenLists){const e=this.m_lists.getField(t,2),s=this.m_lists.getField(t,3);e!==Js.st_nullNode()?this.m_lists.setField(e,3,s):this.m_listOfLists=s,s!==Js.st_nullNode()&&this.m_lists.setField(s,2,e)}return this.freeList_(t),e}getElement(e){return this.m_listNodes.getField(e,0)}getData(e){return this.getElement(e)}setElement(e,t){s(0)}getNext(e){return this.m_listNodes.getField(e,1)}getFirst(e){return this.m_lists.getField(e,0)}getFirstElement(e){const t=this.getFirst(e);return this.getElement(t)}static st_nullNode(){return-1}clear(){this.m_listNodes.deleteAll(!0),this.m_lists.deleteAll(!0),this.m_listOfLists=Js.st_nullNode()}isEmpty(e){return s(0),!1}getNodeCount(){return this.m_listNodes.size()}getListCount(){return this.m_lists.size()}getFirstList(){return this.m_listOfLists}getNextList(e){return this.m_lists.getField(e,3)}}function $s(e=-1){return{m_value:e,m_line:new V,m_segment:null,m_segmentInfo:new ie(-1),m_env:new Ke(0,0),m_dxdy:55555555,m_bHorizontal:!1,m_bCurve:!1}}const en=67;class tn extends Xe{constructor(e,t,s){super(!0),this.m_bIntersectionDetected=!1,this.m_nonSimpleResult=new $t,this.m_tempSimpleEdge1=$s(),this.m_tempSimpleEdge2=$s(),this.m_prev1=D,this.m_prev2=D,this.m_vertex1=D,this.m_vertex2=D,this.m_currentNode=-1,this.m_prevX1=Number.NaN,this.m_prevX2=Number.NaN,this.m_prevY=Number.NaN,this.m_prevX=0,this.m_sweepY=Number.NaN,this.m_sweepX=0,this.m_ptSweep=new We,this.m_simpleEdgesCache=[],this.m_simpleEdgesRecycle=[],this.m_cOutstandingConstructedEdges=0,this.m_shape=e,this.m_bShapeHasSegments=this.m_shape.hasCurves(),this.m_tolerance=t,this.m_tolerance10=10*t,this.m_bIsSimple=s;const n=Math.trunc(Math.min(3*e.getTotalPointCount()/2,en)),r=Math.min(7,n);this.m_simpleEdgesCache.length=r}tryGetCachedEdge_(e){const t=this.m_simpleEdgesCache[(e&Ht())%this.m_simpleEdgesCache.length];return t&&t.m_value===e?t:null}tryDeleteCachedEdge_(e){const t=(e&Ht())%this.m_simpleEdgesCache.length,s=this.m_simpleEdgesCache[t];s&&s.m_value===e&&(this.m_simpleEdgesRecycle.push(s),this.m_simpleEdgesCache[t]=null)}tryCreateCachedEdge_(e){const t=(e&Ht())%this.m_simpleEdgesCache.length;let s=this.m_simpleEdgesCache[t];return s?null:(0===this.m_simpleEdgesRecycle.length?(s=$s(),this.m_cOutstandingConstructedEdges++):s=this.m_simpleEdgesRecycle.pop(),s.m_value=e,this.m_simpleEdgesCache[t]=s,s)}initSimpleEdge_(e,t){this.m_bShapeHasSegments&&this.initSimpleEdgeHelper_(e,t)||e.m_bCurve||(this.m_shape.queryLineConnector(t,e.m_line,!0),e.m_segment=e.m_line,e.m_env.setCoordsNoNAN(e.m_line.getStartX(),e.m_line.getEndX()),e.m_env.vmax+=this.m_tolerance,e.m_line.orientBottomUp(),e.m_bHorizontal=e.m_line.getEndY()===e.m_line.getStartY(),e.m_bHorizontal||(e.m_dxdy=(e.m_line.getEndX()-e.m_line.getStartX())/(e.m_line.getEndY()-e.m_line.getStartY())))}initSimpleEdgeHelper_(e,t){if(e.m_segment=this.m_shape.getSegment(t),e.m_segmentInfo=this.m_shape.getOriginalSegmentInfo(t),e.m_bCurve=null!==e.m_segment,e.m_bCurve){const t=e.m_segment.clone();return t.orientBottomUp(),e.m_segment=t,e.m_env=e.m_segment.queryInterval(0,0),e.m_env.vmax+=this.m_tolerance,!0}return!1}compareTwoSegments_(e,t){const s=e.getStartXY(),n=e.getEndXY(),r=t.getStartXY(),i=t.getEndXY();if(this.m_ptSweep.setCoords(this.m_sweepX,this.m_sweepY),s.isEqualPoint2D(r)&&this.m_sweepY===s.y){this.m_ptSweep.assign(n.compare(i)<0?n:i);const s=e.intersectionOfYMonotonicWithAxisX(this.m_ptSweep.y,this.m_ptSweep.x),r=t.intersectionOfYMonotonicWithAxisX(this.m_ptSweep.y,this.m_ptSweep.x);if(Math.abs(s-r)>this.m_tolerance)return s<r?-1:1}const o=s.compare(r)<0?r:s,a=n.compare(i)<0?n:i;let h=0,m=0;for(let l=1;l<5;l++){Ft(o,a,l/5,this.m_ptSweep);const s=e.intersectionOfYMonotonicWithAxisX(this.m_ptSweep.y,this.m_ptSweep.x),n=t.intersectionOfYMonotonicWithAxisX(this.m_ptSweep.y,this.m_ptSweep.x),r=Math.abs(s-n);r>h&&(h=r,m=s<n?-1:1)}return 0===m?this.errorCracking():m}compareNonHorizontal_(e,t){if(e.m_line.getStartY()===t.m_line.getStartY()&&e.m_line.getStartX()===t.m_line.getStartX())return e.m_line.getEndY()===t.m_line.getEndY()&&e.m_line.getEndX()===t.m_line.getEndX()?this.m_bIsSimple?this.errorCoincident():0:this.compareNonHorizontalUpperEnd_(e,t);if(e.m_line.getEndY()===t.m_line.getEndY()&&e.m_line.getEndX()===t.m_line.getEndX())return this.compareNonHorizontalLowerEnd_(e,t);const s=this.compareNonHorizontalLowerEnd_(e,t),n=this.compareNonHorizontalUpperEnd_(e,t);return s<0&&n<0?-1:s>0&&n>0?1:this.errorCracking()}compareHorizontal1Case1_(e,t){if(e.getEndX()>t.getEndX()){if(t.getEndX()>t.getStartX()&&t.getEndY()-t.getStartY()<2*this.m_tolerance&&e.isIntersectingPoint(t.getEndXY(),this.m_tolerance,!0))return this.errorCracking()}else{if((t.getEndY()-t.getStartY())/(t.getEndX()-t.getStartX())*(e.getEndX()-e.getStartX())<this.m_tolerance10&&t.isIntersectingPoint(e.getEndXY(),this.m_tolerance,!0))return this.errorCracking()}return 1}compareHorizontal1Case2_(e,t){if(e.getStartX()<t.getStartX()){if(t.getEndX()>t.getStartX()&&t.getEndY()-t.getStartY()<2*this.m_tolerance&&e.isIntersectingPoint(t.getEndXY(),this.m_tolerance,!0))return this.errorCracking()}else{if((t.getEndY()-t.getStartY())/(t.getEndX()-t.getStartX())*(e.getStartX()-e.getEndX())<this.m_tolerance10&&t.isIntersectingPoint(e.getStartXY(),this.m_tolerance,!0))return this.errorCracking()}return-1}compareHorizontal1Case3_(e,t){const s=We.getNAN();s.setSub(t.getEndXY(),t.getStartXY()),s.rightPerpendicularThis(),s.normalize();const n=We.getNAN();n.setSub(e.getStartXY(),t.getStartXY());const r=We.getNAN();r.setSub(e.getEndXY(),t.getStartXY());const i=n.dotProduct(s),o=r.dotProduct(s),a=Math.abs(i),h=Math.abs(o);if(a<h){if(a<this.m_tolerance10&&t.isIntersectingPoint(e.getStartXY(),this.m_tolerance,!0))return this.errorCracking()}else if(h<this.m_tolerance10&&t.isIntersectingPoint(e.getEndXY(),this.m_tolerance,!0))return this.errorCracking();return i<0&&o<0?-1:i>0&&o>0?1:this.errorCracking()}compareHorizontal1_(e,t){return e.getStartY()===t.getStartY()&&e.getStartX()===t.getStartX()?this.compareHorizontal1Case1_(e,t):e.getEndY()===t.getEndY()&&e.getEndX()===t.getEndX()?this.compareHorizontal1Case2_(e,t):this.compareHorizontal1Case3_(e,t)}compareHorizontal2_(e,t){return e.getEndY()===t.getEndY()&&e.getEndX()===t.getEndX()&&e.getStartY()===t.getStartY()&&e.getStartX()===t.getStartX()?this.m_bIsSimple?this.errorCoincident():0:this.errorCracking()}compareNonHorizontalLowerEnd_(e,t){let s=1;if(e.m_line.getStartY()<t.m_line.getStartY()){s=-1;const n=e;e=t,t=n}const n=e.m_line,r=t.m_line,i=n.getStartX()-r.getStartX(),o=t.m_dxdy*(n.getStartY()-r.getStartY()),a=this.m_tolerance10;return i<o-a?-s:i>o+a?s:r.isIntersectingPoint(n.getStartXY(),this.m_tolerance,!0)?this.errorCracking():i<o?-s:s}compareNonHorizontalUpperEnd_(e,t){let s=1;if(t.m_line.getEndY()<e.m_line.getEndY()){s=-1;const n=e;e=t,t=n}const n=e.m_line,r=t.m_line,i=n.getEndX()-r.getStartX(),o=t.m_dxdy*(n.getEndY()-r.getStartY()),a=this.m_tolerance10;return i<o-a?-s:i>o+a?s:r.isIntersectingPoint(n.getEndXY(),this.m_tolerance,!0)?this.errorCracking():i<o?-s:s}errorCoincident(){this.m_bIntersectionDetected=!0;const e=7;return this.m_nonSimpleResult=new $t(e,this.m_vertex1,this.m_vertex2),-1}errorCracking(){if(this.m_bIntersectionDetected=!0,this.m_bIsSimple){const e=6;this.m_nonSimpleResult=new $t(e,this.m_vertex1,this.m_vertex2)}else this.m_prev1=D,this.m_prev2=D,this.m_vertex1=D,this.m_vertex2=D;return-1}compareSegments_(e,t,s,n){if(s.m_env.vmax<n.m_env.vmin)return-1;if(n.m_env.vmax<s.m_env.vmin)return 1;if(!s.m_bCurve&&!n.m_bCurve){let e=s.m_bHorizontal?1:0;return e|=n.m_bHorizontal?2:0,0===e?this.compareNonHorizontal_(s,n):1===e?this.compareHorizontal1_(s.m_line,n.m_line):2===e?-1*this.compareHorizontal1_(n.m_line,s.m_line):this.compareHorizontal2_(s.m_line,n.m_line)}if(this.m_bIntersectionDetected)return-1;const r=this.m_prevY===this.m_sweepY&&this.m_prevX===this.m_sweepX;let i,o;if(r&&e===this.m_prev1?i=this.m_prevX1:(i=Number.NaN,this.m_prev1=D),r&&t===this.m_prev2?o=this.m_prevX2:(o=Number.NaN,this.m_prev2=D),this.m_prevY=this.m_sweepY,this.m_prevX=this.m_sweepX,Number.isNaN(i)){this.m_prev1=e;const t=s.m_segment.intersectionOfYMonotonicWithAxisX(this.m_sweepY,this.m_sweepX);i=t,this.m_prevX1=t}if(Number.isNaN(o)){this.m_prev2=t;const e=n.m_segment.intersectionOfYMonotonicWithAxisX(this.m_sweepY,this.m_sweepX);o=e,this.m_prevX2=e}const a=$(!0,!0,s.m_segment,n.m_segment,this.m_tolerance,!0);return 0!==a?2===a?this.m_bIsSimple?this.errorCoincident():s.m_segmentInfo.equals(n.m_segmentInfo)?0:this.errorCracking():this.errorCracking():Math.abs(i-o)<=this.m_tolerance?this.compareTwoSegments_(s.m_segment,n.m_segment):i<o?-1:i>o?1:0}clearIntersectionDetectedFlag(){this.m_bIntersectionDetected=!1}intersectionDetected(){return this.m_bIntersectionDetected}getLastComparedNode(){return this.m_currentNode}getResult(){return this.m_nonSimpleResult}setSweepY(e,t){this.m_sweepY=e,this.m_sweepX=t,this.m_prev1=D,this.m_prev2=D,this.m_vertex1=D,this.m_vertex2=D}compare(e,t,s){if(this.m_bIntersectionDetected)return-1;const n=e.getElement(s),r=t;return this.m_currentNode=s,this.compareSegments(r,r,n,n)}compareSegments(e,t,s,n){let r=this.tryGetCachedEdge_(e);null===r?this.m_vertex1===t?r=this.m_tempSimpleEdge1:(this.m_vertex1=t,r=this.tryCreateCachedEdge_(e),null===r&&(r=this.m_tempSimpleEdge1,this.m_tempSimpleEdge1.m_value=e),this.initSimpleEdge_(r,t)):this.m_vertex1=t;let i=this.tryGetCachedEdge_(s);return null===i?this.m_vertex2===n?i=this.m_tempSimpleEdge2:(this.m_vertex2=n,i=this.tryCreateCachedEdge_(s),null===i&&(i=this.m_tempSimpleEdge2,this.m_tempSimpleEdge2.m_value=s),this.initSimpleEdge_(i,n)):this.m_vertex2=n,this.compareSegments_(t,n,r,i)}onDelete(e){this.tryDeleteCachedEdge_(e)}onSet(e){this.tryDeleteCachedEdge_(e)}onEndSearch(e){this.tryDeleteCachedEdge_(e)}onAddUniqueElementFailed(e){this.tryDeleteCachedEdge_(e)}}class sn{constructor(e,t){this.m_bIntersectionDetected=!1,this.m_pointOfInterest=We.getNAN(),this.m_line1=new V,this.m_seg1=null,this.m_env=Ke.constructEmpty(),this.m_vertex1=-1,this.m_currentNode=-1,this.m_minDist=Number.MAX_VALUE,this.m_shape=e,this.m_tolerance=t}getCurrentNode(){return this.m_currentNode}clearIntersectionDetectedFlag(){this.m_bIntersectionDetected=!1,this.m_minDist=Number.MAX_VALUE}intersectionDetected(){return this.m_bIntersectionDetected}setPoint(e){this.m_pointOfInterest.assign(e)}compare(e,t){const s=e.getElement(t);return this.compareVertex(e,t,s)}compareVertex(t,s,n){let r,i=this.m_shape.getSegment(n),o=!0;if(null==i)this.m_shape.queryLineConnector(n,this.m_line1,!0),this.m_env.setCoordsNoNAN(this.m_line1.getStartX(),this.m_line1.getEndX()),i=this.m_line1,r=this.m_line1.getStartY()===this.m_line1.getEndY();else{const t=e.constructEmpty();i.queryLooseEnvelope(t),t.queryIntervalX(this.m_env),r=0===t.height(),o=!1}if(this.m_pointOfInterest.x+this.m_tolerance<this.m_env.vmin)return-1;if(this.m_pointOfInterest.x-this.m_tolerance>this.m_env.vmax)return 1;if(r)return this.m_currentNode=s,this.m_bIntersectionDetected=!0,0;let a=0;if(o){te(this.m_line1);const e=this.m_line1.getStartXY(),t=new We;t.setSub(this.m_line1.getEndXY(),e),t.rightPerpendicularThis();const s=new We;s.setSub(this.m_pointOfInterest,e),a=t.dotProduct(s),a/=t.length()}else{a=i.intersectionOfYMonotonicWithAxisX(this.m_pointOfInterest.y,this.m_pointOfInterest.x)-this.m_pointOfInterest.x}if(a<10*-this.m_tolerance)return-1;if(a>10*this.m_tolerance)return 1;if(i.isIntersectingPoint(this.m_pointOfInterest,this.m_tolerance)){Math.abs(a)<this.m_minDist&&(this.m_currentNode=s,this.m_minDist=a),this.m_bIntersectionDetected=!0}return a<0?-1:a>0?1:0}}class nn{constructor(e,t){this.m_lists=new Js(!1),this.m_hash=t,this.m_hashBuckets=new Int32Array(e),this.m_hashBuckets.fill(nn.st_nullNode()),this.m_bitFilter=new Int32Array(10*e+31>>5)}reserveElements(e){this.m_lists.reserveLists(Math.min(this.m_hashBuckets.length,e)),this.m_lists.reserveNodes(e)}addElement(e,t){void 0===t&&(t=this.m_hash.getHash(e));const s=t%(this.m_bitFilter.length<<5);this.m_bitFilter[s>>5]|=1<<(31&s);const n=t%this.m_hashBuckets.length;let r=this.m_hashBuckets[n];r===Js.st_nullNode()&&(r=this.m_lists.createList(),this.m_hashBuckets[n]=r);return this.m_lists.addElement(r,e)}deleteElement(e,s){void 0===s&&(s=this.m_hash.getHash(e));const n=s%this.m_hashBuckets.length,r=this.m_hashBuckets[n];r===Js.st_nullNode()&&t("");let i=this.m_lists.getFirst(r),o=Js.st_nullNode();for(;i!==Js.st_nullNode();){const t=this.m_lists.getData(i),s=this.m_lists.getNext(i);t===e?(this.m_lists.deleteElementDirect(r,o,i),this.m_lists.getFirst(r)===Js.st_nullNode()&&(this.m_lists.deleteList(r),this.m_hashBuckets[n]=Js.st_nullNode())):o=i,i=s}}getFirstInBucket(e){const t=e%(this.m_bitFilter.length<<5);if(!(this.m_bitFilter[t>>5]&1<<(31&t)))return Js.st_nullNode();const s=e%this.m_hashBuckets.length,n=this.m_hashBuckets[s];return n===Js.st_nullNode()?Js.st_nullNode():this.m_lists.getFirst(n)}getNextInBucket(e){return this.m_lists.getNext(e)}findNode(e){const t=this.m_hash.getHash(e);let s=this.getFirstInBucket(t);for(;s!==Js.st_nullNode();){const t=this.m_lists.getData(s);if(this.m_hash.equal(t,e))return s;s=this.m_lists.getNext(s)}return Js.st_nullNode()}deleteNode(e){const s=this.getElement(e),n=this.m_hash.getHash(s)%this.m_hashBuckets.length,r=this.m_hashBuckets[n];r===Js.st_nullNode()&&t(""),this.m_lists.deleteElementSearch(r,e),this.m_lists.getFirst(r)===Js.st_nullNode()&&(this.m_lists.deleteList(r),this.m_hashBuckets[n]=Js.st_nullNode())}getElement(e){return this.m_lists.getData(e)}static st_nullNode(){return Js.st_nullNode()}clear(){s(0)}size(){return this.m_lists.getNodeCount()}dbgPrintBucketHistogram(){}}function rn(e,t,s,n,r){const i=new cn(r);return i.m_shape=e,i.m_sqrTolerance=t*t,i.m_cellSize=2*t,i.m_invCellSize=1/i.m_cellSize,i.m_geometry=s,i.m_bTrackChanges=n,i.m_bHasSegmentParentage=e.hasSegmentParentage(),i.clusterNonReciprocal()}function on(e,t,s,n,r){const i=e-s,o=t-n;return i*i+o*o<=r}function an(){return{pt:new We,weight:0,rank:0,bMerged:!1}}function hn(e,t,s,n,r,i){const o=an(),a=s+r;let h=!1,m=e.x;e.x!==t.x&&(n===i&&(m=(e.x*s+t.x*r)/a),h=!0);let l=e.y;return e.y!==t.y&&(n===i&&(l=(e.y*s+t.y*r)/a),h=!0),n!==i?n>i?(o.rank=n,o.weight=s,o.pt=e):(o.rank=i,o.weight=r,o.pt=t):(o.pt.setCoords(m,l),o.weight=a,o.rank=n),o.bMerged=h,o}function mn(e,t,s,n,r,i,o,a,h){const m=e.equals(t);if(n>i)return o.assignCopy(e),h[0]=n,a[0]=s,m;if(i>n)return o=t,h[0]=i,a[0]=r,m;o.assignCopy(e);const l=hn(e.getXY(),t.getXY(),s,n,r,i);return o.setXY(l.pt),a[0]=l.weight,h[0]=l.rank,m}function ln(e,t,s,n,r){const i=new cn(r);return i.m_shape=e,i.m_sqrTolerance=t*t,i.m_cellSize=2*t,i.m_invCellSize=1/i.m_cellSize,i.m_geometry=s,i.m_bTrackChanges=!1,i.needsClustering()}function gn(e,t){const s=Bt(e);return qt(s,t)}class un{constructor(e,t,s,n,r){this.m_workPt=new We,this.m_shape=e,this.m_sqrTolerance=s,this.m_invCellSize=n,this.m_origin=t.clone(),this.m_hashValues=r}getHash(e){return this.m_shape.getUserIndex(e,this.m_hashValues)}calculateHashFromVertex(e){this.m_shape.queryXY(e,this.m_workPt);const t=this.m_workPt.x-this.m_origin.x,s=Math.trunc(t*this.m_invCellSize+.5),n=this.m_workPt.y-this.m_origin.y;return gn(s,Math.trunc(n*this.m_invCellSize+.5))}equal(e,t){return s(0),!1}}class cn{constructor(e){this.m_origin=We.getNAN(),this.m_sqrTolerance=0,this.m_cellSize=0,this.m_invCellSize=0,this.m_geometry=D,this.m_bucketArray=new Array(4),this.m_bucketHash=new Array(4),this.m_dbgCandidateCheckCount=0,this.m_nsr=new $t,this.m_hashValues=-1,this.m_newClusters=-1,this.m_bTrackChanges=!1,this.m_bHasSegmentParentage=!1,this.m_shape=null,this.m_clusters=new Js,this.m_hashFunction=null,this.m_hashTable=null,this.m_progressCounter=0,this.m_progressTracker=e}progress_(){}collectClusterCandidates(e,t){const s=We.getNAN();this.m_shape.queryXY(e,s);const n=(s.x-this.m_origin.x)*this.m_invCellSize,r=(s.y-this.m_origin.y)*this.m_invCellSize,i=Math.trunc(n),o=Math.trunc(r);let a=0;for(let h=0;h<=1;h+=1)for(let e=0;e<=1;e+=1){const t=gn(i+h,o+e),s=this.m_hashTable.getFirstInBucket(t);s!==nn.st_nullNode()&&(this.m_bucketArray[a]=s,this.m_bucketHash[a]=t,a++)}for(let h=a-1;h>=1;h--){const e=this.m_bucketArray[h];for(let t=h-1;t>=0;t--)if(e===this.m_bucketArray[t]){this.m_bucketHash[t]=-1,a--,h!==a&&(this.m_bucketHash[h]=this.m_bucketHash[a],this.m_bucketArray[h]=this.m_bucketArray[a]);break}}for(let h=0;h<a;h++)this.collectNearestNeighbourCandidates(e,this.m_bucketHash[h],s,this.m_bucketArray[h],t)}collectNearestNeighbourCandidates(e,t,s,n,r){const i=We.getNAN();for(let o=n;o!==nn.st_nullNode();o=this.m_hashTable.getNextInBucket(o)){const n=this.m_hashTable.getElement(o);e===n||-1!==t&&this.m_shape.getUserIndex(n,this.m_hashValues)!==t||(this.m_shape.queryXY(n,i),on(s.x,s.y,i.x,i.y,this.m_sqrTolerance)&&r.push(o))}}mergeClusters(e,t,s){let n=this.m_shape.getUserIndex(e,this.m_newClusters);const r=this.m_shape.getUserIndex(t,this.m_newClusters);-1===n&&(n=this.m_clusters.createList(),this.m_clusters.addElement(n,e),this.m_shape.setUserIndex(e,this.m_newClusters,n)),-1===r?this.m_clusters.addElement(n,t):this.m_clusters.concatenateLists(n,r),this.m_shape.setUserIndex(t,this.m_newClusters,be.impossibleIndex2());const i=this.mergeVertices(e,t);if(s){const t=this.m_hashFunction.calculateHashFromVertex(e);this.m_shape.setUserIndex(e,this.m_hashValues,t)}return i}mergeVertices(e,t){const s=We.getNAN();this.m_shape.queryXY(e,s);const n=We.getNAN();this.m_shape.queryXY(t,n);const r=this.m_shape.getRank(e),i=this.m_shape.getRank(t),o=this.m_shape.getWeight(e),a=this.m_shape.getWeight(t);let h,m,l,g,u=!1;if(r===i?(h=r,m=o+a,l=s.x,s.x!==n.x&&(l=(s.x*o+n.x*a)/m,u=!0),g=s.y,s.y!==n.y&&(g=(s.y*o+n.y*a)/m,u=!0)):(r>i?(l=s.x,g=s.y,m=o,h=r):(l=n.x,g=n.y,m=a,h=i),u=!s.equals(n)),u&&(this.m_shape.setXYMonotonic(e,l,g),this.m_bTrackChanges&&this.m_shape.setGeometryModifiedWithVertex(e,!0),this.m_bHasSegmentParentage)){const s=this.m_shape.getSegmentParentageBreakVertex(e)||this.m_shape.getSegmentParentageBreakVertex(t);this.m_shape.setSegmentParentageBreakVertex(e,s),this.m_shape.setSegmentParentageBreakVertex(t,s)}return this.m_shape.setWeight(e,m),this.m_shape.setRank(e,h),u}needsClustering(){const e={stack:[],error:void 0,hasError:!1};try{Rt(e,Ct((()=>{this.m_hashTable=null,this.m_hashFunction=null,this.m_shape.removeUserIndex(this.m_hashValues),this.m_shape.removeUserIndex(this.m_newClusters)})),!1);const t=this.m_shape.getSelectedCount(),s=this.m_shape.getEnvelope2D(this.m_progressTracker);this.m_origin.assign(s.getLowerLeft());const n=Math.max(s.height(),s.width())/(Pt()-1);this.m_cellSize<n&&(this.m_cellSize=n,this.m_invCellSize=1/this.m_cellSize),this.m_clusters.clear(),this.m_clusters.reserveLists(this.m_shape.getSelectedCount()/3+1),this.m_clusters.reserveNodes(this.m_shape.getSelectedCount()/3+1),this.m_hashValues=this.m_shape.createUserIndex(),this.m_newClusters=this.m_shape.createUserIndex(),this.m_hashFunction=new un(this.m_shape,this.m_origin,this.m_sqrTolerance,this.m_invCellSize,this.m_hashValues),this.m_hashTable=new nn(4*t/3,this.m_hashFunction),this.m_hashTable.reserveElements(this.m_shape.getSelectedCount());let r=!1;for(let e=0;e<2;e++){const t=[],s=this.m_shape.queryVertexIteratorOnSelection(this.m_geometry);for(let n=s.next();n!==D;n=s.next()){if(this.progress_(),e>0&&this.m_shape.getUserIndex(n,this.m_newClusters)===be.impossibleIndex2())continue;let s;if(0===e?(s=this.m_hashFunction.calculateHashFromVertex(n),this.m_shape.setUserIndex(n,this.m_hashValues,s)):s=this.m_shape.getUserIndex(n,this.m_hashValues),this.collectClusterCandidates(n,t),0!==t.length){for(let e=0,s=t.length;e<s;e++){this.progress_();const s=t[e],i=this.m_hashTable.getElement(s);if(this.m_hashTable.deleteNode(s),!this.m_shape.isEqualXY(n,i))return this.m_nsr=new $t(5,this.m_shape.getVertexIndex(n),this.m_shape.getVertexIndex(i)),r=!0,r;this.mergeClusters(n,i,!1)}t.length=0}0===e&&this.m_hashTable.addElement(n,s)}}return r}catch(t){e.error=t,e.hasError=!0}finally{Yt(e)}}clusterNonReciprocal(){const e=this.m_shape.getSelectedCount(),t=this.m_shape.getEnvelope2D(this.m_progressTracker);this.m_origin=t.getLowerLeft();const s=Math.max(t.height(),t.width())/(Pt()-1);this.m_cellSize<s&&(this.m_cellSize=s,this.m_invCellSize=1/this.m_cellSize),this.m_clusters.clear(),this.m_clusters.reserveLists(Math.trunc(this.m_shape.getSelectedCount()/3+1)),this.m_clusters.reserveNodes(Math.trunc(this.m_shape.getSelectedCount()/3+1)),this.m_hashValues=this.m_shape.createUserIndex(),this.m_newClusters=this.m_shape.createUserIndex(),this.m_hashFunction=new un(this.m_shape,this.m_origin,this.m_sqrTolerance,this.m_invCellSize,this.m_hashValues),this.m_hashTable=new nn(Math.trunc(4*e/3),this.m_hashFunction),this.m_hashTable.reserveElements(this.m_shape.getSelectedCount());let n=!1;{const e=this.m_shape.queryVertexIteratorOnSelection(this.m_geometry);for(let t=e.next();t!==D;t=e.next()){this.progress_();const e=this.m_hashFunction.calculateHashFromVertex(t);this.m_shape.setUserIndex(t,this.m_hashValues,e),this.m_hashTable.addElement(t,e)}}{const e=[],t=this.m_shape.queryVertexIteratorOnSelection(this.m_geometry);for(let s=t.next();s!==D;s=t.next()){if(this.m_shape.getUserIndex(s,this.m_newClusters)===be.impossibleIndex2())continue;let t=this.m_shape.getUserIndex(s,this.m_hashValues);this.m_hashTable.deleteElement(s,t);let r=!1;for(;this.collectClusterCandidates(s,e),0!==e.length;){let t=0;for(let n=0,r=e.length;n<r;n++){this.progress_();const i=e[n],o=this.m_hashTable.getElement(i);this.m_hashTable.deleteNode(i);const a=n+1===r;t|=this.mergeClusters(s,o,a)?1:0}if(r||=0!==t,n||=0!==t,e.length=0,!t)break}r&&(t=this.m_shape.getUserIndex(s,this.m_hashValues)),this.m_hashTable.addElement(s,t)}e.length=0}return n&&this.applyClusterPositions_(),this.m_hashTable=null,this.m_hashFunction=null,this.m_shape.removeUserIndex(this.m_hashValues),this.m_shape.removeUserIndex(this.m_newClusters),n}applyClusterPositions_(){const e=We.getNAN();for(let t=this.m_clusters.getFirstList();t!==Js.st_nullNode();t=this.m_clusters.getNextList(t)){let s=this.m_clusters.getFirst(t);const n=this.m_clusters.getElement(s);this.m_shape.queryXY(n,e);const r=this.m_shape.getRank(n),i=this.m_shape.getWeight(n);for(s=this.m_clusters.getNext(s);s!==Js.st_nullNode();s=this.m_clusters.getNext(s)){const t=this.m_clusters.getElement(s);if(this.m_bTrackChanges?this.m_shape.isEqualXYPoint2D(t,e)||(this.m_shape.setXYMonotonicPoint2D(t,e),this.m_shape.setGeometryModifiedWithVertex(t,!0)):this.m_shape.setXYMonotonicPoint2D(t,e),this.m_bHasSegmentParentage){const e=this.m_shape.getSegmentParentageBreakVertex(n)||this.m_shape.getSegmentParentageBreakVertex(t);this.m_shape.setSegmentParentageBreakVertex(n,e),this.m_shape.setSegmentParentageBreakVertex(t,e)}this.m_shape.setWeight(t,i),this.m_shape.setRank(t,r)}}}}class _n{constructor(){this.m_inputParts=[],this.m_resultParts1=[],this.m_resultParts2=[],this.m_resultSegments=[],this.m_freeSegments=[],this.m_inputSegments=[],this.m_param1=[],this.m_param2=[],this.m_tolerance=0,this.m_toleranceZ=0,this.m_point=new ae,this.m_pointWeight=1,this.m_maxDensifyLimit=0,this.m_pointRank=0,this.m_changed1=!1,this.m_changed2=!1,this.m_adaptiveDensify=!1}clear(){this.freeAllResultSegments(),this.m_inputSegments.length=0,this.m_inputParts.length=0,this.m_resultParts1.length=0,this.m_resultParts2.length=0,this.m_param1.length=0,this.m_param2.length=0,this.m_adaptiveDensify=!1,this.m_changed1=!1,this.m_changed2=!1}newIntersectionPart_(e,t,s,n,r,i,o,a,h,m){return pn(e,t,s,n,r,i,o,a,h,m)}pushSegment(e,t,s,n,r,i,o,a,h,m){return this.m_inputParts.push(this.newIntersectionPart_(this.m_inputSegments.length,t,s,n,r,i,o,a,h,m)),this.m_inputSegments.push(e),this.m_inputParts.length-1}getResultSegmentCount(e){return this.m_adaptiveDensify?0===e?this.m_param1.length-1:this.m_param2.length-1:0===e?this.m_resultParts1.length:this.m_resultParts2.length}getResultPart_(e,t){return 0===e?this.m_resultParts1[t]:this.m_resultParts2[t]}getResultSegment(e,t){return this.m_resultSegments[this.getResultPart_(e,t).segmentIndex].get()}getSegmentChanged(e){return 0===e?this.m_changed1:this.m_changed2}getResultSegmentStartPointWeight(e,t){return this.getResultPart_(e,t).weightStart}getResultSegmentStartPointRank(e,t){return this.getResultPart_(e,t).rankStart}getResultSegmentSegmentParentage(e,t){return this.getResultPart_(e,t).segmentParentage}getResultSegmentStartPointIsBreak(e,t){return this.getResultPart_(e,t).u.bBreakStart}getResultSegmentEndPointWeight(e,t){return this.getResultPart_(e,t).weightEnd}getResultSegmentEndPointRank(e,t){return this.getResultPart_(e,t).rankEnd}getResultSegmentEndPointIsBreak(e,t){return this.getResultPart_(e,t).u.bBreakEnd}getResultSegmentInteriorRank(e,t){return this.getResultPart_(e,t).rankInterior}getResultSegmentInteriorWeight(e,t){return this.getResultPart_(e,t).weightInterior}getResultPoint(){return this.m_point}getResultPointWeight(){return this.m_pointWeight}getResultPointRank(){return this.m_pointRank}getResultPointChanged(){return this.m_changed2}intersectLines(e,t){2!==this.m_inputSegments.length&&l(""),this.m_changed1=!1,this.m_changed2=!1,this.m_tolerance=e;const s=at(e*_n.c_smallToleranceFactor);let n=!1;const r=this.m_inputParts[0],i=this.m_inputParts[1],o=this.m_inputSegments[r.segmentIndex],a=this.m_inputSegments[i.segmentIndex];if(t||5&j(!0,o,a,e,!0)){const t=Q(!0,o,a,null,this.m_param1,this.m_param2,e);0===t&&l("");const h=new Array(t);for(let e=0;e<t;++e)h[e]=We.getNAN();const m=new Float64Array(t),g=new Int32Array(t),u=new Array(t),c=new Array(t);for(let e=0;e<t;++e)u[e]=fn(),c[e]=fn();for(let e=0;e<t;e++){const t=this.m_param1[e],l=this.m_param2[e];let _,d=r.rankInterior,p=r.weightInterior;0===t?(d=r.rankStart,p=r.weightStart,_=r.u.bBreakStart):1===t?(d=r.rankEnd,p=r.weightEnd,_=r.u.bBreakEnd):(this.m_changed1=!0,_=!1);let f,x=i.rankInterior,y=i.weightInterior;0===l?(x=i.rankStart,y=i.weightStart,f=i.u.bBreakStart):1===l?(x=i.rankEnd,y=i.weightEnd,f=i.u.bBreakEnd):(this.m_changed2=!0,f=!1);const P=d,E=x;let S=1,C=0,I=We.getNAN();if(P===E){const n=o.getCoord2D(t),r=a.getCoord2D(l);S=p+y;C=d,Ft(n,r,y/S,I);const i=We.sqrDistance(I,n),h=We.sqrDistance(I,r);u[e].bBigMove=i>s,c[e].bBigMove=h>s,this.m_changed1||n.equals(I)||(this.m_changed1=!0),this.m_changed2||r.equals(I)||(this.m_changed2=!0)}else if(P>E){I=o.getCoord2D(t);const n=a.getCoord2D(l);S=p,C=d;const r=We.sqrDistance(I,n);u[e].bBigMove=!1,c[e].bBigMove=r>s,this.m_changed2||n.equals(I)||(this.m_changed2=!0)}else{I=a.getCoord2D(l),S=y,C=x;const n=o.getCoord2D(t),r=We.sqrDistance(I,n);u[e].bBigMove=r>s,c[e].bBigMove=!1,this.m_changed1||n.equals(I)||(this.m_changed1=!0)}h[e].assign(I),m[e]=S,g[e]=C,u[e].bIsBreak=_||f,c[e].bIsBreak=_||f,n||=u[e].bBigMove||c[e].bBigMove}const _=r.rankInterior,d=r.weightInterior;let p=0,f=-1;for(let s=0;s<=t;s++){const n=s<t?this.m_param1[s]:1;if(n!==p){const i=this.allocResultSegment(),a=this.m_resultSegments[i];let l,c,x,y;o.queryCut(p,n,a,!1),a.get().snapControlPoints(e*e);let P=!1,E=!1,S=!1,C=!1,I=!1,b=We.getNAN(),w=We.getNAN();-1!==f?(c=g[f],l=m[f],P=u[f].bBigMove,b.assign(h[f]),S=u[f].bIsBreak,I=!0):(l=r.weightStart,c=r.rankStart,b=a.get().getStartXY(),S=r.u.bBreakStart),s<t?(y=g[s],x=m[s],E=u[s].bBigMove,w.assign(h[s]),C=u[s].bIsBreak,I=!0):(x=r.weightEnd,y=r.rankEnd,w=a.get().getEndXY(),C=r.u.bBreakEnd),I&&a.get().setCoordsForIntersector(b,w,!0),this.m_resultParts1.push(this.newIntersectionPart_(i,l,c,x,y,d,_,S,C,r.segmentParentage));const v=this.m_resultParts1.at(-1);v.u.bBigMoveStart=P,v.u.bBigMoveEnd=E,p=n,f=s}else-1===f&&(f=s)}const x=new Array(t);for(let e=0;e<t;e++)x[e]=e;t>2?(x.sort(((e,t)=>this.m_param2[e]<this.m_param2[t]?-1:this.m_param2[e]>this.m_param2[t]?1:0)),et(this.m_param2)):2===t&&this.m_param2[0]>this.m_param2[1]&&(this.m_param2[1]=gt(this.m_param2[0],this.m_param2[0]=this.m_param2[1]),x[1]=gt(x[0],x[0]=x[1]));const y=i.rankInterior,P=i.weightInterior;p=0,f=-1;for(let s=0;s<=t;s++){const n=s<t?this.m_param2[s]:1;if(n!==p){const r=this.allocResultSegment(),o=this.m_resultSegments[r];let l,u,_,d;a.queryCut(p,n,o,!1),o.get().snapControlPoints(e*e);let E=We.getNAN(),S=We.getNAN(),C=!1,I=!1,b=!1,w=!1,v=!1;if(-1!==f){const e=x[f];l=m[e],u=g[e],E.assign(h[e]),b=c[e].bBigMove,C=c[e].bIsBreak,v=!0}else l=i.weightStart,u=i.rankStart,E=o.get().getStartXY(),C=i.u.bBreakStart;if(s!==t){const e=x[s];_=m[e],d=g[e],S.assign(h[e]),w=c[e].bBigMove,I=c[e].bIsBreak,v=!0}else _=i.weightEnd,d=i.rankEnd,S=o.get().getEndXY(),I=i.u.bBreakEnd;v&&o.get().setCoordsForIntersector(E,S,!0),this.m_resultParts2.push(this.newIntersectionPart_(r,l,u,_,d,P,y,C,I,i.segmentParentage));const T=this.m_resultParts2.at(-1);T.u.bBigMoveStart=b,T.u.bBigMoveEnd=w,p=n,f=s}else-1===f&&(f=s)}return n?3:2}return 0}intersectLines3D(e,t,n,r){return s(0),1}intersect2D(e,t){const s=this.m_inputParts[0],n=this.m_inputParts[1],r=this.m_inputSegments[s.segmentIndex].getGeometryType(),i=this.m_inputSegments[n.segmentIndex].getGeometryType();if(r!==o.enumLine||i!==o.enumLine){return new En(this).intersectCurves(e,t)}return this.intersectLines(e,t)}intersect2DEx(e,t,s,n,r){this.m_point.assignCopy(t),1!==this.m_inputSegments.length&&l(""),this.m_tolerance=e,this.m_changed1=!1,this.m_changed2=!1;const i=at(e*_n.c_smallToleranceFactor);let o=!1;const a=this.m_inputParts[0],h=this.m_inputSegments[a.segmentIndex];if(r||h.isIntersectingPoint(t.getXY(),e,!0)){this.m_param1=$e(16,Number.NaN);const r=h.getClosestCoordinate(t.getXY(),!1);this.m_param1[0]=r;let m=a.rankInterior,l=a.weightInterior;0===r?(m=a.rankStart,l=a.weightStart):1===r?(m=a.rankEnd,l=a.weightEnd):this.m_changed1=!0;let g=m;const u=s,c=n;g===u&&h.isCurve()&&(g=u+1);let _=1,d=0;const p=new We;if(g===u){const e=h.getCoord2D(r),s=t.getXY();_=l+c,d=m;Ft(e,s,c/_,p),this.m_changed1||e.equals(p)||(this.m_changed1=!0),this.m_changed2||s.equals(p)||(this.m_changed2=!0);o=We.sqrDistance(p,e)>i}else if(g>u)p.assign(h.getCoord2D(r)),_=l,d=m,this.m_changed2||p.equals(t.getXY())||(this.m_changed2=!0);else{p.assign(h.getCoord2D(r)),_=c,d=u,this.m_changed1||p.equals(t.getXY())||(this.m_changed1=!0);o=We.sqrDistance(p,t.getXY())>i}let f=0,x=-1;const y=1;for(let t=0;t<=y;t++){const s=t<y?this.m_param1[0]:1;if(s!==f){const n=this.allocResultSegment(),r=this.m_resultSegments[n];h.queryCut(f,s,r),r.get().snapControlPoints(e*e);let i=a.weightStart,o=a.weightEnd,m=a.rankStart,l=a.rankEnd;const g=a.rankInterior,u=a.weightInterior;let c=a.u.bBreakStart,P=a.u.bBreakEnd;-1!==x&&(i=_,m=d,c=!0,r.get().setCoordsForIntersector(p,r.get().getEndXY(),!0)),t!==y&&(o=_,l=d,P=!0,r.get().setCoordsForIntersector(r.get().getStartXY(),p,!0)),f=s,this.m_resultParts1.push(this.newIntersectionPart_(n,i,m,o,l,u,g,c,P,a.segmentParentage))}x=t}return this.m_point.setXY(p),this.m_pointWeight=_,this.m_pointRank=d,o?3:2}return 0}intersect3D(e,t,n,r){return s(0),1}intersect3DEx(e,t,n,r,i,o,a){return s(0),1}getTolerance(){return this.m_tolerance}freeAllResultSegments(){this.m_resultSegments.length=0,this.m_freeSegments.length=0}freeResultSegment(e){this.m_freeSegments.push(e)}allocResultSegment(){if(this.m_freeSegments.length){return this.m_freeSegments.pop()}const e=new b,t=this.m_resultSegments.length;return this.m_resultSegments.push(e),t}allocResultSegmentFromBuffer(e){if(this.m_freeSegments.length){return this.m_freeSegments.pop()}const t=new b({copy:e}),s=this.m_resultSegments.length;return this.m_resultSegments.push(t),s}allocResultSegmentFromSegment(e){if(this.m_freeSegments.length){return this.m_freeSegments.pop()}const t=new b({segment:e}),s=this.m_resultSegments.length;return this.m_resultSegments.push(t),s}}function dn(e,t){return{bBigMoveStart:!1,bBigMoveEnd:!1,bBreakStart:e,bBreakEnd:t}}function pn(e,t,s,n,r,i,o,a,h,m){return{segmentIndex:e,weightStart:t,rankStart:s,weightEnd:n,rankEnd:r,weightInterior:i,rankInterior:o,segmentParentage:m,u:dn(a,h)}}function fn(){return{bBigMove:!1,bIsBreak:!1}}_n.maxWeight=.1*Number.MAX_VALUE,_n.c_smallToleranceFactor=.01,_n.c_maxGeometryTypeToRankDelta=8;let xn=class{constructor(){this.start=null,this.end=null,this.equalEdge=null,this.segmentIndex=-1,this.segmentParentage=-1,this.weight=0,this.rank=0}hasSegment(){return this.segmentIndex>=0}transferAttributes(e,t,s){if(1===t.getDescription().getAttributeCount())return;const n=e.parent.m_resultSegments[this.segmentIndex].get().getStartXY(),r=e.parent.m_resultSegments[this.segmentIndex].get().getEndXY(),i=new ae;t.queryStart(i),s?(i.setXY(n),e.parent.m_resultSegments[this.segmentIndex].get().setStart(i)):(i.setXY(r),e.parent.m_resultSegments[this.segmentIndex].get().setEnd(i)),t.queryEnd(i),s?(i.setXY(r),e.parent.m_resultSegments[this.segmentIndex].get().setEnd(i)):(i.setXY(n),e.parent.m_resultSegments[this.segmentIndex].get().setStart(i))}copyFromWhenOverlap(e,t,s){this.equalEdge=t,t.equalEdge=this,this.segmentIndex=e.parent.allocResultSegmentFromBuffer(e.parent.m_resultSegments[t.segmentIndex]),this.segmentParentage=t.segmentParentage,this.weight=t.weight,this.rank=t.rank,s?(this.start.copyFrom(t.start),this.end.copyFrom(t.end)):(this.start.copyFrom(t.end),this.end.copyFrom(t.start),e.parent.m_resultSegments[this.segmentIndex].get().reverse())}getEnd(){return this.end}getNextInChain(){return this.end.nextInChain}getPrevInChain(){return this.start.prevInChain}};class yn{constructor(){this.hash=0,this.pt=new We,this.prevInChain=null,this.nextInChain=null,this.prevInHash=null,this.nextInHash=null,this.prevEqual=null,this.nextEqual=null,this.weight=0,this.rank=0,this.bBigMove=!1,this.bIsBreak=!1}copyFrom(e){this.pt.assign(e.pt),this.weight=e.weight,this.rank=e.rank,this.bBigMove=e.bBigMove,this.bIsBreak=e.bIsBreak}nextNode(){return this.nextInChain?this.nextInChain.end:null}prevNode(){return this.prevInChain?this.prevInChain.start:null}equalListHead(){let e=this;for(;null!==e.prevEqual;e=e.prevEqual);return e}}function Pn(e,t,s,n){return{edge1:e,edge2:t,recursion:s,bIsIntersecting:n}}class En{constructor(e){this.m_pairs=[],this.m_chainOrigin1=null,this.m_chainOrigin2=null,this.m_newNodes=[],this.m_hashTableOfEquals=[],this.m_hashTableOfEqualsSize=0,this.m_origin=new We,this.m_cell=new We,this.parent=e}addSegment(e,t,n,r,i,o,a,h,m,l,g){const u=this.newNode(this.parent.m_resultSegments[e].get().getStartXY(),n,r,m),c=this.newNode(this.parent.m_resultSegments[e].get().getEndXY(),i,o,l);this.newEdge(u,c,e,a,h,g),null===this.m_chainOrigin1?this.m_chainOrigin1=u:null===this.m_chainOrigin2?this.m_chainOrigin2=u:s(0)}intersectCurvesHelper(e,t,n,r,i){const a=this.getSegment(e).get(),h=this.getSegment(t).get();if(a.isDegenerate(0)||h.isDegenerate(0))return 0;const m=this.tryOverlapIntersectCurves(e,t,n,r);if(0!==m)return m;const g=at(.01*n);let u=!1,c=this.processSharpCorners(a,h,n,i>4);const _=c>0;if(!_){if(!(r||5&$(!0,!1,a,h,n,!0)))return 0;c=Q(!0,a,h,null,this.parent.m_param1,this.parent.m_param2,n)}0===c&&l("");const d=a.getGeometryType(),p=h.getGeometryType(),f=lt(We,c),x=lt(We,c),y=new Array(c),P=new Array(c),E=new Array(c),S=new Array(c),C=kt(fn,c),I=kt(fn,c);let b=!1,w=!1;for(let s=0;s<c;s++){const r=this.parent.m_param1[s],i=this.parent.m_param2[s];let o=e.rank,m=e.weight,l=!0,c=!1;0===r?(o=e.start.rank,m=e.start.weight,c=e.start.bIsBreak):1===r?(o=e.end.rank,m=e.end.weight,c=e.end.bIsBreak):(b=!0,l=!1);let v=t.rank,T=t.weight,N=!1,G=!0;0===i?(v=t.start.rank,T=t.start.weight,N=t.start.bIsBreak):1===i?(v=t.end.rank,T=t.end.weight,N=t.end.bIsBreak):(w=!0,G=!1);let D=o,V=v;if(D===V&&(D*=_n.c_maxGeometryTypeToRankDelta,V*=_n.c_maxGeometryTypeToRankDelta,D+=Sn(d,a,!1),V+=Sn(p,h,!1)),l&&G&&V===D){const e=a.getCoord2D(r),t=h.getCoord2D(i);e.equals(t)&&(V=D-1)}let F=1,H=0,k=1,A=0;const M=new We,U=new We,q=a.getCoord2D(r),O=h.getCoord2D(i);if(_&&We.distance(q,O)>n)M.setCoordsPoint2D(q),U.setCoordsPoint2D(O),F=m,k=T,H=o,A=v,C[s].bBigMove=!1,I[s].bBigMove=!1,c=!0,N=!0;else if(D===V){k=F=m+T,A=H=o;Ft(q,O,T/F,M),U.setCoordsPoint2D(M);const e=We.sqrDistance(M,q),t=We.sqrDistance(M,O);C[s].bBigMove=e>g,I[s].bBigMove=t>g,b||q.equals(M)||(b=!0),w||O.equals(U)||(w=!0)}else if(D>V){M.setCoordsPoint2D(q),U.setCoordsPoint2D(M),k=F=m,A=H=o;const e=We.sqrDistance(M,O);C[s].bBigMove=!1,I[s].bBigMove=e>g,w||O.equals(U)||(w=!0)}else{U.setCoordsPoint2D(O),M.setCoordsPoint2D(U),k=F=T,A=H=v;const e=We.sqrDistance(M,q);C[s].bBigMove=e>g,I[s].bBigMove=!1,b||q.equals(M)||(b=!0)}f[s].assign(M),x[s].assign(U),y[s]=F,P[s]=k,E[s]=H,S[s]=A,C[s].bIsBreak=c||N,I[s].bIsBreak=c||N,u||=C[s].bBigMove||I[s].bBigMove,s>0&&(r!==this.parent.m_param1[s-1]&&i!==this.parent.m_param2[s-1]||(E[s]<=E[s-1]?(f[s].assign(x[s-1]),y[s]=P[s-1],E[s]=S[s-1],x[s].assign(x[s-1]),P[s]=P[s-1],S[s]=S[s-1],C[s].bBigMove||=C[s-1].bBigMove,I[s].bBigMove||=I[s-1].bBigMove,C[s].bIsBreak||=C[s-1].bIsBreak,I[s].bIsBreak||=I[s-1].bIsBreak):(f[s-1].assign(f[s]),y[s-1]=y[s],E[s-1]=E[s],x[s-1].assign(x[s]),P[s-1]=P[s],S[s-1]=S[s],C[s-1].bBigMove||=C[s].bBigMove,I[s-1].bBigMove||=I[s].bBigMove,C[s-1].bIsBreak||=C[s].bIsBreak,I[s-1].bIsBreak||=I[s].bIsBreak)))}if(!(b||w||2!==c||d===o.enumLine&&p===o.enumLine)){if(this.processDoublyConnectedEdges(e,t,i+1,n))return this.parent.m_changed1=!0,this.parent.m_changed2=!0,2;s(0)}this.parent.m_changed1||=b,this.parent.m_changed2||=w;let v=e,T=e.end.weight,N=e.end.rank,G=e.end.bBigMove,D=e.end.bIsBreak,V=0,F=-1;for(let s=0;s<=c;s++){const t=s<c?this.parent.m_param1[s]:1;if(t!==V){const r=this.parent.allocResultSegment(),i=this.parent.m_resultSegments[r];let o,h,m,l;a.queryCut(V,t,i,!1),i.get().snapControlPoints(n*n);let g=!1,u=!1,_=!1,d=!1;const p=new We,x=new We;-1!==F?(h=E[F],o=y[F],_=C[F].bBigMove,g=C[F].bIsBreak,p.assign(f[F])):(o=e.start.weight,h=e.start.rank,_=e.start.bBigMove,g=e.start.bIsBreak,p.assign(i.get().getStartXY())),s<c?(l=E[s],m=y[s],d=C[s].bBigMove,u=C[s].bIsBreak,x.assign(f[s])):(m=T,l=N,d=G,u=D,x.assign(i.get().getEndXY()));let P=v;t<1&&(this.splitEdgeInPlace(v),P=v.getNextInChain()),this.updateSegmentOnly(v,r),0===v.start.hash||v.start.pt.equals(p)||(this.m_newNodes.push(v.start),this.removeNodeFromHash(v.start),v.start.hash=0),0===v.end.hash||v.end.pt.equals(x)||(this.m_newNodes.push(v.end),this.removeNodeFromHash(v.end),v.end.hash=0),v.start.pt.assign(p),v.end.pt.assign(x),v.start.bBigMove||=_,v.end.bBigMove||=d,v.start.bIsBreak||=g,v.end.bIsBreak||=u,v.start.weight=o,v.start.rank=h,v.end.weight=m,v.end.rank=l,v=P,V=t,F=s}else-1===F&&(F=s)}const H=v.getNextInChain(),k=[];k.length=c;for(let s=0;s<c;s++)k[s]=s;c>2?(k.sort(((e,t)=>At(this.parent.m_param2[e],this.parent.m_param2[t]))),this.parent.m_param2.sort(At)):2===c&&this.parent.m_param2[0]>this.parent.m_param2[1]&&(this.parent.m_param2[1]=gt(this.parent.m_param2[0],this.parent.m_param2[0]=this.parent.m_param2[1]),k[1]=gt(k[0],k[0]=k[1])),v=t,T=t.end.weight,N=t.end.rank,G=t.end.bBigMove,D=t.end.bIsBreak,V=0,F=-1;for(let s=0;s<=c;s++){const e=s<c?this.parent.m_param2[s]:1;if(e!==V){const r=this.parent.allocResultSegment(),i=this.parent.m_resultSegments[r];let o,a,m,l;h.queryCut(V,e,i,!1),i.get().snapControlPoints(n*n);const g=new We,u=new We;let _=!1,d=!1,p=!1,f=!1;if(-1!==F){const e=k[F];o=P[e],a=S[e],g.assign(x[e]),p=I[e].bBigMove,_=I[e].bIsBreak}else o=t.start.weight,a=t.start.rank,p=t.start.bBigMove,_=t.start.bIsBreak,g.assign(i.get().getStartXY());if(s!==c){const e=k[s];m=P[e],l=S[e],u.assign(x[e]),f=I[e].bBigMove,d=I[e].bIsBreak}else m=T,l=N,f=G,d=D,u.assign(i.get().getEndXY());let y=v;e<1&&(this.splitEdgeInPlace(v),y=v.getNextInChain()),this.updateSegmentOnly(v,r),0===v.start.hash||v.start.pt.equals(g)||(this.m_newNodes.push(v.start),this.removeNodeFromHash(v.start),v.start.hash=0),0===v.end.hash||v.end.pt.equals(u)||(this.m_newNodes.push(v.end),this.removeNodeFromHash(v.end),v.end.hash=0),v.start.pt.assign(g),v.end.pt.assign(u),v.start.bBigMove||=p,v.end.bBigMove||=f,v.start.bIsBreak||=_,v.end.bIsBreak||=d,v.start.weight=o,v.start.rank=a,v.end.weight=m,v.end.rank=l,v=y,V=e,F=s}else-1===F&&(F=s)}const A=v.getNextInChain();return this.postProcessResultPartsForCurves(e,H,t,A,i+1),u?3:2}intersectCurves(t,n){2!==this.parent.m_inputSegments.length&&l(""),this.parent.m_changed1=!1,this.parent.m_changed2=!1,this.parent.m_tolerance=t,this.m_hashTableOfEqualsSize=0,this.m_hashTableOfEquals=Je(16);const r=e.constructEmpty();for(let s=0;s<2;s++){const t=this.parent.allocResultSegmentFromSegment(this.parent.m_inputSegments[this.parent.m_inputParts[s].segmentIndex]),n=e.constructEmpty();this.parent.m_inputSegments[this.parent.m_inputParts[s].segmentIndex].queryLooseEnvelope(n),r.mergeEnvelope2D(n);const i=this.parent.m_inputParts[s];this.addSegment(t,0,i.weightStart,i.rankStart,i.weightEnd,i.rankEnd,i.weightInterior,i.rankInterior,i.u.bBreakStart,i.u.bBreakEnd,i.segmentParentage)}r.inflateCoords(100*t,100*t),this.m_origin.assign(r.getLowerLeft()),this.m_cell.setCoords(2*t,2*t),this.m_pairs.push(Pn(this.m_chainOrigin1.nextInChain,this.m_chainOrigin2.nextInChain,0,n));let i=0,o=!0;for(;this.m_pairs.length;){const e=this.m_pairs.at(-1);this.m_pairs.pop(),s(e.recursion>=0),s(e.recursion<=256),this.clusterNodes(t);const n=this.intersectCurvesHelper(e.edge1,e.edge2,t,e.bIsIntersecting,e.recursion);o&&(o=!1,i=n)}for(let e=0;e<2;e++){const t=0===e?this.parent.m_resultParts1:this.parent.m_resultParts2;for(let s=(0===e?this.m_chainOrigin1:this.m_chainOrigin2).nextInChain;null!=s;s=s.getNextInChain())t.push(this.parent.newIntersectionPart_(s.segmentIndex,s.start.weight,s.start.rank,s.end.weight,s.end.rank,s.weight,s.rank,s.start.bIsBreak,s.end.bIsBreak,s.segmentParentage)),t.at(-1).u.bBigMoveStart=s.start.bBigMove,t.at(-1).u.bBigMoveEnd=s.end.bBigMove}return i}tryOverlapIntersectCurves(e,t,n,r){const i=this.parent.m_resultSegments[e.segmentIndex].get(),o=this.parent.m_resultSegments[t.segmentIndex].get(),a=i.getStartXY().equals(o.getStartXY())&&i.getEndXY().equals(o.getEndXY()),h=i.getStartXY().equals(o.getEndXY())&&i.getEndXY().equals(o.getStartXY());if(!a&&!h)return 0;const m=se(i,o,!0);if(0!==m&&ne(i,o)&&e.segmentParentage===t.segmentParentage){let e=!1;if(m>0)e=i.equals(o);else{s(-1===m);const t=new b({segment:o});t.get().reverse(),e=i.equals(t.get())}if(e)return 1}const l=n*_n.c_smallToleranceFactor;let g=!1;if(0===m){const e=[.5,.25,.75,.125,.375,.625,.875,.5625,.3125];for(let t=0,s=e.length;t<s;++t){const s=e[t],r=new We;i.queryCoord2D(s,r);const a=o.getClosestCoordinate(r,!1),h=new We;o.queryCoord2D(a,h);const m=We.distance(r,h);if(m>n)return 0;g||=m>l}for(let t=0,s=e.length;t<s;++t){const s=e[t],r=new We;o.queryCoord2D(s,r);const a=i.getClosestCoordinate(r,!1),h=new We;i.queryCoord2D(a,h);const m=We.distance(r,h);if(m>n)return 0;g||=m>l}}let u=e.rank,c=t.rank;return u===c&&(u*=_n.c_maxGeometryTypeToRankDelta,c*=_n.c_maxGeometryTypeToRankDelta,u+=Sn(i.getGeometryType(),i,!0),c+=Sn(o.getGeometryType(),o,!0)),u>c?(t.copyFromWhenOverlap(this,e,a),t.transferAttributes(this,i,a)):c>u?(e.copyFromWhenOverlap(this,t,a),e.transferAttributes(this,o,a)):e.segmentParentage<=t.segmentParentage?(e.weight=e.weight+t.weight,t.copyFromWhenOverlap(this,e,a),t.transferAttributes(this,i,a)):(t.weight=e.weight+t.weight,e.copyFromWhenOverlap(this,t,a),e.transferAttributes(this,o,a)),g?3:2}postProcessResultPartsForCurves(e,t,s,n,r){r===Mt()&&l("curve_helper");for(let i=e;i!==t;i=i.getNextInChain())this.updateSegmentToNodes(i);for(let i=s;i!==n;i=i.getNextInChain())this.updateSegmentToNodes(i);for(let i=e;i!==t;i=i.getNextInChain()){const e=i.end.pt.sub(i.start.pt);for(let t=s;t!==n;t=t.getNextInChain()){let s=0;if(i.start.pt.equals(t.start.pt)&&i.end.pt.equals(t.end.pt)?s=1:i.start.pt.equals(t.end.pt)&&i.end.pt.equals(t.start.pt)&&(s=-1),!s){let s=i.start.pt.equals(t.start.pt)?1:0;if(s||(s=i.end.pt.equals(t.end.pt)?2:0,s||(s=i.end.pt.equals(t.start.pt)?3:0,s||(s=i.start.pt.equals(t.end.pt)?4:0))),s){const n=t.end.pt.sub(t.start.pt),o=e.dotProduct(n);let a;switch(s){case 1:case 2:a=o>0;break;case 3:case 4:a=o<0;break;default:l("post_process_result_parts_for_curves_")}a&&this.m_pairs.push(Pn(i,t,r,!1))}continue}const n=this.parent.m_resultSegments[i.segmentIndex],o=this.parent.m_resultSegments[t.segmentIndex],a=[.5,.25,.75];for(let e=0,t=a.length;e<t;++e){const t=a[e],r=new We;n.get().queryCoord2D(t,r);const i=o.get().getClosestCoordinate(r,!1),h=new We;o.get().queryCoord2D(i,h);if(We.distance(r,h)>this.parent.m_tolerance){s=0;break}}if(!s){this.m_pairs.push(Pn(i,t,r,!1));continue}for(let e=0,t=a.length;e<t;++e){const t=a[e],r=new We;o.get().queryCoord2D(t,r);const i=n.get().getClosestCoordinate(r,!1),h=new We;n.get().queryCoord2D(i,h);if(We.distance(r,h)>this.parent.m_tolerance){s=0;break}}if(!s){this.m_pairs.push(Pn(i,t,r,!1));continue}i.equalEdge=t,t.equalEdge=i;let h=i.rank,m=t.rank;h===m&&(h*=_n.c_maxGeometryTypeToRankDelta,m*=_n.c_maxGeometryTypeToRankDelta,h+=Sn(n.get().getGeometryType(),n.get(),!0),m+=Sn(o.get().getGeometryType(),o.get(),!0)),h>m||h===m&&i.segmentParentage<=t.segmentParentage?(n.copyTo(o,!1),t.segmentParentage=i.segmentParentage,-1===s&&o.get().reverse()):(o.copyTo(n,!1),i.segmentParentage=t.segmentParentage,-1===s&&n.get().reverse());break}}this.updateAttachedEdgesAfterNodeChange(e.start),t&&this.updateAttachedEdgesAfterNodeChange(t.start),this.updateAttachedEdgesAfterNodeChange(s.start),n&&this.updateAttachedEdgesAfterNodeChange(n.start)}processDoublyConnectedEdges(e,t,s,n){s===Mt()&&l("curve_helper");const r=this.getSegment(e).get(),i=this.getSegment(t).get(),o=r.getStartXY().equals(i.getStartXY())&&r.getEndXY().equals(i.getEndXY())?1:r.getEndXY().equals(i.getStartXY())&&r.getStartXY().equals(i.getEndXY())?-1:0;if(0!==o){const a=new b;r.queryCut(0,.5,a),a.get().snapControlPoints(n*n);const h=new b;r.queryCut(.5,1,h),h.get().snapControlPoints(n*n),this.splitEdgeInPlace(e),e.end.pt=a.get().getEndXY(),e.segmentIndex=this.parent.allocResultSegmentFromBuffer(a),e.getNextInChain().segmentIndex=this.parent.allocResultSegmentFromBuffer(h);let m=i.getClosestCoordinate(e.end.pt,!1);return Math.abs(m-.5)>.2&&(m=.5),i.queryCut(0,m,a),a.get().snapControlPoints(n*n),i.queryCut(m,1,h),h.get().snapControlPoints(n*n),this.splitEdgeInPlace(t),t.end.pt=a.get().getEndXY(),t.segmentIndex=this.parent.allocResultSegmentFromBuffer(a),t.getNextInChain().segmentIndex=this.parent.allocResultSegmentFromBuffer(h),o>0?(this.m_pairs.push(Pn(e,t,s,!1)),this.m_pairs.push(Pn(e.getNextInChain(),t.getNextInChain(),s,!1))):(this.m_pairs.push(Pn(e,t.getNextInChain(),s,!1)),this.m_pairs.push(Pn(e.getNextInChain(),t,s,!1))),!0}return!1}newNode(e,t,s,n){const r=new yn;return this.m_newNodes.push(r),r.pt=e,r.rank=s,r.weight=t,r.bIsBreak=n,r}newEdge(e,t,s,n,r,i){const o=new xn;return o.start=e,o.end=t,e.nextInChain=o,t.prevInChain=o,o.segmentIndex=s,o.segmentParentage=i,o.rank=r,o.weight=n,o}splitEdgeInPlace(e){e.segmentIndex=-1;const t=new xn,s=new yn;this.m_newNodes.push(s),s.pt.setNAN(),s.nextInChain=t,s.prevInChain=e,s.prevInHash=null,s.nextInHash=null,s.prevEqual=null,s.nextEqual=null,s.weight=e.weight,s.rank=e.rank,s.bIsBreak=!1,s.bBigMove=!1,t.start=s,t.segmentIndex=-1,t.end=e.end,t.end.prevInChain=t,t.rank=e.rank,t.weight=e.weight,t.segmentParentage=e.segmentParentage,e.end=s,e.equalEdge&&(e.equalEdge.equalEdge=null),e.equalEdge=null}updateSegmentOnly(e,t){e.segmentIndex=t}updateAttachedEdgesAfterNodeChange(e){for(let t=e.equalListHead();null!==t;t=t.nextEqual)this.updateAttachedEdgesAfterNodeChangeImpl(t)}updateAttachedEdgesAfterNodeChangeImpl(e){const t=e.prevInChain;if(t&&t.hasSegment()){const s=this.getSegment(t).get();e.pt.equals(s.getEndXY())||(s.setCoordsForIntersector(t.start.pt,t.end.pt,!1),s.ensureXYMonotone())}const s=e.nextInChain;if(s&&s.hasSegment()){const t=this.getSegment(s).get();e.pt.equals(t.getStartXY())||(t.setCoordsForIntersector(s.start.pt,s.end.pt,!1),t.ensureXYMonotone())}}updateSegmentToNodes(e){const t=this.getSegment(e).get();e.start.pt.equals(t.getStartXY())&&e.end.pt.equals(t.getEndXY())||(t.setCoordsForIntersector(e.start.pt,e.end.pt,!1),t.ensureXYMonotone()),this.updateAttachedEdgesAfterNodeChange(e.start),this.updateAttachedEdgesAfterNodeChange(e.end)}getSegment(e){return this.parent.m_resultSegments[e.segmentIndex]}clusterNodes(e){let t=!1;const s=[],n=[],r=[];for(let i=0,o=this.m_newNodes.length;i<o;i++){const e=this.m_newNodes[i];if(null===e)continue;let t=e;for(let s=i+1;s<o;s++){const n=this.m_newNodes[s];null!==n&&(e.pt.equals(n.pt)&&(t.nextInHash=n,n.prevInHash=t,t=n,this.m_newNodes[s]=null))}}for(let i=0,o=this.m_newNodes.length;i<o;i++){const o=this.m_newNodes[i];if(null==o)continue;for(o.hash=this.calculateHash(o.pt);;){const i=Je(4),a=this.hashTableBinsToCheck(o,i);for(let t=0;t<a;t++)if(null!==i[t])for(let a=i[t];null!==a;){const t=a.nextInHash;We.distance(o.pt,a.pt)<=e&&(s.push(a),this.removeNodeFromHash(a),a.hash=0,r.push(a),n.push(a)),a=t}let h=!1;for(const e of s)if(!o.pt.equals(e.pt)){const s=hn(o.pt,e.pt,o.weight,o.rank,e.weight,e.rank);o.pt.assign(s.pt),o.weight=s.weight,o.rank=s.rank,h=!0,t=!0}if(s.length=0,!h)break;o.hash=this.calculateHash(o.pt)}r.push(o),n.push(o);for(let e=o.nextInHash;null!==e;){e.prevInHash=null;const t=e.nextInHash;e.nextInHash=null,r.push(e),n.push(e),e=t}const a=o.hash;let h=null,m=null;for(const e of n)o!==e&&(e.hash=a,e.pt.assign(o.pt),e.rank=o.rank,e.weight=o.weight),e.prevInHash=h,h&&(h.nextInHash=e),e.prevEqual=m,e.nextEqual=null,m&&(m.nextEqual=e),m=e,h=e;const l=a%this.m_hashTableOfEquals.length;h.nextInHash=this.m_hashTableOfEquals[l],null!==this.m_hashTableOfEquals[l]&&(this.m_hashTableOfEquals[l].prevInHash=h),this.m_hashTableOfEquals[l]=n[0],this.m_hashTableOfEqualsSize+=n.length,n.length=0,this.rehashIfNeeded()}if(this.m_newNodes.length=0,t)for(const i of r)this.updateAttachedEdgesAfterNodeChange(i)}rehashIfNeeded(){if(2*this.m_hashTableOfEqualsSize>this.m_hashTableOfEquals.length){const e=this.m_hashTableOfEquals;this.m_hashTableOfEquals=Je(2*e.length),this.m_hashTableOfEqualsSize=0;for(const t of e){let e=t;for(;e;){const t=e.nextInHash;e.nextInHash=null,e.prevInHash=null,this.addNodeToHashImpl(e),e=t}}}}addNodeToHashImpl(e){const t=e.hash%this.m_hashTableOfEquals.length,s=this.m_hashTableOfEquals[t];e.nextInHash=s,null!==s&&(s.prevInHash=e),this.m_hashTableOfEquals[t]=e,this.m_hashTableOfEqualsSize++}removeNodeFromHash(e){const t=e.hash%this.m_hashTableOfEquals.length,s=e.prevInHash,n=e.nextInHash;s?s.nextInHash=n:this.m_hashTableOfEquals[t]=n,n&&(n.prevInHash=s),this.m_hashTableOfEqualsSize--,e.prevInHash=null,e.nextInHash=null}hashTableBinsToCheck(e,t){const s=(e.pt.x-this.m_origin.x)/this.m_cell.x,n=(e.pt.y-this.m_origin.y)/this.m_cell.y,r=Pt()-1,i=Math.round(pt(s,-2147483646,r)),o=Math.round(pt(n,-2147483646,r));let a=i|o<<32;a=ze(a),t[0]=this.m_hashTableOfEquals[a%this.m_hashTableOfEquals.length];let h=i+1|o<<32;h=ze(h);let m=1;t[1]=this.m_hashTableOfEquals[h%this.m_hashTableOfEquals.length],t[1]!==t[0]&&(m=2);let l=i+1|o+1<<32;l=ze(l),t[m]=this.m_hashTableOfEquals[l%this.m_hashTableOfEquals.length];for(let u=0;u<m;u++)if(t[m]===t[u]){m--;break}m++;let g=i|o+1<<32;g=ze(g),t[m]=this.m_hashTableOfEquals[g%this.m_hashTableOfEquals.length];for(let u=0;u<m;u++)if(t[m]===t[u]){m--;break}return m++,m}calculateHash(e){const t=(e.x-this.m_origin.x)/this.m_cell.x,s=(e.y-this.m_origin.y)/this.m_cell.y,n=Pt()-1;let r=Math.round(pt(t,-2147483646,n))|Math.round(pt(s,-2147483646,n))<<32;return r=ze(r),0===r&&(r=1),r}processSharpCorners(e,t,s,n){if(this.parent.m_param1.length=0,this.parent.m_param2.length=0,e.getStartXY().equals(t.getStartXY())){const r=[0,0],i=[0,0],o=re(e,t,0,0,s,2,r,i,n);if(o){this.parent.m_param1.push(0),this.parent.m_param2.push(0);for(let e=0;e<o;e++)this.parent.m_param1.push(r[e]),this.parent.m_param2.push(i[e]);return o+1}}if(e.getEndXY().equals(t.getEndXY())){const r=[0,0],i=[0,0],o=re(e,t,1,1,s,2,r,i,n);if(o){for(let e=0;e<o;e++)this.parent.m_param1.push(r[e]),this.parent.m_param2.push(i[e]);return this.parent.m_param1.push(1),this.parent.m_param2.push(1),o+1}}if(e.getStartXY().equals(t.getEndXY())){const r=[0,0],i=[0,0],o=re(e,t,0,1,s,2,r,i,n);if(o){this.parent.m_param1.push(0),this.parent.m_param2.push(1);for(let e=0;e<o;e++)this.parent.m_param1.push(r[e]),this.parent.m_param2.push(i[e]);return o+1}}if(e.getEndXY().equals(t.getStartXY())){const r=[0,0],i=[0,0],o=re(e,t,1,0,s,2,r,i,n);if(o){for(let e=0;e<o;e++)this.parent.m_param1.push(r[e]),this.parent.m_param2.push(i[e]);return this.parent.m_param1.push(1),this.parent.m_param2.push(0),o+1}}return 0}}function Sn(e,t,s){let n=0;switch(e){case o.enumLine:n=0;break;case o.enumBezier:n=2;break;case o.enumRationalBezier2:n=3;break;case o.enumBezier2:n=1;break;case o.enumEllipticArc:n=0===t.projectionBehavior()?5:4;break;default:l("")}return s?5-n:n}class Cn extends tn{constructor(e){super(e.m_shape,e.m_tolerance,!1),this.m_parent=e}compare(e,t,s){if(this.m_bIntersectionDetected)return-1;const n=e.getElement(s),r=this.m_parent.getEdgeOriginVertices(t),i=this.m_parent.m_edgeVertices.getFirstElement(r),o=this.m_parent.getEdgeOriginVertices(n),a=this.m_parent.m_edgeVertices.getFirstElement(o);return this.m_currentNode=s,this.compareSegments(t,i,n,a)}}class In extends sn{constructor(e){super(e.m_shape,e.m_tolerance),this.m_parent=e}compare(e,t){if(this.m_bIntersectionDetected)return-1;const s=e.getElement(t),n=this.m_parent.getEdgeOriginVertices(s),r=this.m_parent.m_edgeVertices.getFirstElement(n);return this.m_currentNode=t,this.compareVertex(e,t,r)}}class bn extends Xe{constructor(e){super(),this.pt1=We.getNAN(),this.pt2=We.getNAN(),this.m_shape=e}compare(e,t,s){this.m_shape.queryXY(t,this.pt1);const n=e.getElement(s);return this.m_shape.queryXY(n,this.pt2),this.pt1.compare(this.pt2)}}class wn{constructor(e){this.m_point=We.getNAN(),this.m_pt=We.getNAN(),this.m_shape=e}setPoint(e){this.m_point.setCoordsPoint2D(e)}compare(e,t){const s=e.getElement(t);return this.m_shape.queryXY(s,this.m_pt),this.m_point.compare(this.m_pt)}}class vn{constructor(e,t){this.m_shape=null,this.m_progressTracker=null,this.m_edges=new be(8),this.m_clusters=new be(5),this.m_clusterVertices=new Js(!1),this.m_edgeVertices=new Js(!1),this.m_helperPoint=new ae,this.m_eventQ=new Te,this.m_sweepStructure=new Te,this.m_bComplications=!1,this.m_sweepComparator=null,this.m_tempEdgeBuffer=[],this.m_modifiedClusters=[],this.m_edgesToInsertInSweepStructure=[],this.m_prevNeighbour=-1,this.m_nextNeighbour=-1,this.m_bContinuingSegmentChainOptimization=!1,this.m_progressCounter=0,this.m_segmentIntersector=new _n,this.m_segBuf1=new b,this.m_segBuf2=new b,this.m_sweepPoint=new We(0,0),this.m_tolerance=0,this.m_toleranceSqr=0,this.m_sweepPointCluster=-1,this.m_vertexClusterIndex=-1,this.m_bCracked=!1,this.m_bSweepPointClusterWasModified=!1,this.m_progressTracker=e,this.m_bTrackChanges=t}hadComplications(){return this.m_bComplications}sweep(e,t){const s=new Xt;s.setSwapCoordinates(),e.applyTransformation(s),this.setEditShape_(e),this.m_bCracked=!1,this.m_tolerance=t,this.m_toleranceSqr=t*t;let n=this.sweepImpl_();return e.applyTransformation(s),n||(this.fillEventQueuePass2(),n=this.sweepImpl_()||n),this.m_shape.removeUserIndex(this.m_vertexClusterIndex),this.m_shape=null,this.m_bCracked}sweepVertical(e,t){this.setEditShape_(e),this.m_bCracked=!1,this.m_tolerance=t,this.m_toleranceSqr=t*t,this.m_bComplications=!1;let s=this.sweepImpl_();if(!this.m_bComplications){const n=e.filterClosePoints(t,!0,!1,this.m_bTrackChanges,D);this.m_bComplications=1===n,s||=1===n}return-1!==this.m_vertexClusterIndex&&(this.m_shape.removeUserIndex(this.m_vertexClusterIndex),this.m_vertexClusterIndex=-1),this.m_shape=null,s}getEdgeCluster(e,t){return this.m_edges.getField(e,0+t)}setEdgeCluster_(e,t,s){this.m_edges.setField(e,0+t,s)}getEdgeOriginVertices(e){return this.m_edges.getField(e,2)}setEdgeOriginVertices_(e,t){this.m_edges.setField(e,2,t)}getNextEdgeEx(e,t){return this.m_edges.getField(e,3+t)}setNextEdgeEx_(e,t,s){this.m_edges.setField(e,3+t,s)}getEdgeSweepNode(e){return this.m_edges.getField(e,7)}setEdgeSweepNode_(e,t){this.m_edges.setField(e,7,t)}getNextEdge(e,t){const s=this.getEdgeEnd(e,t);return this.m_edges.getField(e,3+s)}setNextEdge_(e,t,s){const n=this.getEdgeEnd(e,t);this.m_edges.setField(e,3+n,s)}getPrevEdge(e,t){const s=this.getEdgeEnd(e,t);return this.m_edges.getField(e,5+s)}setPrevEdge_(e,t,s){const n=this.getEdgeEnd(e,t);this.m_edges.setField(e,5+n,s)}getClusterVertices(e){return this.m_clusters.getField(e,0)}setClusterVertices_(e,t){this.m_clusters.setField(e,0,t)}getClusterSweepEdgeList(e){return this.m_clusters.getField(e,2)}setClusterSweepEdgeList_(e,t){this.m_clusters.setField(e,2,t)}getClusterFirstEdge(e){return this.m_clusters.getField(e,1)}setClusterFirstEdge_(e,t){this.m_clusters.setField(e,1,t)}getClusterEventQNode(e){return this.m_clusters.getField(e,3)}setClusterEventQNode_(e,t){this.m_clusters.setField(e,3,t)}newCluster_(e){const t=this.m_clusters.newElement(),s=this.m_clusterVertices.createList();return this.setClusterVertices_(t,s),e!==D&&(this.m_clusterVertices.addElement(s,e),this.m_shape.setUserIndex(e,this.m_vertexClusterIndex,t)),t}deleteCluster_(e){this.m_clusters.deleteElement(e)}addVertexToCluster_(e,t){const s=this.getClusterVertices(e);this.m_clusterVertices.addElement(s,t),this.m_shape.setUserIndex(t,this.m_vertexClusterIndex,e)}newEdge_(e){const t=this.m_edges.newElement(),s=this.m_edgeVertices.createList();return this.setEdgeOriginVertices_(t,s),-1!==e&&this.m_edgeVertices.addElement(s,e),t}addVertexToEdge_(e,t){const s=this.getEdgeOriginVertices(e);this.m_edgeVertices.addElement(s,t)}deleteEdge_(e){this.m_edges.deleteElement(e);const t=this.m_edgesToInsertInSweepStructure.findIndex((t=>t===e));t>=0&&St(this.m_edgesToInsertInSweepStructure,t)}addEdgeToCluster(e,t){-1===this.getEdgeCluster(e,0)?this.setEdgeCluster_(e,0,t):-1===this.getEdgeCluster(e,1)?this.setEdgeCluster_(e,1,t):l(""),this.addEdgeToClusterImpl_(e,t)}addEdgeToClusterImpl_(e,t){const s=this.getClusterFirstEdge(t);if(-1!==s){const n=this.getNextEdge(s,t);this.setPrevEdge_(n,t,e),this.setNextEdge_(e,t,n),this.setNextEdge_(s,t,e),this.setPrevEdge_(e,t,s)}else this.setPrevEdge_(e,t,e),this.setNextEdge_(e,t,e),this.setClusterFirstEdge_(t,e)}getEdgeEnd(e,t){return this.getEdgeCluster(e,0)===t?0:1}mergeClusters_(e,t){this.dbgCheckCluster_(e),this.dbgCheckCluster_(t);const s=this.getClusterEventQNode(t);-1!==s&&(this.m_eventQ.deleteNode(s),this.setClusterEventQNode_(t,-1));let n=this.getClusterFirstEdge(e),r=this.getClusterFirstEdge(t);if(-1!==r){let s=r,i=r,o=!1;do{this.dbgCheckEdge_(s),o=!1;const n=this.getEdgeEnd(s,t),a=this.getNextEdgeEx(s,n);if(this.getEdgeCluster(s,n+1&1)===e){this.disconnectEdge_(s);const e=this.getEdgeOriginVertices(s);if(this.m_edgeVertices.deleteList(e),this.deleteEdge_(s),s===a){r=-1;break}r===s&&(r=this.getClusterFirstEdge(t),i=a,o=!0)}s=a}while(s!==i||o);if(-1!==r){do{const n=this.getEdgeEnd(s,t),r=this.getNextEdgeEx(s,n);this.setEdgeCluster_(s,n,e),s=r}while(s!==i);if(n=this.getClusterFirstEdge(e),-1!==n){const t=this.getNextEdge(n,e),s=this.getNextEdge(r,e);t===n?(this.setClusterFirstEdge_(e,r),this.addEdgeToClusterImpl_(n,e),this.setClusterFirstEdge_(e,n)):s===r&&this.addEdgeToClusterImpl_(r,e),this.setNextEdge_(r,e,t),this.setPrevEdge_(t,e,r),this.setNextEdge_(n,e,s),this.setPrevEdge_(s,e,n)}else this.setClusterFirstEdge_(e,r)}}const i=this.getClusterVertices(e),o=this.getClusterVertices(t);for(let a=this.m_clusterVertices.getFirst(o);-1!==a;a=this.m_clusterVertices.getNext(a)){const t=this.m_clusterVertices.getElement(a);this.m_shape.setUserIndex(t,this.m_vertexClusterIndex,e)}this.m_clusterVertices.concatenateLists(i,o),this.deleteCluster_(t),this.dbgCheckCluster_(e)}mergeEdges_(e,t){this.dbgCheckEdge_(e),this.dbgCheckEdge_(t);const s=this.getEdgeCluster(e,0),n=this.getEdgeCluster(e,1),r=this.getEdgeCluster(t,0),i=this.getEdgeCluster(t,1),o=this.getEdgeOriginVertices(e),a=this.getEdgeOriginVertices(t);if(this.m_edgeVertices.concatenateLists(o,a),t===this.getClusterFirstEdge(s)&&this.setClusterFirstEdge_(s,e),t===this.getClusterFirstEdge(n)&&this.setClusterFirstEdge_(n,e),this.disconnectEdge_(t),this.deleteEdge_(t),!(s===r&&n===i||n===r&&s===i)){const e=this.getClusterXY(s),t=this.getClusterXY(r);e.isEqualPoint2D(t)?(s!==r&&this.mergeClusters_(s,r),n!==i&&this.mergeClusters_(n,i)):(n!==r&&this.mergeClusters_(n,r),s!==i&&this.mergeClusters_(s,i))}this.dbgCheckEdge_(e)}disconnectEdge_(e){const t=this.getEdgeCluster(e,0),s=this.getEdgeCluster(e,1);this.disconnectEdgeFromCluster_(e,t),this.disconnectEdgeFromCluster_(e,s)}disconnectEdgeFromCluster_(e,t){const s=this.getNextEdge(e,t),n=this.getPrevEdge(e,t),r=this.getClusterFirstEdge(t);s!==e?(this.setNextEdge_(n,t,s),this.setPrevEdge_(s,t,n),r===e&&this.setClusterFirstEdge_(t,s)):this.setClusterFirstEdge_(t,-1)}applyIntersectorToEditShape_(e,t,s){let n=this.m_edgeVertices.getFirst(e);const r=this.m_edgeVertices.getElement(n),i=this.getClusterFromVertex(r),o=this.m_shape.getNextVertex(r),a=this.getClusterFromVertex(o),h=this.m_shape.getXY(r),m=this.m_shape.getXY(o);let l=!1,g=!1;const u=t.getResultSegment(s,0).getStartXY(),c=t.getResultSegment(s,t.getResultSegmentCount(s)-1).getEndXY();h.equals(u)||(l=!0),m.equals(c)||(g=!0),this.m_shape.splitSegmentWithIntersector(r,t,s,!0,!0);const _=this.m_bTrackChanges&&t.getSegmentChanged(s);for(_&&this.m_shape.setGeometryModifiedWithVertex(r,!0),n=this.m_edgeVertices.getNext(n);-1!==n;n=this.m_edgeVertices.getNext(n)){const e=this.m_edgeVertices.getElement(n),r=this.getClusterFromVertex(e)===i;this.m_shape.splitSegmentWithIntersector(e,t,s,r,!0),_&&this.m_shape.setGeometryModifiedWithVertex(e,!0)}if(l&&this.updateClusterXY(!0,i,u,t.getResultSegmentStartPointWeight(s,0),t.getResultSegmentStartPointRank(s,0)),g){const e=t.getResultSegmentCount(s)-1;this.updateClusterXY(!0,a,c,t.getResultSegmentEndPointWeight(s,e),t.getResultSegmentEndPointRank(s,e))}}createEdgesAndClustersFromSplitEdge_(e,t,s){this.dbgCheckNewEdgesArray_();const n=this.getEdgeOriginVertices(e),r=this.getEdgeCluster(e,0),i=this.getEdgeCluster(e,1);let o=this.newEdge_(-1);this.m_edgesToInsertInSweepStructure.push(o);const a=be.impossibleIndex3();this.setEdgeSweepNode_(o,a),this.m_tempEdgeBuffer.push(o),this.addEdgeToCluster(o,r);const h=t.getResultSegmentCount(s);for(let m=1;m<h;m++){const e=this.newCluster_(-1);this.m_modifiedClusters.push(e),this.m_tempEdgeBuffer.push(e),this.addEdgeToCluster(o,e);const t=this.newEdge_(-1);this.m_edgesToInsertInSweepStructure.push(t),this.setEdgeSweepNode_(t,a),this.m_tempEdgeBuffer.push(t),this.addEdgeToCluster(t,e),o=t}this.addEdgeToCluster(o,i);for(let m=this.m_edgeVertices.getFirst(n);-1!==m;m=this.m_edgeVertices.getNext(m)){let e=this.m_edgeVertices.getElement(m);if(this.getClusterFromVertex(e)===r){let t=0;const s=this.m_tempEdgeBuffer.length;do{if(t>0){const s=this.m_tempEdgeBuffer[t-1];this.addVertexToCluster_(s,e)}const s=this.m_tempEdgeBuffer[t];t+=2,this.addVertexToEdge_(s,e),e=this.m_shape.getNextVertex(e)}while(t<s)}else{let t=this.m_tempEdgeBuffer.length-1;do{if(t<this.m_tempEdgeBuffer.length-2){const s=this.m_tempEdgeBuffer[t+1];this.addVertexToCluster_(s,e)}const s=this.m_tempEdgeBuffer[t];t-=2,this.addVertexToEdge_(s,e),e=this.m_shape.getNextVertex(e)}while(t>=0)}}this.m_tempEdgeBuffer.length=0,this.dbgCheckNewEdgesArray_()}getVertexFromClusterIndex(e){const t=this.getClusterVertices(e);return this.m_clusterVertices.getFirstElement(t)}getClusterFromVertex(e){return this.m_shape.getUserIndex(e,this.m_vertexClusterIndex)}processSplitHelper1_(e,t,s){const n=this.getEdgeCluster(t,0),r=this.getClusterXY(n),i=this.getEdgeCluster(t,1),o=this.getClusterXY(i),a=s.getResultSegmentCount(e);let h=s.getResultSegment(e,0);const m=h.getStartXY();if(!r.isEqualPoint2D(m)){if(!this.m_bComplications){r.compare(this.m_sweepPoint)*m.compare(this.m_sweepPoint)<0&&(this.m_bComplications=!0)}this.getAffectedEdges(n,this.m_tempEdgeBuffer),this.m_modifiedClusters.push(n)}if(!this.m_bComplications&&a>1){const e=r.compare(o),t=h.getEndXY();(r.compare(t)!==e||t.compare(o)!==e||t.compare(this.m_sweepPoint)<0)&&(this.m_bComplications=!0)}h=s.getResultSegment(e,a-1);const l=h.getEndXY();if(!o.isEqualPoint2D(l)){if(!this.m_bComplications){o.compare(this.m_sweepPoint)*l.compare(this.m_sweepPoint)<0&&(this.m_bComplications=!0)}this.getAffectedEdges(i,this.m_tempEdgeBuffer),this.m_modifiedClusters.push(i)}this.m_tempEdgeBuffer.push(t);for(let g=0,u=this.m_tempEdgeBuffer.length;g<u;g++){const e=this.m_tempEdgeBuffer[g],s=this.getEdgeSweepNode(e);be.isValidElement(s)&&(this.m_sweepStructure.deleteNode(s),this.setEdgeSweepNode_(e,-1));const n=be.impossibleIndex3();e!==t&&this.getEdgeSweepNode(e)!==n&&(this.m_edgesToInsertInSweepStructure.push(e),this.setEdgeSweepNode_(e,n))}this.m_tempEdgeBuffer.length=0}checkAndFixIntersection_(e,t){const s=this.m_sweepStructure.getElement(e);return this.m_sweepComparator.compare(this.m_sweepStructure,s,t),!!this.m_sweepComparator.intersectionDetected()&&(this.m_sweepComparator.clearIntersectionDetectedFlag(),this.fixIntersection_(e,t),!0)}fixIntersection_(e,t){this.m_bCracked=!0;const n=this.m_sweepStructure.getElement(e),r=this.m_sweepStructure.getElement(t);let i=null,o=null;const a=this.getEdgeOriginVertices(n),h=this.m_edgeVertices.getFirstElement(a),m=this.getEdgeOriginVertices(r),l=this.m_edgeVertices.getFirstElement(m),g=this.m_shape.querySegment(h,this.m_segBuf1,!1,!1);s(g),i=this.m_segBuf1.get();const u=this.m_shape.getNextVertex(h),c=this.m_shape.getWeight(h),_=this.m_shape.getSegmentParentageBreakVertex(h),d=this.m_shape.getWeight(u),p=this.m_shape.getSegmentParentageBreakVertex(u),f=this.m_shape.getSegmentWeight(h),x=this.m_shape.getRank(h),y=this.m_shape.getRank(u),P=this.m_shape.getSegmentRank(h),E=this.m_shape.getSegmentParentage(h),S=this.m_shape.querySegment(l,this.m_segBuf2,!1,!1);s(S),o=this.m_segBuf2.get();const C=this.m_shape.getNextVertex(l),I=this.m_shape.getWeight(l),b=this.m_shape.getSegmentParentageBreakVertex(l),w=this.m_shape.getWeight(C),v=this.m_shape.getSegmentParentageBreakVertex(C),T=this.m_shape.getSegmentWeight(l),N=this.m_shape.getRank(l),G=this.m_shape.getRank(C),D=this.m_shape.getSegmentRank(l),V=this.m_shape.getSegmentParentage(l);this.m_segmentIntersector.pushSegment(i,c,x,d,y,f,P,_,p,E),this.m_segmentIntersector.pushSegment(o,I,N,w,G,T,D,b,v,V),3===this.m_segmentIntersector.intersect2D(this.m_tolerance,!0)&&(this.m_bComplications=!0),this.splitEdge_(n,r,-1,this.m_segmentIntersector),this.m_segmentIntersector.clear()}fixIntersectionPointSegment_(e,t){this.m_bCracked=!0;const n=this.m_sweepStructure.getElement(t);let r=null;const i=this.getEdgeOriginVertices(n),o=this.m_edgeVertices.getFirstElement(i),a=this.m_shape.querySegment(o,this.m_segBuf1,!1,!1);s(a),r=this.m_segBuf1.get();const h=this.m_shape.getNextVertex(o),m=this.m_shape.getWeight(o),l=this.m_shape.getSegmentParentageBreakVertex(o),g=this.m_shape.getWeight(h),u=this.m_shape.getSegmentParentageBreakVertex(h),c=this.m_shape.getSegmentWeight(o),_=this.m_shape.getRank(o),d=this.m_shape.getRank(h),p=this.m_shape.getSegmentRank(o),f=this.m_shape.getSegmentParentage(o),x=this.getClusterFirstVertex(e);this.m_segmentIntersector.pushSegment(r,m,_,g,d,c,p,l,u,f),this.m_shape.queryPoint(x,this.m_helperPoint);const y=this.m_shape.getWeight(x),P=this.m_shape.getRank(x);this.m_segmentIntersector.intersect2DEx(this.m_tolerance,this.m_helperPoint,P,y,!0),this.splitEdge_(n,-1,e,this.m_segmentIntersector),this.m_segmentIntersector.clear()}insertNewEdges_(){if(0===this.m_edgesToInsertInSweepStructure.length)return!0;this.dbgCheckNewEdgesArray_();let e=!0,t=0;const s=this.m_edgesToInsertInSweepStructure.length,n=Math.max(2*s+200,this.m_sweepStructure.size()+200);for(;this.m_edgesToInsertInSweepStructure.length;){if(this.m_edgesToInsertInSweepStructure.length>Math.max(100,this.m_shape.getTotalPointCount())||t>n){this.m_edgesToInsertInSweepStructure.length=0,this.m_bComplications=!0,e=!1;break}const s=this.m_edgesToInsertInSweepStructure.at(-1);this.m_edgesToInsertInSweepStructure.pop(),this.setEdgeSweepNode_(s,-1);const r=this.isEdgeOnSweepLine_(s);be.isValidElement(r)?(this.insertNewEdgeToSweepStructure_(s,r),t++):r!==be.impossibleIndex2()&&(e=!1),this.m_bContinuingSegmentChainOptimization=!1}return e}insertNewEdgeToSweepStructure_(e,t){let s;if(this.m_bContinuingSegmentChainOptimization?(s=this.m_sweepStructure.addElementAtPosition(this.m_prevNeighbour,this.m_nextNeighbour,e,!0,!0),this.m_bContinuingSegmentChainOptimization=!1):s=this.m_sweepStructure.addUniqueElement(e),-1===s){const t=this.m_sweepStructure.getDuplicateElement(),s=this.m_sweepStructure.getElement(t);return this.mergeEdges_(s,e),!1}if(this.setEdgeSweepNode_(e,s),this.m_sweepComparator.intersectionDetected()){this.m_sweepComparator.clearIntersectionDetectedFlag();const e=this.m_sweepComparator.getLastComparedNode();return this.m_prevNeighbour===e&&(this.m_prevNeighbour=-1),this.m_nextNeighbour===e&&(this.m_nextNeighbour=-1),this.fixIntersection_(e,s),!0}return!1}isEdgeOnSweepLine_(e){const t=this.getEdgeCluster(e,0),s=this.getEdgeCluster(e,1),n=this.getClusterXY(t),r=this.getClusterXY(s);if(We.sqrDistance(n,r)<=this.m_toleranceSqr)return this.m_bComplications=!0,-1;const i=n.compare(this.m_sweepPoint),o=r.compare(this.m_sweepPoint);return i<=0&&o>0?s:o<=0&&i>0?t:i>0&&o>0?be.impossibleIndex2():-1}fillEventQueue(){const e=new we(0),t=this.m_shape.queryVertexIteratorOnSelection();for(let r=t.next();r!==D;r=t.next())-1!==this.m_shape.getUserIndex(r,this.m_vertexClusterIndex)&&e.add(r);this.m_shape.sortVerticesSimpleByY(e,0,e.size()),this.progress_(!0),this.m_eventQ.clear(),this.m_eventQ.setCapacity(e.size()),this.m_eventQ.setComparator(new bn(this.m_shape));const s=We.getNAN();s.setNAN();let n=-1;for(let r=0,i=e.size();r<i;r++){const t=e.read(r);if(this.m_shape.getXY(t).isEqualPoint2D(s)){const e=this.m_shape.getUserIndex(t,this.m_vertexClusterIndex);this.mergeClusters_(n,e);continue}n=this.getClusterFromVertex(t),this.m_shape.queryXY(t,s);const i=this.m_eventQ.addBiggestElement(t);this.setClusterEventQNode_(n,i)}}fillEventQueuePass2(){const e=new we(0);for(let t=this.m_eventQ.getFirst();-1!==t;t=this.m_eventQ.getNext(t)){const s=this.m_eventQ.getElement(t);e.add(s)}this.m_eventQ.clear(),this.m_shape.sortVerticesSimpleByY(e,0,e.size()),this.progress_(!0);for(let t=0,s=e.size();t<s;t++){const s=e.read(t),n=this.getClusterFromVertex(s),r=this.m_eventQ.addBiggestElement(s);this.setClusterEventQNode_(n,r)}}getAffectedEdges(e,t){const s=this.getClusterFirstEdge(e);if(-1===s)return;let n=s;do{const s=this.getEdgeSweepNode(n);be.isValidElement(s)&&t.push(n),n=this.getNextEdge(n,e)}while(n!==s)}updateClusterXY(e,t,s,n,r){const i=this.getClusterVertices(t);for(let o=this.m_clusterVertices.getFirst(i);-1!==o;o=this.m_clusterVertices.getNext(o)){const t=this.m_clusterVertices.getElement(o);this.m_shape.setXYMonotonicPoint2D(t,s),this.m_shape.setWeight(t,n),this.m_shape.setRank(t,r),e&&this.m_bTrackChanges&&this.m_shape.setGeometryModifiedWithVertex(t,!0),this.m_shape.setSegmentParentageBreakVertex(t,!0)}}splitEdge_(e,t,s,n){this.dbgCheckEdge_(e),-1!==t&&this.dbgCheckEdge_(t),this.disconnectEdge_(e),-1!==t&&this.disconnectEdge_(t),this.processSplitHelper1_(0,e,n),-1!==t&&this.processSplitHelper1_(1,t,n),-1!==s&&n.getResultPointChanged()&&this.m_modifiedClusters.push(s);for(let o=0,a=this.m_modifiedClusters.length;o<a;o++){const e=this.m_modifiedClusters[o],t=this.getClusterEventQNode(e);-1!==t&&(this.m_eventQ.deleteNode(t),this.setClusterEventQNode_(e,-1))}const r=this.getEdgeOriginVertices(e),i=-1!==t?this.getEdgeOriginVertices(t):-1;if(this.applyIntersectorToEditShape_(r,n,0),-1!==i)this.applyIntersectorToEditShape_(i,n,1);else{const e=n.getResultPoint().getXY();this.updateClusterXY(n.getResultPointChanged(),s,e,n.getResultPointWeight(),n.getResultPointRank())}this.createEdgesAndClustersFromSplitEdge_(e,n,0),-1!==t&&this.createEdgesAndClustersFromSplitEdge_(t,n,1),this.m_edgeVertices.deleteList(r),this.deleteEdge_(e),-1!==t&&(this.m_edgeVertices.deleteList(i),this.deleteEdge_(t));for(let o=0,a=this.m_modifiedClusters.length;o<a;o++){const e=this.m_modifiedClusters[o];e===this.m_sweepPointCluster&&(this.m_bSweepPointClusterWasModified=!0);let t=this.getClusterEventQNode(e);if(-1===t){const s=this.getClusterFirstVertex(e);if(t=this.m_eventQ.addUniqueElement(s),-1===t){const t=this.m_eventQ.getDuplicateElement(),s=this.m_eventQ.getElement(t),n=this.getClusterFromVertex(s);this.mergeClusters_(n,e)}else this.setClusterEventQNode_(e,t)}}this.m_modifiedClusters.length=0}getClusterXY(e){const t=this.getClusterFirstVertex(e);return this.m_shape.getXY(t)}getClusterFirstVertex(e){const t=this.getClusterVertices(e);return this.m_clusterVertices.getFirstElement(t)}dbgCheckEdge_(e){}dbgCheckCluster_(e){}dbgCheckNewEdgesArray_(){}dbgSaveSweepStructure_(e){}sweepImpl_(){this.progress_(!0),this.m_bSweepPointClusterWasModified=!1,this.m_sweepPointCluster=-1,null===this.m_sweepComparator&&(this.m_sweepStructure.disableBalancing(),this.m_sweepComparator=new Cn(this),this.m_sweepStructure.setComparator(this.m_sweepComparator));const e=[];let t=null,s=null;this.m_prevNeighbour=-1,this.m_nextNeighbour=-1,this.m_bContinuingSegmentChainOptimization=!1;const n=be.impossibleIndex2(),r=be.impossibleIndex3();for(let i=this.m_eventQ.getFirst();-1!==i;){this.progress_(),this.dbgCheckSweepStructure_(),this.m_bContinuingSegmentChainOptimization=!1,this.m_prevNeighbour=-1,this.m_nextNeighbour=-1;const o=this.m_eventQ.getElement(i);this.m_sweepPointCluster=this.getClusterFromVertex(o),this.m_shape.queryXY(o,this.m_sweepPoint),this.m_sweepComparator.setSweepY(this.m_sweepPoint.y,this.m_sweepPoint.x);let a=!1;{const t=this.getClusterFirstEdge(this.m_sweepPointCluster);if(a=-1===t,!a){let s=t;do{const t=this.getEdgeSweepNode(s);-1===t?(this.m_edgesToInsertInSweepStructure.push(s),this.setEdgeSweepNode_(s,r)):t!==r&&e.push(t),s=this.getNextEdge(s,this.m_sweepPointCluster)}while(s!==t)}}if(!this.m_sweepStructure.isAutoBalancing()&&(this.m_sweepStructure.getMaxDepthEver()>4||this.m_edgesToInsertInSweepStructure.length>10)&&this.m_sweepStructure.enableBalancing(),e.length>0){this.m_bContinuingSegmentChainOptimization=1===e.length&&1===this.m_edgesToInsertInSweepStructure.length;for(let r=0,i=e.length;r<i;r++){const t=this.m_sweepStructure.getElement(e[r]);this.setEdgeSweepNode_(t,n)}let t=n,s=n;for(let r=0,i=e.length;r<i;r++){const i=e[r];if(t===n){const e=this.m_sweepStructure.getPrev(i);if(-1!==e){const s=this.m_sweepStructure.getElement(e);this.getEdgeSweepNode(s)!==n&&(t=e)}else t=-1}if(s===n){const e=this.m_sweepStructure.getNext(i);if(-1!==e){const t=this.m_sweepStructure.getElement(e);this.getEdgeSweepNode(t)!==n&&(s=e)}else s=-1}if(t!==n&&s!==n)break}for(let n=0,r=e.length;n<r;n++){const t=e[n],s=this.m_sweepStructure.getElement(t);this.m_sweepStructure.deleteNode(t),this.setEdgeSweepNode_(s,-1)}e.length=0,this.m_prevNeighbour=t,this.m_nextNeighbour=s,-1!==t&&-1!==s?this.m_bContinuingSegmentChainOptimization||this.checkAndFixIntersection_(t,s):-1===t&&-1===s&&(this.m_bContinuingSegmentChainOptimization=!1)}else a&&(null===t&&(t=new In(this)),t.setPoint(this.m_sweepPoint),this.m_sweepStructure.searchUpperBound(t),t.intersectionDetected()&&(t.clearIntersectionDetectedFlag(),this.fixIntersectionPointSegment_(this.m_sweepPointCluster,t.getCurrentNode())));const h=this.m_bContinuingSegmentChainOptimization;!this.insertNewEdges_()&&h&&-1!==this.m_prevNeighbour&&-1!==this.m_nextNeighbour&&this.checkAndFixIntersection_(this.m_prevNeighbour,this.m_nextNeighbour),this.m_bSweepPointClusterWasModified?(this.m_bSweepPointClusterWasModified=!1,null===s&&(s=new wn(this.m_shape)),s.setPoint(this.m_sweepPoint),i=this.m_eventQ.searchUpperBound(s)):i=this.m_eventQ.getNext(i)}return this.m_bCracked}setEditShape_(e){this.m_shape=e,this.m_vertexClusterIndex=this.m_shape.createUserIndex(),this.m_edges.setCapacity(e.getSelectedCount()+32),this.m_clusters.setCapacity(e.getSelectedCount()),this.m_clusterVertices.reserveLists(e.getSelectedCount()),this.m_clusterVertices.reserveNodes(e.getSelectedCount()),this.m_edgeVertices.reserveLists(e.getSelectedCount()+32),this.m_edgeVertices.reserveNodes(e.getSelectedCount()+32);for(let t=this.m_shape.getFirstGeometry();t!==D;t=this.m_shape.getNextGeometry(t)){if(c(this.m_shape.getGeometryType(t)))for(let s=this.m_shape.getFirstPath(t);s!==D;s=this.m_shape.getNextPath(s)){const t=this.m_shape.getPathSize(s),n=this.m_shape.getFirstVertex(s);if(n===D)continue;let r=this.m_shape.getNextVertex(n);if(r===D||r===n)continue;let i=-1;e.selected(n)&&(i=this.newCluster_(n));let o=-1;-1!==i&&e.selected(r)&&(o=this.newEdge_(n),this.addEdgeToCluster(o,i));let a=o;for(let e=0,s=t-2;e<s;e++){const e=this.m_shape.getNextVertex(r);let t=-1;if(this.m_shape.selected(r)){const s=this.newCluster_(r);-1!==a&&this.addEdgeToCluster(a,s),this.m_shape.selected(e)&&(t=this.newEdge_(r),this.addEdgeToCluster(t,s))}a=t,r=e}if(this.m_shape.isClosedPath(s)){const e=this.m_shape.getNextVertex(r);if(this.m_shape.selected(r)){const t=this.newCluster_(r);if(-1!==a&&this.addEdgeToCluster(a,t),this.m_shape.selected(e)){const e=this.newEdge_(r);this.addEdgeToCluster(e,t),this.addEdgeToCluster(e,i)}}}else{let e=-1;this.m_shape.selected(r)&&(e=this.newCluster_(r),-1!==a&&this.addEdgeToCluster(a,e))}}else for(let e=this.m_shape.getFirstPath(t);e!==D;e=this.m_shape.getNextPath(e)){let t=this.m_shape.getFirstVertex(e);for(let s=0,n=this.m_shape.getPathSize(e);s<n;s++)this.m_shape.selected(t)&&this.newCluster_(t),t=this.m_shape.getNextVertex(t)}}this.fillEventQueue()}progress_(e=!1){}dbgCheckSweepStructure_(){}}function Tn(e,t,s,n){s>0&&rn(e,s,t,!1,n);new Gn(n).executeImpl_(e,t)}function Nn(e,t,s){return{vertex0:e,vertex1:t,dir:s}}class Gn{constructor(e){this.m_shape=null,this.m_spikes=[],this.m_points=new we(0),this.m_pointsIndex=-1,this.m_dissolvedEdges=0,this.m_progressTracker=e}executeImpl_(e,t){if(this.m_shape=e,e.getPathCount(t)<2&&e.getPointCount(t)<6)return;this.m_points.resize(0);for(let s=e.getFirstPath(t);s!==D;s=e.getNextPath(s)){let t=e.getFirstVertex(s);for(let n=0,r=e.getPathSize(s);n<r;n++,t=e.getNextVertex(t))this.m_points.add(t)}this.m_pointsIndex=e.createUserIndex();for(let s=0,g=this.m_points.size();s<g;++s)e.setUserIndex(this.m_points.read(s),this.m_pointsIndex,s);e.sortVerticesSimpleByY(this.m_points,0,this.m_points.size());let n=this.m_points.read(0);const r=e.getXY(n);let i=1,o=0;const a=[];for(let s=1;s<this.m_points.size();s++){const t=this.m_points.read(s);if(t===D)continue;if(-1===e.getUserIndex(t,this.m_pointsIndex))continue;const h=e.getXY(t);if(h.isEqualPoint2D(r))i++;else{if(i>1){for(let t=o;t<s;t++){const s=this.m_points.read(t);if(-1===e.getUserIndex(s,this.m_pointsIndex))continue;const n=e.getNextVertex(s),i=e.getPrevVertex(s);if(s!==n&&!e.isEqualXYPoint2D(n,r)){const e=Nn(s,n,1);a.push(e)}if(s!==i&&i!==n&&!e.isEqualXYPoint2D(i,r)){const e=Nn(s,i,-1);a.push(e)}}a.length>0&&this.processBunch_(a,r)}n=t,r.assign(h),i=1,o=s}}if(0===this.m_dissolvedEdges)return e.removeUserIndex(this.m_pointsIndex),void(this.m_pointsIndex=-1);let h=e.getPointCount(t);for(let s=0;s<this.m_points.size();s++){const t=this.m_points.read(s);if(t===D)continue;if(-1!==e.getUserIndex(t,this.m_pointsIndex)){e.setUserIndex(t,this.m_pointsIndex,-1);continue}const n=e.getPathFromVertex(t);e.getFirstVertex(n)===t&&e.setFirstVertex(n,D),e.freeVertex(t),this.m_points.write(s,D),h--}const m=e.createPathUserIndex();let l=e.getPathCount(t);for(let g=0,u=this.m_points.size();g<u;++g){if(this.m_points.read(g)===D)continue;let n=this.m_points.read(g);if(-1!==e.getUserIndex(n,this.m_pointsIndex))continue;let r=e.getPathFromVertex(n),i=-1;if(2===e.getPathUserIndex(r,m)){r=D;for(let t=e.getNextVertex(n);t!==n;t=e.getNextVertex(t)){const s=e.getPathFromVertex(t);if(2!==e.getPathUserIndex(s,m)){r=s,n=t;break}}r===D&&(r=e.insertPath(t,D),e.setClosedPath(r,!0),l++),s(r!==D)}e.setPathUserIndex(r,m,2),i=e.getFirstVertex(r);let o=0,a=!1,h=n;do{i===h&&(a=!0),e.setUserIndex(h,this.m_pointsIndex,1);const t=e.getPathFromVertex(h);t!==r&&(2!==e.getPathUserIndex(t,m)&&(e.setPathUserIndex(t,m,1),e.setFirstVertex(t,D)),e.setPathToVertex(h,r)),o++,h=e.getNextVertex(h)}while(h!==n);a||e.setFirstVertex(r,n),e.setPathSize(r,o)}for(let s=e.getFirstPath(t);s!==D;){const t=e.getNextPath(s);1!==e.getPathUserIndex(s,m)&&e.getFirstVertex(s)!==D||(e.removePathOnly(s),l--),s=t}e.setGeometryVertexCount(t,h),e.setGeometryPathCount(t,l),e.removePathUserIndex(m),e.removeUserIndex(this.m_pointsIndex),this.m_pointsIndex=-1,e.dbgVerifyVertexCounts(),e.filterClosePoints(0,!0,!1,!1,t)}processBunch_(e,t){e.sort(((e,s)=>{const n=this.m_shape.getXY(e.vertex1).sub(t),r=this.m_shape.getXY(s.vertex1).sub(t),i=We.compareVectors(n,r);return 0===i?e.dir<s.dir?-1:1:i}));let s=0;const n=this.m_shape.getXY(e[0].vertex1);let r=1;const i=this.m_shape.hasCurves();for(let o=1,a=e.length;o<a;o++){const t=this.m_shape.getXY(e[o].vertex1);if(!(t.isEqualPoint2D(n)&&(r++,o+1<a))){if(2===r){const t=e[s],n=e[s+1],r=t.dir;if(r!==n.dir){let e=!0;if(i&&(e=!this.m_shape.isCurve(1===t.dir?t.vertex0:t.vertex1)&&!this.m_shape.isCurve(1===n.dir?n.vertex0:n.vertex1)),e){if(1===r){const e=t.vertex0,s=n.vertex0;this.m_shape.setNextVertex(e,s),this.m_shape.setPrevVertex(s,e),this.m_shape.getPrevVertex(e)===s&&(this.m_shape.setUserIndex(e,this.m_pointsIndex,-1),this.m_shape.setUserIndex(s,this.m_pointsIndex,-1));const r=t.vertex1,i=n.vertex1;this.m_shape.setPrevVertex(r,i),this.m_shape.setNextVertex(i,r),this.m_shape.getNextVertex(r)===i&&(this.m_shape.setUserIndex(r,this.m_pointsIndex,-1),this.m_shape.setUserIndex(i,this.m_pointsIndex,-1))}else{const e=t.vertex0,s=n.vertex0;this.m_shape.setPrevVertex(e,s),this.m_shape.setNextVertex(s,e),this.m_shape.getNextVertex(e)===s&&(this.m_shape.setUserIndex(e,this.m_pointsIndex,-1),this.m_shape.setUserIndex(s,this.m_pointsIndex,-1));const r=t.vertex1,i=n.vertex1;this.m_shape.setNextVertex(r,i),this.m_shape.setPrevVertex(i,r),this.m_shape.getPrevVertex(r)===i&&(this.m_shape.setUserIndex(r,this.m_pointsIndex,-1),this.m_shape.setUserIndex(i,this.m_pointsIndex,-1))}this.m_dissolvedEdges+=2}}}n.assign(t),s=o,r=1}}e.length=0}}function Dn(e){for(let t=e.getFirstGeometry();t!==D;t=e.getNextGeometry(t))if(c(e.getGeometryType(t)))return!0;return!1}function Vn(e,t,s,n){if(!Dn(e))return!1;const r=new An(n);r.m_shape=e,r.m_tolerance=t,r.m_bTrackChanges=s;let i=!1;const o=e.hasCurves()?5:15;return i=e.getTotalPointCount()<o?r.crackBruteForce_():r.crackerPlaneSweep_(),i}function Fn(e,t,s,n,r){if(!Dn(t))return!1;let i=new An(r);if(i.m_shape=t,i.m_tolerance=s,i.m_bAllowCoincident=e,i.m_bNeedsNonSimpleResult=null!==n,i.needsCrackingImpl_())return n&&n.assign(i.m_nonSimpleResult),!0;const o=new Xt;o.setSwapCoordinates(),t.applyTransformation(o),i=new An(r),i.m_shape=t,i.m_tolerance=s,i.m_bAllowCoincident=e,i.m_bNeedsNonSimpleResult=null!==n;const a=i.needsCrackingImpl_();return t.applyTransformation(o),!!a&&(n&&n.assign(i.m_nonSimpleResult),!0)}function Hn(e,t,s,n){const r=t.getGeometryType();if(c(r)){return new An(n).crackAWithBMultiPath_(e,t,s)}h("crack_A_with_B")}function kn(e,t){return{t:e,index:t}}class An{crackBruteForce_(){let e=this.crackBruteForceImpl_();if(!e&&this.m_shape.hasCurves()){const t=new Xt;t.setSwapCoordinates(),this.m_shape.applyTransformation(t),e=this.crackBruteForceImpl_(),this.m_shape.applyTransformation(t)}return e}crackBruteForceImpl_(){let t=!1;const n=new b,r=new b,o=e.constructEmpty(),a=e.constructEmpty(),h=!1,m=new ae,l=new _n,g=this.m_shape.getTotalPointCount(),u=g*g*2,c=this.m_shape.queryVertexIteratorOnSelection();for(let e=c.next();e!==D;e=c.next()){const g=this.m_shape.getGeometryType(c.currentGeometry());let _=1,d=1,p=1,f=0,x=0,y=0;const P=this.m_shape.getSegmentParentage(e);let E=!1,S=!1,C=null,I=!1;if(i(g))_=this.m_shape.getWeight(e),f=this.m_shape.getRank(e);else{if(C=this.getSegment_(e,n),null===C)continue;const t=this.m_shape.getVertexIndex(e);_=this.m_shape.getWeightWithIndex(t),f=this.m_shape.getRankWithIndex(t),p=this.m_shape.getSegmentWeightWithIndex(t),y=this.m_shape.getSegmentRankWithIndex(t),E=this.m_shape.getSegmentParentageBreakVertex(e);{const t=this.m_shape.getNextVertex(e);d=this.m_shape.getWeight(t),x=this.m_shape.getRank(t),S=this.m_shape.getSegmentParentageBreakVertex(t)}if(C.queryLooseEnvelope(o),o.inflateCoords(this.m_tolerance,this.m_tolerance),C.isDegenerate(this.m_tolerance)){if(!C.isDegenerate(0))continue;I=!0,C=null}}const b=new J({copy:c});let w=b.next();w!==D&&(w=b.next());let v=0;for(;w!==D;w=b.next()){if(0!==v){v--;continue}if(this.m_shape.getTotalPointCount()>u)return t;this.progress_();const g=this.m_shape.getGeometryType(b.currentGeometry());let T=null,N=!1,G=0,V=0,F=0,H=0,k=0,A=0,M=!1,U=!1;const q=this.m_shape.getSegmentParentage(w);if(i(g))G=this.m_shape.getWeight(w),H=this.m_shape.getRank(w);else{if(T=this.getSegment_(w,r),null===T)continue;const e=this.m_shape.getVertexIndex(w);G=this.m_shape.getWeightWithIndex(e),H=this.m_shape.getRankWithIndex(e),F=this.m_shape.getSegmentWeightWithIndex(e),A=this.m_shape.getSegmentRankWithIndex(e),M=this.m_shape.getSegmentParentageBreakVertex(w);{const e=this.m_shape.getNextVertex(w);V=this.m_shape.getWeight(e),k=this.m_shape.getRank(e),U=this.m_shape.getSegmentParentageBreakVertex(e)}if(T.queryLooseEnvelope(a),T.isDegenerate(this.m_tolerance)){if(!T.isDegenerate(0))continue;N=!0,T=null}}let O=0,B=0;if(null!==C&&null!==T){if(o.isIntersectingNe(a)){0!==$(!0,!0,C,T,this.m_tolerance,!0)&&(l.pushSegment(C,_,f,d,x,p,y,E,S,P),l.pushSegment(T,G,H,V,k,F,A,M,U,q),l.intersect2D(this.m_tolerance,!0),t||=l.getSegmentChanged(0)||l.getSegmentChanged(1),O=l.getResultSegmentCount(0),B=l.getResultSegmentCount(1),O+B>0&&(this.m_shape.splitSegmentWithIntersector(e,l,0,!0,!0),this.m_shape.splitSegmentWithIntersector(w,l,1,!0,!0),this.m_bTrackChanges&&(l.getSegmentChanged(0)&&this.m_shape.setGeometryModifiedWithVertex(e,!0),l.getSegmentChanged(1)&&this.m_shape.setGeometryModifiedWithVertex(w,!0))),B>1&&(v+=B-1),l.clear())}}else if(null!==C){const s=this.m_shape.getXY(w);if(o.contains(s)){if(l.pushSegment(C,_,f,d,x,p,y,E,S,P),this.m_shape.queryPoint(w,m),l.intersect2DEx(this.m_tolerance,m,H,G,h),t||=l.getSegmentChanged(0)||l.getResultPointChanged(),O=l.getResultSegmentCount(0),O>0)if(this.m_bTrackChanges&&(l.getSegmentChanged(0)&&this.m_shape.setGeometryModifiedWithVertex(e,!0),l.getSegmentChanged(1)&&this.m_shape.setGeometryModifiedWithVertex(w,!0)),this.m_shape.splitSegmentWithIntersector(e,l,0,!0,!0),N){let e=D;for(let t=this.m_shape.getNextVertex(w);t!==D&&t!==w&&(T=this.getSegment_(t,r),e=t,null!=T&&T.isDegenerate(0));t=this.m_shape.getNextVertex(t));for(let t=w;t!==D&&(this.m_shape.setPoint(t,l.getResultPoint(),!0),t!==e);t=this.m_shape.getNextVertex(t));}else this.m_shape.setPoint(w,l.getResultPoint(),!0);l.clear()}}else{if(null===T)continue;{const s=this.m_shape.getXY(e);if(a.inflateCoords(this.m_tolerance,this.m_tolerance),a.contains(s)){if(l.pushSegment(T,G,H,V,k,F,A,M,U,q),this.m_shape.queryPoint(e,m),l.intersect2DEx(this.m_tolerance,m,f,_,h),t||=l.getSegmentChanged(0)||l.getResultPointChanged(),B=l.getResultSegmentCount(0),B>0)if(this.m_bTrackChanges&&(l.getSegmentChanged(0)&&this.m_shape.setGeometryModifiedWithVertex(w,!0),l.getSegmentChanged(1)&&this.m_shape.setGeometryModifiedWithVertex(e,!0)),this.m_shape.splitSegmentWithIntersector(w,l,0,!0,!0),v+=B-1,I){let t=D;for(let s=this.m_shape.getNextVertex(e);s!==D&&s!==e&&(T=this.getSegment_(s,r),t=s,null!=T&&T.isDegenerate(0));s=this.m_shape.getNextVertex(s));for(let s=e;s!==D&&(this.m_shape.setPoint(s,l.getResultPoint(),!0),s!==t);s=this.m_shape.getNextVertex(s));}else this.m_shape.setPoint(e,l.getResultPoint(),!0);l.clear()}}}if(O+B!==0&&0!==O){let t=!1;for(;C=this.getSegment_(e,n),null!=C&&(C.queryEnvelope(o),C.isDegenerate(this.m_tolerance));){if(!(O>1)){t=!0;break}e=c.next(),O--,s(e!==D)}if(t)break}}}return t}crackerPlaneSweep_(){return this.planesweep_()}planesweep_(){return new vn(this.m_progressTracker,this.m_bTrackChanges).sweep(this.m_shape,this.m_tolerance)}needsCrackingImpl_(){let e=!1;const t=new we(0);t.resize(this.m_shape.getSelectedCount());const s=this.m_shape.queryVertexIteratorOnSelection();for(let l=0,g=s.next();g!==D;++l,g=s.next())t.write(l,g);this.m_shape.sortVerticesSimpleByY(t,0,t.size()),t.add(D);const n=this.m_shape.createUserIndex(),r=this.m_shape.createUserIndex();this.m_sweepComparator=new tn(this.m_shape,this.m_tolerance,!this.m_bAllowCoincident),this.m_sweepStructure.setComparator(this.m_sweepComparator);let i=null;const o=[],a=[];let h=0;const m=new We;for(let g=t.read(h++);g!==D;){this.m_shape.queryXY(g,m);let s=!1;do{let e=this.m_shape.getNextVertex(g),i=this.m_shape.getPrevVertex(g);s||=e!==D||i!==D,e===D||this.m_shape.selected(e)||(e=D),i===D||this.m_shape.selected(i)||(i=D),e!==D&&this.m_shape.compareVerticesSimpleY(g,e)<0&&(a.push(g),a.push(e)),i!==D&&this.m_shape.compareVerticesSimpleY(g,i)<0&&(a.push(i),a.push(i));const m=this.m_shape.getUserIndex(g,n);-1!==m&&(o.push(m),this.m_shape.setUserIndex(g,n,-1));const l=this.m_shape.getUserIndex(g,r);-1!==l&&(o.push(l),this.m_shape.setUserIndex(g,r,-1)),g=t.read(h++)}while(g!==D&&this.m_shape.isEqualXYPoint2D(g,m));if(!s&&(null===i&&(i=new sn(this.m_shape,this.m_tolerance)),i.setPoint(m),this.m_sweepStructure.searchUpperBound(i),i.intersectionDetected())){e=!0,this.m_bNeedsNonSimpleResult&&(l("needsCrackingIMpl_"),this.m_nonSimpleResult=new $t(6,-1,-1));break}let u=1===o.length&&2===a.length;const c=32;o.length>c&&et(o);let _=-1,d=-1;if(!u)for(let t=0,n=o.length;t<n;t++){const s=o[t],n=this.m_sweepStructure.getPrev(s);if(-1!==n&&-1===o.indexOf(n))if(-1===_)_=n;else{if(e=!0,!this.m_bNeedsNonSimpleResult)break;this.m_nonSimpleResult=new $t(6,-1,-1)}const r=this.m_sweepStructure.getNext(s);if(-1!==r&&-1===o.indexOf(r))if(-1===d)d=r;else{if(e=!0,!this.m_bNeedsNonSimpleResult)break;this.m_nonSimpleResult=new $t(6,-1,-1)}if(-1!==_&&-1!==d)break}if(e&&!this.m_bNeedsNonSimpleResult)break;if(this.m_sweepComparator.setSweepY(m.y,m.x),!u){for(let e=0,t=o.length;e<t;e++){const t=o[e];this.m_sweepStructure.deleteNode(t)}o.length=0}if(!u&&-1!==_&&-1!==d&&this.checkForIntersections_(_,d)){e=!0,this.m_bNeedsNonSimpleResult&&(this.m_nonSimpleResult=this.m_sweepComparator.getResult());break}for(let t=0,i=a.length;t<i;t+=2){const s=a[t],i=a[t+1];let h;if(u?(h=this.m_sweepStructure.replaceElementAtPosition(o[0],s,!0,!0),o.length=0,u=!1):h=this.m_sweepStructure.addElement(s),this.m_sweepComparator.intersectionDetected()){this.m_bNeedsNonSimpleResult&&(this.m_nonSimpleResult=this.m_sweepComparator.getResult()),e=!0;break}-1===this.m_shape.getUserIndex(i,n)?this.m_shape.setUserIndex(i,n,h):this.m_shape.setUserIndex(i,r,h)}if(e)break;a.length=0}return this.m_shape.removeUserIndex(n),this.m_shape.removeUserIndex(r),e}checkForIntersections_(e,t){const s=this.m_sweepStructure.getElement(e);this.m_sweepComparator.compare(this.m_sweepStructure,s,t);const n=this.m_sweepComparator.intersectionDetected();return this.m_sweepComparator.clearIntersectionDetectedFlag(),n}getSegment_(e,t){return An.st_getSegment(this.m_shape,e,t)}static st_getSegment(e,t,s){return e.querySegment(t,s,!1,!1)?s.get():null}dbgPrintSweepEdge(e){}dbgPrintSweepStructure(){}dbgSaveSweepStructure(e=null){}dbgCheckSweepStructure(){}progress_(e=!1){this.m_progressCounter++}crackAWithBMultiPath_(t,n,r){const i=e.constructEmpty();t.queryLooseEnvelope(i);const a=e.constructEmpty();if(n.queryLooseEnvelope(a),a.inflateCoords(r,r),!a.isIntersecting(i))return t;const h=t.getImpl(),m=h.getAccelerators();let l=null,u=null;m&&(u=m.getQuadTree()),Mn(t,g(n))&&(l=ce(h,a),u=l);const c=u?u.getIteratorForQT():null,_=n.querySegmentIterator(),d=t.querySegmentIterator(),p=new Array(15),f=[];for(;_.nextPath();)for(;_.hasNextSegment();){const t=_.nextSegment();if(u){c.resetIterator(t,r);for(let e=c.next();-1!==e;e=c.next()){this.progress_();const s=u.getElement(e);if(d.resetToVertex(s,-1),d.hasNextSegment()){const e=d.nextSegment().intersect(t,null,p,null,r);for(let t=0;t<e;t++){const e=p[t];if(0===e||1===e)continue;const s=kn(e,d.getStartPointIndex());f.push(s)}}}}else{const s=e.constructEmpty();if(t.queryLooseEnvelope(s),s.inflateCoords(r,r),!i.isIntersecting(s))continue;for(d.resetToFirstPath();d.nextPath();)for(;d.hasNextSegment();){const n=d.nextSegment(),i=e.constructEmpty();if(n.queryLooseEnvelope(i),!i.isIntersecting(s))continue;const o=n.intersect(t,null,p,null,r);for(let e=0;e<o;e++){const t=p[e];if(0===t||1===t)continue;const s=kn(t,d.getStartPointIndex());f.push(s)}}}}if(0===f.length)return t;f.sort(((e,t)=>e.index<t.index?-1:e.index>t.index?1:e.t<t.t?-1:e.t>t.t?1:0));const x=t.createInstance();if(x.getGeometryType()===o.enumPolygon){x.setFillRule(t.getFillRule())}for(d.resetToFirstPath();d.nextPath()&&!d.hasNextSegment(););s(d.hasNextSegment());let y=d.nextSegment();const P=new b;let E=-1;for(let e=0,o=f.length;e<o;){const t=f[e].index;let n=e+1;for(;n<o&&f[n].index===t;)++n;for(;d.getStartPointIndex()<t;){this.progress_();const e=d.hasNextSegment(),t=d.getPathIndex();if((e||!d.isClosingSegment()||d.isCurve())&&(s(null!==y),x.addSegment(y,E!==t)),E=t,!e){for(d.isPathClosed();d.nextPath()&&!d.hasNextSegment(););s(d.hasNextSegment())}y=d.nextSegment()}let r=0;for(let o=e;o<n;o++){const e=f[o].t;if(e===r)continue;s(null!==y),y.queryCut(r,e,P),r=e;const t=d.getPathIndex();x.addSegment(P.get(),E!==t),E=t}const i=d.hasNextSegment();if((i||!d.isClosingSegment()||d.isCurve())&&(s(null!=y),y.queryCut(r,1,P),x.addSegment(P.get(),!1)),i)y=d.nextSegment();else{for(;d.nextPath()&&!d.hasNextSegment(););y=d.hasNextSegment()?d.nextSegment():null}e=n}if(null!==y){const e=d.getPathIndex();(d.hasNextSegment()||!d.isClosingSegment()||d.isCurve())&&x.addSegment(y,E!==e),E=e}let S=d.hasNextSegment();for(;;){if(!S){for(;d.nextPath()&&(S=d.hasNextSegment(),!S););if(!S)break}y=d.nextSegment();const e=d.getPathIndex();S=d.hasNextSegment();(S||!d.isClosingSegment()||d.isCurve())&&x.addSegment(y,E!==e),E=e}return x}constructor(e){this.m_shape=null,this.m_progressTracker=null,this.m_nonSimpleResult=new $t,this.m_tolerance=0,this.m_sweepComparator=null,this.m_progressCounter=0,this.m_bTrackChanges=!1,this.m_bNeedsNonSimpleResult=!1,this.m_bAllowCoincident=!0,this.m_sweepStructure=new Te,this.m_progressTracker=e}}function Mn(e,t){const s=e.getPointCount();if(s<16)return!1;const n=1;return 2*s+1*(Math.log(s)/Math.log(2))*t<n*s*t}An.s_bForceBruteForce=!0;class Un{constructor(e,t){this.m_monotoneParts=lt(b,16),this.m_xOrds=$e(16,Number.NaN),this.m_inputPoint=We.getNAN(),this.m_miny=0,this.m_maxy=0,this.m_windnum=0,this.m_bAlternate=e,this.m_tolerance=t,this.m_toleranceSqr=t*t,this.m_bTestBorder=!!t,this.m_bBreak=!1}_DoOne(e){if(!this.m_bTestBorder&&(this.m_bAlternate&&this.m_inputPoint.equals(e.getStartXY())||this.m_inputPoint.equals(e.getEndXY())))return void(this.m_bBreak=!0);if(e.getStartY()===this.m_inputPoint.y&&e.getStartY()===e.getEndY()){if(this.m_bAlternate&&!this.m_bTestBorder){const t=Math.min(e.getStartX(),e.getEndX()),s=Math.max(e.getStartX(),e.getEndX());this.m_inputPoint.x>t&&this.m_inputPoint.x<s&&(this.m_bBreak=!0)}return}let t=!1;const s=Math.max(e.getStartX(),e.getEndX());if(this.m_inputPoint.x>s)t=!0;else if(this.m_inputPoint.x>=Math.min(e.getStartX(),e.getEndX())){const n=e.intersectionOfYMonotonicWithAxisX(this.m_inputPoint.y,s);t=!Number.isNaN(n)&&n<=this.m_inputPoint.x}if(t){if(this.m_inputPoint.y===e.getStartY()){if(this.m_inputPoint.y<e.getEndY())return}else if(this.m_inputPoint.y===e.getEndY()&&this.m_inputPoint.y<e.getStartY())return;this.m_bAlternate?this.m_windnum^=1:this.m_windnum+=e.getStartY()>e.getEndY()?1:-1}}_Result(){return!!this.m_windnum}testBorder(e){const t=e.getClosestCoordinate(this.m_inputPoint,!1),s=e.getCoord2D(t);return We.sqrDistance(s,this.m_inputPoint)<=this.m_toleranceSqr}setInputPoint(e){this.m_inputPoint.setCoordsPoint2D(e),this.m_miny=e.y-this.m_tolerance,this.m_maxy=e.y+this.m_tolerance}processSegment(e){const t=e.queryInterval(0,1);if(t.vmin>this.m_maxy||t.vmax<this.m_miny)return!1;if(this.m_bTestBorder&&this.testBorder(e))return!0;if(t.vmin>this.m_inputPoint.y||t.vmax<this.m_inputPoint.y)return!1;let n=0;if(e.isCurve()&&(0===this.m_monotoneParts.length&&(this.m_monotoneParts.length=128),n=e.getMonotonicParts(this.m_monotoneParts,!0),s(this.m_monotoneParts.length>=n)),n>0)for(let s=0;s<n;s++){const e=this.m_monotoneParts[s].get(),t=Ke.construct(e.getStartY(),e.getEndY());if(!(t.vmin>this.m_inputPoint.y||t.vmax<this.m_inputPoint.y)&&(this._DoOne(e),this.m_bBreak))return!0}else if(this._DoOne(e),this.m_bBreak)return!0;return!1}result(){return s(0),2}}function qn(t,s,n,r){const i=new e;t.queryLooseEnvelope(i),i.inflateCoords(r,r);const o=0===t.getFillRule(),a=new Un(o,r);a.setInputPoint(n);const h=i.clone();h.xmax=n.x+r,h.ymin=n.y-r,h.ymax=n.y+r;const m=t.getImpl().querySegmentIterator(),l=s.getIterator(h,r);for(let e=l.next();-1!==e;e=l.next())if(m.resetToVertex(s.getElement(e),-1),m.hasNextSegment()){const e=m.nextSegment();if(a.processSegment(e))return-1}return a._Result()?1:0}function On(e,t,s){const n=0===e.getFillRule(),r=new Un(n,s);r.setInputPoint(t);const i=e.getImpl().querySegmentIterator();for(;i.nextPath();)for(;i.hasNextSegment();){const e=i.nextSegment();if(r.processSegment(e))return-1}return r._Result()?1:0}function Bn(e,t,s){return t.isEmpty()?0:Rn(e,t.getXY(),s)}function Rn(t,n,r){if(t.isEmpty())return 0;const i=e.constructEmpty();if(t.queryLooseEnvelope(i),i.inflateCoords(r,r),!i.contains(n))return 0;const o=t.getImpl().getAccelerators();if(o){o.getRasterizedGeometry()&&s(0);const e=o.getQuadTree();if(e)return qn(t,e,n,r)}return On(t,n,r)}function Yn(e,t){const s=e.getPointCount();if(s<16)return!1;const n=1;return 2*s+1*(Math.log(s)/Math.log(2))*t<n*s*t}function Xn(e,t,s,n,r){const i=new Zn(r);return i.m_shape=e,i.m_geometry=t,i.m_sortedVertices=s,i.m_bFixSelfTangency=n,i.fixRingOrientation_()}function Ln(e,t,s){const n=new Zn(s);return n.m_shape=e,n.m_geometry=t,n.m_sortedVertices=null,n.m_bFixSelfTangency=!1,n.fixRingOrientationForMp2sp_()}class zn{getDirection_(e){return this.m_shape.getNextVertex(this.getEnd1(e))===this.getEnd2(e)}getEnd_(e){const t=this.getEnd1(e),s=this.getEnd2(e);return this.m_shape.getNextVertex(t)===s?s:t}constructor(e){this.m_end1Nodes=[],this.m_end2Nodes=[],this.m_directions=[],this.m_shape=e,this.m_firstFree=-1}getSegment(e){return this.m_shape.getSegment(this.getStart(e))}isBottomUp(e){let t=this.getEnd1(e),n=this.getEnd2(e);this.m_shape.getPrevVertex(t)===n&&(n=gt(t,t=n));const r=We.getNAN(),i=We.getNAN();return this.m_shape.queryXY(t,r),this.m_shape.queryXY(n,i),s(!r.equals(i)),r.y<i.y}getStart(e){const t=this.getEnd1(e),s=this.getEnd2(e);return this.m_shape.getNextVertex(t)===s?t:s}getEnd1(e){return this.m_end1Nodes[e]}getEnd2(e){return this.m_end2Nodes[e]}freeEdge(e){this.m_end1Nodes[e]=this.m_firstFree,this.m_firstFree=e}newEdge(e){if(-1!==this.m_firstFree){const t=this.m_firstFree;return this.m_firstFree=this.m_end1Nodes[t],this.m_end1Nodes[t]=e,this.m_end2Nodes[t]=this.m_shape.getNextVertex(e),t}const t=this.m_end1Nodes.length;return this.m_end1Nodes.push(e),this.m_end2Nodes.push(this.m_shape.getNextVertex(e)),t}getShape(){return this.m_shape}getPath(e){return this.m_shape.getPathFromVertex(this.getEnd1(e))}}let Wn=class extends Xe{constructor(e){super(),this.m_line1=new V,this.m_line2=new V,this.m_leftElm=-1,this.m_leftx=0,this.m_seg1=null,this.m_helper=e}compare(e,t,s){const n=e.getElement(s),r=this.m_helper.m_edges;let i;if(this.m_leftElm===t)i=this.m_leftx;else{if(this.m_seg1=r.getSegment(t),this.m_seg1)i=this.m_seg1.intersectionOfYMonotonicWithAxisX(this.m_helper.m_yScanline,0);else{r.getShape().queryLineConnector(r.getStart(t),this.m_line1,!0),this.m_seg1=this.m_line1,i=this.m_line1.intersectionOfYMonotonicWithAxisX(this.m_helper.m_yScanline,0)}this.m_leftx=i,this.m_leftElm=t}let o,a=r.getSegment(n);if(a)o=a.intersectionOfYMonotonicWithAxisX(this.m_helper.m_yScanline,0);else{r.getShape().queryLineConnector(r.getStart(n),this.m_line2,!0),a=this.m_line2,o=this.m_line2.intersectionOfYMonotonicWithAxisX(this.m_helper.m_yScanline,0)}if(i===o){const e=r.isBottomUp(t),s=r.isBottomUp(n),h=e?this.m_seg1.getEndY():this.m_seg1.getStartY(),m=s?a.getEndY():a.getStartY(),l=Math.min(h,m);let g=.5*(l+this.m_helper.m_yScanline);g===this.m_helper.m_yScanline&&(g=l),i=this.m_seg1.intersectionOfYMonotonicWithAxisX(g,0),o=a.intersectionOfYMonotonicWithAxisX(g,0),i===o&&S("")}return i<o?-1:i>o?1:0}reset(){this.m_leftElm=-1}};class jn{constructor(e){this.m_node=-1,this.m_index=0,this.m_sortedVertices=e.m_sortedVertices,this.m_sortedVerticesArray=e.m_sortedVerticesArray,this.m_sortedVertices&&(this.m_node=this.m_sortedVertices.getFirst(this.m_sortedVertices.getFirstList()))}next(){if(this.m_sortedVertices){const e=this.m_node;if(-1===e)return D;const t=this.m_sortedVertices.getData(e);return this.m_node=this.m_sortedVertices.getNext(e),t}if(this.m_index<this.m_sortedVerticesArray.size()){const e=this.m_sortedVerticesArray.read(this.m_index);return this.m_index++,e}return D}}class Zn{constructor(e){this.m_edges=null,this.m_shape=null,this.m_AET=new Te,this.m_yScanline=0,this.m_geometry=D,this.m_unknownRingOrientationCount=-1,this.m_sortedVertices=null,this.m_sortedVerticesArray=null,this.m_unknownNodes=[],this.m_node1UserIndex=-1,this.m_node2UserIndex=-1,this.m_pathOrientationIndex=-1,this.m_pathParentageIndex=-1,this.m_pathParentsIndex=-1,this.m_progressCounter=0,this.m_bFixSelfTangency=!1,this.m_progressTracker=e,this.m_AET.disableBalancing(),this.m_sweepComparator=new Wn(this),this.m_AET.setComparator(this.m_sweepComparator)}fixRingOrientation_(){const e=this.fixRingOrientationImplMain_();return-1===this.m_pathOrientationIndex||this.fixRingOrientationImplSimplify_(),e}fixRingOrientationForMp2sp_(){return this.fixRingOrientationImplMain_(),-1===this.m_pathOrientationIndex?-1:this.fixRingOrientationImplMp2sp_()}processBunchForRingOrientationTest_(e){return this.processBunchForRingOrientationTestOddEven_(e)}processBunchForRingOrientationTestOddEven_(e){let t=!1;if(this.m_edges||(this.m_edges=new zn(this.m_shape)),this.m_unknownNodes.length=0,this.processBunchForRingOrientationRemoveEdges_(e),!this.m_AET.isAutoBalancing()){let t=0;for(let s=0,n=e.length;s<n;s++){-1!==e[s]&&t++}(t>10||this.m_AET.getMaxDepthEver()>4)&&this.m_AET.enableBalancing()}for(let s=0,n=e.length;s<n;s++){const t=e[s];t!==D&&this.insertEdge_(t,-1)}for(let n=0;n<this.m_unknownNodes.length&&this.m_unknownRingOrientationCount>0;n++){const e=this.m_unknownNodes[n],r=this.m_AET.getElement(e),i=this.m_edges.getPath(r),o=this.m_shape.getPathUserIndex(i,this.m_pathOrientationIndex);let a=D;if(0===o){let n=this.m_AET.getPrev(e),r=e,i=!1;for(;n!==Te.st_nullNode();){const e=this.m_AET.getElement(n),t=this.m_edges.getPath(e);if(0!==this.m_shape.getPathUserIndex(t,this.m_pathOrientationIndex)){a=t;break}r=n,n=this.m_AET.getPrev(n)}if(n===Te.st_nullNode())i=!0,n=r;else{const e=this.m_AET.getElement(n);i=this.m_edges.isBottomUp(e),n=this.m_AET.getNext(n),i=!i}do{const e=this.m_AET.getElement(n),o=this.m_edges.getPath(e);if(0===this.m_shape.getPathUserIndex(o,this.m_pathOrientationIndex)){if(i!==this.m_edges.isBottomUp(e)){const e=this.m_shape.getFirstVertex(o);this.m_shape.reverseRingInternal(e),this.m_shape.setLastVertex(o,this.m_shape.getPrevVertex(e)),t=!0}if(this.m_shape.setPathUserIndex(o,this.m_pathOrientationIndex,i?3:2),!i){let e=this.m_shape.getPathUserIndex(a,this.m_pathOrientationIndex);2===e?(a=this.m_shape.getPathUserIndex(a,this.m_pathParentsIndex),e=this.m_shape.getPathUserIndex(a,this.m_pathOrientationIndex),s(3===e)):s(3===e);const t=this.m_shape.getPathUserIndex(a,this.m_pathParentageIndex);this.m_shape.setPathUserIndex(a,this.m_pathParentageIndex,o),this.m_shape.setPathUserIndex(o,this.m_pathParentageIndex,t),this.m_shape.setPathUserIndex(o,this.m_pathParentsIndex,a)}if(this.m_unknownRingOrientationCount--,!this.m_unknownRingOrientationCount)return t}a=o,r=n,n=this.m_AET.getNext(n),i=!i}while(r!==e)}}return t}processBunchForRingOrientationRemoveEdges_(e){for(let t=0,s=e.length;t<s;t++){const s=e[t],n=this.m_shape.getUserIndex(s,this.m_node1UserIndex),r=this.m_shape.getUserIndex(s,this.m_node2UserIndex);if(-1!==n){const e=this.m_AET.getElement(n);this.m_edges.freeEdge(e),this.m_shape.setUserIndex(s,this.m_node1UserIndex,-1)}if(-1!==r){const e=this.m_AET.getElement(r);this.m_edges.freeEdge(e),this.m_shape.setUserIndex(s,this.m_node2UserIndex,-1)}let i=-1;-1!==n&&-1!==r?(this.m_AET.deleteNode(n),this.m_AET.deleteNode(r),e[t]=D):i=-1!==n?n:r,-1!==i&&(this.insertEdge_(s,i)||this.m_AET.deleteNode(i),e[t]=D)}}dbgVerifyRingOrientation_(){}insertEdge_(e,t){const s=We.getNAN(),n=We.getNAN();this.m_shape.queryXY(e,s);const r=this.m_shape.getNextVertex(e);this.m_shape.queryXY(r,n);let i=!1;if(s.y<n.y){i=!0;const s=this.m_edges.newEdge(e);let n;-1===t?n=this.m_AET.addElement(s):(n=t,this.m_AET.setElement(n,s));-1===this.m_shape.getUserIndex(r,this.m_node1UserIndex)?this.m_shape.setUserIndex(r,this.m_node1UserIndex,n):this.m_shape.setUserIndex(r,this.m_node2UserIndex,n);const o=this.m_shape.getPathFromVertex(e);0===this.m_shape.getPathUserIndex(o,this.m_pathOrientationIndex)&&this.m_unknownNodes.push(n)}const o=this.m_shape.getPrevVertex(e);if(this.m_shape.queryXY(o,n),s.y<n.y){i=!0;const s=this.m_edges.newEdge(o);let n;-1===t?n=this.m_AET.addElement(s):(n=t,this.m_AET.setElement(n,s));-1===this.m_shape.getUserIndex(o,this.m_node1UserIndex)?this.m_shape.setUserIndex(o,this.m_node1UserIndex,n):this.m_shape.setUserIndex(o,this.m_node2UserIndex,n);const r=this.m_shape.getPathFromVertex(e);0===this.m_shape.getPathUserIndex(r,this.m_pathOrientationIndex)&&this.m_unknownNodes.push(n)}return i}fixRingSelfTangency_(){const e=[],t=[];let n=-1,r=-1;const i=new We;let o=D,a=D,h=-1;const m=new jn(this);for(let s=m.next();s!==D;s=m.next()){const m=new We;this.m_shape.queryXY(s,m);const l=this.m_shape.getPathFromVertex(s);if(i.equals(m)&&a===l){if(-1===r&&(n=this.m_shape.createPathUserIndex(),this.m_shape.fillPathUserIndexForGeometry(this.m_geometry,n,-1),r=this.m_shape.createUserIndex(),this.m_shape.fillUserIndexForGeometry(this.m_geometry,r,-1)),-1===h){h=t.length,this.m_shape.setUserIndex(o,r,h),t.push(1);-1===this.m_shape.getPathUserIndex(l,n)&&(this.m_shape.setPathUserIndex(l,n,o),e.push(l))}this.m_shape.setUserIndex(s,r,h),t[t.length-1]++}else h=-1,i.assign(m);o=s,a=l}if(0===e.length)return!1;s(-1!==n);for(let s=0,l=e.length;s<l;s++){const i=e[s];let o=this.m_shape.getPathUserIndex(i,n);const a=this.m_shape.getUserIndex(o,r),h=[],m=[];h.push(o),m.push(a);for(let e=this.m_shape.getNextVertex(o);e!==o;e=this.m_shape.getNextVertex(e)){const s=e,n=this.m_shape.getUserIndex(s,r);if(-1!==n){if(0===m.length){m.push(n),h.push(s);continue}if(m.at(-1)===n){const i=h.at(-1);this.m_shape.peelALoopIntoAPath(i,s),this.m_shape.setUserIndex(e,r,-1),t[n]--,1===t[n]&&(t[n]=0,m.pop(),h.pop()),o=i,e=i}else h.push(e),m.push(n)}}}return this.m_shape.removePathUserIndex(n),this.m_shape.removeUserIndex(r),this.m_shape.dbgVerifyVertexCounts(),!0}progress_(e=!1){}fixRingOrientationImplMain_(){const e={stack:[],error:void 0,hasError:!1};try{let t,s=!1;const n=Rt(e,Ct((()=>{this.m_sortedVerticesArray=null})),!1);if(null===this.m_sortedVertices){const e=this.m_shape.getPointCount(this.m_geometry);t=new we(0);for(let s=this.m_shape.getFirstPath(this.m_geometry);s!==D;s=this.m_shape.getNextPath(s)){let e=this.m_shape.getFirstVertex(s);for(let n=0,r=this.m_shape.getPathSize(s);n<r;n++)t.add(e),e=this.m_shape.getNextVertex(e)}this.m_shape.sortVerticesSimpleByY(t,0,e),this.progress_(!0),this.m_sortedVerticesArray=t}else n.bForget=!0;if(this.m_bFixSelfTangency&&(s=this.fixRingSelfTangency_()),1===this.m_shape.getPathCount(this.m_geometry)){const e=this.m_shape.getFirstPath(this.m_geometry),t=this.m_shape.getRingArea(e);if(this.m_shape.setExterior(e,!0),t<0){const t=this.m_shape.getFirstVertex(e);return this.m_shape.reverseRingInternal(t),this.m_shape.setLastVertex(e,this.m_shape.getPrevVertex(t)),!0}return!1}this.m_shape.dbgVerifyCurves(),this.m_pathOrientationIndex=this.m_shape.createPathUserIndex(),this.m_pathParentageIndex=this.m_shape.createPathUserIndex(),this.m_pathParentsIndex=this.m_shape.createPathUserIndex();for(let e=this.m_shape.getFirstPath(this.m_geometry);e!==D;e=this.m_shape.getNextPath(e))this.m_shape.setPathUserIndex(e,this.m_pathOrientationIndex,0),this.m_shape.setPathUserIndex(e,this.m_pathParentageIndex,-1),this.m_shape.setPathUserIndex(e,this.m_pathParentsIndex,-1);const r=[];this.m_yScanline=Number.NaN;const i=We.getNAN();this.m_unknownRingOrientationCount=this.m_shape.getPathCount(this.m_geometry),this.m_node1UserIndex=this.m_shape.createUserIndexUninitialized(),this.m_shape.fillUserIndexForGeometry(this.m_geometry,this.m_node1UserIndex,-1),this.m_node2UserIndex=this.m_shape.createUserIndexUninitialized(),this.m_shape.fillUserIndexForGeometry(this.m_geometry,this.m_node2UserIndex,-1);const o=new jn(this);for(let e=o.next();e!==D&&(this.progress_(),this.m_shape.queryXY(e,i),i.y!==this.m_yScanline&&r.length&&(s=this.processBunchForRingOrientationTest_(r)||s,this.m_sweepComparator.reset(),r.length=0),r.push(e),this.m_yScanline=i.y,0!==this.m_unknownRingOrientationCount);e=o.next());return this.m_unknownRingOrientationCount>0&&(s=this.processBunchForRingOrientationTest_(r)||s,r.length=0),this.m_shape.removeUserIndex(this.m_node1UserIndex),this.m_shape.removeUserIndex(this.m_node2UserIndex),this.dbgVerifyRingOrientation_(),s}catch(t){e.error=t,e.hasError=!0}finally{Yt(e)}}fixRingOrientationImplSimplify_(){const e=[];for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==D;)if(this.progress_(),3===this.m_shape.getPathUserIndex(t,this.m_pathOrientationIndex)){this.m_shape.setExterior(t,!0);for(let r=this.m_shape.getPathUserIndex(t,this.m_pathParentageIndex);r!==D;){const s=this.m_shape.getPathUserIndex(r,this.m_pathParentageIndex);e.push(r),this.m_shape.setExterior(r,!1),this.m_shape.setPathUserIndex(r,this.m_pathParentageIndex,t),r=s}let s=t,n=e.length;for(let e=this.m_shape.getNextPath(t);n>0&&e!==D;e=this.m_shape.getNextPath(e),--n){if(this.m_shape.getPathUserIndex(e,this.m_pathParentageIndex)!==t){s=D;break}s=e}if(0!==n){s=t;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.m_shape.setPathUserIndex(n,this.m_pathParentageIndex,Ne),this.m_shape.movePath(this.m_geometry,this.m_shape.getNextPath(s),n),s=n}}e.length=0,t=this.m_shape.getNextPath(s)}else t=this.m_shape.getNextPath(t);this.m_shape.removePathUserIndex(this.m_pathOrientationIndex),this.m_shape.removePathUserIndex(this.m_pathParentageIndex),this.m_shape.removePathUserIndex(this.m_pathParentsIndex)}fixRingOrientationImplMp2sp_(){const e=this.m_shape.createPathUserIndex();let t=0;const s=[];for(let n=this.m_shape.getFirstPath(this.m_geometry);n!==D;)if(this.progress_(),3===this.m_shape.getPathUserIndex(n,this.m_pathOrientationIndex)){this.m_shape.setExterior(n,!0),this.m_shape.setPathUserIndex(n,e,t),t++;for(let e=this.m_shape.getPathUserIndex(n,this.m_pathParentageIndex);e!==D;){const t=this.m_shape.getPathUserIndex(e,this.m_pathParentageIndex);s.push(e),this.m_shape.setExterior(e,!1),this.m_shape.setPathUserIndex(e,this.m_pathParentageIndex,n),e=t}let r=n,i=s.length,o=t;for(let t=this.m_shape.getNextPath(n);i>0&&t!==D;t=this.m_shape.getNextPath(t),--i){if(this.m_shape.getPathUserIndex(t,this.m_pathParentageIndex)!==n){r=D;break}r=t,this.m_shape.setPathUserIndex(t,e,-o),o++}if(0!==i){r=n,o=t;for(let t=0,n=s.length;t<n;t++){const n=s[t];this.m_shape.setPathUserIndex(n,e,-o),o++,this.m_shape.setPathUserIndex(n,this.m_pathParentageIndex,Ne)}r=n}t=o,s.length=0,n=this.m_shape.getNextPath(r)}else n=this.m_shape.getNextPath(n);return this.m_shape.removePathUserIndex(this.m_pathOrientationIndex),this.m_shape.removePathUserIndex(this.m_pathParentageIndex),this.m_shape.removePathUserIndex(this.m_pathParentsIndex),e}}function Kn(e,t,s,n,r,i){const o=new Qn(i);return o.m_shape=e,o.m_geometry=t,o.m_knownSimpleResult=s,o.m_bFixSelfTangency=n,o.m_polylineDegeneracies=r,o.m_bHasSegmentParentage=e.hasSegmentParentage(),o.m_bHasSegments=e.hasCurves(),o.simplify_()}class Qn{constructor(e){this.m_shape=null,this.m_geometry=D,this.m_sortedVertices=new Ae,this.m_bunchEdgeEndPoints=[],this.m_bunchEdgeCenterPoints=[],this.m_bunchEdgeIndices=[],this.m_knownSimpleResult=-1,this.m_sortedVerticesListIndex=-1,this.m_polylineDegeneracies=D,this.m_userIndexSortedIndexToVertex=-1,this.m_userIndexSortedAngleIndexToVertex=-1,this.m_nextVertexToProcess=-1,this.m_firstCoincidentVertex=-1,this.m_progressCounter=0,this.m_bFixSelfTangency=!1,this.m_bHasSegmentParentage=!1,this.m_bHasSegments=!1,this.m_progressTracker=e}compareAngles_(e,t){if(this.m_bHasSegments)return this.compareAnglesCurves_(e,t);const s=this.m_bunchEdgeEndPoints[e],n=new We;this.m_shape.queryXY(s,n);const r=new We,i=this.m_bunchEdgeEndPoints[t];if(this.m_shape.queryXY(i,r),n.equals(r))return 0;const o=this.m_bunchEdgeCenterPoints[e],a=new We;this.m_shape.queryXY(o,a);const h=this.m_bunchEdgeCenterPoints[t],m=new We;this.m_shape.queryXY(h,m);const l=new We;l.setSub(n,a);const g=new We;g.setSub(r,m),(l.isZero()||g.isZero())&&S("");return We.compareVectors(l,g)}compareAnglesCurves_(e,t){const s=this.m_bunchEdgeEndPoints[e],n=this.m_bunchEdgeEndPoints[t],r=this.m_bunchEdgeCenterPoints[e],i=this.m_bunchEdgeCenterPoints[t],o=this.m_shape.getNextVertex(r)===s,a=this.m_shape.getNextVertex(i)===n,h=new b,m=new We;o?(this.m_shape.querySegment(r,h,!1,!0),m.assign(h.get().getTangent(0))):(this.m_shape.querySegment(s,h,!1,!0),m.assign(h.get().getTangent(1)),m.negateThis());const l=new We;a?(this.m_shape.querySegment(i,h,!1,!0),l.assign(h.get().getTangent(0))):(this.m_shape.querySegment(n,h,!1,!0),l.assign(h.get().getTangent(1)),l.negateThis()),(m.isZero()||l.isZero())&&S("");return We.compareVectors(m,l)}beforeRemoveVertex_(e,t){const s=this.m_shape.getUserIndex(e,this.m_userIndexSortedIndexToVertex);if(this.m_nextVertexToProcess===s&&(this.m_nextVertexToProcess=this.m_sortedVertices.getNext(this.m_nextVertexToProcess)),this.m_firstCoincidentVertex===s&&(this.m_firstCoincidentVertex=this.m_sortedVertices.getNext(this.m_firstCoincidentVertex)),this.m_sortedVertices.deleteElement(this.m_sortedVerticesListIndex,s),this.removeAngleSortInfo_(e),t){const t=this.m_shape.getPathFromVertex(e);if(t!==D){if(this.m_shape.getFirstVertex(t)===e){const s=this.m_shape.getNextVertex(e);if(s!==e){if(this.m_shape.getPathFromVertex(s)===t)return void this.m_shape.setFirstVertex(t,s);{const s=this.m_shape.getPrevVertex(e);if(s!==e){if(this.m_shape.getPathFromVertex(s)===t)return void this.m_shape.setFirstVertex(t,s)}}}this.m_shape.setFirstVertex(t,D),this.m_shape.setLastVertex(t,D)}}}}processBunch_(){let e=!1;const t=new We(0,0);for(;;){this.m_bunchEdgeEndPoints.length=0,this.m_bunchEdgeCenterPoints.length=0,this.m_bunchEdgeIndices.length=0;let s=this.m_firstCoincidentVertex,n=0,r=!0;for(;s!==this.m_nextVertexToProcess;){const e=this.m_sortedVertices.getData(s);r&&(this.m_shape.queryXY(e,t),r=!1);const i=this.m_shape.getPrevVertex(e),o=this.m_shape.getNextVertex(e);this.m_shape.getUserIndex(i,this.m_userIndexSortedAngleIndexToVertex)!==Ne&&(this.m_bunchEdgeEndPoints.push(i),this.m_shape.setUserIndex(i,this.m_userIndexSortedAngleIndexToVertex,Ne),this.m_bunchEdgeCenterPoints.push(e),this.m_bunchEdgeIndices.push(n++));this.m_shape.getUserIndex(o,this.m_userIndexSortedAngleIndexToVertex)!==Ne&&(this.m_bunchEdgeEndPoints.push(o),this.m_shape.setUserIndex(o,this.m_userIndexSortedAngleIndexToVertex,Ne),this.m_bunchEdgeCenterPoints.push(e),this.m_bunchEdgeIndices.push(n++)),s=this.m_sortedVertices.getNext(s)}if(this.m_bunchEdgeEndPoints.length<2){1===this.m_bunchEdgeEndPoints.length&&this.m_shape.setUserIndex(this.m_bunchEdgeEndPoints[0],this.m_userIndexSortedAngleIndexToVertex,-1);break}this.m_bunchEdgeIndices.sort(((e,t)=>this.compareAngles_(e,t)));for(let e=0,t=this.m_bunchEdgeIndices.length;e<t;e++){const t=this.m_bunchEdgeIndices[e],s=this.m_bunchEdgeEndPoints[t];this.m_shape.setUserIndex(s,this.m_userIndexSortedAngleIndexToVertex,e)}const i=this.processCrossOvers_(t);for(let e=0,t=this.m_bunchEdgeIndices.length;e<t;e++){const t=this.m_bunchEdgeIndices[e];if(-1===t)continue;const s=this.m_bunchEdgeEndPoints[t];this.m_shape.setUserIndex(s,this.m_userIndexSortedAngleIndexToVertex,-1)}if(!i)break;e=!0}return e}processCrossOvers_(e){let t=!1,s=!0;for(;s;){s=!1;let n=0;-1===this.m_bunchEdgeIndices[n]&&(n=this.getNextEdgeIndex_(n));let r=this.getNextEdgeIndex_(n);for(let i=0,o=this.m_bunchEdgeIndices.length;i<o&&-1!==n&&-1!==r&&n!==r;i++){const i=this.m_bunchEdgeIndices[n],o=this.m_bunchEdgeIndices[r],a=this.m_bunchEdgeEndPoints[i],h=this.m_bunchEdgeEndPoints[o];let m=this.m_shape.getNextVertex(a),l=!1;this.m_shape.isEqualXYPoint2D(m,e)||(m=this.m_shape.getPrevVertex(a),l=!0);let g=this.m_shape.getNextVertex(h),u=!1;this.m_shape.isEqualXYPoint2D(g,e)||(g=this.m_shape.getPrevVertex(h),u=!0);const c=l?this.m_shape.getPrevVertex(m):this.m_shape.getNextVertex(m),_=u?this.m_shape.getPrevVertex(g):this.m_shape.getNextVertex(g);let d=!1;(this.removeSpike_(m)||this.removeSpike_(g)||this.removeSpike_(a)||this.removeSpike_(h)||this.removeSpike_(c)||this.removeSpike_(_))&&(d=!0),m!==g&&(!d&&this.m_shape.isEqualXY(a,h)&&(d=this.resolveOverlap_(l,u,m,a,g,h)),!d&&this.m_shape.isEqualXY(c,_)&&(d=this.resolveOverlap_(!l,!u,m,c,g,_)),!d&&this.m_shape.isEqualXY(a,_)&&(d=this.resolveOverlap_(l,!u,m,a,g,_)),!d&&this.m_shape.isEqualXY(c,h)&&(d=this.resolveOverlap_(!l,u,m,c,g,h))),d&&(t=!0),s||=d,n=d?this.getNextEdgeIndex_(n):r,r=this.getNextEdgeIndex_(n)}}if(!t){let s=0;-1===this.m_bunchEdgeIndices[s]&&(s=this.getNextEdgeIndex_(s));let n=this.getNextEdgeIndex_(s);for(let r=0,i=this.m_bunchEdgeIndices.length;r<i&&-1!==s&&-1!==n&&s!==n;r++){const r=this.m_bunchEdgeIndices[s],i=this.m_bunchEdgeIndices[n],o=this.m_bunchEdgeEndPoints[r],a=this.m_bunchEdgeEndPoints[i];let h=this.m_shape.getNextVertex(o);this.m_shape.isEqualXYPoint2D(h,e)||(h=this.m_shape.getPrevVertex(o));let m=this.m_shape.getNextVertex(a);this.m_shape.isEqualXYPoint2D(m,e)||(m=this.m_shape.getPrevVertex(a));const l=this.getDirection_(h,o),g=this.getDirection_(m,a),u=l?this.m_shape.getPrevVertex(h):this.m_shape.getNextVertex(h),c=g?this.m_shape.getPrevVertex(m):this.m_shape.getNextVertex(m),_=this.detectAndResolveCrossOver_(l,g,o,h,u,a,m,c);1!==_?0===_?(s=this.getNextEdgeIndex_(s),n=this.getNextEdgeIndex_(s)):(s=this.getPrevEdgeIndex_(s),n=this.getNextEdgeIndex_(s)):t=!0}}return t}simplify_(){if(this.m_shape.getGeometryType(this.m_geometry)===o.enumPolygon&&1===this.m_shape.getFillRule(this.m_geometry)){new La(this.m_progressTracker).planarSimplifyNoCrackingAndCluster(this.m_bFixSelfTangency,this.m_shape,this.m_geometry,0)}let e=!1;this.m_userIndexSortedIndexToVertex=-1,this.m_userIndexSortedAngleIndexToVertex=-1,this.m_userIndexSortedAngleIndexToVertex=this.m_shape.createUserIndexUninitialized();const t=this.m_shape.getPointCount(this.m_geometry),s=new we(0);this.m_shape.dbgVerifyMonotone();for(let i=this.m_shape.getFirstPath(this.m_geometry);i!==D;i=this.m_shape.getNextPath(i)){let e=this.m_shape.getFirstVertex(i);for(let t=0,n=this.m_shape.getPathSize(i);t<n;t++)this.m_shape.setUserIndex(e,this.m_userIndexSortedAngleIndexToVertex,-1),s.add(e),e=this.m_shape.getNextVertex(e)}this.m_shape.sortVerticesSimpleByY(s,0,t),this.progress_(!0),this.m_userIndexSortedIndexToVertex=this.m_shape.createUserIndexUninitialized(),this.m_sortedVertices.reserveNodes(t),this.m_sortedVerticesListIndex=this.m_sortedVertices.createList(0);for(let i=0;i<t;i++){const e=s.read(i),t=this.m_sortedVertices.addElement(this.m_sortedVerticesListIndex,e);this.m_shape.setUserIndex(e,this.m_userIndexSortedIndexToVertex,t)}this.m_nextVertexToProcess=-1,this.cleanupSpikes_()&&(e=!0);let n=0,r=!1;do{r=!1,this.m_nextVertexToProcess=-1,this.m_firstCoincidentVertex=this.m_sortedVertices.getFirst(this.m_sortedVerticesListIndex);const t=new We(0,0);this.m_firstCoincidentVertex!==Ae.st_nullNode()&&this.m_shape.queryXY(this.m_sortedVertices.getData(this.m_firstCoincidentVertex),t);let s=0,i=this.m_firstCoincidentVertex;for(;i!==Ae.st_nullNode()&&(i=this.m_sortedVertices.getNext(i),i!==Ae.st_nullNode());){this.progress_();const e=this.m_sortedVertices.getData(i),n=We.getNAN();if(this.m_shape.queryXY(e,n),t.equals(n))s++;else{if(s>0){this.m_nextVertexToProcess=i;const e=this.processBunch_();i=this.m_nextVertexToProcess,i!==Ae.st_nullNode()&&this.m_shape.queryXY(this.m_sortedVertices.getData(i),n),e&&(r=!0)}t.setCoordsPoint2D(n),this.m_firstCoincidentVertex=i,s=0}}if(this.m_nextVertexToProcess=-1,s>0){this.processBunch_()&&(r=!0)}n++>10&&l(""),r&&this.fixOrphanVertices_(),this.cleanupSpikes_()&&(r=!0),e||=r}while(r);return this.m_shape.dbgVerifyMonotone(),this.m_shape.dbgVerifyCurves(),this.m_shape.removeUserIndex(this.m_userIndexSortedIndexToVertex),this.m_shape.removeUserIndex(this.m_userIndexSortedAngleIndexToVertex),e=Xn(this.m_shape,this.m_geometry,this.m_sortedVertices,this.m_bFixSelfTangency,this.m_progressTracker)||e,this.m_shape.dbgVerifyCurves(),e}getDirection_(e,t){return this.m_shape.getNextVertex(t)!==e}detectAndResolveCrossOver_(e,t,s,n,r,i,o,a){if(n===o)return this.removeAngleSortInfo_(s),this.removeAngleSortInfo_(i),-1;const h=this.m_shape.getUserIndex(s,this.m_userIndexSortedAngleIndexToVertex),m=this.m_shape.getUserIndex(r,this.m_userIndexSortedAngleIndexToVertex),l=this.m_shape.getUserIndex(i,this.m_userIndexSortedAngleIndexToVertex),g=this.m_shape.getUserIndex(a,this.m_userIndexSortedAngleIndexToVertex),u=new Array(8),c=new Array(4);u[0]=0,c[0]=h,u[1]=0,c[1]=m,u[2]=1,c[2]=l,u[3]=1,c[3]=g;for(let d=1;d<4;d++){const e=c[d],t=u[d];let s=d-1;for(;s>=0&&c[s]>e;)c[s+1]=c[s],u[s+1]=u[s],s--;c[s+1]=e,u[s+1]=t}let _=0;if(u[0]&&(_|=1),u[1]&&(_|=2),u[2]&&(_|=4),u[3]&&(_|=8),5!==_&&10!==_)return 0;if(e!==t&&(a=gt(i,i=a)),e)this.m_shape.setNextVertex(a,n),this.m_shape.setPrevVertex(n,a),this.m_shape.setNextVertex(r,o),this.m_shape.setPrevVertex(o,r),this.m_bHasSegmentParentage&&(this.m_shape.setSegmentParentageBreakVertex(n,!0),this.m_shape.setSegmentParentageBreakVertex(o,!0));else{if(this.m_shape.setPrevVertex(a,n),this.m_shape.setNextVertex(n,a),this.m_shape.setPrevVertex(r,o),this.m_shape.setNextVertex(o,r),this.m_bHasSegmentParentage){const e=this.m_shape.getSegmentParentage(n),t=this.m_shape.getSegmentParentage(o);this.m_shape.setSegmentParentageAndBreak(n,t,!0),this.m_shape.setSegmentParentageAndBreak(o,e,!0)}if(this.m_bHasSegments){const e=this.m_shape.getVertexIndex(n),t=this.m_shape.getVertexIndex(o),s=this.m_shape.getSegmentFromIndex(e);this.m_shape.setSegmentToIndex(e,null);const r=this.m_shape.getSegmentFromIndex(t);this.m_shape.setSegmentToIndex(t,null),this.m_shape.setSegmentToIndex(e,r),this.m_shape.setSegmentToIndex(t,s)}}return 1}resolveOverlap_(e,t,s,n,r,i){return this.resolveOverlapOddEven_(e,t,s,n,r,i)}resolveOverlapOddEven_(e,t,s,n,r,i){if(e!==t){e||(r=gt(s,s=r),i=gt(n,n=i));const t=this.m_shape.getNextVertex(r),o=this.m_shape.getNextVertex(s);if(this.m_shape.setNextVertex(s,t),this.m_shape.setPrevVertex(t,s),this.m_shape.setNextVertex(r,o),this.m_shape.setPrevVertex(o,r),this.m_bHasSegments){const e=this.m_shape.getVertexIndex(s),t=this.m_shape.getVertexIndex(r),n=this.m_shape.getSegmentFromIndex(e);this.m_shape.setSegmentToIndex(e,null);const i=this.m_shape.getSegmentFromIndex(t);this.m_shape.setSegmentToIndex(t,null),this.m_shape.setSegmentToIndex(e,i),this.m_shape.setSegmentToIndex(t,n)}if(this.m_bHasSegmentParentage){const e=this.m_shape.getSegmentParentage(s),t=this.m_shape.getSegmentParentage(r);this.m_shape.setSegmentParentageAndBreak(s,t,!0),this.m_shape.setSegmentParentageAndBreak(r,e,!0),this.m_shape.setSegmentParentageBreakVertex(n,!0),this.m_shape.setSegmentParentageBreakVertex(i,!0)}this.removeSpike_(r)}else{const o=e?s:n,a=t?r:i,h=e?n:s,m=t?i:r;let l=null;if(this.m_bHasSegments){const e=this.m_shape.getVertexIndex(m);l=this.m_shape.getSegmentFromIndex(e),this.m_shape.setSegmentToIndex(e,null);const t=this.m_shape.getVertexIndex(a);this.m_shape.setSegmentToIndex(t,null);const s=this.m_shape.getVertexIndex(o);this.m_shape.setSegmentToIndex(s,null)}let g=-1;this.m_bHasSegmentParentage&&(g=this.m_shape.getSegmentParentage(m));let u=!1;this.m_shape.setNextVertex(o,a),this.m_shape.setNextVertex(a,o),this.m_shape.setPrevVertex(h,m),this.m_shape.setPrevVertex(m,h);let c=m;for(;c!==a;){const e=this.m_shape.getPrevVertex(c),t=this.m_shape.getNextVertex(c);if(this.m_shape.setPrevVertex(c,t),this.m_shape.setNextVertex(c,e),u||=c===o,this.m_bHasSegments&&c!==o){const e=this.m_shape.getVertexIndex(t),s=l;l=this.m_shape.getSegmentFromIndex(e),null!==s&&s.reverse(),this.m_shape.setSegmentToIndex(e,s)}if(this.m_bHasSegmentParentage){const e=this.m_shape.getSegmentParentage(t);this.m_shape.setSegmentParentagePreserveBreak(t,g),g=e}c=t}let _=null;if(!u){const e=this.m_shape.getPrevVertex(a),t=this.m_shape.getNextVertex(a);if(this.m_shape.setPrevVertex(a,t),this.m_shape.setNextVertex(a,e),this.m_bHasSegments){const e=this.m_shape.getVertexIndex(a);_=this.m_shape.getSegmentFromIndex(e),this.m_shape.setSegmentToIndex(e,null)}}let d=-1,p=-1;if(this.m_bHasSegmentParentage&&(d=u?this.m_shape.getSegmentParentage(o):this.m_shape.getSegmentParentage(a),p=this.m_shape.getSegmentParentage(h)),this.transferVertexData_(a,o),this.beforeRemoveVertex_(a,!0),this.m_shape.removeVertexInternal(a,!0),this.removeAngleSortInfo_(o),this.transferVertexData_(m,h),this.beforeRemoveVertex_(m,!0),this.m_shape.removeVertexInternal(m,!0),this.removeAngleSortInfo_(h),this.m_bHasSegmentParentage&&(this.m_shape.setSegmentParentageAndBreak(o,d,!0),this.m_shape.setSegmentParentageAndBreak(h,p,!0)),_){const e=this.m_shape.getVertexIndex(o);this.m_shape.setSegmentToIndex(e,_)}}return!0}cleanupSpikes_(){let e=!1;for(let t=this.m_shape.getFirstPath(this.m_geometry);t!==D;){const s=this.m_shape.getNextPath(t);let n=this.m_shape.getFirstVertex(t);for(let r=0,i=this.m_shape.getPathSize(t);r<i&&i>1;){this.progress_();const{v:s,bModified:o}=this.checkAndCleanupSpike_(t,n);if(s===D)break;o?(e=!0,n=s,r=0,i=this.m_shape.getPathSize(t)):(n=s,r++)}t=s}return e}checkAndCleanupSpike_(e,t){const s={v:D,bModified:!1};let n=this.m_shape.getPrevVertex(t),r=this.m_shape.getNextVertex(t),i=D,o=D;for(;this.m_shape.isEqualXY(n,r)&&(i=n,o=r,r!==t);)n=this.m_shape.getPrevVertex(n),r=this.m_shape.getNextVertex(r);if(i===D)return s.v=r,s;s.bModified=!0;for(let a=this.m_shape.getNextVertex(i);this.beforeRemoveVertex_(a,!1),a!==o;a=this.m_shape.getNextVertex(a));if(i===t)return this.m_polylineDegeneracies!==D?this.m_shape.movePath(this.m_polylineDegeneracies,D,e):this.m_shape.removePath(e),s.v=D,s;{const e=this.m_shape.peelALoopIntoAPath(i,o);this.m_polylineDegeneracies!==D?this.m_shape.movePath(this.m_polylineDegeneracies,D,e):this.m_shape.removePath(e)}return s.v=i,s}removeSpike_(e){let t=this.m_shape.getPrevVertex(e),s=this.m_shape.getNextVertex(e),n=D,r=D;for(;this.m_shape.isEqualXY(t,s)&&(n=t,r=s,s!==e);)t=this.m_shape.getPrevVertex(t),s=this.m_shape.getNextVertex(s);if(n===D)return!1;if(this.m_shape.peelALoop(n,r),this.m_bHasSegmentParentage&&(this.m_shape.setSegmentParentageBreakVertex(n,!0),this.m_shape.setSegmentParentageBreakVertex(r,!0)),this.removeAngleSortInfo_(n),this.m_polylineDegeneracies===D)for(let i=this.m_shape.getNextVertex(r);;){const e=this.m_shape.getNextVertex(i);if(this.removeAngleSortInfo_(i),this.beforeRemoveVertex_(i,!0),this.m_shape.setSegmentToIndex(this.m_shape.getVertexIndex(i),null),this.m_shape.removeVertexInternal(i,!1),i===r)break;i=e}else{for(let t=r;;){const e=this.m_shape.getNextVertex(t);if(this.removeAngleSortInfo_(t),this.beforeRemoveVertex_(t,!1),t=e,t===r)break}const e=[!1];this.m_shape.insertClosedPath(this.m_polylineDegeneracies,D,r,r,e)}return!0}fixOrphanVertices_(){let e=0;for(let n=this.m_sortedVertices.getFirst(this.m_sortedVertices.getFirstList());-1!==n;n=this.m_sortedVertices.getNext(n)){const e=this.m_sortedVertices.getData(n);this.m_shape.setPathToVertex(e,D)}let t=0;for(let n=this.m_shape.getFirstPath(this.m_geometry);n!==D;){const s=this.m_shape.getFirstVertex(n);if(s===D||this.m_shape.getPathFromVertex(s)!==D){const e=n;n=this.m_shape.getNextPath(n),this.m_shape.removePathOnly(e);continue}this.m_shape.setPathToVertex(s,n);let r=1;for(let e=this.m_shape.getNextVertex(s);e!==s;e=this.m_shape.getNextVertex(e))this.m_shape.setPathToVertex(e,n),r++;this.m_shape.setRingAreaValid(n,!1),this.m_shape.setPathSize(n,r),this.m_shape.setLastVertex(n,this.m_shape.getPrevVertex(s)),t+=r,e++,n=this.m_shape.getNextPath(n)}for(let n=this.m_sortedVertices.getFirst(this.m_sortedVertices.getFirstList());-1!==n;n=this.m_sortedVertices.getNext(n)){const s=this.m_sortedVertices.getData(n);if(this.m_shape.getPathFromVertex(s)!==D)continue;const r=[!1],i=this.m_shape.insertClosedPath(this.m_geometry,D,s,s,r);t+=this.m_shape.getPathSize(i),e++}this.m_shape.setGeometryPathCount(this.m_geometry,e),this.m_shape.setGeometryVertexCount(this.m_geometry,t);let s=0;for(let n=this.m_shape.getFirstGeometry();n!==D;n=this.m_shape.getNextGeometry(n))s+=this.m_shape.getPointCount(n);this.m_shape.setTotalPointCount(s)}getNextEdgeIndex_(e){if(-1===e)return-1;for(let t=0,s=this.m_bunchEdgeIndices.length-1;t<s;t++)if(e=(e+1)%this.m_bunchEdgeIndices.length,-1!==this.m_bunchEdgeIndices[e])return e;return-1}getPrevEdgeIndex_(e){if(-1===e)return-1;for(let t=0,s=this.m_bunchEdgeIndices.length-1;t<s;t++)if(e=(this.m_bunchEdgeIndices.length+e-1)%this.m_bunchEdgeIndices.length,-1!==this.m_bunchEdgeIndices[e])return e;return-1}transferVertexData_(e,t){const s=this.m_shape.getUserIndex(t,this.m_userIndexSortedIndexToVertex),n=this.m_shape.getUserIndex(t,this.m_userIndexSortedAngleIndexToVertex);this.m_shape.transferAllDataToTheVertex(e,t),this.m_shape.setUserIndex(t,this.m_userIndexSortedIndexToVertex,s),this.m_shape.setUserIndex(t,this.m_userIndexSortedAngleIndexToVertex,n)}removeAngleSortInfo_(e){const t=this.m_shape.getUserIndex(e,this.m_userIndexSortedAngleIndexToVertex);-1!==t&&(this.m_bunchEdgeIndices[t]=-1,this.m_shape.setUserIndex(e,this.m_userIndexSortedAngleIndexToVertex,-1))}progress_(e=!1){}}function Jn(s,n,r,i,a,h=!0){switch(tr(i)){case 0:break;case 1:t("relation string length has to be 9 characters");break;default:t("relation string")}if(h){const e=_r(i,s.getDimension(),n.getDimension());if(0!==e)return Dr(s,n,r,e,a)}let m=0;if("number"==typeof r)m=r;else{const t=e.constructEmpty();s.queryEnvelope(t);const i=e.constructEmpty();n.queryEnvelope(i);const o=e.constructEmpty();o.setCoords({env2D:t}),o.mergeEnvelope2D(i),m=le(r,o,!1)}const l=br(s,m),g=br(n,m);if(l.isEmpty()||g.isEmpty())return cr(l,g,i);const u=l.getGeometryType(),c=g.getGeometryType();let _=!1;switch(u){case o.enumPolygon:switch(c){case o.enumPolygon:_=sr(l,g,m,i,a);break;case o.enumPolyline:_=nr(l,g,m,i,a);break;case o.enumPoint:_=hr(l,g,m,i);break;case o.enumMultiPoint:_=rr(l,g,m,i,a)}break;case o.enumPolyline:switch(c){case o.enumPolygon:_=nr(g,l,m,wr(i),a);break;case o.enumPolyline:_=ir(l,g,m,i,a);break;case o.enumPoint:_=mr(l,g,m,i,a);break;case o.enumMultiPoint:_=or(l,g,m,i,a)}break;case o.enumPoint:switch(c){case o.enumPolygon:_=hr(g,l,m,wr(i));break;case o.enumPolyline:_=mr(g,l,m,wr(i),a);break;case o.enumPoint:_=gr(l,g,m,i);break;case o.enumMultiPoint:_=lr(g,l,m,wr(i))}break;case o.enumMultiPoint:switch(c){case o.enumPolygon:_=rr(g,l,m,wr(i),a);break;case o.enumPolyline:_=or(g,l,m,wr(i),a);break;case o.enumMultiPoint:_=ar(l,g,m,i,a);break;case o.enumPoint:_=lr(l,g,m,i)}break;default:_=!1}return _}function $n(t,s,n,r){const i=new Cr;i.resetMatrix_(),i.setPredicates_("T*****F**"),i.setAreaAreaPredicates_();const o=e.constructEmpty(),a=e.constructEmpty();t.queryEnvelope(o),s.queryEnvelope(a);let h=!1;if(kr(o,a,n)&&(i.areaAreaDisjointPredicates_(t,s),h=!0),h||Ar(t,s),h){return ur(i.m_matrix,i.m_scl)}let m=new T,l=m.addGeometry(t),g=m.addGeometry(s),u=null,c=0;if(t.hasNonLinearSegments()||s.hasNonLinearSegments()){u=new ua;const e=ma(n,m.getEnvelope2D(r));c=ga(e,0),na(m,e,n,12e3,u,null,r)}_a(m,new ue(n,0).add(c),r,!1,!1);const _=m.getGeometry(g).getBoundary();if(m.filterClosePoints(0,!0,!0,!1,D),Kn(m,l,-1,!1,D,r),0===m.getPointCount(l))return!1;Kn(m,g,-1,!1,D,r),i.setEditShape_(m,r);const d=0===m.getPointCount(g);if(!d){i.computeMatrixTopoGraphHalfEdges_(l,g),i.m_topoGraph.removeShape();const e=ur(i.m_matrix,i.m_scl);if(!e)return e}const p=m.getGeometry(l);m=new T,l=m.addGeometry(p),g=m.addGeometry(_),i.setEditShape_(m,r),i.m_predicateCount=0,i.resetMatrix_(),i.setPredicates_(d?"T*****F**":"******F**"),i.setAreaLinePredicates_(),i.computeMatrixTopoGraphHalfEdges_(l,g),i.m_topoGraph.removeShape();return ur(i.m_matrix,i.m_scl)}function er(t,s,n,r){const i=new Cr;i.resetMatrix_(),i.setPredicates_("T*****F**"),i.setAreaLinePredicates_();const o=e.constructEmpty(),a=e.constructEmpty();t.queryEnvelope(o),s.queryEnvelope(a);let h=!1;if(kr(o,a,n)&&(i.areaLineDisjointPredicates_(t,s),h=!0),h||Ar(t,s),h){return ur(i.m_matrix,i.m_scl)}const m=new T,l=m.addGeometry(t),g=m.addGeometry(s);if(i.setEditShapeCrackAndCluster_(m,new ue(n,0),r),0===m.getPointCount(l))return!1;i.computeMatrixTopoGraphHalfEdges_(l,g),i.m_topoGraph.removeShape();return ur(i.m_matrix,i.m_scl)}function tr(e){if(9!==e.length)return 1;for(let t=0;t<9;t++){const s=e[t];if("*"!==s&&"T"!==s&&"F"!==s&&"0"!==s&&"1"!==s&&"2"!==s)return 2}return 0}function sr(t,s,n,r,i){const o=new Cr;o.resetMatrix_(),o.setPredicates_(r),o.setAreaAreaPredicates_();const a=e.constructEmpty(),h=e.constructEmpty();t.queryEnvelope(a),s.queryEnvelope(h);let m=!1;if(kr(a,h,n)&&(o.areaAreaDisjointPredicates_(t,s),m=!0),m||Ar(t,s),!m){const e=new T,r=e.addGeometry(t),a=e.addGeometry(s);o.setEditShapeCrackAndCluster_(e,new ue(n,0),i),o.computeMatrixTopoGraphHalfEdges_(r,a),o.m_topoGraph.removeShape()}return ur(o.m_matrix,o.m_scl)}function nr(t,s,n,r,i){const o=new Cr;o.resetMatrix_(),o.setPredicates_(r),o.setAreaLinePredicates_();const a=e.constructEmpty(),h=e.constructEmpty();t.queryEnvelope(a),s.queryEnvelope(h);let m=!1;if(kr(a,h,n)&&(o.areaLineDisjointPredicates_(t,s),m=!0),m||Ar(t,s),!m){const e=new T,r=e.addGeometry(t),a=e.addGeometry(s);o.setEditShapeCrackAndCluster_(e,new ue(n,0),i),o.m_clusterIndexB=o.m_topoGraph.createUserIndexForClusters(),Sr(a,o.m_topoGraph,o.m_clusterIndexB),o.computeMatrixTopoGraphHalfEdges_(r,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexB),o.m_topoGraph.removeShape()}return ur(o.m_matrix,o.m_scl)}function rr(t,s,n,r,i){const o=new Cr;o.resetMatrix_(),o.setPredicates_(r),o.setAreaPointPredicates_();const a=e.constructEmpty(),h=e.constructEmpty();t.queryEnvelope(a),s.queryEnvelope(h);let m=!1;if(kr(a,h,n)&&(o.areaPointDisjointPredicates_(t),m=!0),m||Ar(t,s),!m){const e=new T,r=e.addGeometry(t),a=e.addGeometry(s);o.setEditShapeCrackAndCluster_(e,new ue(n,0),i),o.computeMatrixTopoGraphClusters_(r,a),o.m_topoGraph.removeShape()}return ur(o.m_matrix,o.m_scl)}function ir(t,s,n,r,i){const o=new Cr;o.resetMatrix_(),o.setPredicates_(r),o.setLineLinePredicates_();const a=e.constructEmpty(),h=e.constructEmpty();t.queryEnvelope(a),s.queryEnvelope(h);let m=!1;if(kr(a,h,n)&&(o.lineLineDisjointPredicates_(t,s),m=!0),m||Ar(t,s),!m){const e=new T,r=e.addGeometry(t),a=e.addGeometry(s);o.setEditShapeCrackAndCluster_(e,new ue(n,0),i),o.m_clusterIndexA=o.m_topoGraph.createUserIndexForClusters(),o.m_clusterIndexB=o.m_topoGraph.createUserIndexForClusters(),Sr(r,o.m_topoGraph,o.m_clusterIndexA),Sr(a,o.m_topoGraph,o.m_clusterIndexB),o.computeMatrixTopoGraphHalfEdges_(r,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexA),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexB),o.m_topoGraph.removeShape()}return ur(o.m_matrix,o.m_scl)}function or(t,s,n,r,i){const o=new Cr;o.resetMatrix_(),o.setPredicates_(r),o.setLinePointPredicates_();const a=e.constructEmpty(),h=e.constructEmpty();t.queryEnvelope(a),s.queryEnvelope(h);let m=!1;if(kr(a,h,n)&&(o.linePointDisjointPredicates_(t),m=!0),m||Ar(t,s),!m){const e=new T,r=e.addGeometry(t),a=e.addGeometry(s);o.setEditShapeCrackAndCluster_(e,new ue(n,0),i),o.m_clusterIndexA=o.m_topoGraph.createUserIndexForClusters(),Sr(r,o.m_topoGraph,o.m_clusterIndexA),o.computeMatrixTopoGraphClusters_(r,a),o.m_topoGraph.deleteUserIndexForClusters(o.m_clusterIndexA),o.m_topoGraph.removeShape()}return ur(o.m_matrix,o.m_scl)}function ar(t,s,n,r,i){const o=new Cr;o.resetMatrix_(),o.setPredicates_(r),o.setPointPointPredicates_();const a=new e,h=new e;t.queryEnvelope(a),s.queryEnvelope(h);let m=!1;if(kr(a,h,n)&&(o.pointPointDisjointPredicates_(),m=!0),!m){const e=new T,r=e.addGeometry(t),a=e.addGeometry(s);o.setEditShapeCrackAndCluster_(e,new ue(n,0),i),o.computeMatrixTopoGraphClusters_(r,a),o.m_topoGraph.removeShape()}return ur(o.m_matrix,o.m_scl)}function hr(t,s,n,r,i){const o=new Cr;o.resetMatrix_(),o.setPredicates_(r),o.setAreaPointPredicates_();const a=e.constructEmpty();t.queryEnvelope(a);const h=s.getXY();let m=!1;if(Mr(h,a,n)&&(o.areaPointDisjointPredicates_(t),m=!0),!m){const s=Bo(t,h,n);if(1===s)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===s){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 s=e.constructEmpty();t.queryEnvelope(s),o.m_matrix[2]=s.height()||s.width()?1:-1}}else o.areaPointDisjointPredicates_(t)}return ur(o.m_matrix,r)}function mr(t,s,n,r,i){const o=new Cr;o.resetMatrix_(),o.setPredicates_(r),o.setLinePointPredicates_();const a=e.constructEmpty();t.queryEnvelope(a);let h=!1;if(Mr(s.getXY(),a,n)&&(o.linePointDisjointPredicates_(t),h=!0),!h){let e=null,r=!1,a=!1;if(o.m_performPredicates[0]||o.m_performPredicates[6]){!Dr(t,s,n,4,i)?(o.m_performPredicates[0]&&(e=N(t),a=!Dr(e,s,n,4,i),r=!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!==e&&e.isEmpty()?o.m_matrix[3]=-1:(r||(null==e&&(e=N(t)),a=!Dr(e,s,n,4,i),r=!0),o.m_matrix[3]=a?0:-1)),o.m_performPredicates[5])if(null!==e&&e.isEmpty())o.m_matrix[5]=-1;else if(r&&!a)o.m_matrix[5]=0;else{null===e&&(e=N(t));const r=Dr(e,s,n,3,i);o.m_matrix[5]=r?-1:0}if(o.m_performPredicates[2]){if(0!==t.calculateLength2D())o.m_matrix[2]=1;else{const e=new w({vd:t.getDescription()});e.addPoints(t,0,t.getPointCount());const r=Dr(e,s,n,3,i);o.m_matrix[2]=r?-1:0}}}return ur(o.m_matrix,o.m_scl)}function lr(t,s,n,r,i){const o=new Cr;o.resetMatrix_(),o.setPredicates_(r),o.setPointPointPredicates_();const a=e.constructEmpty();t.queryEnvelope(a);const h=s.getXY(),m=new We;let l=!1;if(Mr(h,a,n)&&(o.pointPointDisjointPredicates_(),l=!0),!l){let e=!1,s=!0;const r=n*n;for(let n=0;n<t.getPointCount()&&(t.queryXY(n,m),We.sqrDistance(m,h)<=r?e=!0:s=!1,!e||s);n++);e?(o.m_matrix[0]=0,o.m_matrix[2]=s?-1:0,o.m_matrix[6]=-1):(o.m_matrix[0]=-1,o.m_matrix[2]=0,o.m_matrix[6]=0)}return ur(o.m_matrix,r)}function gr(e,t,s,n,r){const i=e.getXY(),o=t.getXY(),a=$e(9,-1);We.sqrDistance(i,o)<=s*s?a[0]=0:(a[2]=0,a[6]=0),a[8]=2;return ur(a,n)}function ur(e,t){for(let s=0;s<9;s++)switch(t[s]){case"T":if(-1===e[s])return!1;break;case"F":if(-1!==e[s])return!1;break;case"0":if(0!==e[s])return!1;break;case"1":if(1!==e[s])return!1;break;case"2":if(2!==e[s])return!1}return!0}function cr(t,s,n){const r=$e(9,-1);if(t.isEmpty()&&s.isEmpty())return ur(r,n);let i,a=!1;t.isEmpty()?(i=s,a=!0):i=t,r[0]=-1,r[1]=-1,r[3]=-1,r[4]=-1,r[6]=-1,r[7]=-1,r[8]=2;const h=i.getGeometryType();if(c(h))if(h===o.enumPolygon){if(0!==i.calculateArea2D())r[2]=2,r[5]=1;else{r[5]=-1;const t=e.constructEmpty();i.queryEnvelope(t),r[2]=t.height()||t.width()?1:0}}else{const e=0!==i.calculateLength2D();r[2]=e?1:0,r[5]=G(i)?0:-1}else r[2]=0,r[5]=-1;return a&&Ir(r),ur(r,n)}function _r(e,t,s){return dr(e)?3:pr(e)?4:fr(e,t,s)?8:xr(e,t,s)?16:Pr(e)?64:yr(e)?1:Er(e,t,s)?32:0}function dr(e){return"T*F**FFF*"===e}function pr(e){return"FF*FF****"===e}function fr(e,t,s){return(0!==t||0!==s)&&(2===t&&2===s?"F***T****"===e:(2===t||1===t)&&0===s&&"F**T*****"===e)}function xr(e,t,s){return t>s?"T*****T**"===e:1===t&&1===s&&"0********"===e}function yr(e){return"T*****FF*"===e}function Pr(e){return"T**FF*FF*"===e}function Er(e,t,s){return t===s&&(1!==t?"T*T***T**"===e:"1*T***T**"===e)}function Sr(e,t,s){const n=t.getGeometryID(e);for(let r=t.getFirstCluster();r!==D;r=t.getNextCluster(r)){if(!(t.getClusterParentage(r)&n))continue;const e=t.getClusterHalfEdge(r);if(e===D){t.setClusterUserIndex(r,s,0);continue}let i=e,o=0;do{const e=i;t.getHalfEdgeParentage(e)&n&&o++,i=t.getHalfEdgeNext(t.getHalfEdgeTwin(e))}while(i!==e);t.setClusterUserIndex(r,s,o)}}class Cr{nullFunc(){return l("should not be called"),!1}constructor(){this.m_clusterIndexA=-1,this.m_clusterIndexB=-1,this.m_visitedIndex=-1,this.m_topoGraph=new Qs,this.m_matrix=$e(9,0),this.m_maxDim=$e(9,0),this.m_performPredicates=$e(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_(e){this.m_scl=e;for(let t=0;t<9;t++)"*"!==this.m_scl[t]?(this.m_performPredicates[t]=!0,this.m_predicateCount++):this.m_performPredicates[t]=!1}setRemainingPredicatesToFalse_(){for(let e=0;e<9;e++)this.m_performPredicates[e]&&-2===this.m_matrix[e]&&(this.m_matrix[e]=-1,this.m_performPredicates[e]=!1)}isPredicateKnown_(e){return-2!==this.m_matrix[e]&&(-1===this.m_matrix[e]?(this.m_performPredicates[e]=!1,this.m_predicateCount--,!0):"T"!==this.m_scl[e]&&"F"!==this.m_scl[e]?!(this.m_matrix[e]<this.m_maxDim[e])&&(this.m_performPredicates[e]=!1,this.m_predicateCount--,!0):(this.m_performPredicates[e]=!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_(e,t){this.m_matrix[0]=-1,this.m_matrix[1]=-1,this.m_matrix[3]=-1,this.m_matrix[4]=-1,this.areaGeomContainsOrDisjointPredicates_(e,this.m_performPredicates[2]?2:-1,this.m_scl[2],this.m_performPredicates[5]?5:-1,this.m_scl[5]),this.areaGeomContainsOrDisjointPredicates_(t,this.m_performPredicates[6]?6:-1,this.m_scl[6],this.m_performPredicates[7]?7:-1,this.m_scl[7])}areaGeomContainsOrDisjointPredicates_(t,s,n,r,i){const o=-1!==s,a=-1!==r;if(o||a){if(!("T"!==n&&"F"!==n&&o||"T"!==i&&"F"!==i&&a)||0!==t.calculateArea2D())o&&(this.m_matrix[s]=2),a&&(this.m_matrix[r]=1);else if(a&&(this.m_matrix[r]=-1),o){const n=e.constructEmpty();t.queryEnvelope(n),this.m_matrix[s]=n.height()||n.width()?1:0}}}areaAreaContainsPredicates_(e){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_(e,this.m_performPredicates[0]?0:-1,this.m_scl[0],this.m_performPredicates[1]?1:-1,this.m_scl[1])}areaAreaWithinPredicates_(e){this.areaAreaContainsPredicates_(e),Ir(this.m_matrix)}areaLineDisjointPredicates_(e,t){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 e=this.m_scl[6],s="T"===e||"F"===e||0!==t.calculateLength2D();this.m_matrix[6]=s?1:0}if(this.m_performPredicates[7]){const e=G(t);this.m_matrix[7]=e?0:-1}this.areaGeomContainsOrDisjointPredicates_(e,this.m_performPredicates[2]?2:-1,this.m_scl[2],this.m_performPredicates[5]?5:-1,this.m_scl[5])}areaLineContainsPredicates_(e,t){if(this.m_performPredicates[0]){const e=this.m_scl[0],s="T"===e||"F"===e||0!==t.calculateLength2D();this.m_matrix[0]=s?1:0}if(this.m_performPredicates[1]){const e=G(t);this.m_matrix[1]=e?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_(e){this.m_matrix[0]=-1,this.m_matrix[3]=-1,this.m_matrix[6]=0,this.areaGeomContainsOrDisjointPredicates_(e,this.m_performPredicates[2]?2:-1,this.m_scl[2],this.m_performPredicates[5]?5:-1,this.m_scl[5])}areaPointContainsPredicates_(e){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_(e,t){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 t=this.m_scl[2],s="T"===t||"F"===t||0!==e.calculateLength2D();this.m_matrix[2]=s?1:0}if(this.m_performPredicates[5]){const t=G(e);this.m_matrix[5]=t?0:-1}if(this.m_performPredicates[6]){const e=this.m_scl[6],s="T"===e||"F"===e||0!==t.calculateLength2D();this.m_matrix[6]=s?1:0}if(this.m_performPredicates[7]){const e=G(t);this.m_matrix[7]=e?0:-1}}linePointDisjointPredicates_(e){if(this.m_matrix[0]=-1,this.m_matrix[3]=-1,this.m_performPredicates[2]){const t=this.m_scl[2],s="T"===t||"F"===t||0!==e.calculateLength2D();this.m_matrix[2]=s?1:0}if(this.m_performPredicates[5]){const t=G(e);this.m_matrix[5]=t?0:-1}this.m_matrix[6]=0}pointPointDisjointPredicates_(){this.m_matrix[0]=-1,this.m_matrix[2]=0,this.m_matrix[6]=0}areaAreaPredicates_(e,t,s){let n=!0;if(this.m_performPredicates[0]){this.interiorAreaInteriorArea_(e,t,s);const r=this.isPredicateKnown_(0);n&&=r}if(this.m_performPredicates[1]){this.interiorAreaBoundaryArea_(e,t,1);const s=this.isPredicateKnown_(1);n&&=s}if(this.m_performPredicates[2]){this.interiorAreaExteriorArea_(e,t,s,2);const r=this.isPredicateKnown_(2);n&&=r}if(this.m_performPredicates[3]){this.interiorAreaBoundaryArea_(e,s,3);const t=this.isPredicateKnown_(3);n&&=t}if(this.m_performPredicates[4]){this.boundaryAreaBoundaryArea_(e,t,s);const r=this.isPredicateKnown_(4);n&&=r}if(this.m_performPredicates[5]){this.boundaryAreaExteriorArea_(e,t,s,5);const r=this.isPredicateKnown_(5);n&&=r}if(this.m_performPredicates[6]){this.interiorAreaExteriorArea_(e,s,t,6);const r=this.isPredicateKnown_(6);n&&=r}if(this.m_performPredicates[7]){this.boundaryAreaExteriorArea_(e,s,t,7);const r=this.isPredicateKnown_(7);n&&=r}return n}areaLinePredicates_(e,t,s){let n=!0;if(this.m_performPredicates[0]){this.interiorAreaInteriorLine_(e,t,s);const r=this.isPredicateKnown_(0);n&&=r}if(this.m_performPredicates[1]){this.interiorAreaBoundaryLine_(e,t,s,this.m_clusterIndexB);const r=this.isPredicateKnown_(1);n&&=r}if(this.m_performPredicates[2]){this.interiorAreaExteriorLine_(e,t,s);const r=this.isPredicateKnown_(2);n&&=r}if(this.m_performPredicates[3]){this.boundaryAreaInteriorLine_(e,t,s,this.m_clusterIndexB);const r=this.isPredicateKnown_(3);n&&=r}if(this.m_performPredicates[4]){this.boundaryAreaBoundaryLine_(e,t,s,this.m_clusterIndexB);const r=this.isPredicateKnown_(4);n&&=r}if(this.m_performPredicates[5]){this.boundaryAreaExteriorLine_(e,t,s);const r=this.isPredicateKnown_(5);n&&=r}if(this.m_performPredicates[6]){this.exteriorAreaInteriorLine_(e,t);const s=this.isPredicateKnown_(6);n&&=s}if(this.m_performPredicates[7]){this.exteriorAreaBoundaryLine_(e,t,s,this.m_clusterIndexB);const r=this.isPredicateKnown_(7);n&&=r}return n}lineLinePredicates_(e,t,s){let n=!0;if(this.m_performPredicates[0]){this.interiorLineInteriorLine_(e,t,s,this.m_clusterIndexA,this.m_clusterIndexB);const r=this.isPredicateKnown_(0);n&&=r}if(this.m_performPredicates[1]){this.interiorLineBoundaryLine_(e,t,s,this.m_clusterIndexA,this.m_clusterIndexB,1);const r=this.isPredicateKnown_(1);n&&=r}if(this.m_performPredicates[2]){this.interiorLineExteriorLine_(e,t,s,2);const r=this.isPredicateKnown_(2);n&&=r}if(this.m_performPredicates[3]){this.interiorLineBoundaryLine_(e,s,t,this.m_clusterIndexB,this.m_clusterIndexA,3);const r=this.isPredicateKnown_(3);n&&=r}if(this.m_performPredicates[4]){this.boundaryLineBoundaryLine_(e,t,s,this.m_clusterIndexA,this.m_clusterIndexB);const r=this.isPredicateKnown_(4);n&&=r}if(this.m_performPredicates[5]){this.boundaryLineExteriorLine_(e,t,s,this.m_clusterIndexA,5);const r=this.isPredicateKnown_(5);n&&=r}if(this.m_performPredicates[6]){this.interiorLineExteriorLine_(e,s,t,6);const r=this.isPredicateKnown_(6);n&&=r}if(this.m_performPredicates[7]){this.boundaryLineExteriorLine_(e,s,t,this.m_clusterIndexB,7);const r=this.isPredicateKnown_(7);n&&=r}return n}areaPointPredicates_(e,t,s){let n=!0;if(this.m_performPredicates[0]){this.interiorAreaInteriorPoint_(e,t);const s=this.isPredicateKnown_(0);n&&=s}if(this.m_performPredicates[2]){this.interiorAreaExteriorPoint_(e,t);const s=this.isPredicateKnown_(2);n&&=s}if(this.m_performPredicates[3]){this.boundaryAreaInteriorPoint_(e,t,s);const r=this.isPredicateKnown_(3);n&&=r}if(this.m_performPredicates[5]){this.boundaryAreaExteriorPoint_(e,t);const s=this.isPredicateKnown_(5);n&&=s}if(this.m_performPredicates[6]){this.exteriorAreaInteriorPoint_(e,t);const s=this.isPredicateKnown_(6);n&&=s}return n}linePointPredicates_(e,t,s){let n=!0;if(this.m_performPredicates[0]){this.interiorLineInteriorPoint_(e,t,s,this.m_clusterIndexA);const r=this.isPredicateKnown_(0);n&&=r}if(this.m_performPredicates[2]){this.interiorLineExteriorPoint_(e,t,s,this.m_clusterIndexA);const r=this.isPredicateKnown_(2);n&&=r}if(this.m_performPredicates[3]){this.boundaryLineInteriorPoint_(e,t,s,this.m_clusterIndexA);const r=this.isPredicateKnown_(3);n&&=r}if(this.m_performPredicates[5]){this.boundaryLineExteriorPoint_(e,t,s,this.m_clusterIndexA);const r=this.isPredicateKnown_(5);n&&=r}if(this.m_performPredicates[6]){this.exteriorLineInteriorPoint_(e,t,s);const r=this.isPredicateKnown_(6);n&&=r}return n}pointPointPredicates_(e,t,s){let n=!0;if(this.m_performPredicates[0]){this.interiorPointInteriorPoint_(e,t,s);const r=this.isPredicateKnown_(0);n&&=r}if(this.m_performPredicates[2]){this.interiorPointExteriorPoint_(e,t,s,2);const r=this.isPredicateKnown_(2);n&&=r}if(this.m_performPredicates[6]){this.interiorPointExteriorPoint_(e,s,t,6);const r=this.isPredicateKnown_(6);n&&=r}return n}interiorAreaInteriorArea_(e,t,s){if(2===this.m_matrix[0])return;const n=this.m_topoGraph.getHalfEdgeFaceParentage(e);n&t&&n&s&&(this.m_matrix[0]=2)}interiorAreaBoundaryArea_(e,t,s){if(1===this.m_matrix[s])return;const n=this.m_topoGraph.getHalfEdgeFaceParentage(e),r=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(e));n&t&&r&t&&(this.m_matrix[s]=1)}interiorAreaExteriorArea_(e,t,s,n){if(2===this.m_matrix[n])return;const r=this.m_topoGraph.getHalfEdgeFaceParentage(e);r&t&&!(r&s)&&(this.m_matrix[n]=2)}boundaryAreaBoundaryArea_(e,t,s){if(1===this.m_matrix[4])return;const n=this.m_topoGraph.getHalfEdgeParentage(e);if(n&t&&n&s)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(e)),this.m_visitedIndex)){const n=this.m_topoGraph.getHalfEdgeTo(e),r=this.m_topoGraph.getClusterParentage(n);if(r&t&&r&s)return void(this.m_matrix[4]=0)}}boundaryAreaExteriorArea_(e,t,s,n){if(1===this.m_matrix[n])return;const r=this.m_topoGraph.getHalfEdgeFaceParentage(e),i=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(e));r&s||i&s||(this.m_matrix[n]=1)}interiorAreaInteriorLine_(e,t,s){if(1===this.m_matrix[0])return;const n=this.m_topoGraph.getHalfEdgeFaceParentage(e),r=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(e));n&t&&r&t&&(this.m_matrix[0]=1)}interiorAreaBoundaryLine_(e,t,s,n){if(0!==this.m_matrix[1]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(e)),this.m_visitedIndex)){const r=this.m_topoGraph.getHalfEdgeTo(e),i=this.m_topoGraph.getClusterParentage(r);if(!(i&t)){if(this.m_topoGraph.getHalfEdgeFaceParentage(e)&t){const e=this.m_topoGraph.getClusterUserIndex(r,n);if(i&s&&e%2!=0)return void(this.m_matrix[1]=0)}}}}interiorAreaExteriorLine_(e,t,s){if(2===this.m_matrix[2])return;this.m_topoGraph.getHalfEdgeParentage(e)&t&&(this.m_matrix[2]=2)}boundaryAreaInteriorLine_(e,t,s,n){if(1===this.m_matrix[3])return;const r=this.m_topoGraph.getHalfEdgeParentage(e);if(r&t&&r&s)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(e)),this.m_visitedIndex)){const r=this.m_topoGraph.getHalfEdgeTo(e),i=this.m_topoGraph.getClusterParentage(r);if(i&t){const e=this.m_topoGraph.getClusterUserIndex(r,n);if(i&s&&e%2==0)return void(this.m_matrix[3]=0)}}}boundaryAreaBoundaryLine_(e,t,s,n){if(0!==this.m_matrix[4]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(e)),this.m_visitedIndex)){const r=this.m_topoGraph.getHalfEdgeTo(e),i=this.m_topoGraph.getClusterParentage(r);if(i&t){const e=this.m_topoGraph.getClusterUserIndex(r,n);if(i&s&&e%2!=0)return void(this.m_matrix[4]=0)}}}boundaryAreaExteriorLine_(e,t,s){if(1===this.m_matrix[5])return;const n=this.m_topoGraph.getHalfEdgeParentage(e);n&t&&!(n&s)&&(this.m_matrix[5]=1)}exteriorAreaInteriorLine_(e,t){if(1===this.m_matrix[6])return;const s=this.m_topoGraph.getHalfEdgeFaceParentage(e),n=this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(e));s&t||n&t||(this.m_matrix[6]=1)}exteriorAreaBoundaryLine_(e,t,s,n){if(0!==this.m_matrix[7]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(e)),this.m_visitedIndex)){const r=this.m_topoGraph.getHalfEdgeTo(e),i=this.m_topoGraph.getClusterParentage(r);if(!(i&t)){if(!(this.m_topoGraph.getHalfEdgeFaceParentage(e)&t)){const e=this.m_topoGraph.getClusterUserIndex(r,n);if(i&s&&e%2!=0)return void(this.m_matrix[7]=0)}}}}interiorLineInteriorLine_(e,t,s,n,r){if(1===this.m_matrix[0])return;const i=this.m_topoGraph.getHalfEdgeParentage(e);if(i&t&&i&s)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(e)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(e),o=this.m_topoGraph.getClusterParentage(i);if(o&t&&o&s){const e=this.m_topoGraph.getClusterUserIndex(i,n),t=this.m_topoGraph.getClusterUserIndex(i,r);if(e%2==0&&t%2==0)return void(this.m_matrix[0]=0)}}}interiorLineBoundaryLine_(e,t,s,n,r,i){if(0!==this.m_matrix[i]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(e)),this.m_visitedIndex)){const o=this.m_topoGraph.getHalfEdgeTo(e),a=this.m_topoGraph.getClusterParentage(o);if(a&t&&a&s){const e=this.m_topoGraph.getClusterUserIndex(o,n),t=this.m_topoGraph.getClusterUserIndex(o,r);if(e%2==0&&t%2!=0)return void(this.m_matrix[i]=0)}}}interiorLineExteriorLine_(e,t,s,n){if(1===this.m_matrix[n])return;const r=this.m_topoGraph.getHalfEdgeParentage(e);r&t&&!(r&s)&&(this.m_matrix[n]=1)}boundaryLineBoundaryLine_(e,t,s,n,r){if(0!==this.m_matrix[4]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(e)),this.m_visitedIndex)){const i=this.m_topoGraph.getHalfEdgeTo(e),o=this.m_topoGraph.getClusterParentage(i);if(o&t&&o&s){const e=this.m_topoGraph.getClusterUserIndex(i,n),t=this.m_topoGraph.getClusterUserIndex(i,r);if(e%2!=0&&t%2!=0)return void(this.m_matrix[4]=0)}}}boundaryLineExteriorLine_(e,t,s,n,r){if(0!==this.m_matrix[r]&&1!==this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgePrev(this.m_topoGraph.getHalfEdgeTwin(e)),this.m_visitedIndex)){const t=this.m_topoGraph.getHalfEdgeTo(e);if(!(this.m_topoGraph.getClusterParentage(t)&s)){if(this.m_topoGraph.getClusterUserIndex(t,n)%2!=0)return void(this.m_matrix[r]=0)}}}interiorAreaInteriorPoint_(e,t){if(0===this.m_matrix[0])return;if(!(this.m_topoGraph.getClusterParentage(e)&t)){const s=this.m_topoGraph.getClusterChain(e);if(this.m_topoGraph.getChainParentage(s)&t)return void(this.m_matrix[0]=0)}}interiorAreaExteriorPoint_(e,t){if(2===this.m_matrix[2])return;this.m_topoGraph.getClusterParentage(e)&t&&(this.m_matrix[2]=2)}boundaryAreaInteriorPoint_(e,t,s){if(0===this.m_matrix[3])return;const n=this.m_topoGraph.getClusterParentage(e);n&t&&n&s&&(this.m_matrix[3]=0)}boundaryAreaExteriorPoint_(e,t){if(1===this.m_matrix[5])return;this.m_topoGraph.getClusterParentage(e)&t&&(this.m_matrix[5]=1)}exteriorAreaInteriorPoint_(e,t){if(0===this.m_matrix[6])return;if(!(this.m_topoGraph.getClusterParentage(e)&t)){const s=this.m_topoGraph.getClusterChain(e);if(!(this.m_topoGraph.getChainParentage(s)&t))return void(this.m_matrix[6]=0)}}interiorLineInteriorPoint_(e,t,s,n){if(0===this.m_matrix[0])return;const r=this.m_topoGraph.getClusterParentage(e);if(r&t&&r&s){if(this.m_topoGraph.getClusterUserIndex(e,n)%2==0)return void(this.m_matrix[0]=0)}}interiorLineExteriorPoint_(e,t,s,n){if(1===this.m_matrix[2])return;if(-1===this.m_topoGraph.getClusterHalfEdge(e)){if(0!==this.m_matrix[2]){if(!(this.m_topoGraph.getClusterParentage(e)&s))return void(this.m_matrix[2]=0)}}else this.m_matrix[2]=1}boundaryLineInteriorPoint_(e,t,s,n){if(0===this.m_matrix[3])return;const r=this.m_topoGraph.getClusterParentage(e);if(r&t&&r&s){if(this.m_topoGraph.getClusterUserIndex(e,n)%2!=0)return void(this.m_matrix[3]=0)}}boundaryLineExteriorPoint_(e,t,s,n){if(0===this.m_matrix[5])return;const r=this.m_topoGraph.getClusterParentage(e);if(r&t&&!(r&s)){if(this.m_topoGraph.getClusterUserIndex(e,n)%2!=0)return void(this.m_matrix[5]=0)}}exteriorLineInteriorPoint_(e,t,s){if(0===this.m_matrix[6])return;const n=this.m_topoGraph.getClusterParentage(e);n&t||!(n&s)||(this.m_matrix[6]=0)}interiorPointInteriorPoint_(e,t,s){if(0===this.m_matrix[0])return;const n=this.m_topoGraph.getClusterParentage(e);n&t&&n&s&&(this.m_matrix[0]=0)}interiorPointExteriorPoint_(e,t,s,n){if(0===this.m_matrix[n])return;const r=this.m_topoGraph.getClusterParentage(e);!(r&t)||r&s||(this.m_matrix[n]=0)}computeMatrixTopoGraphHalfEdges_(e,t){let s=!1;const n=this.m_topoGraph.getGeometryID(e),r=this.m_topoGraph.getGeometryID(t);this.m_visitedIndex=this.m_topoGraph.createUserIndexForHalfEdges();for(let i=this.m_topoGraph.getFirstCluster();i!==D;i=this.m_topoGraph.getNextCluster(i)){const e=this.m_topoGraph.getClusterHalfEdge(i);if(e===D){if(null!==this.m_predicatesCluster&&(s=this.m_predicatesCluster(i,n,r),s))break;continue}let t=e;do{let e=t;if(1!==this.m_topoGraph.getHalfEdgeUserIndex(e,this.m_visitedIndex))do{if(s=this.m_predicatesHalfEdge(e,n,r),s)break;this.m_topoGraph.setHalfEdgeUserIndex(e,this.m_visitedIndex,1),e=this.m_topoGraph.getHalfEdgeNext(e)}while(e!==t&&!s);if(s)break;t=this.m_topoGraph.getHalfEdgeNext(this.m_topoGraph.getHalfEdgeTwin(e))}while(t!==e);if(s)break}s||this.setRemainingPredicatesToFalse_(),this.m_topoGraph.deleteUserIndexForHalfEdges(this.m_visitedIndex)}computeMatrixTopoGraphClusters_(e,t){let s=!1;const n=this.m_topoGraph.getGeometryID(e),r=this.m_topoGraph.getGeometryID(t);for(let i=this.m_topoGraph.getFirstCluster();i!==D&&(s=this.m_predicatesCluster(i,n,r),!s);i=this.m_topoGraph.getNextCluster(i));s||this.setRemainingPredicatesToFalse_()}setEditShape_(e,t){this.m_topoGraph.setEditShape(e,t)}setEditShapeCrackAndCluster_(e,t,s){let n=0;if(e.hasCurves()){const r=new ua,i=e.getEnvelope2D(s),o=ma(t.total(),i);n=ga(o,0),na(e,o,t.total(),12e3,r,null,s),r.clearStitcher(e)}_a(e,t.add(n),s,!1,!1),e.filterClosePoints(0,!0,!0,!1,D);for(let r=e.getFirstGeometry();r!==D;r=e.getNextGeometry(r))e.getGeometryType(r)===o.enumPolygon&&Kn(e,r,-1,!1,D,s);this.setEditShape_(e,s)}}function Ir(e){const t=e[1],s=e[2],n=e[5];e[1]=e[3],e[2]=e[6],e[5]=e[7],e[3]=t,e[6]=s,e[7]=n}function br(t,s,n){const r=t.getGeometryType();if(a(r)){const e=new I({vd:t.getDescription()});return e.addSegment(t,!0),e}if(r===o.enumEnvelope){const n=t,r=e.constructEmpty();if(t.queryEnvelope(r),r.height()<=s&&r.width()<=s){const e=new ae({vd:t.getDescription()});return n.getCenter(e),e}if(r.height()<=s||r.width()<=s){const e=new I({vd:t.getDescription()}),s=new ae;return n.queryCornerByVal(0,s),e.startPathPoint(s),n.queryCornerByVal(2,s),e.lineToPoint(s),e}const i=new C({vd:t.getDescription()});return i.addEnvelope(n,!1),i}return t}function wr(e){return`${e[0]}${e[3]}${e[6]}${e[1]}${e[4]}${e[7]}${e[2]}${e[5]}${e[8]}`}class vr{nullFunc(){return l("should not be called"),!1}constructor(t,s,n,r=!1){this.m_bDone=!1,this.m_tolerance=0,this.m_elementHandle=-1,this.m_query=e.constructEmpty(),this.m_envInter=e.constructEmpty(),this.m_quadTree=null,this.m_intersector=null,this.m_function=this.nullFunc;const i=t.getAccelerators();let o=null;null!=i&&(o=r?i.getQuadTreeForPaths():i.getQuadTree());const a=s.getAccelerators();let h=null;if(null!=a&&(h=r?a.getQuadTreeForPaths():a.getQuadTree()),null===o&&null===h&&!r){const r=t.getPointCount(),i=s.getPointCount();if(r>10&&i>10){const a=e.constructEmpty(),m=e.constructEmpty(),l=e.constructEmpty();t.queryLooseEnvelope(a),s.queryLooseEnvelope(m),a.inflateCoords(n,n),m.inflateCoords(n,n),l.setCoords({env2D:a}),l.intersect(m),r>=i?o=c(t.getGeometryType())?ce(t,l):Ge(t,l):h=c(s.getGeometryType())?ce(s,l):Ge(s,l)}}this.construct_(t,o,s,h,n,r)}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):c(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?c(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||_(""),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||_(""),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,s,n,r,i,a){const h=e.constructEmpty(),m=e.constructEmpty();t.queryLooseEnvelope(h),n.queryLooseEnvelope(m),h.inflateCoords(i,i),m.inflateCoords(i,i),this.m_envInter.setCoords({env2D:h}),this.m_envInter.intersect(m),this.m_multiVertexImplA=t,this.m_multiVertexImplB=n;const l=t.getGeometryType(),g=n.getGeometryType();this.m_bPaths=a,this.m_pathIndex=-1,this.m_pointIndex=-1,this.m_bSwapElements=!1,this.m_queryType=o.enumUnknown,this.m_bQuadTree=!1,null!==s&&(this.m_bDone=!1,this.m_tolerance=i,this.m_quadTree=s,this.m_qtIter=this.m_quadTree.getIteratorForQT(),this.m_bQuadTree=!0,this.m_bSwapElements=!0,c(g)?(this.m_queryType=g,this.m_function=this.nextPath_,a?this.m_pathIndex=n.getPathCount():this.m_segIter=n.querySegmentIterator()):(this.m_queryType=g,this.m_function=this.nextPoint_,this.m_pointIndex=n.getPointCount())),this.m_bQuadTree||null!==r&&(this.m_bDone=!1,this.m_tolerance=i,this.m_quadTree=r,this.m_qtIter=this.m_quadTree.getIteratorForQT(),this.m_bQuadTree=!0,this.m_bSwapElements=!1,c(l)?(this.m_queryType=l,this.m_function=this.nextPath_,a?this.m_pathIndex=t.getPathCount():this.m_segIter=t.querySegmentIterator()):(this.m_queryType=l,this.m_function=this.nextPoint_,this.m_pointIndex=t.getPointCount())),this.m_bQuadTree||(a&&c(l)&&c(g)?this.m_intersector=He(t,n,i):c(l)&&c(g)?(this.m_intersector=De(t,n,i),this.m_bSwapElements=!1):c(l)&&!c(g)?(this.m_intersector=Ve(t,n,i),this.m_bSwapElements=!1):!c(l)&&c(g)?(this.m_intersector=Ve(n,t,i),this.m_bSwapElements=!0):(this.m_intersector=Fe(t,n,i),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(),s=new e;return t.queryLooseEnvelope(s),!s.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 We;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(e.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&&(c(this.m_queryType)?(this.m_function=this.m_bPaths?this.nextPath_:this.nextSegment_,!0):(this.m_function=this.nextPoint_,!0))}}function Tr(e){return 2===e?1:1===e?2:128===e?64:64===e?128:e}function Nr(t,s,n){let r;if(t instanceof $u||null===t){const i=e.constructEmpty();i.setCoords({pt:s}),i.mergeEnvelope2D(n),r=le(t,i,!1)}else r=t;return r}function Gr(t,s,n){let r;if(t instanceof $u||null===t){const i=e.constructEmpty();i.setCoords({env2D:s}),i.mergeEnvelope2D(n),r=le(t,i,!1)}else r=t;return r}function Dr(t,s,n,i,h){if(t.isEmpty()||s.isEmpty())return 4===i;r(t),r(s);let m=t.getGeometryType(),l=s.getGeometryType();if(m===o.enumEnvelope){if(l===o.enumEnvelope)return Vr(t,s,n,i);if(l===o.enumPoint)return Fr(s,t,n,Tr(i))}else if(m===o.enumPoint){if(l===o.enumEnvelope)return Fr(t,s,n,i);if(l===o.enumPoint)return Hr(t,s,n,i)}const g=e.constructEmpty();t.queryEnvelope(g);const u=e.constructEmpty();s.queryEnvelope(u);const c=Gr(n,g,u);if(kr(g,u,c))return 4===i;let _=!1,d=null,p=null,f=null,x=null;switch(a(m)?(d=new I({vd:t.getDescription()}),d.addSegment(t,!0),f=d,m=o.enumPolyline):f=t,a(l)?(p=new I({vd:s.getDescription()}),p.addSegment(s,!0),x=p,l=o.enumPolyline):x=s,m!==o.enumEnvelope&&l!==o.enumEnvelope?(f.getDimension()<x.getDimension()||m===o.enumPoint&&l===o.enumMultiPoint)&&(i=Tr(i)):m!==o.enumPolygon&&l!==o.enumEnvelope&&(i=Tr(i)),m){case o.enumPolygon:switch(l){case o.enumPolygon:_=Ur(f,x,c,i,h);break;case o.enumPolyline:_=qr(f,x,c,i,h);break;case o.enumPoint:_=Or(f,x,c,i);break;case o.enumMultiPoint:_=Br(f,x,c,i);break;case o.enumEnvelope:_=Rr(f,x,c,i,h)}break;case o.enumPolyline:switch(l){case o.enumPolygon:_=qr(x,f,c,i,h);break;case o.enumPolyline:_=Yr(f,x,c,i,h);break;case o.enumPoint:_=Xr(f,x,c,i);break;case o.enumMultiPoint:_=Lr(f,x,c,i);break;case o.enumEnvelope:_=zr(f,x,c,i,h)}break;case o.enumPoint:switch(l){case o.enumPolygon:_=Or(x,f,c,i);break;case o.enumPolyline:_=Xr(x,f,c,i);break;case o.enumMultiPoint:_=jr(x,f,c,i)}break;case o.enumMultiPoint:switch(l){case o.enumPolygon:_=Br(x,f,c,i);break;case o.enumPolyline:_=Lr(x,f,c,i);break;case o.enumMultiPoint:_=Wr(f,x,c,i);break;case o.enumPoint:_=jr(f,x,c,i);break;case o.enumEnvelope:_=Zr(f,x,c,i)}break;case o.enumEnvelope:switch(l){case o.enumPolygon:_=Rr(x,f,c,i,h);break;case o.enumPolyline:_=zr(x,f,c,i,h);break;case o.enumMultiPoint:_=Zr(x,f,c,i)}}return _}function Vr(t,s,n,r,i){if(t.isEmpty()||s.isEmpty())return 4===r;const o=e.constructEmpty();t.queryEnvelope(o);const a=e.constructEmpty();s.queryEnvelope(a);const h=Gr(n,o,a);switch(r){case 4:return kr(o,a,h);case 2:return ao(a,o,h,!1);case 128:return ao(a,o,h,!0);case 1:return ao(o,a,h,!1);case 64:return ao(o,a,h,!0);case 3:return ro(o,a,h);case 8:return io(o,a,h);case 32:return oo(o,a,h);case 16:return!1}return!1}function Fr(t,s,n,r,i){if(t.isEmpty()||s.isEmpty())return 4===r;const o=t.getXY(),a=e.constructEmpty();s.queryEnvelope(a);const h=Nr(n,o,a);switch(r){case 4:return Mr(o,a,h);case 2:case 128:return no(o,a,h);case 1:case 64:return!1;case 3:return to(o,a,h);case 8:return so(o,a,h)}return!1}function Hr(t,s,n,r,i){if(t.isEmpty()||s.isEmpty())return 4===r;const o=t.getXY(),a=s.getXY();let h;if(n instanceof $u||null===n){const t=e.constructEmpty();t.setCoords({pt:o}),t.merge(a),h=le(n,t,!1)}else h=n;switch(r){case 4:return $i(o,a,h);case 2:case 128:return eo(a,o,h);case 1:case 64:return eo(o,a,h);case 3:return Ji(o,a,h)}return!1}function kr(t,s,n){const r=e.constructEmpty();return r.setCoords({env2D:s}),r.inflateCoords(n,n),!t.isIntersecting(r)}function Ar(e,t,n,r=!1){const i=e.getGeometryType(),o=t.getGeometryType();if(m(i)){const t=e.getImpl().getAccelerators();if(null!==t){const e=t.getRasterizedGeometry();s(null===e)}}if(m(o)){const e=t.getImpl().getAccelerators();if(null!==e){const t=e.getRasterizedGeometry();s(null===t)}}return 0}function Mr(t,s,n,r){const i=e.constructEmpty();return i.setCoords({env2D:s}),i.inflateCoords(n,n),!i.contains(t)}function Ur(e,t,s,n,r){switch(n){case 4:return Qr(e,t,s);case 2:return ei(t,e,s,r);case 128:return ti(t,e,s);case 1:return ei(e,t,s,r);case 64:return ti(e,t,s);case 3:return Kr(e,t,s,r);case 8:return Jr(e,t,s);case 32:return $r(e,t,s,r)}return!1}function qr(e,t,s,n,r){switch(n){case 4:return si(e,t,s);case 1:return ii(e,t,s,r);case 64:return oi(e,t,s);case 8:return ni(e,t,s,r);case 16:return ri(e,t,s)}return!1}function Or(e,t,s,n,r){switch(n){case 4:return ai(e,t,s);case 1:case 64:return mi(e,t,s);case 8:return hi(e,t,s)}return!1}function Br(e,t,s,n,r){switch(n){case 4:return li(e,t,s);case 1:return ci(e,t,s,!1);case 64:return ci(e,t,s,!0);case 8:return gi(e,t,s);case 16:return ui(e,t,s)}return!1}function Rr(e,t,s,n,r){if(di(e,t,s))return 4===n;if(4===n)return!1;switch(n){case 2:return xi(e,t,s,!1);case 128:return xi(e,t,s,!0);case 1:return yi(e,t,s,!1,r);case 64:return yi(e,t,s,!0,r);case 3:return _i(e,t,s,r);case 8:return pi(e,t,s,r);case 32:return fi(e,t,s,r);case 16:return!1}return!1}function Yr(e,t,s,n,r){switch(n){case 4:return Ei(e,t,s);case 2:return bi(t,e,s,r);case 128:return wi(t,e,s,r);case 1:return bi(e,t,s,r);case 64:return wi(e,t,s,r);case 3:return Pi(e,t,s,r);case 8:return Si(e,t,s,r);case 32:return Ii(e,t,s,r);case 16:return Ci(e,t,s,r)}return!1}function Xr(e,t,s,n,r){switch(n){case 4:return vi(e,t,s);case 1:case 64:return Ni(e,t,s);case 8:return Ti(e,t,s)}return!1}function Lr(e,t,s,n,r){switch(n){case 4:return Gi(e,t,s);case 1:case 64:return Fi(e,t,s);case 8:return Di(e,t,s);case 16:return Vi(e,t,s)}return!1}function zr(e,t,s,n,r){if(ki(e,t,s))return 4===n;if(4===n)return!1;switch(n){case 2:return Mi(e,t,s,!1);case 128:return Mi(e,t,s,!0);case 1:case 64:case 32:return!1;case 3:return Hi(e,t,s);case 8:return Ai(e,t,s,r);case 16:return Ui(e,t,s)}return!1}function Wr(e,t,s,n,r){switch(n){case 4:return Oi(e,t,s);case 2:case 128:return Ri(t,e,s);case 1:case 64:return Ri(e,t,s);case 3:return qi(e,t,s);case 32:return Bi(e,t,s)}return!1}function jr(e,t,s,n,r){switch(n){case 4:return Xi(e,t,s);case 2:case 128:return Li(e,t,s);case 1:case 64:return zi(e,t,s);case 3:return Yi(e,t,s)}return!1}function Zr(e,t,s,n,r){switch(n){case 4:return ji(e,t,s);case 2:return Ki(e,t,s,!1);case 128:return Ki(e,t,s,!0);case 1:case 64:return!1;case 3:return Wi(e,t,s);case 8:return Zi(e,t,s);case 16:return Qi(e,t,s)}return!1}function Kr(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();if(t.queryEnvelope(i),s.queryEnvelope(o),!ro(i,o,n))return!1;if(Ar(t,s),_o(t,s,n))return!0;const a=t.calculateLength2D(),h=s.calculateLength2D(),m=Math.max(t.getPointCount(),s.getPointCount());if(Math.abs(a-h)>4*m*n)return!1;if(t.hasNonLinearSegments()||s.hasNonLinearSegments()){return Jn(t,s,n,"**F**FFF*",r,!1)}return xo(t,s,n,!0)}function Qr(e,t,s,n){Ar(e,t,s,!0);return 1===ho(e,t,s,!0)}function Jr(e,t,s,n){return Ar(e,t),wo(e,t,s,null)}function $r(e,t,s,n){return Ar(e,t),vo(e,t,s,n)}function ei(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();return t.queryEnvelope(i),s.queryEnvelope(o),!!go(i,o,n)&&(Ar(t,s),To(t,s,n,r))}function ti(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();return t.queryEnvelope(i),s.queryEnvelope(o),!!go(i,o,n)&&(Ar(t,s),2===ho(t,s,n,!1))}function si(e,t,s,n){Ar(e,t,s,!0);return 1===ho(e,t,s,!0)}function ni(e,t,s,n){return Ar(e,t),No(e,t,s,n)}function ri(e,t,s,n){return Ar(e,t),Go(e,t,s,null)}function ii(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();return t.queryEnvelope(i),s.queryEnvelope(o),!!go(i,o,n)&&(Ar(t,s),Do(t,s,n,r))}function oi(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();return t.queryEnvelope(i),s.queryEnvelope(o),!!go(i,o,n)&&(Ar(t,s),2===ho(t,s,n,!1))}function ai(e,t,s,n){return 0===Oo(e,t,s)}function hi(e,t,s,n){return Fo(e,t.getXY(),s)}function mi(e,t,s,n){return Vo(e,t.getXY(),s)}function li(e,t,s,n,r){Ar(e,t);return 1===mo(e,t,s)}function gi(t,s,n,r){Ar(t,s);const i=e.constructEmpty();t.queryEnvelope(i),i.inflateCoords(n,n);const o=new We;let a=!1;const h=t.getImpl(),m=new C;let l=t,g=!1;for(let e=0;e<s.getPointCount();e++){if(s.queryXY(e,o),i.contains(o)){const e=Bo(l,o,n);if(2===e)a=!0;else if(1===e)return!1}g||(!Yn(t,s.getPointCount()-1)||null!==h.getAccelerators()&&null!==h.getAccelerators().getQuadTree()?l=t:(t.copyTo(m),m.getImpl().buildQuadTreeAccelerator(1),l=m),g=!0)}return!!a}function ui(t,s,n,r){Ar(t,s);const i=new e,o=new e,a=new e;t.queryEnvelope(i),s.queryEnvelope(a),o.setCoords({env2D:i}),o.inflateCoords(n,n);let h=!1,m=!1;const l=new We,g=t.getImpl(),u=new C;let c=t,_=!1;for(let e=0;e<s.getPointCount();e++){if(s.queryXY(e,l),o.contains(l)){const e=Bo(c,l,n);0===e?m=!0:1===e&&(h=!0)}else m=!0;if(h&&m)return!0;_||(!Yn(t,s.getPointCount()-1)||null!==g.getAccelerators()&&null!==g.getAccelerators().getQuadTree()?c=t:(t.copyTo(u),u.getImpl().buildQuadTreeAccelerator(1),c=u),_=!0)}return!1}function ci(t,s,n,r,i){const o=e.constructEmpty(),a=e.constructEmpty();if(t.queryEnvelope(o),s.queryEnvelope(a),!go(o,a,n))return!1;Ar(t,s);let h=!1;const m=new We,l=t.getImpl(),g=new C;let u=t,c=!1;for(let e=0;e<s.getPointCount();e++){if(s.queryXY(e,m),!o.contains(m))return!1;const i=Bo(u,m,n);if(1===i)h=!0;else if(0===i)return!1;if(r&&2===i)return!1;c||(!Yn(t,s.getPointCount()-1)||null!==l.getAccelerators()&&null!==l.getAccelerators().getQuadTree()?u=t:(t.copyTo(g),g.getImpl().buildQuadTreeAccelerator(1),u=g),c=!0)}return h}function _i(t,s,n,r){const i=new e,o=new e;if(t.queryEnvelope(i),s.queryEnvelope(o),!ro(i,o,n))return!1;const a=new C;return a.addEnvelope(s,!1),Kr(t,a,n,r)}function di(t,s,n,r){Ar(t,s);const i=e.constructEmpty(),o=e.constructEmpty();if(t.queryEnvelope(i),s.queryEnvelope(o),go(o,i,n))return!1;return 0===Bo(t,o.getLowerLeft(),0)&&(!o.contains(t.getXY(0))&&!bo(t,o,n))}function pi(t,s,n,r){Ar(t,s);const i=new e,o=new e;if(t.queryEnvelope(i),s.queryEnvelope(o),go(o,i,n))return!1;if(o.height()<=n||o.width()<=n)return!1;const a=new C;return a.addEnvelope(s,!1),wo(t,a,n,r)}function fi(t,s,n,r){Ar(t,s);const i=new e,o=new e;if(t.queryEnvelope(i),s.queryEnvelope(o),go(o,i,n))return!1;if(o.height()<=n||o.width()<=n)return!1;const a=new C;return a.addEnvelope(s,!1),vo(t,a,n,r)}function xi(t,s,n,r,i){const o=e.constructEmpty(),a=e.constructEmpty();return t.queryEnvelope(o),s.queryEnvelope(a),r?uo(a,o,n):go(a,o,n)}function yi(t,s,n,r,i){const o=e.constructEmpty(),a=e.constructEmpty();if(t.queryEnvelope(o),s.queryEnvelope(a),!go(o,a,n))return!1;Ar(t,s);const h=new C;return h.addEnvelope(s,!1),r?2===ho(t,h,n,!1):To(t,h,n,i)}function Pi(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();if(t.queryEnvelope(i),s.queryEnvelope(o),!ro(i,o,n))return!1;if(Ar(t,s),_o(t,s,n))return!0;if(t.hasNonLinearSegments()||s.hasNonLinearSegments()){return Jn(t,s,n,"**F**FFF*",r,!1)}return xo(t,s,n,!1)}function Ei(e,t,s,n){Ar(e,t);const r=e.getImpl(),i=t.getImpl();return!new vr(r,i,s,!0).next()||!Po(e,t,s)}function Si(t,s,n,r){Ar(t,s);const i=[],o=Eo(t,s,n,i);if(-2===o){const i=e.constructEmpty(),o=e.constructEmpty(),a=e.constructEmpty();let h,m;if(t.queryEnvelope(i),s.queryEnvelope(o),i.inflateCoords(1e3*n,1e3*n),o.inflateCoords(1e3*n,1e3*n),a.setCoords({env2D:i}),a.intersect(o),t.getPointCount()>10){if(h=Lt(t,a,n,0,r),h.isEmpty())return!1}else h=t;if(s.getPointCount()>10){if(m=Lt(s,a,n,0,r),m.isEmpty())return!1}else m=s;return Jn(h,m,n,"F********",r,!1)}if(0!==o)return!1;const a=new w;for(let e=0;e<i.length;e+=2){const t=i[e],s=i[e+1];a.addXY(t,s)}const h=t.getBoundary(),m=s.getBoundary();return h.addPoints(m,0,m.getPointCount()),!h.isEmpty()&&Ri(h,a,n)}function Ci(t,s,n,r){Ar(t,s);const i=[],o=Eo(t,s,n,i);if(-2===o){const i=e.constructEmpty(),o=e.constructEmpty(),a=e.constructEmpty();let h,m;if(t.queryEnvelope(i),s.queryEnvelope(o),i.inflateCoords(1e3*n,1e3*n),o.inflateCoords(1e3*n,1e3*n),a.setCoords({env2D:i}),a.intersect(o),t.getPointCount()>10){if(h=Lt(t,a,n,0,r),h.isEmpty())return!1}else h=t;if(s.getPointCount()>10){if(m=Lt(s,a,n,0,r),m.isEmpty())return!1}else m=s;return Jn(h,m,n,"0********",r,!1)}if(0!==o)return!1;const a=new w;for(let e=0;e<i.length;e+=2){const t=i[e],s=i[e+1];a.addXY(t,s)}const h=t.getBoundary(),m=s.getBoundary();return h.addPoints(m,0,m.getPointCount()),!!h.isEmpty()||!Ri(h,a,n)}function Ii(t,s,n,r){Ar(t,s);const i=e.constructEmpty(),o=e.constructEmpty();t.queryEnvelope(i),s.queryEnvelope(o);const a=co(i,o,n),h=co(o,i,n),m=t.hasNonLinearSegments(),l=s.hasNonLinearSegments(),g=Eo(t,s,n,null);if(-1===g)return!1;if(1===g){if(a&&h)return!0;if(!m&&!l)return a&&!h?!yo(s,t,n,!1):h&&!a?!yo(t,s,n,!1):!yo(t,s,n,!1)&&!yo(s,t,n,!1)}const u=e.constructEmpty(),c=e.constructEmpty(),_=e.constructEmpty();let d,p;u.setCoords({env2D:i}),u.inflateCoords(1e3*n,1e3*n),c.setCoords({env2D:o}),c.inflateCoords(1e3*n,1e3*n),_.setCoords({env2D:u}),_.intersect(c);let f="";if(f+="1*",a){if(s.getPointCount()>10){if(p=Lt(s,_,n,0,r),p.isEmpty())return!1}else p=s;f+="****"}else p=s,f+="T***";if(h){if(t.getPointCount()>10){if(d=Lt(t,_,n,0,r),d.isEmpty())return!1}else d=t;f+="***"}else d=t,f+="T**";return Jn(d,p,n,f,r,!1)}function bi(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();if(t.queryEnvelope(i),s.queryEnvelope(o),!go(i,o,n))return!1;if(Ar(t,s),t.hasNonLinearSegments()||s.hasNonLinearSegments()){return Jn(t,s,n,"******FF*",r,!1)}return yo(s,t,n,!1)}function wi(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();if(t.queryEnvelope(i),s.queryEnvelope(o),!go(i,o,n))return!1;Ar(t,s);return Jn(t,s,n,"T**FF*FF*",r,!1)}function vi(e,t,s,n){Ar(e,t);return!Co(e,t.getXY(),s)}function Ti(e,t,s,n){Ar(e,t);return ko(e,t.getXY(),s)}function Ni(e,t,s,n){Ar(e,t);return Io(e,t.getXY(),s)}function Gi(e,t,s,n){return Ar(e,t),!So(e,t,s,!1)}function Di(e,t,s,n){Ar(e,t);const r=e.getImpl(),i=t.getImpl(),o=new w,a=new vr(r,i,s,!1),h=r.querySegmentIterator();let m=!1;for(;a.next();){const e=a.getRedElement(),t=a.getBlueElement();h.resetToVertex(e,-1);const n=h.nextSegment(),r=i.getXY(t);n.isIntersectingPoint(r,s)&&(m=!0,o.addPoint2D(r))}if(!m)return!1;const l=e.getBoundary();return!l.isEmpty()&&Ri(l,o,s)}function Vi(e,t,s,n){Ar(e,t);const r=e.getImpl(),i=t.getImpl(),o=i.getPointCount(),a=$e(o,!1),h=new vr(r,i,s,!1),m=r.querySegmentIterator();let l=!1;for(;h.next();){const e=h.getRedElement(),t=h.getBlueElement();m.resetToVertex(e,-1);const n=m.nextSegment(),r=i.getXY(t);n.isIntersectingPoint(r,s)&&(l=!0,a[t]=!0)}if(!l)return!1;let g=!1;for(let _=0;_<o;_++)if(!a[_]){g=!0;break}if(!g)return!1;const u=e.getBoundary();if(u.isEmpty())return!0;const c=new w;for(let _=0;_<o;_++)a[_]&&c.addPoint2D(i.getXY(_));return!Ri(u,c,s)}function Fi(t,s,n,r,i){const o=e.constructEmpty(),a=e.constructEmpty();if(t.queryEnvelope(o),s.queryEnvelope(a),!go(o,a,n))return!1;Ar(t,s);const h=So(t,s,n,!0);if(!h)return h;const m=t.getBoundary();return m.isEmpty()?h:!Ri(m,s,n)}function Hi(t,s,n,r){const i=new e,o=new e;return t.queryEnvelope(i),s.queryEnvelope(o),!(o.height()>n&&o.width()>n)&&ro(i,o,n)}function ki(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();t.queryEnvelope(i),s.queryEnvelope(o);const a=Ao(o,i,n);return 0===a?!bo(t,o,n):4===a}function Ai(t,s,n,r){const i=new e,a=new e;if(t.queryEnvelope(i),s.queryEnvelope(a),a.height()<=n||a.width()<=n)return!1;const h=new e,m=new e;if(h.setCoords({env2D:a}),m.setCoords({env2D:a}),h.inflateCoords(n,n),m.inflateCoords(-n,-n),m.containsEnvelope(i)||!i.isIntersecting(h))return!1;const g=t.getImpl().querySegmentIterator();g.stripAttributes();const u=t.getImpl().getAccelerators();let c=null,_=null;null!==u&&(c=u.getQuadTree(),null!==c&&(_=c.getIterator(a,n))),_||g.nextPath()||l("relational_operations");let d=!1,p=null;const f=new We,x=new We,y=t.hasNonLinearSegments();let P=!1;for(;;){if(null!==_){const e=_.next();if(-1===e)break;g.resetToVertex(c.getElement(e),-1),p=g.nextSegment()}else{for(;!g.hasNextSegment()&&g.nextPath(););if(!g.hasNextSegment())break;p=g.nextSegment()}if(y&&p.getGeometryType()!==o.enumLine){const t=new e;if(p.queryEnvelope(t),m.containsEnvelope(t))return!1;if(h.isIntersecting(t)){P=!0;break}}else{f.assign(p.getStartXY()),x.assign(p.getEndXY());let e=m.clipLine(f,x);if(0!==e)return!1;d||(e=h.clipLine(f,x),0!==e&&(d=!0))}}if(!P)return d;const E=new C;return E.addEnvelope(a,!1),ni(E,t,n,r)}function Mi(t,s,n,r,i){const a=e.constructEmpty(),h=e.constructEmpty();if(t.queryEnvelope(a),s.queryEnvelope(h),h.height()<=n||h.width()<=n)return!1;if(r)return uo(h,a,n);if(!go(h,a,n))return!1;const m=e.constructEmpty();m.setCoords({env2D:h}),m.inflateCoords(-n,-n);const g=e.constructEmpty();if(g.setCoords({env2D:h}),g.inflateCoords(n,n),m.containsEnvelope(a))return!0;const u=t.getImpl().querySegmentIterator();u.stripAttributes(),u.nextPath()||l("relational_operations");let c,_,d,p,f,x,y=!1;const P=t.hasNonLinearSegments();for(P&&(d=new V,p=new V,f=new V,x=new V,m.querySide(0,d),m.querySide(1,p),m.querySide(2,f),m.querySide(3,x));;){for(;!u.hasNextSegment()&&u.nextPath(););if(!u.hasNextSegment())break;const e=u.nextSegment();if(P&&e.getGeometryType()!==o.enumLine){if(e.isIntersecting(d,n)){y=!0;break}if(e.isIntersecting(p,n)){y=!0;break}if(e.isIntersecting(f,n)){y=!0;break}if(e.isIntersecting(x,n)){y=!0;break}}else{c=e.getStartXY(),_=e.getEndXY();if(0!==m.clipLine(c,_)){y=!0;break}}}return y}function Ui(t,n,r,i){const a=new e,h=new e;if(t.queryEnvelope(a),n.queryEnvelope(h),h.height()<=r||h.width()<=r)return!1;const m=new e;if(m.setCoords({env2D:h}),m.inflateCoords(r,r),m.containsEnvelope(a))return!1;const l=!0,g=new e;if(g.setCoords({env2D:h}),g.inflateCoords(-r,-r),!g.isIntersecting(a))return!1;const u=t.getImpl().querySegmentIterator();u.stripAttributes();const c=t.getImpl().getAccelerators();let _=null,d=null;if(null!==c&&(_=c.getQuadTree(),null!==_&&(d=_.getIterator(h,r))),!d){const e=u.nextPath();s(e)}let p=!1,f=null;const x=new We,y=new We;let P=null,E=null,S=null,C=null;for(t.hasNonLinearSegments()&&(P=new V,E=new V,S=new V,C=new V,g.querySide(0,P),g.querySide(1,E),g.querySide(2,S),g.querySide(3,C));;){if(null!==d){const e=d.next();if(-1===e)break;u.resetToVertex(_.getElement(e),-1),f=u.nextSegment()}else{for(;!u.hasNextSegment()&&u.nextPath(););if(!u.hasNextSegment())break;f=u.nextSegment()}if(f.getGeometryType()===o.enumLine){x.assign(f.getStartXY()),y.assign(f.getEndXY());if(0!==g.clipLine(x,y)){p=!0;break}}else{if(P.isIntersecting(f,r)){p=!0;break}if(E.isIntersecting(f,r)){p=!0;break}if(S.isIntersecting(f,r)){p=!0;break}if(C.isIntersecting(f,r)){p=!0;break}}}return p&&l}function qi(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();return t.queryEnvelope(i),s.queryEnvelope(o),!!ro(i,o,n)&&(!!po(t,s,n)||fo(t,s,n,!1,!0,!1))}function Oi(e,t,s,n){const r=e,i=t,o=new vr(r,i,s,!1),a=s*s,h=new We,m=new We;for(;o.next();){const e=o.getRedElement(),t=o.getBlueElement();if(r.queryXY(e,h),i.queryXY(t,m),We.sqrDistance(h,m)<=a)return!1}return!0}function Bi(e,t,s,n){return fo(e,t,s,!1,!1,!0)}function Ri(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();return t.queryEnvelope(i),s.queryEnvelope(o),!!go(i,o,n)&&fo(s,t,n,!0,!1,!1)}function Yi(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();return t.queryEnvelope(i),s.queryEnvelope(o),ro(i,o,n)}function Xi(e,t,s,n){return Ho(e,t.getXY(),s)}function Li(e,t,s,n){return Yi(e,t,s)}function zi(e,t,s,n){return!Xi(e,t,s)}function Wi(t,s,n,r){const i=new e,o=new e;return t.queryEnvelope(i),s.queryEnvelope(o),!(o.height()>n||o.width()>n)&&ro(i,o,n)}function ji(t,s,n,r){const i=e.constructEmpty(),o=e.constructEmpty();if(t.queryEnvelope(i),s.queryEnvelope(o),go(o,i,n))return!1;const a=e.constructEmpty();a.setCoords({env2D:o}),a.inflateCoords(n,n);const h=new We;for(let e=0;e<t.getPointCount();e++)if(t.queryXY(e,h),a.contains(h))return!1;return!0}function Zi(t,s,n,r){const i=new e,o=new e,a=new e;if(s.queryEnvelope(i),i.height()<=n||i.width()<=n)return!1;o.setCoords({env2D:i}),a.setCoords({env2D:i}),o.inflateCoords(n,n),a.inflateCoords(-n,-n);const h=new We;let m=!1;for(let e=0;e<t.getPointCount();e++)if(t.queryXY(e,h),o.contains(h)){if(a.containsExclusive(h))return!1;m=!0}return m}function Ki(t,s,n,r,i){const o=e.constructEmpty(),a=e.constructEmpty();if(t.queryEnvelope(o),s.queryEnvelope(a),a.height()<=n||a.width()<=n)return!1;if(r)return uo(a,o,n);if(!go(a,o,n))return!1;let h=!1;const m=e.constructEmpty(),l=e.constructEmpty();m.setCoords({env2D:a}),l.setCoords({env2D:a}),m.inflateCoords(-n,-n),l.inflateCoords(n,n);const g=new We;for(let e=0;e<t.getPointCount();e++){if(t.queryXY(e,g),!l.contains(g))return!1;m.containsExclusive(g)&&(h=!0)}return h}function Qi(t,s,n,r){const i=new e,o=new e;if(t.queryEnvelope(i),s.queryEnvelope(o),go(o,i,n))return!1;if(o.height()<=n||o.width()<=n)return!1;const a=new e,h=new e;a.setCoords({env2D:o}),a.inflateCoords(-n,-n),h.setCoords({env2D:o}),h.inflateCoords(n,n);const m=new We;let l=!1,g=!1;for(let e=0;e<t.getPointCount();e++)if(t.queryXY(e,m),!l&&a.containsExclusive(m)&&(l=!0),g||h.contains(m)||(g=!0),l&&g)return!0;return!1}function Ji(e,t,s,n){return We.sqrDistance(e,t)<=s*s}function $i(e,t,s,n){return We.sqrDistance(e,t)>s*s}function eo(e,t,s,n){return Ji(e,t,s)}function to(t,s,n,r){const i=new e;return i.setCoords({pt:t}),ro(i,s,n)}function so(t,s,n,r){if(s.height()<=n||s.width()<=n)return!1;const i=new e,o=new e;return i.setCoords({env2D:s}),i.inflateCoords(n,n),!!i.contains(t)&&(o.setCoords({env2D:s}),o.inflateCoords(-n,-n),!o.containsExclusive(t))}function no(t,s,n,r){if(s.height()<=n||s.width()<=n)return!1;const i=e.constructEmpty();i.setCoords({env2D:s}),i.inflateCoords(-n,-n);return i.containsExclusive(t)}function ro(e,t,s,n){return go(e,t,s)&&go(t,e,s)}function io(t,s,n,r){if(t.height()<=n||t.width()<=n||s.height()<=n||s.width()<=n)return!1;const i=new e;return i.setCoords({env2D:t}),i.inflateCoords(-n,-n),i.intersect(s),!(!i.isEmpty()&&i.height()>n&&i.width()>n)&&(i.setCoords({env2D:t}),i.inflateCoords(n,n),i.intersect(s),!i.isEmpty())}function oo(t,s,n,r){if(t.height()<=n||t.width()<=n||s.height()<=n||s.width()<=n)return!1;if(go(t,s,n))return!1;if(go(s,t,n))return!1;const i=new e;return i.setCoords({env2D:t}),i.inflateCoords(-n,-n),i.intersect(s),!i.isEmpty()&&(i.height()>n||i.width()>n)}function ao(t,s,n,r,i){if(t.height()<=n||t.width()<=n)return!1;if(r)return uo(t,s,n);if(!go(t,s,n))return!1;const o=e.constructEmpty();return o.setCoords({env2D:t}),o.inflateCoords(-n,-n),o.intersect(s),!o.isEmpty()}function ho(t,s,n,r,i){const a=new We,h=new We,m=e.constructEmpty(),l=e.constructEmpty(),g=t.getImpl(),u=s.getImpl(),c=u.getGeometryType(),_=new vr(g,u,n,!0);if(!_.next())return 1;if(Po(t,s,n))return r?4:0;const d=new C;let p=t;const f=new C;let x=null;c===o.enumPolygon&&(x=s);const y=c===o.enumPolygon?$e(g.getPathCount(),!1):[],P=$e(u.getPathCount(),!1);let E=!1,S=!1,I=!1,b=!1,w=!1,v=!1;do{if(I&&w||b&&v)break;if(I&&b)break;const e=_.getRedElement(),i=_.getBlueElement();if(!P[i]&&(h.assign(s.getXY(s.getPathStart(i))),m.setCoords({env2D:_.getRedEnvelope()}),m.inflateCoords(n,n),m.contains(h))){if(0!==Bo(p,h,0)){if(b=!0,r)return 4}else v=!0;P[i]=!0}if(c===o.enumPolygon&&!y[e]&&(a.assign(t.getXY(t.getPathStart(e))),l.setCoords({env2D:_.getBlueEnvelope()}),l.inflateCoords(n,n),l.contains(a))){if(0!==Bo(x,a,0)){if(I=!0,r)return 4}else w=!0;y[e]=!0}if(E||(!Yn(t,s.getPathCount()-1)||null!==g.getAccelerators()&&null!==g.getAccelerators().getQuadTree()?p=t:(t.copyTo(d),d.getImpl().buildQuadTreeAccelerator(1),p=d),E=!0),c===o.enumPolygon&&!S){const e=s;!Yn(e,t.getPathCount()-1)||null!==u.getAccelerators()&&null!==u.getAccelerators().getQuadTree()?x=s:(e.copyTo(f),f.getImpl().buildQuadTreeAccelerator(1),x=f),S=!0}}while(_.next());if(!I&&!b)return 1;if(!w||!v){if(c===o.enumPolygon)for(let e=0,t=g.getPathCount();e<t;e++)if(!y[e]){w=!0;break}for(let e=0,t=u.getPathCount();e<t;e++)if(!P[e]){v=!0;break}}return I&&w||b&&v||I&&b?4:b?2:3}function mo(t,s,n,r,i){const o=e.constructEmpty();t.queryEnvelope(o),o.inflateCoords(n,n);const a=new We,h=t.getImpl(),m=new C;let l=t,g=!1,u=!1,c=!1;for(let e=0;e<s.getPointCount();e++){if(s.queryXY(e,a),o.contains(a)){const e=Bo(l,a,n);if(1===e)return u=!0,4;if(2===e)return 4;c=!0}else c=!0;g||(!Yn(t,s.getPointCount()-1)||null!==h.getAccelerators()&&null!=h.getAccelerators().getQuadTree()?l=t:(t.copyTo(m),m.getImpl().buildQuadTreeAccelerator(1),l=m),g=!0)}return u?c?4:2:1}function lo(t,n,r,i,a){i[0]=!1;const h=t.getImpl(),m=n.getImpl(),l=h.querySegmentIterator(),g=m.querySegmentIterator(),u=[0,0],c=[0,0],_=new vr(h,m,r);let d=!1;for(;_.next();){const e=_.getRedElement(),t=_.getBlueElement();l.resetToVertex(e,-1),g.resetToVertex(t,-1);const s=l.nextSegment(),n=g.nextSegment();let o=0;if(Mo(s,n)?!d&&n.isIntersecting(s,r)&&(d=!0):o=n.intersect(s,null,c,u,r),0!==o&&(d=!0,1===o)){const e=u[0],t=c[0];if(e>0&&e<1&&t>0&&t<1)return i[0]=!0,!1}}if(!d){i[0]=!0;const a=e.constructEmpty();t.queryEnvelope(a),a.inflateCoords(r,r);const l=new C;let g=t,u=!1;for(let r=0,i=n.getPathCount();r<i;r++)if(n.getPathSize(r)>0){const i=e.constructEmpty();if(n.queryPathEnvelope(r,i),!a.isIntersecting(i))return!1;{const e=Rn(g,n.getXY(n.getPathStart(r)),0);if(s(-1!==e),0===e)return!1}u||(!Yn(t,n.getPathCount()-1)||null!==h.getAccelerators()&&null!==h.getAccelerators().getQuadTree()?g=t:(t.copyTo(l),l.getImpl().buildQuadTreeAccelerator(1),g=l),u=!0)}if(1===t.getPathCount()||n.getGeometryType()===o.enumPolyline)return!0;const c=n,_=e.constructEmpty();c.queryEnvelope(_),_.inflateCoords(r,r);const d=new C;let p=c,f=!1;for(let n=0,r=t.getPathCount();n<r;n++)if(t.getPathSize(n)>0){const r=e.constructEmpty();if(t.queryPathEnvelope(n,r),_.isIntersecting(r)){const e=Rn(p,t.getXY(t.getPathStart(n)),0);if(s(-1!==e),1===e)return!1}f||(!Yn(c,t.getPathCount()-1)||null!==m.getAccelerators()&&null!==m.getAccelerators().getQuadTree()?p=c:(c.copyTo(d),d.getImpl().buildQuadTreeAccelerator(1),p=d),f=!0)}return!0}return!1}function go(t,s,n){const r=e.constructEmpty();return r.setCoords({env2D:t}),r.inflateCoords(n,n),r.containsEnvelope(s)}function uo(t,s,n){const r=e.constructEmpty();return r.setCoords({env2D:s}),r.inflateCoords(n,n),t.containsExclusiveEnvelope(r)}function co(t,s,n){const r=e.constructEmpty();return r.setCoords({env2D:s}),r.inflateCoords(n,n),!r.contains(t.getLowerLeft())||(!r.contains(t.getLowerRight())||(!r.contains(t.getUpperLeft())||!r.contains(t.getUpperRight())))}function _o(e,t,s,n){if(e.getPathCount()!==t.getPathCount()||e.getPointCount()!==t.getPointCount())return!1;if(e.hasNonLinearSegments()||t.hasNonLinearSegments())return e.equals(t);const r=new We,i=new We;let o=!0;const a=s*s;for(let h=0;h<e.getPathCount();h++){if(e.getPathEnd(h)!==t.getPathEnd(h)){o=!1;break}for(let s=e.getPathStart(h);s<t.getPathEnd(h);s++)if(e.queryXY(s,r),t.queryXY(s,i),We.sqrDistance(r,i)>a){o=!1;break}if(!o)break}return!!o}function po(e,t,s,n){if(e.getPointCount()!==t.getPointCount())return!1;const r=new We,i=new We;let o=!0;const a=s*s;for(let h=0;h<e.getPointCount();h++)if(e.queryXY(h,r),t.queryXY(h,i),We.sqrDistance(r,i)>a){o=!1;break}return!!o}function fo(e,t,s,n,r,i,o){const a=e.getImpl(),h=t.getImpl(),m=a.getPointCount(),l=h.getPointCount(),g=$e(m,!1),u=r||i?$e(l,!1):[],c=s*s,_=new vr(a,h,s);for(;_.next();){const e=_.getRedElement(),t=_.getBlueElement(),s=a.getXY(e),n=h.getXY(t);We.sqrDistance(s,n)<=c&&(g[e]=!0,(r||i)&&(u[t]=!0))}let d=!1,p=!1;for(let y=0;y<m;y++){const e=g[y];if(d||=!e,p||=e,(r||n)&&d)return!1}if(n)return!0;let f=!1,x=!1;for(let y=0;y<l;y++){const e=u[y];if(f||=!e,x||=e,r&&f)return!1}return!!r||d&&p&&f&&x}function xo(e,t,s,n){return yo(e,t,s,n)&&yo(t,e,s,n)}function yo(t,s,r,i){if(n(t),n(s),s.isEmpty())return!1;let o=!0;const a=$e(2,Number.NaN),h=$e(2,Number.NaN),m=[],g=new qo;let u;const c=e.constructEmpty(),_=e.constructEmpty(),d=e.constructEmpty();t.queryEnvelope(c),s.queryEnvelope(_),c.inflateCoords(r,r),_.inflateCoords(r,r),d.setCoords({env2D:c}),d.intersect(_);const p=t.getImpl().querySegmentIterator(),f=s.getImpl().querySegmentIterator(),x=s.getImpl().getAccelerators();let y=null,P=null,E=null,S=null;if(null!==x&&(y=x.getQuadTree(),P=x.getQuadTreeForPaths(),null!==P&&(S=P.getIteratorForQT())),null===y){const e=t.getPointCount(),n=s.getPointCount();e>10&&n>10&&(y=ce(s.getImpl(),d))}for(null!==y&&(E=y.getIteratorForQT());p.nextPath();)for(;p.hasNextSegment();){let e=p.nextSegment();if(e.queryEnvelope(c),!c.isIntersecting(d))return o=!1,!1;if(null!==S&&(S.resetIterator(c,r),-1===S.next()))continue;let t=0,s=null;if(null!=E)E.resetIterator(e,r);else if(f.resetToFirstPath(),!f.nextPath())return o=!1,!1;do{if(t=0,null!==E){const n=E.next();if(-1===n)return o=!1,!1;f.resetToVertex(y.getElement(n),-1),s=f.nextSegment(),t=e.intersect(s,null,a,h,r)}else{for(;!f.hasNextSegment();)if(!f.nextPath())return o=!1,!1;s=f.nextSegment(),s.queryEnvelope(_),_.inflateCoords(r,r),c.isIntersecting(_)&&(t=e.intersect(s,null,a,h,r))}}while(2!==t||0!==a[0]||i&&!(h[0]<=h[1]));let n=Number.NaN,x=!1;do{let i=!1;if(1===a[1]){if(!p.hasNextSegment()){x=!0;break}e=p.nextSegment(),i=!0}if(1===h[1]&&h[0]<=h[1]){if(-1===n)break;if(n=1,!f.hasNextSegment())break;s=f.nextSegment(),i=!0}if(0===h[1]&&h[0]>h[1]){if(1===n)break;if(Number.isNaN(n)){if(!f.hasPreviousSegment())break;f.previousSegment(),n=-1}if(!f.hasPreviousSegment())break;s=f.previousSegment(),i=!0}if(!i)break;t=e.intersect(s,null,a,h,r)}while(2===t&&(!i||h[0]<=h[1]));if(x)continue;const P=e.calculateLength2D();e.queryEnvelope(c),m.length=0,g.m_overlapEvents.length=0;let C=!1,I=!1,b=0;const w=le(null,c,!0);for(null!==E?E.resetIterator(e,r):(f.resetToFirstPath(),f.nextPath()||l("relational_operations"));;){if(t=0,null!==E){const n=E.next();if(-1===n)break;f.resetToVertex(y.getElement(n),-1),s=f.nextSegment(),t=e.intersect(s,null,a,h,r)}else{for(;!f.hasNextSegment()&&f.nextPath(););if(!f.hasNextSegment())break;s=f.nextSegment(),s.queryEnvelope(_),_.inflateCoords(r,r),c.isIntersecting(_)&&(t=e.intersect(s,null,a,h,r))}if(2===t&&(!i||h[0]<=h[1])){const e=p.getStartPointIndex(),t=p.getPathIndex(),s=f.getStartPointIndex(),n=f.getPathIndex();if(u=Uo(e,t,a[0],a[1],s,n,h[0],h[1]),g.m_overlapEvents.push(u),m.push(m.length),!(C||u.m_scalarA0<b&&u.m_scalarA1<b))if(0===b&&P*(u.m_scalarA0-b)>r)C=!0;else if(0!==b&&P*(u.m_scalarA0-b)>w)C=!0;else if(b=u.m_scalarA1,P*(1-b)<=r||1===b){I=!0;break}}}if(!I){if(!C)return o=!1,!1;m.length>1&&m.sort(((e,t)=>g.compareOverlapEvents(e,t))),b=0;for(let e=0;e<g.m_overlapEvents.length;e++)if(u=g.m_overlapEvents[m[e]],!(u.m_scalarA0<b&&u.m_scalarA1<b)){if(0===b&&P*(u.m_scalarA0-b)>r)return o=!1,!1;if(0!==b&&P*(u.m_scalarA0-b)>w)return o=!1,!1;if(b=u.m_scalarA1,P*(1-b)<=r||1===b)break}if(P*(1-b)>r)return o=!1,!1;m.length=0,g.m_overlapEvents.length=0}}return o}function Po(e,t,s){const n=e.getImpl(),r=t.getImpl(),i=n.querySegmentIterator(),o=r.querySegmentIterator(),a=new vr(n,r,s);for(;a.next();){const e=a.getRedElement(),t=a.getBlueElement();i.resetToVertex(e,-1),o.resetToVertex(t,-1);const n=i.nextSegment();if(o.nextSegment().isIntersecting(n,s))return!0}return!1}function Eo(e,t,s,n){const r=e.getImpl(),i=t.getImpl(),o=r.querySegmentIterator(),a=i.querySegmentIterator(),h=$e(2,Number.NaN),m=new vr(r,i,s);let l=!1,g=-1;for(;m.next();){const e=m.getRedElement(),t=m.getBlueElement();o.resetToVertex(e,-1),a.resetToVertex(t,-1);const r=o.nextSegment(),i=a.nextSegment();let u=0;if(Mo(r,i)){if(i.isIntersecting(r,s))return-2}else u=r.intersect(i,null,h,null,s);if(u)if(2===u){const e=r.calculateLength2D(),t=h[0];if(e*(h[1]-t)>s)return g=1,g;l=!0}else if(g=0,n){const e=h[0],t=new We;r.queryCoord2D(e,t),n.push(t.x),n.push(t.y)}}return l?-2:g}function So(e,t,s,n){const r=e.getImpl(),i=t,o=i.getPointCount(),a=n?$e(o,!1):[],h=new vr(r,i,s,!1),m=r.querySegmentIterator();for(;h.next();){const e=h.getRedElement(),t=h.getBlueElement();m.resetToVertex(e,-1);const r=m.nextSegment(),o=i.getXY(t);if(r.isIntersectingPoint(o,s)){if(!n)return!0;a[t]=!0}}if(!n)return!1;for(let l=0;l<o;l++)if(!a[l])return!1;return!0}function Co(t,s,n){const r=new We,i=n*n,o=t.querySegmentIterator(),a=t.getImpl().getAccelerators();if(null!==a){const t=a.getQuadTree();if(null!==t){const a=e.constructEmpty();a.setCoords({pt:s});const h=t.getIterator(a,n);for(let e=h.next();-1!==e;e=h.next())if(o.resetToVertex(t.getElement(e),-1),o.hasNextSegment()){const e=o.nextSegment(),t=e.getClosestCoordinate(s,!1);if(e.queryCoord2D(t,r),We.sqrDistance(s,r)<=i)return!0}return!1}}const h=e.constructEmpty();for(;o.nextPath();)for(;o.hasNextSegment();){const e=o.nextSegment();if(e.queryEnvelope(h),h.inflateCoords(n,n),!h.contains(s))continue;const t=e.getClosestCoordinate(s,!1);if(e.queryCoord2D(t,r),We.sqrDistance(s,r)<=i)return!0}return!1}function Io(e,t,s){return Co(e,t,s)&&!ko(e,t,s)}function bo(t,s,n,r){const i=t.querySegmentIterator(),a=t.getImpl().getAccelerators(),h=t.hasNonLinearSegments();let m=null,l=null,g=null,u=null;if(null!==a){const t=a.getQuadTree();if(null!==t){const r=t.getIterator(s,n);h&&(m=new V,l=new V,g=new V,u=new V,s.querySide(0,m),s.querySide(1,l),s.querySide(2,g),s.querySide(3,u));const a=e.constructEmpty();a.setCoords({env2D:s}),a.inflateCoords(n,n);for(let e=r.next();-1!==e;e=r.next())if(i.resetToVertex(t.getElement(e),-1),i.hasNextSegment()){const e=i.nextSegment();if(e.getGeometryType()===o.enumLine){const t=e.getStartXY(),s=e.getEndXY();if(a.clipLine(t,s))return!0;continue}if(s.contains(e.getStartXY())||s.contains(e.getEndXY()))return!0;if(e.isIntersecting(m,n))return!0;if(e.isIntersecting(l,n))return!0;if(e.isIntersecting(g,n))return!0;if(e.isIntersecting(u,n))return!0}return!1}}if(h){m=new V,l=new V,g=new V,u=new V,s.querySide(0,m),s.querySide(1,l),s.querySide(2,g),s.querySide(3,u);const e=t.querySegmentIterator();for(;e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(s.contains(t.getStartXY())||s.contains(t.getEndXY()))return!0;if(t.isIntersecting(m,n))return!0;if(t.isIntersecting(l,n))return!0;if(t.isIntersecting(g,n))return!0;if(t.isIntersecting(u,n))return!0}}else{const r=e.constructEmpty();r.setCoords({env2D:s}),r.inflateCoords(n,n);const i=t.getImpl(),o=i.getAttributeStreamRef(0),a=new We;for(let e=0,t=i.getPathCount();e<t;e++){let t=!0;const s=new We,n=new We,h=new We,m=i.getPathStart(e),l=new We;for(let g=m,u=i.getPathEnd(e);g<u;g++)if(t)o.queryPoint2D(2*g,s),l.assign(s),t=!1;else{if(o.queryPoint2D(2*g,a),n.setCoordsPoint2D(s),h.setCoordsPoint2D(a),r.clipLine(n,h))return!0;s.assign(a)}if(i.isClosedPath(e)&&!t&&(n.setCoordsPoint2D(s),h.setCoordsPoint2D(l),r.clipLine(n,h)))return!0}}return!1}function wo(t,s,n,r){const i=t.getImpl(),o=s.getImpl(),a=[0],h=_e(i.getIsSimple(0,a))&&_e(o.getIsSimple(0,a)),m=i.querySegmentIterator(),l=o.querySegmentIterator(),g=$e(2,0),u=$e(2,0),c=new vr(i,o,n);let _=!1;for(;c.next();){const e=c.getRedElement(),t=c.getBlueElement();m.resetToVertex(e,-1),l.resetToVertex(t,-1);const s=m.nextSegment(),r=l.nextSegment();let i=0;if(Mo(s,r)){if(r.isIntersecting(s,n)){_=!0;break}}else i=r.intersect(s,null,u,g,n);if(2===i){const e=g[0],t=g[1],r=s.calculateLength2D();if(h&&(t-e)*r>n)return!1;_=!0}else if(i){const e=g[0],t=u[0];if(e>0&&e<1&&t>0&&t<1)return!1;_=!0}}if(!_)return!1;const d=e.constructEmpty(),p=e.constructEmpty(),f=e.constructEmpty();let x,y;if(t.queryEnvelope(d),s.queryEnvelope(p),d.inflateCoords(1e3*n,1e3*n),p.inflateCoords(1e3*n,1e3*n),f.setCoords({env2D:d}),f.intersect(p),t.getPointCount()>10){if(x=Lt(t,f,n,0,r),x.isEmpty())return!1}else x=t;if(s.getPointCount()>10){if(y=Lt(s,f,n,0,r),y.isEmpty())return!1}else y=s;return Jn(x,y,n,"F********",r,!1)}function vo(t,s,n,r){const i=t.getImpl(),o=s.getImpl(),a=[0],h=_e(i.getIsSimple(0,a))&&_e(o.getIsSimple(0,a)),m=e.constructEmpty(),l=e.constructEmpty(),g=e.constructEmpty();t.queryEnvelope(m),s.queryEnvelope(l);let u=!1;const c=co(m,l,n),_=co(l,m,n),d=i.querySegmentIterator(),p=o.querySegmentIterator(),f=$e(2,Number.NaN),x=$e(2,Number.NaN),y=new vr(i,o,n);for(;y.next();){const e=y.getRedElement(),t=y.getBlueElement();d.resetToVertex(e,-1),p.resetToVertex(t,-1);const s=d.nextSegment(),r=p.nextSegment();let i=0;if(Mo(s,r)){if(r.isIntersecting(s,n))break}else i=r.intersect(s,null,x,f,n);if(2===i){const e=f[0],t=f[1],r=s.calculateLength2D();if(h&&(t-e)*r>n&&(u=!0,c&&_))return!0}else if(i){const e=f[0],t=x[0];if(e>0&&e<1&&t>0&&t<1)return!0}}const P=e.constructEmpty(),E=e.constructEmpty();let S,C;P.setCoords({env2D:m}),P.inflateCoords(1e3*n,1e3*n),E.setCoords({env2D:l}),E.inflateCoords(1e3*n,1e3*n),g.setCoords({env2D:P}),g.intersect(E);let I="";if(I+=u?"**":"T*",c){if(s.getPointCount()>10){if(C=Lt(s,g,n,0,r),C.isEmpty())return!1}else C=s;I+="****"}else C=s,I+="T***";if(_){if(t.getPointCount()>10){if(S=Lt(t,g,n,0,r),S.isEmpty())return!1}else S=t;I+="***"}else S=t,I+="T**";return Jn(S,C,n,I,r,!1)}function To(t,s,n,r){const i=[!1],o=lo(t,s,n,i);if(i[0])return o;const a=e.constructEmpty();let h;if(s.queryEnvelope(a),a.inflateCoords(1e3*n,1e3*n),t.getPointCount()>10){if(h=Lt(t,a,n,0,r),h.isEmpty())return!1}else h=t;return $n(h,s,n,r)}function No(t,s,n,r){const i=t.getImpl(),o=s.getImpl(),a=i.querySegmentIterator(),h=o.querySegmentIterator(),m=$e(2,Number.NaN),l=$e(2,Number.NaN),g=new vr(i,o,n);let u=!1;for(;g.next();){const e=g.getRedElement(),t=g.getBlueElement();a.resetToVertex(e,-1),h.resetToVertex(t,-1);const s=a.nextSegment(),r=h.nextSegment();let i=0;if(Mo(s,r)?!u&&r.isIntersecting(s,n)&&(u=!0):i=r.intersect(s,null,l,m,n),2===i)u=!0;else if(i){const e=m[0],t=l[0];if(e>0&&e<1&&t>0&&t<1)return!1;u=!0}}if(!u)return!1;const c=e.constructEmpty(),_=e.constructEmpty(),d=e.constructEmpty();let p,f;if(t.queryEnvelope(c),s.queryEnvelope(_),c.inflateCoords(1e3*n,1e3*n),_.inflateCoords(1e3*n,1e3*n),d.setCoords({env2D:c}),d.intersect(_),t.getPointCount()>10){if(p=Lt(t,d,n,0,r),p.isEmpty())return!1}else p=t;if(s.getPointCount()>10){if(f=Lt(s,d,n,0,r),f.isEmpty())return!1}else f=s;return Jn(p,f,n,"F********",r,!1)}function Go(t,s,n,r){const i=t.getImpl(),o=s.getImpl(),a=i.querySegmentIterator(),h=o.querySegmentIterator(),m=$e(2,Number.NaN),l=$e(2,Number.NaN),g=new vr(i,o,n);let u=!1;for(;g.next();){const e=g.getRedElement(),t=g.getBlueElement();a.resetToVertex(e,-1),h.resetToVertex(t,-1);const s=a.nextSegment(),r=h.nextSegment();let i=0;if(Mo(s,r)?!u&&r.isIntersecting(s,n)&&(u=!0):i=r.intersect(s,null,l,m,n),2===i)u=!0;else if(i){const e=m[0],t=l[0];if(e>0&&e<1&&t>0&&t<1)return!0;u=!0}}if(!u)return!1;const c=e.constructEmpty(),_=e.constructEmpty(),d=e.constructEmpty(),p=e.constructEmpty(),f=e.constructEmpty();if(t.queryEnvelope(c),s.queryEnvelope(_),co(_,c,n)){let e,i;if(d.setCoords({env2D:c}),d.inflateCoords(1e3*n,1e3*n),p.setCoords({env2D:_}),p.inflateCoords(1e3*n,1e3*n),f.setCoords({env2D:d}),f.intersect(p),t.getPointCount()>10){if(e=Lt(t,f,n,0,r),e.isEmpty())return!1}else e=t;if(s.getPointCount()>10){if(i=Lt(s,f,n,0,r),i.isEmpty())return!1}else i=s;return Jn(e,i,n,"T********",r,!1)}return Jn(t,s,n,"T*****T**",r,!1)}function Do(t,s,n,r){const i=[!1],o=lo(t,s,n,i);if(i[0])return o;const a=e.constructEmpty();let h;if(s.queryEnvelope(a),a.inflateCoords(1e3*n,1e3*n),t.getPointCount()>10){if(h=Lt(t,a,n,0,r),h.isEmpty())return!1}else h=t;return er(h,s,n,r)}function Vo(e,t,s,n){return 1===Bo(e,t,s)}function Fo(e,t,s,n){return 2===Bo(e,t,s)}function Ho(e,t,s,n){const r=new We,i=s*s;for(let o=0;o<e.getPointCount();o++)if(e.queryXY(o,r),We.sqrDistance(r,t)<=i)return!1;return!0}function ko(e,t,s){const n=e.getBoundary();return!n.isEmpty()&&!Ho(n,t,s)}function Ao(t,s,n){const r=e.constructEmpty();return r.setCoords({env2D:t}),r.inflateCoords(n,n),r.containsEnvelope(s)?1073741824:r.isIntersecting(s)?t.isIntersecting(s)?t.xmin<s.xmin&&s.xmax<t.xmax?s.ymin<t.ymin&&s.ymax>t.ymax?0:1073741824:t.ymin<s.ymin&&s.ymax<t.ymax?s.xmin<t.xmin&&s.xmax>t.xmax?0:1073741824:0:0:4}function Mo(e,t){return e.getGeometryType()!==o.enumLine||t.getGeometryType()!==o.enumLine}function Uo(e,t,s,n,r,i,o,a){return{m_ivertexA:e,m_ipathA:t,m_scalarA0:s,m_scalarA1:n,m_ivertexB:r,m_ipathB:i,m_scalarB0:o,m_scalarB1:a}}class qo{constructor(){this.m_overlapEvents=[]}compareOverlapEvents(e,t){const s=this.m_overlapEvents[e],n=this.m_overlapEvents[t];if(s.m_ipathA<n.m_ipathA)return-1;if(s.m_ipathA===n.m_ipathA){if(s.m_ivertexA<n.m_ivertexA)return-1;if(s.m_ivertexA===n.m_ivertexA){if(s.m_scalarA0<n.m_scalarA0)return-1;if(s.m_scalarA0===n.m_scalarA0){if(s.m_scalarA1<n.m_scalarA1)return-1;if(s.m_scalarA1===n.m_scalarA1&&s.m_ivertexB<n.m_ivertexB)return-1}}}return 1}}function Oo(e,t,s){const n=Bn(e,t,s);return n?1===n?1:2:0}function Bo(e,t,s){const n=Rn(e,t,s);return n?1===n?1:2:0}function Ro(e,t,s,n,r){for(let i=0;i<s;i++)r[i]=Bo(e,t[i],n)}function Yo(t,s,n,r,i){if(t.getGeometryType()===o.enumPolygon)Ro(t,s,n,r,i);else if(t.getGeometryType()===o.enumEnvelope){const o=e.constructEmpty();t.queryEnvelope(o),Lo(o,s,n,r,i)}else _("")}function Xo(e,t,s,n,r){const i=e.getGeometryType();i===o.enumPolyline?Zo(e,t,s,n,r):a(i)?jo():_("")}function Lo(e,t,s,n,r){if(e.isEmpty()){for(let e=0;e<s;e++)r[e]=0;return}const i=e.clone();i.inflateCoords(.5*-n,.5*-n);const o=e.clone();o.inflateCoords(.5*n,.5*n);for(let a=0;a<s;a++)i.contains(t[a])?r[a]=1:o.contains(t[a])?r[a]=2:r[a]=0}function zo(e){if(e.isEmpty())return 0;switch(e.getGeometryType()){case o.enumMultiPoint:return e.getImpl().getPointCount();case o.enumPolyline:return e.getImpl().getPathCount();case o.enumPolygon:return e.getImpl().getOGCPolygonCount();case o.enumGeometryCollection:return e.getGeometryCount()}return 1}function Wo(e,t,s){if(s.reset(),t<3)return;const n=e[0].clone(),r=n.x,i=n.y,o=e[1].clone(),a=new We;for(let h=2;h<t;h++)a.assign(e[h]),s.pe((a.x-n.x)*(o.y-i)),n.assign(o),o.assign(a);s.pe((r-n.x)*(o.y-i))}function jo(e,t,n,r,i){s(0)}function Zo(t,n,r,i,o){const a=t.getImpl(),h=a.getAccelerators();let m=null;h&&(m=h.getRasterizedGeometry());let l=r;for(let e=0;e<r;e++)o[e]=1,m&&s(0);if(l){if(h){let t=null;null!==h&&null!==h.getQuadTree()&&(t=h.getQuadTree());const s=a.getPointCount();if(null===t&&s>20&&s*r>4*s+Math.log(s)*r&&(t=ce(a)),t){let s=null;const h=a.querySegmentIterator(),m=new e;for(let e=0;e<r&&l;e++)if(1===o[e]){m.setCoords(n[e]),null===s?s=t.getIterator(m,i):s.resetIterator(m,i);let r=-1;for(let a=s.next();-1!==a;a=s.next()){h.resetToVertex(t.getElement(a),r),r=h.getPathIndex();if(h.nextSegment().isIntersectingPoint(n[e],i)){o[e]=2,l--;break}o[e]=0}}return}}const t=a.querySegmentIterator();for(;t.nextPath()&&l;)for(;t.hasNextSegment()&&l;){const e=t.nextSegment();for(let t=0;t<r&&l;t++)1===o[t]&&e.isIntersectingPoint(n[t],i)&&(o[t]=2,l--)}}for(let e=0;e<r;e++)1===o[e]&&(o[e]=0)}function Ko(e,t,s,n,r){const i=L(t),o=Math.max(4*i,s);return new sa(t,null,o,Number.NaN,r).approximateWithCirclesImpl(e,n)}function Qo(){return Number.isNaN(this.radius.value())}function Jo(){return{ptStart:new We,ptEnd:new We,center:new X,radius:new Gt,fcenter:new z,fradius2:new It,maxError:Number.NaN,isLine:Qo}}const $o=5,ea=1/8;function ta(e,t,s,n){return{pt:e.clone(),t,err:s,checkCount:n}}class sa{constructor(e,t,s,n,r){this.m_left=e,this.m_tracker=r,this.m_eps=s,this.m_trackerCounter=0,this.m_tolerance=n,this.m_circleCheckCounter=0,this.m_bReversedLeft=!1,this.m_leftArc=Jo()}closeToCircularArc(e,t,s,n,r,i){if(this.m_circleCheckCounter++,i.maxError=0,!sa.checkSweepAngle(e,t))return!1;if(i.ptStart.setCoordsPoint2D(s),i.ptEnd.setCoordsPoint2D(r),e.isCircular()){const t=e;return i.fradius2=It.constructDouble(t.getSemiMajorAxis()).mulDouble(t.getSemiMajorAxis()),i.radius.set(t.getSemiMajorAxis()),i.fcenter.assignPoint2D(t.getCenter()),i.center.set(t.getCenter()),!0}const o=i.ptEnd.sub(i.ptStart).clone();o.leftPerpendicularThis(),o.normalize();if(Math.abs(o.dotProduct(n.sub(i.ptStart)))<=this.m_eps)return!!this.confirmIsLine(i,o)&&(i.radius.set(Number.NaN),i.center.setCoords(0,0),!0);{const s=i.ptEnd.sub(i.ptStart),r=n.sub(i.ptStart),o=s.crossProduct(r);if(0===o)return!1;const a=.5*s.sqrLength(),h=.5*r.sqrLength();let m=a*r.y-h*s.y;m/=o;let l=s.x*h-r.x*a;l/=o;const g=Math.sqrt(m*m+l*l);if(4*Number.EPSILON*g>this.m_eps)return!1;const u=m+i.ptStart.x,c=l+i.ptStart.y;i.radius.set(g),i.center.setCoords(u,c);const _=this.maxCircleApproximationError(e,t,i);if(_>this.m_eps)return i.maxError=_,!1}const a=(new z).assignPoint2D(i.ptStart),h=(new z).assignPoint2D(i.ptEnd).sub(a),m=(new z).assignPoint2D(n).sub(a),l=h.crossProduct(m);if(l.isZero())return!1;const g=h.sqrLength().mulDouble(.5),u=m.sqrLength().mulDouble(.5),c=g.mul(m.y).sub(u.mul(h.y)),_=h.x.mul(u).sub(m.x.mul(g)),d=c.mul(c).add(_.mul(_)),p=l.clone();p.invertThis(),i.fradius2=d.mul(p).mul(p),i.fcenter.setCoords(c.mul(p).add(a.x),_.mul(p).add(a.y)),i.center.setWithEps(i.fcenter.asPoint2D()),i.radius.setWithEps(Math.sqrt(i.fradius2.toDouble()));const f=X.constructPoint2D(i.ptStart).subE(i.center),x=X.constructPoint2D(i.ptEnd).subE(i.center);if(!f.dotProduct(x).gt(bt))return!1;const y=this.maxCircleApproximationError(e,t,i);return i.maxError=y,y<=this.m_eps}static checkSweepAngle(e,t){if(e.getGeometryType()===o.enumEllipticArc){const s=e,n=W(s,t.vmin),r=W(s,t.vmax);return!(Math.abs(r-n)>.5*_t)}return!0}confirmIsLine(e,t){const s=e.ptEnd.sub(e.ptStart);return!(Math.abs(t.dotProduct(s.mul(.25)))>this.m_eps)&&!(Math.abs(t.dotProduct(s.mul(.75)))>this.m_eps)}maxCircleApproximationError(e,t,s){const n=[.25,.75],r=[.1,.25,.75,.9];let i,a;e.getGeometryType()===o.enumEllipticArc?(i=n,a=n.length):(i=r,a=r.length);let h=0;for(let o=0;o<a;++o){const n=new We;e.queryCoord2D(mt(t.vmin,t.vmax,i[o]),n);const r=n.sub(s.center.value()).length(),a=Math.abs(r-s.radius.value());a>h&&(h=a)}return h}approximateWithCirclesImpl(e,t){let s=1;t&&t.push(0);const n=$e(9,Number.NaN);let r;e?r=this.m_left.getMonotonicPartParams(n.length,n):(n[0]=0,n[1]=1,r=2);const i=[],o=[],a=new We(0,0);for(let h=1;h<r;h++){const e=new Ke(n[h-1],n[h]);for(this.m_bReversedLeft=!sa.goodOrientation(this.m_left,e),this.m_bReversedLeft?(i.push(ta(a,e.vmin,0,0)),i.push(ta(a,e.vmax,0,0))):(i.push(ta(a,e.vmax,0,0)),i.push(ta(a,e.vmin,0,0))),i[0].pt=this.m_left.getCoord2D(i[0].t),i[1].pt=this.m_left.getCoord2D(i[1].t);i.length>1;){this.progress_();const e=i.at(-1);let n=e.checkCount,r=e.err;const a=e.pt.clone(),h=e.t,m=i[i.length-2].t,l=.5*(h+m),g=this.m_left.getCoord2D(l);if(r<=this.m_eps||n>=$o){const e=new Ke;if(e.setCoords(h,m),this.closeToCircularArc(this.m_left,e,a,g,i[i.length-2].pt,this.m_leftArc)){t&&(this.m_bReversedLeft?o.push(h):t.push(m)),s++,i.pop();continue}n=0,r=this.m_leftArc.maxError}e.t=l,e.pt.setCoordsPoint2D(g),r*=ea,n++,e.err=r,e.checkCount=n,i.push(ta(a,h,r,n))}this.m_bReversedLeft&&t&&(t.length=t.length+o.length,ut(t,o.reverse(),t.length-o.length,0,o.length),o.length=0),i.length=0}return s}approximateWithCirclesImplPolyline(e){const t=new I,s=[];if(!this.approximateWithCirclesImpl(!0,s))return t;let n=0;const r=this.m_left.getStartXY();t.startPath(r);for(let i=1;i<s.length;++i)if(e)t.lineTo(this.m_left.getCoord2D(s[i]));else{const e=new We;this.m_left.queryCoord2D(s[i],e);const o=new We;this.m_left.queryCoord2D(.5*(s[i]+n),o);const a=new M;a.constructCircularArcThreePoint(r,e,o),t.addSegment(a,!1),r.assign(e),n=s[i]}return t}static goodOrientation(e,t){const s=e.getCoord2D(t.vmin),n=e.getCoord2D(t.vmax);return s.compare(n)<0}progress_(e=!1){}}function na(e,t,s,n,r,i,o){ia(e,t,s,r,i,o)}function ra(e,t,s,n){if(!c(e.getGeometryType()))return e;const r=e.getImpl();if(!r.hasNonLinearSegments())return e;const i=e.createInstance();if(i.getGeometryType()===o.enumPolygon){i.setFillRule(e.getFillRule())}new T;const a=new ae,h=new b,m=[],l=[],g=[],u=e.getDescription().getAttributeCount()>1,_=r.querySegmentIterator();for(;_.nextPath();){let e=!0;for(;_.hasNextSegment();){const n=_.isClosingSegment(),r=_.nextSegment();if(!r.isCurve()){i.addSegment(r,e,n),e=!1;continue}let c,d=!1;const p=!0,f=!0;switch(r.getGeometryType()){case o.enumEllipticArc:case o.enumRationalBezier2:c=H(r,t,s,p,f,l,g,m),d=!0;break;default:c=F(r,t,s,!0,p,l,m)}const x=d?2:3;l[1].isNAN()?(h.createLine(),h.get().construct(l[0],l[x])):d?(h.createQuadraticRationalBezier(),h.get().constructArrayWeights(l,g)):(h.createCubicBezier(),h.get().constructPoints(l)),u&&e&&(r.queryCoord(m[0],a),h.get().setStart(a)),u&&(r.queryCoord(m[1],a),h.get().setEnd(a)),i.addSegment(h.get(),e,n&&1===c),e=!1;for(let e=1,t=c,s=x;e<t;++e,s+=x)l[s+1].isNAN()?(h.createLine(),h.get().construct(l[s],l[s+x])):d?(h.createQuadraticRationalBezier(),h.get().constructArrayWeights(l.slice(s),g.slice(s))):(h.createCubicBezier(),h.get().constructPoints(l.slice(s))),u&&(r.queryCoord(m[e+1],a),h.get().setEnd(a)),i.addSegment(h.get(),!1,n&&e+1===t)}}return i}function ia(e,t,s,n,r,i){e.hasCurves()?(e.setCurveStitcherPointer(n),n.m_impl=new ca(i,!1,null),n.m_impl.buildMonotonicCurveParentage(e,t,s,r)):n.m_impl=null}function oa(e,t,s,n,r,i,o,a){e.hasCurves()?(e.setCurveStitcherPointer(i),i.m_impl=new ca(a,!0,r),i.m_impl.buildMonotonicCurveParentage(e,t,s,o),xa(e,s,a)):i.m_impl=null}function aa(e){if(!e.hasSegmentParentage())return;const t=new we(0),s=e.queryVertexIteratorOnSelection();for(let o=s.next();o!==D;o=s.next())t.add(o);if(0===t.size())return;e.sortVerticesSimpleByY(t,0,t.size()),t.add(D);const n=We.getNAN();e.queryXY(t.read(0),n);let r=0;const i=We.getNAN();for(let o=1,a=t.size();o<a;o++){{const s=t.read(o);s!==D?e.queryXY(s,i):i.setNAN()}if(!i.isEqualPoint2D(n)){let s=!1,a=-2;for(let n=r;n<o;++n){const r=t.read(n);if(e.getSegmentParentageBreakVertex(r)){s=!0;break}let i=e.getSegmentParentage(r);const o=e.getPrevVertex(r);if(o!==D){let t=e.getSegmentParentage(o);if(-1===i&&(i=t),-1===t&&(t=i),i!==t){s=!0;break}}if(-2!==a&&i!==a){s=!0;break}a=i}if(s)for(let n=r;n<o;++n)e.setSegmentParentageBreakVertex(t.read(n),!0);n.setCoordsPoint2D(i),r=o}}}function ha(e,t){let s=t.isEmpty()?e:pe(null,t,!0).total();return s>e&&(s=e),.125*s}function ma(t,s){return s||(s=e.constructEmpty()),ha(t,s)}function la(e,t){return.125*e}function ga(e,t){return 3*e+3*t}class ua{constructor(){this.m_impl=null}stitchCurves(e,t,s,n){this.m_impl&&(this.m_impl.stitchCurves(e,t,s),n&&this.clearStitcher(e))}clearStitcher(e){this.m_impl&&(this.m_impl.clearStitcher(e),this.m_impl=null)}getOriginalVertexIndex(e,t){return this.m_impl.getOriginalVertexIndex(e,t)}getOriginalSegmentTypeInfo(e){return this.m_impl.getOriginalSegmentTypeInfo(e)}}class ca{constructor(e,t,s){this.m_originalPlanarSegments=[],this.m_progressTracker=null,this.m_nsr=null,this.m_progressTracker=e,this.m_nsr=s,this.m_tolerance=0,this.m_originalVertexIndex=-1,this.m_type=0,this.m_progressCounter=0,this.m_bIsSimple=t}buildMonotonicCurveParentage(e,t,n,r){const i=!1,a=!0;if(!e.hasCurves())return;s(!e.hasSegmentParentage()),this.m_type=1,this.m_originalPlanarSegments.length=0,this.m_bIsSimple&&(this.m_originalVertexIndex=e.createUserIndex()),this.m_tolerance=n;const h=new ae,m=new b,l=[],g=[],u=[];for(let c=e.getFirstGeometry();c!==D;c=e.getNextGeometry(c))for(let r=e.getFirstPath(c);r!==D;r=e.getNextPath(r)){let c=e.getPathSize(r),_=e.getFirstVertex(r),d=0,p=-1;for(let f=0;f<c;f++){let x=e.getNextVertex(_);if(!e.querySegment(_,m,!0,!1)){_=x;continue}if(0===d){p=e.getVertexIndex(_);const t=ca.regularizeCurve(e,m.get(),_,n);if(t>=0){this.m_nsr&&0===this.m_nsr.m_reason&&this.m_nsr.assign(new $t(13,p,-1)),d=t,c=e.getPathSize(r),x=e.getNextVertex(_);const n=e.querySegment(_,m,!0,!1);s(n)}}else d--;const y=e.getVertexIndex(_);let P;-1!==this.m_originalVertexIndex&&e.setUserIndex(_,this.m_originalVertexIndex,p),e.setSegmentToIndex(y,null);let E=!1;switch(m.get().getGeometryType()){case o.enumEllipticArc:case o.enumRationalBezier2:P=H(m.get(),t,n,i,a,g,u,l),E=!0;break;default:{const e=!this.m_bIsSimple||!m.get().isMonotoneQuickAndDirty();P=F(m.get(),t,n,e,i,g,l)}}const S=this.m_originalPlanarSegments.length;if(e.setSegmentParentageAndBreak(_,S,!0),!g[1].isNAN()){let t=null;t=E?new A({points:g,weights:u}):new k({cp:g}),t.snapControlPoints(n*n),e.setSegmentToIndex(y,t)}const C=E?2:3;for(let t=1,s=P,i=C;t<s;++t,i+=C){m.get().queryCoord(l[t],h);const s=e.insertVertex(r,x,h);if(-1!==this.m_originalVertexIndex&&e.setUserIndex(s,this.m_originalVertexIndex,p),!g[i+1].isNAN())if(E){const t=new A({points:g.slice(i),weights:u.slice(i)});t.snapControlPoints(n*n),e.setSegmentToIndex(e.getVertexIndex(s),t)}else{const t=new k({cp:g.slice(i)});t.snapControlPoints(n*n),e.setSegmentToIndex(e.getVertexIndex(s),t)}e.setSegmentParentageAndBreak(s,S,!1)}P>1&&(f+=P-1,c=e.getPathSize(r)),this.m_originalPlanarSegments.push(m.releaseSegment()),_=x}}}stitchCurves(e,t,s){ca.st_stitchCurvesImpl(this,e,t,s,!1)}clearStitcher(e){this.m_originalPlanarSegments.length=0,-1!==this.m_originalVertexIndex&&(e.removeUserIndex(this.m_originalVertexIndex),this.m_originalVertexIndex=-1),e.deleteSegmentParentage()}static st_verifyParentage(e){ca.st_stitchCurvesImpl(null,e,D,0,!0)}getOriginalVertexIndex(e,t){return-1!==this.m_originalVertexIndex&&t!==D?e.getUserIndex(t,this.m_originalVertexIndex):-1}getOriginalSegmentTypeInfo(e){if(-1!==e){const t=this.m_originalPlanarSegments[e];switch(t.getGeometryType()){case o.enumEllipticArc:return 0===t.projectionBehavior()?0:1;case o.enumBezier:return 2;case o.enumBezier2:return 3;case o.enumLine:return-1;case o.enumRationalBezier2:return 4;default:h("")}}return-1}progress_(e=!1){this.m_progressCounter++}processSpan_(e,t,n,r,i,o,a){if(t===n&&0===r)return s(e.getNextVertex(t)===D),e.setSegmentToIndex(e.getVertexIndex(t),null),void e.setSegmentParentageAndBreak(t,-1);const h=e.getNextVertex(t);{let t=2;for(let s=h;s!==n;s=e.getNextVertex(s))t++;s(t===r)}if(null===i){e.setSegmentToIndex(e.getVertexIndex(t),null);for(let t=h;t!==n;)t=e.removeVertex(t,!0);return}const m=e.getXY(t),l=e.getXY(n);if(i.isClosed()){if(m.isEqualPoint2D(l)&&m.isEqualPoint2D(i.getStartXY())){let s;if(s=this.verifySegmentFitness(e,t,n,r,i,o,a)){const r=i.clone();return r.dropAllAttributes(),s<0&&r.reverse(),this.removeSpan(e,t,n),void e.setSegmentToIndex(e.getVertexIndex(t),r)}}}else if(m.isEqualPoint2D(i.getStartXY())){if(l.isEqualPoint2D(i.getEndXY())){const s=i.clone();if(s.dropAllAttributes(),this.verifySegmentFitness(e,t,n,r,s,o,a))return this.removeSpan(e,t,n),void e.setSegmentToIndex(e.getVertexIndex(t),s)}}else if(l.isEqualPoint2D(i.getStartXY())&&m.isEqualPoint2D(i.getEndXY())){const s=i.getReversed();if(s.dropAllAttributes(),this.verifySegmentFitness(e,t,n,r,s,o,a))return this.removeSpan(e,t,n),void e.setSegmentToIndex(e.getVertexIndex(t),s)}this.processSpanSplitSegment(e,t,n,r,i,o,a)}processSpanSplitSegment(e,t,s,n,r,i,o){if(r.isLine())return;if(this.fitSegmentToSpan(e,t,s,n,r,i,o))return;const a=o*o;let h=n,m=t;const l=e.getXY(t);let g=r.getClosestCoordinate(l,!1);const u=r.getCoord2D(g);let c=!1;const _=We.sqrDistance(l,u);if(_>a){const n=e.getNextVertex(t);if(this.approximateSpanSection(e,t,r,i,o),n===s)return;m=n,c=!0,h-=1}let d=s;const p=e.getXY(s);g=r.getClosestCoordinate(p,!1);const f=r.getCoord2D(g);let x=!1;const y=We.sqrDistance(p,f);if(y>a){const t=e.getPrevVertex(s);if(this.approximateSpanSection(e,t,r,i,o),t===m)return;d=t,x=!0,h-=1}if((c||x)&&this.fitSegmentToSpan(e,m,d,h,r,i,o))return;let P=!1;if(!c&&_>0){const s=e.getNextVertex(t);if(this.approximateSpanSection(e,t,r,i,o),s===d)return;m=s,c=!0,P=!0,h-=1}if(!x&&y>0){const t=e.getPrevVertex(s);if(this.approximateSpanSection(e,t,r,i,o),t===m)return;d=t,x=!0,P=!0,h-=1}if(P&&this.fitSegmentToSpan(e,m,d,h,r,i,o))return;let E=m;for(;;){const t=e.getNextVertex(E);if(this.approximateSpanSection(e,E,r,i,o),E=t,E===d)return}}fitSegmentToSpan(e,t,n,r,i,o,a){const h=0===this.m_type,m=[];if(m.push(e.getXY(t)),h){let i=t;const o=32;if(r>o){const t=BigInt(r-1),a=BigInt(o-1);let h=a,l=0n;for(let s=1;s<r;s++,h+=a)if(i=e.getNextVertex(i),h>=l+t){l+=t;const s=e.getXY(i);m.push(s)}s(i===n)}else{for(let t=1;t<r;t++){i=e.getNextVertex(i);const t=e.getXY(i);m.push(t)}s(i===n)}}else{let s=t;const i=new b;for(;;){e.querySegment(s,i,!1,!0);const t=[.1,.25,.4,.5,.6,.75,.9,1];let o=0;for(const e of t){(2===r||1&o)&&m.push(i.get().getCoord2D(e)),o++}if(s=e.getNextVertex(s),s===n)break}}const l=(()=>{let e=m[0].compare(m.at(-1));if(0===e){const t=new wt(0);Wo(m,m.length,t),e=t.getResult()>=0?-1:1}return e>0})();l&&m.reverse();const g=i.clone();if(g.dropAllAttributes(),g.setSegmentFromCoords(m,m.length),l&&g.reverse(),g.snapControlPoints(this.m_tolerance*this.m_tolerance),this.verifySegmentFitness(e,t,n,r,g,o,a)){this.removeSpan(e,t,n);const s=e.getVertexIndex(t);return e.setSegmentToIndex(s,g),!0}return!1}approximateSpanSection(e,t,s,n,r){const i=new b;if(!e.querySegment(t,i,!0,!1))return;const a=s.getGeometryType();if(a!==i.get().getGeometryType()){if(a===o.enumEllipticArc){if(i.get().getGeometryType()!==o.enumRationalBezier2)return;if(0===s.projectionBehavior()){const s=[];Ko(!1,i.get(),r,s,this.m_progressTracker);const n=e.getNextVertex(t),o=e.getPathFromVertex(t),a=new ae;let h=t;for(let t=1,r=s.length;t<r;t++){const r=s[t],m=i.get().getCoord2D(s[t-1]),l=i.get().getCoord2D(mt(s[t-1],r,.5));i.get().queryCoord(r,a);const g=a.getXY(),u=new M;u.constructCircularArcThreePoint(m,g,l);let c=D;r<1&&(c=e.insertVertex(o,n,a)),e.setSegmentToIndex(e.getVertexIndex(h),u),h=c}return}{const s=lt(We,3);i.get().queryControlPoints(s);const n=[0,0,0];i.get().queryWeights(n);const r=U(n),o=new M;return q(s,r*r,null,!1,o),void e.setSegmentToIndex(e.getVertexIndex(t),o)}}l("approximate_span_section_")}}verifySegmentFitness(e,t,s,n,r,i,o){return 0===this.m_type?this.verifySegmentFitnessLines(e,t,s,n,r,i,o):this.verifySegmentFitnessCurves(e,t,s,n,r,i,o)}verifySegmentFitnessCurves(e,t,s,n,r,i,o){const a=e.getXY(t),h=e.getXY(s);if(!a.isEqualPoint2D(r.getStartXY())||!h.isEqualPoint2D(r.getEndXY()))return 0;let m=0;if(r.isClosed()){const e=r.getCoord2D(.1).sub(a);m=r.getCoord2D(.7).sub(a).crossProduct(e)>=0?1:-1}const l=new Array(O.s_maxMonotonicPartParams);let g=r.getMonotonicPartParams(l.length,l);g--;const u=new V,c=[1,.5,.75,.25];let _=0,d=t;const p=a.clone();for(;;){const t=e.getNextVertex(d);let n=e.getSegment(d);null===n&&(e.queryLineConnector(d,u,!0),n=u);for(let e=t===s?1:0;e<c.length;e++){const t=n.getCoord2D(c[e]);if(!r.isCloserThanDistance(t,Ke.unit(),o))return 0}if(g>1)for(let e=1;e<g;){const t=r.getCoord2D(l[e]);n.isCloserThanDistance(t,Ke.unit(),o)?(l[g-1]=gt(l[e],l[e]=l[g-1]),g--):e++}if(m){const e=n.getCoord2D(.25);_+=e.sub(a).crossProduct(p.sub(a)),p.assign(e),e.assign(n.getCoord2D(.75)),_+=e.sub(a).crossProduct(p.sub(a)),p.assign(e)}if(d=t,d===s)return g>1?0:m?_<0?-m:m:1}}verifySegmentFitnessLines(e,t,n,r,i,o,a){return s(0),0}removeSpan(e,t,s){e.setSegmentToIndex(e.getVertexIndex(t),null);const n=e.getNextVertex(t);n!==s&&e.removeVertices(n,s)}static st_stitchCurvesImpl(e,t,s,n,r){if(t.hasSegmentParentage())return t.hasCurves()?ca.st_stitchCurvesFromCurvesImpl(e,t,s,n,r):ca.st_stitchCurvesFromLinesImpl(e,t,s,n,r)}static st_stitchCurvesFromLinesImpl(e,t,n,r,i){let o=n===D?t.getFirstGeometry():n;for(;o!==D;){for(let n=t.getFirstPath(o);n!==D;n=t.getNextPath(n)){let o=t.getPathSize(n);t.isClosedPath(n)&&(o+=1);let a=!0,h=!1;const m=t.getFirstVertex(n);let l=m;for(let n=0;n<o&&l!==D;){let g=t.getSegmentParentage(l);if(-1===g||a){a=!1,n++,l=t.getNextVertex(l),h=!0;continue}let u,c,_=0;if(h?(u=t.getPrevVertex(l),c=l,s(u!==D),s(c!==u),s(-1===t.getSegmentParentage(u)||m===u)):(u=l,c=t.getNextVertex(u),n++,s(c!==D),s(c!==u),g=t.getSegmentParentage(c)),_=2,h=!1,-1===g||t.getSegmentParentageBreakVertex(c)){l=c;continue}let d=t.getNextVertex(c);for(n++;n<o&&d!==D;){c=d,_++;const e=t.getSegmentParentage(d);if(-1===e||t.getSegmentParentageBreakVertex(d))break;s(e===g),n++,d=t.getNextVertex(d)}if(!i){const s=e.m_originalPlanarSegments[g];e.processSpan_(t,u,c,_,s,g,r)}l=c}}if(n!==D)break;o=t.getNextGeometry(o)}}static st_stitchCurvesFromCurvesImpl(e,t,n,r,i){let o=n===D?t.getFirstGeometry():n;for(;o!==D;)if(x(t.getGeometryType(o))){for(let n=t.getFirstPath(o);n!==D;n=t.getNextPath(n)){let o=t.getPathSize(n);const a=t.isClosedPath(n);a&&(o+=1);let h=t.getFirstVertex(n);if(a){if(-1!==t.getSegmentParentage(h)){let e=h;for(let s=0;!t.getSegmentParentageBreakVertex(e);s++){if(s===o){h=t.getFirstVertex(n),t.setSegmentParentageBreakVertex(e,!0);break}e=t.getPrevVertex(e)}}}else s(-1===t.getSegmentParentage(h)||t.getSegmentParentageBreakVertex(h));let m=h;for(let n=0;n<o&&m!==D;){const a=t.getSegmentParentage(m);if(-1===a){n++,m=t.getNextVertex(m);continue}let h=0,l=D;const g=m;h=1;let u=t.getNextVertex(g);for(;n<o&&u!==D;){n++,l=u,h++;const e=t.getSegmentParentage(u);if(-1===e||t.getSegmentParentageBreakVertex(u))break;s(e===a),u=t.getNextVertex(u)}if(l===D)break;if(!i){const s=e.m_originalPlanarSegments[a];e.processSpan_(t,g,l,h,s,a,r)}m=l}}if(n!==D)break;o=t.getNextGeometry(o)}else o=n===D?t.getNextGeometry(o):D}static regularizeCurve(e,t,s,n){let r=t.snapControlPoints(n*n);if(r){const n=e.getVertexIndex(s),r=t.clone();e.setSegmentToIndex(n,r)}if(t.getGeometryType()===k.type){const i=[],o=t.calculateSpecialPointsForCracking(n,i);if(o>0){e.splitSegment(s,i,o),r=e.snapControlPoints(s,o+1,n*n)||r;for(let t=0;t<o;t++)s=e.getNextVertex(s),e.setSegmentParentageBreakVertex(s,!0);return o}}return r?0:-1}}function _a(e,t,s,n,r){return new Pa(e,s,t,n,r).do_()}function da(e,t,s){const n=ye(e);return on(t.getX(),t.getY(),s.getX(),s.getY(),at(n))}function pa(e,t,s=1,n=1,r=1,i=1){if(n>i)return e;if(i>n)return t;const o=[0],a=[0],h=new ae;return mn(e,t,s,n,r,i,h,a,o),h}function fa(e,t,s){const n=ye(t),r=ke(t);return!!ln(e,n,D,null,s)||Fn(!0,e,r,null,s)}function xa(e,t,s){return Pa.fixCurveTwoPointLoops(e,t,s)}function ya(e){return ye(e)}class Pa{constructor(e,t,s,n,r){this.m_shape=e,this.m_progressTracker=t,this.m_tolerance=s,this.m_bFilterDegenerateSegments=n,this.m_bTrackChanges=r,this.m_progressCounter=0}do_(){const e=new ue(this.m_tolerance.tolerance,this.m_tolerance.resolution),t=1e-5,s=1e-6,n=ya(e);let r=ke(e);const i=r*(1+t);r*=1+s;let o=!1;const a=this.m_shape.getTotalPointCount()+10>30?1e3:(this.m_shape.getTotalPointCount()+10)*(this.m_shape.getTotalPointCount()+10),h=this.m_shape.hasPointFeatures();for(let m=0;;m++){this.m_shape.dbgCheckSelection(),m>a&&l("crack_and_cluster_iteration_exceeded"),this.m_shape.dbgVerifyMonotone();let e=-1;0===m&&(e=this.firstCrack_(),o||=e>0);const t=this.cluster_(n);if(this.m_shape.dbgVerifyMonotone(),o||=t,this.m_bFilterDegenerateSegments){const e=0!==this.m_shape.filterClosePoints(n,!0,!1,this.m_bTrackChanges,D);o||=e,this.m_shape.dbgVerifyMonotone()}const s=this.m_shape.snapControlPointsOnSelection(i*i);o||=s,this.m_shape.dbgCheckSelection();let g=!1;if((0===m&&-1===e||h||Fn(!0,this.m_shape,r,null,this.m_progressTracker))&&(g=this.crack_(i),o||=g,this.m_shape.dbgVerifyMonotone()),!g&&!Pa.fixCurveTwoPointLoops(this.m_shape,n,this.m_progressTracker)){this.m_shape.dbgVerifyMonotone();break}}return o&&aa(this.m_shape),o}cluster_(e){return rn(this.m_shape,e,D,this.m_bTrackChanges,this.m_progressTracker)}crack_(e){return Vn(this.m_shape,e,this.m_bTrackChanges,this.m_progressTracker)}static fixCurveTwoPointLoops(e,t,n){if(!e.hasCurves())return!1;e.dbgVerifyCurves();const r=e.createUserIndexUninitialized(),i=new we(0),o=e.queryVertexIteratorOnSelection();for(let s=o.next();s!==D;s=o.next())i.add(s),e.setUserIndex(s,r,-1);if(0===i.size())return!1;i.add(D),e.sortVerticesSimpleByY(i,0,i.size()-1);let a=0;const h=e.getXY(i.read(a)),m=new We(Number.NaN,Number.NaN),l=[];for(let s=1,g=i.size();s<g;++s){const t=i.read(s),n=t!==D?e.getXY(t):m;if(n.equals(h))continue;const o=[];for(let m=a;m<s;m++){const t=i.read(m),s=e.getPrevVertex(t);if(s!==D&&-1===e.getUserIndex(s,r)){const t=Ea(e.getXY(s),e.getSegment(s));0!==We.sqrDistance(h,t.otherPt)&&(t.vert=s,t.dir=-1,o.push(t)),e.setUserIndex(s,r,1)}const n=e.getNextVertex(t);if(n!==D&&-1===e.getUserIndex(t,r)){const s=Ea(e.getXY(n),e.getSegment(t));0!==We.sqrDistance(h,s.otherPt)&&(s.vert=t,s.dir=1,o.push(s)),e.setUserIndex(t,r,1)}}if(o.length>1){o.sort(((e,t)=>Ia(e,t)));const e=Ea(m.clone(),null);o.push(e);let t=0;for(let s=1,n=o.length;s<n;s++)if(!o[s].otherPt.equals(o[s-1].otherPt)){if(s-t>1&&null!==o[t].seg){let e=!1;const n=t;for(let r=t+1;r<s;r++)if(!Sa(o[n],o[r])){e=!0;break}if(e)for(let r=t;r<s&&null!==o[r].seg;r++)l.push(o[r].vert)}t=s}}a=s,h.setCoordsPoint2D(n)}for(const g of l){const n=e.getSegment(g);s(null!==n);const r=e.getXY(g),i=e.getXY(e.getNextVertex(g));if(We.distance(r,i)<3*t)e.setSegmentToIndex(e.getVertexIndex(g),null);else{const t=n.lengthToT(.5*n.calculateLength2D());e.splitSegment(g,[t],1)}}return e.removeUserIndex(r),l.length>0}firstCrack_(){const e=this.m_shape.getEnvelope2D(this.m_progressTracker),t=pe(null,e,!0).total();if(4*t<this.m_tolerance.total()){let e=!1;const s=1.1*t,n=t,r=this.cluster_(s);e||=r;let i=0;this.m_bFilterDegenerateSegments&&(i=this.m_shape.filterClosePoints(0,!0,!1,this.m_bTrackChanges,D));const o=this.crack_(n);return e||=o,e?1:i?2:0}return-1}progress_(e=!1){this.m_progressCounter++,!e&&4095&this.m_progressCounter||(this.m_progressCounter=0)}}function Ea(e,t){return{otherPt:e,seg:t,vert:-1,dir:0}}function Sa(e,t){if(s(e.otherPt.equals(t.otherPt)),null===e.seg)return null===t.seg;if(null===t.seg)return!1;const n=e.seg.getGeometryType();if(n!==t.seg.getGeometryType())return!1;if(n===o.enumBezier){const s=e.seg,n=t.seg;let r=s.getControlPoint1(),i=s.getControlPoint2();-1===e.dir&&(i=gt(r,r=i));let o=n.getControlPoint1(),a=n.getControlPoint2();return-1===t.dir&&(a=gt(o,o=a)),r.equals(o)&&i.equals(a)}if(n===o.enumRationalBezier2){const s=e.seg,n=t.seg,r=s.getControlPoint1(),i=n.getControlPoint1();if(!r.equals(i))return!1;const o=[0,0,0];s.queryWeights(o),-1===e.dir&&(o[2]=gt(o[0],o[0]=o[2]));const a=[0,0,0];return n.queryWeights(a),-1===t.dir&&(a[2]=gt(a[0],a[0]=a[2])),o[0]===a[0]&&o[1]===a[1]&&o[2]===a[2]}l("")}function Ca(e,t){if(null===e.seg||null===t.seg)return null!==e.seg?-1:null!==t.seg?1:0;const s=e.seg.getGeometryType(),n=t.seg.getGeometryType();return s<n?-1:s>n?1:0}function Ia(e,t){const s=e.otherPt.compare(t.otherPt);return 0!==s?s:Ca(e,t)}var ba=c,wa=a,va=y;function Ta(e){switch(e){case 1:return 1;case 2:return 2;case 3:return 3;case 4:return 4;case 0:return 0;default:s(0,"unrecognized cut side")}return 3}function Na(){return{unsplitBehavior:0,allCrossRoadsImpassable:!1,ogcRule:!1}}function Ga(e,t,s,n){return new La(n).autoCompleteImpl(e,t,s)}function Da(e,t,s,n,r,i,a){const h=new La(r);h.m_bOGCOutput=!0;const m=e.getGeometryType()===o.enumPolygon&&1===e.getFillRule()&&!_e(n);return h.planarSimplifyImpl_(e,t,m,s,n,r,i,a)}function Va(e,t,s,n,r,i,o,a){return new La(i).planarSimplifyImpl_(e,t,s,n,r,i,o,a)}function Fa(e,t,n,r){const i=new La(r),o=new T,a=o.addGeometry(t),h=i.planarSimplifyNoCrackingAndCluster(e,o,a,n);s(h,"planar_simplify_no_cracking_and_cluster");return o.getGeometry(a)}function Ha(e,t,n,r,i,o,a){return s(0),{}}function ka(e,t,n,r){return s(0),{}}function Aa(e,t,s){return Wa(e,t,s)}function Ma(t,s,n,r){if(t.isEmpty()||s.isEmpty()||t.getDimension()>s.getDimension())return ja(Za(t),t,s,"-");const i=new e;t.queryEnvelope(i);const a=new e;s.queryEnvelope(a);const h=new e;h.setCoords({env2D:i}),h.mergeEnvelope2D(a);const m=pe(n,h,!0),l=a.clone(),g=ye(m);if(l.inflateCoords(g,g),!i.isIntersecting(l))return ja(Za(t),t,s,"-");const u=new La(r),c=new T,_=c.addGeometry(Za(t)),d=c.addGeometry(Za(s));let p=0,f=0,x=null;if(c.hasCurves()){x=new ua;const e=c.getEnvelope2D(r);f=la(m.total());const t=ma(m.total(),e);p=ga(t,f),na(c,t,m.total(),12e3,x,null,r)}u.setEditShapeCrackAndCluster(c,m.add(p));const y=u.difference(_,d);null!==x&&x.stitchCurves(c,y,f,!0);const P=ja(c.getGeometry(y),t,s,"-");return ba(P.getGeometryType())&&(P.getImpl().setIsSimple(4,m.total()),P.getGeometryType()===o.enumPolygon&&P.getImpl().updateOGCFlagsProtected()),P}function Ua(t,s,n,r){if(t.getDimension()>s.getDimension())return ja(Za(t),t,s,"^");if(t.getDimension()<s.getDimension())return ja(Za(s),t,s,"^");if(t.isEmpty())return ja(Za(s),t,s,"^");if(s.isEmpty())return ja(Za(t),t,s,"^");const i=new e;t.queryEnvelope(i);const a=new e;s.queryEnvelope(a);const h=new e;h.setCoords({env2D:i}),h.mergeEnvelope2D(a);const m=pe(n,h,!0),l=new La(r),g=new T,u=g.addGeometry(Za(t)),c=g.addGeometry(Za(s));let _=0,d=null;if(g.hasCurves()){d=new ua;const e=g.getEnvelope2D(r);_=la(m.total());na(g,ma(m.total(),e),m.total(),12e3,d,null,r)}l.setEditShapeCrackAndCluster(g,m);const p=l.symmetricDifference(u,c);null!==d&&d.stitchCurves(g,p,_,!0);const f=ja(g.getGeometry(p),t,s,"^");return ba(f.getGeometryType())&&(f.getImpl().setIsSimple(4,m.total()),f.getGeometryType()===o.enumPolygon&&f.getImpl().updateOGCFlagsProtected()),f}function qa(e,t,s){return za(e,t,s,!0)}function Oa(e,t,s){return e.isEmpty()||t.isEmpty()?e.createInstance():da(s,e,t)?new ae({copy:pa(e,t)}):e.createInstance()}function Ba(t,s,n,r){const i=e.constructEmpty();t.queryEnvelope(i);const a=e.constructEmpty();s.queryEnvelope(a);const h=e.constructEmpty();h.setCoords({env2D:i}),h.mergeEnvelope2D(a);const m=pe(n,h,!0),l=new e(a),g=ye(m);if(l.inflateCoords(g,g),!i.isIntersecting(l)){if(t.getDimension()<=s.getDimension())return ja(Za(t.createInstance()),t,s,"&");if(t.getDimension()>s.getDimension())return ja(Za(s.createInstance()),t,s,"&")}const u=new La(r),c=new T,_=c.addGeometry(Za(t)),d=c.addGeometry(Za(s));let p=0,f=0,x=null;if(c.hasCurves()){x=new ua;const e=c.getEnvelope2D(r);f=la(m.total());const t=ma(m.total(),e);p=ga(t,f),na(c,t,m.total(),12e3,x,null,r)}u.setEditShapeCrackAndCluster(c,m.add(p));const y=u.intersection(_,d);null!==x&&x.stitchCurves(c,y,f,!0);const P=ja(c.getGeometry(y),t,s,"&");return ba(P.getGeometryType())&&(P.getImpl().setIsSimple(4,m.total()),P.getGeometryType()===o.enumPolygon&&P.getImpl().updateOGCFlagsProtected()),P}function Ra(t,s,n,r){const i=new Array(3),a=e.constructEmpty();t.queryEnvelope(a);const h=e.constructEmpty();s.queryEnvelope(h);const m=e.constructEmpty();m.setCoords({env2D:a}),m.mergeEnvelope2D(h);const l=pe(n,m,!0),g=new e(h),u=ye(l);if(g.inflateCoords(u,u),!a.isIntersecting(g)){if(t.getDimension()<=s.getDimension()){const e=ja(Za(t.createInstance()),t,s,"&");return i[e.getDimension()]=e,i}if(t.getDimension()>s.getDimension()){const e=ja(Za(s.createInstance()),t,s,"&");return i[e.getDimension()]=e,i}}const c=new La(r),_=new T,d=_.addGeometry(Za(t)),p=_.addGeometry(Za(s));let f=0,x=0,y=null;if(_.hasCurves()){y=new ua;const e=_.getEnvelope2D(r);x=la(l.total());const t=ma(l.total(),e);f=ga(t,x),na(_,t,l.total(),12e3,y,null,r)}c.setEditShapeCrackAndCluster(_,l.add(f)),_.dbgVerifyCurves();const P=c.intersectionEx(d,p);for(const e of P){null!==y&&y.stitchCurves(_,e,x,!1);const n=ja(_.getGeometry(e),t,s,"&");ba(n.getGeometryType())&&(n.getImpl().setIsSimple(4,l.total()),n.getGeometryType()===o.enumPolygon&&n.getImpl().updateOGCFlagsProtected()),i[n.getDimension()]=n}return null!==y&&y.clearStitcher(_),i}function Ya(e,s,n,r,i,o=!1){0===s&&t("not enough geometries to dissolve");let a=0;for(let t=0,d=s;t<d;t++)a=Math.max(e[t].getDimension(),a);if(2===a||1===a)return new La(r).dissolveMultiPaths_(a,!1,e,s,n,i,o);let h=0,m=-1;for(let t=0,d=s;t<d;t++)e[t].getDimension()===a&&(-1===m&&(m=t),e[t].isEmpty()||(m=t,h++));if(h<2)return Za(e[m]);const l=de.constructEmpty(),g=new T;let u=D;for(let t=0,d=s;t<d;t++)if(e[t].getDimension()===a&&!e[t].isEmpty()){u===D?u=g.addGeometry(Za(e[t])):g.appendGeometry(u,Za(e[t]));const s=de.constructEmpty();e[t].queryLooseEnvelope(s),l.mergeEnv3D(s)}const c=pe(n,l.getEnvelope2D(),!0),_=new La(r);if(o){const e=fe(n,l.getEnvelopeZs(),!0);return _.planarSimplify3DImpl_(g,c,e,0,!0)}return _.m_bOGCOutput=!0,_.planarSimplifyMultiPoints(g,c,!1,-1)}function Xa(e,s,n,r,i,o=!1){s<2&&t("not enough geometries to dissolve");let a=0;for(let t=0,p=s;t<p;t++)a=Math.max(e[t].getDimension(),a);if(2===a||1===a)return new La(r).dissolveMultiPaths_(a,!0,e,s,n,i,o);const h=de.constructEmpty(),m=new T;let l=D,g=0,u=-1;for(let t=0,p=s;t<p;t++)if(e[t].getDimension()===a&&(-1===u&&(u=t),!e[t].isEmpty())){u=t,l===D?l=m.addGeometry(Za(e[t])):m.appendGeometry(l,Za(e[t]));const s=de.constructEmpty();e[t].queryLooseEnvelope(s),h.mergeEnv3D(s),g++}if(g<2)return Za(e[u]);const c=0===a?n:null,_=pe(c,h.getEnvelope2D(),!0),d=new La(r);if(o){const e=fe(c,h.getEnvelopeZs(),!0);return d.m_bOGCOutput=!0,d.planarSimplify3DImpl_(m,_,e,0,!0)}return d.planarSimplifyMultiPoints(m,_,!0,-1)}class La{constructor(e){this.m_topoGraph=null,this.m_maskLookup=[],this.m_dummyPt1=We.getNAN(),this.m_dummyPt2=We.getNAN(),this.m_fromEdgeForPolylines=D,this.m_progressCounter=0,this.m_bOGCOutput=!1,this.m_progressTracker=e}linesToPolygonsImpl(e,t){let s=0,n=0,r=null;if(e.hasCurves()){r=new ua;const i=e.getEnvelope2D(this.m_progressTracker);n=la(t.total());const o=ma(t.total(),i);s=ga(o,n),na(e,o,t.total(),12e3,r,null,this.m_progressTracker)}this.setEditShapeCrackAndCluster(e,t.add(s));const i=this.m_topoGraph.createUserIndexForChains(),o=this.m_topoGraph.getFirstChain();this.m_topoGraph.setChainUserIndex(o,i,1);for(let h=this.m_topoGraph.getChainFirstIsland(o);h!==D;h=this.m_topoGraph.getChainNextInParent(h))this.m_topoGraph.setChainUserIndex(h,i,1);const a=[];for(let h=this.m_topoGraph.getFirstChain();h!==D;h=this.m_topoGraph.getChainNext(h)){if(1===this.m_topoGraph.getChainUserIndex(h,i))continue;this.m_topoGraph.setChainUserIndex(h,i,1);for(let e=this.m_topoGraph.getChainFirstIsland(h);e!==D;e=this.m_topoGraph.getChainNextInParent(e))this.m_topoGraph.setChainUserIndex(e,i,1);if(0===this.m_topoGraph.getChainArea(h))continue;const t=this.m_topoGraph.extractPolygonFromChainAndIslands(e,D,h,D);null!=r&&r.stitchCurves(e,t,n,!1);const s=e.getGeometry(t);a.push(s)}return new Kt(a)}autoCompleteImpl(e,t,s){let n=0,r=0,i=null;if(e.hasCurves()){i=new ua;const t=e.getEnvelope2D(this.m_progressTracker);r=la(s.total());const o=ma(s.total(),t);n=ga(o,r),na(e,o,s.total(),12e3,i,null,this.m_progressTracker)}this.setEditShapeCrackAndCluster(e,s.add(n));const o=this.m_topoGraph.getGeometryID(t),a=this.m_topoGraph.createUserIndexForChains(),h=this.m_topoGraph.getFirstChain();this.m_topoGraph.setChainUserIndex(h,a,1);for(let l=this.m_topoGraph.getChainFirstIsland(h);l!==D;l=this.m_topoGraph.getChainNextInParent(l))this.m_topoGraph.setChainUserIndex(l,a,1);const m=[];for(let l=this.m_topoGraph.getFirstChain();l!==D;l=this.m_topoGraph.getChainNext(l)){if(1===this.m_topoGraph.getChainUserIndex(l,a))continue;this.m_topoGraph.setChainUserIndex(l,a,1);for(let e=this.m_topoGraph.getChainFirstIsland(l);e!==D;e=this.m_topoGraph.getChainNextInParent(e))this.m_topoGraph.setChainUserIndex(e,a,1);if(0!==this.m_topoGraph.getChainParentage(l))continue;const t=this.m_topoGraph.getChainHalfEdge(l);let s=t,n=!1;do{const e=this.m_topoGraph.getHalfEdgeTwin(s);if(this.m_topoGraph.getHalfEdgeChain(e)!==l&&this.m_topoGraph.getHalfEdgeParentage(s)&o){n=!0;break}s=this.m_topoGraph.getHalfEdgeNext(s)}while(s!==t);if(!n)continue;if(0===this.m_topoGraph.getChainArea(l))continue;const h=this.m_topoGraph.extractPolygonFromChainAndIslands(e,D,l,D);null!==i&&i.stitchCurves(e,h,r,!1);const g=e.getGeometry(h);m.push(g)}return new Kt(m)}setEditShape(e,t=!1){null===this.m_topoGraph&&(this.m_topoGraph=new Qs),this.m_topoGraph.setEditShape(e,this.m_progressTracker,!0,t)}setEditShapeCrackAndCluster(e,t){_a(e,t,this.m_progressTracker,!0,!1);for(let s=e.getFirstGeometry();s!==D;s=e.getNextGeometry(s))e.getGeometryType(s)===o.enumPolygon&&Kn(e,s,-1,this.m_bOGCOutput,D,this.m_progressTracker);this.setEditShape(e)}setHalfEdgeOrientations_(e,t){const s=this.m_topoGraph.getShape();for(let n=s.getFirstGeometry();n!==D;n=s.getNextGeometry(n))if(n===t)for(let t=s.getFirstPath(n);t!==D;t=s.getNextPath(t)){let n=s.getFirstVertex(t);if(n===D)continue;let r=s.getNextVertex(n);for(;r!==D;){const t=this.m_topoGraph.getClusterFromVertex(n),i=this.m_topoGraph.getClusterFromVertex(r),o=this.m_topoGraph.getHalfEdgeConnector(t,i);if(o!==D){const t=this.m_topoGraph.getHalfEdgeTwin(o);this.m_topoGraph.setHalfEdgeUserIndex(o,e,1),this.m_topoGraph.setHalfEdgeUserIndex(t,e,2)}n=r,r=s.getNextVertex(n)}}}flushVertices_(e,t){const s=this.m_topoGraph.getShape(),n=s.hasSegmentParentage(),r=new b,i=s.insertPath(e,D);t.push(t[0]);const o=t.length;let a=D;for(let h=0;h<o;h++){const e=t[h];if(a=s.addVertex(i,e),!n)continue;const m=this.m_topoGraph.getClusterFromVertex(e);if(h>0&&this.m_topoGraph.isBreakNode(m)&&s.setSegmentParentageBreakVertex(a,!0),h<o-1){const e=this.m_topoGraph.getHalfEdgeConnector(m,this.m_topoGraph.getClusterFromVertex(t[h+1])),n=this.m_topoGraph.getSegmentParentage(e);s.setSegmentParentageAndBreak(a,n,h>0||this.m_topoGraph.isBreakNode(m)),this.m_topoGraph.isHalfEdgeCurve(e)&&(this.m_topoGraph.querySegmentXY(e,r),s.setSegmentToIndex(s.getVertexIndex(a),r.get().clone()))}}if(n){const e=this.m_topoGraph.getClusterFromVertex(t[o-1]);this.m_topoGraph.isBreakNode(e)&&s.setSegmentParentageBreakVertex(a,!0)}s.setClosedPath(i,!0)}processPolygonCuts_(e,t,s,n){const r=this.m_topoGraph.getGeometryID(s),i=this.m_topoGraph.getGeometryID(n),a=[],h=this.m_topoGraph.getShape(),m=this.m_topoGraph.createUserIndexForHalfEdges();for(let l=this.m_topoGraph.getFirstCluster();l!==D;l=this.m_topoGraph.getNextCluster(l)){const s=this.m_topoGraph.getClusterHalfEdge(l);if(s===D)continue;let n=s;do{if(1!==this.m_topoGraph.getHalfEdgeUserIndex(n,m)){let s=n,l=n,g=!1,u=0;do{if(this.m_topoGraph.setHalfEdgeUserIndex(s,m,1),!g){if(this.m_topoGraph.getHalfEdgeParentage(s)&i){this.m_topoGraph.getHalfEdgeFaceParentage(s)&r&&(l=s,g=!0)}}if(g){const t=this.m_topoGraph.getHalfEdgeOrigin(s),n=this.m_topoGraph.getClusterVertexIterator(t),r=this.m_topoGraph.getVertexFromVertexIterator(n);if(a.push(r),-1!==e){if(this.m_topoGraph.getHalfEdgeParentage(s)&i){u|=this.m_topoGraph.getHalfEdgeUserIndex(s,e)}}}s=this.m_topoGraph.getHalfEdgeNext(s)}while(s!==l);if(g&&this.m_topoGraph.getChainArea(this.m_topoGraph.getHalfEdgeChain(l))>0){const e=h.createGeometry(o.enumPolygon);this.flushVertices_(e,a),-1!==t&&h.setGeometryUserIndex(e,t,u)}a.length=0}n=this.m_topoGraph.getHalfEdgeNext(this.m_topoGraph.getHalfEdgeTwin(n))}while(n!==s)}this.m_topoGraph.deleteUserIndexForHalfEdges(m)}cutPolygonPolyline_(e,t,s,n){this.m_topoGraph.removeSpikes_();let r=-1;-1!==e&&(r=this.m_topoGraph.createUserIndexForHalfEdges(),this.setHalfEdgeOrientations_(r,s)),this.processPolygonCuts_(r,e,t,s),-1!==r&&(this.m_topoGraph.deleteUserIndexForHalfEdges(r),r=-1);const i=this.m_topoGraph.getShape();for(let o=i.getFirstGeometry();o!==D;o=i.getNextGeometry(o))o!==t&&o!==s&&n.push(o);n.sort(((e,t)=>{const s=i.getFirstPath(e),n=i.getRingArea(s),r=i.getFirstPath(t),o=i.getRingArea(r);return n<o?-1:n>o?1:0}))}cut(e,t,s,n,r){const i=this.m_topoGraph.getShape().getGeometryType(s),o=this.m_topoGraph.getShape().getGeometryType(n),a=y(i),h=y(o);if(2!==a||1!==h)if(1!==a||1!==h)l("");else{new Qa(this,e,t,s,n,r).Do()}else this.cutPolygonPolyline_(t,s,n,r)}progress_(e=!1){}isGoodParentage(e){return e>=0&&e<this.m_maskLookup.length&&this.m_maskLookup[e]}normalizeInputGeometry(e){const s=e.getGeometryType();if(s===o.enumEnvelope){const t=new C({vd:e.getDescription()});return e.isEmpty()||t.addEnvelope(e,!1),t}if(s===o.enumPoint){const t=new w({vd:e.getDescription()});return e.isEmpty()||t.add(e),t}if(a(s)){const t=new I({vd:e.getDescription()});return e.isEmpty()||t.addSegment(e,!0),t}return s!==o.enumMultiPoint&&s!==o.enumPolyline&&s!==o.enumPolygon&&t("Unexpected geometry type"),e}dissolveNonSimplePolygons(e,t,n,r){s(t>0);const i=new T;let o=0,a=-1;for(let s=0,h=t;s<h;s++)2===e[s].getDimension()&&(-1===a&&(a=s),e[s].isEmpty()||(o++,i.addGeometry(e[s])));return 0===o?(s(a>=0),this.normalizeInputGeometry(e[a])):this.planarSimplifyPolygons(i,n,!0,!1,-1,!0)}dissolveMultiPaths_(t,n,r,i,h,m,l){s(t>=1&&t<=2),s(i>0);const u=8&m?1:2,_=de.constructEmpty();let d=0,p=-1,f=!0;for(let e=0,s=i;e<s;e++)if(r[e].getDimension()===t&&(-1===p&&(p=e),!r[e].isEmpty())){p=e,d++;const s=de.constructEmpty();if(r[e].queryLooseEnvelope(s),_.mergeEnv3D(s),2===t&&f&&r[e].getGeometryType()===o.enumPolygon)if(16&m){const t=[0],s=r[e].getImpl().getIsSimple(0,t),n=this.m_bOGCOutput?5===s:me(s);f&&=n}else{const t=xe(r[e],0);f&&=t}}if(d<2&&(s(p>=0),0===d||!(16&m)))return this.normalizeInputGeometry(r[p]);if(!f){const e=pe(n?null:h,_.getEnvelope2D(),!0);return this.dissolveNonSimplePolygons(r,i,e,m)}const x=r.slice(0,i),y=pe(h,_.getEnvelope2D(),!0),P=10*ye(y);let E=new ue(0,0);if(l&&(E=fe(h,_.getEnvelopeZs(),!0)),1===d&&1===t&&2===u&&!n)return l?Ha():this.m_bOGCOutput?Da(x[p],y,!1,-1,this.m_progressTracker,u,!1):Va(x[p],y,!1,!1,-1,this.m_progressTracker,u,!1);const S=new Pe;S.startConstruction();let b=2===t?3:4,w=0;for(let g=0,C=i;g<C;g++){if(x[g].getDimension()!==t||x[g].isEmpty())continue;let r=x[g].getGeometryType();if(r!==o.enumEnvelope){if(a(r)?(x[g]=this.normalizeInputGeometry(x[g]),r=o.enumPolyline):s(c(r)),1===t){s(r===o.enumPolyline);let e=-1;if(l)s(0,"3d not implemented yet");else{const t=[0];e=x[g].getImpl().getIsSimple(y.total(),t)}if(this.m_bOGCOutput?5!==e:!me(e))if(n)b=-1;else{l?s(0,"3d not implemented yet"):this.m_bOGCOutput?x[g]=Da(x[g],y,!1,-1,this.m_progressTracker,u,!1):x[g]=Va(x[g],y,!1,!1,-1,this.m_progressTracker,u,!1);const e=[0];s(me(x[g].getImpl().getIsSimple(y.total(),e)))}}else{s(r===o.enumPolygon);const e=[0],t=x[g].getImpl().getIsSimple(0,e);s(_e(t))}const i=x[g].getImpl();for(let t=0,s=i.getPathCount();t<s;t++){const s=e.constructEmpty();i.queryLoosePathEnvelope(t,s),s.inflateCoords(P,P),S.addEnvelope(w,s),w++}}else{s(r===o.enumEnvelope);const t=e.constructEmpty();x[g].queryLooseEnvelope(t),t.inflateCoords(P,P),S.addEnvelope(w,t),w++,b=-1}}S.endConstruction();const v=w,N=$e(v,-2147483647),G=$e(v,-1);let V=0;p=-1,w=0;for(let e=0,a=i;e<a;e++){if(x[e].getDimension()!==t)continue;if(-1===p&&(p=e),x[e].isEmpty())continue;p=e,V++;const n=x[e].getGeometryType();if(c(n)){for(let t=0,s=x[e].getPathCount();t<s;t++)G[w]=e,N[w]=-t-1,w++}else s(n===o.enumEnvelope),G[w]=e,N[w]=-1,w++}if(V<2&&2===t)return s(p>=0),this.normalizeInputGeometry(x[p]);let F=v;for(;S.next()&&F>0;){this.progress_();const e=S.getHandleA(),t=S.getHandleB(),s=S.getElement(e),n=S.getElement(t);G[s]!==G[n]&&(N[s]<0&&(F--,N[s]=-(N[s]+1)),N[n]<0&&(F--,N[n]=-(N[n]+1)))}const H=new T;let k=!1,A=0;for(let e=0,a=i;e<a;e++){if(x[e].getDimension()!==t||x[e].isEmpty())continue;const n=x[e].getGeometryType(),r=A;let i=0,a=0;const h=c(n)?x[e]:null;for(let t=r,s=N.length;t<s&&G[t]===e;t++)N[t]>=0&&(i++,a+=h?h.getPathSize(N[t]):g(x[e])),A++;if(a>.95*g(x[e])){H.addGeometry(this.normalizeInputGeometry(x[e]));for(let e=r;e<A;e++)N[e]<0&&(N[e]=-(N[e]+1))}else{if(0===i){k=!0;continue}{k=!0,s(c(n)),s(null!=h);const t=new C({vd:x[e].getDescription()}),i=new I({vd:x[e].getDescription()}),a=n===o.enumPolygon?t:i;for(let e=r;e<A;e++)N[e]>=0&&a.addPath(h,N[e],!0);H.addGeometry(a)}}}let M;if(H.getFirstGeometry()!==D){const e=2===t,s=n?pe(null,_.getEnvelope2D(),!0):y;let r=new ue(0,0);if(l&&(r=n?fe(null,_.getEnvelopeZs(),!0):E),2===t&&!(2&m)){H.collapseAllGeometriesToFirst();let e=0,t=null;if(H.hasCurves()&&!H.hasSegmentParentage()){t=new ua;const n=H.getEnvelope2D(this.m_progressTracker);e=la(s.total());na(H,ma(s.total(),n),s.total(),12e3,t,null,this.m_progressTracker)}Tn(H,H.getFirstGeometry(),s.total(),this.m_progressTracker),null!==t&&t.stitchCurves(H,D,e,!0)}if(l)M=this.planarSimplify3DImpl_(H,s,r,u,!0);else if(2===t)M=this.planarSimplifyPolygons(H,s,e,n,-1,!1);else{const e=Na();e.ogcRule=this.m_bOGCOutput,e.allCrossRoadsImpassable=!0,e.unsplitBehavior=u,M=this.planarSimplifyPolylines(H,s,n,e,-1)}if(!k){const e=[0];b=M.getImpl().getIsSimple(s.total(),e)}}else s(k),s(p>=0),M=2===t?new C({vd:x[p].getDescription()}):new I({vd:x[p].getDescription()});if(k){let e=0;for(let t=0,s=N.length;t<s;t++){const s=G[t];if(!(s<0)&&N[t]<0){const n=x[s].getGeometryType(),r=c(n)?x[s]:null;if(r){const s=-(N[t]+1);e+=r.getPathSize(s)}else e+=4}}M.reserve(M.getPointCount()+e);for(let t=0,n=N.length;t<n;t++){const e=G[t];if(!(e<0)&&N[t]<0){const n=x[e].getGeometryType(),r=c(n)?x[e]:null;if(r){const e=-(N[t]+1);M.addPath(r,e,!0)}else n===o.enumEnvelope?M.addEnvelope(x[e],!1):(s(a(n)),M.addSegment(x[e],!0))}}}let U=0;if(2===t?-1!==b&&(b=3,U=n?0:y.total()):(s(1===t),n||-1===b||(U=y.total())),l||M.getImpl().setIsSimple(b,U),!n&&k)if(2===t){if(!l)return(new ph).execute(M,h,!1,this.m_progressTracker);s(0,"3d not yet implemented")}else 1===t&&1!==u&&(M=l?ka():Fa(this.m_bOGCOutput,M,u,this.m_progressTracker),M.getImpl().setIsSimple(b,U));return M}dissolveTopoGraphCommonEdges_(){const e=this.m_topoGraph.createUserIndexForHalfEdges(),t=[];for(let s=this.m_topoGraph.getFirstCluster();s!==D;s=this.m_topoGraph.getNextCluster(s)){const n=this.m_topoGraph.getClusterHalfEdge(s);let r=n;if(n!==D)do{this.progress_();if(1!==this.m_topoGraph.getHalfEdgeUserIndex(r,e)){const s=this.m_topoGraph.getHalfEdgeTwin(r);this.m_topoGraph.setHalfEdgeUserIndex(s,e,1),this.m_topoGraph.setHalfEdgeUserIndex(r,e,1);const n=this.m_topoGraph.getHalfEdgeFaceParentage(r);if(this.isGoodParentage(n)){const e=this.m_topoGraph.getHalfEdgeFaceParentage(s);this.isGoodParentage(e)&&t.push(r)}}r=this.m_topoGraph.getHalfEdgeNext(this.m_topoGraph.getHalfEdgeTwin(r))}while(r!==n)}this.m_topoGraph.deleteUserIndexForHalfEdges(e),this.m_topoGraph.deleteEdgesBreakFaces_(t)}chooseVertexByOrder(e,t,n,r){let i=Ht(),o=D;for(let s=this.m_topoGraph.getClusterVertexIterator(e);s!==D;s=this.m_topoGraph.incrementVertexIterator(s)){const e=this.m_topoGraph.getVertexFromVertexIterator(s),r=t.getUserIndex(e,n);r>=0&&r<i&&(i=r,o=e)}s(o!==D);let a=t.getUserIndex(o,r);return a>0&&(t.setUserIndex(o,r,--a),0===a&&t.setUserIndex(o,n,-1)),o}chooseVertexFromCluster_(e,t){return this.m_topoGraph.getVertexDominantFromCluster(e,t)}chooseVertexFromVertexCluster_(e,t){return this.m_topoGraph.getVertexDominant(e,t)}collectPolygonPathsPreservingFrom_(e,t,s,n,r){const i=this.m_topoGraph.getShape();if(i.getGeometryType(e)!==o.enumPolygon)return;const a=i.hasSegmentParentage(),h=new b;for(let o=i.getFirstPath(e);o!==D;o=i.getNextPath(o)){const e=i.getFirstVertex(o);this.m_topoGraph.getClusterFromVertex(e);const m=this.m_topoGraph.getHalfEdgeFromVertex(e);if(m===D)continue;const l=this.m_topoGraph.getHalfEdgeUserIndex(m,s);if(1===l||2===l)continue;const g=this.m_topoGraph.getHalfEdgeFaceParentage(m);if(!this.isGoodParentage(g)){this.m_topoGraph.setHalfEdgeUserIndex(m,s,2);continue}this.m_topoGraph.setHalfEdgeUserIndex(m,s,1);const u=i.insertPath(t,D);i.setClosedPath(u,!0);let c=m,_=e,d=this.m_topoGraph.getClusterFromVertex(_),p=1;do{this.progress_();const e=this.chooseVertexFromVertexCluster_(_,r),t=i.addVertex(u,e);if(this.m_topoGraph.isHalfEdgeCurve(c)&&(this.m_topoGraph.querySegmentXY(c,h),i.setSegmentToIndex(i.getVertexIndex(t),h.get().clone())),a){const e=this.m_topoGraph.getSegmentParentage(c);i.setSegmentParentageAndBreak(t,e,this.m_topoGraph.isBreakNode(d))}let o,m;-1!==n&&this.m_topoGraph.setClusterUserIndex(d,n,1),this.m_topoGraph.setHalfEdgeUserIndex(c,s,1),c=this.m_topoGraph.getHalfEdgeNext(c);do{o=1===p?i.getNextVertex(_):i.getPrevVertex(_),m=o!==D?this.m_topoGraph.getClusterFromVertex(o):D}while(m===d);const l=this.m_topoGraph.getHalfEdgeOrigin(c);if(l!==m){do{o=1===p?i.getPrevVertex(_):i.getNextVertex(_),m=o!==D?this.m_topoGraph.getClusterFromVertex(o):D}while(m===d);if(l!==m){m=l;const e=this.m_topoGraph.getClusterVertexIterator(m);o=this.m_topoGraph.getVertexFromVertexIterator(e)}else p=-p}d=m,_=o}while(c!==m)}}topoOperationPolygonPolygonHelper_(e,t,s,n,r,i){this.progress_(!0),e!==D&&this.collectPolygonPathsPreservingFrom_(e,s,r,i,n),t!==D&&this.collectPolygonPathsPreservingFrom_(t,s,r,i,n);const o=new b,a=this.m_topoGraph.getShape();a.dbgVerifyCurves();const h=a.hasSegmentParentage();for(let m=this.m_topoGraph.getFirstCluster();m!==D;m=this.m_topoGraph.getNextCluster(m)){const e=this.m_topoGraph.getClusterHalfEdge(m);if(e===D)continue;let t=e;do{this.progress_();const e=this.m_topoGraph.getHalfEdgeUserIndex(t,r);if(1!==e&&2!==e){const e=this.m_topoGraph.getHalfEdgeFaceParentage(t);if(this.isGoodParentage(e)){const e=a.insertPath(s,D);a.setClosedPath(e,!0);let m=t;do{const t=this.m_topoGraph.getHalfEdgeVertexIterator(m);let s=D;if(t!==D)s=this.m_topoGraph.getVertexFromVertexIterator(t);else{const e=this.m_topoGraph.getHalfEdgeVertexIterator(this.m_topoGraph.getHalfEdgeTwin(m));s=this.m_topoGraph.getVertexFromVertexIterator(e),s=a.getNextVertex(s)}const l=this.chooseVertexFromVertexCluster_(s,n),g=a.addVertex(e,l);if(h){const e=this.m_topoGraph.getSegmentParentage(m),t=this.m_topoGraph.getHalfEdgeOrigin(m);a.setSegmentParentageAndBreak(g,e,this.m_topoGraph.isBreakNode(t))}if(this.m_topoGraph.isHalfEdgeCurve(m)&&(this.m_topoGraph.querySegmentXY(m,o),a.setSegmentToIndex(a.getVertexIndex(g),o.get().clone())),this.m_topoGraph.setHalfEdgeUserIndex(m,r,1),-1!==i){const e=this.m_topoGraph.getClusterFromVertex(l);this.m_topoGraph.setClusterUserIndex(e,i,1)}m=this.m_topoGraph.getHalfEdgeNext(m)}while(m!==t)}else this.m_topoGraph.setHalfEdgeUserIndex(t,r,2)}t=this.m_topoGraph.getHalfEdgeNext(this.m_topoGraph.getHalfEdgeTwin(t))}while(t!==e)}}topoOperationPolygonPolygon_(e,t,s,n=!1){this.dissolveTopoGraphCommonEdges_();const r=this.m_topoGraph.getShape(),i=r.createGeometry(o.enumPolygon),a=this.m_topoGraph.createUserIndexForHalfEdges();return this.topoOperationPolygonPolygonHelper_(e,t,i,s,a,-1),this.m_topoGraph.deleteUserIndexForHalfEdges(a),n||Kn(r,i,3,this.m_bOGCOutput,D,this.m_progressTracker),i}topoOperationPolyline_(e,t){const s=Na();return s.allCrossRoadsImpassable=!1,s.ogcRule=t,s.unsplitBehavior=0,this.topoOperationPolylineSimplifyOrPolylineTopoHelper_(D,e,!1,s).first}topoOperationMultiPoint_(){const e=this.m_topoGraph.getShape(),t=e.createGeometry(o.enumMultiPoint),s=e.insertPath(t,D);for(let n=this.m_topoGraph.getFirstCluster();n!==D;n=this.m_topoGraph.getNextCluster(n)){const t=this.m_topoGraph.getClusterParentage(n);if(this.isGoodParentage(t)){let t=D;for(let s=this.m_topoGraph.getClusterVertexIterator(n);s!==D;s=this.m_topoGraph.incrementVertexIterator(s)){const n=this.m_topoGraph.getVertexFromVertexIterator(s);t===D&&(t=n);const r=e.getGeometryFromPath(e.getPathFromVertex(n)),i=this.m_topoGraph.getGeometryID(r);if(this.isGoodParentage(i)){t=n;break}}e.addVertex(s,t)}}return t}intersection(e,t){const n=this.m_topoGraph.getShape().getGeometryType(e),r=this.m_topoGraph.getShape().getGeometryType(t),i=y(n),o=y(r),a=this.m_topoGraph.getGeometryID(e),h=this.m_topoGraph.getGeometryID(t);s(a>=0),s(h>=0),this.m_maskLookup.length=0,this.m_maskLookup.length=1+(a|h),this.m_maskLookup[a|h]=!0;let m=D;return this.m_topoGraph.getShape().getVertexDescription().getAttributeCount()>1&&(m=e),2===i&&2===o?this.topoOperationPolygonPolygon_(e,t,m):1===i&&o>0||1===o&&i>0?this.topoOperationPolyline_(m,this.m_bOGCOutput):0===i||0===o?this.topoOperationMultiPoint_():void l("")}topoOperationPolygonPolygonEx(e,t,s){const n=this.m_topoGraph.getShape(),r=n.createGeometry(o.enumPolygon),i=n.createGeometry(o.enumPolyline),a=n.createGeometry(o.enumMultiPoint);this.dissolveTopoGraphCommonEdges_();let h=D;const m=this.m_topoGraph.createUserIndexForHalfEdges(),l=this.m_topoGraph.createUserIndexForClusters();n.dbgVerifyCurves(),this.topoOperationPolygonPolygonHelper_(e,t,r,s,m,l),n.dbgVerifyCurves();const g=n.hasSegmentParentage(),u=new b;for(let o=this.m_topoGraph.getFirstCluster();o!==D;o=this.m_topoGraph.getNextCluster(o)){const e=this.m_topoGraph.getClusterHalfEdge(o);if(e===D)continue;let t=e;do{let e=this.m_topoGraph.getHalfEdgeUserIndex(t,m),r=this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgeTwin(t),m),a=e|r;if(2===a){let h=this.m_topoGraph.getHalfEdgeParentage(t);if(this.isGoodParentage(h)){const c=n.insertPath(i,D);let _=t;const d=this.chooseVertexFromCluster_(o,s);let p=n.addVertex(c,d);if(g){const e=this.m_topoGraph.getSegmentParentage(t),s=this.m_topoGraph.getHalfEdgeOrigin(t);n.setSegmentParentageAndBreak(p,e,this.m_topoGraph.isBreakNode(s))}this.m_topoGraph.isHalfEdgeCurve(t)&&(this.m_topoGraph.querySegmentXY(t,u),n.setSegmentToIndex(n.getVertexIndex(p),u.get().clone())),this.m_topoGraph.setClusterUserIndex(o,l,1);do{this.progress_();const i=this.m_topoGraph.getHalfEdgeTo(_),o=this.chooseVertexFromCluster_(i,s);if(p=n.addVertex(c,o),g){const e=this.m_topoGraph.getSegmentParentage(t),s=this.m_topoGraph.getHalfEdgeOrigin(t);n.setSegmentParentageAndBreak(p,e,this.m_topoGraph.isBreakNode(s))}if(this.m_topoGraph.setHalfEdgeUserIndex(_,m,1),this.m_topoGraph.setHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgeTwin(_),m,1),this.m_topoGraph.setClusterUserIndex(i,l,1),_=this.m_topoGraph.getHalfEdgeNext(_),e=this.m_topoGraph.getHalfEdgeUserIndex(_,m),r=this.m_topoGraph.getHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgeTwin(_),m),a=e|r,2!==a)break;if(h=this.m_topoGraph.getHalfEdgeParentage(_),!this.isGoodParentage(h)){this.m_topoGraph.setHalfEdgeUserIndex(_,m,1),this.m_topoGraph.setHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgeTwin(_),m,1);break}this.m_topoGraph.isHalfEdgeCurve(t)&&_!==t&&(this.m_topoGraph.querySegmentXY(t,u),n.setSegmentToIndex(n.getVertexIndex(p),u.get().clone()))}while(_!==t)}else this.m_topoGraph.setHalfEdgeUserIndex(t,m,1),this.m_topoGraph.setHalfEdgeUserIndex(this.m_topoGraph.getHalfEdgeTwin(t),m,1)}t=this.m_topoGraph.getHalfEdgeNext(this.m_topoGraph.getHalfEdgeTwin(t))}while(t!==e)}for(let o=this.m_topoGraph.getFirstCluster();o!==D;o=this.m_topoGraph.getNextCluster(o)){this.progress_();if(1===this.m_topoGraph.getClusterUserIndex(o,l))continue;const e=this.m_topoGraph.getClusterParentage(o);if(this.isGoodParentage(e)){h===D&&(h=n.insertPath(a,D));const e=this.m_topoGraph.getClusterVertexIterator(o);let t=D;if(e!==D){t=this.m_topoGraph.getVertexFromVertexIterator(e);const r=this.chooseVertexFromVertexCluster_(t,s);n.addVertex(h,r)}}}this.m_topoGraph.deleteUserIndexForClusters(l),this.m_topoGraph.deleteUserIndexForHalfEdges(m),n.dbgVerifyCurves(),Kn(n,r,3,this.m_bOGCOutput,D,this.m_progressTracker);const c=[D,D,D];return c[0]=a,c[1]=i,c[2]=r,c}topoOperationPolylinePolylineOrPolygonEx(e,t){const s=Na();return s.allCrossRoadsImpassable=!1,s.ogcRule=t,s.unsplitBehavior=0,this.topoOperationPolylineSimplifyOrPolylineTopoHelper_(D,e,!0,s)}topoOperationMultiPoint(){const e=this.m_topoGraph.getShape(),t=e.createGeometry(o.enumMultiPoint),s=e.insertPath(t,D);for(let n=this.m_topoGraph.getFirstCluster();n!==D;n=this.m_topoGraph.getNextCluster(n)){const t=this.m_topoGraph.getClusterParentage(n);if(this.isGoodParentage(t)){let t=D;for(let s=this.m_topoGraph.getClusterVertexIterator(n);s!==D;s=this.m_topoGraph.incrementVertexIterator(s)){const n=this.m_topoGraph.getVertexFromVertexIterator(s);t===D&&(t=n);const r=e.getGeometryFromPath(e.getPathFromVertex(n)),i=this.m_topoGraph.getGeometryID(r);if(this.isGoodParentage(i)){t=n;break}}e.addVertex(s,t)}}return t}intersectionEx(e,t){const n=this.m_topoGraph.getShape().getGeometryType(e),r=this.m_topoGraph.getShape().getGeometryType(t),i=va(n),o=va(r),a=this.m_topoGraph.getGeometryID(e),h=this.m_topoGraph.getGeometryID(t);s(a>=0),s(h>=0),this.m_maskLookup.length=0,this.m_maskLookup.length=1+(a|h),this.m_maskLookup[a|h]=!0;let m=D;if(this.m_topoGraph.getShape().getVertexDescription().getAttributeCount()>1&&(m=e),2===i&&2===o)return this.topoOperationPolygonPolygonEx(e,t,m);if(1===i&&o>0||1===o&&i>0){const{first:e,second:t}=this.topoOperationPolylinePolylineOrPolygonEx(m,this.m_bOGCOutput);return[t,e]}if(0===i||0===o){const e=[];return e.push(this.topoOperationMultiPoint()),e}l("")}getCombinedHalfEdgeParentage(e){return this.m_topoGraph.getHalfEdgeParentage(e)|this.m_topoGraph.getHalfEdgeFaceParentage(e)|this.m_topoGraph.getHalfEdgeFaceParentage(this.m_topoGraph.getHalfEdgeTwin(e))}prevailingDirection(e,t){const s=this.getCombinedHalfEdgeParentage(t),n=this.m_topoGraph.getHalfEdgeOrigin(t),r=this.m_topoGraph.getHalfEdgeTo(t);let i=0,o=0;for(let a=this.m_topoGraph.getClusterVertexIterator(n);a!==D;a=this.m_topoGraph.incrementVertexIterator(a)){const n=this.m_topoGraph.getVertexFromVertexIterator(a),h=e.getPathFromVertex(n),m=e.getGeometryFromPath(h),l=this.m_topoGraph.getGeometryID(m),g=e.getFirstVertex(h),u=!!(l&s);u&&g===n&&(this.m_fromEdgeForPolylines=t);const c=e.getNextVertex(n);if(c!==D&&this.m_topoGraph.getClusterFromVertex(c)===r){if(i++,u){if(this.m_fromEdgeForPolylines===D&&g===c){const e=this.m_topoGraph.getHalfEdgeNext(t);this.isGoodParentage(this.getCombinedHalfEdgeParentage(e))&&(this.m_fromEdgeForPolylines=e)}o++}}else{const s=e.getPrevVertex(n);if(s!==D&&this.m_topoGraph.getClusterFromVertex(s)===r&&(i--,u)){if(this.m_fromEdgeForPolylines===D&&g===s){const e=this.m_topoGraph.getHalfEdgeNext(t);this.isGoodParentage(this.getCombinedHalfEdgeParentage(e))&&(this.m_fromEdgeForPolylines=e)}o--}}}this.m_topoGraph.queryXY(n,this.m_dummyPt1),this.m_topoGraph.queryXY(r,this.m_dummyPt2);return(0!==o?o:i)*We.distance(this.m_dummyPt1,this.m_dummyPt2)}tryMoveThroughCrossroadBackwards(e,t){const s=this.m_topoGraph.getHalfEdgePrev(e),n=this.m_topoGraph.getHalfEdgeTwin(s);if(!t){if(this.m_topoGraph.isStrongPathNode(this.m_topoGraph.getHalfEdgeOrigin(e)))return D;const t=this.m_topoGraph.getHalfEdgeTwin(e);if(n===this.m_topoGraph.getHalfEdgeNext(t))return s}let r=n,i=D;for(;r!==e;){const e=this.getCombinedHalfEdgeParentage(r);if(this.isGoodParentage(e)){if(i!==D)return D;i=this.m_topoGraph.getHalfEdgeTwin(r)}r=this.m_topoGraph.getHalfEdgeTwin(this.m_topoGraph.getHalfEdgePrev(r))}return i}tryMoveThroughCrossroadForward(e,t){const s=this.m_topoGraph.getHalfEdgeNext(e),n=this.m_topoGraph.getHalfEdgeTwin(s);if(!t){const t=this.m_topoGraph.getHalfEdgeTwin(e);if(this.m_topoGraph.isStrongPathNode(this.m_topoGraph.getHalfEdgeOrigin(t)))return D;if(n===this.m_topoGraph.getHalfEdgePrev(t))return s}let r=n,i=D;for(;r!==e;){const e=this.getCombinedHalfEdgeParentage(r);if(this.isGoodParentage(e)){if(i!==D)return D;i=this.m_topoGraph.getHalfEdgeTwin(r)}r=this.m_topoGraph.getHalfEdgeTwin(this.m_topoGraph.getHalfEdgeNext(r))}return i}isOnALoop(e,t){let s=e;const n=2*this.m_topoGraph.getShape().getTotalPointCount()+10;for(let r=0;r<n;r++){if(1===this.m_topoGraph.getHalfEdgeUserIndex(s,t))return!1;const n=this.m_topoGraph.getHalfEdgeNext(s);if(n===this.m_topoGraph.getHalfEdgeTwin(s))return!1;if(s=n,s===e)return!0}l("is_on_a_loop_")}restorePolylineParts(e,t,n,r,i,o,a,h,m,l){s(i===D&&o>=0&&a>=0||-1===o&&-1===a),s(-1===h&&1!==l.unsplitBehavior||-1!==h&&1===l.unsplitBehavior);const g=l.ogcRule,u=l.allCrossRoadsImpassable,c=1===l.unsplitBehavior,_=0===l.unsplitBehavior,d=this.m_topoGraph.getShape(),p=d.hasSegmentParentage();let f=e,x=this.m_topoGraph.getHalfEdgeTwin(f);const y=new b;this.m_fromEdgeForPolylines=D;let P=this.prevailingDirection(d,f),E=f,S=D,C=!1,I=!1,w=!1;if(!c)for(;;){const t=this.m_topoGraph.getHalfEdgePrev(f);if(t===x){w=!0;break}const s=this.m_topoGraph.getHalfEdgeNext(x);if(this.m_topoGraph.isStrongPathNode(this.m_topoGraph.getHalfEdgeOrigin(s))){C=!0;break}if(this.m_topoGraph.getHalfEdgeTwin(t)!==s){if(u){C=!0;break}if(f=this.tryMoveThroughCrossroadBackwards(f,!0),f===D){C=!0;break}x=this.m_topoGraph.getHalfEdgeTwin(f)}else f=t,x=s;if(1===this.m_topoGraph.getHalfEdgeUserIndex(f,n)){w=!0;break}if(f===e){S=e,I=!0;break}const r=this.getCombinedHalfEdgeParentage(f);if(!this.isGoodParentage(r))break;E=f,P+=this.prevailingDirection(d,f)}if(S===D){for(f=e,x=this.m_topoGraph.getHalfEdgeTwin(f),S=f;;){const e=this.m_topoGraph.getHalfEdgeNext(f),t=this.m_topoGraph.isStrongPathNode(this.m_topoGraph.getHalfEdgeOrigin(e));if(t){C=!0;break}if(e===x){w=!0;break}if(-1!==h){const e=this.m_topoGraph.getHalfEdgeOrigin(x);if(1===this.m_topoGraph.getClusterUserIndex(e,h)){C=!0;break}}const s=this.m_topoGraph.getHalfEdgePrev(x);if(this.m_topoGraph.getHalfEdgeTwin(e)!==s){if(t||u){C=!0;break}if(f=this.tryMoveThroughCrossroadForward(f,!0),f===D){C=!0;break}x=this.m_topoGraph.getHalfEdgeTwin(f)}else f=e,x=s;if(1===this.m_topoGraph.getHalfEdgeUserIndex(f,n)){w=!0;break}const r=this.getCombinedHalfEdgeParentage(f);if(!this.isGoodParentage(r))break;S=f,P+=this.prevailingDirection(d,f)}const t=this.m_topoGraph.getHalfEdgeOrigin(E);I=this.m_topoGraph.getHalfEdgeTo(S)===t}else if(this.m_fromEdgeForPolylines!==D){E=e,S=this.tryMoveThroughCrossroadBackwards(E,!1),s(S!==D);const t=this.m_topoGraph.getHalfEdgeTwin(E);this.m_topoGraph.getHalfEdgeNext(t)}let v=I;I||w||m&&(v=this.isOnALoop(e,n),v||(v=this.isOnALoop(x,n)));const T=P>=0;let N=!1;v&&C&&(I?(N=g,T&&(N||c||_)&&E!==e&&(s(!c),E=e,N=!1)):(c||T&&_)&&(E=e));let G=0;for(f=E;x=this.m_topoGraph.getHalfEdgeTwin(f),this.m_topoGraph.setHalfEdgeUserIndex(f,n,1),this.m_topoGraph.setHalfEdgeUserIndex(x,n,1),G++,f!==S;)f=u?this.m_topoGraph.getHalfEdgeNext(f):this.tryMoveThroughCrossroadForward(f,!1);T||(S=gt(E,E=S),S=this.m_topoGraph.getHalfEdgeTwin(S),E=this.m_topoGraph.getHalfEdgeTwin(E));let V=d.insertPath(t,D);f=E;const F=this.m_topoGraph.getHalfEdgeOrigin(E);let H;H=-1!==o?this.chooseVertexByOrder(F,d,o,a):this.chooseVertexFromCluster_(F,i),this.m_topoGraph.isStrongPathNode(F)&&d.setStrongPathStart(V,!0);let k=d.addVertex(V,H),A=k;-1!==r&&this.m_topoGraph.setClusterUserIndex(F,r,1);let M=0;const U=N?Math.trunc((G+1)/2):-1;let q=D,O=!0,B=D;for(;;){if(p){const e=this.m_topoGraph.getSegmentParentage(f),t=this.m_topoGraph.getHalfEdgeOrigin(f);d.setSegmentParentageAndBreak(A,e,O||this.m_topoGraph.isBreakNode(t))}O=!1,this.m_topoGraph.isHalfEdgeCurve(f)&&(this.m_topoGraph.querySegmentXY(f,y),d.setSegmentToIndex(d.getVertexIndex(A),y.get().clone())),q!==D&&-1!==a&&d.addToUserIndex(q,a,-1);const e=u?this.m_topoGraph.getHalfEdgeNext(f):this.tryMoveThroughCrossroadForward(f,!1),s=this.m_topoGraph.getHalfEdgeTo(f);let n;if(n=-1!==o?this.chooseVertexByOrder(s,d,o,a):this.chooseVertexFromCluster_(s,i),k=d.addVertex(V,n),B=s,-1!==r&&this.m_topoGraph.setClusterUserIndex(s,r,1),p&&this.m_topoGraph.isBreakNode(s)&&d.setSegmentParentageBreakVertex(k,!0),q=n,M++,N&&M===U&&(V=d.insertPath(t,D),k=d.addVertex(V,n),O=!0,-1!==a&&d.addToUserIndex(n,a,-1),q=D),f===S)break;f=e,A=k}B!==D&&this.m_topoGraph.isStrongPathNode(B)&&d.setStrongPathEnd(V,!0)}topoOperationPolylineSimplify_(e,t){return this.topoOperationPolylineSimplifyOrPolylineTopoHelper_(e,D,!1,t).first}topoOperationPolylineSimplifyOrPolylineTopoHelper_(e,t,n,r){s(t===D||e===D);const i=this.m_topoGraph.getShape(),a=t=>t=e===D?t===D?i.getFirstGeometry():i.getNextGeometry(t):t===D?e:D,h=i.createGeometry(o.enumPolyline);let m=-1;n&&(m=this.m_topoGraph.createUserIndexForClusters());const l=this.m_topoGraph.createUserIndexForHalfEdges(),g=t===D?i.createUserIndex():-1,u=t===D?i.createUserIndex():-1;let c=-1;if(1===r.unsplitBehavior){c=this.m_topoGraph.createUserIndexForClusters();for(let e=a(D);e!==D;e=a(e))for(let t=i.getFirstPath(e);t!==D;t=i.getNextPath(t)){{const e=i.getFirstVertex(t),s=this.m_topoGraph.getClusterFromVertex(e);this.m_topoGraph.setClusterUserIndex(s,c,1)}if(!i.isClosedPath(t)){const e=i.getLastVertex(t),s=this.m_topoGraph.getClusterFromVertex(e);this.m_topoGraph.setClusterUserIndex(s,c,1)}}}if(t===D){let e=0;for(let t=a(D);t!==D;t=a(t))for(let s=i.getFirstPath(t);s!==D;s=i.getNextPath(s)){if(i.isClosedPath(s)){let t=i.getFirstVertex(s);for(let n=0,r=i.getPathSize(s);n<r;n++,t=i.getNextVertex(t))i.setUserIndex(t,g,e++),i.setUserIndex(t,u,2)}else{const t=i.getFirstVertex(s);i.setUserIndex(t,g,e++),i.setUserIndex(t,u,1);let n=i.getNextVertex(t);for(let r=1,o=i.getPathSize(s)-1;r<o;++r)i.setUserIndex(n,g,e++),i.setUserIndex(n,u,2),n=i.getNextVertex(n);i.setUserIndex(n,g,e++),i.setUserIndex(n,u,1)}}}for(let s=a(D);s!==D;s=a(s))for(let e=i.getFirstPath(s);e!==D;e=i.getNextPath(e)){let s=i.getFirstVertex(e);for(let n=0,o=i.getPathSize(e);n<o;n++,s=i.getNextVertex(s)){const e=this.m_topoGraph.getHalfEdgeFromVertex(s);if(e===D)continue;if(1===this.m_topoGraph.getHalfEdgeUserIndex(e,l))continue;const i=this.getCombinedHalfEdgeParentage(e);if(this.isGoodParentage(i)){const s=0===n;this.restorePolylineParts(e,h,l,m,t,g,u,c,s,r)}}}let _=D;if(n){_=i.createGeometry(o.enumMultiPoint);let e=D;for(let s=this.m_topoGraph.getFirstCluster();s!==D;s=this.m_topoGraph.getNextCluster(s)){this.progress_();if(1!==this.m_topoGraph.getClusterUserIndex(s,m)){const n=this.m_topoGraph.getClusterParentage(s);if(this.isGoodParentage(n)){e===D&&(e=i.insertPath(_,D));const n=this.m_topoGraph.getClusterVertexIterator(s);if(n!==D){let r;this.m_topoGraph.getVertexFromVertexIterator(n),r=-1!==g?this.chooseVertexByOrder(s,i,g,u):this.chooseVertexFromCluster_(s,t),i.addVertex(e,r)}}}}}return-1!==u&&i.removeUserIndex(u),-1!==g&&i.removeUserIndex(g),-1!==m&&i.removeUserIndex(m),this.m_topoGraph.deleteUserIndexForHalfEdges(l),je(h,_)}difference(e,t){const s=this.m_topoGraph.getShape().getGeometryType(e),n=this.m_topoGraph.getShape().getGeometryType(t),r=y(s),i=y(n);if(r>i)return e;const o=this.m_topoGraph.getGeometryID(e),a=this.m_topoGraph.getGeometryID(t);if(this.m_maskLookup.length=0,this.m_maskLookup.length=1+(o|a),this.m_maskLookup[o]=!0,2===r&&2===i){let s=D;return this.m_topoGraph.getShape().getVertexDescription().getAttributeCount()>1&&(s=e),this.topoOperationPolygonPolygon_(e,t,s)}if(1===r&&2===i){const t=Na();return t.allCrossRoadsImpassable=!1,t.ogcRule=this.m_bOGCOutput,t.unsplitBehavior=0,this.topoOperationPolylineSimplifyOrPolylineTopoHelper_(e,D,!1,t).first}if(1===r&&1===i){const t=Na();return t.allCrossRoadsImpassable=!0,t.ogcRule=this.m_bOGCOutput,t.unsplitBehavior=0,this.topoOperationPolylineSimplifyOrPolylineTopoHelper_(e,D,!1,t).first}if(0===r)return this.topoOperationMultiPoint_();l("")}symmetricDifference(e,t){const n=this.m_topoGraph.getShape().getGeometryType(e),r=this.m_topoGraph.getShape().getGeometryType(t),i=va(n),o=va(r),a=this.m_topoGraph.getGeometryID(e),h=this.m_topoGraph.getGeometryID(t);return s(a>=0),s(h>=0),this.m_maskLookup.length=0,this.m_maskLookup.length=1+(a|h),this.m_maskLookup[a]=!0,this.m_maskLookup[a]=!0,this.m_maskLookup[h]=!0,2===i&&2===o?this.topoOperationPolygonPolygon_(e,t,D):1===i&&1===o?this.topoOperationPolyline_(D,this.m_bOGCOutput):0===i&&0===o?this.topoOperationMultiPoint():void l("")}planarSimplifyNoCrackingAndCluster(e,t,n,r){this.m_bOGCOutput=e,this.m_topoGraph=new Qs;const i=t.getFillRule(n),a=t.getGeometryType(n);if(1!==i||a===o.enumMultiPoint?this.m_topoGraph.setAndSimplifyEditShapeAlternate(t,n,this.m_progressTracker):this.m_topoGraph.setAndSimplifyEditShapeWinding(t,n,this.m_progressTracker),this.m_topoGraph.dirtyCheckFailed())return!1;this.m_topoGraph.setCheckDirtyPlanesweepTolerance(Number.NaN);const h=this.m_topoGraph.getGeometryID(n);if(s(h>=0),this.m_maskLookup.length=0,this.m_maskLookup.length=h+1,this.m_maskLookup[h]=!0,t.getGeometryType(n)===o.enumPolygon||1===i&&t.getGeometryType(n)!==o.enumMultiPoint){t.setFillRule(n,0);const s=this.topoOperationPolygonPolygon_(n,D,D);if(t.swapGeometry(s,n),t.removeGeometry(s),1===i&&this.m_bOGCOutput)return this.planarSimplifyNoCrackingAndCluster(e,t,n,r)}else if(t.getGeometryType(n)===o.enumPolyline){const e=Na();e.ogcRule=this.m_bOGCOutput,e.allCrossRoadsImpassable=!0,e.unsplitBehavior=r;const s=this.topoOperationPolylineSimplify_(t.getFirstGeometry(),e);t.swapGeometry(s,n),t.removeGeometry(s)}else if(t.getGeometryType(n)===o.enumMultiPoint){const e=this.topoOperationMultiPoint_();t.swapGeometry(e,n),t.removeGeometry(e)}else l("");return!0}unsplitPolylineExact(e){return s(0),new I}planarSimplifyPolylines(e,t,n,r,i){for(let _=e.getFirstGeometry();_!==D;_=e.getNextGeometry(_)){const t=e.getGeometryType(_);s(t===o.enumPolyline)}let a=0,h=0,m=null;if(e.hasCurves()&&!e.hasSegmentParentage()){m=new ua;const s=e.getEnvelope2D(this.m_progressTracker);h=la(t.total());const n=ma(t.total(),s);a=ga(n,h),na(e,n,t.total(),12e3,m,null,this.m_progressTracker)}{const s=ya(t.add(a));e.filterClosePoints(s,!1,!1,!1,D)}if(this.m_topoGraph=new Qs,4!==i&&5!==i)if(null===m&&n){const s=new vn(this.m_progressTracker,!1);s.sweepVertical(e,t.total()),s.hadComplications()?(_a(e,t,this.m_progressTracker,!0,!1),n=!1):this.m_topoGraph.setCheckDirtyPlanesweepTolerance(t.total())}else _a(e,t.add(a),this.m_progressTracker,!0,!1),n=!1;else n=!1;e.removeSelection(),e.collapseAllGeometriesToFirst();const l=e.getFirstGeometry();if(this.m_topoGraph.setAndSimplifyEditShapeAlternate(e,l,this.m_progressTracker),this.m_topoGraph.dirtyCheckFailed())return s(n&&null===m),this.m_topoGraph.removeShape(),this.m_topoGraph=null,this.planarSimplifyPolylines(e,t,!1,r,-1);this.m_topoGraph.setCheckDirtyPlanesweepTolerance(Number.NaN);const g=this.m_topoGraph.getGeometryID(l);s(g>=0),this.m_maskLookup.length=0,this.m_maskLookup.length=g+1,this.m_maskLookup[g]=!0;const u=this.topoOperationPolylineSimplify_(e.getFirstGeometry(),r);null!==m&&m.stitchCurves(e,u,h,!0);const c=e.getGeometry(u);return n||c.getImpl().setIsSimple(4,t.total()),c}planarSimplifyMultiPoints(e,t,n,r){for(let l=e.getFirstGeometry();l!==D;l=e.getNextGeometry(l)){const t=e.getGeometryType(l);s(t===o.enumMultiPoint)}this.m_topoGraph=new Qs,4!==r&&5!==r?(_a(e,t,this.m_progressTracker,!0,!1),n=!1):n=!1,e.removeSelection(),e.collapseAllGeometriesToFirst();const i=e.getFirstGeometry();if(this.m_topoGraph.setAndSimplifyEditShapeAlternate(e,i,this.m_progressTracker),this.m_topoGraph.dirtyCheckFailed())return s(n),this.m_topoGraph.removeShape(),this.m_topoGraph=null,this.planarSimplifyMultiPoints(e,t,!1,-1);this.m_topoGraph.setCheckDirtyPlanesweepTolerance(Number.NaN);const a=this.m_topoGraph.getGeometryID(i);s(a>=0),this.m_maskLookup.length=0,this.m_maskLookup.length=a+1,this.m_maskLookup[a]=!0;const h=this.topoOperationMultiPoint(),m=e.getGeometry(h);return n||m.getImpl().setIsSimple(4,t.total()),m}planarSimplifyPolygons(e,t,n,r,i,a){for(let f=e.getFirstGeometry();f!==D;f=e.getNextGeometry(f)){const t=e.getGeometryType(f);s(t===o.enumPolygon||t===o.enumPolyline&&n)}let h=0,m=0,l=null;if(e.hasCurves()&&!e.hasSegmentParentage()){l=new ua;const s=e.getEnvelope2D(this.m_progressTracker);m=la(t.total());const n=ma(t.total(),s);h=ga(n,m),na(e,n,t.total(),12e3,l,null,this.m_progressTracker)}if(a){_a(e,t.add(h),this.m_progressTracker,!0,!1);for(let t=e.getFirstGeometry();t!==D;t=e.getNextGeometry(t))e.getGeometryType(t)===o.enumPolygon&&Kn(e,t,-1,!1,D,this.m_progressTracker)}if(this.m_topoGraph=new Qs,a||4===i||5===i)r=!1;else if(null===l&&r){const s=new vn(this.m_progressTracker,!1);s.sweepVertical(e,t.total()),s.hadComplications()?(_a(e,t,this.m_progressTracker,!0,!1),r=!1):this.m_topoGraph.setCheckDirtyPlanesweepTolerance(t.total())}else _a(e,t.add(h),this.m_progressTracker,!0,!1),r=!1;e.removeSelection(),e.collapseAllGeometriesToFirst();const g=e.getFirstGeometry();if(n?this.m_topoGraph.setAndSimplifyEditShapeWinding(e,g,this.m_progressTracker):this.m_topoGraph.setAndSimplifyEditShapeAlternate(e,g,this.m_progressTracker),this.m_topoGraph.dirtyCheckFailed())return s(r&&null===l),this.m_topoGraph.removeShape(),this.m_topoGraph=null,this.planarSimplifyPolygons(e,t,n,!1,-1,!1);this.m_topoGraph.setCheckDirtyPlanesweepTolerance(Number.NaN);const u=this.m_topoGraph.getGeometryID(g);s(u>=0),this.m_maskLookup.length=0,this.m_maskLookup.length=u+1,this.m_maskLookup[u]=!0,e.setFillRule(g,0);const c=this.m_bOGCOutput&&n,_=c;let d=this.topoOperationPolygonPolygon_(g,D,D,_);if(c){this.m_topoGraph.removeShape(),this.m_topoGraph=null,e.removeGeometry(g),this.m_topoGraph=new Qs,this.m_topoGraph.setAndSimplifyEditShapeAlternate(e,d,this.m_progressTracker);d=this.topoOperationPolygonPolygon_(d,D,D,!1)}null!==l&&l.stitchCurves(e,d,m,!0);const p=e.getGeometry(d);return p.setFillRule(0),r?p.getImpl().setIsSimple(3,0):(p.getImpl().setIsSimple(4,t.total()),p.getImpl().updateOGCFlagsProtected()),p}planarSimplify3DImpl_(e,t,n,r,i){return s(0),{}}planarSimplifyImpl_(e,t,s,n,r,i,a,h){if(e.isEmpty())return e.clone();const m=e.getGeometryType(),g=new T,u=g.addGeometry(e);if(_e(r)&&m===o.enumPolygon&&(s=!1,g.setFillRule(u,0)),h&&(e.hasAttribute(1)&&g.replaceNaNs(1,0),g.removeNaNVertices()),m===o.enumPolygon||m===o.enumPolyline&&s)return this.planarSimplifyPolygons(g,t,s,n,r,!1);if(m===I.type){const e=Na();return e.allCrossRoadsImpassable=!0,e.ogcRule=this.m_bOGCOutput,e.unsplitBehavior=a,this.planarSimplifyPolylines(g,t,n,e,r)}if(m===o.enumMultiPoint)return this.planarSimplifyMultiPoints(g,t,n,r);l("what else?")}}function za(e,t,s,n){if(e.isEmpty())return e.createInstance();if(t.isEmpty())return n?e.createInstance():new ae({copy:e});const r=[new We],i=[0],o=2===t.getDimension();1!==t.getDimension()&&2!==t.getDimension()&&l(""),r[0]=e.getXY(),o?Yo(t,r,1,s.total(),i):Xo(t,r,1,s.total(),i);let a=0===i[0];return n||(a=!a),a?e.createInstance():e}function Wa(e,t,s,n){const r=e.createInstance(),i=lt(We,100),o=new Array(100),a=e.getPointCount();let h=!0;const m=2===t.getDimension();1!==t.getDimension()&&2!==t.getDimension()&&l("");for(let l=0;l<a;){const n=e.queryCoordinates(i,i.length,l,-1)-l;m?Yo(t,i,n,s.total(),o):Xo(t,i,n,s.total(),o);let a=0;for(let t=0;t<n;t++){0===o[t]&&(h&&(h=!1,r.addPoints(e,0,l)),a!==t&&r.addPoints(e,l+a,l+t),a=t+1)}h||a===n||r.addPoints(e,l+a,l+n),l+=n}return h?e:r}function ja(e,t,s,n){const r=e.getGeometryType();if(r===o.enumEnvelope){const t=new C({vd:e.getDescription()});return e.isEmpty()||t.addEnvelope(e,!1),t}if(r===o.enumPoint&&("|"===n||"^"===n)){const t=new w({vd:e.getDescription()});return e.isEmpty()||t.add(e),t}if(r===o.enumLine){const t=new I({vd:e.getDescription()});return e.isEmpty()||t.addSegment(e,!0),t}if(r===o.enumMultiPoint&&"-"===n&&t.getGeometryType()===o.enumPoint){const t=new ae({vd:e.getDescription()});return e.isEmpty()||e.getPointByVal(0,t),t}if(r===o.enumMultiPoint&&"&"===n&&t.getGeometryType()===o.enumPoint){const t=new ae({vd:e.getDescription()});return e.isEmpty()||e.getPointByVal(0,t),t}return e}function Za(e){const s=e.getGeometryType();if(s===o.enumEnvelope){const t=new C({vd:e.getDescription()});return e.isEmpty()||t.addEnvelope(e,!1),t}if(s===o.enumPoint){const t=new w({vd:e.getDescription()});return e.isEmpty()||t.add(e),t}if(wa(s)){const t=new I({vd:e.getDescription()});return e.isEmpty()||t.addSegment(e,!0),t}return s!==o.enumMultiPoint&&s!==o.enumPolyline&&s!==o.enumPolygon&&t("Unexpected geometry type"),e}function Ka(e,t,n,r){const i=n===D?e.getClusterHalfEdge(t):n;let o=i;s(e.getHalfEdgeOrigin(i)===t);do{r(o),o=e.getHalfEdgeNext(e.getHalfEdgeTwin(o))}while(o!==i)}class Qa{constructor(e,t,s,n,r,i){this.m_rParent=e,this.m_rTopoGraph=e.m_topoGraph,this.m_rShape=this.m_rTopoGraph.getShape(),this.m_IDCuttee=this.m_rTopoGraph.getGeometryID(n),this.m_IDCutter=this.m_rTopoGraph.getGeometryID(r),this.m_IDBoth=this.m_IDCuttee|this.m_IDCutter,this.m_bConsiderTouch=t,this.m_sideIndex=s,this.m_cuttee=n,this.m_cutter=r,this.m_rCutHandles=i,this.m_cutteeBreadcrumbsIndex=this.m_rShape.createUserIndexUninitialized(),this.m_clusterParentageIndex=this.m_rShape.createUserIndexUninitialized();for(let o=this.m_rShape.getFirstPath(this.m_cuttee);o!==D;o=this.m_rShape.getNextPath(o)){let e=0;const t=this.m_rShape.getPathSize(o);for(let s=this.m_rShape.getFirstVertex(o);e<t;e++,s=this.m_rShape.getNextVertex(s))this.m_rShape.setUserIndex(s,this.m_clusterParentageIndex,this.m_rTopoGraph.getClusterParentage(this.m_rTopoGraph.getClusterFromVertex(s)))}}Do(){this.cutPolylinePolyline_(),this.m_rShape.removeUserIndex(this.m_cutteeBreadcrumbsIndex),this.m_rShape.removeUserIndex(this.m_clusterParentageIndex)}setTbd(e){return 8|e}classifyStandardCut(e,t,s,n){const r=this.m_rShape.getPrevVertex(e),i=this.m_rShape.getNextVertex(e),o=r===D?D:this.m_rTopoGraph.getHalfEdgeConnector(t,this.m_rTopoGraph.getClusterFromVertex(r)),a=i===D?D:this.m_rTopoGraph.getHalfEdgeConnector(t,this.m_rTopoGraph.getClusterFromVertex(i)),h=this.m_rTopoGraph.getHalfEdgeConnector(t,this.m_rTopoGraph.getClusterFromVertex(s)),m=this.m_rTopoGraph.getHalfEdgeConnector(t,this.m_rTopoGraph.getClusterFromVertex(n));let l=1,g=32,u=32;if(Ka(this.m_rTopoGraph,t,m,(e=>{e===h&&(l=2),e===o&&(g=l),e===a&&(u=l)})),this.m_bConsiderTouch)32!==g&&this.m_rShape.setUserIndex(r,this.m_cutteeBreadcrumbsIndex,this.m_rShape.getUserIndex(r,this.m_cutteeBreadcrumbsIndex)|g),32!==u&&this.m_rShape.setUserIndex(e,this.m_cutteeBreadcrumbsIndex,this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex)|u);else{if(32===g||32===u)return 1;if(g===u&&!(o===h||o===m||a===h||a===m))return 1;this.m_rShape.setUserIndex(r,this.m_cutteeBreadcrumbsIndex,this.m_rShape.getUserIndex(r,this.m_cutteeBreadcrumbsIndex)|g),this.m_rShape.setUserIndex(e,this.m_cutteeBreadcrumbsIndex,this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex)|u)}return 0}classifyTouchCut(e,t,s,n){const r=this.m_rShape.getPrevVertex(e),i=this.m_rShape.getNextVertex(e),o=r===D?D:this.m_rTopoGraph.getHalfEdgeConnector(t,this.m_rTopoGraph.getClusterFromVertex(r)),a=i===D?D:this.m_rTopoGraph.getHalfEdgeConnector(t,this.m_rTopoGraph.getClusterFromVertex(i)),h=s===D?D:this.m_rTopoGraph.getHalfEdgeConnector(t,this.m_rTopoGraph.getClusterFromVertex(s)),m=n===D?D:this.m_rTopoGraph.getHalfEdgeConnector(t,this.m_rTopoGraph.getClusterFromVertex(n));if(!this.m_bConsiderTouch){let t;return(t=h===o||m===o)?this.m_rShape.setUserIndex(e,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex))):(t=h===a||m===a)&&this.m_rShape.setUserIndex(r,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(r,this.m_cutteeBreadcrumbsIndex))),t?0:1}if(o===D)return this.m_rShape.setUserIndex(e,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex))),0;if(a===D)return this.m_rShape.setUserIndex(r,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(r,this.m_cutteeBreadcrumbsIndex))),0;if(o===a)return this.m_rShape.setUserIndex(r,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(r,this.m_cutteeBreadcrumbsIndex))),this.m_rShape.setUserIndex(e,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex))),0;if(m!==D){if(o===m)return this.m_rShape.setUserIndex(e,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex))),0;if(a===m)return this.m_rShape.setUserIndex(r,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(r,this.m_cutteeBreadcrumbsIndex))),0;let s=1;Ka(this.m_rTopoGraph,t,m,(t=>{if(t===o){const e=this.m_rShape.getUserIndex(r,this.m_cutteeBreadcrumbsIndex)|s;this.m_rShape.setUserIndex(r,this.m_cutteeBreadcrumbsIndex,e),s=2}else if(t===a){const t=this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex)|s;this.m_rShape.setUserIndex(e,this.m_cutteeBreadcrumbsIndex,t),s=2}}))}else{if(o===h)return this.m_rShape.setUserIndex(e,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex))),0;if(a===h)return this.m_rShape.setUserIndex(r,this.m_cutteeBreadcrumbsIndex,this.setTbd(this.m_rShape.getUserIndex(r,this.m_cutteeBreadcrumbsIndex))),0;let s=2;Ka(this.m_rTopoGraph,t,h,(t=>{if(t===o){const e=this.m_rShape.getUserIndex(r,this.m_cutteeBreadcrumbsIndex)|s;this.m_rShape.setUserIndex(r,this.m_cutteeBreadcrumbsIndex,e),s=1}else if(t===a){const t=this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex)|s;this.m_rShape.setUserIndex(e,this.m_cutteeBreadcrumbsIndex,t),s=1}}))}return 0}classifyCutVertex(e,t){let s=0,n=0;for(let r=this.m_rTopoGraph.getClusterVertexIterator(t);r!==D;r=this.m_rTopoGraph.incrementVertexIterator(r)){const i=this.m_rTopoGraph.getVertexFromVertexIterator(r);if(this.m_rShape.getGeometryFromVertex(i)===this.m_cutter){n++;const r=this.m_rShape.getPrevVertex(i),o=this.m_rShape.getNextVertex(i);s+=r===D||o===D?this.classifyTouchCut(e,t,r,o):this.classifyStandardCut(e,t,r,o)}}n&&s===n&&!this.m_bConsiderTouch&&this.m_rShape.setUserIndex(e,this.m_clusterParentageIndex,this.m_IDCuttee)}cutPolylinePolyline_(){this.m_rShape.getGeometryType(this.m_cuttee),this.m_rShape.getGeometryType(this.m_cutter),this.m_rParent.m_maskLookup.length=0,this.m_rParent.m_maskLookup.length=this.m_IDBoth+1,this.m_rParent.m_maskLookup[this.m_IDBoth]=!0;for(let o=this.m_rShape.getFirstPath(this.m_cuttee);o!==D;o=this.m_rShape.getNextPath(o)){const e=this.m_rShape.getPathSize(o);let t=this.m_rShape.getFirstVertex(o);for(let s=0;s<e;++s,t=this.m_rShape.getNextVertex(t))this.m_rShape.setUserIndex(t,this.m_cutteeBreadcrumbsIndex,0);t=this.m_rShape.getFirstVertex(o);for(let s=0;s<e;++s,t=this.m_rShape.getNextVertex(t)){const e=this.m_rTopoGraph.getClusterFromVertex(t);this.m_rTopoGraph.getClusterParentage(e)===this.m_IDBoth&&this.classifyCutVertex(t,e)}}const e=(e,t)=>{let s=this.m_rShape.getUserIndex(e,this.m_cutteeBreadcrumbsIndex);const n=this.m_rTopoGraph.getHalfEdgeConnector(this.m_rTopoGraph.getClusterFromVertex(e),this.m_rTopoGraph.getClusterFromVertex(t));return(this.m_rTopoGraph.getHalfEdgeParentage(n)&this.m_IDBoth)===this.m_IDBoth&&(s|=4),s};for(let o=this.m_rShape.getFirstPath(this.m_cuttee);o!==D;o=this.m_rShape.getNextPath(o)){let t=this.m_rShape.getFirstVertex(o);const s=this.m_rShape.isClosedPath(o),n=this.m_rShape.getPathSize(o)+(s?1:0);let r=1,i=32;for(let o=this.m_rShape.getNextVertex(t);r<n;++r,t=o,o=this.m_rShape.getNextVertex(o)){const s=e(t,o);this.m_rShape.getUserIndex(t,this.m_clusterParentageIndex)===this.m_IDBoth&&(i=s),32!==i&&this.m_rShape.setUserIndex(t,this.m_cutteeBreadcrumbsIndex,i|s)}t=this.m_rShape.getLastVertex(o);let a=32;r=1;for(let o=this.m_rShape.getPrevVertex(t);r<n;++r,t=o,o=this.m_rShape.getPrevVertex(o)){const s=e(o,t);this.m_rShape.getUserIndex(t,this.m_clusterParentageIndex)===this.m_IDBoth&&(a=s),32!==a&&this.m_rShape.setUserIndex(o,this.m_cutteeBreadcrumbsIndex,a|s)}}let t=D,s=D,n=32;const r=this.m_rShape.hasSegmentParentage(),i=new b;for(let a=this.m_rShape.getFirstPath(this.m_cuttee);a!==D;a=this.m_rShape.getNextPath(a)){const e=this.m_rShape.isClosedPath(a),h=this.m_rShape.getPathSize(a)+(e?1:0);let m=1,l=this.m_rShape.getFirstVertex(a),g=D,u=!0;for(let a=this.m_rShape.getNextVertex(l);m<h;++m,a=this.m_rShape.getNextVertex(a)){let e=this.m_rShape.getUserIndex(l,this.m_cutteeBreadcrumbsIndex);8===e?e=3:(e&=-9,4&e?e=4:3&~e||(e=3)),e!==n?(t!==D&&(g=this.m_rShape.addVertex(s,l),r&&this.m_rTopoGraph.isBreakNode(this.m_rTopoGraph.getClusterFromVertex(l))&&this.m_rShape.setSegmentParentageBreakVertex(g,!0),this.m_rCutHandles.push(t),this.m_rShape.setGeometryUserIndex(t,this.m_sideIndex,n)),t=this.m_rShape.createGeometry(o.enumPolyline),s=this.m_rShape.insertPath(t,D),n=e,u=!0):this.m_rShape.getUserIndex(l,this.m_clusterParentageIndex)===this.m_IDBoth&&4!==e&&(g=this.m_rShape.addVertex(s,l),r&&this.m_rTopoGraph.isBreakNode(this.m_rTopoGraph.getClusterFromVertex(l))&&this.m_rShape.setSegmentParentageBreakVertex(g,!0),s=this.m_rShape.insertPath(t,D),u=!0),g=this.m_rShape.addVertex(s,l);const h=this.m_rTopoGraph.getClusterFromVertex(l);!u&&r&&this.m_rTopoGraph.isBreakNode(h)&&this.m_rShape.setSegmentParentageBreakVertex(g,!0);const m=this.m_rTopoGraph.getHalfEdgeFromVertex(l);if(r){const e=this.m_rTopoGraph.getSegmentParentage(m);this.m_rShape.setSegmentParentageAndBreak(g,e,u||this.m_rTopoGraph.isBreakNode(h))}this.m_rTopoGraph.isHalfEdgeCurve(m)&&(this.m_rTopoGraph.querySegmentXY(m,i),this.m_rShape.setSegmentToIndex(this.m_rShape.getVertexIndex(g),i.get().clone())),l=a,u=!1}g=this.m_rShape.addVertex(s,l),r&&this.m_rTopoGraph.isBreakNode(this.m_rTopoGraph.getClusterFromVertex(l))&&this.m_rShape.setSegmentParentageBreakVertex(g,!0),this.m_rCutHandles.push(t),this.m_rShape.setGeometryUserIndex(t,this.m_sideIndex,n),t=D,s=D,n=32}}}function Ja(e,t,s){return new La(s).linesToPolygonsImpl(e,t)}function $a(t,s,n,r,i){if(r&&(r.m_reason=0,r.m_vertexIndex1=-1,r.m_vertexIndex2=-1),t.isEmpty())return 5;const h=t.getGeometryType();if(h===o.enumPoint)return rh(t,r);const m=Se(s,t,!1).total();if(h===o.enumEnvelope){const s=t,n=new e;return s.queryEnvelope(n),n.isDegenerate(m)?(r&&(r.m_reason=4,r.m_vertexIndex1=-1,r.m_vertexIndex2=-1),0):5}if(a(h)){const e=t,o=new I({vd:e.getDescription()});return o.addSegment(e,!0),th(o,s,n,r,i)}const g=[0],u=t.getImpl().getIsSimple(m,g);let c=n?-1:u;if(me(c)||0===c)return c;const _=new dh(t,s,c,i,!1);h===o.enumMultiPoint||h===o.enumPolyline||h===o.enumPolygon?c=_.isSimplePlanarImpl():l("");return t.getImpl().setIsSimple(c,m),r&&r.assign(_.m_nonSimpleResult),c}function eh(t,s,n,r,i){if(r&&(r.m_reason=0,r.m_vertexIndex1=-1,r.m_vertexIndex2=-1),t.isEmpty())return 5;const g=t.getGeometryType();if(g===o.enumPoint)return rh(t,r);const u=Se(s,t,!1).total();if(g===o.enumEnvelope){const s=t,n=new e;return s.queryEnvelope(n),n.isDegenerate(u)?(r&&(r.m_reason=4,r.m_vertexIndex1=-1,r.m_vertexIndex2=-1),0):5}if(a(g)){const e=t,o=new I({vd:e.getDescription()});return o.addSegment(e,!0),eh(o,s,n,r,i)}E(g),m(g)||h("OGC simplify is not implemented for this geometry type");const c=[0],_=t.getImpl().getIsSimple(u,c);let d=n?-1:_;if(5===d||0===d)return d;const p=new dh(t,s,d,i,!0);g===o.enumMultiPoint||g===o.enumPolyline||g===o.enumPolygon?(d=p.isSimplePlanarImpl(),me(d)&&(d=5)):l("");return t.getImpl().setIsSimple(d,u),r&&r.assign(p.m_nonSimpleResult),d}function th(t,s,n,r,i){if(r&&(r.m_reason=0,r.m_vertexIndex1=-1,r.m_vertexIndex2=-1),t.isEmpty())return 5;const h=t.getGeometryType();if(h===o.enumPoint)return rh(t,r);const m=Se(s,t,!1).total();if(h===o.enumEnvelope){const s=t,n=e.constructEmpty();return s.queryEnvelope(n),n.isDegenerate(m)?(r&&(r.m_reason=4,r.m_vertexIndex1=-1,r.m_vertexIndex2=-1),0):5}if(a(h)){const e=t,o=new I({vd:e.getDescription()});return o.addSegment(e,!0),th(o,s,n,r,i)}const g=[0],u=t.getImpl().getIsSimple(m,g);let c=n?-1:u;if(-1!==c)return c;const _=new dh(t,s,c,i,!1);return h===o.enumMultiPoint?c=_.multipointIsSimpleAsFeature():h===o.enumPolyline?c=_.polylineIsSimpleAsFeature():h===o.enumPolygon?c=_.polygonIsSimpleAsFeature():l(""),t.getImpl().setIsSimple(c,m),r&&r.assign(_.m_nonSimpleResult),c}function sh(t,s,n,r){if(t.isEmpty())return t;const i=t.getGeometryType();if(i===o.enumPoint){const e=new $t;if(rh(t,e),3===e.m_reason){const e=t.clone();return e.replaceNaNs(1,0),e}return 2===e.m_reason?t.createInstance():t}if(i===o.enumEnvelope){const n=Se(s,t,!0).total(),r=t,i=e.constructEmpty();return r.queryEnvelope(i),i.isDegenerate(n)?r.createInstance():t}if(a(i)){const e=t,i=new I({vd:e.getDescription()});return i.addSegment(e,!0),sh(i,s,n,r)}E(i);const h=Se(s,t,!1).total(),m=[0],g=t.getImpl().getIsSimple(h,m),u=n?-1:g;if(me(u)){if(i===o.enumPolygon&&0!==t.getFillRule()){const e=t.clone();return e.setFillRule(0),e}return t}if((i===o.enumMultiPoint||i===o.enumPolyline)&&u>=1)return t;const c=new dh(t,s,u,r,!1);let _;return i===o.enumMultiPoint?_=c.multipointSimplifyAsFeature():i===o.enumPolyline?_=c.polylineSimplifyAsFeature():i===o.enumPolygon?_=c.polygonSimplifyAsFeature():l(""),_}function nh(t,s,n,r){if(t.isEmpty())return t;const i=t.getGeometryType();if(i===o.enumPoint){const e=new $t;if(rh(t,e),3===e.m_reason){const e=t.clone();return e.replaceNaNs(1,0),e}return 2===e.m_reason?t.createInstance():t}if(i===o.enumEnvelope){const n=t,r=new e;n.queryEnvelope(r);const i=Se(s,t,!0).total();return r.isDegenerate(i)?n.createInstance():t}if(a(i)){const e=t,i=new I({vd:e.getDescription()});return i.addSegment(e,!0),nh(i,s,n,r)}E(i),m(i)||h("OGC simplify is not implemented for this geometry type");const l=Se(s,t,!1).total(),g=[0],u=t.getImpl().getIsSimple(l,g),c=n?-1:u;if(5===c){if(i===o.enumPolygon&&0!==t.getFillRule()){const e=t.clone();return e.setFillRule(0),e}return t}return Da(t,Se(s,t,!0),!1,c,r,0,!0)}function rh(e,t){const s=e.getX(),n=e.getY();if(!Number.isFinite(s)||!Number.isFinite(n))return t&&(t.m_reason=2,t.m_vertexIndex1=-1,t.m_vertexIndex2=-1),0;if(e.hasAttribute(1)){const s=e.getZ();if(!Number.isFinite(s))return t&&(t.m_reason=Number.isNaN(s)?3:2,t.m_vertexIndex1=-1,t.m_vertexIndex2=-1),0}return 5}class ih{constructor(){this.m_segment=null,this.m_vertexIndex=-1,this.m_pathIndex=-1,this.m_flags=0}setReversed(e){this.m_flags&=-2,this.m_flags=this.m_flags|(e?1:0)}getReversed(){return!!(1&this.m_flags)}getRightSide(){return this.getReversed()?0:1}}function oh(){return{x:-1,y:-1,ipath:-1,ivertex:-1,ipolygon:-1}}function ah(e,t,s,n,r){return{x:e,y:t,ipath:s,ivertex:n,ipolygon:r}}function hh(e,t){return e.x===t.x&&e.y===t.y&&e.ipath===t.ipath&&e.ivertex===t.ivertex&&e.ipolygon===t.ipolygon}function mh(e,t){e.x=t.x,e.y=t.y,e.ipath=t.ipath,e.ivertex=t.ivertex,e.ipolygon=t.ipolygon}function lh(){return{x:-1,y:-1,ipath:-1,ivertex:-1,bBoundary:!1,bEndPoint:!1}}function gh(e,t,s,n,r,i){return{x:e,y:t,ipath:s,ivertex:n,bBoundary:r,bEndPoint:i}}function uh(e,t){e.x=t.x,e.y=t.y,e.ipath=t.ipath,e.ivertex=t.ivertex,e.bBoundary=t.bBoundary,e.bEndPoint=t.bEndPoint}class ch extends Xe{constructor(e){super(),this.m_helper=e}compare(e,t,s){const n=e.getElement(s),r=this.m_helper.m_xy.read(2*t)-this.m_helper.m_xy.read(2*n);return r<0?-1:r>0?1:0}}class _h extends Xe{constructor(e){super(),this.m_helper=e}compare(e,t,s){const n=e.getElement(s),r=this.m_helper.m_edges[t],i=this.m_helper.m_edges[n],o=r.getReversed(),a=i.getReversed();let h=r.m_segment.intersectionOfYMonotonicWithAxisX(this.m_helper.m_yScanline,0),m=i.m_segment.intersectionOfYMonotonicWithAxisX(this.m_helper.m_yScanline,0);if(h===m){const e=o?r.m_segment.getStartY():r.m_segment.getEndY(),t=a?i.m_segment.getStartY():i.m_segment.getEndY(),s=Math.min(e,t);let n=.5*(s-this.m_helper.m_yScanline)+this.m_helper.m_yScanline;n===this.m_helper.m_yScanline&&(n=s),h=r.m_segment.intersectionOfYMonotonicWithAxisX(n,0),m=i.m_segment.intersectionOfYMonotonicWithAxisX(n,0)}return h<m?-1:h>m?1:0}}class dh{constructor(e,t,s,n,r){this.m_multiVertexGeom=null,this.m_edges=[],this.m_freeEdges=[],this.m_lineEdgesRecycle=[],this.m_newEdges=[],this.m_recycledSegIter=null,this.m_crossOverHelperList=new Ae,this.m_progressTracker=null,this.m_progressCounter=0,this.m_AET=new Te,this.m_xyToNode1=null,this.m_xyToNode2=null,this.m_pathOrientations=null,this.m_pathParentage=null,this.m_xy=null,this.m_pairs=[],this.m_pairIndices=null,this.m_pathsForOGCTests=[],this.m_curveStitcher=null,this.m_editShape=null,this.m_multiPathStitcher=null,this.m_nonSimpleResult=new $t,this.m_progressCounter=0,this.m_progressTracker=n,this.m_geometry=e,this.m_knownSimpleResult=s,this.m_sr=t;const i=Se(t,e,!1);this.m_toleranceIsSimple=i,this.m_toleranceIsSimpleClustering=ye(i),this.m_toleranceIsSimpleCracking=ke(i),this.m_toleranceSimplify=Se(t,e,!0),this.m_description=this.m_geometry.getDescription(),this.m_attributeCount=this.m_description.getAttributeCount(),this.m_bOGCRestrictions=r,this.m_bPlanarSimplify=this.m_bOGCRestrictions,this.m_unknownOrientationPathCount=-1,this.m_yScanline=0,this.m_progressCounter=0}isSimplePlanarImpl(){if(this.m_bPlanarSimplify=!0,!this.checkStructure())return 0;const e=this.m_geometry.getGeometryType();return c(e)&&!this.checkDegenerateSegments(!1)?0:this._CheckClustering()?c(e)?this._CheckCracking()?this.m_geometry.getGeometryType()===o.enumPolyline?this.checkSelfIntersectionsPolylinePlanar()?4:0:this._CheckSelfIntersections()?this._CheckValidRingOrientation():0:0:5:0}isSimplePlanarImpl3D(){return s(0),7}generateSortedPairs(e){let t=null;c(e.getGeometryType())&&(t=e);const s=(this.m_bPlanarSimplify||this.m_bOGCRestrictions)&&null!==t,n=e.getPointCount();this.m_xy=e.getAttributeStreamRef(0),this.m_pairs.length=0,this.m_pairIndices=new we(0),s&&(this.m_pathsForOGCTests.length=0);let r=0;for(let a=0;a<n;a++)if(this.m_pairs.push(2*a),this.m_pairs.push(2*a+1),this.m_pairIndices.add(2*a),this.m_pairIndices.add(2*a+1),s){for(;a>=t.getPathEnd(r);)r++;this.m_pathsForOGCTests.push(r)}const i=new Me,o={parent:this,workPt:new We,userSort(e,t,n){n.sort(e,t,((e,t)=>this.parent.compareVerticesForPlanarClustering(e,t,s)))},getValue(e){const t=this.parent.m_pairs[e],s=t>>1;this.parent.m_xy.queryPoint2D(2*s,this.workPt);return this.workPt.y+(1&t?this.parent.m_toleranceIsSimpleClustering:-this.parent.m_toleranceIsSimpleClustering)}};i.sort(this.m_pairIndices,0,2*n,o)}_TestToleranceDistancePlanar(e,t){const s=this.m_xy.read(2*e),n=this.m_xy.read(2*e+1),r=this.m_xy.read(2*t),i=this.m_xy.read(2*t+1);if(!!on(s,n,r,i,this.m_toleranceIsSimpleClustering*this.m_toleranceIsSimpleClustering)){if(0===this.m_geometry.getDimension())return!1;return s===r&&n===i}return!0}checkStructure(){const e=this.m_geometry.getGeometryType();if(c(e)){const e=this.m_geometry.getImpl(),t=this.m_geometry.getGeometryType()===o.enumPolygon?3:2;for(let s=0,n=e.getPathCount();s<n;s++)if(e.getPathSize(s)<t){if(e.hasNonLinearSegments()&&e.hasNonLinearSegmentsPath(s)&&e.getPathSize(s)>0)continue;return this.m_nonSimpleResult=new $t(1,s,0),!1}}if(m(e)){const e=this.m_geometry.getImpl(),t=e.getAttributeStreamRef(0);for(let s=0,n=e.getPointCount();s<n;s++){if(!t.readPoint2D(2*s).isFinite())return this.m_nonSimpleResult=new $t(2,s,0),!1}if(this.m_geometry.hasAttribute(1)){const t=e.getAttributeStreamRef(1);for(let s=0,n=e.getPointCount();s<n;s++){const e=t.read(s);if(!Number.isFinite(e))return Number.isNaN(e)?this.m_nonSimpleResult=new $t(3,s,0):this.m_nonSimpleResult=new $t(2,s,0),!1}}}return!0}checkDegenerateSegments(e){const t=this.m_geometry.getImpl(),s=t.querySegmentIterator(),n=t.hasAttribute(1),r=n?Ue(this.m_sr,t,!1).total():0,i=t.hasNonLinearSegments(),o=this.m_toleranceIsSimple.total();for(;s.nextPath();)for(;s.hasNextSegment();){const t=s.nextSegment();let a=t.calculateLowerLength2D();if(!(a>o)&&!(i&&t.isCurve()&&(a=t.calculateLength2D(),a>o))){if(e&&n){const e=t.getStartAttributeAsDbl(1,0),s=t.getEndAttributeAsDbl(1,0);if(Math.abs(s-e)>r)continue}return this.m_nonSimpleResult=new $t(4,s.getStartPointIndex(),-1),!1}}return!0}checkDegenerateSegments3D(){return s(0),!1}_CheckClustering(){const e=this.m_geometry.getImpl();this.generateSortedPairs(e);const t=e.getPointCount();this.m_AET.clear(),this.m_AET.setComparator(new ch(this)),this.m_AET.setCapacity(t);for(let s=0,n=2*t;s<n;s++){this.progress_();const e=this.m_pairIndices.read(s),t=this.m_pairs[e],n=t>>1;if(1&t){const e=this.m_AET.search(n),t=this.m_AET.getPrev(e),s=this.m_AET.getNext(e);if(this.m_AET.deleteNode(e),t!==Te.st_nullNode()&&s!==Te.st_nullNode()&&!this._TestToleranceDistancePlanar(this.m_AET.getElement(t),this.m_AET.getElement(s)))return this.m_nonSimpleResult=new $t(5,this.m_AET.getElement(t),this.m_AET.getElement(s)),!1}else{const e=this.m_AET.addElement(n),t=this.m_AET.getPrev(e);if(t!==Te.st_nullNode()&&!this._TestToleranceDistancePlanar(this.m_AET.getElement(t),n))return this.m_nonSimpleResult=new $t(5,n,this.m_AET.getElement(t)),!1;const s=this.m_AET.getNext(e);if(s!==Te.st_nullNode()&&!this._TestToleranceDistancePlanar(this.m_AET.getElement(s),n))return this.m_nonSimpleResult=new $t(5,n,this.m_AET.getElement(s)),!1}}return!0}_CheckCracking(){const e=this.m_geometry.getImpl(),t=e.getPointCount();return!e.hasNonLinearSegments()&&t<10?this._CheckCrackingBrute():this._CheckCrackingPlanesweep()}_CheckCrackingPlanesweep(){if(this.m_editShape=new T,this.m_editShape.addGeometry(this.m_geometry),this.m_editShape.hasCurves()){this.m_curveStitcher=new ua;const t=e.constructEmpty();this.m_geometry.queryEnvelope(t);const s=ma(this.m_toleranceSimplify.total(),t),n=new $t;if(oa(this.m_editShape,s,this.m_toleranceSimplify.total(),12e3,n,this.m_curveStitcher,null,this.m_progressTracker),0!==n.m_reason)return this.m_editShape=null,this.m_nonSimpleResult.assign(n),!1}const t=new $t;return Fn(!1,this.m_editShape,this.m_toleranceIsSimpleCracking,t,this.m_progressTracker)?(null!=this.m_curveStitcher?(t.m_vertexIndex1=this.m_curveStitcher.getOriginalVertexIndex(this.m_editShape,t.m_vertexIndex1),t.m_vertexIndex2=this.m_curveStitcher.getOriginalVertexIndex(this.m_editShape,t.m_vertexIndex2),this.m_curveStitcher=null):(t.m_vertexIndex1=this.m_editShape.getVertexIndex(t.m_vertexIndex1),t.m_vertexIndex2=this.m_editShape.getVertexIndex(t.m_vertexIndex2)),this.m_editShape=null,this.m_nonSimpleResult.assign(t),!1):(null==this.m_curveStitcher&&(this.m_editShape=null),!0)}_CheckCrackingBrute(){const e=this.m_geometry.getImpl(),t=e.querySegmentIterator(),s=e.querySegmentIterator();for(;t.nextPath();)for(;t.hasNextSegment();){const e=t.nextSegment();if(!t.isLastSegmentInPath()||!t.isLastPath()){s.resetTo(t);do{for(;s.hasNextSegment();){const n=s.nextSegment(),r=j(!0,e,n,this.m_toleranceIsSimpleCracking,!0);if(r){const e=2===r?7:6;return this.m_nonSimpleResult=new $t(e,t.getStartPointIndex(),s.getStartPointIndex()),!1}}}while(s.nextPath())}}return!0}_CheckSelfIntersections(){let e=this.m_geometry.getImpl();null!==this.m_curveStitcher&&(this.m_multiPathStitcher=this.m_editShape.getGeometry(this.m_editShape.getFirstGeometry()),e=this.m_multiPathStitcher.getImpl(),this.generateSortedPairs(e)),this.m_edges.length=0,this.m_lineEdgesRecycle.length=0,this.m_recycledSegIter=e.querySegmentIterator(),this.m_recycledSegIter.setCirculator(!0);const t=new Array(0),s=e.getPointCount();let n=Number.NaN,r=0;for(let i=0,o=2*s;i<o;i++){this.progress_();const e=this.m_pairIndices.read(i),s=this.m_pairs[e];if(1&s)continue;const o=s>>1,a=this.m_xy.read(2*o),h=this.m_xy.read(2*o+1);if(t.length&&(a!==n||h!==r)){if(!this.processBunchForSelfIntersectionTest(t))return!1;t.length=0}t.push(o),n=a,r=h}return!!this.processBunchForSelfIntersectionTest(t)}checkSelfIntersectionsPolylinePlanar(){const e=this.m_geometry.getImpl(),t=[];for(let o=0,a=e.getPathCount();o<a;o++)t.push(e.isClosedPathInXYPlane(o));const s=lh();let n,r,i;{const o=this.m_pairIndices.read(0),a=this.m_pairs[o]>>1,h=this.m_xy.readPoint2D(2*a),m=this.m_pathsForOGCTests[a];n=t[m],r=e.getPathStart(m),i=e.getPathEnd(m)-1,s.bEndPoint=a===r||a===i,this.m_bOGCRestrictions?s.bBoundary=!n&&s.bEndPoint:s.bBoundary=s.bEndPoint,s.ipath=m,s.x=h.x,s.y=h.y,s.ivertex=a}for(let o=1,a=this.m_pairIndices.size();o<a;o++){const a=this.m_pairIndices.read(o),h=this.m_pairs[a];if(1&h)continue;const m=h>>1,l=this.m_xy.readPoint2D(2*m),g=this.m_pathsForOGCTests[m];let u;g!==s.ipath&&(n=t[g],r=e.getPathStart(g),i=e.getPathEnd(g)-1);const c=m===r||m===i;u=this.m_bOGCRestrictions?!n&&c:c;const _=gh(l.x,l.y,g,m,u,c);if(_.x===s.x&&_.y===s.y)if(this.m_bOGCRestrictions){if(!(_.bBoundary&&s.bBoundary||_.ipath===s.ipath&&_.bEndPoint&&s.bEndPoint))return this.m_nonSimpleResult=new $t(10,_.ivertex,s.ivertex),!1}else if(!_.bEndPoint||!s.bEndPoint)return this.m_nonSimpleResult=new $t(7,_.ivertex,s.ivertex),!1;uh(s,_)}return!0}checkSelfIntersectionsPolylinePlanar3D(e){return s(0),!1}checkSelfIntersectionsPolygonsOGC(){const e=this.m_geometry.getImpl(),t=[];let s=-1,n=!1;for(let l=0,g=e.getPathCount();l<g;l++)e.isExteriorRingOGC(l)&&(n=!1,s++,l<g-1&&(e.isExteriorRingOGC(l+1)||(n=!0))),t.push(n?s:-1);const r=oh();{const e=this.m_pairIndices.read(0),s=this.m_pairs[e]>>1,n=this.m_xy.readPoint2D(2*s),i=this.m_pathsForOGCTests[s];r.ipath=i,r.x=n.x,r.y=n.y,r.ivertex=s,r.ipolygon=t[i]}const i=[];for(let l=1,g=this.m_pairIndices.size();l<g;l++){const e=this.m_pairIndices.read(l),s=this.m_pairs[e];if(1&s)continue;const n=s>>1,o=this.m_xy.readPoint2D(2*n),a=this.m_pathsForOGCTests[n],h=ah(o.x,o.y,a,n,t[a]);if(h.x===r.x&&h.y===r.y){if(h.ipath===r.ipath)return this.m_nonSimpleResult=new $t(11,h.ivertex,r.ivertex),!1;t[h.ipath]>=0&&t[h.ipath]===t[r.ipath]&&(0!==i.length&&hh(i.at(-1),r)||i.push({...r}),i.push(h))}mh(r,h)}if(0===i.length)return!0;const o=new Ae(!0);t.fill(-1);let a=-1;const h=new We;for(let l=0,g=i.length;l<g;l++){const e=i[l];e.x===h.x&&e.y===h.y||(a=o.createList(0),h.x=e.x,h.y=e.y);let s=t[e.ipath];-1===s&&(s=o.createList(2),t[e.ipath]=s),o.addElement(s,a),o.addElement(a,s)}const m=[];for(let l=o.getFirstList();-1!==l;l=o.getNextList(l)){const e=o.getListData(l);if(1&e||!(2&e))continue;let s=-1;for(m.push(l),m.push(-1);m.length;){const e=m.at(-1);m.pop();const t=m.at(-1);m.pop();const n=o.getListData(t);if(1&n){s=2&n?t:e;break}o.setListData(t,1|n);for(let s=o.getFirst(t);-1!==s;s=o.getNext(s)){const n=o.getData(s);n!==e&&(m.push(n),m.push(t))}}if(-1!==s){const e=t.indexOf(s);return this.m_nonSimpleResult=new $t(12,e,-1),!1}}return!0}_CheckValidRingOrientation(){const e=null!==this.m_multiPathStitcher?this.m_multiPathStitcher.getImpl():this.m_geometry.getImpl();if(e.calculateArea2D()<=0)return this.m_nonSimpleResult=new $t(8,1===e.getPathCount()?1:-1,-1),0;if(1===e.getPathCount())return this.m_bOGCRestrictions&&!this.checkSelfIntersectionsPolygonsOGC()?0:4;this.m_pathOrientations=new qe(e.getPathCount(),0),this.m_pathParentage=new we(e.getPathCount(),-1);let t=-1,s=0;for(let i=0,o=e.getPathCount();i<o;i++){const n=e.calculateRingArea2D(i);if(this.m_pathOrientations.write(i,n<0?0:8),n>0)t=i,s=n;else{if(0===n)return this.m_nonSimpleResult=new $t(8,i,-1),0;if((t<0||s<Math.abs(n))&&(this.m_nonSimpleResult=new $t(9,i,-1),this.m_bOGCRestrictions))return 0;this.m_pathParentage.write(i,t)}}this.m_unknownOrientationPathCount=e.getPathCount(),this.m_newEdges.length=0;const n=e.getPointCount();this.m_yScanline=Number.NaN;const r=[];this.m_xyToNode1=new we(n,Te.st_nullNode()),this.m_xyToNode2=new we(n,Te.st_nullNode()),this.m_freeEdges.length=0,this.m_AET.clear(),this.m_AET.setComparator(new _h(this));for(let i=0,o=2*n;this.m_unknownOrientationPathCount>0&&i<o;i++){const e=this.m_pairIndices.read(i),t=this.m_pairs[e];if(1&t)continue;const s=t>>1,n=this.m_xy.read(2*s+1);if(n!==this.m_yScanline&&r.length){if(!this.processBunchForRingOrientationTest(r))return 0;r.length=0}r.push(s),this.m_yScanline=n}return this.m_unknownOrientationPathCount>0&&!this.processBunchForRingOrientationTest(r)?0:this.m_bOGCRestrictions?0!==this.m_nonSimpleResult.m_reason?0:this.checkSelfIntersectionsPolygonsOGC()?5:0:0===this.m_nonSimpleResult.m_reason?4:3}processBunchForSelfIntersectionTest(e){if(1===e.length)return!0;for(let o=0,a=e.length;o<a;o++){const t=e[o];this.m_recycledSegIter.resetToVertex(t,-1);const s=this.m_recycledSegIter.previousSegment();this.m_edges.push(this.createEdge(s,t,this.m_recycledSegIter.getPathIndex(),!0)),this.m_recycledSegIter.nextSegment();const n=this.m_recycledSegIter.nextSegment();this.m_edges.push(this.createEdge(n,t,this.m_recycledSegIter.getPathIndex(),!1))}this.m_edges.sort(((e,t)=>this.edgeAngleCompare(e,t)));let t=this.m_crossOverHelperList.getFirstList();-1===t&&(t=this.m_crossOverHelperList.createList(0)),this.m_crossOverHelperList.reserveNodes(this.m_edges.length);for(let o=0,a=this.m_edges.length;o<a;o++)this.m_crossOverHelperList.addElement(t,o);let s=!0,n=-1,r=-1;for(;s;){s=!1;let e=this.m_crossOverHelperList.getFirst(t);if(-1===e)break;let i=this.m_crossOverHelperList.getNext(e);for(;-1!==i;){const o=this.m_crossOverHelperList.getData(e),a=this.m_crossOverHelperList.getData(i);if(n=this.m_edges[o].m_vertexIndex,r=this.m_edges[a].m_vertexIndex,n!==r)e=i,i=this.m_crossOverHelperList.getNext(e);else if(s=!0,this.m_crossOverHelperList.deleteElement(t,e),e=this.m_crossOverHelperList.getPrev(i),i=this.m_crossOverHelperList.deleteElement(t,i),-1===i||-1===e)break}}const i=this.m_crossOverHelperList.getListSize(t);if(this.m_crossOverHelperList.clear(t),i>0)return this.m_nonSimpleResult=new $t(7,n,r),!1;for(let o=0,a=e.length;o<a;o++)this.recycleEdge(this.m_edges[o]);return this.m_edges.length=0,!0}processBunchForRingOrientationTest(e){for(let t=0,s=e.length;t<s;t++){const s=e[t];let n=this.m_xyToNode1.read(s);if(n!==Te.st_nullNode()){const e=this.m_AET.getElement(n);this.m_freeEdges.push(e),this.m_AET.deleteNode(n),this.recycleEdge(this.m_edges[e]),this.m_edges[e]=null,this.m_xyToNode1.write(s,Te.st_nullNode())}if(n=this.m_xyToNode2.read(s),n!==Te.st_nullNode()){const e=this.m_AET.getElement(n);this.m_freeEdges.push(e),this.m_AET.deleteNode(n),this.recycleEdge(this.m_edges[e]),this.m_edges[e]=null,this.m_xyToNode2.write(s,Te.st_nullNode())}}for(let t=0,s=e.length;t<s;t++){const s=e[t];this.m_recycledSegIter.resetToVertex(s,-1);const n=this.m_recycledSegIter.previousSegment();if(n.getStartY()>n.getEndY()){const e=this.m_recycledSegIter.getStartPointIndex(),t=this.createEdge(n,s,this.m_recycledSegIter.getPathIndex(),!0);let r;this.m_freeEdges.length>0?(r=this.m_freeEdges.at(-1),this.m_freeEdges.pop(),this.m_edges[r]=t):(r=this.m_edges.length,this.m_edges.push(t));const i=this.m_AET.addElement(r);this.m_xyToNode1.read(e)===Te.st_nullNode()?this.m_xyToNode1.write(e,i):this.m_xyToNode2.write(e,i),3&this.m_pathOrientations.read(this.m_recycledSegIter.getPathIndex())||this.m_newEdges.push(i)}this.m_recycledSegIter.nextSegment();const r=this.m_recycledSegIter.nextSegment();if(r.getStartY()<r.getEndY()){const e=this.m_recycledSegIter.getEndPointIndex(),t=this.createEdge(r,s,this.m_recycledSegIter.getPathIndex(),!1);let n;this.m_freeEdges.length>0?(n=this.m_freeEdges.at(-1),this.m_freeEdges.pop(),this.m_edges[n]=t):(n=this.m_edges.length,this.m_edges.push(t));const i=this.m_AET.addElement(n);this.m_xyToNode1.read(e)===Te.st_nullNode()?this.m_xyToNode1.write(e,i):this.m_xyToNode2.write(e,i),3&this.m_pathOrientations.read(this.m_recycledSegIter.getPathIndex())||this.m_newEdges.push(i)}}for(let t=0,s=this.m_newEdges.length;t<s&&this.m_unknownOrientationPathCount>0;t++){const e=this.m_newEdges[t],s=this.m_AET.getElement(e),n=this.m_edges[s].m_pathIndex;if(!(3&this.m_pathOrientations.read(n))){let t=-1,s=this.m_AET.getPrev(e),n=e,r=0;{let e=-1,i=null,o=-1,a=0;for(;s!==Te.st_nullNode()&&(e=this.m_AET.getElement(s),i=this.m_edges[e],o=i.m_pathIndex,a=this.m_pathOrientations.read(o),!(3&a));)n=s,s=this.m_AET.getPrev(s);s===Te.st_nullNode()?(r=1,s=n):(t=1==(3&a)?o:this.m_pathParentage.read(o),r=i.getRightSide()?0:1,s=this.m_AET.getNext(s))}do{const e=this.m_AET.getElement(s),i=this.m_edges[e],o=i.m_pathIndex;let a=this.m_pathOrientations.read(o);if(!(3&a)){if(r!==i.getRightSide())return this.m_nonSimpleResult=new $t(8,o,-1),!1;const e=r&&!i.getReversed()?1:2;if(a=-4&a|e,this.m_pathOrientations.write(o,a),2===e&&0===this.m_nonSimpleResult.m_reason){const e=this.m_pathParentage.read(o);if(e!==t&&(this.m_nonSimpleResult=new $t(9,o,e),this.m_bOGCRestrictions))return!1}if(this.m_unknownOrientationPathCount--,!this.m_unknownOrientationPathCount)return!0}t=1==(3&a)?o:this.m_pathParentage.read(o),n=s,s=this.m_AET.getNext(s),r=r?0:1}while(n!==e)}}return this.m_newEdges.length=0,!0}createEdge(e,t,s,n){let r;return e.getGeometryType()===o.enumLine?r=this.createEdgeLine(e):(r=new ih,r.m_segment=e.clone()),r.m_vertexIndex=t,r.m_pathIndex=s,r.m_flags=0,r.setReversed(n),r}createEdgeLine(e){let t;return this.m_lineEdgesRecycle.length>0?(t=this.m_lineEdgesRecycle.at(-1),this.m_lineEdgesRecycle.pop(),e.copyTo(t.m_segment)):(t=new ih,t.m_segment=e.clone()),t}recycleEdge(e){e.m_segment.getGeometryType()===o.enumLine&&this.m_lineEdgesRecycle.push(e)}static isShortSegment(e,t,s,n){let r=e.calculateLowerLength2D();if(r<=s){let i=!0;if(e.isCurve()&&(r=e.calculateLength2D(),i=r<=s),i){if(t){let t=e.getEndAttributeAsDbl(1,0);Number.isNaN(t)&&(t=0);let s=e.getStartAttributeAsDbl(1,0);return Number.isNaN(s)&&(s=0),Math.abs(s-t)<=n}return!0}return!1}return!1}static isShortSegmentPoints(e,t,s,n,r){if(s){const s=e.getXYZ(),i=t.getXYZ();return Oe(s,i,n,r)}{const s=e.getXY(),r=t.getXY();return We.sqrDistance(s,r)<=n*n}}removeDegenerateSegmentsFromCurvedPath(e,t,n,r){const i=e.hasAttribute(1),o=e.querySegmentIterator();o.resetToPath(t),s(o.nextPath());const a=this.m_toleranceSimplify.total();let h=!1,m=!0;const l=new ae,g=new ae,u=new We;for(;o.hasNextSegment();){this.progress_();const e=o.nextSegment();if(dh.isShortSegment(e,i,a,n))if(h){if(e.queryEnd(g),dh.isShortSegmentPoints(l,g,i,a,n))continue;m&&(r.startPathPoint(l),m=!1),e.queryEnd(l),r.lineToPoint(l),h=!1}else u.assign(e.getStartXY()),e.queryStart(l),h=!0;else if(h)if(e.isCurve()){const t=e.clone();if(t.setCoordsForIntersector(u,e.getEndXY(),!1),t.setStart(l),dh.isShortSegment(t,i,a,n))continue;r.addSegment(t,m),m=!1,h=!1}else{if(e.queryEnd(g),dh.isShortSegmentPoints(l,g,i,a,n))continue;m&&(r.startPathPoint(l),m=!1),r.lineToPoint(g),h=!1}else r.addSegment(e,m),m=!1}if(m)return;if(!h)return;e.isClosedPath(t)?e.getPointByVal(e.getPathStart(t),l):e.getPointByVal(e.getPathEnd(t)-1,l);const c=r.querySegmentIterator();c.resetToLastPath(),c.resetToLastSegment();const _=r.getDescription().getAttributeCount()>1;for(s(c.previousPath());c.hasPreviousSegment();){const e=c.previousSegment();if(e.isCurve()){const t=e.clone();if(t.setCoordsForIntersector(e.getStartXY(),l.getXY(),!1),!dh.isShortSegment(t,i,a,n)){_&&t.setEnd(l);const e=c.getEndPointIndex();for(let t=r.getPointCount()-1;t>=e;t--)r.removePoint(t);return void r.addSegment(t,!1)}}else if(e.queryStart(g),!dh.isShortSegmentPoints(g,l,i,a,n)){const e=c.getEndPointIndex();for(let t=r.getPointCount()-1;t>=e;t--)r.removePoint(t);return void r.lineToPoint(l)}}r.removePath(r.getPathCount()-1)}multipointIsSimpleAsFeature(){if(!this.checkStructure())return 0;const e=this.m_geometry.getImpl();this.m_multiVertexGeom=e;const t=e.getPointCount(),s=new Array(t);for(let n=0;n<t;n++)s[n]=n;s.sort(((e,t)=>this.compareVerticesMultiPoint(e,t)));for(let n=1;n<t;n++)if(0===this.compareVerticesMultiPoint(s[n-1],s[n]))return this.m_nonSimpleResult=new $t(5,s[n-1],s[n]),0;return 1}polylineIsSimpleAsFeature(){return this.checkStructure()&&this.checkDegenerateSegments(!0)?1:0}polygonIsSimpleAsFeature(){return this.isSimplePlanarImpl()}multipointSimplifyAsFeature(){let e=this.m_geometry.getImpl();const t=dh.hasNanZs(e);let s,n=this.m_geometry;t&&(s=this.m_geometry.clone(),e=s.getImpl(),s.replaceNaNs(1,Be.getDefaultValue(1)),n=s),this.m_multiVertexGeom=e;const r=e.getPointCount(),i=new Array(r);for(let g=0;g<r;g++)i[g]=g;i.sort(((e,t)=>this.compareVerticesMultiPoint(e,t)));const o=new Array(r);o.fill(!1);let a=-1;for(let g=0;g<r;g++){const t=i[g];e.getXY(t).isFinite()&&((a<0||0!==this.compareVerticesMultiPoint(a,t))&&(o[t]=!0),a=t)}const h=this.m_geometry.createInstance();let m=0,l=0;for(let g=0;g<r;g++)o[g]?l=g+1:(m<l&&h.addPoints(n,m,l),m=g+1);return m<l&&h.addPoints(n,m,l),h.getImpl().setIsSimple(1,this.m_toleranceSimplify.total()),h}polylineSimplifyAsFeature(){const e=this.m_geometry.getImpl(),t=e.querySegmentIterator(),s=e.querySegmentIterator(),n=this.m_geometry.createInstance(),r=this.m_geometry,i=e.hasAttribute(1),o=i?Ue(this.m_sr,e,!0).total():0,a=[],h=[];let m=null;i&&(m=e.getAttributeStreamRef(1));const l=new ae,g=e.hasNonLinearSegments(),u=this.m_toleranceSimplify.total();for(;t.nextPath();){if(s.nextPath(),e.getPathSize(t.getPathIndex())<2)continue;if(g&&e.hasNonLinearSegmentsPath(t.getPathIndex())){this.removeDegenerateSegmentsFromCurvedPath(e,t.getPathIndex(),o,n);continue}s.resetToLastSegment();let c=0,_=0,d=!0,p=!0;for(;t.hasNextSegment();){this.progress_();const n=t.nextSegment(),r=s.previousSegment();if(t.getStartPointIndex()>s.getStartPointIndex())break;if(d){const s=t.getStartPointIndex();e.getXY(s).isNAN()||(d=!1,a.push(s))}if(p){const t=s.getEndPointIndex();e.getXY(t).isNAN()||(h.push(t),p=!1)}if(!d){const s=a.at(-1),r=t.getEndPointIndex();if(r-s>1){const t=new We;t.setSub(e.getXY(s),e.getXY(r)),c=t.length()}else c=n.calculateLength2D();if(c>u)a.push(r),c=0;else if(i){let e=m.read(s);Number.isNaN(e)&&(e=0);let t=m.read(r);Number.isNaN(t)&&(t=0),Math.abs(t-e)>o&&(a.push(r),c=0)}}if(!p){const t=h.at(-1),n=s.getStartPointIndex();if(n-t>1){const s=new We;s.setSub(e.getXY(t),e.getXY(n)),_=s.length()}else _=r.calculateLength2D();if(_>u)h.push(n),_=0;else if(i){let e=m.read(t);Number.isNaN(e)&&(e=0);let s=m.read(n);Number.isNaN(s)&&(s=0),Math.abs(s-e)>o&&(h.push(n),_=0)}}}if(a.length>0&&h.length>0&&(a.at(-1)<h.at(-1)?a.length>h.length?a.pop():h.pop():(a.at(-1)===h.at(-1)||h.pop(),h.pop())),h.length+a.length>=2){let e=!1;for(let t=0,s=a.length;t<s;t++)r.getPointByVal(a[t],l),e?n.lineToPoint(l):(n.startPathPoint(l),e=!0);for(let t=h.length-1;t>0;t--)r.getPointByVal(h[t],l),e?n.lineToPoint(l):(n.startPathPoint(l),e=!0);r.isClosedPath(t.getPathIndex())?n.closePathWithLine():h.length>0&&(r.getPointByVal(h[0],l),n.lineToPoint(l))}a.length=0,h.length=0}return i&&n.replaceNaNs(1,0),n.getImpl().setIsSimple(1,u),n}polygonSimplifyAsFeature(){return this.simplifyPlanar()}simplifyPlanar(){if(1===this.m_geometry.getFillRule()&&!_e(this.m_knownSimpleResult))return Va(this.m_geometry,this.m_toleranceSimplify,!0,!1,this.m_knownSimpleResult,this.m_progressTracker,0,!0);const t=new T;if(t.addGeometry(this.m_geometry),this.m_geometry.hasAttribute(1)&&t.replaceNaNs(1,0),t.removeNaNVertices(),0!==t.getTotalPointCount()){let s=null,n=0,r=0;if(t.hasCurves()){s=new ua;const i=e.constructEmpty();this.m_geometry.queryEnvelope(i);const o=ma(this.m_toleranceSimplify.total(),i);n=la(this.m_toleranceSimplify.total()),r=ga(o,n),na(t,o,this.m_toleranceSimplify.total(),12e3,s,null,this.m_progressTracker)}if(!_e(this.m_knownSimpleResult)){_a(t,this.m_toleranceSimplify.add(r),this.m_progressTracker,!0,!1)}this.m_geometry.getGeometryType()===o.enumPolygon&&Kn(t,t.getFirstGeometry(),this.m_knownSimpleResult,!1,-1,this.m_progressTracker),null!==s&&s.stitchCurves(t,t.getFirstGeometry(),n,!0)}const s=t.getGeometry(t.getFirstGeometry());return s.getGeometryType()===o.enumPolygon&&(s.getImpl().updateOGCFlagsProtected(),s.setFillRule(0)),s.getImpl().setIsSimple(4,this.m_toleranceSimplify.total()),s}progress_(){}static hasNanZs(e){if(e.hasAttribute(1)){const t=e.getAttributeStreamRef(1);for(let s=0,n=e.getPointCount();s<n;s++){const e=t.read(s);if(Number.isNaN(e))return!0}}return!1}compareVerticesForPlanarClustering(e,t,s){if(e===t)return 0;const n=this.m_pairs[e],r=this.m_pairs[t],i=n>>1,o=r>>1,a=this.m_xy.readPoint2D(2*i);a.y+=1&n?this.m_toleranceIsSimpleClustering:-this.m_toleranceIsSimpleClustering;const h=this.m_xy.readPoint2D(2*o);h.y+=1&r?this.m_toleranceIsSimpleClustering:-this.m_toleranceIsSimpleClustering;const m=a.compare(h);if(0===m&&s){const e=this.m_pathsForOGCTests[i]-this.m_pathsForOGCTests[o];return Qe(e)}return m}compareVerticesMultiPoint(e,t){if(e===t)return 0;const s=this.m_multiVertexGeom.getXY(e),n=this.m_multiVertexGeom.getXY(t),r=!s.isFinite(),i=!n.isFinite();if(r||i)return r<i?-1:r>i?1:0;if(s.y<n.y)return-1;if(s.y>n.y)return 1;if(s.x<n.x)return-1;if(s.x>n.x)return 1;for(let o=1;o<this.m_attributeCount;o++){const s=this.m_description.getSemantics(o),n=Be.getComponentCount(s);for(let r=0;r<n;r++){const n=this.m_multiVertexGeom.getAttributeAsDbl(s,e,r),i=this.m_multiVertexGeom.getAttributeAsDbl(s,t,r),o=vt(n,i);if(0!==o)return o}}return 0}edgeAngleCompare(e,t){if(e===t)return 0;const s=e.m_segment.getTangent(e.getReversed()?1:0);e.getReversed()&&s.negateThis();const n=t.m_segment.getTangent(t.getReversed()?1:0);t.getReversed()&&n.negateThis();const r=s.getQuarter(),i=n.getQuarter();if(i===r){const e=s.crossProduct(n);return e<0?1:e>0?-1:0}return r<i?-1:1}}class ph{getOperatorType(){return 10103}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}isSimpleAsFeature(e,t,s,n,r){const i=th(e,t,s,n,r);return Ee(e.getGeometryType(),i)}isSimplePlanarDONOTUSE(e,t,s,n,r){const i=$a(e,t,s,n,r);return me(i)}executeMany(e,t,s,n){return new fh(e,t,s,n)}execute(e,t,s,n){const r=new Kt([e]),i=this.executeMany(r,t,s,n).next();return i||l("null geometry"),i}}class fh extends Zt{constructor(e,t,s,n){super(),this.m_progressTracker=n,this.m_bForceSimplify=s,this.m_index=-1,this.m_inputGeometryCursor=e,this.m_spatialReference=t}next(){const e=this.m_inputGeometryCursor.next();return e?(this.m_index=this.m_inputGeometryCursor.getGeometryID(),this.simplify(e)):null}getGeometryID(){return this.m_index}tock(){return!1}getRank(){return 1}simplify(e){if(e||t(""),e.getGeometryType()===o.enumGeometryCollection){const t=B(e,-1),s=(new ph).executeMany(t,this.m_spatialReference,this.m_bForceSimplify,this.m_progressTracker),n=e.createInstance();for(let e=s.next();null!=e;e=s.next())n.addGeometry(e);return n}return sh(e,this.m_spatialReference,this.m_bForceSimplify,this.m_progressTracker)}}function xh(t,s,n){const r=new e;t.queryEnvelope(r);const i=new e;s.queryEnvelope(i);const a=new e(i);if(a.inflate(2*n),!a.isIntersecting(r))return 4;const h=t.getGeometryType(),m=s.getGeometryType();if(h===o.enumEnvelope&&r.containsEnvelope(a))return 1;if(m===o.enumEnvelope){const t=new e(r);if(t.inflate(2*n),i.containsEnvelope(t))return 2}return 0}class yh{constructor(e,t,s,n){this.m_intersectorGeom=null,this.m_sr=null,this.m_dimensionMask=-1,this.m_progressTracker=null,this.m_intersectorGeomType=o.enumUnknown,this.m_geomIntersectorEmptyGeom=null,this.m_intersectorGeom=e,this.m_sr=t,this.m_dimensionMask=s,this.m_progressTracker=n,this.m_intersectorGeomType=e.getGeometryType()}intersect(t){const s=this.tryFastImplementation(t);if(null!==s)return s;const n=Re(this.m_intersectorGeom,t),r=pe(this.m_sr,n,!0).total(),i=e.constructEmpty();this.m_intersectorGeom.queryEnvelope(i);const o=e.constructEmpty();t.queryEnvelope(o),i.inflateCoords(2*r,2*r),i.intersect(o),i.inflateCoords(100*r,100*r);const a=0;let h=Lt(this.m_intersectorGeom,i,a,0,this.m_progressTracker),m=Lt(t,i,a,0,this.m_progressTracker);return t.getDimension()>this.m_intersectorGeom.getDimension()&&(h=gt(m,m=h)),Ba(m,h,this.m_sr,this.m_progressTracker)}intersectEx(t){const s=this.tryFastImplementation(t);if(null!==s){const e=[];return e.length=3,e[s.getDimension()]=s,this.prepareVector(t.getDescription(),this.m_dimensionMask,e)}const n=Re(this.m_intersectorGeom,t),r=pe(this.m_sr,n,!0).total(),i=e.constructEmpty();this.m_intersectorGeom.queryEnvelope(i);const o=e.constructEmpty();t.queryEnvelope(o),i.inflateCoords(2*r,2*r),i.intersect(o),i.inflateCoords(100*r,100*r);const a=0;let h=Lt(this.m_intersectorGeom,i,a,0,this.m_progressTracker),m=Lt(t,i,a,0,this.m_progressTracker);t.getDimension()>this.m_intersectorGeom.getDimension()&&(h=gt(m,m=h));const l=Ra(m,h,this.m_sr,this.m_progressTracker);return this.prepareVector(t.getDescription(),this.m_dimensionMask,l)}init(e,t,n,r=null){s(0)}static intersectPoints(e,t,s){const n=Re(e,t);return Oa(e,t,pe(s,n,!0))}tryFastImplementation(t){const s=t.getGeometryType();if(this.m_intersectorGeomType===o.enumPoint&&s===o.enumPoint){const e=yh.intersectPoints(t,this.m_intersectorGeom,this.m_sr);if(-1!==this.m_dimensionMask){const t=new w({vd:e.getDescription()});return e.isEmpty()||t.add(e),t}return e}if(s===o.enumEnvelope&&this.m_intersectorGeomType===o.enumEnvelope&&(-1===this.m_dimensionMask||4===this.m_dimensionMask)){const e=t,s=this.m_intersectorGeom,n=new ge({copy:e});return n.intersect(s),n}const n=Re(t,this.m_intersectorGeom),r=pe(this.m_sr,n,!0),i=t.isEmpty(),a=this.m_intersectorGeom.isEmpty();let h=i||a;if(!h){const e=xh(this.m_intersectorGeom,t,r.total());if(4===e)h=!0;else{if(2&e)return this.m_intersectorGeom;if(1&e)return t}}if(h){const e=y(s),n=y(this.m_intersectorGeomType);return e<n?yh.ReturnEmpty(t,i):e>n||0===e&&s===o.enumMultiPoint&&this.m_intersectorGeomType===o.enumPoint?this.ReturnEmptyIntersector():yh.ReturnEmpty(t,i)}if(s===o.enumEnvelope&&0===y(this.m_intersectorGeomType)||this.m_intersectorGeomType===o.enumEnvelope&&0===y(s)){const n=s===o.enumEnvelope?t:this.m_intersectorGeom,i=s===o.enumEnvelope?this.m_intersectorGeom:t,a=e.constructEmpty();return n.queryEnvelope(a),Lt(i,a,r.total(),0,this.m_progressTracker)}if(0===y(s)&&y(this.m_intersectorGeomType)>0||y(s)>0&&0===y(this.m_intersectorGeomType)){if(s===o.enumMultiPoint)return Aa(t,this.m_intersectorGeom,r);if(s===o.enumPoint)return qa(t,this.m_intersectorGeom,r);if(this.m_intersectorGeomType===o.enumMultiPoint)return Aa(this.m_intersectorGeom,t,r);if(this.m_intersectorGeomType===o.enumPoint)return qa(this.m_intersectorGeom,t,r);l("")}return null}ReturnEmptyIntersector(){return null===this.m_geomIntersectorEmptyGeom&&(this.m_geomIntersectorEmptyGeom=this.m_intersectorGeom.createInstance()),this.m_geomIntersectorEmptyGeom}static ReturnEmpty(e,t){return t?e:e.createInstance()}prepareVector(e,t,s){let n=0;return 1&t?(s[0]||(s[0]=new w({vd:e})),n++):s.shift(),2&t?(s[n]||(s[n]=new I({vd:e})),n++):s.splice(n,1),4&t?s[n]||(s[n]=new C({vd:e})):s.splice(n,1),new Kt(s)}}class Ph extends Zt{constructor(e,s,n,r,i){super(),this.m_smallCursor=null,this.m_progressTracker=r,this.m_geomIntersector=s.next(),this.m_intersector=new yh(this.m_geomIntersector,n,i,r),this.m_index=-1,this.m_inputGeoms=e,this.m_dimensionMask=i,-1!==this.m_dimensionMask&&(this.m_dimensionMask<=0||this.m_dimensionMask>7)&&t("bad dimension mask")}next(){if(!this.m_geomIntersector)return null;let e;if(null!==this.m_smallCursor){if(e=this.m_smallCursor.next(),e)return e;this.m_smallCursor=null}for(;e=this.m_inputGeoms.next();){if(r(e),this.m_index=this.m_inputGeoms.getGeometryID(),-1===this.m_dimensionMask){return this.m_intersector.intersect(e)}this.m_smallCursor=this.m_intersector.intersectEx(e);return this.m_smallCursor.next()}return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}}class Eh{getOperatorType(){return 1e4}accelerateGeometry(e,t,s){if(!this.canAccelerateGeometry(e))return!1;Se(t,e,!0);let n=0;return e.getGeometryType()!==o.enumPolygon&&e.getGeometryType()!==o.enumPolyline||!R(e)||0===s||(n|=e.getImpl().buildQuadTreeAccelerator(s)?1:0),!!n}canAccelerateGeometry(e){return R(e)}supportsCurves(){return!0}executeMany(e,t,s,n,r=-1){return new Ph(e,t,s,n,r)}execute(e,t,s,n){if(e.getGeometryType()===o.enumPoint&&t.getGeometryType()===o.enumPoint)return yh.intersectPoints(e,t,s);const r=new Kt([e]),i=new Kt([t]),a=this.executeMany(r,i,s,n,-1).next();return a||l("null output"),a}}function Sh(e,t,s){return t.m_projector.project(e,s)}function Ch(e,t,s,n,r){e.m_projector.transformInPlaceZ(t,null,s,n,null,r);const i=n.slice(0,s).filter((e=>!e.isNAN()));for(let o=0,a=i.length;o<a;++o)n[o].assign(i[o]);return i.length}function Ih(e,t,s,n,r){return e.m_projector.transformInPlaceZ(t,null,s,n,null,r)}function bh(s,n,r,i){if(s&&n&&n.isPannable()||t("fold_into_360_range_geodetic"),s.isEmpty())return s;if(4===r)return wh(s,n,i);let h=s;const m=h.getGeometryType();if(c(m)){h=Gl(s,n);const t=new e;h.queryEnvelope(t);const i=pe(n,t,!1).total(),o=n.getPannableExtent();let a=Math.floor((t.xmin-o.xmin)/o.width())*o.width()+o.xmin,m=h;for(;a<t.xmax;)a>t.xmin+i&&a<t.xmax-i&&(m=Tl(m,n,r,!0,a)),a+=o.width();h=m}else{if(m===o.enumEnvelope){const e=new C({vd:h.getDescription()});return e.addEnvelope(h,!1),bh(e,n,r,i)}if(a(m)){const e=new I({vd:h.getDescription()});return e.addSegment(h,!0),bh(e,n,r,i)}}return wh(h,n,i)}function wh(e,s,n){if(e&&s&&s.isPannable()||t(""),e.isEmpty())return e;let r;const i=e.getGeometryType();if(i===o.enumEnvelope){const t=new C({vd:e.getDescription()});t.addEnvelope(e,!1),r=t}else if(a(i)){const t=new I({vd:e.getDescription()});t.addSegment(e,!0),r=t}else r=e;const h=Gl(r,s);return h.isEmpty()?h:El(h,s,0,h!==e,0,n)}function vh(e,t,s){if(!t.isPannable()||e.isEmpty())return e;const n=t.getPannableExtent().width(),r=.5*n,i=e.queryInterval(0,0);if(i.width()<r||!m(e.getGeometryType())){if(Number.isNaN(s))return e;const t=i.getCenter();if(Math.abs(t-s)<=r)return e;{const r=new Xt,i=it((s-t)/n)*n;r.setShiftCoords(i,0);const o=e.clone();return o.applyTransformation(r),o}}const o=e.getGeometryType(),a=e,h=a.getAttributeStreamRef(0),l=e.clone(),g=l.getAttributeStreamRef(0);let u=0,_=0,d=0,p=c(o)?0:-1;const f=Ke.constructEmpty();let x=!1;for(let m=0,y=a.getPointCount();m<y;m++){const e=h.read(2*m);m===_&&(c(o)?(0===p&&Number.isNaN(s)&&(x=!0),p>0&&Number.isNaN(s)&&(s=f.getCenter(),x=!1),_=a.getPathEnd(p),p++):_=a.getPointCount(),Number.isNaN(s)?d=e:(d=s,u=0));let t=e-d;Math.abs(t)>r&&(t=it(t/n)*n,u-=t,Math.abs(u)<.1*n&&(u=0));const i=e+u;g.write(2*m,i),x&&f.mergeCoordinate(i),d=e}return l.notifyModified(),l}const Th="missing implementation";function Nh(t,s,n,r){const i=s.getCoordinateSystemType();if(0===i){const e=new ec;return s.queryPrecisionDescriptor(e),Gh(t,e,s,n)}let o=t;2!==r&&3!==r||!s.isPannable()||(o=wh(o,s,n));const a=new ec;if(s.queryPrecisionDescriptor(a),o=Gh(o,a,s,n),0===r||o.isEmpty())return o;if(1===i){if(1===r){const t=new e;o.queryLooseEnvelope(t);const r=s.getPannableExtent(),i=.01*r.width();return r.xmin=t.xmin-i,r.xmax=t.xmax+i,(new zt).execute(o,r,s,n)}return o}if(2===i){const e=s.getPCSHorizon();if(1===r||2===r){const t=(new Eh).execute(o,e,s,n);return t===e?t.clone():t}return o}if(3===i)return o;l(Th)}function Gh(e,t,s,n){const r=t.getXYGridRange(),i=e.hasAttribute(1),o=e.hasAttribute(2);let a=new Ke,h=new Ke;i&&(a=t.getZGridRange()),o&&(h=t.getMGridRange());let m=(new zt).execute(e,r,s,n);if(i){const t=m.queryInterval(1,0);a.contains(t)||(e===m&&(m=m.clone()),Ce(m,a,1,0))}if(o){const t=m.queryInterval(2,0);h.contains(t)||(e===m&&(m=m.clone()),Ce(m,h,2,0))}return m}class Dh{constructor(e){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,e||t(""),this.m_projTransform=e,this.m_bClipOutCurvedPoles=!1;const s=this.m_projTransform.getExtendedParamsImpl();this.m_bNormalizeOutputGeometry=s.normalizeResultGeometry,this.m_bNormalizeOutputGeometry&&(s.legacyHorizonClipping?this.m_bNormalizeOutputGeometry=!1:this.m_projTransform.getOutputSR().isPannable()||(this.m_bNormalizeOutputGeometry=!1)),s.clipWithInputHorizon?(this.m_inputPCSHorizonClipOption=0,!s.legacyHorizonClipping&&this.m_projTransform.getInputSR().isPannable()&&(this.m_inputPCSHorizonClipOption=this.m_bNormalizeOutputGeometry?4:2)):this.m_inputPCSHorizonClipOption=1,s.clipWithOutputHorizon?(this.m_outputPCSHorizonClipOption=0,!s.legacyHorizonClipping&&this.m_projTransform.getOutputSR().isPannable()&&(this.m_outputPCSHorizonClipOption=this.m_bNormalizeOutputGeometry?4:2)):this.m_outputPCSHorizonClipOption=1,this.m_centralMeridianOfOutputGCS=s.centralMeridianOfOutputGCS,this.m_densificationStepInput=s.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(e,t){if(this.m_projTransform.isIdentity()||e.isEmpty())return e;const s=e.getGeometryType();if(s===o.enumPoint)return this.projectPoint(e,t);const n=this.m_projTransform.getInputSR().getCoordinateSystemType(),r=this.m_projTransform.getOutputSR().getCoordinateSystemType(),i=this.m_projTransform.getInputSR(),a=this.m_projTransform.getOutputSR();if(0===n&&n===r){const t=Fh(i,a),s=e.clone();return s.applyTransformation(t),s}switch(s){case o.enumPolyline:case o.enumPolygon:return this.projectMultiPath(e,t);case o.enumMultiPoint:return this.projectMultiPoint(e,t);case o.enumEnvelope:return this.projectEnvelope(e,t);case o.enumGeometryCollection:return this.projectGeometryCollection(e,t);default:l("")}}projectPoint(e,t){const s=[e.getXY()];let n,r=null;(n=e.hasAttribute(1))&&(r=[e.getZ()]),this.transformInPlaceZ(s,r,1,s,r,null);const i=e.clone();return i.setXY(s[0]),n&&i.setZ(r[0]),i}projectMultiPoint(e,t){let n=new w({copy:e});const r=this.m_projTransform.getInputSR(),i=this.m_projTransform.getOutputSR(),o=r.getCoordinateSystemType(),a=i.getCoordinateSystemType();if(3===o&&s(0),n=Ul(n,r,this.m_inputPCSHorizonClipOption,t),n.isEmpty())return n;2===o&&Wl(r,0,n),ig(this.m_projTransform,n,!1);let h=0;3===a&&s(0);const m=2===a;return m?h=i.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(h=this.m_centralMeridianOfOutputGCS),m&&0!==this.m_outputPCSHorizonClipOption||(n=El(n,Ru(i),h,!1,0,t)),m&&(n=pl(n,i,this.m_outputPCSHorizonClipOption,t),Xl(i,n,this.m_bNormalizeOutputGeometry),n.isEmpty()),n}projectMultiPath(e,t){const s=e.getGeometryType();return s===o.enumPolygon?this.projectPolygon(e,t):s===o.enumPolyline?this.projectPolyline(e,t):void l("project_multi_path_")}projectEnvelope(e,t){this.m_projTransform.getInputSR(),this.m_projTransform.getOutputSR();const s=this.m_projTransform.isVertical()&&e.hasAttribute(1);let n=Ke.constructEmpty();if(s&&(n=e.queryInterval(1,0)),n.width()>0){const s=e.clone();s.setInterval(1,0,n.vmin,n.vmin);const r=this.projectEnvelopeHelper(s,t);s.setInterval(1,0,n.vmax,n.vmax);const i=this.projectEnvelopeHelper(s,t);return r.merge(i),r}return this.projectEnvelopeHelper(e,t)}projectPolygon(t,n){s(t.getGeometryType()===o.enumPolygon),s(!this.m_projTransform.isIdentity()),s(!t.isEmpty());const r=this.m_projTransform.getInputSR(),i=this.m_projTransform.getOutputSR(),a=r.getCoordinateSystemType(),h=i.getCoordinateSystemType(),m=new C({copy:t});3===a&&s(0),3===h&&s(0);const l=2===a,g=2===h,u=l?r.getGCS():r,c=g?i.getGCS():i,_=!g&&!this.m_bDontHackPolesInGeogToGeog;let d=!1,p=Ul(m,r,this.m_inputPCSHorizonClipOption,n);if(p.isEmpty())return p;let f=this.m_densificationStepInput;const x=!Number.isNaN(f);let y;x&&(p=(new jt).execute(p,f,0,0,n));let P=g?i.getPCSInfo():null,E=Number.NaN;l&&(E=r.getCentralMeridian());const S=null!==i.getGCSSplitLines();if(this.m_bDontGeonormalizePolygon){const e=p;if(l&&(sg(r,E,e),x)){const e=r.getUnitsPerMillimeter();f*=r.getGCS().getUnitsPerMillimeter()/e}if(ag(this.m_projTransform,e,_),x){const e=r.getGCS().getUnitsPerMillimeter();f*=i.getGCS().getUnitsPerMillimeter()/e}y=e}else{let t=new I({vd:p.getDescription()});if(t.addAndExplicitlyOpenAllPaths(p,!1),l){if(sg(r,E,t),x){const e=r.getUnitsPerMillimeter();f*=r.getGCS().getUnitsPerMillimeter()/e}if(this.m_bClipOutCurvedPoles){const s=r.getPCSInfo(),i=s.getSouthPoleGeometry()===Ec.PE_POLE_LINE_CURVED,o=s.getNorthPoleGeometry()===Ec.PE_POLE_LINE_CURVED;if(i||o){const s=e.constructEmpty();t.queryLooseEnvelope(s),s.inflateCoords(1,1);const r=89.9999*u.getOneDegreeGCSUnit();i&&(s.ymin=-r),o&&(s.ymax=r),t=Wt(t,s,u,0,0,n)}}}if(ag(this.m_projTransform,t,_),x){const e=Ru(r).getUnitsPerMillimeter();f*=Ru(i).getUnitsPerMillimeter()/e}let s=Number.NaN;g?(P=i.getPCSInfo(),s=i.getCentralMeridian()):Number.isNaN(this.m_centralMeridianOfOutputGCS)||(s=this.m_centralMeridianOfOutputGCS);let o=Vh(r)|Vh(i),a=10*c.getTolerance(0);this.m_bDontHackPolesInGeogToGeog&&(o=3,a=10*c.getTolerance(0)),y=wl(p,r,t,c,s,n,o,a,this.m_bNormalizeOutputGeometry),o=0}if(S&&(s(!i.isPannable()),y=al(y,i,n)),g){if(!d){const e=c.getPannableExtent().width();if(y.queryInterval(0,0).width()>=e-10*c.getTolerance(0)){const e=P.getNorthPoleLocation(),t=P.getSouthPoleLocation(),s=P.getNorthPoleGeometry(),n=P.getSouthPoleGeometry();let r=0;s===Ec.PE_POLE_POINT&&e!==Ec.PE_POLE_OUTSIDE_BOUNDARY&&(r=1),n===Ec.PE_POLE_POINT&&t!==Ec.PE_POLE_OUTSIDE_BOUNDARY&&(r|=2),d||=0!==r}}y=pl(y,i,this.m_outputPCSHorizonClipOption,n),x&&(y=(new jt).execute(y,f,0,0,n)),zl(i,y,this.m_bNormalizeOutputGeometry)}return y.isEmpty()||d&&(y=(new ph).execute(y,i,!1,n)),y}projectPolyline(e,t){s(e.getGeometryType()===o.enumPolyline),s(!this.m_projTransform.isIdentity()),s(!e.isEmpty());const n=this.m_projTransform.getInputSR(),r=this.m_projTransform.getOutputSR(),i=n.getCoordinateSystemType(),a=r.getCoordinateSystemType(),h=new I({copy:e});3===i&&s(0),3===a&&s(0);const m=2===i,l=2===a;m&&n.getGCS();const g=l?r.getGCS():r,u=!l&&!this.m_bDontHackPolesInGeogToGeog;let c=Ul(h,n,this.m_inputPCSHorizonClipOption,t);if(c.isEmpty())return c;let _=Number.NaN;m&&(_=n.getCentralMeridian());const d=null!==r.getGCSSplitLines();let p=this.m_densificationStepInput;const f=!Number.isNaN(p);let x;if(f&&(c=(new jt).execute(c,p,0,0,t)),this.m_bDontGeonormalizePolygon){if(m&&(sg(n,_,c),f)){const e=n.getUnitsPerMillimeter();p*=n.getGCS().getUnitsPerMillimeter()/e}if(ag(this.m_projTransform,c,u),f){const e=n.getGCS().getUnitsPerMillimeter();p*=r.getGCS().getUnitsPerMillimeter()/e}x=c}else{const e=new I({vd:c.getDescription()});if(e.addAndExplicitlyOpenAllPaths(c,!1),m&&(sg(n,_,e),f)){const e=n.getUnitsPerMillimeter();p*=n.getGCS().getUnitsPerMillimeter()/e}if(ag(this.m_projTransform,e,u),f){const e=n.getGCS().getUnitsPerMillimeter();p*=r.getGCS().getUnitsPerMillimeter()/e}let s=Number.NaN;l?s=r.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(s=this.m_centralMeridianOfOutputGCS);let i=Vh(n)|Vh(r),o=10*g.getTolerance(0);this.m_bDontHackPolesInGeogToGeog&&(i=3,o=0),x=vl(c,n,e,g,s,t,i,o,this.m_bNormalizeOutputGeometry),i=0}return d&&(s(!r.isPannable()),x=al(x,r,t)),l&&(x=pl(x,r,this.m_outputPCSHorizonClipOption,t),f&&(x=(new jt).execute(x,p,0,0,t)),zl(r,x,this.m_bNormalizeOutputGeometry)),x.isEmpty(),x}projectGeometryCollection(e,t){return s(0),{}}projectEnvelopeHelper(t,s){const n=(t.height()+t.width())/400;if(0!==n){const r=(new jt).execute(t,n,0,0,s),i=this.projectMultiPath(r,s),o=new ge({vd:t.getDescription()});if(i.isEmpty()){const n=Math.min(t.height(),t.width()),i=Se(this.m_projTransform.getInputSR(),t,!0).total();if(n>100*i){const t=e.constructEmpty(),s=pe(this.m_projTransform.getOutputSR(),t,!0).total(),r=this.m_projTransform.getInputSR().getOneMeter()/this.m_projTransform.getOutputSR().getOneMeter();if(n>100*Math.max(i,s*r))return o}const a=new I;a.addAndExplicitlyOpenAllPaths(r,!1);this.projectMultiPath(a,s).queryEnvelope(o);const h=new w({vd:t.getDescription()});h.reserve(4);const m=new ae;for(let e=0;e<4;e++)t.queryCornerByVal(e,m),h.add(m);const l=this.projectMultiPoint(h,s),g=new ge;return l.queryEnvelope(g),o.merge(g),o}return i.queryEnvelope(o),o}{const e=t.getCenterXY(),n=new ae(e),r=this.projectPoint(n,s),i=new ge({vd:t.getDescription()});if(r.isEmpty())i.setEmpty();else{t.copyTo(i);const e=r.getXY();i.setCoords(e.x,e.y,e.x,e.y)}return i}}transformInPlace(e,t,n,r){return s(0),0}transformInPlaceZ(e,t,n,r,i,o){if(this.m_projTransform.isIdentity())return e!==r&&nt(r,e,n),t!==i&&ut(i,t,0,0,n),n;const a=this.m_projTransform,m=a.getInputSR(),l=a.getOutputSR(),g=m.getCoordinateSystemType(),u=l.getCoordinateSystemType();if(0===g&&g===u){return Fh(m,l).transformPoints2D(e,n,r),a.isVertical()&&s(0),n}3===g&&h("image: transform_in_place_"),3===u&&h("image: transform_in_place_"),ql(e,n,r,m,this.m_inputPCSHorizonClipOption),i!==t&&ut(i,t,0,0,n),2===g&&ng(m,0,r,n),gg(this.m_projTransform,r,i,n,!1);let c=0;const _=2===u;if(_?c=l.getCentralMeridian():Number.isNaN(this.m_centralMeridianOfOutputGCS)||(c=this.m_centralMeridianOfOutputGCS),_&&0!==this.m_outputPCSHorizonClipOption||Sl(r,n,l.getGCS(),c),_){if(!Pl(r,n,l,this.m_outputPCSHorizonClipOption))for(let e=0;e<n;++e)r[e].setNAN();Bl(l,r,n,!1)}let d=n;for(let s=0;s<n;++s)r[s].isNAN()&&(i&&(i[s]=Number.NaN),d--);return d}}function Vh(e){if(2!==e.getCoordinateSystemType())return 0;let t=0;const s=e.getPCSInfo(),n=s.getNorthPoleLocation(),r=s.getSouthPoleLocation(),i=s.getNorthPoleGeometry(),o=s.getSouthPoleGeometry();return i===Ec.PE_POLE_POINT&&n!==Ec.PE_POLE_OUTSIDE_BOUNDARY&&(t=1),o===Ec.PE_POLE_POINT&&r!==Ec.PE_POLE_OUTSIDE_BOUNDARY&&(t|=2),t}function Fh(e,t){const s=e.getHorzUnitFactor(),n=t.getHorzUnitFactor();let r=1,i=1;const o=20015077/180;1===e.getUnit().getUnitType()&&(r=o),1===t.getUnit().getUnitType()&&(i=o);const a=s/n*(r!==i?r/i:1),h=new Xt;return h.setScaleCoords(a,a),h}let Hh=class{getOperatorType(){return 10300}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s){return!t||t.isIdentity()?e:new kh(e,t,s)}execute(e,t,s){return t.isIdentity()?e:Sh(e,t,s)}transform(e,t,s,n,r=!0){return r?Ch(e,t,s,n,null):Ih(e,t,s,n,null)}transform3D(e,t,n,r,i=!0){return s(0),0}foldInto360Range(e,t){return wh(e,t,null)}foldInto360RangeGeodetic(e,t,s){return bh(e,t,s,null)}normalizeGeometryEx(e,t,s,n,r=0){return Cm(e,t,s,n,r)}normalizeGeometry(e,t,s){return vh(e,t,s)}clipToSpatialReference(e,t,s,n=0){return Nh(e,t,s,n)}};class kh extends Zt{constructor(e,s,n){super(),this.m_projTrans=s,this.m_progressTracker=n,this.m_index=-1,e||t(""),this.m_inputGeoms=e}next(){const e=this.m_inputGeoms.next();return null!=e?(n(e),r(e),this.m_index=this.m_inputGeoms.getGeometryID(),Sh(e,this.m_projTrans,this.m_progressTracker)):null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}}function Ah(e,s,h,m,l,g,u=!1){e||t("Geometry.Geodetic_densify.densify");let c=e.getGeometryType();if(r(e),n(e),e.isEmpty()||i(c))return e;const _=new Rh;_.m_sr=s,_.m_gcs=s.getGCS(),_.m_transform=_.m_gcs!==s?s.getSRToGCSTransform():null,_.m_progressTracker=g;const d=vu();let p,f,x;if(_.m_gcs.querySpheroidData(d),_.m_a=d.majorSemiAxis,_.m_eSquared=d.e2,_.m_rpu=_.m_gcs.getUnit().getUnitToBaseFactor(),_.m_gcsTolerance=_.m_gcs.getTolerance(0),_.m_radTolerance=_.m_gcsTolerance*_.m_rpu,_.m_maxLength=m,_.m_maxDeviation=l,_.m_curveType=h,c===o.enumEnvelope){const t=new C({vd:e.getDescription()});t.addEnvelope(e,!1),p=t,c=o.enumPolygon}else if(a(c)){const t=new I({vd:e.getDescription()});t.addSegment(e,!0),p=t,c=o.enumPolyline}else p=e;if(4!==_.m_curveType){if(f=_.m_transform&&!_.m_transform.isIdentity()?(new Hh).execute(p,_.m_transform,g):Gl(p,_.m_gcs),f.isEmpty())return f;f=Mh(_.m_rpu,f);let e=_.geodeticDensify(f);u||(e=(new Hh).foldInto360RangeGeodetic(e,_.m_gcs,_.m_curveType)),x=_.m_transform&&!_.m_transform.isIdentity()?(new Hh).execute(e,_.m_transform.getInverse(),g):e}else{let e;if(s.isPannable())e=Gl(p,s);else{const t=s.getPCSHorizon();e=(new Eh).execute(p,t,s,g),e===t&&(e=t.clone())}if(f=e,f.isEmpty())return f;x=_.shapePreservingDensify(f)}return x}function Mh(t,s){const n=new e;if(s.queryLooseEnvelope(n),n.width()*t<Math.PI)return s;let r=!1;const i=s.querySegmentIterator(),o=new We,a=new We;for(;i.nextPath();)for(;i.hasNextSegment();){const e=i.nextSegment();if(o.setCoordsPoint2D(e.getStartXY()),a.setCoordsPoint2D(e.getEndXY()),o.scale(t),a.scale(t),Math.abs(o.x-a.x)>Math.PI){if(!qh(o,a)){r=!0;break}if(Math.abs(o.x-a.x)>2*Math.PI){r=!0;break}}}if(!r)return s;const h=s.createInstance();h.reserve(s.getPointCount());const m=s.getDescription().getAttributeCount()>1,l=new We,g=new We,u=new We(0,0),c=new We(0,0),_=new ae;for(i.resetToFirstPath();i.nextPath();){let e=Number.NaN,s=0;for(;i.hasNextSegment();){const n=i.nextSegment();o.setCoordsPoint2D(n.getStartXY()),a.setCoordsPoint2D(n.getEndXY()),o.scale(t),a.scale(t),Number.isNaN(e)?(s=$h(o.x,Number.NaN,s),u.setCoordsPoint2D(o)):u.setCoordsPoint2D(c),e=u.x;if(qh(o,a)){if(a.x-o.x>2*Math.PI)for(;a.x-o.x>2*Math.PI;)a.x-=2*Math.PI;else if(a.x-o.x<2*-Math.PI)for(;a.x-o.x<2*-Math.PI;)a.x+=2*Math.PI;s=$h(a.x,Number.NaN,s),c.setCoordsPoint2D(a)}else l.setCoordsPoint2D(a),im(l),s=$h(l.x,e,s),c.setCoords(s+l.x,l.y);if(Math.abs(c.x-a.x)<.5&&c.setCoordsPoint2D(a),m){n.queryCoord(0,_),g.setCoordsPoint2D(u),g.scale(1/t),_.setXY(g);i.isFirstSegmentInPath()?h.startPathPoint(_):h.lineToPoint(_),i.isLastSegmentInPath()&&!i.isPathClosed()&&(n.queryCoord(1,_),g.setCoordsPoint2D(c),g.scale(1/t),_.setXY(g),h.lineToPoint(_))}else{i.isFirstSegmentInPath()&&h.insertPath2D(-1,null,0,0,!0);const e=h.getPathCount()-1;g.setCoordsPoint2D(u),g.scale(1/t),h.insertPoint2D(e,-1,g),i.isLastSegmentInPath()&&!i.isPathClosed()&&(g.setCoordsPoint2D(c),g.scale(1/t),h.insertPoint2D(e,-1,g))}}}return h}function Uh(e,t,s,n,r,i,o,a,h,m,l,g){const u=new We,c=new We,_=n.compare(r)>0;Qh(_,n,r,u,c);const d=Lh(e,t,s,u,c,i,o,a,h,m,null,l,g);return _&&Kh(h,m,null,l),d}function qh(e,t){return!(!cc(e.y,_t)||!cc(t.y,_t))||!(!cc(e.y,-_t)||!cc(t.y,-_t))}function Oh(e,t){return!(!cc(e.y,_t)||cc(t.y,_t))||!(!cc(e.y,-_t)||cc(t.y,-_t))}function Bh(e,t){return!(!cc(t.y,_t)||cc(e.y,_t))||!(!cc(t.y,-_t)||cc(e.y,-_t))}class Rh{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(e){const t=e.createInstance(),s=e.querySegmentIterator(),n=[],r=[],i=new b,o=e.getDescription().getAttributeCount()>1;for(;s.nextPath();){const e=[0];for(;s.hasNextSegment();){const a=s.nextSegment(),h=a.getStartXY(),m=a.getEndXY();h.scale(this.m_rpu),m.scale(this.m_rpu);const l=new We,g=new We,u=h.compare(m)>0;Qh(u,h,m,l,g),n.length=0,r.length=0,this.m_maxLength>0?Lh(this.m_a,this.m_eSquared,this.m_curveType,l,g,this.m_maxLength,this.m_maxDeviation,this.m_radTolerance,null,null,o?r:null,n,e):zh(),u&&Kh(null,null,o?r:null,n),n[0].setCoordsPoint2D(a.getStartXY()),n.at(-1).setCoordsPoint2D(a.getEndXY());const c=1/this.m_rpu;for(let e=1,t=n.length-1;e<t;e++)n[e].scale(c);if(o){const e=Jh(u,a,i);Xh(s.isFirstSegmentInPath(),s.isLastSegmentInPath()&&!s.isPathClosed(),a,e,r,n,t)}else Yh(s.isFirstSegmentInPath(),s.isLastSegmentInPath()&&!s.isPathClosed(),n,t)}}return t}shapePreservingDensify(e){const t=e.createInstance(),s=e.querySegmentIterator(),n=[],r=[],i=new b,o=e.getDescription().getAttributeCount()>1;for(;s.nextPath();)for(;s.hasNextSegment();){const e=s.nextSegment(),a=e.getStartXY(),h=e.getEndXY(),m=a.compare(h)>0,l=Jh(m,e,i);n.length=0,r.length=0,Zh(this.m_a,this.m_eSquared,this.m_rpu,l,this.m_sr,this.m_maxLength,this.m_maxDeviation,o?r:null,n),m&&Kh(null,null,o?r:null,n),o?Xh(s.isFirstSegmentInPath(),s.isLastSegmentInPath()&&!s.isPathClosed(),e,l,r,n,t):Yh(s.isFirstSegmentInPath(),s.isLastSegmentInPath()&&!s.isPathClosed(),n,t)}return t}}function Yh(e,t,s,n){e&&n.insertPath2D(-1,null,0,0,!0);const r=n.getPathCount()-1;n.insertPointsFromPoints(r,-1,s,0,s.length-1,!0),t&&n.insertPoint2D(r,-1,s.at(-1))}function Xh(e,t,s,n,r,i,o){o.reserve(o.getPointCount()+i.length-1);const a=new ae;if(s.queryStart(a),e?o.startPathPoint(a):o.lineToPoint(a),i.length>2){const e=n.calculateLength2D();for(let t=1;t<i.length-1;t++){const s=n.lengthToT(r[t]*e);n.queryCoord(s,a),a.setXY(i[t]),o.lineToPoint(a)}}t&&(s.queryEnd(a),o.lineToPoint(a))}function Lh(e,t,s,n,r,i,o,a,h,m,l,g,u){const c={stack:[],error:void 0,hasError:!1};try{const _=Rt(c,new pc,!1),d=Rt(c,new pc,!1),p=Rt(c,new pc,!1);Ic.geodeticDistance(e,t,n.x,n.y,r.x,r.y,p,_,d,s);const f=p.val,x=_.val,y=d.val;let P=x,E=y;P<0&&(P+=2*Math.PI),E<0&&(E+=2*Math.PI),h&&(h[0]=P),m&&(m[0]=E);let S=Number.NaN,C=Number.NaN;if(null!==l){const s=bc.q90(e,t),r=bc.q(e,t,n.y);S=(s-r)/f,C=(s+r)/f}const I=Oh(n,r),b=Bh(n,r),w=I||b,v=nm(n,r,a),T=Rt(c,new ct(new pc,new pc),!1),N=new We,G=new We,D=new We;u[0]=$h(n.x,Number.NaN,u[0]);let V=u[0];if(f<=i)return g.push(n.clone()),u[0]=$h(r.x,Number.NaN,u[0]),null!=l&&l.push(0),w?(I&&em(n,r,l,g),b&&tm(n,r,l,g)):v?sm(n,r,x,S,C,l,g):o>0&&(G.setCoords(n.x-V,n.y),N.setCoords(r.x-u[0],r.y),V=Wh()),g.push(r.clone()),f;const F=1+Math.ceil(f/i),H=f/(F-1),k=new We;g.push(n.clone()),k.setCoordsPoint2D(n),G.setCoords(n.x-u[0],n.y),null!==l&&l.push(0);for(let i=1;i<F;i++){let h;if(i<F-1){const r=i*H;Ic.geodeticCoordinate(e,t,n.x,n.y,r,x,T.at(0),T.at(1),s),N.setCoords(T.at(0).val,T.at(1).val),u[0]=$h(N.x,k.x,u[0]),D.setCoords(u[0]+N.x,N.y),h=i/(F-1)}else u[0]=$h(r.x,Number.NaN,u[0]),N.setCoords(r.x-u[0],r.y),D.setCoordsPoint2D(r),h=1;w?(1===i&&I&&em(n,D,l,g),i===F-1&&b&&tm(k,r,l,g)):v?rm(k,D,a)&&(n.x<r.x?k.x>D.x&&(u[0]+=2*Math.PI,D.setCoords(u[0]+N.x,N.y)):k.x<D.x&&(u[0]-=2*Math.PI,D.setCoords(u[0]+N.x,N.y)),sm(k,D,x,S,C,l,g)):o>0&&Wh(),g.push(D.clone()),null!=l&&l.push(h),k.setCoordsPoint2D(D),G.setCoordsPoint2D(N),V=u[0]}return f}catch(_){c.error=_,c.hasError=!0}finally{Yt(c)}}function zh(e,t,n,r,i,o,a,h,m,l){s(0)}function Wh(e,t,n,r,i,o,a,h,m,l,g,u,c,_,d){return s(0),0}function jh(e,t,s,n){const r=gs(e,t,s),i=gs(e,t,n);return oe.distance(r,i)}function Zh(e,t,s,n,r,i,o,a,h){const m=n.isCurve(),l=Ns(e,t)*Math.PI*179/180;let g=i;i>0&&!(i>l)||(g=l),g=As(e,t,g);let u=o;!m||u>0||(u=.001);const c=u>0;let _=Number.NaN;c&&(_=As(e,t,u));const d=r.getPECoordSys(),p=1===r.getCoordinateSystemType(),f=r.getTolerance(0),x=n.getStartXY(),y=n.getEndXY(),P=new We,E=new We;if(p)P.setCoordsPoint2D(x),P.scale(s),E.setCoordsPoint2D(y),E.scale(s);else{const e=[x.x,x.y,y.x,y.y];yc.projToGeog(d,2,e),P.setCoords(e[0],e[1]),P.scale(s),E.setCoords(e[2],e[3]),E.scale(s)}let S=0,C=0;const I=[],b=[],w=[];I.push(y.clone()),b.push(E.clone()),w.push(1),h.push(x.clone()),null!==a&&a.push(C);const v=r.isPannable(),T=x.clone(),N=[.5,.33333333333333337,.6666666666666666,.16666666666666669,.8333333333333333];let G=5;for(m||(c?(N[0]=.5,N[1]=.25,N[2]=.75,G=3):G=1);b.length>0;){const i=I.at(-1).clone();E.assign(b.at(-1));const o=w.at(-1);let l=!1,u=Number.NaN;const x=jh(e,t,P,E);let y=g>=x&&Math.abs(P.y-E.y)<.9*Math.PI;p&&y&&(y=Math.abs(P.x-E.x)<.9*Math.PI);const D=new We,V=new We;let F=!1;if(m||c||!y||y&&(F=!0),n.calculateSubLength(C,o)<=f&&(F=!0),!F)for(let a=0;a<G;a++){const i=mt(C,o,N[a]),h=new We;n.queryCoord2D(i,h);const m=new We;if(p)m.setCoords(h.x*s,h.y*s);else{const e=[h.x,h.y];yc.projToGeog(d,1,e),m.setCoords(e[0]*s,e[1]*s)}if(0===a&&(u=i,D.setCoordsPoint2D(h),V.setCoordsPoint2D(m),!y)){l=!0;break}if(p&&Math.abs(P.x-m.x)>=Math.PI){l=!0;break}if(g<jh(e,t,P,m)){l=!0;break}if(c){const i=xs(e,t,P,E,N[a]),h=i.clone();if(p?(h.x/=s,h.y/=s):(h.x/=s,h.y/=s,Ih(r.getGCSToSRTransform(),[h],1,[h],null)),h.isNAN()){const s=gs(e,t,m),n=gs(e,t,P),r=gs(e,t,E),{first:i,second:o}=Cs(e,t,s,n,r,2,null);if(o>_){l=!0;break}}else{if(v){const e=r.getPannableExtent().width(),t=mt(n.getStartX(),n.getEndX(),.5);for(;h.x<t-.5*e;)h.x+=e;for(;h.x>=t+.5*e;)h.x-=e}const a=n.getClosestCoordinateOnInterval(h,new Ke(C,o),-1),m=n.getCoord2D(a);if(!p){const e=[m.x,m.y];yc.projToGeog(d,1,e),m.x=e[0],m.y=e[1]}m.x*=s,m.y*=s;let g=jh(e,t,m,i);if(g>_){if(g<4*_){const s=gs(e,t,m),n=gs(e,t,P),r=gs(e,t,E),{first:i,second:o}=Cs(e,t,s,n,r,2,null);g=o}if(g>_){l=!0;break}}}}}l?(I.push(D.clone()),b.push(V.clone()),w.push(u)):(I.pop(),b.pop(),w.pop(),h.push(i.clone()),S+=x,null!==a&&a.push(S),T.setCoordsPoint2D(i),P.setCoordsPoint2D(E),C=o)}if(null!==a){const e=1/S;for(let t=0;t<a.length;t++)a[t]*=e}}function Kh(e,t,s,n){if(n.reverse(),null!==s&&s.reverse(),e){const s=e[0],n=t[0];e[0]=n,t[0]=s}}function Qh(e,t,s,n,r){e?(n.setCoordsPoint2D(s),r.setCoordsPoint2D(t)):(n.setCoordsPoint2D(t),r.setCoordsPoint2D(s))}function Jh(e,t,s){return e?(s.create(t.getGeometryType()),t.copyTo(s.get()),s.get().reverse(),s.get()):t}function $h(e,t,s){if(Number.isNaN(t)){for(;s-e>Math.PI;)s-=2*Math.PI;for(;e-s>Math.PI;)s+=2*Math.PI;return s}return s+e-t>Math.PI?s-=2*Math.PI:t-(s+e)>Math.PI&&(s+=2*Math.PI),s}function em(e,t,s,n){if(e.y>0){const r=new We;r.setCoords(t.x,_t),cc(e.x,r.x)||cc(t.y,r.y)||(n.push(r),null!==s&&s.push(0))}else{const r=new We;r.setCoords(t.x,-_t),cc(e.x,r.x)||cc(t.y,r.y)||(n.push(r),null!==s&&s.push(0))}}function tm(e,t,s,n){if(t.y>0){const r=new We;r.setCoords(e.x,_t),cc(t.x,r.x)||cc(e.y,r.y)||(n.push(r),null!==s&&s.push(1))}else{const r=new We;r.setCoords(e.x,-_t),cc(t.x,r.x)||cc(e.y,r.y)||(n.push(r),null!==s&&s.push(1))}}function sm(e,t,s,n,r,i,o){if(dc(s)){if(_t-e.y>0){const t=new We;t.setCoords(e.x,_t),o.push(t),null!==i&&i.push(n)}if(_t-t.y>0){const e=new We;e.setCoords(t.x,_t),o.push(e),null!==i&&i.push(n)}}else{if(_t+e.y>0){const t=new We;t.setCoords(e.x,-_t),o.push(t),null!==i&&i.push(r)}if(_t+t.y>0){const e=new We;e.setCoords(t.x,-_t),o.push(e),null!==i&&i.push(r)}}}function nm(e,t,s){return!(!rm(e,t,s)||cc(e.y,_t)||cc(e.y,-_t)||cc(t.y,_t)||cc(t.y,-_t))}function rm(e,t,s){return Math.abs(Math.abs(e.x-t.x)-Math.PI)<=s}function im(e){if(e.x<-Math.PI)for(;e.x<-Math.PI;)e.x+=2*Math.PI;else if(e.x>Math.PI)for(;e.x>Math.PI;)e.x-=2*Math.PI}function om(e,t,s,n){const r={stack:[],error:void 0,hasError:!1};try{const i=[s.x],o=[s.y-n],a=[s.x],h=[s.y+n];Ts(i,o),Ts(a,h);const m=Rt(r,new pc,!1),l=Rt(r,new pc,!1);Ic.greatEllipticDistance(e,t,s.x,s.y,i[0],o[0],m,null,null),Ic.greatEllipticDistance(e,t,s.x,s.y,a[0],h[0],l,null,null);return Math.min(m.val,l.val)}catch(i){r.error=i,r.hasError=!0}finally{Yt(r)}}function am(t,s,n,r,i){const o=new e;n.queryEnvelope(o);const a=Se(null,n,!0).total();if(s.xmin-o.xmin<=a&&o.xmax-s.xmax<=a)return n;const h=s.width();let m=0;for(;s.xmin+m*h<o.xmin;)m++;for(;s.xmin+m*h>o.xmin;)m--;const l=m*h,g=new Xt;g.setShiftCoords(-l,0);const u=n;u.applyTransformation(g);const c=new e;u.queryEnvelope(c);let _=null;if(c.xmax>s.xmax){let n=0;const r=new e;r.setCoords({env2D:s}),r.ymin-=1,r.ymax+=1;let o=u;for(;r.xmin<c.xmax;){c.xmax>r.xmax&&(o=Tl(o,t,2,!0,r.xmax));const e=Ye(o,r),a=pe(null,e,!0).total(),m=Lt(o,r,a,Number.NaN,i);null===_?_=m===o?m.clone():m:(g.setShiftCoords(-n*h,0),m.applyTransformation(g),_.add(m,!1)),n++,r.xmin=r.xmax,r.xmax=s.xmax+n*h}}else _=u;return _}class hm{constructor(e,t){this.m_basisX=new oe,this.m_basisY=new oe,this.m_normal=new oe,s(1===e.getCoordinateSystemType()),this.m_gcs=e;const n=vu();e.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_e2=n.e2,this.m_rpu=e.getUnit().getUnitToBaseFactor(),this.m_curvCenterRad=t.mul(this.m_rpu);const r=this.m_curvCenterRad.x,i=this.m_curvCenterRad.y,o=Math.cos(r),a=Math.sin(r),h=Math.cos(i),m=Math.sin(i);this.m_cartCenter3D=cs(this.m_a,this.m_e2,o,a,h,m),this.m_normal.setCoordsPoint3D(this.m_cartCenter3D),this.m_d=this.m_cartCenter3D.length(),this.m_normal.divThis(this.m_d),oe.selectRightHandedBasisFromNormal(this.m_normal,this.m_basisX,this.m_basisY),this.m_northPolePcs=this.projectPoint(We.construct(0,.5*Math.PI/this.m_rpu)),this.m_southPolePcs=this.projectPoint(We.construct(0,.5*-Math.PI/this.m_rpu))}project(e){const s=e.getGeometryType();if(m(s)){n(e);const t=e;return this.projectMultiVertex(t)}t("Gnomonic.project")}unproject(e,s,r){const i=e.getGeometryType();if(m(i)){n(e);let t=e;const a=[];if(i===o.enumPolygon){const e=t.getPathCount();for(let s=0;s<e;s++){const e=t.calculateRingArea2D(s);a.push(e)}}return this.unprojectMultiVertex(s,t),c(i)?(fm(this.m_gcs,0,t),mm(a,this.m_gcs,0,t,r)):t=El(t,this.m_gcs,0,!0,0,r),t}t("Gnomonic.unproject")}projectPoint(e){const t=e.mul(this.m_rpu),s=gs(this.m_a,this.m_e2,t),n=this.m_normal.dotProduct(s);if(n<=0)return We.construct(Number.NaN,Number.NaN);const r=this.m_d/n,i=s.mul(r).sub(this.m_cartCenter3D),o=new We;return o.x=this.m_basisX.dotProduct(i),o.y=this.m_basisY.dotProduct(i),o}unprojectPoint(e){const t=this.m_cartCenter3D.add(this.m_basisX.mul(e.x).add(this.m_basisY.mul(e.y)));return ps(this.m_a,this.m_e2,t).divide(this.m_rpu)}projectMultiVertex(e){const t=e.getImpl();let s=!0;const n=new We,r=new We;for(let i=0,o=t.getPointCount();i<o;i++)t.queryXY(i,n),n.y*this.m_rpu>.5*Math.PI?r.assign(this.m_northPolePcs):n.y*this.m_rpu<.5*-Math.PI?r.assign(this.m_southPolePcs):r.assign(this.projectPoint(n)),t.setXY(i,r),r.isNAN()&&(s=!1);return t.notifyModifiedFlags(2001),s}unprojectMultiVertex(e,t){const s=t.getImpl(),n=e*e,r=!this.m_northPolePcs.isNAN(),i=!this.m_southPolePcs.isNAN();for(let o=0,a=s.getPointCount();o<a;o++){const e=s.getXY(o);let t=new We;r&&We.sqrDistance(e,this.m_northPolePcs)<=n?(t.setCoords(this.m_curvCenterRad.x,.5*Math.PI),t.scale(1/this.m_rpu)):i&&We.sqrDistance(e,this.m_southPolePcs)<=n?(t.setCoords(this.m_curvCenterRad.x,.5*-Math.PI),t.scale(1/this.m_rpu)):t=this.unprojectPoint(e),s.setXY(o,t)}s.notifyModifiedFlags(2001)}}function mm(t,s,n,r,i){const a=r.getGeometryType(),h=s.getPannableExtent();let m=r,l=!1,g=!1;if(a===o.enumPolygon){const r=new e,o=We.construct(n,0);r.setCoords({env2D:h}),r.centerAt(o),l=lm(t,s,r,m,i);const a=pm(s,r,m,i);a!==m&&(g=!0),m=a}else m=(new Hh).foldInto360RangeGeodetic(m,s,2);a===o.enumPolygon&&(l||g)&&(m=(new ph).execute(m,s,!1,i)),m!==r&&(r.setEmpty(),r.add(m,!1))}function lm(e,t,s,n,r){const i=gm(s,n),o=um(e,t,s,n,r);return i||o}function gm(t,s){const n=new e;s.queryEnvelope(n);const r=cc(t.ymax,n.ymax),i=cc(t.ymin,n.ymin),o=r||i;return!!o&&(cm(t,s),o)}function um(e,t,s,n,r){const i=[],o=[],a=.5*s.width();for(let g=0;g<n.getPathCount();g++){const h=n.getXY(n.getPathStart(g)),m=n.getXY(n.getPathEnd(g)-1),l=e[g]<0;if(Math.abs(h.x-m.x)>a){const e=_m(l,t,s,g,n,r);i.push(e),o.push(g)}else if(!l){if(n.calculateRingArea2D(g)<0){const e=dm(t,s,g,n,r);i.push(e),o.push(g)}}}if(0===i.length)return!1;const h=new C({vd:n.getDescription()});let m=0,l=o[m];for(let g=0;g<n.getPathCount();g++)g===l?(h.add(i[m],!1),m++,m<o.length&&(l=o[m])):h.addPath(n,g,!0);return n.setEmpty(),n.add(h,!1),!0}function cm(t,s){const n=new C,r=new e;for(let e=0;e<s.getPathCount();e++){s.queryPathEnvelope(e,r);let i=cc(t.ymax,r.ymax),o=cc(t.ymin,r.ymin);if(!(i||o)){n.addPath(s,e,!0);continue}n.insertPath2D(-1,null,0,0,!0);const a=s.getPathStart(e),h=s.getPathEnd(e),m=h-a;let l=-1;for(l=a;l<h;l++){const e=s.getXY(l);if(i=cc(t.ymax,e.y),o=cc(t.ymin,e.y),!i&&!o)break}let g=l,u=!1,c=Number.NaN;do{const r=s.getXY(g);i=cc(t.ymax,r.y),o=cc(t.ymin,r.y);const h=a+(g+1-a)%m;if(i||o){let i=We.construct(c,r.y);n.insertPoint2D(e,-1,i);const o=s.getXY(h),a=cc(t.ymax,o.y),m=cc(t.ymin,o.y);a||m||(i=We.construct(o.x,r.y),u?n.setXY(n.getPointCount()-1,i):n.insertPoint2D(e,-1,i)),u=!0}else n.insertPoint2D(e,-1,r),c=r.x,u=!1;g=h}while(g!==l)}s.setEmpty(),s.add(n,!1)}function _m(t,s,n,r,i,o){const a=new C,h=new C,m=new Xt,l=i.getXY(i.getPathStart(r)),g=i.getXY(i.getPathEnd(r)-1),u=n.width(),c=.5*u,_=new e;i.queryEnvelope(_);const d=Math.ceil(_.width()/u)+1;let p,f;l.x>g.x?(p=-u,f=t?n.ymin:n.ymax):(p=u,f=t?n.ymax:n.ymin),m.setShiftCoords(p,0),a.addPath(i,r,!0),h.add(a,!1);const x=new ae;for(let e=0;e<d;e++)h.applyTransformation(m),h.getPointByVal(0,x),a.lineToPoint(x),a.addSegmentsFromPath(h,0,0,h.getSegmentCount()-1,!1);const y=a.getXY(0),P=a.getXY(a.getPointCount()-1);y.y=f,P.y=f,a.lineTo(P);const E=new We;for(E.setCoordsPoint2D(P),E.x-=.5*p;Math.abs(E.x-y.x)>c;)a.lineTo(E),E.x-=.5*p;a.lineTo(y);const S=n.getCenter().x,I=new e;a.queryEnvelope(I);let b=0;const w=I.getCenter().x;w-S>c?b=-Math.ceil((w-S-c)/u):S-w>c&&(b=Math.ceil((S-w-c)/u)),0!==b&&(m.setShiftCoords(b*u,0),a.applyTransformation(m));const v=new T,N=v.addGeometry(a);Nl(v,N,s,0,2,!0,n.xmin),Nl(v,N,s,0,2,!0,n.xmax);const G=v.getGeometry(N),D=Ye(G,n);D.inflateCoords(0,1);const V=pe(null,D,!0);return Lt(G,n,V.total(),Number.NaN,o)}function dm(t,s,n,r,i){const o=s.width(),a=.5*o,h=s.getCenter().x,m=new e;r.queryPathEnvelope(n,m);let l,g=0,u=m.getCenter().x;if(u-h>a?g=-Math.ceil((u-h-a)/o):h-u>a&&(g=Math.ceil((h-u-a)/o)),0!==g){const e=new Xt;e.setShiftCoords(g*o,0),r.getImpl().applyTransformationToPath(e,n),r.queryPathEnvelope(n,m),u=m.getCenter().x}const c=new e;s.containsExclusiveEnvelope(m)?(l=!1,c.setCoords({env2D:s})):(l=!0,c.setCoords({env2D:s}),c.xmin-=o,c.xmax+=o);let _=r.createInstance();_.addPathPoint2D(null,0,!0);const d=new We;if(d.setCoords(c.xmin,c.ymin),_.insertPoint2D(0,-1,d),d.setCoords(c.xmin,c.ymax),_.insertPoint2D(0,-1,d),d.setCoords(.5*(c.xmin+c.xmax),c.ymax),_.insertPoint2D(0,-1,d),d.setCoords(c.xmax,c.ymax),_.insertPoint2D(0,-1,d),d.setCoords(c.xmax,c.ymin),_.insertPoint2D(0,-1,d),d.setCoords(.5*(c.xmin+c.xmax),c.ymin),_.insertPoint2D(0,-1,d),l){_.addPath(r,n,!0);const e=new Xt;u<h?e.setShiftCoords(o,0):e.setShiftCoords(-o,0),r.getImpl().applyTransformationToPath(e,n),_.addPath(r,n,!0);const a=new T,m=a.addGeometry(_);Nl(a,m,t,0,2,!0,s.xmin),Nl(a,m,t,0,2,!0,s.xmax),_=a.getGeometry(m);const l=Ye(_,s);l.inflateCoords(0,1);const g=pe(null,l,!0).total();_=Lt(_,s,g,Number.NaN,i)}else _.addPath(r,n,!0);return _}function pm(t,s,n,r){const i=new e;n.queryEnvelope(i);const o=Se(null,n,!0).total();if(s.xmin-i.xmin<=o&&i.xmax-s.xmax<=o)return n;const a=n.createInstance();let h=n.createInstance();const m=new e,l=n.getPathCount();for(let e=0;e<l;e++)n.queryPathEnvelope(e,m),s.xmin-m.xmin<=o&&m.xmax-s.xmax<=o?a.addPath(n,e,!0):(h.setEmpty(),h.addPath(n,e,!0),h=am(t,s,h,!0,r),a.add(h,!0));return a}function fm(e,t,s){const n=e.getPannableExtent(),r=We.construct(t,0);n.centerAt(r);const i=n.width(),o=.5*i,a=new We;a.setNAN();let h=Number.NaN;for(let m=0;m<s.getPathCount();m++)for(let e=s.getPathStart(m);e<s.getPathEnd(m);e++){const t=s.getXY(e),r=cc(t.y,n.ymax)||cc(n.ymin,t.y);e===s.getPathStart(m)?(a.setNAN(),h=0):a.isNAN()||r||(h=xm(t.x,a.x,o,i,h)),t.x+=h,s.setXY(e,t),r||a.setCoordsPoint2D(t)}s.getImpl().notifyModifiedFlags(2001)}function xm(e,t,s,n,r){return r+e-t>s?r-=n:t-(r+e)>s&&(r+=n),r}function ym(e,t,s,n,r,i){const o=t.getAttributeStreamRef(0),a=t.getPointCount();let h=!1;const m=new We;for(let P=0;P<a;++P){if(o.queryPoint2D(2*P,m),1&i&&m.y>=s){h=!0;break}if(2&i&&m.y<=-s){h=!0;break}}if(!h)return!1;let l=!1;e&&(l=t.getImpl().isClosedPathInXYPlane(0));const g=new T,u=g.addGeometry(t),c=g.getFirstPath(u);let _=-1,d=!0;const p=new We,f=new ae;let x=D;const y=Im*r/360;for(let P=g.getFirstVertex(c);P!==D;P=g.getNextVertex(P)){g.queryXY(P,m);let e=1&i&&m.y>=s?1:0;if(e|=2&i&&m.y<=-s?2:0,_>0&&_!==e){if(p.x!==m.x){const e=g.getPrevVertex(P);g.queryPoint(e,f);const t=g.insertVertex(c,P,f);p.x=m.x,g.setXY(t,p)}if(l){let e=x!==D?g.getNextVertex(x):g.getFirstVertex(c);const t=g.getPrevVertex(P);for(;e!==t;)e=g.removeVertex(e,!1);if(x!==D){const e=g.getXY(x),s=g.getXY(t);if(Math.abs(e.x-s.x)>y){g.queryPoint(x,f);const n=g.insertVertex(c,t,f);e.x=mt(e.x,s.x,.5),g.setXY(n,e)}}}x=D}if(e&&(m.y=Ze(n,m.y),g.setXY(P,m),!d&&_!==e))if(m.x!==p.x){g.queryPoint(P,f);const e=g.insertVertex(c,P,f);g.setXYCoords(e,p.x,m.y),x=e}else x=P;_=e,p.assign(m),d=!1}if(l){if(x!==D){let e=g.getNextVertex(x);for(;e!==D;)e=g.removeVertex(e,!1)}const e=g.getFirstVertex(c);let t=g.getLastVertex(c);const s=g.getXY(e),n=g.getXY(t);if(!s.equals(n)&&(g.queryPoint(e,f),t=g.insertVertex(c,D,f),Math.abs(s.x-n.x)>y)){const e=g.insertVertex(c,t,f);s.x=mt(s.x,n.x,.5),g.setXY(e,s)}}return t.assignCopy(g.getGeometry(u)),!0}function Pm(e,t){let s=new C({vd:e});s.addEnvelope(t,!1);const n=t.width()/180;return s=(new jt).execute(s,n,0,0,null),s}function Em(e,t){const s=e.getPannableExtent();return Number.isNaN(t)||s.centerAtCoords(t,0),s}function Sm(e,t,s){const n=vu();t.querySpheroidData(n);const r=t.getGCS()!==t?t.getSRToGCSTransform():null,i=lt(We,100),o=new oe(0,0,0),a=e.getPointCount(),h=t.getGCS().getUnit().getUnitToBaseFactor();for(let u=0,c=a;u<c;){const t=Math.min(100,c-u);e.queryCoordinates(i,t,u,u+t),r&&(new Hh).transform(r,i,t,i,!1);for(let e=0;e<t;e++){if(i[e].isNAN())continue;i[e].scale(h);const t=gs(n.majorSemiAxis,n.e2,i[e]);o.addThis(t)}u+=t}const m=ps(n.majorSemiAxis,n.e2,o);m.scale(1/h);const l=e;if(!new hm(t.getGCS(),m).project(l))return 0;s.length=e.getPathCount();const g=l.calculateArea2D()<0;for(let u=0,c=e.getPathCount();u<c;u++){const e=l.calculateRingArea2D(u),t=g?e<0:e>0;s[u]=t}return g?-1:1}function Cm(e,t,s,n,r){if(!t.isPannable()||e.isEmpty())return e;const i=e.getGeometryType();i===o.enumGeometryCollection&&h("not yet impl for geometry collection");const a=t.getPannableExtent();Number.isNaN(s)&&(s=a.getCenterX());const g=a.width(),u=.5*g,c=r>0,_=e.queryInterval(0,0);if(!c&&_.width()<u||!m(e.getGeometryType())){const t=_.getCenter();if(Math.abs(t-s)<=u)return e;{const n=new Xt,r=it((s-t)/g)*g;n.setShiftCoords(r,0);const i=e.clone();return i.applyTransformation(n),i}}if(i===o.enumPolygon){let i=new I({vd:e.getDescription()});i.addAndExplicitlyOpenAllPaths(e,!1),c&&(i=Ah(i,t,2,r,Number.NaN,null,!0));const o=[];if(!n){{let s=e;c&&(s=new C,s.add(i,!1));const n=Sm(e,t,o);if(n)n<0&&i.reverseAllPaths();else{const e=s.getPathCount();for(let t=0;t<e;t++)o.push(s.calculateRingArea2D(t)>0)}}n=o}return new bm(null,n,i,null,t,s,3,0,null).geoNormalizePolygonGeometry(!0)}if(i===o.enumPolyline){let n=new I({vd:e.getDescription()});n.addAndExplicitlyOpenAllPaths(e,!1),c&&(n=Ah(n,t,2,r,Number.NaN,null,!0));return new bm(null,null,n,null,t,s,3,0,null).geoNormalizePolylineGeometry(!0)}if(i===o.enumMultiPoint){const t=e,n=t.getAttributeStreamRef(0);let r,i=null,o=s,a=0;const h=.1*g;for(let s=0,m=t.getPointCount();s<m;s++){const t=n.read(2*s);let m=t-o;if(Math.abs(m)>u&&(m=it(m/g)*g,a-=m,Math.abs(a)<h&&(a=0)),0!==a){i||(r=e.clone(),i=r.getAttributeStreamRef(0));const n=t+a;i.write(2*s,n)}o=t}return i?(r.notifyModified(),r):e}l("")}const Im=210;class bm{constructor(e,t,n,r,i,o,a,h,m){this.m_bAdjustedAtPoles=0,this.m_inputPoly=n,this.m_progressTracker=m,this.m_originalGeometry=e,this.m_originalSR=r,this.m_polygonRingFlags=t,this.m_pannableSR=i,this.m_poleSnappingTolerance=h,this.m_poleFlags=a,this.m_bAdjustedAtPoles=0,this.m_pannableExtent=Em(this.m_pannableSR,o),this.m_centralLongitude=Number.isNaN(o)?this.m_pannableExtent.getCenterX():o,this.m_width360=this.m_pannableExtent.width(),this.m_degree=this.m_width360/360,this.m_GCSLargeDelta=Im*this.m_degree,s(null===this.m_originalGeometry&&null===this.m_originalSR||null!==this.m_originalGeometry&&null!==this.m_originalSR)}geonormalizeRing(e,t,n,r,i,o,a){let h=n;const m=new I({vd:this.m_inputPoly.getDescription()});m.addPath(this.m_inputPoly,e,!0),0!==this.m_poleFlags&&(this.m_bAdjustedAtPoles|=ym(!0,m,this.m_pannableExtent.ymax-this.m_poleSnappingTolerance,this.m_pannableExtent.ymax,this.m_pannableExtent.width(),this.m_poleFlags)?1:0,this.m_bAdjustedAtPoles&&(h=!1));let g=-1;h&&(g=this.m_originalGeometry.getPathStart(e));const u=m.getAttributeStreamRef(0),c=m.getPointCount();let _=0,d=u.read(0),p=0;const f=3*this.m_pannableSR.getTolerance(0);let x=!1;const y=new We,P=new We;let E=!1;const S=m.hasNonLinearSegments(),C=new We;for(let s=1;s<c;++s){u.queryPoint2D(2*s,C);const e=C.x;let t=e+_;const n=t-d;if(C.x=t,Math.abs(n)>this.m_GCSLargeDelta){if(h){const e=g+s-1,t=g+(s+1<c?s:0),i=o.read(2*e),a=(o.read(2*t)-i)*r;Math.abs(n-a)>1*this.m_degree&&(h=!1)}if(!h){_-=Ze(this.m_width360,t-d),t=e+_,++p,E=0!==_,C.x=t}}else x||he(y,P,C,f)&&(x=!0);E&&(S&&l("error in geonormalize_ring_ for curves"),u.write(2*s,t)),d=t,y.setCoordsPoint2D(P),P.setCoordsPoint2D(C)}p&&m.notifyModified();const b=m.getXY(0),w=m.getXY(c-1);if(We.distance(b,w)<f){const e=this.finalizeGeoNormalizeClosedRing(m,x,i);a.add(e,!1)}else{if(t<0)if(null!==this.m_originalGeometry){s(null!==this.m_originalGeometry);t=this.m_originalGeometry.calculateRingArea2D(e)>0?1:0}else t=1;const n=this.finalizeGeoNormalizeOpenedRing(t>0,m);a.add(n,!1)}}geoNormalizePolygonGeometry(t){s(this.m_originalSR&&this.m_originalGeometry||!this.m_originalGeometry&&!this.m_originalSR),s(this.m_pannableSR.isPannable());let n=null,r=Number.NaN;const i=!!this.m_originalSR&&this.m_originalSR.isPannable();i&&(n=this.m_originalGeometry.getAttributeStreamRef(0),r=this.m_width360/this.m_originalSR.getPannableExtent().width()),this.m_bAdjustedAtPoles=0;const o=new C({vd:this.m_inputPoly.getDescription()});for(let e=0,s=this.m_inputPoly.getPathCount();e<s;++e){const s=this.m_polygonRingFlags?this.m_polygonRingFlags[e]?1:0:-1;this.geonormalizeRing(e,s,i,r,t,n,o)}const a=this.m_pannableSR.getTolerance(0),h=this.m_pannableExtent.width()/180;kl(o,this.m_pannableExtent,.1*a,!1);const m=e.constructEmpty();if(m.setCoords({env2D:this.m_pannableExtent}),t){let t=!0;for(let s=0;s<2;s++){t=!0;const s=e.constructEmpty();for(let e=0,n=o.getPathCount();e<n;e++)if(o.queryPathEnvelope(e,s),!(m.xmin<=s.xmin&&m.xmax>=s.xmax||s.xmin>=m.xmax||s.xmax<=m.xmin)){t=!1;break}if(t)break;m.move(.5*this.m_width360,0)}t||m.setCoords({env2D:this.m_pannableExtent})}let l=Lt(o,m,a,h,this.m_progressTracker),g=o!==l;const u=this.m_originalGeometry?this.m_originalGeometry.calculateArea2D():1,c=l.calculateArea2D();let _=0;if(c>0&&u<0)_=1;else if(c<=0&&u>0)if(0===c){if(this.m_originalSR){let e=Number.NaN;2===this.m_originalSR.getCoordinateSystemType()?e=this.m_originalSR.getPCSHorizon().calculateArea2D():1===this.m_originalSR.getCoordinateSystemType()&&(e=this.m_originalSR.getPannableExtent().getArea()),u>.99*e&&(_=-1)}}else _=-1;if(0!==_){const e=Pm(l.getDescription(),m);e.add(l,!1),g=!0,l=e}return g&&(l=(new ph).execute(l,this.m_pannableSR,!1,this.m_progressTracker)),l}geoNormalizePolylineGeometry(t){s(this.m_pannableSR.isPannable());let n=null;const r=this.m_originalSR&&this.m_originalSR.isPannable();let i=1;r&&(s(this.m_originalGeometry),i=this.m_width360/this.m_originalSR.getPannableExtent().width(),n=this.m_originalGeometry.getAttributeStreamRef(0));const o=this.m_pannableExtent.width(),a=o*ot()*4;let h=t,m=Number.NaN;const g=Ke.constructEmpty();this.m_bAdjustedAtPoles=0;let u=new I({vd:this.m_inputPoly.getDescription()});for(let d=0,p=this.m_inputPoly.getPathCount();d<p;++d){let t=r;const c=new I({vd:this.m_inputPoly.getDescription()});c.addPath(this.m_inputPoly,d,!0);const _=this.m_inputPoly.isClosedPath(d);0!==this.m_poleFlags&&(this.m_bAdjustedAtPoles|=ym(_,c,this.m_pannableExtent.ymax-this.m_poleSnappingTolerance,this.m_pannableExtent.ymax,o,this.m_poleFlags)?1:0,this.m_bAdjustedAtPoles&&(t=!1));let p=-1;const f=c.getPointCount();let x=!1;t&&(p=this.m_originalGeometry.getPathStart(d),x=this.m_originalGeometry.isClosedPath(d));const y=c.getAttributeStreamRef(0);let P=0,E=y.read(0),S=0;const C=new We,b=new We;let w=!1;const v=c.hasNonLinearSegments(),T=new We;for(let e=1;e<f;++e){y.queryPoint2D(2*e,T);const s=T.x;let r=s+P;const o=r-E;if(T.x=r,Math.abs(o)>this.m_GCSLargeDelta){if(t){const s=p+e-1;let r=p;(!x||e+1<f)&&(r+=e);const a=n.read(2*s),h=(n.read(2*r)-a)*i;Math.abs(o-h)>1*this.m_degree&&(t=!1)}if(!t){P-=Ze(this.m_width360,r-E),r=s+P,++S,w=0!==P,T.x=r}}w&&(v&&l("error in geonormalize_ring_ for curves"),y.write(2*e,r)),E=r,C.setCoordsPoint2D(b),b.setCoordsPoint2D(T)}if(S&&c.notifyModified(),h){let t=!1;if(!c.isEmpty()){const n=e.constructEmpty();if(c.queryEnvelope(n),n.width()>=o||n.ymin<=this.m_pannableExtent.ymin||n.ymax>=this.m_pannableExtent.ymax)t=!0;else{if(Number.isNaN(m)){const e=this.m_centralLongitude-.5*o;m=n.xmin,m+=Math.round((e-n.xmin)/o)*o,m>e&&(m-=o),s(m<=e),m<e&&(m+=o),s(m>=e)}let e=Math.round((m-n.xmin)/o)*o;if(n.xmin+e>m+a&&(e-=o),n.xmin+e<m-a&&(e+=o),g.mergeCoordinate(n.xmin+e),g.mergeCoordinate(n.xmax+e),t=g.width()>=o,!t){const t=new Xt;t.setShiftCoords(e,0),c.applyTransformation(t)}}}u.add(c,!1),t&&(u=(()=>{const e=new I({vd:u.getDescription()});for(let t=0,s=u.getPathCount();t<s;++t){const s=new I({vd:u.getDescription()});s.addPath(u,t,!0);const n=El(s,this.m_pannableSR,this.m_centralLongitude,!0,0,this.m_progressTracker);e.add(n,!1)}return e})(),h=!1)}else{const e=El(c,this.m_pannableSR,this.m_centralLongitude,!0,0,this.m_progressTracker);u.add(e,!1)}}if(h)return u;const c=this.m_pannableSR.getTolerance(0),_=this.m_pannableExtent.width()/180;kl(u,this.m_pannableExtent,.1*c,!1);return Lt(u,this.m_pannableExtent,c,_,this.m_progressTracker)}finalizeGeoNormalizeOpenedRing(t,n){const r=n.getPointCount(),i=n.getXY(0),o=n.getXY(r-1);{const e=Math.abs(o.x-i.x),t=Math.round(e/this.m_width360)*this.m_width360;s(Math.abs(e-t)<this.m_pannableSR.getTolerance(0))}const a=Qe(o.x-i.x),h=e.constructEmpty();n.queryLooseEnvelope(h);const m=this.m_pannableExtent.getCenterX();let l=0,g=m-this.m_width360,u=m+this.m_width360;if(a>=0){let e=Math.ceil((g-h.xmin)/this.m_width360);for(e*=this.m_width360;g>h.xmin+e;)e+=this.m_width360;for(;g<h.xmax+e;)e-=this.m_width360;for(l=e,h.width()>720&&(u=g+360*Math.ceil(h.width()/360));u<h.xmax;)u+=this.m_width360}else{let e=Math.ceil((u-h.xmax)/this.m_width360);for(e*=this.m_width360;u<h.xmax+e;)e-=this.m_width360;for(;u>h.xmin+e;)e+=this.m_width360;for(l=e,h.width()>720&&(g=u-360*Math.ceil(h.width()/360));g>h.xmin;)g-=this.m_width360}const c=Math.round(Math.abs(o.x-i.x)/this.m_width360)*this.m_width360,_=a*c,d=h.clone();d.move(l,0);const p=new We(0,0),f=new Xt;f.setShiftCoords(l,0),n.applyTransformation(f);const x=new I({vd:n.getDescription()});x.add(n,!1),p.assign(n.getXY(r-1));let y=0,P=x.getXY(0).x;for(;a>0?d.xmax<u:d.xmin>g;)d.move(_,0),f.xd=_,n.applyTransformation(f),P+=_,this.m_pannableExtent.xmin<=P&&this.m_pannableExtent.xmax>=P&&(y=x.getPointCount()-1),n.setXY(0,p),p.assign(n.getXY(r-1)),x.addSegmentsFromPath(n,0,0,r-1,!1);const E=new C({vd:x.getDescription()});E.add(x,!1);const S=x.getXY(0),b=x.getXY(x.getPointCount()-1),w=a<0?t:!t,v=E.getPointCount()-1;if(w){const e=new We(b.x,this.m_pannableExtent.ymax);E.lineTo(e);const t=new We(this.m_pannableExtent.getCenterX(),this.m_pannableExtent.ymax);E.lineTo(t);const s=new We(S.x,this.m_pannableExtent.ymax);E.lineTo(s)}else{const e=new We(b.x,this.m_pannableExtent.ymin);E.lineTo(e);const t=new We(this.m_pannableExtent.getCenterX(),this.m_pannableExtent.ymin);E.lineTo(t);const s=new We(S.x,this.m_pannableExtent.ymin);E.lineTo(s)}if(E.interpolateAttributesPath(0,v,0),E.getImpl().changeRingStartPoint(y),c>this.m_width360){const e=new C({copy:E});f.setShiftCoords(this.m_width360,0),e.applyTransformation(f),E.add(e,!1)}return E}finalizeGeoNormalizeClosedRing(t,s,n){const r=new C({vd:t.getDescription()});r.add(t,!1);const i=()=>{const e=r.getPointCount()-2;return r.getSegmentType(e)!==o.enumLine};if(r.hasNonLinearSegments()&&i()){const e=new b,t=r.getPointCount()-2;r.getSegmentBuffer(t,e,!1),r.removePointFromPath(0,t+1),r.closeLastPathWithSegment(e.get())}else r.removePointFromPath(0,r.getPointCount()-1);const a=e.constructEmpty();r.queryLooseEnvelope(a);let h=Math.ceil((this.m_pannableExtent.xmin-a.xmin)/this.m_width360);for(h*=this.m_width360;this.m_pannableExtent.xmin>a.xmin+h;)h+=this.m_width360;for(;this.m_pannableExtent.xmin<a.xmax+h;)h-=this.m_width360;if(h+=this.m_width360,0!==h){a.move(h,0);const e=new Xt;e.setShiftCoords(h,0),r.applyTransformation(e)}if(this.m_pannableExtent.xmin<=a.xmin&&this.m_pannableExtent.xmax>=a.xmax){if(s){const e=r.calculateArea2D(),t=(new ph).execute(r,this.m_pannableSR,!0,this.m_progressTracker);if(t!==r){const s=t.calculateArea2D();Qe(e)!==Qe(s)&&t.reverseAllPaths(),r.assignMove(t)}}let e;if(e=new C(n?{copy:r}:{move:r}),n)for(;a.xmin<this.m_pannableExtent.xmax;){a.move(this.m_width360,0);const t=new Xt;t.setShiftCoords(this.m_width360,0),r.applyTransformation(t),e.add(r,!1)}return e}let m=new C({vd:t.getDescription()});m.add(r,!1);const l=s||a.width()>this.m_width360-10*this.m_pannableSR.getTolerance(0);for(;a.xmin<this.m_pannableExtent.xmax;){a.move(this.m_width360,0);const e=new Xt;e.setShiftCoords(this.m_width360,0),r.applyTransformation(e),m.add(r,!1)}if(l){const e=m.calculateArea2D();m.setFillRule(1),m=(new ph).execute(m,this.m_pannableSR,!0,this.m_progressTracker);const t=m.calculateArea2D();Qe(e)!==Qe(t)&&m.reverseAllPaths()}return m}geonormalize_ring_(e,t,n,r,i,o,a){s(0)}}function wm(e){s(0);const t=$g(e),n=new Nm;return n.setVertProj_(t),n}function vm(e,t=!0){return s(0),{}}function Tm(e){return du()}class Nm{constructor(){this.m_hashCode=0,this.m_peVertSysVal=null,this.m_verticalUnit=new xu,this.m_verticalShift=0,this.m_userVerticalWKID=0,this.m_bIsDepth=!1}getType(){return s(0),0}getID(){return s(0),0}getLatestID(){return this.m_peVertSysVal?this.m_peVertSysVal.getLatestID():0}getOldID(){return this.m_peVertSysVal?this.m_peVertSysVal.getOldID():0}getText(){return s(0),""}getTextExtended(e){return s(0),""}getText2(e){return s(0),""}getUnit(){return s(0),{}}equals(e){return s(0),!1}equalForProjection(e){return s(0),!1}getPeVertcsCopy(){return s(0),{}}getOneMeter(){return 1/this.m_verticalUnit.getUnitToBaseFactor()}getUnitToBaseFactor(){return s(0),0}isDepth(){return s(0),!1}getVerticalShift(){return s(0),0}isCustomWkid(){return!!this.m_peVertSysVal&&this.m_peVertSysVal.isCustomWkid()}getHashCode(){return this.m_hashCode}setVertProj_(e){this.m_peVertSysVal=e}getPEVerticalCoordSys(){return this.m_peVertSysVal?this.m_peVertSysVal.m_peVertcs:null}}function Gm(e,t,s,n,r){if(e.equals(t))return!1;if(n){let s=1,i=0,o=1,a=1,h=0,m=1;Number.isNaN(e.m_heightMetersPerUnit)||(s=e.m_heightMetersPerUnit,i=e.m_heightZ0,o=e.m_heightSign,a=t.m_heightMetersPerUnit,h=t.m_heightZ0,m=t.m_heightSign);const l=o*m*s/a;for(let e=0;e<r;e++)n[e]=(n[e]-i)*l+h}let i=1,o=0;if(Number.isNaN(e.m_XYToRadians)||(i=e.m_XYToRadians/t.m_XYToRadians,o=e.m_PrimeMeridianDegrees-t.m_PrimeMeridianDegrees,0!==o&&(o=Z(o),o/=t.m_XYToRadians)),Array.isArray(s)){const e=s;for(let t=0;t<r;t++)e[t][0]=e[t][0]*i+o,e[t][1]=e[t][1]*i}else{const e=s;for(let t=0;t<r;t++){const s=t<<1;e[s]=e[s]*i+o,e[s+1]=e[s+1]*i}}return!0}function Dm(){return{m_heightMetersPerUnit:0,m_heightSign:0,m_heightZ0:0,m_XYToRadians:0,m_PrimeMeridianDegrees:0,assign(e){this.m_heightMetersPerUnit=e.m_heightMetersPerUnit,this.m_heightSign=e.m_heightSign,this.m_heightZ0=e.m_heightZ0,this.m_XYToRadians=e.m_XYToRadians,this.m_PrimeMeridianDegrees=e.m_PrimeMeridianDegrees},equals(e){return rt(this.m_heightSign,e.m_heightSign)&&rt(this.m_heightMetersPerUnit,e.m_heightMetersPerUnit)&&rt(this.m_heightZ0,e.m_heightZ0)&&rt(this.m_XYToRadians,e.m_XYToRadians)&&rt(this.m_PrimeMeridianDegrees,e.m_PrimeMeridianDegrees)},initFromGcsAndVcsPe(e,t){this.m_heightSign=1,this.m_heightMetersPerUnit=Number.NaN,this.m_heightZ0=0,this.m_XYToRadians=Number.NaN,this.m_PrimeMeridianDegrees=Number.NaN,t&&s(0),e&&(this.m_XYToRadians=e.getUnit().getUnitFactor(),this.m_PrimeMeridianDegrees=e.getPrimem().getLongitude())},initFromGcsAndVcs(e,t){const s=e?e.getPECoordSys():null,n=t?t.getPEVerticalCoordSys():null;this.initFromGcsAndVcsPe(s,n)},processUnitParams(e){Number.isNaN(this.m_heightMetersPerUnit)&&(this.m_heightMetersPerUnit=e.m_heightMetersPerUnit,this.m_heightSign=e.m_heightSign,this.m_heightZ0=e.m_heightZ0),Number.isNaN(this.m_XYToRadians)&&(this.m_XYToRadians=e.m_XYToRadians,this.m_PrimeMeridianDegrees=e.m_PrimeMeridianDegrees)}}}class Vm{constructor(e){this.m_constantsLoaded=-1,this.m_isUsable=-1,this.m_inputSR=null,this.m_outputSR=null,this.m_inputSRHorz=null,this.m_outputSRHorz=null,this.m_inputVCS=null,this.m_outputVCS=null,this.m_hashCode=0,this.m_areaOfUse=new ge,this.m_inputUnitParams=Dm(),this.m_outputUnitParams=Dm(),s(e),this.m_geogTran=e,this.m_vertTran=null,this.m_latestID=fc.getCode(this.m_geogTran),this.m_latestID<0&&(this.m_latestID=0);const t=this.m_geogTran.getGeogcs1();fc.getCode(t);const n=this.m_geogTran.getGeogcs2();fc.getCode(n),this.initUnitParams()}getLatestId(){return this.m_latestID}getText(){return this.m_geogTran?this.m_geogTran.toString():(s(0),"")}getGeogtran(){return this.m_geogTran}getVerttran(){return null}loadConstants(e){let t=this.m_constantsLoaded;if(-1===t){if(!e){this.m_geogTran||l("vcs not impl");const t=this.m_geogTran.getParameters();null!==t[xc.PE_PARM_ND]&&(e=0===t[xc.PE_PARM_ND].getValue())}t=this.m_geogTran.loadConstants()?1:0,this.m_constantsLoaded=t}return 0!==t}isUsable(){let e=this.m_isUsable;return-1===e&&(this.m_geogTran?this.m_isUsable=e=this.m_geogTran?1:0:this.m_isUsable=e=this.m_vertTran?1:0),1===e}getInputSr(e){return this.updateSrs(),e?this.m_inputSR:this.m_inputSRHorz}getOutputSr(e){return this.updateSrs(),e?this.m_outputSR:this.m_outputSRHorz}getHashCode(){let e=this.m_hashCode;return 0===e&&(e=this.m_latestID>0?ze(this.m_latestID):dt(this.getText()),0===e&&(e=345),this.m_hashCode=e),e}isGeogtran(){return null!==this.m_geogTran}prepareOrThrow(){}getName(){return this.isGeogtran()?this.getGeogtran().getName():(h("vcs not impl"),"")}updateSrs(){if(this.m_inputSR||this.m_inputVCS)return;let e,t,n,r,i,o;if(this.m_geogTran){const s=this.m_geogTran.getGeogcs1(),a=Qg(s),h=this.m_geogTran.getGeogcs2(),m=Qg(h);let l=-1,g=-1;l=a.getVcsCode(),g=m.getVcsCode(),n=Au(s,null,null,1),r=Au(h,null,null,1),l>0&&g>0?(i=wm(l),o=wm(g),e=qu(),t=qu()):(e=n,t=r)}else s(0);this.m_inputSR||this.m_inputVCS||(this.m_inputSR=e,this.m_outputSR=t,this.m_inputSRHorz=n,this.m_outputSRHorz=r,this.m_inputVCS=i,this.m_outputVCS=o)}initUnitParams(){if(this.m_inputUnitParams.m_heightSign=1,this.m_inputUnitParams.m_heightMetersPerUnit=Number.NaN,this.m_inputUnitParams.m_heightZ0=0,this.m_outputUnitParams.m_heightSign=1,this.m_outputUnitParams.m_heightMetersPerUnit=Number.NaN,this.m_outputUnitParams.m_heightZ0=0,this.m_inputUnitParams.m_XYToRadians=Number.NaN,this.m_inputUnitParams.m_PrimeMeridianDegrees=Number.NaN,this.m_outputUnitParams.m_XYToRadians=Number.NaN,this.m_outputUnitParams.m_PrimeMeridianDegrees=Number.NaN,this.m_vertTran)s(0);else if(this.m_geogTran){const e=this.m_geogTran;let t=e.getGeogcs1();this.m_inputUnitParams.m_XYToRadians=t.getUnit().getUnitFactor(),this.m_inputUnitParams.m_PrimeMeridianDegrees=t.getPrimem().getLongitude(),t=e.getGeogcs2(),this.m_outputUnitParams.m_XYToRadians=t.getUnit().getUnitFactor(),this.m_outputUnitParams.m_PrimeMeridianDegrees=t.getPrimem().getLongitude()}}}function Fm(e,t,s,n,r,i,o){let a=null;if(t){a=t.getPEVerticalCoordSys()}let h=null;if(e){h=e.getPECoordSys()}let m=null;if(n){m=n.getPEVerticalCoordSys()}let l=null;if(s){l=s.getPECoordSys()}if(!(h||a||l||m))return!1;const g=Dm();g.initFromGcsAndVcsPe(h,a);const u=Dm();return u.initFromGcsAndVcsPe(l,m),Gm(g,u,r,i,o)}function Hm(e,t,s,n,r,i,o,a){const h=t,m=e,l=Dm();l.initFromGcsAndVcsPe(m,h),a.assign(n?s.m_outputUnitParams:s.m_inputUnitParams),a.processUnitParams(l),l.processUnitParams(a),o>0&&Gm(l,a,r,i,o)}function km(e,t,s,n,r,i,o,a){const h=Dm();h.assign(s?t.m_inputUnitParams:t.m_outputUnitParams),h.processUnitParams(e);let m=null,l=null;if(n){l=n.getPECoordSys()}const g=Dm();g.initFromGcsAndVcsPe(l,m),g.processUnitParams(h),h.processUnitParams(g),a>0&&Gm(h,g,i,o,a)}function Am(e,t,s,n,r,i,o,a,h){const m=Dm(),l=Dm();m.assign(s?t.m_inputUnitParams:t.m_outputUnitParams),l.assign(r?n.m_outputUnitParams:n.m_inputUnitParams),m.processUnitParams(e),l.processUnitParams(m),m.processUnitParams(l),a>0&&Gm(m,l,i,o,a),h.assign(l)}function Mm(e,t,s,n,r,i,o){const a=t.getVerttran(),h=t.getGeogtran();if(o.assign(s?t.m_inputUnitParams:t.m_outputUnitParams),o.processUnitParams(e),i>0){t.prepareOrThrow();const e=s?xc.PE_TRANSFORM_2_TO_1:xc.PE_TRANSFORM_1_TO_2;a?mg():lg(h,i,n,r,e)}}function Um(e,t,s,n,r){const i=e.getVerttran(),o=e.getGeogtran();if(r>0){e.prepareOrThrow();const a=t?xc.PE_TRANSFORM_2_TO_1:xc.PE_TRANSFORM_1_TO_2;i?mg():lg(o,r,s,n,a)}}class qm{supportsCurves(){return!0}accelerateGeometry(e,t,s){return Om(e,t,s)}canAccelerateGeometry(e){return Bm(e)}}function Om(e,t,s){if(!Bm(e))return!1;Ie(t,e,!1);let n=0;const r=e.getGeometryType();return c(r)&&R(e)&&0!==s&&(n|=e.getImpl().buildQuadTreeAccelerator(s)?1:0),c(r)&&Y(e)&&0!==s&&(n|=e.getImpl().buildQuadTreeForPathsAccelerator(s)?1:0),n>0}function Bm(e){return R(e)||Y(e)}class Rm extends qm{getOperatorType(){return 8}execute(e,t,s,n){return Dr(e,t,s,1,n)}}function Ym(s,n,r,i){if(s.isEmpty()||n.isEmpty())return s;const h=s.getDimension(),m=n.getDimension();if(h>m)return s;const l=s.getGeometryType(),g=n.getGeometryType(),u=new e,c=new e,_=new e;s.queryEnvelope(u),n.queryEnvelope(c),_.setCoords({env2D:u}),_.mergeEnvelope2D(c);const d=pe(r,_,!0),p=ye(d),f=new e;if(f.setCoords({env2D:u}),f.inflateCoords(p,p),!f.isIntersecting(c))return s;if(1===h&&2===m){const e=el(s,n,g,r,i);if(e)return e}if(l===o.enumPoint){let e;switch(a(g)?(e=new I({vd:n.getDescription()}),e.addSegment(n,!0)):e=n,g){case o.enumPolygon:return zm(s,e,d);case o.enumPolyline:return Wm(s,e,d);case o.enumMultiPoint:return jm(s,e,d);case o.enumEnvelope:return Zm(s,e,d);case o.enumPoint:return Km(s,e,d);default:t("invalid shape type")}}else if(l===o.enumMultiPoint)switch(g){case o.enumPolygon:return Qm(s,n,d);case o.enumEnvelope:return Jm(s,n,d);case o.enumPoint:return $m(s,n,d)}const x=new e(u);x.inflate(100*d.total());return Ma(s,Lt(n,x,0,0,i),r,i)}class Xm{getOperatorType(){return 10002}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n){return new Lm(e,t,s,n)}execute(e,t,s,n){return this.executeMany(new Kt([e]),new Kt([t]),s,n).next()}}class Lm extends Zt{constructor(e,t,s,n){super(),this.m_progressTracker=n,this.m_index=-1,this.m_inputGeoms=e,this.m_spatialReference=s;const r=t.next();this.m_geomSubtractor=r||new C}next(){const e=this.m_inputGeoms.next();return e?(r(e),P(e),this.m_index=this.m_inputGeoms.getGeometryID(),Ym(e,this.m_geomSubtractor,this.m_spatialReference,this.m_progressTracker)):null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}}function zm(e,t,s,n){return 0===Oo(t,e,s.total())?e:e.createInstance()}function Wm(t,s,n,r){const i=t.getXY(),o=s.querySegmentIterator(),a=ye(n),h=a*a;for(;o.nextPath();)for(;o.hasNextSegment();){const s=o.nextSegment(),r=new e;if(s.queryEnvelope(r),r.inflateCoords(a,a),!r.contains(i))continue;if(s.isIntersectingPoint(i,n.total()))return t.createInstance();let m=s.getStartXY();if(We.sqrDistance(i,m)<=h)return t.createInstance();if(m=s.getEndXY(),We.sqrDistance(i,m)<=h)return t.createInstance()}return t}function jm(e,t,s,n){const r=t.getImpl().getAttributeStreamRef(0),i=t.getPointCount(),o=e.getXY(),a=ye(s),h=a*a,m=new We;for(let l=0;l<i;l++){r.queryPoint2D(2*l,m);if(We.sqrDistance(m,o)<=h)return e.createInstance()}return e}function Zm(t,s,n,r){const i=new e;s.queryEnvelope(i),i.inflate(n.total());const o=t.getXY();return i.contains(o)?t.createInstance():t}function Km(e,t,s,n){const r=ye(s),i=r*r,o=e.getXY(),a=t.getXY();return We.sqrDistance(o,a)<=i?e.createInstance():e}function Qm(t,s,n,r){const i=new e;s.queryEnvelope(i),i.inflate(n.total());const o=t.getPointCount();let a=!1;const h=$e(o,!1),m=new We;for(let e=0;e<o;e++){if(t.queryXY(e,m),!i.contains(m))continue;0!==Bo(s,m,n.total())&&(a=!0,h[e]=!0)}if(!a)return t;const l=t.createInstance();for(let e=0;e<o;e++)h[e]||l.addPoints(t,e,e+1);return l}function Jm(t,s,n,r){const i=new e;s.queryEnvelope(i),i.inflate(n.total());const o=t.getPointCount();let a=!1;const h=$e(o,!1),m=new We;for(let e=0;e<o;e++)t.queryXY(e,m),i.contains(m)&&(a=!0,h[e]=!0);if(!a)return t;const l=t.createInstance();for(let e=0;e<o;e++)h[e]||l.addPoints(t,e,e+1);return l}function $m(e,t,s,n){const r=e.getImpl().getAttributeStreamRef(0),i=e.getPointCount(),o=t.getXY();let a=!1;const h=$e(i,!1),m=ye(s),l=m*m,g=new We;for(let c=0;c<i;c++){r.queryPoint2D(2*c,g);We.sqrDistance(g,o)<=l&&(a=!0,h[c]=!0)}if(!a)return e;const u=e.createInstance();for(let c=0;c<i;c++)h[c]||u.addPoints(e,c,c+1);return u}function el(t,s,n,r,i){const a=new ge;t.queryEnvelope(a);const h=new e;s.queryEnvelope(h),a.merge(h);const m=.1*a.width(),l=.1*a.height();a.inflateCoords(m,l);const g=new C;g.addEnvelope(a,!1);const u=g.getImpl();if(n===o.enumPolygon){const e=s.getImpl();u.add(e,!0)}else u.addEnvelope(s,!0);return new yh(g,r,-1,i).tryFastImplementation(t)}class tl{getOperatorType(){return 10001}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n=0){return new il(e,t,s,n)}execute(e,t,s,n){const r=new Kt([e,t]),i=new il(r,s,n,0).next();return i||l("null output"),i}}function sl(){return{geom:null,vertexCount:-1,bUnioned:!1,location:new We}}function nl(e,t){return We.compareZorder(e.location,t.location)?-1:e.location.equals(t.location)?0:1}class rl{constructor(){this.binVertexCount=0,this.geometries=[]}addPair(e){this.binVertexCount+=e.vertexCount,this.geometries.push(e)}sort(){this.geometries.sort(((e,t)=>nl(e,t)))}geomCount(){return this.geometries.length}geomPairs(){return this.geometries}clear(){this.binVertexCount=0,this.geometries.length=0}getBinVertexCount(){return this.binVertexCount}}class il extends Zt{constructor(e,t,s,n,r=!1){super(),this.m_index=-1,this.m_currentDim=-1,this.m_bDone=!1,this.m_unionBins=[],this.m_readyGeoms=Je(4),this.m_dimGeomCounts=$e(4,0),this.m_addedGeoms=0,this.m_maxDimension=-1,this.m_bHadGeometry=$e(4,!1),this.m_complexUnionGeoms=Je(4),this.m_totalNonEmptyGeomCounters=$e(4,0),this.m_progressTracker=s,this.m_bUnionAllDimensions=!!(4&n),this.m_bPreserveAllPathEnds=!!(8&n),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_options=n,this.m_bIs3D=r}next(){if(this.m_bDone&&this.m_currentDim===this.m_maxDimension)return null;for(;!this.step_(););if(-1===this.m_maxDimension)return null;if(this.m_bUnionAllDimensions){if(-1===this.m_currentDim)for(let e=0;e<=this.m_maxDimension;e++)if(this.m_bHadGeometry[e]){this.m_complexUnionGeoms[e]=this.getResultGeometry(e);for(let t=e+1;t<=this.m_maxDimension;t++)this.m_complexUnionGeoms[t]=this.getResultGeometry(t),this.m_bHadGeometry[t]&&!this.m_complexUnionGeoms[t].isEmpty()&&(this.m_bIs3D?s(0):this.m_complexUnionGeoms[e]=(new Xm).execute(this.m_complexUnionGeoms[e],this.m_complexUnionGeoms[t],this.m_spatialReference,this.m_progressTracker))}for(;this.m_currentDim++,(this.m_currentDim>this.m_maxDimension||this.m_currentDim<0)&&l(""),!this.m_bHadGeometry[this.m_currentDim];);if(this.m_index++,0===this.m_currentDim&&this.m_complexUnionGeoms[this.m_currentDim].getGeometryType()===o.enumPoint){const e=new w({vd:this.m_complexUnionGeoms[this.m_currentDim].getDescription()});return this.m_complexUnionGeoms[this.m_currentDim].isEmpty()||e.add(this.m_complexUnionGeoms[this.m_currentDim]),e}return this.m_complexUnionGeoms[this.m_currentDim]}return this.m_index=0,this.m_currentDim=this.m_maxDimension,this.getResultGeometry(this.m_maxDimension)}getGeometryID(){return this.m_index}getRank(){return 1}tock(){return this.step_()}getResultGeometry(e){return this.m_readyGeoms[e]}finishDim(e,t,n){let r=t;if(!n)return 16&this.m_options?(r=Ya([r],1,this.m_spatialReference,this.m_progressTracker,this.m_options,this.m_bIs3D),r):r;if(1&this.m_options)return r;if(1===e){if(!(8&this.m_options)&&(!!(16&this.m_options)||this.m_totalNonEmptyGeomCounters[e]>1)){r=Ya([r],1,this.m_spatialReference,this.m_progressTracker,16|this.m_options,this.m_bIs3D);const e=[0],t=r.getImpl().getIsSimple(0,e);s(this.m_bIs3D||me(t))}else 1===this.m_totalNonEmptyGeomCounters[e]&&(this.m_bIs3D?s(0):r=(new ph).execute(r,this.m_spatialReference,!1,this.m_progressTracker))}else this.m_bIs3D?s(0):r=(new ph).execute(r,this.m_spatialReference,!1,this.m_progressTracker);if(0===e&&r.getGeometryType()===o.enumPoint){const e=new w({vd:r.getDescription()});r.isEmpty()||e.add(r),r=e}return r}static getLevel(e){const t=4,s=g(e);let n=s>0?(Math.log(s)-Math.log(32))/Math.log(t):0;return n<0&&(n=0),Math.floor(n)}step_(){if(this.m_bDone)return!0;let e;if(this.m_inputGeoms?(e=this.m_inputGeoms.next(),null===e?(this.m_bDone=!0,this.m_inputGeoms=null):(this.checkAndThrow(e),e.isEmpty()||this.m_totalNonEmptyGeomCounters[e.getDimension()]++)):e=null,null!==e){const t=e.getDimension();this.m_bHadGeometry[t]=!0,(t>=this.m_maxDimension||this.m_bUnionAllDimensions)&&(this.addGeom(t,!1,e),t>this.m_maxDimension&&!this.m_bUnionAllDimensions&&this.removeAllBinsWithLowerDimension(t))}if(this.m_addedGeoms>0)for(let t=0;t<=this.m_maxDimension;t++){for(;this.m_dimGeomCounts[t]>1;){const e=this.collectGeometriesToUnion(t);if(null===e)break;{let s;s=1&this.m_options?Ya(e,e.length,this.m_spatialReference,this.m_progressTracker,this.m_options,this.m_bIs3D):Xa(e,e.length,this.m_spatialReference,this.m_progressTracker,8|this.m_options,this.m_bIs3D),this.addGeom(t,!0,s)}}if(this.m_bDone&&(s(this.m_dimGeomCounts[t]<=1),0!==this.m_dimGeomCounts[t])){const e=this.m_unionBins[t].entries().next().value,s=e[1].geomPairs()[0].geom,n=e[1].geomPairs()[0].bUnioned;this.m_unionBins[t].clear(),this.m_readyGeoms[t]=this.finishDim(t,s,n)}}return this.m_bDone}addGeom(t,s,n){const r=sl();r.geom=n;const i=g(n);r.vertexCount=i;const o=e.constructEmpty();n.queryEnvelope(o),r.location=i>0?o.getCenter():new We(0,0);const a=il.getLevel(n);if(t+1>this.m_unionBins.length)for(;this.m_unionBins.length<Math.max(2,t+1);)this.m_unionBins.push(new Map);let h=null;const m=this.m_unionBins[t].get(a);m&&(h=m),null===h&&(h=new rl,this.m_unionBins[t].set(a,h)),r.bUnioned=s,h.addPair(r),this.m_dimGeomCounts[t]++,this.m_addedGeoms++,this.m_maxDimension=Math.max(this.m_maxDimension,t)}removeAllBinsWithLowerDimension(e){for(let t=0;t<e;t++)this.m_unionBins[t].clear(),this.m_addedGeoms-=this.m_dimGeomCounts[t],this.m_dimGeomCounts[t]=0}collectGeometriesToUnion(e){if(1&this.m_options&&!this.m_bDone)return null;let t=null;const s=[];for(const n of this.m_unionBins[e].keys())s.push(n);et(s);for(let n=0;n<s.length;n++){if(-1===s[n])continue;const r=this.m_unionBins[e].get(s[n]);{const i=5e3,o=4,a=r.getBinVertexCount()>i&&r.geomCount()>=o;if(this.m_bDone||a){for(let r=0;r<n;r++){if(-1===s[r])continue;const n=this.m_unionBins[e].get(s[r]);n.sort(),this.m_dimGeomCounts[e]-=n.geomCount(),this.m_addedGeoms-=n.geomCount();for(const e of n.geomPairs())t||(t=new Array),t.push(e.geom);n.clear(),this.m_unionBins[e].delete(s[r]),s[r]=-1}r.sort(),this.m_dimGeomCounts[e]-=r.geomCount(),this.m_addedGeoms-=r.geomCount();for(const e of r.geomPairs())t||(t=new Array),t.push(e.geom);if(r.clear(),this.m_unionBins[e].delete(s[n]),s[n]=-1,!this.m_bDone)break}}}return t}checkAndThrow(e){this.m_bIs3D&&(e.getDimension()>1&&u(),e.hasAttribute(1)||t("Geometry must have Zs")),r(e)}}class ol extends qm{getOperatorType(){return 3}execute(e,t,s,n=null){return Dr(e,t,s,4,n)}}function al(t,s,n){const r=s.getGCSSplitLines();if(null===r)return t;const i=s.getGCS(),o=i.getPannableExtent().width(),a=e.constructEmpty();t.queryLooseEnvelope(a);const h=Ke.constructEmpty();a.queryIntervalX(h);const m=r.querySegmentIterator();let l=null;const g=new Xt;for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),t=e.queryInterval(0,0),s=Ke.constructEmpty();s.setCoordsFromEnvelope(t);let n=0;for(;s.vmax>h.vmin;)s.move(-o),n--;for(;s.vmin<=h.vmax;){if(s.isIntersecting(h)){null===l&&(l=new I);const t=new V({start:e.getStartXY(),end:e.getEndXY()});0!==n&&(g.setShiftCoords(n*o,0),t.applyTransformation(g)),l.addSegment(t,!0)}s.move(o),++n}}if(null!==l){const e=Se(i,l,!0);return Hn(t,l,ye(e),n)}return t}function hl(e,t,s){let n=e.getName();return Zu(n)||(s||t>0?(n=e.toString(xc.PE_STR_NAME_CANON|xc.PE_STR_AUTH_NONE),n=cl(n)):n=e.toString(xc.PE_STR_AUTH_TOP)),n}function ml(e,t,n,r){return s(0),""}function ll(e,s=-1){if((s>1||s<-1)&&t("verbosity"),-1===s)return e.toString();{const t=0===s?xc.PE_STR_AUTH_TOP:xc.PE_STR_AUTH_ALL;return e.toString(t)}}function gl(e,s){(s>1||s<-1)&&t("verbosity");let n=xc.PE_STR_FMT_WKT2;return-1!==s&&(n|=0===s?xc.PE_STR_AUTH_TOP:xc.PE_STR_AUTH_ALL),e.toString(n)}function ul(e){return s(0),""}function cl(e){return e.toLocaleUpperCase("en-US")}function _l(e,s,n){const r=e.getPCSHorizon();if(r.getGeometryType()!==o.enumPolygon)if(r.getGeometryType()!==o.enumEnvelope)t("");else{const e=r;for(let t=0;t<n;t++)e.contains(s[t])||s[t].setNAN()}else{const t=e.getDefaultPrecisionSR().getTolerance(0),i=r;for(let e=0;e<n;e++)1!==Bo(i,s[e],t)&&s[e].setNAN()}}function dl(e,t,s,n){for(let r=0;r<t;r++){if(e[r].y<s.ymin||e[r].y>s.ymax){e[r].setNAN();continue}const t=e[r].x;e[r].x=Il(t,s,n)}}function pl(t,s,n,r){if(t.isEmpty()||1===n)return t;const i=t.getGeometryType();if(i===o.enumPoint){const e=t,r=e.getXY();return 0===Pl([r],1,s,n)||r.isNAN()?e.setEmpty():e.setXY(r),t}if(i===o.enumMultiPoint){const e=t,r=t.createInstance(),i=e.getPointCount();r.reserve(i);const o=e.getAttributeStreamRef(0),a=e.getDescription().getAttributeCount()>1,h=new ae,m=Float64Array.from(o.getArray());if(Pl(m,i,s,n)>0)for(let t=0,s=2*i;t<s;t+=2)Number.isNaN(m[t])||(a?(e.getPointByVal(t>>1,h),h.setXYCoords(m[t],m[t+1]),r.add(h)):r.addXY(m[t],m[t+1]));return r}let a=t;const h=s.getOneDegreeGCSUnit(),m=90*h,g=180*h,u=360*h,_=s.getCentralMeridian(),d=.5*h,p=e.constructEmpty();a.queryEnvelope(p);const f=s.getGCSHorizon(),x=s.getGCSHorisonIsInclusive(),y=f.getGeometryType()===o.enumEnvelope,P=e.constructEmpty();f.queryEnvelope(P);const E=s.getGCS();if(2!==n&&4!==n||(P.xmin=_-g,P.xmax=P.xmin+u),4===n){if(!(p.width()>u-h)){const t=e.constructEmpty();t.setCoords({xmin:p.xmin-h,ymin:P.ymin,xmax:p.xmax+h,ymax:P.ymax}),a=(new zt).execute(a,t,E,r);let s=Math.floor((_-p.getCenterX())/u);for(p.move(s*u,0);p.xmin>P.xmax;)s-=1,p.move(-u,0);for(;p.xmin<P.xmin;)s+=1,p.move(u,0);if(0!==s){const e=new Xt;e.setShiftCoords(s*u,0),a.applyTransformation(e)}return a}n=2}if(2===n&&(P.xmin=_-g,P.xmax=P.xmin+u),p.ymin<-m||p.ymax>m){const t=e.constructEmpty();if(t.setCoords({xmin:p.xmin-h,ymin:-m,xmax:p.xmax+h,ymax:m}),a=(new zt).execute(a,t,E,r),a.isEmpty())return a;a.queryEnvelope(p)}if(x&&(P.ymax<p.ymin||P.ymin>p.ymax))return a.createInstance();p.width()>u&&(a=Fl(a,_-g,u,E,!0,0,!0,r),a.queryEnvelope(p));let S=Vl(p.xmin,p.xmax,P.xmin,P.xmax,u);if(0!==S&&p.move(S,0),p.xmax>P.xmax||p.xmin<P.xmin){if(p.xmax>P.xmax)for(;p.xmin>=P.xmax;)p.move(-u,0),S-=u;for(;p.xmin<P.xmax-u;)p.move(u,0),S+=u}const C=Ie(E,f,!1);if(0!==S){const e=new Xt;e.setShiftCoords(S,0),a.applyTransformation(e),S=0}if(x){if(y&&P.containsEnvelope(p))return a;const e=new Array(2);for(let t=0;t<2;t++){let s;if(y?s=c(i)?Lt(a,P,C,d,r):Lt(a,P,C,0,r):(s=(new Eh).execute(a,f,E,r),s===f&&(s=s.clone())),P.xmin<=p.xmin&&P.xmax>=p.xmax)return s;if(P.xmin>=p.xmin&&P.xmax<=p.xmax)return s;if(e[t]=s,0===t){p.move(-u,0);const e=new Xt;e.setShiftCoords(-u,0),a.applyTransformation(e)}}return c(i)?e[0].add(e[1],!1):l("intersect_with_GCS_horizon: unexpected geometry type"),e[0]}{if(P.ymax<p.ymin||P.ymin>p.ymax)return a;let e=0;for(;!a.isEmpty()&&p.xmax>P.xmin;){if(0!==e){const t=new Xt;t.setShiftCoords(e,0),a.applyTransformation(t)}if(!(new ol).execute(a,f,E,r)){a=(new Xm).execute(a,f,E,r),f===a&&(a=a.clone())}if(0!==e){const t=new Xt;t.setShiftCoords(-e,0),a.applyTransformation(t)}e-=u,p.move(-u,0)}return a}}function fl(e,t,s,n,r,i){const o={stack:[],error:void 0,hasError:!1};try{if(2===i){return ws(e,t,s,n,r)}if(Math.abs(s.x-n.x)>=Math.PI||!vg(s.x,n.x,r))return Number.NaN;s.x>n.x&&(n=gt(s,s=n));const a=Rt(o,new pc,!1),h=Rt(o,new pc,!1),m=Rt(o,new pc,!1),l=s.clone();Ic.geodeticDistance(e,t,s.x,s.y,n.x,n.y,h,a,null,i);const g=h.val;let u=0,c=1;for(;g*(c-u)>1e-12*e;){const o=.5*(u+c);if(Ic.geodeticCoordinate(e,t,s.x,s.y,g*o,a.val,h,m,i),l.x=h.val,l.y=m.val,l.x===r)return l.y;if(vg(s.x,l.x,r))c=o;else{if(!vg(n.x,l.x,r))return Number.NaN;u=o}}return l.y}catch(a){o.error=a,o.hasError=!0}finally{Yt(o)}}function xl(e,t){let s;if(Array.isArray(e)){const n=e;s=new Float64Array(2*t);for(let e=0,r=0;e<t;e++,r+=2)s[r]=n[e].x,s[r+1]=n[e].y}else s=e;return s}function yl(e,t,s,n){for(let r=0,i=0;r<n;r++,i+=2)t[s+r].x=e[i],t[s+r].y=e[i+1]}function Pl(t,s,n,r){if(0===s||1===r)return s;const i=xl(t,s);if(2===r){const e=n.getPannableExtentInGCS();let r=s;for(let t=0,n=2*s;t<n;t+=2)(i[t+1]>e.ymax||i[t+1]<e.ymin)&&(i[t]=Number.NaN,r--);return r?(Hl(i,s,e.xmin,e.width(),!0),t!==i&&yl(i,t,0,s),r):0}const a=n.getOneDegreeGCSUnit(),h=90*a,m=180*a,l=360*a;let g=s;for(let e=0,o=2*s;e<o;e+=2)(i[e+1]>h||i[e+1]<-h)&&(i[e]=Number.NaN,g--);if(!g)return 0;const u=e.constructEmpty();u.setFromPoints(i,s);const c=n.getGCSHorizon(),_=n.getGCSHorisonIsInclusive(),d=c.getGeometryType()===o.enumEnvelope,p=e.constructEmpty();if(c.queryEnvelope(p),_&&(p.ymax<u.ymin||p.ymin>u.ymax))return 0;if(_){if(Hl(i,s,p.getCenterX()-m,l,!0),g=s,d)for(let e=0,t=2*s;e<t;e+=2)p.containsCoords(i[e],i[e+1])||(i[e]=Number.NaN,g--);else{const e=Ie(n.getGCS(),c,!1),t=new We;for(let n=0,r=2*s;n<r;n+=2){t.setCoords(i[n],i[n+1]);0!==Bo(c,t,e)||(i[n]=Number.NaN,g--)}}}else{Hl(i,s,-m,l,!0),g=s;const e=Ie(n.getGCS(),c,!1),t=new We;for(let n=0,r=2*s;n<r;n+=2){t.setCoords(i[n],i[n+1]),t.isNAN()&&g--;const s=Dl(t.x,p.xmin,p.xmax,l);t.x+=s;0!==Bo(c,t,e)&&(i[n]=Number.NaN,g--)}}return g>0&&Array.isArray(t)&&yl(i,t,0,s),g}function El(e,s,n,r,i,o){if(s.isPannable()||t("fold_into_360_degree_range"),e.isEmpty())return e;let a,h;if(2===s.getCoordinateSystemType()){const e=s.getPannableExtent();h=e.xmin,a=e.width()}else{const e=s.getOneDegreeGCSUnit();a=360*e,h=n-180*e}return Fl(e,h,a,s,r,i,!0,o)}function Sl(e,t,s,n){let r,i;if(2===s.getCoordinateSystemType()){const e=s.getPannableExtent();r=e.xmin,i=e.width()}else{const e=s.getOneDegreeGCSUnit();i=360*e,r=n-180*e}Hl(e,t,r,i)}function Cl(e,t){const s=t.width();let n=tt(e-t.vmin,s);n<0&&(n+=s);return t.snapClip(n+t.vmin)}function Il(e,t,s){return e>t.xmax&&e-t.xmax<s?t.xmax:e<t.xmin&&t.xmin-e<s?t.xmin:e}function bl(e,t,s){if(e[0]<t.vmin||e[0]>t.vmax||s&&e[0]===t.vmax){const s=t.width();return e[0]+=Math.ceil((t.vmin-e[0])/s)*s,e[0]=t.snapClip(e[0]),!0}return!1}function wl(e,t,s,n,r,i,o,a,h){return new bm(e,null,s,t,n,r,o,a,i).geoNormalizePolygonGeometry(h)}function vl(e,t,s,n,r,i,o,a,h){return new bm(e,null,s,t,n,r,o,a,i).geoNormalizePolylineGeometry(h)}function Tl(e,t,s,n,r){const i=new T,o=i.addGeometry(e);return Nl(i,o,t,Ie(t,e,!1),s,n,r),i.getGeometry(o)}function Nl(e,t,n,r,i,o,a){const h={stack:[],error:void 0,hasError:!1};try{s(Du()),n.isPannable()||_("insert_geodetic_points");const m=n.getPannableExtent(),l=n.getGCS(),g=vu();l.querySpheroidData(g);const u=l.getUnit().getUnitToBaseFactor(),c=g.majorSemiAxis,d=g.e2;let p=0;const f=new Ke;m.queryIntervalX(f);let x=null;const y=new Array(4);2===n.getCoordinateSystemType()?(x=n.getPECoordSys(),o?(y[0]=Cl(a,f),y[1]=m.getCenterY(),yc.projToGeog(x,1,y),p=y[0]*u):(y[0]=m.getCenterX(),y[1]=a,yc.projToGeog(x,1,y),p=y[1]*u)):p=a*u,o||0===p||2===i||_("insert_geodetic_points: 1");const P=Rt(h,new pc,!1),E=new We,S=new We,C=new We,I=new We,b=new We,w=new We;for(let s=e.getFirstPath(t);s!==D;s=e.getNextPath(s)){const t=e.getFirstVertex(s);e.queryXY(t,C);let h=!1;const m=e.getNextVertex(t);for(let s=m;s!==D;s=e.getNextVertex(s)){if(s===m){if(h)break;h=!0}if(e.queryXY(s,I),o&&(r<a-C.x&&I.x-a>r||r<a-I.x&&C.x-a>r)||!o&&(0!==a||r<-C.y&&I.y>r||r<-I.y&&C.y>r))do{if(Math.abs(C.x-I.x)>=.5*f.width())break;2===n.getCoordinateSystemType()?(y[0]=Cl(C.x,f),y[1]=C.y,y[2]=Cl(I.x,f),y[3]=I.y,tg(x,2,y,0),b.x=y[0]*u,b.y=y[1]*u,w.y=y[3]*u):(b.x=C.x*u,b.y=C.y*u,w.y=I.y*u),w.x=(I.x-C.x)*Math.PI*2/f.width()+b.x;let t=0;const r=lt(We,2);if(o){if(S.x=p,S.y=fl(c,d,b,w,p,i),Number.isNaN(S.y))break;r[0]=S,t=1}else if(2===i){const e=[0,0];if(t=vs(c,d,b,w,p,e),!t)break;r[0].x=e[0],r[0].y=p,2===t&&(r[1].x=e[1],r[1].y=p)}else{if(S.x=Tg(c,d,b,w,i),Number.isNaN(S.x))break;S.y=0,r[0]=S,t=1}let h=-1;for(let m=0;m<t;m++){Ic.geodeticDistance(c,d,b.x,b.y,w.x,w.y,P,null,null,i);const t=P.val;Ic.geodeticDistance(c,d,b.x,b.y,r[m].x,r[m].y,P,null,null,i);const l=P.val;2===n.getCoordinateSystemType()?(y[0]=r[m].x/u,y[1]=r[m].y/u,yc.geogToProj(x,1,y),o?(E.y=y[1],E.x=a):(E.x=Ng(y[0],C.x,I.x,f),E.y=a)):o?(E.x=a,E.y=r[m].y/u):(E.x=Ng(r[m].x/u,C.x,I.x,f),E.y=a);const g=t>0?pt(l/t,0,1):.5;if(0===g||1===g)continue;if(h>g)continue;const _=e.getPrevVertex(s);e.splitSegment(_,[g],1);const p=e.getNextVertex(_);e.setXYCoords(p,E.x,E.y),h=g}}while(0);C.setCoordsPoint2D(I)}}}catch(m){h.error=m,h.hasError=!0}finally{Yt(h)}}function Gl(t,n){s(n.isPannable());const r=n.getPannableExtent();if(t.getGeometryType()===o.enumPoint){const e=t.getY();return r.ymin<=e&&e<=r.ymax?t:t.createInstance()}const i=e.constructEmpty();t.queryEnvelope(i);const a=e.constructEmpty();a.setCoords({env2D:r}),a.xmin=i.xmin,a.xmax=i.xmax,a.inflateCoords(.01*a.height(),0);const h=le(n,i,!1);let m;return m=a.containsEnvelope(i)?t:Lt(t,a,h,0,null),m}function Dl(e,t,s,n){return it((.5*(s+t)-e)/n)*n}function Vl(e,t,s,n,r){if(e>=s&&t<=n)return 0;return Dl(.5*(t+e),s,n,r)}function Fl(t,s,n,r,i,a,h,m){const l=t.getGeometryType(),g=Ke.constructEmpty();g.setCoords(s,s+n);const u=[0];if(l===o.enumPoint){const e=t;if(u[0]=e.getX(),bl(u,g,h)){const e=i?t:t.clone();return e.setX(u[0]),e}return t}const c=e.constructEmpty();if(t.queryEnvelope(c),c.isEmpty())return t;if(l===o.enumMultiPoint){const e=i?t:t.clone(),s=e.getImpl(),n=s.getAttributeStreamRef(0),r=2*s.getPointCount();let o=!1;for(let t=0;t<r;t+=2)u[0]=n.read(t),bl(u,g,h)&&(n.write(t,u[0]),o=!0);return o&&s.notifyModifiedFlags(2001),e}const _=Ke.constructEmpty();if(c.queryIntervalX(_),g.contains(_))return g.vmax,_.vmax,t;const d=e.constructEmpty();if(d.setCoords({env2D:c}),0===_.width()){let e=_.vmin;e+=Math.ceil((g.vmin-e)/n)*n,e=g.snapClip(e);const s=i?t:t.clone();return s.setAttributeBasic(0,0,e),s}if(l===o.enumEnvelope){const e=i?t:t.clone();return c.intersect(d),e.setEnvelope(c),e}const p=.1*Math.max(c.height(),c.width())*1;d.inflateCoords(0,p);let f=t;const x=r.getTolerance(0),y=new Xt;for(;;){const e=Math.floor((_.vmin-s)/n),t=Math.ceil((_.vmax-s)/n);if(!(t-e>3))break;{const i=Math.floor(.5*(t+e));d.xmin=c.xmin-p,d.xmax=s+n*i;const h=Lt(f,d,x,a,m);d.xmin=d.xmax,d.xmax=c.xmax+p;const g=Lt(f,d,x,a,m);y.setShiftCoords((i-t)*n,0),g.applyTransformation(y),l===o.enumPolygon?f=(new tl).execute(h,g,r,m):(f=h,f.add(g,!1)),f.queryEnvelope(c),c.queryIntervalX(_)}}d.xmin=s,d.xmax=s+n;const P=e.constructEmpty();P.setCoords({env2D:d}),P.inflateCoords(x,0);const E=Math.floor((c.xmin-d.xmin)/n)*n;let S;E?(d.move(E,0),y.setShiftCoords(-E,0)):y.setIdentity(),S=l===o.enumPolyline?new I({vd:f.getDescription()}):new C({vd:f.getDescription()});const b=e.constructEmpty(),w=e.constructEmpty();for(;c.xmax>d.xmin;){const e=Lt(f,d,x,0,m);e.queryEnvelope(w);let t=!1;t=l===o.enumPolyline?!e.isEmpty()&&(w.width()>x||w.height()>x):!e.isEmpty()&&(l!==o.enumPolygon||w.width()>x),t&&(e.applyTransformation(y),e.queryEnvelope(w),S.queryEnvelope(b),b.inflateCoords(x,x),b.isIntersecting(w)&&l===o.enumPolygon?S=(new tl).execute(S,e,r,m):S.add(e,!1)),d.move(n,0),y.shiftCoords(-n,0)}return S}function Hl(e,t,s,n,r=!0){const i=new Ke;i.setCoords(s,s+n);const o=[0];if(Array.isArray(e)){const s=e;for(let e=0;e<t;e++)i.containsRightExclusive(s[e].x)||(o[0]=s[e].x,bl(o,i,r),s[e].x=o[0])}else{const s=e;for(let e=0;e<t;e++){const t=e<<1;i.containsRightExclusive(s[t])||(o[0]=s[t],bl(o,i,r),s[t]=o[0])}}}function kl(t,n,r,i=!0){if(t.isEmpty())return;const a=t.getGeometryType();if(!i||a!==o.enumPolygon)if(m(a)){let e=!1;if(c(a)&&t.hasNonLinearSegments()){const i=t.getImpl(),o=i.getAttributeStreamRef(0),a=i.getSegmentFlagsStreamRef();s(null!==a);for(let t=0,s=i.getPathCount();t<s;t++){let s=!0;const h=i.isClosedPath(t),m=i.getPathEnd(t);if(h&&i.getPathSize(t)>0){s=1===(31&a.read(m-1))}for(let l=i.getPathStart(t);l<m;l++){if(1===(31&a.read(l))){if(s){const t=o.read(2*l),s=Il(t,n,r);s!==t&&(e=!0,o.write(2*l,s))}s=!0}else s=!1}}}else{const s=t.getImpl(),i=s.getAttributeStreamRef(0);for(let t=0,o=s.getPointCount();t<o;t++){const s=i.read(2*t),o=Il(s,n,r);o!==s&&(e=!0,i.write(2*t,o))}}e&&t.getImpl().notifyModifiedFlags(2001)}else if(a===o.enumEnvelope){const s=t,i=e.constructEmpty();s.queryEnvelope(i),i.xmin=Il(i.xmin,n,r),i.xmax=Il(i.xmax,n,r),s.setEnvelope(i)}else if(a===o.enumPoint){const e=t;e.setX(Il(e.getX(),n,r))}else l("")}function Al(e,t,s){const n=new We;return n.x=Il(e.x,t,s),n.y=e.y,n}function Ml(t,s){if(s.isEmpty())return 0;const n=t.getPECoordSys();if(n.getProjection().getCode()===xc.PE_PRJ_AZIMUTHAL_EQUIDISTANT){const r=vu();t.querySpheroidData(r);const i=n.getParameters();if(null===i[xc.PE_PARM_LAM0])return 0;if(null===i[xc.PE_PARM_PHI0])return 0;const o=[i[xc.PE_PARM_LAM0].getValue(),i[xc.PE_PARM_PHI0].getValue()];yc.geogToProj(n,1,o);const a=new We(o[0],o[1]),h=e.constructEmpty();s.queryEnvelope(h);const m=lt(We,4);h.queryCorners(m);let l=0;const g=t.getOneMeter();let u=Math.max(r.majorSemiAxis,r.minorSemiAxis)*Math.PI,c=Math.min(r.majorSemiAxis,r.minorSemiAxis)*Math.PI;c-=u/180,u*=g,c*=g;for(let e=0;e<4;e++){const t=We.distance(m[e],a);if(t>u)l++;else if(t>c)return-1}if(0===l)return 1;if(4===l){const t=e.constructEmpty();return t.setCoords({center:a,width:u,height:u}),h.isIntersectingNe(t)?-1:0}return-1}return-1}function Ul(t,n,r,i){const a=t.getGeometryType();s(a===o.enumPolygon||a===o.enumPolyline||a===o.enumMultiPoint);const h=n.getCoordinateSystemType();if(2===h){let s=t;if(0===r){const r=Ml(n,t);if(0===r)return t.createInstance();if(1===r)return t;const a=n.getPCSHorizon(),h=a.getGeometryType(),m=n.getDefaultPrecisionSR();if(h===o.enumEnvelope){const r=e.constructEmpty();a.queryEnvelope(r);const o=le(m,r,!1);s=Lt(t,r,o,5e4*n.getOneMeterPCSUnit(),i)}else(new Rm).execute(a,t,m,i)||(s=(new Eh).execute(s,a,m,i),s===a&&(s=s.clone()))}else if(n.isPannable()){const t=e.constructEmpty();s.queryEnvelope(t);const h=n.getPannableExtent();h.containsEnvelope(t)||(kl(s,h,n.getTolerance(0)),2!==r&&4!==r||(s=Gl(s,n)),4!==r?s=El(s,n,0,!0,1e5*n.getOneMeterPCSUnit(),i):a===o.enumPolygon&&t.width()>2*h.width()&&(s=Fl(s,-2*h.width(),2*h.width(),n,!0,0,!0,i)))}return s}if(s(1===h),a===o.enumMultiPoint)return kl(t,n.getPannableExtent(),n.getTolerance(0)),t;{const s=e.constructEmpty();t.queryEnvelope(s);let r=t;const h=n.getPannableExtent();if(s.ymin<h.ymin||s.ymax>h.ymax){const t=Math.max(1,s.calculateToleranceFromEnvelope()),o=new e(s.xmin-t,h.ymin,s.xmax+t,h.ymax);if(r=(new zt).execute(r,o,n,i),r.isEmpty())return r}return a===o.enumPolygon&&s.width()>2*h.width()&&(r=Fl(r,-2*h.width(),2*h.width(),n,!0,0,!0,i)),r}}function ql(e,t,n,r,i,o){const a=r.getCoordinateSystemType();if(2===a){if(0===i)n!==e&&nt(n,e,t),_l(r,n,t);else if(n!==e&&nt(n,e,t),r.isPannable()){const e=r.getTolerance(0);dl(n,t,r.getPannableExtent(),e),Sl(n,t,r,0)}}else{s(1===a);const i=r.getTolerance(0),o=r.getPannableExtent();for(let s=0;s<t;s++)n[s].assign(Al(e[s],o,i))}}function Ol(e,t){const s=t.getPointCount();if(!s)return;const n=t.getImpl(),r=n.getAttributeStreamRef(0),i=e;yc.geogToProj(i,s,r.getArray()),n.notifyModifiedFlags(2001)}function Bl(e,t,s,n){if(!s)return;const r=e.getPECoordSys();if(1===s){const s=[t[0].x,t[0].y];if(yc.geogToProj(r,1,s),n){const{first:n,second:r}=e.m_peCoordSysVal.getGeogToProjFactors();s[0]=n*(t[0].x-e.getCentralMeridian())+r}return void t[0].setCoords(s[0],s[1])}const i=e.isPannable(),o=i?e.getPannableExtent().width():0,a=179*o/360;let h=0;i&&(h=e.getCentralMeridian());const m=256,l=new Float64Array(2*m);for(let g=0;g<s;){for(let e=g;e<s&&t[e].isNAN();++e)g++;let u=Math.min(m,s-g);if(u>0){for(let e=1,s=g+1;e<u;++e,++s)if(t[s].isNAN()){u=e;break}for(let e=0;e<u;++e){const s=e<<1;l[s]=t[g+e].x,l[s+1]=t[g+e].y}if(yc.geogToProj(r,u,l),n){const{first:s,second:n}=e.m_peCoordSysVal.getGeogToProjFactors();for(let e=0;e<u;++e){l[e<<1]=s*(t[g+e].x-h)+n}}if(i)for(let e=0,s=g;e<u;e++,s++){const n=e<<1,r=l[n],i=Qe(r),m=t[s].x-h;i*Qe(m)<0&&Math.abs(r)>a&&(l[n]-=i*o)}yl(l,t,g,u),g+=u}}}function Rl(e,t,s,n){const r=e.getSRToGCSTransform();return(new Hh).transform(r,t,s,n,!1)}function Yl(t,s,n,r){const i=new w({vd:s.getDescription()});let o;i.addPoints(s,0,-1),o=(new Hh).execute(i,t,r);const a=s.getPointCount();if(n.setEmpty(),t.getInputSR().isPannable()){if(a!==o.getPointCount())return!1;const r=new e;s.queryEnvelope(r);const i=new e;o.queryEnvelope(i);const h=r.width(),m=i.width();if(0!==h&&0!==m){const e=m/h,s=t.getOutputSR().getPannableExtent().width()/t.getInputSR().getPannableExtent().width();if(Math.abs(e/s-1)>1e-10)return!1}else if(0!==h||0!==m)return!1;n.add(s,!1);for(let e=0;e<a;e++){const t=o.getXY(e);n.setXY(e,t)}return!0}return!1}function Xl(e,t,n){s(!n||e.isPannable());const r=t.getPointCount();if(!r)return;const i=t.getImpl(),o=i.getAttributeStreamRef(0),a=e.getPECoordSys();let h=0;const m=o.readRange(0,2*r);let l=()=>{yc.geogToProj(a,r,m)};const g=e.isPannable()&&!n,u=g?e.getPannableExtent().width():0,c=179*u/360;if(e.isPannable()&&(h=e.getCentralMeridian(),n)){const t=e.m_peCoordSysVal.getGeogToProjFactors(),s=t.first,n=t.second;l=()=>{yc.geogToProj(a,r,m);for(let e=0;e<r;e++){const t=e<<1,r=o.read(t),i=s*(r-h)+n;m[t]=i}}}if(l(),g)for(let s=0;s<r;s++){const e=s<<1,t=m[e],n=Qe(t),r=o.read(e)-h;n*Qe(r)<0&&Math.abs(t)>c&&(m[e]+=-n*u)}o.writeRangeFromArray(0,2*r,m,!0,1),i.notifyModifiedFlags(2001)}function Ll(e,t,s){switch(t.getGeometryType()){case o.enumLine:return void xg(e,t,s);case o.enumBezier:return void Ig(e,t,s);case o.enumEllipticArc:return void Pg(e,t,s);case o.enumBezier2:return void bg();case o.enumRationalBezier2:return void wg();default:l("")}}function zl(e,t,n){if(!t.hasNonLinearSegments())return void Xl(e,t,n);if(s(!n||e.isPannable()),t.isEmpty())return;const r=0,i=e.getPECoordSys(),o=e.isPannable(),a=o?e.getPannableExtent().width():0,h=179*a/360;let m=0;o&&(m=e.getCentralMeridian());const l=t.createInstance();l.reserveParts(t.getPointCount(),t.getPathCount());const g=t.getImpl(),u=new b;for(let s=0,c=t.getPathCount();s<c;++s)if(g.hasNonLinearSegmentsPath(s)){let t=!0,r=-1;const i=g.getPathStart(s),o=i+g.getSegmentCountPath(s);g.isClosedPath(s)&&(r=o-1);const a=new We;for(let s=i;s<o;++s){if(g.getSegmentBuffer(s,u,!1),Ll(e,u.get(),n),!t){u.get().getStartXY().equals(a)||u.get().moveTo(a)}if(s!==r)l.addSegment(u.get(),t);else{if(t){const e=new ae;u.get().queryStart(e),l.startPathPoint(e)}l.closeLastPathWithSegment(u.get())}a.assign(u.get().getEndXY()),t=!1}}else{const e=1024;let n,u=g.getPathSize(s),c=Math.min(u,e);l.insertPath(-1,t,s,!0);const _=g.getAttributeStreamRef(0),d=l.getAttributeStreamRef(0);for(let t=g.getPathStart(s),l=g.getPathEnd(s);t<l;){if(n=_.readRange(t,c),yc.geogToProj(i,c,n),o)for(let e=0;e<c;e++){const t=e<<1,s=n[t],i=Qe(s),o=_.read(2*(r+e))-m;i*Qe(o)<0&&Math.abs(s)>h&&(n[t]+=-i*a)}d.writeRangeFromArray(t,c,n,!0,1),t+=c,u-=c,c=Math.min(u,e)}}t.assignMove(l)}function Wl(e,t,s){const n=1e3;let r=s.getPointCount();if(!r)return;const i=s.getImpl(),o=i.getAttributeStreamRef(0);let a=Math.min(r,n),h=0;const m=e.getPECoordSys();Number.isNaN(t)&&(t=0);const l=e.isPannable(),g=e.getOneDegreeGCSUnit(),u=360*g,c=179*g;let _;for(;r;){if(_=o.readRange(2*h,2*a),tg(m,a,_,t),l)for(let e=0;e<a;e++){const s=e<<1,n=_[s]-t,r=Qe(n),i=o.read(2*(h+e));r*Qe(i)<0&&Math.abs(n)>c&&(_[s]+=-r*u)}o.writeRangeFromArray(2*h,2*a,_,!0,1),h+=a,r-=a,a=Math.min(r,n)}i.notifyModifiedFlags(2001)}function jl(e,t,s){switch(s.getGeometryType()){case o.enumLine:return void Zl(e,t,s);case o.enumBezier:return void Jl(e,t,s);case o.enumEllipticArc:return void Kl(e,t,s);case o.enumBezier2:return void $l();case o.enumRationalBezier2:return void eg();default:l("")}}function Zl(e,t,s){const n=[s.getStartXY(),s.getEndXY()];ng(e,t,n,2),s.setStartXY(n[0]),s.setEndXY(n[1]),s.normalizeAfterEndpointChange()}function Kl(e,t,s){if(0===s.projectionBehavior())Ql(e,t,s);else{const n=s.isClosed()&&s.isMajor(),r=[s.getStartXY(),n?s.getCenter():s.getEndXY()],i=[r[0].clone(),r[1].clone()];Eg(e,t,i,2);const o=new Xt;o.initializeFromTwoPointsArray(r,i),s.applyTransformation(o);const a=n?0:1;s.setCoordsForIntersector(i[0],i[a],!1)}}function Ql(e,t,s){Sg(!1,e,t,s,!1)}function Jl(e,t,s){const n=lt(We,4);s.queryControlPoints(n),Eg(e,t,n,4),s.setControlPoints(n)}function $l(e,t,n){s(0)}function eg(e,t,n){s(0)}function tg(e,t,n,r){const i=yc.projToGeogCenter(e,t,n,r);for(let o=0;o<t;++o){const e=o<<1;s(Number.isFinite(n[e]+n[e+1]))}return i}function sg(e,t,s){if(!s.hasNonLinearSegments())return void Wl(e,t,s);if(s.isEmpty())return;const n=e.getPECoordSys();Number.isNaN(t)&&(t=0);const r=e.isPannable(),i=e.getOneDegreeGCSUnit(),o=360*i,a=179*i,h=s.createInstance();h.reserveParts(s.getPointCount(),s.getPathCount());const m=s.getImpl(),l=new b;for(let g=0,u=s.getPathCount();g<u;++g)if(m.hasNonLinearSegmentsPath(g)){let s=!0,n=-1;const r=m.getPathStart(g),i=r+m.getSegmentCountPath(g);m.isClosedPath(g)&&(n=i-1);const o=new We;for(let a=r;a<i;++a){if(m.getSegmentBuffer(a,l,!1),jl(e,t,l.get()),!s){l.get().getStartXY().equals(o)||l.get().moveTo(o)}if(a!==n)h.addSegment(l.get(),s);else{if(s){const e=new ae;l.get().queryStart(e),h.startPathPoint(e)}h.closeLastPathWithSegment(l.get())}o.assign(l.get().getEndXY()),s=!1}}else{const e=1e3;let i,l=m.getPathSize(g),u=Math.min(l,e);h.insertPath(-1,s,g,!0);const c=m.getAttributeStreamRef(0),_=h.getAttributeStreamRef(0);for(let s=m.getPathStart(g),h=m.getPathEnd(g);s<h;){if(i=c.readRange(2*s,2*u),tg(n,u,i,t),r)for(let e=0;e<u;e++){const n=e<<1,r=i[n]-t,h=Qe(r),m=c.read(2*s);h*Qe(m)<0&&Math.abs(r)>a&&(i[n]+=-h*o)}_.writeRangeFromArray(2*s,2*u,i,!0,1),s+=u,l-=u,u=Math.min(l,e)}}s.assignMove(h)}function ng(e,t,s,n){const r=e.getPECoordSys();Number.isNaN(t)&&(t=0);const i=e.isPannable(),o=e.getOneDegreeGCSUnit(),a=360*o,h=179*o,m=256,l=new Float64Array(2*m);for(let g=0;g<n;){for(let t=g;t<n&&s[t].isNAN();++t)g++;let e=Math.min(m,n-g);if(e>0){for(let t=1,n=g+1;t<e;++t,++n)if(s[n].isNAN()){e=t;break}for(let t=0;t<e;t++){const e=t<<1;l[e]=s[g+t].x,l[e+1]=s[g+t].y}if(tg(r,e,l,t),i)for(let n=0,r=g;n<e;++n,++r){const e=n<<1,i=s[r].x,o=l[e]-t,m=Qe(o);m*Qe(i)<0&&Math.abs(o)>h&&(l[e]-=m*a)}for(let t=0;t<e;t++){const e=t<<1;s[g+t].x=l[e],s[g+t].y=l[e+1]}g+=e}}}function rg(e,t,n,r){s(0)}function ig(e,t,s){let n=t.getPointCount();if(!n)return!1;const r=t.getImpl(),i=r.getAttributeStreamRef(0);let o=null;const a=e.getInputSR(),h=e.getOutputSR();a.getVCS(),h.getVCS();const m=a.getOneDegreeGCSUnit(),l=h.getOneDegreeGCSUnit(),g=e.isVertical();g&&t.hasAttribute(1)&&(o=r.getAttributeStreamRef(1));const u=e.getDatumTransformation(),c=!!u&&1===u.getType();if(c||null===o||(rg(o.getArray()),o=null),!u||0===u.count()){const e=a.getGcsUnitFactor()/h.getGcsUnitFactor(),t=(a.getPrimeMeridian()-h.getPrimeMeridian())*l,s=-90*m,o=90*m;let g=0;const u=i.getArray(),c=[0];for(let r=1,i=2*n;r<i;)c[0]=u[r],g|=ft(c,s,o)?1:0,u[r]=c[0],r+=2;if(0!==t||1!==e){g=1;const s=i.getArray();for(let r=0,i=2*n;r<i;){let n=s[r];n*=e,n+=t,s[r]=n,s[r+1]*=e,r+=2}}return 0!==g&&r.notifyModifiedFlags(2001),!!g}const _=1e3;let d=Math.min(n,_);const p=new Array(d),f=new Array(d);let x=null;null!==o&&(x=new Float64Array(d));let y=0,P=Number.NaN,E=Number.NaN;const S=360*l,C=l/m;s&&(E=90*l,P=89.9*m,f.fill(0));let I=!0,b=0;for(;n;){let e=!1;const t=i.readRange(2*y,2*d);for(let s=0;s<d;s++)p[s]=t[s<<1];if(s)for(let s=0;s<d;s++){const n=1+(s<<1),r=Math.abs(t[n])-P;if(r>0){const i=t[n];t[n]=Ze(P,i),f[s]=Ze(r,i),e=!0}}const r=t[0];if(c){const e=u;x&&o.queryRange(y,d,x,!0,1),e.transform(!1,t,x,d),x&&o.writeRangeFromArray(y,d,x,!0,1)}else{u.transform(!1,t,d)}I&&(b=t[0]-C*r,I=!1);for(let s=0;s<d;s++){const e=s<<1,n=t[e]-p[s]*C-b;Math.abs(n)>200&&(t[e]+=n>0?-S:S)}if(e){for(let e=0;e<d;e++)if(f[e]){const s=1+(e<<1);t[s]+=C*f[e],t[s]>E?t[s]=E:t[s]<-E&&(t[s]=-E)}f.fill(0)}i.writeRangeFromArray(2*y,2*d,t,!0,1),g&&o&&o.writeRangeFromArray(y,d,x,!0,1),y+=d,n-=d,d=Math.min(n,_)}return r.notifyModifiedFlags(2001),!0}function og(e,t,s){switch(t.getGeometryType()){case o.enumLine:return ug(e,t,s);case o.enumBezier:return dg(e,t,s);case o.enumEllipticArc:return cg(e,t,s);case o.enumBezier2:return pg();case o.enumRationalBezier2:return fg();default:l("")}}function ag(e,t,s){if(!t.hasNonLinearSegments())return ig(e,t,s);if(t.isEmpty())return!1;const n=t.createInstance();n.reserveParts(t.getPointCount(),t.getPathCount());const r=t.getImpl(),i=new b;for(let o=0,a=t.getPathCount();o<a;++o){let t=!0,a=-1;const h=r.getPathStart(o),m=h+r.getSegmentCountPath(o);r.isClosedPath(o)&&(a=m-1);const l=new We;for(let o=h;o<m;++o){if(r.getSegmentBuffer(o,i,!1),og(e,i.get(),s),!t){i.get().getStartXY().equals(l)||i.get().moveTo(l)}if(o!==a)n.addSegment(i.get(),t);else{if(t){const e=new ae;i.get().queryStart(e),n.startPathPoint(e)}n.closeLastPathWithSegment(i.get())}l.assign(i.get().getEndXY()),t=!1}}return t.assignMove(n),!0}function hg(e,t,s,n,r,i){if(e.isIdentityGeogToGeog()){const s=90*e.getInputSR().getOneDegreeGCSUnit();let r=0;const i=[0];for(let e=0;e<n;e++)i[0]=t[e].y,r|=ft(i,-s,s)?1:0,t[e].y=i[0];return r}const o=e.getInputSR(),a=e.getOutputSR(),h=o.getVCS(),m=a.getVCS(),l=o.getOneDegreeGCSUnit(),g=90*l,u=a.getOneDegreeGCSUnit(),c=e.isVertical(),_=e.getDatumTransformation(),d=!!_&&1===_.getType();if(c||(s=null),!_||0===_.count()){let e=0;const r=[0];for(let s=0;s<n;s++)r[0]=t[s].y,e|=ft(r,-g,g)?1:0,t[s].y=r[0];return e|=Fm(o.getGCS(),h,a.getGCS(),m,t,s,n)?1:0,e}d||null===s||rg();const p=1024;let f=Math.min(n,p);const x=new Array(f),y=$e(f,0);let P=0,E=Number.NaN,S=Number.NaN;const C=360*u,I=u/l;r&&(S=90*u,E=89.9*l);let b=!0,w=0,v=n;for(;v;){let e=!1;for(let s=0;s<f;s++)x[s]=t[s+P].x;if(r)for(let s=0;s<f;s++){const n=Math.abs(t[s+P].y)-E;if(n>0){const r=t[s+P].y;t[s+P].y=Ze(E,r),y[s]=Ze(n,r),e=!0}}const n=t[0].x;if(d){_.transform(!1,t,s,f)}else{_.transform(!1,t,f)}b&&(w=t[0].x-I*n,b=!1);for(let s=0;s<f;s++){const e=t[P+s].x-x[s]*I-w;Math.abs(e)>200&&(e>0?t[P+s].x-=C:t[P+s].x+=C)}if(e){for(let e=0;e<f;e++)y[e]&&(t[P+e].y+=I*y[e],t[P+e].y>S?t[P+e].y=S:t[P+e].y<-S&&(t[P+e].y=-S));y.fill(0,0,f)}P+=f,v-=f,f=Math.min(v,p)}return 1}function mg(e,t,n,r,i){return s(0),0}function lg(e,t,n,r,i){s(null===r),s(t<2147483647);const o=Array.isArray(n);let a;a=o?xt(n):n;const h=Pc.geogToGeog(e,t,a,null,i);return o&&yt(a,n),h}function gg(e,t,s,n,r,i){let o=0,a=!0,h=0;for(let m=0;m<n;++m)t[m].isNAN()?a||(o|=hg(e,t.slice(h,m-h),s?s.slice(h,m-h):null,m-h,r),h=m,a=!0):a&&(h=m,a=!1);return a||(o|=hg(e,0===h?t:t.slice(h),s?0===h?s:s.slice(h):null,n-h,r)),0!==o}function ug(e,t,s){const n=[t.getStartXY(),t.getEndXY()],r=[0,0];let i=null;t.hasAttribute(1)&&(i=r,i[0]=t.getAttributeAsDbl(0,1,0),i[1]=t.getAttributeAsDbl(1,1,0));const o=gg(e,n,i,2,s);return t.setStartXY(n[0]),t.setEndXY(n[1]),i&&(t.setStartAttribute(1,0,i[0]),t.setEndAttribute(1,0,i[1])),t.normalizeAfterEndpointChange(),o}function cg(e,t,s){if(0===t.projectionBehavior())return _g(e,t,s);const n=t.getStartXY().equals(t.getEndXY()),r=lt(We,3),i=lt(We,3),o=[0,0,0];let a=null;r[0].assign(t.getStartXY()),r[1].assign(n?t.getCenter():t.getEndXY());let h=!1;t.hasAttribute(1)&&(a=o,a[0]=t.getAttributeAsDbl(0,1,0),a[1]=t.getAttributeAsDbl(1,1,0),a[2]=mt(a[0],a[1],.5),n&&(a[1]=a[2])),i[0].setCoordsPoint2D(r[0]),i[1].setCoordsPoint2D(r[1]);const m=new Xt;if(n||t.isDegenerateToLine())h=gg(e,i,a,2,s),m.initializeFromTwoPoints(r[0],r[1],i[0],i[1]);else{const n=new We;t.queryCoord2D(.5,n),r[2].setCoordsPoint2D(n),i[2].setCoordsPoint2D(n),h=gg(e,i,a,3,s),m.setFromTwoTriangles(r,i)}return m.isIdentity()||(t.applyTransformation(m),t.setStartXY(i[0]),t.setEndXY(n?i[0]:i[1]),t.normalizeAfterEndpointChange()),a&&(t.setStartAttribute(1,0,a[0]),t.setEndAttribute(1,0,n?a[0]:a[1])),h}function _g(e,t,s){const n=[t.getStartXY(),t.getEndXY(),t.getInteriorPoint(),t.getCenter()];let r=4;t.isDegenerateToLine()&&(r=2);const i=[0,0,0,0];let o=null;if(t.hasAttribute(1)){o=i,o[0]=t.getAttributeAsDbl(0,1,0),o[1]=t.getAttributeAsDbl(1,1,0);const e=mt(o[0],o[1],.5);o[2]=e,o[3]=e}const a=t.getStartXY().equals(t.getEndXY())&&!t.isDegenerateToLine(),h=gg(e,n,o,r,s);return a?t.constructCircleCenterAndPoint(n[3],n[0],!t.isClockwise()):t.isDegenerateToLine()?t.constructLineCircularArc(n[0],n[1]):t.constructCircularArcThreePoint(n[0],n[1],n[2]),o&&(t.setStartAttribute(1,0,o[0]),t.setEndAttribute(1,0,o[1])),h}function dg(e,t,s){const n=lt(We,4);t.queryControlPoints(n);const r=[0,0,0,0];let i=null;t.hasAttribute(1)&&(i=r,i[0]=t.getAttributeAsDbl(0,1,0),i[3]=t.getAttributeAsDbl(1,1,0),i[1]=mt(i[0],i[3],.5),i[2]=i[1]);const o=gg(e,n,i||null,n.length,s);return t.setControlPoints(n),i&&(t.setStartAttribute(1,0,i[0]),t.setEndAttribute(1,0,i[3])),t.normalizeAfterEndpointChange(),o}function pg(e,t,n){return s(0),!1}function fg(e,t,n){return s(0),!1}function xg(e,t,s){const n=[t.getStartXY(),t.getEndXY()];Bl(e,n,2,s),t.setStartXY(n[0]),t.setEndXY(n[1]),t.normalizeAfterEndpointChange()}function yg(e,t,s,n){Bl(e,t,s,n)}function Pg(e,t,s){if(0===t.projectionBehavior())Cg(e,t,s);else{const n=t.isClosed()&&t.isMajor(),r=[t.getStartXY(),n?t.getCenter():t.getEndXY()],i=[r[0].clone(),r[1].clone()];yg(e,i,2,s);const o=new Xt;o.initializeFromTwoPointsArray(r,i),t.applyTransformation(o);const a=n?0:1;t.setCoordsForIntersector(i[0],i[a],!1)}}function Eg(t,s,n,r){ng(t,s,n,r);const i=new e;i.setFromPoints(n,r);const o=t.getOneDegreeGCSUnit(),a=360*o,h=180*o;if(i.width()>h){for(let e=0;e<r;e++)for(;n[e].x<s;)n[e].x+=a;if(i.setFromPoints(n,r),i.xmax>h+s)for(let e=0;e<r;e++)n[e].x-=a}}function Sg(e,t,s,n,r){const i=lt(We,3);let o=0,a=!1,h=!1;const m=n.isDegenerateToLine();m?(i[0].assign(n.getStartXY()),i[1].assign(n.getEndXY()),i[2].setCoords(0,0),o=2):n.isClosed()&&n.isMajor()?(a=!0,h=!n.isClockwise(),i[0].assign(n.getStartXY()),i[1].assign(n.getCenter()),i[2].setCoords(0,0),o=2):(i[0].assign(n.getStartXY()),i[1].assign(n.getEndXY()),i[2].assign(n.getInteriorPoint()),o=3),e?yg(t,i,o,r):Eg(t,s,i,o),m?n.constructLineCircularArc(i[0],i[1]):a?n.constructCircleCenterAndPoint(i[1],i[0],h):n.constructCircularArcThreePoint(i[0],i[1],i[2])}function Cg(e,t,s){Sg(!0,e,0,t,s)}function Ig(e,t,s){const n=lt(We,4);t.queryControlPoints(n),yg(e,n,4,s),t.setControlPoints(n)}function bg(e,t,n){s(0)}function wg(e,t,n){s(0)}function vg(e,t,s){const n=ee(e),r=ee(t),i=K(n,r),o=K(n,ee(s));return 0===o||(i>0&&o>0&&o<=i||i<0&&o<0&&o>=i)}function Tg(e,t,n,r,i){const o={stack:[],error:void 0,hasError:!1};try{const a=n.clone(),h=r.clone();if(2===i){const s=[0,0];return vs(e,t,a,h,0,s),s[0]}if(a.y>h.y){const e=new We;e.assign(a),a.assign(h),h.assign(e)}const m=Rt(o,new pc,!1),l=Rt(o,new pc,!1),g=Rt(o,new pc,!1),u=new Ke;if(u.setCoords(a.y,h.y),!u.containsCoordinate(0)||Math.abs(a.x-h.x)>=Math.PI)return Number.NaN;if(a.x===h.x)return a.x;Ic.geodeticDistance(e,t,a.x,a.y,h.x,h.y,l,m,null,i);const c=l.val;let _=0,d=1;const p=a.clone();for(;c*(d-_)>1e-12*e;){const n=.5*(_+d);if(Ic.geodeticCoordinate(e,t,a.x,a.y,c*n,m.val,l,g,i),p.x=l.val,p.y=g.val,u.setCoords(a.y,p.y),0===p.y)return p.x;if(u.containsCoordinate(0))d=n;else{if(u.setCoords(h.y,p.y),!u.containsCoordinate(0))return s(!1),Number.NaN;_=n}}return p.x}catch(a){o.error=a,o.hasError=!0}finally{Yt(o)}}function Ng(e,t,s,n){const r=new Ke;r.setCoords(t,s);const i=n.width();let o=Math.floor((e-t)/i)*i+e;const a=r.getCenter();for(;Math.abs(o-a)>Math.abs(o+i-a);)o+=i;return o}class Gg extends Zt{constructor(){super(),this.m_geometryDeque=[],this.m_index=-1}next(){if(this.m_geometryDeque.length>0){this.m_index++;const e=this.m_geometryDeque[0];return this.m_geometryDeque.shift(),e}return null}getGeometryID(){return this.m_index}tick(e){this.m_geometryDeque.push(e)}tock(){return!0}getRank(){return 1}}function Dg(e,t){return e===t||null!==e&&null!==t&&(e.m_csType===t.m_csType&&(0===e.m_WKID&&0===t.m_WKID?e.m_hashCode===t.m_hashCode&&e.m_canonicalWkt===t.m_canonicalWkt:e.m_WKID===t.m_WKID))}function Vg(e,t){return e===t||null!==e&&null!==t&&(e.m_csType===t.m_csType&&(0===e.m_WKID&&0===t.m_WKID?1===e.m_csType?e.m_peCoordSys.isEqual(t.m_peCoordSys):e.m_peCoordSys===t.m_peCoordSys:e.m_WKID===t.m_WKID))}class Fg{constructor(n,r=!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=We.getNAN(),this.m_southPole=We.getNAN(),this.m_polesUpdated=0,this.m_domain=e.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=e.constructEmpty(),this.m_pannableExtentGCS=e.constructEmpty(),this.m_areaOfUse=null,this.m_canonicalWkt="",this.m_peCoordSys=n,this.m_WKID=fc.getCode(n),this.m_WKID<=0?(this.m_WKID=0,this.m_canonicalWkt=hl(n,0,!0),this.m_hashCode=dt(this.m_canonicalWkt)):this.m_hashCode=Tt(this.m_WKID);const i=this.m_peCoordSys.getType();this.m_csType=i===xc.PE_TYPE_PROJCS?2:1,s(i===xc.PE_TYPE_PROJCS||i===xc.PE_TYPE_GEOGCS),i===xc.PE_TYPE_PROJCS&&(n.loadConstants()||t("PeProjcs.loadConstants failed"));const o=i===xc.PE_TYPE_GEOGCS?this.m_peCoordSys:this.m_peCoordSys.getGeogcs();i!==xc.PE_TYPE_GEOGCS&&fc.getCode(o),this.m_unit=is(n),this.m_primeMeridian=o.getPrimem().getLongitude();{const e=o.getUnit().getUnitFactor();this.m_gcsUnitFactor=e;let t=Math.PI/(180*e);Math.abs(t-1)<1e-10&&(t=1),this.m_oneDegreeGCS=t}if(i===xc.PE_TYPE_PROJCS){const e=this.m_peCoordSys,t=e.getUnit().getUnitFactor();this.m_oneMeterPCS=1/t,this.m_oneMillimeter=.001/t,this.m_pPCSInfoNoDomain=Ec.generate(e,Ec.PE_PCSINFO_OPTION_NONE),this.m_pPCSInfoNoDomain||l("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 e=1/o.getUnit().getUnitFactor(),t=o.getDatum().getSpheroid().getAxis();this.m_oneMillimeter=.001/t*e,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 s(this.m_pPCSInfoNoDomain),this.m_pPCSInfoNoDomain}getCentralMeridian(){return this.m_centralMeridian}updateGCSHorizon(){if(this.m_peCoordSys.getType()!==xc.PE_TYPE_PROJCS)return;let t=!0;const n=this.m_peCoordSys,r=n.getGeogcs(),i=n.horizonGcsGenerate();if(!i)return;s(i.length>0);const o=i[0].getNump(),a=i[0].getKind();let h,m;t=i[0].getInclusive()>0;const l=this.getOneDegreeGCSUnit(),g=90*l,u=360*l,c=370*l,_=180*l*xc.PE_HORIZON_DELTA/Math.PI,d=e.constructEmpty();let p=null;if(o>1)for(let e=1;e<o;e++)if(i[e].getKind()===xc.PE_HORIZON_LINE){p||(p=new I);const t=i[e].getCoord();p.startPathCoords(t[0][0],t[0][1]),p.lineToCoords(t[1][0],t[1][1])}if(a===xc.PE_HORIZON_RECT){const e=i[0].getCoord();if(d.setFromPoints([new We(e[0][0],e[0][1]),new We(e[1][0],e[1][1])],2),Math.abs(d.ymax-g)<1e-7*_&&(d.ymax=g),Math.abs(d.ymin+g)<1e-7*_&&(d.ymin=-g),d.width()>c){const e=-400*l,t=e+5*u;d.setCoords({xmin:e,ymin:d.ymin,xmax:t,ymax:d.ymax})}const s=new ge({env2D:d});this.m_GCSHorizon||(this.m_GCSHorizon=s,this.m_bGCSHorisonIsInclusive=t)}else{let n=this.getPCSInfo().isGcsHorizonMultiOverlap();const a=Au(r,null,null,1),c=[],_=new Ke;for(let t=0;t<o;t++){if(i[t].getKind()!==xc.PE_HORIZON_POLY)continue;h=i[t].getSize();const s=i[t].getCoord(),n=e.constructEmpty();n.setFromPoints(Nt(s),h),c.push(new Ke(n.xmin,n.xmax)),n.width(),_.merge(c.at(-1))}let d=!1;const f=new Ke;_.width()>u&&c.length>1?(f.vmin=this.getCentralMeridian()-u,f.vmax=f.vmin+2*u,d=!0,n=!0):(f.vmin=_.vmin,f.vmax=f.vmin+u);const x=e=>{let t=0;for(;c[e].vmin+t<f.vmin;)t+=u;for(;c[e].vmax+t-u>f.vmin;)t-=u;return t};let y=new C;if(n){const e=new Gg,t=(new tl).executeMany(e,a,null);for(let s=0;s<o;s++){if(i[s].getKind()!==xc.PE_HORIZON_POLY)continue;h=i[s].getSize();const n=i[s].getCoord();m=i[s].getInclusive()>0;const r=new C;if(r.addPathPoint2D(Nt(n),h-1,!0),d){const t=x(s),n=c[s].clone();n.move(t);let i=t;const o=new Xt;do{o.setShiftCoords(i,0);const t=r.clone();t.applyTransformation(o),e.tick(t),e.tock(),i+=u,n.move(u)}while(n.vmin<f.vmax)}else e.tick(r),t.tock()}y=t.next()}else{y=new C;for(let e=0;e<o;e++){if(i[e].getKind()!==xc.PE_HORIZON_POLY)continue;h=i[e].getSize();const n=i[e].getCoord();if(m=i[e].getInclusive()>0,s(m===t),d){const t=new C;t.addPathPoint2D(Nt(n),h-1,!0);const s=x(e),r=c[e].clone();r.move(s);let i=s;const o=new Xt;do{if(0!==i){o.setShiftCoords(i,0);const e=new C({copy:t});e.applyTransformation(o),y.addPath(e,0,!0)}else y.addPath(t,0,!0);i+=u,r.move(u)}while(r.vmin<f.vmax)}else y.addPathPoint2D(Nt(n),h-1,!0)}}d&&(y=(new zt).execute(y,new e(f.vmin,-g-l,f.vmax,g+l),a,null)),t?(new Eh).accelerateGeometry(y,a,1):(new Xm).accelerateGeometry(y,a,1),(new ol).accelerateGeometry(y,a,1),null===this.m_GCSHorizon&&(this.m_GCSHorizon=y,this.m_bGCSHorisonIsInclusive=t,this.m_GCSSplitLines=p)}}updateAreaOfUse(){return null}updatePCSHorizon(){if(this.m_peCoordSys.getType()!==xc.PE_TYPE_PROJCS)return;const t=this.m_peCoordSys.horizonPcsGenerate();if(!t)return;let n;this.getPCSInfo();const r=t[0].getKind();t[0].getInclusive();const i=e.constructEmpty(),o=t[0].getNump();let a=!1;if(r===xc.PE_HORIZON_RECT){const e=t[0].getCoord();i.setFromPoints(Nt(e),2),n=new ge({env2D:i})}else{let e=-1;for(let s=0;s<o;s++)t[s].getKind()===xc.PE_HORIZON_POLY&&(e=s);s(e>=0);const r=t[e].getSize()-1,i=t[e].getCoord(),h=new C;n=h,h.addPathPoint2D(Nt(i),r,!0),a=!0}if(this.getPCSInfo().isDensificationNeeded()){s(r!==xc.PE_HORIZON_RECT);const e=1e5*this.getOneMeterPCSUnit();n=(new jt).execute(n,e,0,0,null)}if(a){{const e=new ge;n.queryEnvelope(e),n.calculateArea2D(),n.calculateLength2D(),n.getExteriorRingCount()}(new Eh).accelerateGeometry(n,null,1)}null===this.m_PCSHorizon&&(this.m_PCSHorizon=n)}updatePannableExtent(){const t=this.m_peCoordSys.getType();if(t===xc.PE_TYPE_PROJCS){const t=this.m_peCoordSys,s=this.getPCSInfo().getCentralMeridian(),n=t.getGeogcs();n||l("");const r=[s+1/n.getUnit().getUnitFactor()*Math.PI,0];yc.geogToProj(t,1,r);const i=r[0],o=t.getParameters()[xc.PE_PARM_X0].getValue(),a=this.getPCSHorizon(),h=e.constructEmpty();a.queryEnvelope(h);const m=Math.abs(i-o),g=m+o,u=-1*m+o,c=h.ymax,_=h.ymin;this.m_pannableExtent.setCoords({xmin:u,ymin:_,xmax:g,ymax:c})}else if(t===xc.PE_TYPE_GEOGCS){const e=1/this.m_peCoordSys.getUnit().getUnitFactor()*Math.PI;this.m_pannableExtent.setCoords({xmin:-e,ymin:-e/2,xmax:e,ymax:e/2})}else l("")}updatePannableExtentGCS(){const t=this.m_peCoordSys.getType();if(t===xc.PE_TYPE_PROJCS){const t=this.m_peCoordSys,s=this.m_centralMeridian,n=t.getGeogcs();n||l("");const r=1/n.getUnit().getUnitFactor()*Math.PI,i=this.getGCSHorizon(),o=e.constructEmpty();i.queryEnvelope(o),this.m_pannableExtentGCS.setCoords({xmin:s-r,ymin:o.ymin,xmax:s+r,ymax:o.ymax})}else if(t===xc.PE_TYPE_GEOGCS){const e=1/this.m_peCoordSys.getUnit().getUnitFactor()*Math.PI;this.m_pannableExtentGCS.setCoords({xmin:-e,ymin:-e/2,xmax:e,ymax:e/2})}else l("")}updateDomain(){if(1===this.m_csType){const t=400*this.getOneDegreeGCSUnit();this.m_domain=e.construct(-t,-t,t,t)}else{s(2===this.m_csType);const t=Ec.generate(this.m_peCoordSys,Ec.PE_PCSINFO_OPTION_DOMAIN);t||l("generate pcs info failed");const n=new e(t.getDomainMinx(),t.getDomainMiny(),t.getDomainMaxx(),t.getDomainMaxy());this.m_domain.isEmpty()&&this.m_domain.setCoords({env2D:n})}}updatePoles(){if(this.m_peCoordSys.getType()===xc.PE_TYPE_PROJCS){const e=90*this.getOneDegreeGCSUnit(),t=[[0,e],[0,-e]];yc.geogToProj(this.m_peCoordSys,2,t);const s=this.getPCSInfo().getNorthPoleLocation()!==Ec.PE_POLE_OUTSIDE_BOUNDARY,n=this.getPCSInfo().getSouthPoleLocation()!==Ec.PE_POLE_OUTSIDE_BOUNDARY;this.m_polesUpdated||(s&&this.m_northPole.setCoords(t[0][0],t[0][1]),n&&this.m_southPole.setCoords(t[1][0],t[1][1]),this.m_polesUpdated=1)}else this.m_polesUpdated=1}updateGeogToProjFactors(){if(this.m_peCoordSys.getType()===xc.PE_TYPE_PROJCS){const e=this.getOneDegreeGCSUnit(),t=this.m_pPCSInfoNoDomain.getCentralMeridian(),n=[0,0,0,0];n[0]=t,n[1]=0,n[2]=t+e,n[3]=0;const r=yc.geogToProj(this.m_peCoordSys,2,n);s(2===r);const i=(n[2]-n[0])/e,o=n[0];0===this.m_geogToProjFactorsUpdated&&(this.m_geogToProjFactor=i,this.m_geogToProjOffset=o,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(e){return this.m_bIsPannable||0!==this.m_polesUpdated||this.updatePoles(),e?this.m_southPole:this.m_northPole}getGeogToProjFactors(){return 0===this.m_geogToProjFactorsUpdated&&this.updateGeogToProjFactors(),je(this.m_geogToProjFactor,this.m_geogToProjOffset)}getDomainXY(){if(this.m_bIsPannable)return this.m_domain.clone();let e=!1;return e=this.m_domain.isEmpty(),e&&this.updateDomain(),this.m_domain.clone()}getPrimeMeridian(){return this.m_primeMeridian}getLatestID(){return this.m_WKID}getOldID(){let e=this.m_oldWKID;if(e<0){if(e=0,this.m_WKID>0){const t=[0],s=[0];Vc(this.m_peCoordSys.getType(),this.m_WKID,t,s)||l("query_code_change"),e=t[0]}this.m_oldWKID=e}return e}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(e,t){return!1}static equal_for_projection(e,t){return!1}}class Hg{constructor(e,t=!0){this.m_oneMeter=0,this.m_WKID=-1,this.m_oldWKID=-1,this.m_canonicalWkt="not yet implemented",this.m_model=0,this.m_unit=new xu,this.m_cached=!1}setCached(e=!0){this.m_cached=e}getCached(){return this.m_cached}getOneMeterUnit(){return 0}getLatestID(){return this.m_WKID}getOldID(){let e=this.m_oldWKID;return e<0&&(e=0,this.m_WKID>0&&(e=this.m_WKID),this.m_oldWKID=e),e}getModel(){return 0}isCustomWkid(){return!1}getVerticalUnit(){return this.m_unit}static equal(e,t){return!1}static equal_for_projection(e,t){return!1}}function kg(e,t,s,n){return Mg(!0,e,t,s,n)}function Ag(e,t,s,n){return Ug(!0,e,t,s,n)}function Mg(e,t,s,n,r){return t.hasVCS()&&s.hasVCS()?Bg():Rg(t,s,n,r)}function Ug(e,t,s,n,r,i){return new Wg(e?2:1,t,s,n,r,i)}function qg(e,s,n,r,i,o=!1){s&&n||t("");if(1===e&&s.hasVCS()&&n.hasVCS())return h("hv xform not impl"),[];{const e=Xc(s,n,r,i,o),t=[];for(const s of e)t.push(s);return t}}function Og(){return{centralMeridianOfOutputGCS:Number.NaN,densificationStep:Number.NaN,clipWithInputHorizon:!0,clipWithOutputHorizon:!0,legacyHorizonClipping:!1,normalizeResultGeometry:!1,equals(e){return rt(this.centralMeridianOfOutputGCS,e.centralMeridianOfOutputGCS)&&rt(this.densificationStep,e.densificationStep)&&this.clipWithInputHorizon===e.clipWithInputHorizon&&this.clipWithOutputHorizon===e.clipWithOutputHorizon&&this.legacyHorizonClipping===e.legacyHorizonClipping&&this.normalizeResultGeometry===e.normalizeResultGeometry}}}function Bg(e,t,n,r){return s(0),{}}function Rg(s,n,r,i){s&&n||t("!inputSR || !outputSR");const o=s.getLatestID(),a=n.getLatestID();if(3857===o&&4326===a){if(s.m_bDefaultDescriptor&&n.m_bDefaultDescriptor)return mu()}else if(4326===o&&3857===a&&s.m_bDefaultDescriptor&&n.m_bDefaultDescriptor)return lu();const h=e.constructEmpty();h.setCoords({env2D:r});const m=s.getCoordinateSystemType(),l=n.getCoordinateSystemType();if(0===m||0===l)return Yg(s,n);if(i){const e=i.find(0,s.getGCS(),n.getGCS());if(e)return Yg(s,n,e)}const g=s.getGCS().getLatestID(),u=n.getGCS().getLatestID();if(g>0&&g===u)return Yg(s,n);const c=new su(s,n,r);{const e=ru(c);if(e)return e}if(!h.isEmpty()&&1!==m){s.getGCS();let e=new ge({env2D:h});const t=s.getSRToGCSTransform();e=(new Hh).execute(e,t,null),e.queryEnvelope(h)}let _=null;if(!r.isEmpty()){const e=s.getGCS().getPECoordSys(),t=n.getGCS().getPECoordSys();let r=null;if(!h.isEmpty()){const t=e.getPrimem().getLongitude(),s=e.getUnit().getUnitFactor();r=new wc(h.xmin,h.ymin,h.xmax,h.ymax,t,s)}const i=1;let o=Sc.getGTlist(e,t,2,Sc.PE_GTLIST_OPTS_COMMON,r,i);o&&(_=Lc(o),o=null),r&&r.destroy()}r.isEmpty(),null!==_&&0===_.count()&&(_=null);return iu(c,Yg(s,n,_||void 0))}function Yg(e,t,s,n,r){return new Wg(1,e,t,s,n,r)}function Xg(){return{flagsMask:0,setFlag(e,t){t?this.flagsMask|=e:this.flagsMask&=~e},hasFlag(e){return!!(this.flagsMask&e)}}}function Lg(){return{m_extendedParams:Og(),m_extendedParamsInternal:Xg()}}function zg(){return Lg()}let Wg=class e{constructor(e,n,r,i,o,a){let h,m;this.m_datumTran=null,this.m_bIdentity=!0,this.m_bIdentityGeogToGeog=!0,this.m_bVertical=!1,this.m_bNormalize=!1,n&&r||t("!inputSR || !outputSR"),i&&0===i.getType()&&(i.m_bReadOnly=!0),this.m_bNormalize=!1,1!==e&&(h=n.getVCS(),m=r.getVCS(),this.m_bVertical=null!=h&&null!=m),this.m_inputSR=n,this.m_outputSR=r,this.m_bIdentity=!1,this.m_bIdentityGeogToGeog=!1,s(!this.m_params),o&&(this.m_params=Lg(),this.m_params.m_extendedParams=o),a&&(this.m_params||(this.m_params=Lg()),this.m_params.m_extendedParamsInternal=a);let l=!1;const g=null!=i,u=n.getCoordinateSystemType(),c=r.getCoordinateSystemType();if(r.isPannable()&&0!==u&&o){const e=o.centralMeridianOfOutputGCS;if(!Number.isNaN(e)&&r.isPannable()){const t=r.getPannableExtent(),s=t.getCenterX();if(s!==e){const n=Math.ceil(t.width());e+n!==s+n&&(l=!0)}}}const _=o&&o.normalizeResultGeometry;if(n.equals(r))return this.m_bIdentity=!l,this.m_bIdentityGeogToGeog=!0,void this.updateProjector();const d=!g&&n.equalForProjection(r,this.m_bVertical);this.m_bIdentity=d&&!l,this.m_bIdentity?this.m_bIdentityGeogToGeog=!0:0!==u&&0!==c&&(_&&this.m_outputSR.isPannable()&&(this.m_bNormalize=_),this.m_datumTran=i||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 e(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:zg().m_extendedParams}equals(e){return s(0),!1}isVertical(){return this.m_bVertical}isMatchingTransformation(e,t){return s(0),!1}getGeographicTransformations(){return this.m_datumTran}getExtendedParamsImpl(){return this.m_params?this.m_params.m_extendedParams:zg().m_extendedParams}getExtendedParamsInternal(){return this.m_params?this.m_params.m_extendedParamsInternal:zg().m_extendedParamsInternal}isIdentityGeogToGeog(){return this.m_bIdentityGeogToGeog}normalizeOutput(){return this.m_bNormalize}updateProjector(){this.m_projector=new Dh(this)}};const jg=new Map,Zg=new Map,Kg=new Map;function Qg(e){let t=e.getCode();if(t>0){const e=fu(t);return e||pu(fc.coordsys(t))}const s=e.getName();if(Zg.has(s)){const t=Zg.get(s);if(t&&t.deref()){const s=t.deref();if(s.m_peCoordSys.isEqual(e))return s}}return t=fc.getCode(e),pu(t>0?fc.coordsys(t):e)}function Jg(e){e<=0&&d(e);{const t=fu(e);if(t)return t}const t=vc(fc.coordsys(e));t.get()||d(e);const s=pu(t.release());return s.getLatestID()!==e&&jg.set(e,new WeakRef(s)),s}function $g(e){const t=new Hg({},!0);return t.m_WKID=e,t}function eu(e){const t=vc(fc.fromString(xc.PE_TYPE_COORDSYS,e));return t.get()||p(e),Qg(t.release())}function tu(e){Zg.delete(e.m_peCoordSys.getName()),Kg.delete(hl(e.m_peCoordSys,0,!1))}class su{constructor(e,t,s){this.m_hashCode=-1,e&&(this.m_inputSR=e,this.m_outputSR=t,this.m_env=s.clone(),this.m_hashCode=this.m_inputSR.getHashCode(),this.m_hashCode=Le(this.m_hashCode,this.m_outputSR.getHashCode()),this.m_env.isEmpty()||(this.m_hashCode=Le(this.m_hashCode,st(this.m_env.xmin)),this.m_hashCode=Le(this.m_hashCode,st(this.m_env.xmax)),this.m_hashCode=Le(this.m_hashCode,st(this.m_env.ymin)),this.m_hashCode=Le(this.m_hashCode,st(this.m_env.ymax))))}getHashCode(){return this.m_hashCode}equals(e){return!(this.m_inputSR&&!e.m_inputSR||!this.m_inputSR&&e.m_inputSR)&&(this.m_env.equals(e.m_env)&&this.m_inputSR.equals(e.m_inputSR)&&this.m_outputSR.equals(e.m_outputSR))}clear(){this.m_inputSR=void 0,this.m_outputSR=void 0,this.m_hashCode=-1,this.m_env=void 0}}const nu=new Map;function ru(e){if(nu.has(e.getHashCode()))return nu.get(e.getHashCode())}function iu(e,t){return nu.set(e.getHashCode(),t),t}let ou,au,hu;function mu(){return ou||(ou=Ag(tc(),nc())),ou}function lu(){return au||(au=mu().getInverse()),au}function gu(){return hu||(hu=fc.unit(9001)),hu}function uu(e){return null!==vc(fc.coordsys(e)).get()}const cu=new Map;function _u(e){if(cu.has(e))return cu.get(e);{const t=uu(e);return cu.set(e,t),t}}function du(e){return!1}function pu(e){const t=vc(e),s=e.getCode();if(s>0){const e=fu(s);if(e)return e}const n=e.getName();let r=Zg.get(n);if(r){const t=r.deref();if(t&&t.m_peCoordSys.isEqual(e))return t}const i=new Fg(t.release());if(s>0)return i.setCached(),jg.set(s,new WeakRef(i)),Zg.set(n,new WeakRef(i)),i;const o=hl(e,0,!1);if(r=Kg.get(o),r){const e=r.deref();if(e)return e}return i.setCached(),Kg.set(o,new WeakRef(i)),i}function fu(e){const t=jg.get(e);if(t)return t.deref()}class xu extends Jt{constructor(e){return void 0===e?(super(),this.m_wkid=9001,void(this.m_peUnit=null)):"number"==typeof e?(super(),this.m_factor=e,void(this.m_wkid=0)):(super(e),void(e||(this.m_factor=1,this.m_wkid=9001,this.m_peUnit=gu())))}getUnitType(){return 0}convertFromMeters(e){return e/this.getUnitToBaseFactor()}convertToMeters(e){return e*this.getUnitToBaseFactor()}}const yu=["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 Pu(e,t,s){const n=$e(t,"R");let r=0,i=0;for(let o=0;o<t;o++){let s=e[r]>>i&31;if(i+=5,i>31){const t=37-i;s&=(1<<t)-1,i-=32,r++,s|=(e[r]&(1<<i)-1)<<t}const a=yu[s];n[t-1-o]=a}return s>t?n.push(..."0".repeat(s-t)):s<t&&(n.length=s),n.join("")}function Eu(e,t,n,r,i){s(r>>5<i.length);let o=t,a=n;for(let s=r;s>=0;s-=2){const t=31&s,n=.5*(a+o);e>=n?(i[s>>5]|=1<<t,o=n):a=n}}let Su=new Set;const Cu=2147483645n,Iu=9007199254740990n,bu="operation is not supported for unknown coordinate systems";var wu;function vu(){return{majorSemiAxis:0,e2:0,minorSemiAxis:0,flattening:0,isSphere(){return 0===this.e2}}}function Tu(e,t,s){e.majorSemiAxis=t,e.minorSemiAxis=t*(1-s),e.e2=s*(2-s),e.flattening=s}function Nu(e){if(fc)return;Dc(e);const t=Su;Su=null,t.forEach((e=>{const t=e.deref();t&&t.attachToPe()}))}function Gu(e){Gc(e)}function Du(){return!!fc}function Vu(){return!!Tc}function Fu(){return!!fc||!!Tc}function Hu(e,t,n){return s(Fu()),hc(e,void 0===t?0:t,null,!1)}function ku(e,t){s(Fu());const n=new $u;let r;return Du()?(r=eu(e),n.setHorzProj_(r),n.m_vertcs=null,n.m_userWKID=r.getLatestID()):(r=Nc(e),n.m_unit=r.isPCS?new xu(r.metersOrRadiansPerUnit):new ss(r.metersOrRadiansPerUnit)),ic(n.m_precisionDescriptor,r,null,1),n.m_bDefaultDescriptor=!0,n.m_userWKT=e,n.calculateHashCode(),n.initDbgName(),n}function Au(e,t,s,n,r=!0){let i=null;return t&&(i=vm(t,r)),Mu(e,i,s,n,r)}function Mu(e,s,n,r,i){e||t("!PE_coord_sys");const o=new $u;let a;return a=i?Qg(e):new Fg(e,!1),ic(o.m_precisionDescriptor,a,s,r),o.m_bDefaultDescriptor=!0,o.setHorzProj_(a),o.m_vertcs=s,o.m_userWKID=a.getLatestID(),o.calculateHashCode(),o.initDbgName(),o}function Uu(e,s,n=!1){3===e.getCoordinateSystemType()&&t("image spatial reference cannot be altered");const r=new $u,i=e;return r.m_peCoordSysVal=i.m_peCoordSysVal,r.m_vertcs=i.m_vertcs,r.m_unit=i.m_unit,r.m_precisionDescriptor.assign(s),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 qu(e,t,s){return{}}function Ou(e,s,n){void 0===s&&(s=1),(s<=0||!Number.isFinite(s))&&t(""),e||1===s||t("null Unit has to have z_to_xy_factor equal to 1");const r=new $u;r.m_unit=e;const i=e||new xu(9001);return ac(r.m_precisionDescriptor,i,null,1),r.m_bDefaultDescriptor=!0,Number.isNaN(r.m_precisionDescriptor.m_falseX)&&t("NAN false X/Y are not allowed here"),r.m_localZToXYFactor=s,r.calculateHashCode(),r.initDbgName(),r}function Bu(e,t){return e.snapGeometry(t)}function Ru(e){const t=e.getCoordinateSystemType();return 1===t?e:(3===t&&s(0),e.getGCS())}function Yu(e){return s(Fu()),Vu()?Fc(e):_u(e)}function Xu(e){if(Du()){return null!==vc(fc.fromString(xc.PE_TYPE_COORDSYS,e)).get()}try{return Nc(e),!0}catch(t){}return!1}let Lu;function zu(){return Lu||(Lu=(()=>{const e=Math.trunc(Math.random()*Pt()),t=Date.now();return`|abba_000|${e.toString(16)}|${t.toString(16)}|`})()),Lu}!function(e){e[e.utmDefault=0]="utmDefault",e[e.utmNorthSouth=1]="utmNorthSouth"}(wu||(wu={}));let Wu=0;function ju(e=""){let t=`${zu()}${Wu++}`;return""!==e&&(t+=`|${e}`),t}function Zu(e){return e.startsWith(zu())}let Ku,Qu,Ju,$u=class e{destroy(){tu(this.m_peCoordSysVal),1===this.getCoordinateSystemType()||2===this.getCoordinateSystemType()?this.getPECoordSys().destroy():l("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 ec,this.m_hashCode=0,this.m_bDefaultDescriptor=!1,rc(this.m_precisionDescriptor),Su&&Su.add(new WeakRef(this))}attachToPe(){(this.m_userWKID>0?Hu(this.m_userWKID):ku(this.m_userWKT)).copyTo(this,!1)}copyTo(e,t=!0){(t||e.m_bDefaultDescriptor)&&(e.m_bDefaultDescriptor=this.m_bDefaultDescriptor,e.m_precisionDescriptor.assign(this.m_precisionDescriptor)),e.m_defaultPrecisionSR=null,e.m_gcsToSr=this.m_gcsToSr,e.m_geogSpatialReference=this.m_geogSpatialReference,e.m_hashCode=this.m_hashCode,e.m_localZToXYFactor=this.m_localZToXYFactor,e.m_peCoordSysVal=this.m_peCoordSysVal,e.m_srToGcs=this.m_srToGcs,e.m_userWKID=this.m_userWKID,e.m_userWKT=this.m_userWKT,e.m_vertcs=this.m_vertcs,e.m_unit=this.m_unit}getHashCode(){return this.m_hashCode}getHashCodeHorizontal(){let e=0;return e=this.m_peCoordSysVal?this.m_peCoordSysVal.getHashCode():this.m_unit?this.m_unit.getHashCode():305419891,e}updateTransform(e){if(1===this.getCoordinateSystemType())return Ag(this,this,null);let t=e?this.m_srToGcs:this.m_gcsToSr;if(t)return t;const s=this.getGCS(),n=this;t=e?Ag(n,s,null):Ag(s,n,null);const r=t,i=e?this.m_srToGcs:this.m_gcsToSr;return i||(e?this.m_srToGcs=r:this.m_gcsToSr=r,t)}getHashCodeVertical(){return this.m_vertcs?this.m_vertcs.getHashCode():0}calculateHashCode(){let e=this.getHashCodeHorizontal();const t=this.getHashCodeVertical(),s=this.m_precisionDescriptor.getHashCode();e=Le(e,t),this.m_hashCode=Le(e,s)}initDbgName(){}setHorzProj_(e){this.m_peCoordSysVal=e,this.m_unit=this.m_peCoordSysVal.getUnit()}getTolerance(e=0){return this.m_precisionDescriptor.getTolerance(e)}getResolution(e=0){return this.m_precisionDescriptor.getResolution(e)}getPECoordSys(){return this.m_peCoordSysVal?this.m_peCoordSysVal.m_peCoordSys:null}getPCSInfo(){return this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getPCSInfo()}getCentralMeridian(){if(this.throwIfNotGCSOrPCS(),1===this.getCoordinateSystemType())return 0;return this.getPCSInfo().getCentralMeridian()}getCoordinateSystemType(){const e=this.getPECoordSys();if(e){switch(e.getType()){case xc.PE_TYPE_GEOGCS:return 1;case xc.PE_TYPE_PROJCS:return 2;default:return 0}}else{if((this.m_userWKID>0||this.m_userWKT)&&this.m_unit instanceof xu)return 2;if(this.m_unit instanceof ss)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(e){return this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getPole(e)}getText(){const e=this.getPECoordSys();return e?ll(e):this.m_userWKT??""}getTextExtended(e){const t=this.getPECoordSys();return t?this.getPEVerticalCoordSys()?ml(null,t,this.getPEVerticalCoordSys()):ll(t,e):this.m_userWKT??""}getText2(e=-1){const t=this.getPECoordSys();return t?gl(t,e):this.m_userWKT??""}getUnit(){return this.m_unit}getUnitsPerMillimeter(){return this.m_peCoordSysVal?this.m_peCoordSysVal.getUnitsPerMillimeter():this.m_unit instanceof xu?.001/this.m_unit.getUnitToBaseFactor():this.m_unit instanceof ss?.001/(Nc(this.m_userWKT??this.m_userWKID).semiMajor*this.m_unit.getUnitToBaseFactor()):(_("sr object not in valid state"),0)}getAuthorityName(){return this.getPECoordSys()?ul():""}getVerticalUnit(){return h("vcs not implemented"),{}}getVCS(){return this.m_vertcs}hasVCS(){return!1}getGCSHorisonIsInclusive(){return this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSHorisonIsInclusive()}getGCSHorizon(){return this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSHorizon()}getGCS(){const e=this.getCoordinateSystemType();if(0===e)_(bu);else{if(1===e)return this;3===e&&_("image cs not supported")}if(this.m_geogSpatialReference)return this.m_geogSpatialReference;let t;if(this===tc()||this===sc())t=nc();else{s(this.m_peCoordSysVal);const e=this.m_peCoordSysVal.m_peCoordSys.getGeogcs();e||l(""),t=Au(e,this.m_vertcs,null,this.m_precisionDescriptor.getPrecision(),this.m_peCoordSysVal.getCached())}return this.m_geogSpatialReference?t=this.m_geogSpatialReference:this.m_geogSpatialReference=t,t}getGCSSplitLines(){return this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getGCSSplitLines()}toGCS(e,n){if(0===e.length)return 0;e.length>n.length&&t("coordsSrc.size() > coordsDst.size()");const r=this.getCoordinateSystemType();if(0===r&&_(bu),1===r)return nt(n,e,e.length),e.length;s(this.m_peCoordSysVal);const i=this.getSRToGCSTransform();return(new Hh).transform(i,e,e.length,n)}toGeohash(e,t=8){const s=e.clone();s.scale(9102===this.getGCS().getUnit().getID()?1:this.getGCS().getUnit().getUnitToBaseFactor()/Math.PI*180),s.x<-180?(s.x=tt(s.x,360),s.x<-180&&(s.x+=360)):s.x>180&&(s.x=tt(s.x,360),s.x>180&&(s.x-=360)),s.y>90&&(s.y=90),s.y<-90&&(s.y=-90);const n=5*t,r=new Uint32Array(4);Eu(s.x,-180,180,n-1,r),Eu(s.y,-90,90,n-2,r);return Pu(r,t,t)}isPannable(){const e=this.getCoordinateSystemType();return 0!==e&&3!==e&&(s(this.m_peCoordSysVal),this.m_peCoordSysVal.isPannable())}getPannableExtent(){return this.isPannable()||t("!is_pannable"),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getPannableExtent()}getPannableExtentInGCS(){return this.isPannable()||t("!is_pannable"),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getPannableExtentGCS()}throwIfNotGCSOrPCS(){const e=this.getCoordinateSystemType();1!==e&&2!==e&&t("Not a GCS or PCS")}getDomainXY(){return this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getDomainXY()}getFullWorldExtent(){return this.throwIfNotGCSOrPCS(),this.isPannable()?this.getPannableExtent():this.getDomainXY()}queryPrecisionDescriptor(e){if(e.assign(this.m_precisionDescriptor),Number.isNaN(e.m_falseX))if(Du()||_("projection engine is not loaded"),s(null!==this.m_peCoordSysVal),2!==this.m_precisionDescriptor.m_precision){const t=this.m_peCoordSysVal.getDomainXY();e.m_falseX=t.xmin,e.m_falseY=t.ymin}else e.m_falseX=-Number.MAX_VALUE,e.m_falseY=-Number.MAX_VALUE}queryPrecisionDescriptorWithoutFalseXY(e){e.assign(this.m_precisionDescriptor),e.m_falseX=Number.NaN,e.m_falseY=Number.NaN}queryDefaultPrecisionDescriptorWithoutFalseXY(e){if(this.m_bDefaultDescriptor)e.assign(this.m_precisionDescriptor);else{const t=this.getCoordinateSystemType();0===t?ac(e,this.m_unit,this.m_vertcs,this.m_precisionDescriptor.getPrecision()):3===t?h("image cs"):ic(e,this.m_peCoordSysVal,this.m_vertcs,this.m_precisionDescriptor.getPrecision())}e.m_falseX=Number.NaN,e.m_falseY=Number.NaN}horizontalEqual(e){return Dg(this.m_peCoordSysVal,e.m_peCoordSysVal)}verticalEqual(e){return null!==this.m_vertcs==(null!==e.m_vertcs)&&(!this.m_vertcs||this.m_vertcs.equals(e.m_vertcs))}equals(e){const t=e;if(this===t)return!0;if(!this.horizontalEqual(t)||!this.verticalEqual(t))return!1;if(!t.m_peCoordSysVal){if(s(!this.m_peCoordSysVal),null!==this.m_unit!=(null!==t.m_unit))return!1;if(this.m_unit&&!this.m_unit.equals(t.m_unit))return!1;if(this.m_localZToXYFactor!==t.m_localZToXYFactor)return!1}if(!this.m_bDefaultDescriptor||!t.m_bDefaultDescriptor){if(this.m_peCoordSysVal){if(!this.m_precisionDescriptor.equalsWithoutFalseXY(t.m_precisionDescriptor))return!1;s(t.m_peCoordSysVal);let e=this.m_precisionDescriptor.m_falseX,n=this.m_precisionDescriptor.m_falseY;if(Number.isNaN(e)){const t=this.m_peCoordSysVal.getDomainXY();e=t.xmin,n=t.ymin}let r=t.m_precisionDescriptor.m_falseX,i=t.m_precisionDescriptor.m_falseY;if(Number.isNaN(r)){const e=t.m_peCoordSysVal.getDomainXY();r=e.xmin,i=e.ymin}return e===r&&n===i}return this.m_precisionDescriptor.equals(t.m_precisionDescriptor)}return!0}equalForProjection(e,t){if(this===e)return!0;const s=this.getCoordinateSystemType(),n=e.getCoordinateSystemType();if(0===s||0===n)return 0===s&&0===n?(!t||this.getZToXYFactor()===e.getZToXYFactor())&&(!this.getUnit()||!e.getUnit()||this.getUnit().equals(e.getUnit())):3!==s&&3!==n&&(null===this.getUnit()||null===e.getUnit()||(!t||this.getZToXYFactor()===e.getZToXYFactor())&&this.getUnit().equals(e.getUnit()));if(s!==n)return!1;if(3===s)return this.equals(e);if(Vg(this.m_peCoordSysVal,e.m_peCoordSysVal)){if(!t)return!0;if(null!==this.m_vertcs==(null!==e.m_vertcs))return!this.m_vertcs||this.m_vertcs.equalForProjection(e.m_vertcs)}return!1}equalHorizontal(e){return this.horizontalEqual(e)}equalVertical(e){return s(0),!1}equalVerticalVCS(e){return s(0),!1}convergenceAngle(e){return s(0),0}getPeCoordsysCopy(){if(this.m_peCoordSysVal){const e=this.m_peCoordSysVal.m_peCoordSys;return e||l("cannot clone coord sys"),e}return null}getPeVertcsCopy(){return s(0),0}throwIfLocal(){0===this.getCoordinateSystemType()&&t(bu)}getPrimeMeridian(){return this.throwIfLocal(),s(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(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getOneMeterPCSUnit()}getDefaultPrecisionSR(){if(this.m_bDefaultDescriptor)return this;if(null===this.m_defaultPrecisionSR){const e=new ec;this.queryDefaultPrecisionDescriptorWithoutFalseXY(e),this.m_defaultPrecisionSR=Uu(this,e,!0)}return this.m_defaultPrecisionSR}getPCSHorizon(){return this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getPCSHorizon()}getHorzUnitFactor(){return this.m_unit?this.m_unit.getUnitToBaseFactor():1}querySpheroidData(e){this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal);const t=this.getGCS().getPECoordSys().getDatum().getSpheroid(),n=t.getFlattening();Tu(e,t.getAxis(),n)}getAreaOfUse(){0===this.getCoordinateSystemType()&&_(""),s(this.m_peCoordSysVal);const e=this.m_peCoordSysVal.getAreaOfUse();return null===e?new Qt:new Qt({geom:e.clone(),sr:Hu(4326)})}getZToXYFactor(){return 1}isCustomWkid(){return!1}getOneDegreeGCSUnit(){return this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getOneDegreeGCSUnit()}getGcsUnitFactor(){return this.throwIfNotGCSOrPCS(),s(this.m_peCoordSysVal),this.m_peCoordSysVal.getGcsUnitFactor()}snapGeometry(e){if(e.isEmpty())return!1;if(2===this.m_precisionDescriptor.getPrecision())return!1;const t=e.getGeometryType();if(m(t))return this.snapMultiVertex_(e);if(t===o.enumPoint)return this.snapPoint_(e);if(t===o.enumEnvelope)return this.snapEnvelope_(e);if(a(t))return this.snapSegment_(e);if(t===o.enumGeometryCollection){const t=e;let s=!1;for(let e=0,n=t.getGeometryCount();e<n;++e)s=this.snapGeometry(t.getGeometry(e))||s;return s}l("what else?")}snapMultiVertex_(e){if(s(!e.isEmpty()),s(2!==this.m_precisionDescriptor.getPrecision()),c(e.getGeometryType())){const t=e;if(t.hasNonLinearSegments())return this.snapGeometryWithCurves_(t)}const t=e.getImpl(),n=t.getDescription();let r=!1;for(let s=0,i=n.getAttributeCount();s<i;s++){const e=n.getSemantics(s),i=t.getAttributeStreamRef(e);r=this.snapAttributes(e,i,0,t.getPointCount())||r}return r&&t.notifyModifiedFlags(2001),r}snapPoint_(e){return!1}snapEnvelope_(e){return!1}snapSegment_(e){s(!e.isEmpty()),s(2!==this.m_precisionDescriptor.getPrecision());const t=new ec;this.queryPrecisionDescriptor(t);const n=e.getStartXY(),r=new We;r.x=mc(n.x,t.getFalseX(),t.getGridUnitsXY()),r.y=mc(n.y,t.getFalseY(),t.getGridUnitsXY());let i=!r.equals(n);const o=e.getEndXY(),a=new We;a.x=mc(o.x,t.getFalseX(),t.getGridUnitsXY()),a.y=mc(o.y,t.getFalseY(),t.getGridUnitsXY()),i||=!a.equals(o),i&&e.changeEndPoints2D(r,a);const h=(t,s,n)=>{let r=!1;{const i=e.getStartAttributeAsDbl(t,0),o=mc(i,s,n),a=!rt(o,i);r||=a,a&&e.setStartAttribute(t,0,o)}{const i=e.getEndAttributeAsDbl(t,0),o=mc(i,s,n),a=!rt(o,i);r||=a,a&&e.setEndAttribute(t,0,o)}return r};let m=i?1:0;return e.hasAttribute(1)&&(m|=h(1,t.getFalseZ(),t.getGridUnitsZ())?1:0),e.hasAttribute(2)&&(m|=h(2,t.getFalseM(),t.getGridUnitsM())?1:0),!!m}snapGeometryWithCurves_(e){s(!e.isEmpty()),s(2!==this.m_precisionDescriptor.getPrecision());const t=e.createInstance(),n=new b;let r=0;for(let s=0,i=e.getPathCount();s<i;++s){const i=e.getSegmentCountPath(s);if(0===i){if(t.addPath(e,s,!0),1===t.getPathSize(s)){const e=new ae;t.getPointByVal(t.getPointCount()-1,e),r|=this.snapGeometry(e)?1:0,t.setPointByVal(t.getPointCount()-1,e)}continue}const o=e.isClosedPath(s);for(let a=0,h=o?i-1:i;a<h;++a)e.getSegmentFromPath(s,a,n,!1),r|=this.snapGeometry(n.get())?1:0,t.addSegment(n.get(),0===a);o&&(e.getSegmentFromPath(s,i-1,n,!1),r|=this.snapGeometry(n.get())?1:0,1===i?t.addPathFromClosedSegment(n.get(),!1):t.closeLastPathWithSegment(n.get()))}return r&&t.copyTo(e),!!r}snapAttributes(t,s,n,r){let i=!1;const o=new ec;if(this.queryPrecisionDescriptor(o),0===t){const t=s;for(let s=n;s<r;s++){const n=t.read(2*s),r=e.s_SnapValue(n,o.getFalseX(),o.getGridUnitsXY()),a=t.read(2*s+1),h=e.s_SnapValue(a,o.getFalseY(),o.getGridUnitsXY());i=i||r!==n||h!==a,i&&(t.write(2*s,r),t.write(2*s+1,h))}}else if(1===t){const t=s;for(let s=n;s<r;s++){const n=t.read(s),r=e.s_SnapValue(n,o.getFalseZ(),o.getGridUnitsZ());i=i||!rt(r,n),i&&t.write(s,r)}}else if(2===t){const t=s;for(let s=n;s<r;s++){const n=t.read(s),r=e.s_SnapValue(n,o.getFalseM(),o.getGridUnitsM());i=i||!rt(r,n),i&&t.write(s,r)}}return i}static s_SnapValue(e,t,s){return it((e-t)*s)/s+t}};class ec{constructor(){const e=Iu,t=1e-4,s=.001,n=t*Number(e)*.5;this.m_precision=1,this.m_falseX=-n,this.m_falseY=-n,this.m_unitsXY=Number(e)/(2*n),this.m_falseM=-1e5,this.m_unitsM=1/t,this.m_falseZ=-1e5,this.m_unitsZ=1/t,this.m_toleranceXY=s,this.m_toleranceM=s,this.m_toleranceZ=s}getHashCode(){let e=7777,t=7777;return t=Le(t,this.m_falseM),t=Le(t,this.m_unitsM),e=Le(e,this.m_unitsXY),t=Le(t,this.m_toleranceXY),e=Le(e,this.m_falseZ),t=Le(t,this.m_toleranceZ),e=Le(e,this.m_unitsZ),t=Le(t,this.m_toleranceM),e=Le(e,this.m_precision),Le(e,t)}clone(){const e=new ec;return e.m_falseX=this.m_falseX,e.m_falseY=this.m_falseY,e.m_unitsXY=this.m_unitsXY,e.m_falseZ=this.m_falseZ,e.m_unitsZ=this.m_unitsZ,e.m_falseM=this.m_falseM,e.m_unitsM=this.m_unitsM,e.m_toleranceXY=this.m_toleranceXY,e.m_toleranceZ=this.m_toleranceZ,e.m_toleranceM=this.m_toleranceM,e.m_precision=this.m_precision,e}assign(e){return this.m_falseX=e.m_falseX,this.m_falseY=e.m_falseY,this.m_unitsXY=e.m_unitsXY,this.m_falseZ=e.m_falseZ,this.m_unitsZ=e.m_unitsZ,this.m_falseM=e.m_falseM,this.m_unitsM=e.m_unitsM,this.m_toleranceXY=e.m_toleranceXY,this.m_toleranceZ=e.m_toleranceZ,this.m_toleranceM=e.m_toleranceM,this.m_precision=e.m_precision,this}initialize2D(e,t){}getTolerance(e){switch(e){case 0:return this.m_toleranceXY;case 1:return this.m_toleranceZ;case 2:return this.m_toleranceM;default:return 0}}getResolution(e){if(2===this.m_precision)return 0;switch(e){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 e;switch(this.m_precision){case 0:{const e=ec.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(ec.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(),l("")}return t}getZGridRange(){const e=new Ke;switch(this.m_precision){case 0:{const t=ec.getLimit32()/this.getGridUnitsZ();e.setCoords(this.getFalseZ(),this.getFalseZ()+t)}break;case 1:{const t=Number(ec.getLimit64())/this.getGridUnitsZ();e.setCoords(this.getFalseZ(),this.getFalseZ()+t)}break;case 2:e.setCoords(-Number.MAX_VALUE,Number.MAX_VALUE);break;default:e.setEmpty(),l("")}return e}getMGridRange(){const e=new Ke;switch(this.m_precision){case 0:{const t=ec.getLimit32()/this.getGridUnitsM();e.setCoords(this.getFalseM(),this.getFalseM()+t)}break;case 1:{const t=Number(ec.getLimit64())/this.getGridUnitsM();e.setCoords(this.getFalseM(),this.getFalseM()+t)}break;case 2:e.setCoords(-Number.MAX_VALUE,Number.MAX_VALUE);break;default:e.setEmpty(),l("")}return e}setTolerance(e,s){switch(s<0&&t("tol < 0"),Number.isFinite(s)||t("tol is not finite"),e){case 0:this.m_toleranceXY=s;break;case 1:this.m_toleranceZ=s;break;case 2:this.m_toleranceM=s;break;default:t("cannot set tolerance for this attribute")}}setGridParams(e,s,n){Number.isFinite(e)&&Number.isFinite(s)&&Number.isFinite(n)||t("grid params are not finite"),n<1&&t("grid units cannot be smaller than 1.0"),this.m_falseX=e,this.m_falseY=s,this.m_unitsXY=n}setZParams(e,s){Number.isFinite(e)&&Number.isFinite(s)||t("grid params are not finite"),s<1&&t("grid units cannot be smaller than 1.0"),this.m_falseZ=e,this.m_unitsZ=s}setMParams(e,s){Number.isFinite(e)&&Number.isFinite(s)||t("grid params are not finite"),s<1&&t("grid units cannot be smaller than 1.0"),this.m_falseM=e,this.m_unitsM=s}setPrecision(e){}equals(e){return this===e||rt(this.m_falseX,e.m_falseX)&&rt(this.m_falseY,e.m_falseY)&&this.equalsWithoutFalseXY(e)}snapPrecision(){if(2===this.m_precision)return;const e=(e,t,s,n)=>{if(!Number.isFinite(t)||!Number.isFinite(s))return s;if(s<1)return 1;if(!n)return s;const r=Number(e)/s;return Math.trunc((t+r-t)*s)>e&&(s=e/(t+r-t)),Math.max(1,s)},t=Number(0===this.m_precision?Cu:Iu);this.m_unitsXY=e(t,this.m_falseX,this.m_unitsXY,!0),this.m_unitsXY=e(t,this.m_falseY,this.m_unitsXY,!0),this.m_unitsZ=e(t,this.m_falseZ,this.m_unitsZ,!1),this.m_unitsM=e(t,this.m_falseM,this.m_unitsM,!1)}verifyPrecision(){if(2===this.m_precision)return!0;const e=(e,t,s,n)=>{if(s<1)return!1;if(!Number.isFinite(t)||!Number.isFinite(s))return!1;if(!n)return!0;const r=Number(e)/s;return!(BigInt((t+r-t)*s)>e)},t=0===this.m_precision?Cu:Iu;return!!e(t,this.m_falseX,this.m_unitsXY,!0)&&(!!e(t,this.m_falseY,this.m_unitsXY,!0)&&(!!e(t,this.m_falseZ,this.m_unitsZ,!1)&&!!e(t,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(e){return this===e||this.m_unitsXY===e.m_unitsXY&&this.m_falseZ===e.m_falseZ&&this.m_unitsZ===e.m_unitsZ&&this.m_falseM===e.m_falseM&&this.m_unitsM===e.m_unitsM&&this.m_toleranceXY===e.m_toleranceXY&&this.m_toleranceZ===e.m_toleranceZ&&this.m_toleranceM===e.m_toleranceM&&this.m_precision===e.m_precision}setBestXyDomainFromEnvelope(e,t){}setBestZDomainFromZRange(e,t,s){}setBestMDomainFromMRange(e,t,s){}}function tc(){return(!Ku||Du()&&null===Ku.getPECoordSys())&&(Ku=hc(3857,0,null,!0)),Ku}function sc(){return(!Qu||Du()&&null===Qu.getPECoordSys())&&(Qu=hc(102100,0,null,!0)),Qu}function nc(){return(!Ju||Du()&&null===Ju.getPECoordSys())&&(Ju=hc(4326,0,null,!0)),Ju}function rc(e){e.m_falseX=0,e.m_falseY=0,e.m_unitsXY=1,e.m_falseZ=0,e.m_unitsZ=1,e.m_falseM=0,e.m_unitsM=1,e.m_toleranceXY=100*ot(),e.m_toleranceZ=100*ot(),e.m_toleranceM=100*ot(),e.m_precision=2}function ic(e,s,n,r){const i=s instanceof Fg;rc(e),e.m_precision=r,e.m_falseX=Number.NaN,e.m_falseY=Number.NaN;const o=1e-4,a=.001,h=i?s.m_csType:s.isPCS?2:1;if(1===h){const t=(0===r?1/18e5:1e-9)*(i?s.getOneDegreeGCSUnit():Math.PI/s.metersOrRadiansPerUnit/180);e.m_unitsXY=1/t}else if(2===h){const t=(0===r?a:o)*(i?s.getOneMeterPCSUnit():1/s.metersOrRadiansPerUnit);e.m_unitsXY=1/t}else t("unrecognized cs type");e.m_falseM=-1e5,e.m_unitsM=1/(0===r?a:o),e.m_unitsM=Math.max(1,e.m_unitsM),e.m_unitsXY=Math.max(1,e.m_unitsXY);let m=0,l=0;0!==r&&1!==r||(m=2/e.m_unitsXY,l=2/e.m_unitsM),e.m_toleranceXY=Math.max(m,i?s.getUnitsPerMillimeter():2===h?.001/s.metersOrRadiansPerUnit:.001/(s.semiMajor*s.metersOrRadiansPerUnit)),e.m_toleranceM=Math.max(a,l),oc(e,n)}function oc(e,t){const s=1e-4,n=.001;if(e.m_falseZ=-1e5,t){const r=(0===e.m_precision?n:s)*t.getOneMeter();e.m_unitsZ=1/r}else e.m_unitsZ=1/(0===e.m_precision?n:s);e.m_unitsZ=Math.max(1,e.m_unitsZ);let r=0;0!==e.m_precision&&1!==e.m_precision||(r=2/e.m_unitsZ),e.m_toleranceZ=Math.max(t?t.getOneMeter()*n:n,r)}function ac(e,t,s,n){rc(e),e.m_precision=n;const r=0===n?Cu:Iu,i=1e-4,o=.001;let a=1,h=1,m=.001;t&&(h=t.getUnitToBaseFactor()),t&&1===t.getUnitType()?(a=400*Math.PI/180,m=8.983152841195215e-9*Math.PI/180/h):(a=(0===n?o:i)*Number(r)*.5,m=o/h),a/=h,e.m_falseX=-a,e.m_falseY=-a,e.m_unitsXY=Number(r)/(2*a),e.m_falseM=-1e5,e.m_unitsM=1/(0===n?o:i),e.m_unitsM=Math.max(1,e.m_unitsM),e.snapPrecision();let l=0,g=0;0!==e.m_precision&&1!==e.m_precision||(g=2/e.m_unitsM,l=2/e.m_unitsXY),e.m_toleranceXY=Math.max(l,m),e.m_toleranceM=Math.max(o,g),oc(e,s)}function hc(e,t,s,n){if(!n&&t<=0){if(3857===e)return tc();if(102100===e)return sc();if(4326===e)return nc()}const r=new $u;let i,o=null;return Du()?(i=Jg(e),t>0?o=null:t=0,r.setHorzProj_(i),r.m_vertcs=o):(i=Nc(e),r.m_unit=i.isPCS?new xu(i.metersOrRadiansPerUnit):new ss(i.metersOrRadiansPerUnit)),ic(r.m_precisionDescriptor,i,o,1),r.m_bDefaultDescriptor=!0,r.m_userWKID=e,r.calculateHashCode(),r.initDbgName(),r}function mc(e,t,s){return it((e-t)*s)/s+t}let lc=null;const gc=3552713678800501e-30;function uc(e,t,s){return e===t||Math.abs(e-t)<=s*(1+(Math.abs(e)+Math.abs(t))/2)}function cc(e,t){return uc(e,t,gc)}function _c(e,t){return 0===e||Math.abs(e)<=t}function dc(e){return _c(e,gc)}let pc,fc,xc,yc,Pc,Ec,Sc,Cc,Ic,bc,wc;function vc(e){return{_this:e,get(){return this._this},reset(e){this._this=e},release(){const e=this._this;return this._this=null,e}}}let Tc=null;function Nc(e){s(Tc);const t=Tc(e);return t.semiMajor=t.isPCS?Number.NaN:Ac(e),t}function Gc(e){Tc=e,s(Tc)}function Dc(e){const t=e;fc=t.PeFactory,s(fc),wc=t.PeGCSExtent,s(wc),Ic=t.PeLineType,s(Ic),bc=t.PeMath,s(bc),pc=t.PeDouble,s(pc),xc=t.PeDefs,s(xc),yc=t.PeCSTransformations,s(yc),Pc=t.PeGTTransformations,s(Pc),Ec=t.PePCSInfo,s(Ec),Sc=t.PeGTlistExtended,s(Sc),fc.initialize(),Cc=t.PeGTlistExtendedEntry,s(Cc),xc.PE_TYPE_ANGUNIT=512,xc.PE_STR_AUTH_ALL=2,Ec.PE_POLE_LINE_STRAIGHT=2,Ec.PE_POLE_LINE_CURVED=3,xc.PE_PARM_LAM0=2,xc.PE_PARM_PHI0=6,xc.PE_PRJ_AZIMUTHAL_EQUIDISTANT=43032,xc.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA=43033,xc.PE_PRJ_ALBERS=43007,xc.PE_PRJ_CYLINDRICAL_EQAREA=43034,xc.PE_TYPE_VERTCS=8,xc.PE_LINETYPE_GEODESIC=0,xc.PE_LINETYPE_LOXODROME=1,xc.PE_LINETYPE_GREAT_ELLIPTIC=2,xc.PE_LINETYPE_NORMAL_SECTION=3,Sc.PE_GTLIST_OPTS_USABLE=1,Tc=null}function Vc(e,t,s,n){return t<=0?(s[0]=0,n[0]=0,!1):(s[0]=t,n[0]=t,!0)}function Fc(e){s(Vu());return!!Tc(e).isPCS||Hc(e)}function Hc(e){return fc&&_("pe has been loaded. no-pe methods should not be used at this point."),lc||Mc(),lc.has(e)}const kc=/(?:ELLIPSOID|SPHEROID)\["(?:\w|[-()])+",(\d+\.\d+)/;function Ac(e){if(fc&&_("pe has been loaded. no-pe methods should not be used at this point."),"string"==typeof e){const s=e.match(kc);s&&2===s.length||t("bad gcs wkt");const n=Number.parseFloat(s[1]);return Number.isFinite(n)||t("bad gcs wkt"),n}return lc||Mc(),lc.has(e)||_("gcs wkid not found"),lc.get(e)}function Mc(){lc=new Map;for(const e in es){const t=Number.parseFloat(e),s=es[e];if(Array.isArray(s))for(const e of s)lc.set(e,t);else lc.set(s,t)}ts()}function Uc(e,t){const s=fc.geogtran(e);s||d(e);return new Yc(s,t)}function qc(e,t){const s=fc.fromString(xc.PE_TYPE_GEOGTRAN,e);s||p(e);return new Yc(s,t)}function Oc(e,t){return new Yc(e,t)}const Bc=ze(0),Rc=ze(1);let Yc=class e{constructor(t,s){if(t instanceof e)return this.m_geogTranWrapper=t.m_geogTranWrapper,this.m_bInverted=s?!t.m_bInverted:t.m_bInverted,void(this.m_hashCode=Le(this.m_geogTranWrapper.getHashCode(),this.m_bInverted?Rc:Bc));this.m_geogTranWrapper=new Vm(t),this.m_bInverted=s,this.m_hashCode=Le(this.m_geogTranWrapper.getHashCode(),this.m_bInverted?Rc:Bc)}getID(){return this.m_geogTranWrapper.getLatestId()}getLatestID(){return this.m_geogTranWrapper.getLatestId()}getText(){return this.m_geogTranWrapper.getText()}getTextExtended(e){if(!this.m_geogTranWrapper.getGeogtran())return"";if(-1===e)return this.m_geogTranWrapper.getGeogtran().toString();{const t=0===e?xc.PE_STR_AUTH_TOP:xc.PE_STR_AUTH_ALL;return this.m_geogTranWrapper.getGeogtran().toString(t)}}getText2(e=-1){let t=xc.PE_STR_FMT_WKT2;return-1!==e&&(t|=0===e?xc.PE_STR_AUTH_TOP:xc.PE_STR_AUTH_ALL),this.m_geogTranWrapper.getGeogtran().toString(t)}getName(){return this.m_geogTranWrapper&&this.m_geogTranWrapper.getGeogtran()?this.m_geogTranWrapper.getGeogtran().getName():""}getInputSpatialReference(){return this.m_bInverted?this.m_geogTranWrapper.getOutputSr(!1):this.m_geogTranWrapper.getInputSr(!1)}getOutputSpatialReference(){return this.m_bInverted?this.m_geogTranWrapper.getInputSr(!1):this.m_geogTranWrapper.getOutputSr(!1)}getInverse(){return new e(this,!0)}isInverted(){return this.m_bInverted}getHashCode(){return this.m_hashCode}GetPeGeogtran(){return this.m_geogTranWrapper.getGeogtran()}equals(e){const t=e;return t===this||this.m_bInverted===t.m_bInverted&&(this.GetPeGeogtran()===t.GetPeGeogtran()||this.getID()===t.getID()&&!(0===this.getID()&&!this.GetPeGeogtran().isEqual(t.GetPeGeogtran())))}referencesMissingData(){return!!this.m_geogTranWrapper&&!this.m_geogTranWrapper.isUsable()}getWrapper(){return this.m_geogTranWrapper}};function Xc(e,t,n,r,i){const o=e.getGCS(),a=t.getGCS(),h=o.getPECoordSys(),m=a.getPECoordSys();let l=null;if(!n.isEmpty()){const t=n.clone();if(!t.isEmpty()&&2===e.getCoordinateSystemType()){let s=new ge({env2D:t});const n=Ag(e,o,null);s=(new Hh).execute(s,n,null),s.queryEnvelope(t)}if(!t.isEmpty()){const e=h.getPrimem().getLongitude(),s=h.getUnit().getUnitFactor();l=new wc(t.xmin,t.ymin,t.xmax,t.ymax,e,s)}}let g=r;g>=Pt()&&(g=0);const u=[];let c=Sc.PE_GTLIST_OPTS_COMMON;i||(c&=~Sc.PE_GTLIST_OPTS_USABLE);for(let _=0;_<2;_++){u.length=0;const e=g,t=Sc.getGTlist(h,m,2,c,l,e);let n=!1;if(t&&t.length>0)for(let o=0,a=t.length;o<a;o++){const e=Lc([t[o]]);if(s(e),i&&e.referencesMissingData())n=!0;else if(u.push(e),r>0&&u.length===r)break}if(!n)break;0===g||(g=0)}return l&&l.destroy(),u}function Lc(e){s(null!==e);const t=new Wc,n=e[0].getSteps();if(n){const s=e[0].getEntries();for(let e=0;e<n;e++){const n=0!==s[e].getDirection(),r=Oc(s[e].getGeogtran(),n);t.add(r)}return t.create()}return null}let zc=class{constructor(e,t,s,n){this.m_bReadOnly=!0,this.m_name="",this.m_fastTrack=-1,this.m_bNameIsSet=!1,this.m_transforms=e,t&&(this.m_name=t,this.m_bNameIsSet=!0),this.m_inputSr=s,this.m_outputSr=n}getType(){return 0}getName(){if(this.m_bNameIsSet)return this.m_name;if(0===this.m_transforms.length)return"";let e="";for(const t of this.m_transforms)e.length>0&&(e+=" + "),t.isInverted()&&(e+="~"),e+=t.getName();return e}count(){return this.m_transforms.length}createInverse(){return this.getInverse()}getHashCode(){let e=1973;for(let t=0;t<this.m_transforms.length;t++)e=Le(e,this.m_transforms[t].getHashCode());return e}equals(e){return s(0),!1}referencesMissingData(){if(0===this.m_transforms.length)return!1;for(const e of this.m_transforms)if(e.referencesMissingData())return!0;return!1}isMatchingTransformation(e,t){return s(0),!1}validateTransformation(e,t){return s(0),!1}nameIsSet(){return s(0),!1}getInputSpatialReference(){return this.m_inputSr}getOutputSpatialReference(){return this.m_outputSr}getStep(e){return(e<0||e>this.count())&&f(""),this.m_transforms[e]}getInverse(){const e=new Wc;return e.addSteps(this,!0),e.setInputSpatialReference(this.m_outputSr),e.setOutputSpatialReference(this.m_inputSr),e.create()}transform(e,t,s){if(0===this.count())return;let n=this.m_inputSr,r=this.m_outputSr;if(e&&(r=gt(n,n=r)),0===this.m_transforms.length)return void Fm(n,null,r,null,t,null,s);let i=this.m_fastTrack;if(1===i)return void v(e,this.m_transforms,(n=>{Um(n.getWrapper(),e!==n.isInverted(),t,null,s)}));const o=Dm();-1===i&&o.initFromGcsAndVcs(n,null);const a=Dm();let h=e?this.m_transforms.length-1:0;const m=e?-1:1;for(let g=0,u=this.m_transforms.length;g<u;g++,h+=m){if(0===g){const r=this.m_transforms[h];Hm(n.getPECoordSys(),null,r.getWrapper(),e!==r.isInverted(),t,null,s,a),-1===i&&(o.equals(a)||(i=0)),o.assign(a)}else{const n=this.m_transforms[h-m],r=this.m_transforms[h];Am(o,n.getWrapper(),e!==n.isInverted(),r.getWrapper(),e!==r.isInverted(),t,null,s,a),-1===i&&(o.equals(a)||(i=0)),o.assign(a)}const r=this.m_transforms[h];Mm(o,r.getWrapper(),e!==r.isInverted(),t,null,s,a),o.assign(a)}const l=this.m_transforms[h-m];km(o,l.getWrapper(),e!==l.isInverted(),r,null,t,null,s),-1===i&&(a.initFromGcsAndVcs(r,null),o.equals(a)||(i=0)),this.m_fastTrack=0===i?0:1}};class Wc{constructor(){this.m_transforms=[],this.m_inputGCS=null,this.m_outputGCS=null,this.m_name="",this.m_bNameIsSet=!1}getInputSpatialReference(){return null!==this.m_inputGCS?this.m_inputGCS:this.count()>0?this.m_transforms[0].getInputSpatialReference():null}setInputSpatialReference(e){this.m_inputGCS=e?e.getGCS():null}getOutputSpatialReference(){return null!==this.m_outputGCS?this.m_outputGCS:this.count()>0?this.m_transforms.at(-1).getOutputSpatialReference():null}setOutputSpatialReference(e){this.m_outputGCS=e?e.getGCS():null}getName(){if(this.m_bNameIsSet)return this.m_name;if(0===this.m_transforms.length)return"";let e="";for(const t of this.m_transforms)e.length>0&&(e+=" + "),t.isInverted()&&(e+="~"),e+=t.getName();return e}count(){return this.m_transforms.length}getStep(e){return(e<0||e>this.count())&&f(""),this.m_transforms[e]}setStep(e,t){s(0)}add(e){this.m_transforms.push(e)}addSteps(e,t){if(t)for(let s=e.count()-1;s>=0;--s)this.add(e.getStep(s).getInverse());else for(let s=0;s<e.count();++s)this.add(e.getStep(s))}clear(){this.m_transforms=[],this.m_name="",this.m_bNameIsSet=!1,this.m_inputGCS=null,this.m_outputGCS=null}remove(e){s(0)}create(){const e=this.getInputSpatialReference(),t=this.getOutputSpatialReference(),s=new zc(this.m_transforms,this.m_bNameIsSet?this.m_name:null,e,t);return s.m_bReadOnly=!0,this.clear(),s}}const jc=Object.freeze(Object.defineProperty({__proto__:null,SpatialReference:$u,SpatialReferencePrecisionDescriptor:ec,create:Hu,createFromWKT:ku,createImplFromPe:Au,createLocal:Ou,createWithNewPrecision:Uu,createWithNewVCS:qu,getGCS:Ru,getTempName:ju,hasNoPe:Vu,hasPe:Du,injectNoPe:Gu,injectPe:Nu,isInitialized:Fu,isTempName:Zu,isValidWkid:Yu,isValidWkt:Xu,makeSpheroidData:vu,snapGeometry:Bu,webMercator:tc,webMercator102100:sc,wgs84:nc},Symbol.toStringTag,{value:"Module"})),Zc=Object.freeze(Object.defineProperty({__proto__:null,OperatorProject:Hh},Symbol.toStringTag,{value:"Module"})),Kc=Object.freeze(Object.defineProperty({__proto__:null,CompositeGeographicTransformation:zc,CompositeGeographicTransformationEditor:Wc,createImpl:Lc,queryGtListImpl:Xc},Symbol.toStringTag,{value:"Module"})),Qc=Object.freeze(Object.defineProperty({__proto__:null,GeographicTransformation:Yc,create:Uc,createFromPe:Oc,createFromWKT:qc},Symbol.toStringTag,{value:"Module"})),Jc=Object.freeze(Object.defineProperty({__proto__:null,ProjectionTransformation:Wg,createEx:Ag,createFromAoi:kg,createImpl:Mg,createImplEx:Ug,makeExtendedParams:Og,makeExtendedParamsInternal:Xg,queryTransformationList:qg},Symbol.toStringTag,{value:"Module"}));export{Yl as $,ns as A,am as B,ua as C,Nl as D,pc as E,Ic as F,vu as G,hm as H,om as I,Oh as J,Bh as K,Gg as L,Uh as M,qh as N,Rm as O,cc as P,gs as Q,Bl as R,ng as S,La as T,ms as U,Ul as V,Fl as W,Yo as X,ps as Y,yc as Z,Cl as _,ol as a,ks as a0,Ps as a1,Cs as a2,Rl as a3,xc as a4,Ih as a5,Hs as a6,ys as a7,Ug as a8,al as a9,Xu as aA,Yu as aB,Tm as aC,Uu as aD,ec as aE,Qt as aF,jc as aG,Zc as aH,Kc as aI,Qc as aJ,Jc as aK,Xg as aa,Og as ab,gg as ac,Jn as ad,tr as ae,Om as af,Bm as ag,ra as ah,Ua as ai,eh as aj,nh as ak,Ga as al,Du as am,Kn as an,Bu as ao,fa as ap,_a as aq,ga as ar,Ja as as,Qs as at,Js as au,Us as av,ju as aw,fc as ax,Ol as ay,Ds as az,ku as b,Hu as c,qm as d,Xm as e,Eh as f,ph as g,tl as h,Bo as i,Gu as j,ma as k,na as l,Ta as m,oa as n,Ln as o,Ag as p,zo as q,Dr as r,la as s,bc as t,Ah as u,Hh as v,Gl as w,Mh as x,Va as y,Ou as z};
|