@arcgis/core 4.33.0-next.20250422 → 4.33.0-next.20250423

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.
Files changed (152) hide show
  1. package/arcade/geometry/constructors.js +1 -1
  2. package/assets/components/assets/icon/mosaicMethodBlend16.json +1 -0
  3. package/assets/components/assets/icon/mosaicMethodBlend24.json +1 -0
  4. package/assets/components/assets/icon/mosaicMethodBlend32.json +1 -0
  5. package/assets/components/assets/icon/mosaicMethodByAttribute16.json +1 -0
  6. package/assets/components/assets/icon/mosaicMethodByAttribute24.json +1 -0
  7. package/assets/components/assets/icon/mosaicMethodByAttribute32.json +1 -0
  8. package/assets/components/assets/icon/mosaicMethodClosestToCenter16.json +1 -0
  9. package/assets/components/assets/icon/mosaicMethodClosestToCenter24.json +1 -0
  10. package/assets/components/assets/icon/mosaicMethodClosestToCenter32.json +1 -0
  11. package/assets/components/assets/icon/mosaicMethodClosestToNadir16.json +1 -0
  12. package/assets/components/assets/icon/mosaicMethodClosestToNadir24.json +1 -0
  13. package/assets/components/assets/icon/mosaicMethodClosestToNadir32.json +1 -0
  14. package/assets/components/assets/icon/mosaicMethodFirst16.json +1 -0
  15. package/assets/components/assets/icon/mosaicMethodFirst24.json +1 -0
  16. package/assets/components/assets/icon/mosaicMethodFirst32.json +1 -0
  17. package/assets/components/assets/icon/mosaicMethodLast16.json +1 -0
  18. package/assets/components/assets/icon/mosaicMethodLast24.json +1 -0
  19. package/assets/components/assets/icon/mosaicMethodLast32.json +1 -0
  20. package/assets/components/assets/icon/mosaicMethodLockRaster16.json +1 -0
  21. package/assets/components/assets/icon/mosaicMethodLockRaster24.json +1 -0
  22. package/assets/components/assets/icon/mosaicMethodLockRaster32.json +1 -0
  23. package/assets/components/assets/icon/mosaicMethodMaximum16.json +1 -0
  24. package/assets/components/assets/icon/mosaicMethodMaximum24.json +1 -0
  25. package/assets/components/assets/icon/mosaicMethodMaximum32.json +1 -0
  26. package/assets/components/assets/icon/mosaicMethodMean16.json +1 -0
  27. package/assets/components/assets/icon/mosaicMethodMean24.json +1 -0
  28. package/assets/components/assets/icon/mosaicMethodMean32.json +1 -0
  29. package/assets/components/assets/icon/mosaicMethodMinimum16.json +1 -0
  30. package/assets/components/assets/icon/mosaicMethodMinimum24.json +1 -0
  31. package/assets/components/assets/icon/mosaicMethodMinimum32.json +1 -0
  32. package/assets/components/assets/icon/mosaicMethodNone16.json +1 -0
  33. package/assets/components/assets/icon/mosaicMethodNone24.json +1 -0
  34. package/assets/components/assets/icon/mosaicMethodNone32.json +1 -0
  35. package/assets/components/assets/icon/mosaicMethodNorthWest16.json +1 -0
  36. package/assets/components/assets/icon/mosaicMethodNorthWest24.json +1 -0
  37. package/assets/components/assets/icon/mosaicMethodNorthWest32.json +1 -0
  38. package/assets/components/assets/icon/mosaicMethodSeamline16.json +1 -0
  39. package/assets/components/assets/icon/mosaicMethodSeamline24.json +1 -0
  40. package/assets/components/assets/icon/mosaicMethodSeamline32.json +1 -0
  41. package/assets/components/assets/icon/mosaicMethodSum16.json +1 -0
  42. package/assets/components/assets/icon/mosaicMethodSum24.json +1 -0
  43. package/assets/components/assets/icon/mosaicMethodSum32.json +1 -0
  44. package/assets/esri/core/workers/RemoteClient.js +1 -1
  45. package/assets/esri/core/workers/chunks/{b2f9f0767dadf185120c.js → 00612d6e05b1c8647668.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{f54546c155fba2fd3a7e.js → 05d7d8ff3e4cbad32580.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{b1e275607d9754079f60.js → 079434fe765c53d304f2.js} +1 -1
  48. package/assets/esri/core/workers/chunks/{0eed612e82a279ac8d1e.js → 11b55e7e76e50fe11bbe.js} +1 -1
  49. package/assets/esri/core/workers/chunks/235efd948ae470a6f238.js +1 -0
  50. package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js → 30551c1d3e4fa7be86c1.js} +2 -2
  51. package/assets/esri/core/workers/chunks/{0c6f2808c57ff820bfdd.js.LICENSE.txt → 30551c1d3e4fa7be86c1.js.LICENSE.txt} +1 -1
  52. package/assets/esri/core/workers/chunks/{78242f2bf742b33d99fa.js → 3795793643f4db64af0e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js → 3cf001abca8ad933bccf.js} +2 -2
  54. package/assets/esri/core/workers/chunks/{38f9ede26098eb03ca2d.js.LICENSE.txt → 3cf001abca8ad933bccf.js.LICENSE.txt} +1 -1
  55. package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js → 543eb46b55cacd6e1dbc.js} +2 -2
  56. package/assets/esri/core/workers/chunks/{dbaa4b8d37aab40d7bd1.js.LICENSE.txt → 543eb46b55cacd6e1dbc.js.LICENSE.txt} +1 -1
  57. package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js → 577f24923fa4d08360e4.js} +2 -2
  58. package/assets/esri/core/workers/chunks/{93f792f5b94f3745b57d.js.LICENSE.txt → 577f24923fa4d08360e4.js.LICENSE.txt} +1 -1
  59. package/assets/esri/core/workers/chunks/{f46c4a69ef2f763e905b.js → 5d63dfa5a60c88e03b28.js} +1 -1
  60. package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +1 -0
  61. package/assets/esri/core/workers/chunks/{96cddbbeef61a4f33f29.js → 7c42281188b874ffcdad.js} +1 -1
  62. package/assets/esri/core/workers/chunks/8dd26b12c625d20196ed.js +319 -0
  63. package/assets/esri/core/workers/chunks/{736a11e64e5f03e3936b.js → 9408a72968cbd985dd24.js} +53 -53
  64. package/assets/esri/core/workers/chunks/{c2f38c66fae2cdb57445.js → 96e5d192c8d23c1e324f.js} +1 -1
  65. package/assets/esri/core/workers/chunks/{796cf1c2ca9955595836.js → 9b2ab27159500315fbc1.js} +1 -1
  66. package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +1 -0
  67. package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js → ac9c6779771ec855da79.js} +2 -2
  68. package/assets/esri/core/workers/chunks/{814d72abbfdd4552e4ec.js.LICENSE.txt → ac9c6779771ec855da79.js.LICENSE.txt} +1 -1
  69. package/assets/esri/core/workers/chunks/{ef6e805c49e1afdf966b.js → c054198c6438cb57f188.js} +1 -1
  70. package/assets/esri/core/workers/chunks/c5d786166a5609b85276.js.LICENSE.txt +1 -1
  71. package/assets/esri/core/workers/chunks/{601fc99426f0213b0769.js → cbec01223d51cdb9ee79.js} +1 -1
  72. package/assets/esri/core/workers/chunks/{90c893959145827961ac.js → cd9343c78a7c3acdbbcd.js} +1 -1
  73. package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js → d8dc922f7466300b668f.js} +2 -2
  74. package/assets/esri/core/workers/chunks/{5db336767959507c07e5.js.LICENSE.txt → d8dc922f7466300b668f.js.LICENSE.txt} +1 -1
  75. package/assets/esri/core/workers/chunks/e524462c63834fae7e01.js +2 -0
  76. package/assets/esri/core/workers/chunks/{02176f84d6d57f1bc1c8.js.LICENSE.txt → e524462c63834fae7e01.js.LICENSE.txt} +1 -1
  77. package/assets/esri/core/workers/chunks/{e7e987558cf017c62458.js → ebfa4a0334401f5e004a.js} +1 -1
  78. package/assets/esri/core/workers/chunks/{60d3b329e69f3cddb7f4.js → fa8a3c75f9b41d31559b.js} +1 -1
  79. package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
  80. package/assets/esri/themes/dark/main.css +1 -1
  81. package/assets/esri/themes/light/main.css +1 -1
  82. package/assets/esri/themes/light/view.css +1 -1
  83. package/chunks/Bufferer-CicaNej1.js +1 -1
  84. package/chunks/Envelope.js +1 -1
  85. package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
  86. package/chunks/Geometry.js +1 -1
  87. package/chunks/OperatorGeodesicBuffer.js +1 -1
  88. package/chunks/OperatorGeodeticArea.js +1 -1
  89. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  90. package/chunks/OperatorGeodeticLength.js +1 -1
  91. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  92. package/chunks/OperatorProximityGeodesic.js +1 -1
  93. package/chunks/OperatorShapePreservingLength.js +1 -1
  94. package/chunks/OperatorShapePreservingProject.js +1 -1
  95. package/chunks/OperatorSimplifyOGC.js +5 -0
  96. package/chunks/Point2D.js +1 -1
  97. package/chunks/ProjectionTransformation.js +1 -1
  98. package/chunks/QuadraticBezier.js +1 -1
  99. package/chunks/languageUtils.js +1 -1
  100. package/chunks/relateOperator.js +1 -1
  101. package/chunks/vxlLayer.js +1 -1
  102. package/geometry/operators/extendOperator.js +1 -1
  103. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  104. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  105. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  106. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  107. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  108. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  109. package/geometry/operators/gx/operatorSimplifyOGC.js +5 -0
  110. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  111. package/geometry/operators/reshapeOperator.js +1 -1
  112. package/geometry/operators/simplifyOGCOperator.d.ts +6 -0
  113. package/geometry/operators/simplifyOGCOperator.js +5 -0
  114. package/geometry/operators/support/jsonConverter.js +1 -1
  115. package/interfaces.d.ts +98 -2
  116. package/package.json +2 -2
  117. package/support/revision.js +1 -1
  118. package/versionManagement/utils.js +1 -1
  119. package/views/3d/environment/ChapmanAtmosphere.js +1 -1
  120. package/views/3d/layers/LineOfSightLayerView3D.js +1 -1
  121. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  122. package/views/3d/layers/graphics/pipeline/PipelineCommand.js +1 -1
  123. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  124. package/views/3d/layers/graphics/pipeline/TileActionSynchronizer.js +5 -0
  125. package/views/3d/terrain/OverlayRenderTargets.js +1 -1
  126. package/views/3d/webgl/ManagedFBO.js +1 -1
  127. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  128. package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
  129. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  130. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  131. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  132. package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
  133. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  134. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  135. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  136. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  137. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  138. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  139. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  140. package/views/interactive/Tooltip.js +1 -1
  141. package/views/interactive/tooltip/content/TooltipContent.js +1 -1
  142. package/views/layers/LineOfSightLayerView.d.ts +4 -0
  143. package/views/layers/LineOfSightLayerView.js +5 -0
  144. package/views/webgl/FramebufferObject.js +1 -1
  145. package/views/webgl/formats.js +5 -0
  146. package/views/webgl/textureUtils.js +1 -1
  147. package/assets/esri/core/workers/chunks/02176f84d6d57f1bc1c8.js +0 -2
  148. package/assets/esri/core/workers/chunks/82353e59ac6d909dcf41.js +0 -1
  149. package/assets/esri/core/workers/chunks/873327fc41edd3830afa.js +0 -319
  150. package/assets/esri/core/workers/chunks/daa54c8a317c27881763.js +0 -1
  151. package/assets/esri/core/workers/chunks/e15c612caadf7bac4ab9.js +0 -1
  152. package/views/3d/webgl/formats.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{b as t,c as e}from"./tslib.es6.js";import{t as i,G as s,g as n,c as o,v as a,h as m}from"./Geometry.js";import{S as r,a as u}from"./QuadraticBezier.js";import{v as c,p as h,E as l,F as _,Q as p,R as d,S as g,U as x,V as y,W as P,w as S,X as f,t as D,Y as G,G as v}from"./ProjectionTransformation.js";import{h as T,c as b}from"./Envelope.js";import{Envelope2D as w}from"./Envelope2D.js";import{P as M,b as E,n as R,E as C,o as I}from"./Point2D.js";import{T as B}from"./Transformation2D.js";import{s as A,w as q,m as N}from"./Distance2DCalculator-C1KHhZwD.js";import{O as F}from"./OperatorShapePreservingDensify.js";import{O as Y}from"./OperatorClip.js";function X(){return new w}class k{[Symbol.dispose](){this.m_peR1.destroy(),this.m_peR2.destroy(),this.m_peR3.destroy(),this.m_peR1=null,this.m_peR2=null,this.m_peR3=null}constructor(t,e,i){this.m_peR1=new l,this.m_peR2=new l,this.m_peR3=new l,void 0!==t?this.reset(t,e,i):this.reset(1,0,1)}reset(t,e,i){this.m_a=t,this.m_e2=e,this.m_b=this.m_a*Math.sqrt(1-this.m_e2),this.m_unitToDegree=i,this.m_unitToRad=.017453292519943295*i,this.m_u180=180/this.m_unitToDegree,this.m_u360=360/this.m_unitToDegree}calculateBbox(t,e,i,s){const n=this.m_peR1,o=this.m_peR2,a=this.m_peR3;_.geodeticDistance(this.m_a,this.m_e2,t*this.m_unitToRad,e*this.m_unitToRad,i*this.m_unitToRad,s*this.m_unitToRad,a,n,o,0);const m=Math.cos(n.val),r=Math.cos(o.val+3.141592653589793),u=e*this.m_unitToRad,c=D.phiToEta(this.m_e2,u),h=Math.sin(n.val)*Math.cos(c);let l=e;if(m*r<0){const t=m<0?-1:1,e=Math.acos(Math.abs(h))*t;l=D.etaToPhi(this.m_e2,e)/this.m_unitToRad}let p=I((i-t)*this.m_unitToRad,2*Math.PI);Math.abs(p)>Math.PI&&(p=p>0?p-2*Math.PI:p+2*Math.PI),p/=this.m_unitToRad,i=t+p;const d=X();return d.xmin=Math.min(t,i),d.xmax=Math.max(t,i),d.ymin=Math.min(e,s),d.ymin=Math.min(d.ymin,l),d.ymax=Math.max(e,s),d.ymax=Math.max(d.ymax,l),d}minDistanceGeodesic(t,e){const i=O(t),s=O(e);if(i&&s)return this.lowerDistanceGeodetic_(t.xmin,t.ymin,e.xmin,e.ymin);const n=this.normalizeGeodesic_(e,t);return U(t,n)?t.ymin>=n.ymax?this.minDistanceGeodesicUpDown_(t,n):n.ymin>=t.ymax?this.minDistanceGeodesicUpDown_(n,t):t.xmin>n.xmax?this.minDistanceGeodesicLeftRight_(n,t):this.minDistanceGeodesicLeftRight_(t,n):0}normalizeGeodesic_(t,e){const i=t.clone(),s=t.clone();let n=V(i,e);if(0===n)return i;for(;s.xmax>e.xmin;){s.xmin-=this.m_u360,s.xmax-=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}for(s.assign(t);s.xmin<e.xmax;){s.xmin+=this.m_u360,s.xmax+=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}return i}lowerDistanceGeodetic_(t,e,i,s){const n=this.m_peR1;{const o=this.m_b*this.m_b/this.m_a,a=D.phiToPhig(this.m_e2,this.m_unitToRad*e),m=D.phiToPhig(this.m_e2,this.m_unitToRad*s);_.geodeticDistance(o,0,this.m_unitToRad*t,a,this.m_unitToRad*i,m,n,null,null,0)}return n.val}minDistanceGeodesicUpDown_(t,e){if(e.xmin<=t.xmin?e.xmax>=t.xmin:t.xmax>=e.xmin)return this.lowerDistanceGeodetic_(0,t.ymin,0,e.ymax);if(e.xmin>t.xmax){const i=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);if(e.xmax-t.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);return Math.min(i,s)}{const i=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);if(t.xmax-e.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);return Math.min(i,s)}}minDistanceGeodesicLeftRight_(t,e){let i=Math.abs(t.xmax-e.xmin);for(;i>this.m_u180;)i-=this.m_u360;let s=Math.abs(t.xmin-e.xmax);for(;s>this.m_u180;)s-=this.m_u360;return Math.abs(i)<=Math.abs(s)?this.minDistanceGeodesicLeftRightNormalized_(t,e):this.minDistanceGeodesicLeftRightNormalized_(e,t)}minDistanceGeodesicLeftRightNormalized_(t,e){let i,s;return i=this.lowerDistanceGeodetic_(t.xmax,t.ymin,e.xmin,e.ymin),t.ymin>=e.ymin&&t.ymin<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymin,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymin>=t.ymin&&e.ymin<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymin,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),s=this.lowerDistanceGeodetic_(t.xmax,t.ymax,e.xmin,e.ymax),i=Math.min(i,s),t.ymax>=e.ymin&&t.ymax<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymax,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymax>=t.ymin&&e.ymax<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymax,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),i}lowerDistanceGeodeticSegMeridional_(t,e,i,s,n,o){let a=this.lowerDistanceGeodeticPtMeridional_(t,e,s,n,o);const m=this.lowerDistanceGeodeticPtMeridional_(t,i,s,n,o);let r=this.lowerDistanceGeodeticPtMeridional_(s,n,t,e,i);const u=this.lowerDistanceGeodeticPtMeridional_(s,o,t,e,i);return a=Math.min(a,m),r=Math.min(r,u),Math.min(a,r)}lowerDistanceGeodeticPtMeridional_(t,e,i,s,n){const o=this.m_b*this.m_b/this.m_a,a=D.phiToPhig(this.m_e2,this.m_unitToRad*e),m=D.phiToPhig(this.m_e2,this.m_unitToRad*s),r=D.phiToPhig(this.m_e2,this.m_unitToRad*n),u=this.m_peR1,c=this.m_peR2;_.geodeticDistance(o,0,this.m_unitToRad*i,m,this.m_unitToRad*t,a,u,null,null,0),_.geodeticDistance(o,0,this.m_unitToRad*i,r,this.m_unitToRad*t,a,c,null,null,0);const h=p(1,0,new M(this.m_unitToRad*t,a)),l=p(1,0,new M(this.m_unitToRad*i,m)),d=p(1,0,new M(this.m_unitToRad*i,r));let g=new T;g.setCrossProductVector(l,d);const x=l.dotProduct(d);if(g.length()<1.568e-10)return x>=0?Math.min(u.val,c.val):0;g=g.getUnitVector();let y=new T;if(y.setCrossProductVector(g,h),y.length()<1.568e-10){return Math.min(u.val,c.val)-1e-5*o}y=y.getUnitVector();let P=h.sub(g.mul(h.dotProduct(g)));{const e=new T;e.setCrossProductVector(l,P);const i=new T;i.setCrossProductVector(P,d);let s=g.dotProduct(e)>0&&g.dotProduct(i)>0;if(s||(P.negateThis(),e.setCrossProductVector(l,P),i.setCrossProductVector(P,d),s=g.dotProduct(e)>0&&g.dotProduct(i)>0),s){P=P.getUnitVector();const e=G(1,0,P),i=this.m_peR3;_.geodeticDistance(o,0,this.m_unitToRad*t,a,e.x,e.y,i,null,null,0);const s=Math.min(u.val,c.val);return Math.min(s,i.val)}}return Math.min(u.val,c.val)}}function O(t){return t.xmin===t.xmax&&t.ymin===t.ymax}function U(t,e){return e.xmax<t.xmin||e.xmin>t.xmax||e.ymax<t.ymin||e.ymin>t.ymax}function V(t,e){let i,s=0;return i=t.xmin-e.xmax,i>s&&(s=i),i=e.xmin-t.xmax,i>s&&(s=i),s}class j{}function L(t){return{outPoint:void 0===t?new M:t.clone()}}function z(t,e){t.outPoint.assign(e.outPoint)}function H(){return new w}class Q{constructor(t,e,i,s,n=0,o=4){this.m_ptDistFrom=new M,this.m_segStartPt=new M,this.m_segEndPt=new M,this.m_geodeticLength=new l,this.m_az12=new l,this.m_minGeodeticDist=new l,this.m_segStartPt3d=new T,this.m_segEndPt3d=new T,this.m_sr=s,this.m_distCurveType=n,this.m_segCurveType=o,this.m_inputGCS=this.m_sr.getGCS(),this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_bIsPannablePcs=2===this.m_sr.getCoordinateSystemType()&&this.m_sr.isPannable();const a=v();this.m_inputGCS.querySpheroidData(a),this.m_a=a.majorSemiAxis,this.m_eSquared=a.e2,this.setPointDistFrom(t),this.setSegmentEndPoints(e,i)}setSegmentEndPoints(t,e){this.m_segStartPt.assign(t),this.m_segEndPt.assign(e),this.m_bIsPannablePcs||(this.m_segStartPt.mulThis(this.m_rpu),this.m_segEndPt.mulThis(this.m_rpu)),2===this.m_segCurveType&&(this.m_segStartPt3d.assign(p(this.m_a,this.m_eSquared,this.m_segStartPt)),this.m_segEndPt3d.assign(p(this.m_a,this.m_eSquared,this.m_segEndPt))),this.calculateAndUpdateSegmentLength()}setPointDistFrom(t){this.m_ptDistFrom.assign(t),this.m_ptDistFrom.scale(this.m_rpu)}setSegmentCurveType(t){this.m_segCurveType=t}setDistanceCurveType(t){this.m_distCurveType=t}makeFunctor(){return i=>{let s;switch(this.m_segCurveType){case 0:case 1:case 3:{const o={stack:[],error:void 0,hasError:!1};try{const e=t(o,new l,!1),n=t(o,new l,!1);_.geodeticCoordinate(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_geodeticLength.val*i,this.m_az12.val,e,n,this.m_segCurveType),s=new M(e.val,n.val);break}catch(n){o.error=n,o.hasError=!0}finally{e(o)}}case 2:{const t=T.lerp(this.m_segStartPt3d,this.m_segEndPt3d,i);s=G(this.m_a,this.m_eSquared,t);break}case 4:s=M.lerp(this.m_segStartPt,this.m_segEndPt,i),this.m_bIsPannablePcs&&(g(this.m_sr,0,[s],1),s.mulThis(this.m_rpu));break;default:o("Invalid curve type")}return _.geodeticDistance(this.m_a,this.m_eSquared,this.m_ptDistFrom.x,this.m_ptDistFrom.y,s.x,s.y,this.m_minGeodeticDist,null,null,this.m_distCurveType),this.m_minGeodeticDist.val}}calculateAndUpdateSegmentLength(){switch(this.m_segCurveType){case 0:case 2:case 1:case 3:_.geodeticDistance(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_segEndPt.x,this.m_segEndPt.y,this.m_geodeticLength,this.m_az12,null,this.m_segCurveType);break;case 4:this.m_geodeticLength.val=M.distance(this.m_segStartPt,this.m_segEndPt);break;default:o("Invalid curve type")}}[Symbol.dispose](){this.m_geodeticLength[Symbol.dispose](),this.m_az12[Symbol.dispose](),this.m_minGeodeticDist[Symbol.dispose]()}}function K(){return new j}class W{[Symbol.dispose](){this.m_envHelper[Symbol.dispose]()}constructor(t,e,i,s,n){this.m_boxGeomA=H(),this.m_boxGeomB=H(),this.m_envGeomA=new w,this.m_envGeomB=new w,this.m_progressCounter=0,this.m_transformPCS2GCS=null,this.m_segmentBoxesA=new Map,this.m_segmentBoxesB=new Map,this.m_boundaryPtsA=[],this.m_boundaryPtsB=[],this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_inputSR=t,this.m_distCurveType=e,this.m_progressTracker=i,this.m_maxDistance=s,this.m_maxDeviation=n,this.m_inputGCS=t.getGCS(),this.m_peGeogcs=this.m_inputGCS.getPECoordSys(),this.m_tolerance=0;const o=v();this.m_inputGCS.querySpheroidData(o),this.m_a=o.majorSemiAxis,this.m_eSquared=o.e2,this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_envHelper=new k(this.m_a,this.m_eSquared,1),4===this.m_distCurveType&&(this.m_distCurveType=0),this.m_boxGeomA.setEmpty(),this.m_boxGeomB.setEmpty(),this.m_envGeomA.setEmpty(),this.m_envGeomB.setEmpty(),this.m_bIsPannablePcs=2===this.m_inputSR.getCoordinateSystemType()&&this.m_inputSR.isPannable()}progress(t=!1){}calculate(t,e,i,s){const n=L(),o=L();if(t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.checkGeometriesIntersect(t,e,n,o))return i&&z(i,n),s&&z(s,o),0;const a=this.prepareGeometry(t);if(a.isEmpty())return Number.NaN;const m=this.prepareGeometry(e);if(m.isEmpty())return Number.NaN;this.m_tolerance=this.computeTolerance(a,m);const r=this._ExecuteBruteForce(a,m,n,o);return r>=this.m_maxDistance?Number.NaN:(i&&(this.prepareOutput(n),z(i,n)),s&&(this.prepareOutput(o),z(s,o)),r)}createDistanceFunctor(t,e,i){const s=new Q(t,e,i,this.m_inputSR,this.m_distCurveType);return this.m_bIsPannablePcs||1===this.m_inputSR.getCoordinateSystemType()||s.setSegmentCurveType(2),s}_NormalizeAndProject(t){if(this.m_inputSR.isPannable()&&(t=(new c).foldInto360Range(t,this.m_inputSR)),2===this.m_inputSR.getCoordinateSystemType()){const e=h(this.m_inputSR,this.m_inputGCS,null);t=(new c).execute(t,e,this.m_progressTracker)}return t}_ExecuteBruteForce(t,e,n,o){switch(t.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointGeometry(t,e,n,o);case s.enumMultiPoint:return this.calculateDistanceGeodeticMultipointGeometry(t,e,n,o);case s.enumPolyline:case s.enumPolygon:case s.enumEnvelope:return this.calculateDistanceGeodeticMultipathGeometry(t,e,n,o);default:i("")}}calculateDistanceGeodeticPointGeometry(t,e,n,o){switch(e.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointPoint(t,e,n,o);case s.enumMultiPoint:return this.calculateDistanceGeodeticPointMultipoint(t,e,n,o);case s.enumPolyline:case s.enumPolygon:return this.calculateDistanceGeodeticPointMultipath(t,e,n,o);default:i("")}}calculateDistanceGeodeticPointPoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=i.getXY();e.scale(this.m_rpu);const m=s.getXY();m.scale(this.m_rpu),n.outPoint.assign(e),o.outPoint.assign(m);const r=t(a,new l,!1);return _.geodeticDistance(this.m_a,this.m_eSquared,e.x,e.y,m.x,m.y,r,null,null,this.m_distCurveType),r.val}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{this.computeEnvelopesAndBoxes(i,s);const e=this.estimateMinimumDistance(n,o);let m=e<this.m_maxDistance?e:this.m_maxDistance;const r=i.getXY();r.scale(this.m_rpu),n.outPoint.assign(r);const u=p(this.m_a,this.m_eSquared,r),c=new M,h=s.getImpl(),d=t(a,new l,!1),g=h.getPointCount();for(let t=0;t<g;++t){h.queryXY(t,c),c.scale(this.m_rpu);const e=p(this.m_a,this.m_eSquared,c);if(!(T.distance(u,e)>m)&&(!(this.m_envHelper.minDistanceGeodesic(this.m_boxGeomA,this.m_boxGeomB)>m)&&(_.geodeticDistance(this.m_a,this.m_eSquared,r.x,r.y,c.x,c.y,d,null,null,this.m_distCurveType),d.val<m&&(m=d.val,o.outPoint=c,0===m))))return m}return m===this.m_maxDistance?Number.POSITIVE_INFINITY:m}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipath(i,s,o,a){const m={stack:[],error:void 0,hasError:!1};try{const e=new M,r=new M;e.assign(i.getXY()),r.assign(i.getXY()),o.outPoint.assign(r.mul(this.m_rpu)),this.m_bIsPannablePcs&&d(this.m_inputSR,[e],1,!1),this.computeEnvelopesAndBoxes(i,s);const u=this.estimateMinimumDistance(o,a);let c=u<this.m_maxDistance?u:this.m_maxDistance;const h=s.getImpl(),l=new M(0,0),_=new M(0,0),p=[1],g=this.canUseSpatialTree(i,s),x=K();g&&this.buildSpatialTree(x,s);const y=H();y.setCoords({xmin:r.x,ymin:r.y,xmax:r.x,ymax:r.y});const P=t(m,this.createDistanceFunctor(r,l,_),!1),S=h.querySegmentIterator();if(S.stripAttributes(),g)n(0);else for(;S.nextPath();)for(;S.hasNextSegment();){const t=S.nextSegment(),i=this.findOrComputeBoxSegment(S.getStartPointIndex(),t,this.m_segmentBoxesB);if(this.m_envHelper.minDistanceGeodesic(y,i)>c)continue;const s=this.calculateDistanceGeodeticPointSegment(e,r,t,p,P);if(s.second<c&&(this.updateOutputSegment(a,t,s.first),c=s.second,0===c))return 0}return c===this.m_maxDistance?Number.POSITIVE_INFINITY:c}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipointGeometry(t,e,n,o){switch(e.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointMultipoint(e,t,o,n);case s.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipoint(t,e,n,o);case s.enumPolyline:case s.enumPolygon:case s.enumEnvelope:return this.calculateDistanceGeodeticMultipointMultipath(t,e,n,o);default:i("")}}calculateDistanceGeodeticMultipointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=t(a,new l,!1);this.computeEnvelopesAndBoxes(i,s);const m=this.estimateMinimumDistance(n,o);let r=m<this.m_maxDistance?m:this.m_maxDistance;const u=new M,c=new M,h=i.getImpl(),d=s.getImpl(),g=H(),x=h.getPointCount(),y=d.getPointCount();for(let t=0;t<x;++t){if(u.assign(h.getXY(t)),g.setCoords({xmin:u.x,ymin:u.y,xmax:u.x,ymax:u.y}),this.m_envHelper.minDistanceGeodesic(g,this.m_boxGeomB)>r)continue;u.scale(this.m_rpu);const i=p(this.m_a,this.m_eSquared,u);for(let t=0;t<y;++t){c.assign(d.getXY(t)),c.scale(this.m_rpu);const s=p(this.m_a,this.m_eSquared,c);if(!(T.distance(i,s)>=r)&&(_.geodeticDistance(this.m_a,this.m_eSquared,u.x,u.y,c.x,c.y,e,null,null,this.m_distCurveType),e.val<r&&(n.outPoint.assign(u),o.outPoint.assign(c),r=e.val,0===r)))return r}}return r===this.m_maxDistance?Number.POSITIVE_INFINITY:r}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticMultipointMultipath(i,s,o,a){const m={stack:[],error:void 0,hasError:!1};try{const e=s.getImpl().querySegmentIterator();e.stripAttributes(),this.computeEnvelopesAndBoxes(i,s);const r=this.estimateMinimumDistance(o,a);let u=r<this.m_maxDistance?r:this.m_maxDistance;const c=new M,h=new M(0,0),l=new M(0,0),_=new M(0,0),p=[0],g=H(),x=t(m,this.createDistanceFunctor(h,l,_),!1),y=K(),P=this.canUseSpatialTree(i,s);P&&this.buildSpatialTree(y,s);const S=i.getPointCount();for(let t=0;t<S;++t)if(c.assign(i.getXY(t)),h.assign(i.getXY(t)),this.m_bIsPannablePcs&&d(this.m_inputSR,[c],1,!1),g.setCoords({xmin:h.x,ymin:h.y,xmax:h.x,ymax:h.y}),!(this.m_envHelper.minDistanceGeodesic(g,this.m_boxGeomB)>u))if(x.setPointDistFrom(h),P)n(0);else{for(;e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(this.m_envHelper.minDistanceGeodesic(g,this.findOrComputeBoxSegment(e.getStartPointIndex(),t,this.m_segmentBoxesB))>u)continue;const i=this.calculateDistanceGeodeticPointSegment(c,h,t,p,x);if(i.second<u&&(o.outPoint.assign(h.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),u=i.second,0===u))return 0}e.resetToFirstPath()}return u===this.m_maxDistance?Number.POSITIVE_INFINITY:u}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipathGeometry(t,e,n,o){switch(e.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointMultipath(e,t,o,n);case s.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipath(e,t,o,n);case s.enumPolyline:case s.enumPolygon:case s.enumEnvelope:return this.calculateDistanceGeodeticMultipathMultipath(t,e,n,o);default:i("")}}calculateDistanceGeodeticMultipathMultipath(t,e,i,s){const n=[t],o=[e],a=this.swapGeometries(n,o),m=n[0],r=o[0];this.computeEnvelopesAndBoxes(n[0],o[0]);const u=this.estimateMinimumDistance(i,s),c=this.calculateDistanceGeodeticMultipathMultipath_(m,r,i,s,u);return a&&(s.outPoint=E(i.outPoint,i.outPoint=s.outPoint)),c}calculateDistanceGeodeticMultipathMultipath_(i,s,o,a,m=Number.MAX_VALUE){const u={stack:[],error:void 0,hasError:!1};try{let e=m;const c=new M(0,0),h=new M,l=new M(0,0),_=new M,p=new M(0,0),d=new M,y=new M,P=new M,S=[new M],f=[0],D=[0],G=H(),v=H(),T=t(u,this.createDistanceFunctor(p,c,l),!1),b=K(),w=this.canUseSpatialTree(i,s);w&&this.buildSpatialTree(b,s);const E=s.querySegmentIterator();E.stripAttributes();const R=new r,C=A(i);for(let t=0;t<C.length;++t){const s=C[t];i.getSegmentBuffer(s,R,!0);const m=R.get();if(G.assign(this.findOrComputeBoxSegment(s,m,this.m_segmentBoxesA)),w)n(0);else{if(p.assign(m.getStartXY()),d.assign(m.getStartXY()),y.assign(m.getEndXY()),P.assign(m.getEndXY()),this.m_bIsPannablePcs&&(g(this.m_inputSR,0,[d],1),g(this.m_inputSR,0,[P],1)),this.m_envHelper.minDistanceGeodesic(G,this.m_boxGeomB)>e)continue;for(;E.nextPath();){for(;E.hasNextSegment();){const t=E.nextSegment();if(c.assign(t.getStartXY()),h.assign(t.getStartXY()),l.assign(t.getEndXY()),_.assign(t.getEndXY()),m.intersect(t,S,f,D,this.m_tolerance))return this.updateOutputSegment(o,m,f[0]),this.updateOutputSegment(a,t,D[0]),0;if(this.m_bIsPannablePcs&&(g(this.m_inputSR,0,[h],1),g(this.m_inputSR,0,[_],1)),v.assign(this.findOrComputeBoxPoint(E.getStartPointIndex(),h,_,this.m_segmentBoxesB)),this.m_envHelper.minDistanceGeodesic(G,v)>e)continue;T.setSegmentEndPoints(c,l),T.setPointDistFrom(d);let i=x(T.makeFunctor(),0,1,1e-10);if(i.second<e&&(o.outPoint.assign(d.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setPointDistFrom(P),i=x(T.makeFunctor(),0,1,1e-10),i.second<e&&(o.outPoint.assign(P.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setSegmentEndPoints(p,y),T.setPointDistFrom(h),i=x(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(o,m,i.first),a.outPoint.assign(h.mul(this.m_rpu)),e=i.second,0===e))break;if(T.setPointDistFrom(_),i=x(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(o,m,i.first),a.outPoint.assign(_.mul(this.m_rpu)),e=i.second,0===e))break}if(0===e)return 0}E.resetToFirstPath()}}return e===this.m_maxDistance?Number.POSITIVE_INFINITY:e}catch(c){u.error=c,u.hasError=!0}finally{e(u)}}calculateDistanceGeodeticPointSegment(t,e,i,s,n){const o=i.getStartXY(),a=i.getEndXY();return i.intersectPoint(t,s,this.m_tolerance)?R(s[0],0):(n.setPointDistFrom(e),n.setSegmentEndPoints(o,a),x(n.makeFunctor(),0,1,1e-10))}prepareGeometry(t){let e=t.clone();const i=t.getGeometryType();if(i===s.enumPoint||i===s.enumMultiPoint)return this._NormalizeAndProject(e);if(i===s.enumEnvelope&&(e=this.envelopeToPolygon(e)),this.m_inputSR.isPannable())return this.prepareGeometryPannable(e,4);if(2===this.m_inputSR.getCoordinateSystemType()){if(e=y(e,this.m_inputSR,0,null),e.isEmpty())return e;e=(new F).execute(e,this.m_inputSR,5e4,this.m_maxDeviation/2,0,null);const t=this.m_inputSR.getSRToGCSTransform();return(new c).execute(e,t,this.m_progressTracker)}const n=new w;e.queryLooseEnvelope(n);const o=this.m_inputSR.getPannableExtent();if(n.ymin<o.ymin||n.ymax>o.ymax){const t=new w(n.xmin-1,o.ymin,n.xmax+1,o.ymax);if(e=(new Y).execute(e,t,this.m_inputSR,this.m_progressTracker),e.isEmpty())return e}return n.width()>2*o.width()?(e=P(e,-2*o.width(),2*o.width(),this.m_inputSR,!0,0,!0,this.m_progressTracker),e):e}prepareGeometryPannable(t,e){const i=new w;t.queryEnvelope(i);const s=this.m_inputSR.getPannableExtent();if(s.containsEnvelope(i))return t;const n=new C;s.queryIntervalX(n);const o=new C;return i.queryIntervalX(o),t=n.contains(o)?S(t,this.m_inputSR):(new c).foldInto360RangeGeodetic(t,this.m_inputSR,e)}prepareOutput(t){t.outPoint.scale(1/this.m_rpu),2===this.m_inputSR.getCoordinateSystemType()&&d(this.m_inputSR,[t.outPoint],1,!1)}updateOutputSegment(t,e,i){e.queryCoord2D(i,t.outPoint),this.m_bIsPannablePcs&&g(this.m_inputSR,0,[t.outPoint],1),t.outPoint.mulThis(this.m_rpu)}computeTolerance(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB);const i=new w(this.m_envGeomA);return i.mergeEnvelope2D(this.m_envGeomB),b(null,i)}envelopeToPolygon(t){const e=new u;return e.addEnvelope(t,!1),e}computeEnvelopesAndBoxes(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.m_boxGeomA=this.computeBoxGeometry(t,this.m_boundaryPtsA,this.m_segmentBoxesA),this.m_boxGeomB=this.computeBoxGeometry(e,this.m_boundaryPtsB,this.m_segmentBoxesB)}computeBoxGeometry(t,e,i){switch(t.getGeometryType()){case s.enumPoint:return this.computeBoxPoint(t,e);case s.enumMultiPoint:return this.computeBoxMultiPoint(t,e);case s.enumPolyline:case s.enumPolygon:return this.computeBoxMultiPath(t,e,i);default:o("Invalid geometry type")}}computeBoxPoint(t,e){const i=t.getXY();e.length=0,e.push(i.mul(this.m_rpu));const s=H();return s.setCoords({xmin:i.x,ymin:i.y,xmax:i.x,ymax:i.y}),s}computeBoxMultiPoint(t,e){let i=!0;for(let n=0;n<t.getPointCount();++n){const s=t.getXY(n);if(i){e.length=0;for(let t=0;t<4;++t)e.push(s.clone());i=!1}s.x<e[0].x&&e[0].assign(s),s.y>e[1].y&&e[1].assign(s),s.x>e[2].x&&e[2].assign(s),s.y<e[3].y&&e[3].assign(s)}for(let n=0;n<e.length;++n)e[n].mulThis(this.m_rpu);const s=H();return t.queryEnvelope(s),s}computeBoxMultiPath(t,e,i){let s=!0;const n=H();n.setEmpty();const o=t.querySegmentIterator();for(o.stripAttributes();o.nextPath();)for(;o.hasNextSegment();){const t=o.nextSegment(),a=t.getStartXY(),m=t.getEndXY();if(this.m_bIsPannablePcs&&(g(this.m_inputSR,0,[a],1),g(this.m_inputSR,0,[m],1)),s){for(let t=0;t<4;++t)e.push(a.clone());s=!1}a.x<e[0].x&&e[0].assign(a),a.y>e[1].y&&e[1].assign(a),a.x>e[2].x&&e[2].assign(a),a.y<e[3].y&&e[3].assign(a),m.x<e[0].x&&e[0].assign(m),m.y>e[1].y&&e[1].assign(m),m.x>e[2].x&&e[2].assign(m),m.y<e[3].y&&e[3].assign(m);const r=this.findOrComputeBoxPoint(o.getStartPointIndex(),a,m,i);n.mergeEnvelope2D(r)}for(let a=0;a<e.length;++a)e[a].mulThis(this.m_rpu);return n}findOrComputeBoxSegment(t,e,i){if(!i.has(t)){let s=H();if(e.queryEnvelope(s),this.m_bIsPannablePcs){const t=M.construct(s.xmin,s.ymin),e=M.construct(s.xmax,s.ymax);g(this.m_inputSR,0,[t],1),g(this.m_inputSR,0,[e],1),s=this.m_envHelper.calculateBbox(t.x,t.y,e.x,e.y)}return i.set(t,s),s}return i.get(t)}findOrComputeBoxPoint(t,e,i,s){if(!s.has(t)){let n=H();return n.setCoords({xmin:e.x,ymin:e.y,xmax:i.x,ymax:i.y}),this.m_bIsPannablePcs&&(n=this.m_envHelper.calculateBbox(n.xmin,n.ymin,n.xmax,n.ymax)),s.set(t,n),n}return s.get(t)}estimateMinimumDistance(i,s){const n={stack:[],error:void 0,hasError:!1};try{const e=t=>p(this.m_a,this.m_eSquared,t),o=this.m_boundaryPtsA.map(e),a=this.m_boundaryPtsB.map(e);let m=Number.MAX_VALUE,r=0,u=0;for(let t=0;t<o.length;++t)for(let e=0;e<a.length;++e){const i=T.distance(o[t],a[e]);i<m&&(m=i,r=t,u=e)}i.outPoint.assign(this.m_boundaryPtsA[r]),s.outPoint.assign(this.m_boundaryPtsB[u]);const c=t(n,new l,!1);return _.geodeticDistance(this.m_a,this.m_eSquared,this.m_boundaryPtsA[r].x,this.m_boundaryPtsA[r].y,this.m_boundaryPtsB[u].x,this.m_boundaryPtsB[u].y,c,null,null,this.m_distCurveType),c.val}catch(o){n.error=o,n.hasError=!0}finally{e(n)}}swapGeometries(t,e){return a(t[0])>a(e[0])&&(e[0]=E(t[0],t[0]=e[0]),this.m_envGeomB=E(this.m_envGeomA,this.m_envGeomA=this.m_envGeomB),!0)}canUseSpatialTree(t,e){return!1}checkGeometriesIntersect(t,e,i,n){let o=t.getGeometryType(),a=e.getGeometryType();if(this.m_envGeomA.isIntersecting(this.m_envGeomB)){if(o===s.enumPoint&&2===e.getDimension()){const s=[0],o=[t.getXY()];if(f(e,o,1,this.m_tolerance,s),0!==s[0])return i.outPoint.assign(o[0]),n.outPoint.assign(o[0]),!0}else if(a===s.enumPoint&&2===t.getDimension()){const s=[2],o=[e.getXY()];if(f(t,o,1,this.m_tolerance,s),0!==s[0])return i.outPoint.assign(o[0]),n.outPoint.assign(o[0]),!0}if(o===s.enumMultiPoint&&2===e.getDimension())return this.multipointIntersectsArea(t,e,i,n);if(a===s.enumMultiPoint&&2===t.getDimension())return this.multipointIntersectsArea(e,t,n,i);let r,u,c=t,h=e;if(o===s.enumEnvelope&&(r=this.envelopeToPolygon(t),c=r,o=s.enumPolygon),a===s.enumEnvelope&&(u=this.envelopeToPolygon(e),h=u,a=s.enumPolygon),m(o)&&m(a)){const t=c.querySegmentIterator(),e=h.querySegmentIterator(),s=N(),o=N();if(q(c,h,t,e,s,o))return i.outPoint.assign(s.outPoint),n.outPoint.assign(s.outPoint),!0}}return!1}multipointIntersectsArea(t,e,i,s){const n=t.getPointCount();for(let o=0;o<n;++o){const n=[2],a=t.getXY(o);if(f(e,[a],1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(a),s.outPoint.assign(a),!0}return!1}getNearestNeighbourVisitor(t,e,i,s,o,a,m){return n(0),{}}buildSpatialTree(t,e){n(0)}}export{W as G,Q as a,L as m};
5
+ import{b as t,c as e}from"./tslib.es6.js";import{t as i,G as s,g as n,c as o,v as a,h as m}from"./Geometry.js";import{S as r,a as u}from"./QuadraticBezier.js";import{y as c,v as h,G as l,H as _,S as p,U as d,V as g,W as x,X as y,Y as P,z as S,Z as f,w as D,_ as G,I as v}from"./ProjectionTransformation.js";import{h as T,c as b}from"./Envelope.js";import{Envelope2D as w}from"./Envelope2D.js";import{P as M,b as E,n as R,E as C,o as I}from"./Point2D.js";import{T as B}from"./Transformation2D.js";import{s as A,w as q,m as N}from"./Distance2DCalculator-C1KHhZwD.js";import{O as F}from"./OperatorShapePreservingDensify.js";import{O as Y}from"./OperatorClip.js";function X(){return new w}class k{[Symbol.dispose](){this.m_peR1.destroy(),this.m_peR2.destroy(),this.m_peR3.destroy(),this.m_peR1=null,this.m_peR2=null,this.m_peR3=null}constructor(t,e,i){this.m_peR1=new l,this.m_peR2=new l,this.m_peR3=new l,void 0!==t?this.reset(t,e,i):this.reset(1,0,1)}reset(t,e,i){this.m_a=t,this.m_e2=e,this.m_b=this.m_a*Math.sqrt(1-this.m_e2),this.m_unitToDegree=i,this.m_unitToRad=.017453292519943295*i,this.m_u180=180/this.m_unitToDegree,this.m_u360=360/this.m_unitToDegree}calculateBbox(t,e,i,s){const n=this.m_peR1,o=this.m_peR2,a=this.m_peR3;_.geodeticDistance(this.m_a,this.m_e2,t*this.m_unitToRad,e*this.m_unitToRad,i*this.m_unitToRad,s*this.m_unitToRad,a,n,o,0);const m=Math.cos(n.val),r=Math.cos(o.val+3.141592653589793),u=e*this.m_unitToRad,c=D.phiToEta(this.m_e2,u),h=Math.sin(n.val)*Math.cos(c);let l=e;if(m*r<0){const t=m<0?-1:1,e=Math.acos(Math.abs(h))*t;l=D.etaToPhi(this.m_e2,e)/this.m_unitToRad}let p=I((i-t)*this.m_unitToRad,2*Math.PI);Math.abs(p)>Math.PI&&(p=p>0?p-2*Math.PI:p+2*Math.PI),p/=this.m_unitToRad,i=t+p;const d=X();return d.xmin=Math.min(t,i),d.xmax=Math.max(t,i),d.ymin=Math.min(e,s),d.ymin=Math.min(d.ymin,l),d.ymax=Math.max(e,s),d.ymax=Math.max(d.ymax,l),d}minDistanceGeodesic(t,e){const i=O(t),s=O(e);if(i&&s)return this.lowerDistanceGeodetic_(t.xmin,t.ymin,e.xmin,e.ymin);const n=this.normalizeGeodesic_(e,t);return U(t,n)?t.ymin>=n.ymax?this.minDistanceGeodesicUpDown_(t,n):n.ymin>=t.ymax?this.minDistanceGeodesicUpDown_(n,t):t.xmin>n.xmax?this.minDistanceGeodesicLeftRight_(n,t):this.minDistanceGeodesicLeftRight_(t,n):0}normalizeGeodesic_(t,e){const i=t.clone(),s=t.clone();let n=V(i,e);if(0===n)return i;for(;s.xmax>e.xmin;){s.xmin-=this.m_u360,s.xmax-=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}for(s.assign(t);s.xmin<e.xmax;){s.xmin+=this.m_u360,s.xmax+=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}return i}lowerDistanceGeodetic_(t,e,i,s){const n=this.m_peR1;{const o=this.m_b*this.m_b/this.m_a,a=D.phiToPhig(this.m_e2,this.m_unitToRad*e),m=D.phiToPhig(this.m_e2,this.m_unitToRad*s);_.geodeticDistance(o,0,this.m_unitToRad*t,a,this.m_unitToRad*i,m,n,null,null,0)}return n.val}minDistanceGeodesicUpDown_(t,e){if(e.xmin<=t.xmin?e.xmax>=t.xmin:t.xmax>=e.xmin)return this.lowerDistanceGeodetic_(0,t.ymin,0,e.ymax);if(e.xmin>t.xmax){const i=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);if(e.xmax-t.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);return Math.min(i,s)}{const i=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);if(t.xmax-e.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);return Math.min(i,s)}}minDistanceGeodesicLeftRight_(t,e){let i=Math.abs(t.xmax-e.xmin);for(;i>this.m_u180;)i-=this.m_u360;let s=Math.abs(t.xmin-e.xmax);for(;s>this.m_u180;)s-=this.m_u360;return Math.abs(i)<=Math.abs(s)?this.minDistanceGeodesicLeftRightNormalized_(t,e):this.minDistanceGeodesicLeftRightNormalized_(e,t)}minDistanceGeodesicLeftRightNormalized_(t,e){let i,s;return i=this.lowerDistanceGeodetic_(t.xmax,t.ymin,e.xmin,e.ymin),t.ymin>=e.ymin&&t.ymin<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymin,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymin>=t.ymin&&e.ymin<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymin,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),s=this.lowerDistanceGeodetic_(t.xmax,t.ymax,e.xmin,e.ymax),i=Math.min(i,s),t.ymax>=e.ymin&&t.ymax<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymax,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymax>=t.ymin&&e.ymax<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymax,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),i}lowerDistanceGeodeticSegMeridional_(t,e,i,s,n,o){let a=this.lowerDistanceGeodeticPtMeridional_(t,e,s,n,o);const m=this.lowerDistanceGeodeticPtMeridional_(t,i,s,n,o);let r=this.lowerDistanceGeodeticPtMeridional_(s,n,t,e,i);const u=this.lowerDistanceGeodeticPtMeridional_(s,o,t,e,i);return a=Math.min(a,m),r=Math.min(r,u),Math.min(a,r)}lowerDistanceGeodeticPtMeridional_(t,e,i,s,n){const o=this.m_b*this.m_b/this.m_a,a=D.phiToPhig(this.m_e2,this.m_unitToRad*e),m=D.phiToPhig(this.m_e2,this.m_unitToRad*s),r=D.phiToPhig(this.m_e2,this.m_unitToRad*n),u=this.m_peR1,c=this.m_peR2;_.geodeticDistance(o,0,this.m_unitToRad*i,m,this.m_unitToRad*t,a,u,null,null,0),_.geodeticDistance(o,0,this.m_unitToRad*i,r,this.m_unitToRad*t,a,c,null,null,0);const h=p(1,0,new M(this.m_unitToRad*t,a)),l=p(1,0,new M(this.m_unitToRad*i,m)),d=p(1,0,new M(this.m_unitToRad*i,r));let g=new T;g.setCrossProductVector(l,d);const x=l.dotProduct(d);if(g.length()<1.568e-10)return x>=0?Math.min(u.val,c.val):0;g=g.getUnitVector();let y=new T;if(y.setCrossProductVector(g,h),y.length()<1.568e-10){return Math.min(u.val,c.val)-1e-5*o}y=y.getUnitVector();let P=h.sub(g.mul(h.dotProduct(g)));{const e=new T;e.setCrossProductVector(l,P);const i=new T;i.setCrossProductVector(P,d);let s=g.dotProduct(e)>0&&g.dotProduct(i)>0;if(s||(P.negateThis(),e.setCrossProductVector(l,P),i.setCrossProductVector(P,d),s=g.dotProduct(e)>0&&g.dotProduct(i)>0),s){P=P.getUnitVector();const e=G(1,0,P),i=this.m_peR3;_.geodeticDistance(o,0,this.m_unitToRad*t,a,e.x,e.y,i,null,null,0);const s=Math.min(u.val,c.val);return Math.min(s,i.val)}}return Math.min(u.val,c.val)}}function O(t){return t.xmin===t.xmax&&t.ymin===t.ymax}function U(t,e){return e.xmax<t.xmin||e.xmin>t.xmax||e.ymax<t.ymin||e.ymin>t.ymax}function V(t,e){let i,s=0;return i=t.xmin-e.xmax,i>s&&(s=i),i=e.xmin-t.xmax,i>s&&(s=i),s}class j{}function L(t){return{outPoint:void 0===t?new M:t.clone()}}function z(t,e){t.outPoint.assign(e.outPoint)}function H(){return new w}class Z{constructor(t,e,i,s,n=0,o=4){this.m_ptDistFrom=new M,this.m_segStartPt=new M,this.m_segEndPt=new M,this.m_geodeticLength=new l,this.m_az12=new l,this.m_minGeodeticDist=new l,this.m_segStartPt3d=new T,this.m_segEndPt3d=new T,this.m_sr=s,this.m_distCurveType=n,this.m_segCurveType=o,this.m_inputGCS=this.m_sr.getGCS(),this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_bIsPannablePcs=2===this.m_sr.getCoordinateSystemType()&&this.m_sr.isPannable();const a=v();this.m_inputGCS.querySpheroidData(a),this.m_a=a.majorSemiAxis,this.m_eSquared=a.e2,this.setPointDistFrom(t),this.setSegmentEndPoints(e,i)}setSegmentEndPoints(t,e){this.m_segStartPt.assign(t),this.m_segEndPt.assign(e),this.m_bIsPannablePcs||(this.m_segStartPt.mulThis(this.m_rpu),this.m_segEndPt.mulThis(this.m_rpu)),2===this.m_segCurveType&&(this.m_segStartPt3d.assign(p(this.m_a,this.m_eSquared,this.m_segStartPt)),this.m_segEndPt3d.assign(p(this.m_a,this.m_eSquared,this.m_segEndPt))),this.calculateAndUpdateSegmentLength()}setPointDistFrom(t){this.m_ptDistFrom.assign(t),this.m_ptDistFrom.scale(this.m_rpu)}setSegmentCurveType(t){this.m_segCurveType=t}setDistanceCurveType(t){this.m_distCurveType=t}makeFunctor(){return i=>{let s;switch(this.m_segCurveType){case 0:case 1:case 3:{const o={stack:[],error:void 0,hasError:!1};try{const e=t(o,new l,!1),n=t(o,new l,!1);_.geodeticCoordinate(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_geodeticLength.val*i,this.m_az12.val,e,n,this.m_segCurveType),s=new M(e.val,n.val);break}catch(n){o.error=n,o.hasError=!0}finally{e(o)}}case 2:{const t=T.lerp(this.m_segStartPt3d,this.m_segEndPt3d,i);s=G(this.m_a,this.m_eSquared,t);break}case 4:s=M.lerp(this.m_segStartPt,this.m_segEndPt,i),this.m_bIsPannablePcs&&(g(this.m_sr,0,[s],1),s.mulThis(this.m_rpu));break;default:o("Invalid curve type")}return _.geodeticDistance(this.m_a,this.m_eSquared,this.m_ptDistFrom.x,this.m_ptDistFrom.y,s.x,s.y,this.m_minGeodeticDist,null,null,this.m_distCurveType),this.m_minGeodeticDist.val}}calculateAndUpdateSegmentLength(){switch(this.m_segCurveType){case 0:case 2:case 1:case 3:_.geodeticDistance(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_segEndPt.x,this.m_segEndPt.y,this.m_geodeticLength,this.m_az12,null,this.m_segCurveType);break;case 4:this.m_geodeticLength.val=M.distance(this.m_segStartPt,this.m_segEndPt);break;default:o("Invalid curve type")}}[Symbol.dispose](){this.m_geodeticLength[Symbol.dispose](),this.m_az12[Symbol.dispose](),this.m_minGeodeticDist[Symbol.dispose]()}}function K(){return new j}class Q{[Symbol.dispose](){this.m_envHelper[Symbol.dispose]()}constructor(t,e,i,s,n){this.m_boxGeomA=H(),this.m_boxGeomB=H(),this.m_envGeomA=new w,this.m_envGeomB=new w,this.m_progressCounter=0,this.m_transformPCS2GCS=null,this.m_segmentBoxesA=new Map,this.m_segmentBoxesB=new Map,this.m_boundaryPtsA=[],this.m_boundaryPtsB=[],this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_inputSR=t,this.m_distCurveType=e,this.m_progressTracker=i,this.m_maxDistance=s,this.m_maxDeviation=n,this.m_inputGCS=t.getGCS(),this.m_peGeogcs=this.m_inputGCS.getPECoordSys(),this.m_tolerance=0;const o=v();this.m_inputGCS.querySpheroidData(o),this.m_a=o.majorSemiAxis,this.m_eSquared=o.e2,this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_envHelper=new k(this.m_a,this.m_eSquared,1),4===this.m_distCurveType&&(this.m_distCurveType=0),this.m_boxGeomA.setEmpty(),this.m_boxGeomB.setEmpty(),this.m_envGeomA.setEmpty(),this.m_envGeomB.setEmpty(),this.m_bIsPannablePcs=2===this.m_inputSR.getCoordinateSystemType()&&this.m_inputSR.isPannable()}progress(t=!1){}calculate(t,e,i,s){const n=L(),o=L();if(t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.checkGeometriesIntersect(t,e,n,o))return i&&z(i,n),s&&z(s,o),0;const a=this.prepareGeometry(t);if(a.isEmpty())return Number.NaN;const m=this.prepareGeometry(e);if(m.isEmpty())return Number.NaN;this.m_tolerance=this.computeTolerance(a,m);const r=this._ExecuteBruteForce(a,m,n,o);return r>=this.m_maxDistance?Number.NaN:(i&&(this.prepareOutput(n),z(i,n)),s&&(this.prepareOutput(o),z(s,o)),r)}createDistanceFunctor(t,e,i){const s=new Z(t,e,i,this.m_inputSR,this.m_distCurveType);return this.m_bIsPannablePcs||1===this.m_inputSR.getCoordinateSystemType()||s.setSegmentCurveType(2),s}_NormalizeAndProject(t){if(this.m_inputSR.isPannable()&&(t=(new c).foldInto360Range(t,this.m_inputSR)),2===this.m_inputSR.getCoordinateSystemType()){const e=h(this.m_inputSR,this.m_inputGCS,null);t=(new c).execute(t,e,this.m_progressTracker)}return t}_ExecuteBruteForce(t,e,n,o){switch(t.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointGeometry(t,e,n,o);case s.enumMultiPoint:return this.calculateDistanceGeodeticMultipointGeometry(t,e,n,o);case s.enumPolyline:case s.enumPolygon:case s.enumEnvelope:return this.calculateDistanceGeodeticMultipathGeometry(t,e,n,o);default:i("")}}calculateDistanceGeodeticPointGeometry(t,e,n,o){switch(e.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointPoint(t,e,n,o);case s.enumMultiPoint:return this.calculateDistanceGeodeticPointMultipoint(t,e,n,o);case s.enumPolyline:case s.enumPolygon:return this.calculateDistanceGeodeticPointMultipath(t,e,n,o);default:i("")}}calculateDistanceGeodeticPointPoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=i.getXY();e.scale(this.m_rpu);const m=s.getXY();m.scale(this.m_rpu),n.outPoint.assign(e),o.outPoint.assign(m);const r=t(a,new l,!1);return _.geodeticDistance(this.m_a,this.m_eSquared,e.x,e.y,m.x,m.y,r,null,null,this.m_distCurveType),r.val}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{this.computeEnvelopesAndBoxes(i,s);const e=this.estimateMinimumDistance(n,o);let m=e<this.m_maxDistance?e:this.m_maxDistance;const r=i.getXY();r.scale(this.m_rpu),n.outPoint.assign(r);const u=p(this.m_a,this.m_eSquared,r),c=new M,h=s.getImpl(),d=t(a,new l,!1),g=h.getPointCount();for(let t=0;t<g;++t){h.queryXY(t,c),c.scale(this.m_rpu);const e=p(this.m_a,this.m_eSquared,c);if(!(T.distance(u,e)>m)&&(!(this.m_envHelper.minDistanceGeodesic(this.m_boxGeomA,this.m_boxGeomB)>m)&&(_.geodeticDistance(this.m_a,this.m_eSquared,r.x,r.y,c.x,c.y,d,null,null,this.m_distCurveType),d.val<m&&(m=d.val,o.outPoint=c,0===m))))return m}return m===this.m_maxDistance?Number.POSITIVE_INFINITY:m}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipath(i,s,o,a){const m={stack:[],error:void 0,hasError:!1};try{const e=new M,r=new M;e.assign(i.getXY()),r.assign(i.getXY()),o.outPoint.assign(r.mul(this.m_rpu)),this.m_bIsPannablePcs&&d(this.m_inputSR,[e],1,!1),this.computeEnvelopesAndBoxes(i,s);const u=this.estimateMinimumDistance(o,a);let c=u<this.m_maxDistance?u:this.m_maxDistance;const h=s.getImpl(),l=new M(0,0),_=new M(0,0),p=[1],g=this.canUseSpatialTree(i,s),x=K();g&&this.buildSpatialTree(x,s);const y=H();y.setCoords({xmin:r.x,ymin:r.y,xmax:r.x,ymax:r.y});const P=t(m,this.createDistanceFunctor(r,l,_),!1),S=h.querySegmentIterator();if(S.stripAttributes(),g)n(0);else for(;S.nextPath();)for(;S.hasNextSegment();){const t=S.nextSegment(),i=this.findOrComputeBoxSegment(S.getStartPointIndex(),t,this.m_segmentBoxesB);if(this.m_envHelper.minDistanceGeodesic(y,i)>c)continue;const s=this.calculateDistanceGeodeticPointSegment(e,r,t,p,P);if(s.second<c&&(this.updateOutputSegment(a,t,s.first),c=s.second,0===c))return 0}return c===this.m_maxDistance?Number.POSITIVE_INFINITY:c}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipointGeometry(t,e,n,o){switch(e.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointMultipoint(e,t,o,n);case s.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipoint(t,e,n,o);case s.enumPolyline:case s.enumPolygon:case s.enumEnvelope:return this.calculateDistanceGeodeticMultipointMultipath(t,e,n,o);default:i("")}}calculateDistanceGeodeticMultipointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=t(a,new l,!1);this.computeEnvelopesAndBoxes(i,s);const m=this.estimateMinimumDistance(n,o);let r=m<this.m_maxDistance?m:this.m_maxDistance;const u=new M,c=new M,h=i.getImpl(),d=s.getImpl(),g=H(),x=h.getPointCount(),y=d.getPointCount();for(let t=0;t<x;++t){if(u.assign(h.getXY(t)),g.setCoords({xmin:u.x,ymin:u.y,xmax:u.x,ymax:u.y}),this.m_envHelper.minDistanceGeodesic(g,this.m_boxGeomB)>r)continue;u.scale(this.m_rpu);const i=p(this.m_a,this.m_eSquared,u);for(let t=0;t<y;++t){c.assign(d.getXY(t)),c.scale(this.m_rpu);const s=p(this.m_a,this.m_eSquared,c);if(!(T.distance(i,s)>=r)&&(_.geodeticDistance(this.m_a,this.m_eSquared,u.x,u.y,c.x,c.y,e,null,null,this.m_distCurveType),e.val<r&&(n.outPoint.assign(u),o.outPoint.assign(c),r=e.val,0===r)))return r}}return r===this.m_maxDistance?Number.POSITIVE_INFINITY:r}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticMultipointMultipath(i,s,o,a){const m={stack:[],error:void 0,hasError:!1};try{const e=s.getImpl().querySegmentIterator();e.stripAttributes(),this.computeEnvelopesAndBoxes(i,s);const r=this.estimateMinimumDistance(o,a);let u=r<this.m_maxDistance?r:this.m_maxDistance;const c=new M,h=new M(0,0),l=new M(0,0),_=new M(0,0),p=[0],g=H(),x=t(m,this.createDistanceFunctor(h,l,_),!1),y=K(),P=this.canUseSpatialTree(i,s);P&&this.buildSpatialTree(y,s);const S=i.getPointCount();for(let t=0;t<S;++t)if(c.assign(i.getXY(t)),h.assign(i.getXY(t)),this.m_bIsPannablePcs&&d(this.m_inputSR,[c],1,!1),g.setCoords({xmin:h.x,ymin:h.y,xmax:h.x,ymax:h.y}),!(this.m_envHelper.minDistanceGeodesic(g,this.m_boxGeomB)>u))if(x.setPointDistFrom(h),P)n(0);else{for(;e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(this.m_envHelper.minDistanceGeodesic(g,this.findOrComputeBoxSegment(e.getStartPointIndex(),t,this.m_segmentBoxesB))>u)continue;const i=this.calculateDistanceGeodeticPointSegment(c,h,t,p,x);if(i.second<u&&(o.outPoint.assign(h.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),u=i.second,0===u))return 0}e.resetToFirstPath()}return u===this.m_maxDistance?Number.POSITIVE_INFINITY:u}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipathGeometry(t,e,n,o){switch(e.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointMultipath(e,t,o,n);case s.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipath(e,t,o,n);case s.enumPolyline:case s.enumPolygon:case s.enumEnvelope:return this.calculateDistanceGeodeticMultipathMultipath(t,e,n,o);default:i("")}}calculateDistanceGeodeticMultipathMultipath(t,e,i,s){const n=[t],o=[e],a=this.swapGeometries(n,o),m=n[0],r=o[0];this.computeEnvelopesAndBoxes(n[0],o[0]);const u=this.estimateMinimumDistance(i,s),c=this.calculateDistanceGeodeticMultipathMultipath_(m,r,i,s,u);return a&&(s.outPoint=E(i.outPoint,i.outPoint=s.outPoint)),c}calculateDistanceGeodeticMultipathMultipath_(i,s,o,a,m=Number.MAX_VALUE){const u={stack:[],error:void 0,hasError:!1};try{let e=m;const c=new M(0,0),h=new M,l=new M(0,0),_=new M,p=new M(0,0),d=new M,y=new M,P=new M,S=[new M],f=[0],D=[0],G=H(),v=H(),T=t(u,this.createDistanceFunctor(p,c,l),!1),b=K(),w=this.canUseSpatialTree(i,s);w&&this.buildSpatialTree(b,s);const E=s.querySegmentIterator();E.stripAttributes();const R=new r,C=A(i);for(let t=0;t<C.length;++t){const s=C[t];i.getSegmentBuffer(s,R,!0);const m=R.get();if(G.assign(this.findOrComputeBoxSegment(s,m,this.m_segmentBoxesA)),w)n(0);else{if(p.assign(m.getStartXY()),d.assign(m.getStartXY()),y.assign(m.getEndXY()),P.assign(m.getEndXY()),this.m_bIsPannablePcs&&(g(this.m_inputSR,0,[d],1),g(this.m_inputSR,0,[P],1)),this.m_envHelper.minDistanceGeodesic(G,this.m_boxGeomB)>e)continue;for(;E.nextPath();){for(;E.hasNextSegment();){const t=E.nextSegment();if(c.assign(t.getStartXY()),h.assign(t.getStartXY()),l.assign(t.getEndXY()),_.assign(t.getEndXY()),m.intersect(t,S,f,D,this.m_tolerance))return this.updateOutputSegment(o,m,f[0]),this.updateOutputSegment(a,t,D[0]),0;if(this.m_bIsPannablePcs&&(g(this.m_inputSR,0,[h],1),g(this.m_inputSR,0,[_],1)),v.assign(this.findOrComputeBoxPoint(E.getStartPointIndex(),h,_,this.m_segmentBoxesB)),this.m_envHelper.minDistanceGeodesic(G,v)>e)continue;T.setSegmentEndPoints(c,l),T.setPointDistFrom(d);let i=x(T.makeFunctor(),0,1,1e-10);if(i.second<e&&(o.outPoint.assign(d.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setPointDistFrom(P),i=x(T.makeFunctor(),0,1,1e-10),i.second<e&&(o.outPoint.assign(P.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setSegmentEndPoints(p,y),T.setPointDistFrom(h),i=x(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(o,m,i.first),a.outPoint.assign(h.mul(this.m_rpu)),e=i.second,0===e))break;if(T.setPointDistFrom(_),i=x(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(o,m,i.first),a.outPoint.assign(_.mul(this.m_rpu)),e=i.second,0===e))break}if(0===e)return 0}E.resetToFirstPath()}}return e===this.m_maxDistance?Number.POSITIVE_INFINITY:e}catch(c){u.error=c,u.hasError=!0}finally{e(u)}}calculateDistanceGeodeticPointSegment(t,e,i,s,n){const o=i.getStartXY(),a=i.getEndXY();return i.intersectPoint(t,s,this.m_tolerance)?R(s[0],0):(n.setPointDistFrom(e),n.setSegmentEndPoints(o,a),x(n.makeFunctor(),0,1,1e-10))}prepareGeometry(t){let e=t.clone();const i=t.getGeometryType();if(i===s.enumPoint||i===s.enumMultiPoint)return this._NormalizeAndProject(e);if(i===s.enumEnvelope&&(e=this.envelopeToPolygon(e)),this.m_inputSR.isPannable())return this.prepareGeometryPannable(e,4);if(2===this.m_inputSR.getCoordinateSystemType()){if(e=y(e,this.m_inputSR,0,null),e.isEmpty())return e;e=(new F).execute(e,this.m_inputSR,5e4,this.m_maxDeviation/2,0,null);const t=this.m_inputSR.getSRToGCSTransform();return(new c).execute(e,t,this.m_progressTracker)}const n=new w;e.queryLooseEnvelope(n);const o=this.m_inputSR.getPannableExtent();if(n.ymin<o.ymin||n.ymax>o.ymax){const t=new w(n.xmin-1,o.ymin,n.xmax+1,o.ymax);if(e=(new Y).execute(e,t,this.m_inputSR,this.m_progressTracker),e.isEmpty())return e}return n.width()>2*o.width()?(e=P(e,-2*o.width(),2*o.width(),this.m_inputSR,!0,0,!0,this.m_progressTracker),e):e}prepareGeometryPannable(t,e){const i=new w;t.queryEnvelope(i);const s=this.m_inputSR.getPannableExtent();if(s.containsEnvelope(i))return t;const n=new C;s.queryIntervalX(n);const o=new C;return i.queryIntervalX(o),t=n.contains(o)?S(t,this.m_inputSR):(new c).foldInto360RangeGeodetic(t,this.m_inputSR,e)}prepareOutput(t){t.outPoint.scale(1/this.m_rpu),2===this.m_inputSR.getCoordinateSystemType()&&d(this.m_inputSR,[t.outPoint],1,!1)}updateOutputSegment(t,e,i){e.queryCoord2D(i,t.outPoint),this.m_bIsPannablePcs&&g(this.m_inputSR,0,[t.outPoint],1),t.outPoint.mulThis(this.m_rpu)}computeTolerance(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB);const i=new w(this.m_envGeomA);return i.mergeEnvelope2D(this.m_envGeomB),b(null,i)}envelopeToPolygon(t){const e=new u;return e.addEnvelope(t,!1),e}computeEnvelopesAndBoxes(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.m_boxGeomA=this.computeBoxGeometry(t,this.m_boundaryPtsA,this.m_segmentBoxesA),this.m_boxGeomB=this.computeBoxGeometry(e,this.m_boundaryPtsB,this.m_segmentBoxesB)}computeBoxGeometry(t,e,i){switch(t.getGeometryType()){case s.enumPoint:return this.computeBoxPoint(t,e);case s.enumMultiPoint:return this.computeBoxMultiPoint(t,e);case s.enumPolyline:case s.enumPolygon:return this.computeBoxMultiPath(t,e,i);default:o("Invalid geometry type")}}computeBoxPoint(t,e){const i=t.getXY();e.length=0,e.push(i.mul(this.m_rpu));const s=H();return s.setCoords({xmin:i.x,ymin:i.y,xmax:i.x,ymax:i.y}),s}computeBoxMultiPoint(t,e){let i=!0;for(let n=0;n<t.getPointCount();++n){const s=t.getXY(n);if(i){e.length=0;for(let t=0;t<4;++t)e.push(s.clone());i=!1}s.x<e[0].x&&e[0].assign(s),s.y>e[1].y&&e[1].assign(s),s.x>e[2].x&&e[2].assign(s),s.y<e[3].y&&e[3].assign(s)}for(let n=0;n<e.length;++n)e[n].mulThis(this.m_rpu);const s=H();return t.queryEnvelope(s),s}computeBoxMultiPath(t,e,i){let s=!0;const n=H();n.setEmpty();const o=t.querySegmentIterator();for(o.stripAttributes();o.nextPath();)for(;o.hasNextSegment();){const t=o.nextSegment(),a=t.getStartXY(),m=t.getEndXY();if(this.m_bIsPannablePcs&&(g(this.m_inputSR,0,[a],1),g(this.m_inputSR,0,[m],1)),s){for(let t=0;t<4;++t)e.push(a.clone());s=!1}a.x<e[0].x&&e[0].assign(a),a.y>e[1].y&&e[1].assign(a),a.x>e[2].x&&e[2].assign(a),a.y<e[3].y&&e[3].assign(a),m.x<e[0].x&&e[0].assign(m),m.y>e[1].y&&e[1].assign(m),m.x>e[2].x&&e[2].assign(m),m.y<e[3].y&&e[3].assign(m);const r=this.findOrComputeBoxPoint(o.getStartPointIndex(),a,m,i);n.mergeEnvelope2D(r)}for(let a=0;a<e.length;++a)e[a].mulThis(this.m_rpu);return n}findOrComputeBoxSegment(t,e,i){if(!i.has(t)){let s=H();if(e.queryEnvelope(s),this.m_bIsPannablePcs){const t=M.construct(s.xmin,s.ymin),e=M.construct(s.xmax,s.ymax);g(this.m_inputSR,0,[t],1),g(this.m_inputSR,0,[e],1),s=this.m_envHelper.calculateBbox(t.x,t.y,e.x,e.y)}return i.set(t,s),s}return i.get(t)}findOrComputeBoxPoint(t,e,i,s){if(!s.has(t)){let n=H();return n.setCoords({xmin:e.x,ymin:e.y,xmax:i.x,ymax:i.y}),this.m_bIsPannablePcs&&(n=this.m_envHelper.calculateBbox(n.xmin,n.ymin,n.xmax,n.ymax)),s.set(t,n),n}return s.get(t)}estimateMinimumDistance(i,s){const n={stack:[],error:void 0,hasError:!1};try{const e=t=>p(this.m_a,this.m_eSquared,t),o=this.m_boundaryPtsA.map(e),a=this.m_boundaryPtsB.map(e);let m=Number.MAX_VALUE,r=0,u=0;for(let t=0;t<o.length;++t)for(let e=0;e<a.length;++e){const i=T.distance(o[t],a[e]);i<m&&(m=i,r=t,u=e)}i.outPoint.assign(this.m_boundaryPtsA[r]),s.outPoint.assign(this.m_boundaryPtsB[u]);const c=t(n,new l,!1);return _.geodeticDistance(this.m_a,this.m_eSquared,this.m_boundaryPtsA[r].x,this.m_boundaryPtsA[r].y,this.m_boundaryPtsB[u].x,this.m_boundaryPtsB[u].y,c,null,null,this.m_distCurveType),c.val}catch(o){n.error=o,n.hasError=!0}finally{e(n)}}swapGeometries(t,e){return a(t[0])>a(e[0])&&(e[0]=E(t[0],t[0]=e[0]),this.m_envGeomB=E(this.m_envGeomA,this.m_envGeomA=this.m_envGeomB),!0)}canUseSpatialTree(t,e){return!1}checkGeometriesIntersect(t,e,i,n){let o=t.getGeometryType(),a=e.getGeometryType();if(this.m_envGeomA.isIntersecting(this.m_envGeomB)){if(o===s.enumPoint&&2===e.getDimension()){const s=[0],o=[t.getXY()];if(f(e,o,1,this.m_tolerance,s),0!==s[0])return i.outPoint.assign(o[0]),n.outPoint.assign(o[0]),!0}else if(a===s.enumPoint&&2===t.getDimension()){const s=[2],o=[e.getXY()];if(f(t,o,1,this.m_tolerance,s),0!==s[0])return i.outPoint.assign(o[0]),n.outPoint.assign(o[0]),!0}if(o===s.enumMultiPoint&&2===e.getDimension())return this.multipointIntersectsArea(t,e,i,n);if(a===s.enumMultiPoint&&2===t.getDimension())return this.multipointIntersectsArea(e,t,n,i);let r,u,c=t,h=e;if(o===s.enumEnvelope&&(r=this.envelopeToPolygon(t),c=r,o=s.enumPolygon),a===s.enumEnvelope&&(u=this.envelopeToPolygon(e),h=u,a=s.enumPolygon),m(o)&&m(a)){const t=c.querySegmentIterator(),e=h.querySegmentIterator(),s=N(),o=N();if(q(c,h,t,e,s,o))return i.outPoint.assign(s.outPoint),n.outPoint.assign(s.outPoint),!0}}return!1}multipointIntersectsArea(t,e,i,s){const n=t.getPointCount();for(let o=0;o<n;++o){const n=[2],a=t.getXY(o);if(f(e,[a],1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(a),s.outPoint.assign(a),!0}return!1}getNearestNeighbourVisitor(t,e,i,s,o,a,m){return n(0),{}}buildSpatialTree(t,e){n(0)}}export{Q as G,Z as a,L as m};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- function e(e){switch(e){case 1:return"Unknown error";case 2:return"Corrupted geometry";case 3:return"Empty geometry";case 4:return"Math singularity";case 5:return"Buffer is too small";case 6:return"Invalid shape type";case 7:return"Projection out of supported range";case 8:return"Non simple geometry";case 9:return"Cannot calculate geodesic";case 10:return"Notation conversion";case 11:return"Missing grid file";case 12:return"Invalid call";case 13:return"Internal error";case 14:return"Not implemented";case 15:return"IO error";case 16:return"Invalid 3D";case 17:return"An ambiguous geography edge with antipodal points";case 18:return"Geocentric coordinates require ellipsoidal height";case 19:return"Geography cannot be projected into a gnomonic plane or a result of an operation cannot fit into a gnomonic plane";case 20:return"Geometry is too large to be exported in to a given format";case 22:return"Operation is canceled by the user";case 21:return"The operation, such as projection or geodetic computation, cannot be performed without pe-wasm loaded";default:return"unknown error"}}function n(e,n){try{if(!e)throw new Error(n)}catch(t){throw t}}class t extends Error{constructor(e,n){super(n),this.m_AdditionalMessage=n,this.m_ErrorType=e,this.name="GeometryError"}what(){return e(this.m_ErrorType)}additionalMessage(){return this.m_AdditionalMessage?this.m_AdditionalMessage:""}code(){return this.m_ErrorType}}class r extends t{constructor(e){super(2,e),this.name="CorruptedGeometryError"}}class o extends t{constructor(e){super(3,e),this.name="EmptyGeometryError"}}class i extends t{constructor(e){super(4,e),this.name="MathSingularityError"}}class u extends t{constructor(e){super(21,e),this.name="ProjectionEngineNotLoadedError"}}class s extends t{constructor(e){super(8,e),this.name="NonSimpleGeometryError"}}var a;!function(e){e[e.enumUnknown=0]="enumUnknown",e[e.enumPoint=513]="enumPoint",e[e.enumLine=5122]="enumLine",e[e.enumBezier=5123]="enumBezier",e[e.enumEllipticArc=5124]="enumEllipticArc",e[e.enumEnvelope=3077]="enumEnvelope",e[e.enumMultiPoint=8710]="enumMultiPoint",e[e.enumPolyline=25607]="enumPolyline",e[e.enumPolygon=27656]="enumPolygon",e[e.enumMultipatch=40969]="enumMultipatch",e[e.enumGeometryCollection=3594]="enumGeometryCollection",e[e.enumRationalBezier2=5134]="enumRationalBezier2",e[e.enumBezier2=5135]="enumBezier2",e[e.enumRationalBezier23d=5392]="enumRationalBezier23d",e[e.enumGreatArc3d=5393]="enumGreatArc3d"}(a||(a={}));const c=[0,0,1,1,1,2,0,1,2,3,-1,-1,-1,-1,1,1];function m(e){return c[15&e]}function l(e){return!!(512&e)}function p(e){return!!(1024&e)}function d(e){return!!(2048&e)}function f(e){return!!(4096&e)}function y(e){return!!(8192&e)}function h(e){return!!(16384&e)}function g(e){return!!(32768&e)}function w(e){const n=e.getGeometryType();return y(n)?e.getPointCount():e.isEmpty()?0:n===a.enumEnvelope?4:n===a.enumPoint?1:f(n)?2:void b("missing type")}function E(e){const n=e.getGeometryType();if(h(n))return e.hasNonLinearSegments();if(n===a.enumGeometryCollection){const n=e;for(let e=0,t=n.getGeometryCount();e<t;e++)if(E(n.getGeometry(e)))return!0;return!1}return!!f(n)&&n!==a.enumLine}function G(e){throw new u(e)}function v(e){throw new r(e)}function P(e){throw new Error(e)}function M(e){throw new i(e)}function B(){P("Geometry type is not supported for 3D operations.")}function C(e){throw new t(12,e)}function x(e){throw new o(e)}function z(e){throw new t(14,e)}function A(e){throw new Error(e)}function b(e){throw new t(13,e)}function T(e){throw new Error(e)}function k(e){throw new s(e)}function _(){z("Operation does not support curves.")}function N(e){e&&E(e)&&_()}function j(e){e&&g(e.getGeometryType())&&z("Unsupported geometry type.")}function I(e){e===a.enumGeometryCollection&&P("Geometry_collection instances are not supported in this operation")}function L(e){I(e.getGeometryType())}function R(e){P(`bad wkid: ${e}`)}function U(e){let n="bad wkt: ";n+=e,n+="...",P(n)}function D(e,n){e||P(n)}export{m as A,L as B,I as C,k as D,a as G,M as a,z as b,b as c,j as d,l as e,f,n as g,h,y as i,E as j,v as k,N as l,C as m,A as n,g as o,d as p,p as q,G as r,T as s,P as t,x as u,w as v,D as w,B as x,R as y,U as z};
5
+ function e(e){switch(e){case 1:return"Unknown error";case 2:return"Corrupted geometry";case 3:return"Empty geometry";case 4:return"Math singularity";case 5:return"Buffer is too small";case 6:return"Invalid shape type";case 7:return"Projection out of supported range";case 8:return"Non simple geometry";case 9:return"Cannot calculate geodesic";case 10:return"Notation conversion";case 11:return"Missing grid file";case 12:return"Invalid call";case 13:return"Internal error";case 14:return"Not implemented";case 15:return"IO error";case 16:return"Invalid 3D";case 17:return"An ambiguous geography edge with antipodal points";case 18:return"Geocentric coordinates require ellipsoidal height";case 19:return"Geography cannot be projected into a gnomonic plane or a result of an operation cannot fit into a gnomonic plane";case 20:return"Geometry is too large to be exported in to a given format";case 22:return"Operation is canceled by the user";case 21:return"The operation, such as projection or geodetic computation, cannot be performed without pe-wasm loaded";default:return"unknown error"}}function n(e,n){try{if(!e)throw new Error(n)}catch(t){throw t}}class t extends Error{constructor(e,n){super(n),this.m_AdditionalMessage=n,this.m_ErrorType=e,this.name="GeometryError"}what(){return e(this.m_ErrorType)}additionalMessage(){return this.m_AdditionalMessage?this.m_AdditionalMessage:""}code(){return this.m_ErrorType}}class r extends t{constructor(e){super(2,e),this.name="CorruptedGeometryError"}}class o extends t{constructor(e){super(3,e),this.name="EmptyGeometryError"}}class i extends t{constructor(e){super(4,e),this.name="MathSingularityError"}}class u extends t{constructor(e){super(21,e),this.name="ProjectionEngineNotLoadedError"}}class s extends t{constructor(e){super(8,e),this.name="NonSimpleGeometryError"}}var a;!function(e){e[e.enumUnknown=0]="enumUnknown",e[e.enumPoint=513]="enumPoint",e[e.enumLine=5122]="enumLine",e[e.enumBezier=5123]="enumBezier",e[e.enumEllipticArc=5124]="enumEllipticArc",e[e.enumEnvelope=3077]="enumEnvelope",e[e.enumMultiPoint=8710]="enumMultiPoint",e[e.enumPolyline=25607]="enumPolyline",e[e.enumPolygon=27656]="enumPolygon",e[e.enumMultipatch=40969]="enumMultipatch",e[e.enumGeometryCollection=3594]="enumGeometryCollection",e[e.enumRationalBezier2=5134]="enumRationalBezier2",e[e.enumBezier2=5135]="enumBezier2",e[e.enumRationalBezier23d=5392]="enumRationalBezier23d",e[e.enumGreatArc3d=5393]="enumGreatArc3d"}(a||(a={}));const c=[0,0,1,1,1,2,0,1,2,3,-1,-1,-1,-1,1,1];function m(e){return c[15&e]}function l(e){return!!(512&e)}function p(e){return!!(1024&e)}function d(e){return!!(2048&e)}function f(e){return!!(4096&e)}function y(e){return!!(8192&e)}function h(e){return!!(16384&e)}function g(e){return!!(32768&e)}function w(e){const n=e.getGeometryType();return y(n)?e.getPointCount():e.isEmpty()?0:n===a.enumEnvelope?4:n===a.enumPoint?1:f(n)?2:void b("missing type")}function E(e){const n=e.getGeometryType();if(h(n))return e.hasNonLinearSegments();if(n===a.enumGeometryCollection){const n=e;for(let e=0,t=n.getGeometryCount();e<t;e++)if(E(n.getGeometry(e)))return!0;return!1}return!!f(n)&&n!==a.enumLine}function G(e){throw new u(e)}function v(e){throw new r(e)}function P(e){throw new Error(e)}function M(e){throw new i(e)}function B(){P("Geometry type is not supported for 3D operations.")}function C(e){throw new t(12,e)}function x(e){throw new o(e)}function z(e){throw new t(14,e)}function A(e){throw new Error(e)}function b(e){throw new t(13,e)}function T(e){throw new Error(e)}function k(e){throw new s(e)}function _(){z("Operation does not support curves.")}function N(e){e&&E(e)&&_()}function j(e){e&&g(e.getGeometryType())&&z("Unsupported geometry type.")}function I(e){e===a.enumGeometryCollection&&P("Geometry_collection instances are not supported in this operation")}function L(e){I(e.getGeometryType())}function R(e){P(`bad wkid: ${e}`)}function U(e){let n="bad wkt: ";n+=e,n+="...",P(n)}function D(e,n){e||P(n)}export{m as A,L as B,I as C,k as D,a as G,M as a,z as b,b as c,j as d,l as e,f,n as g,h,y as i,g as j,d as k,p as l,E as m,v as n,N as o,C as p,A as q,G as r,T as s,P as t,x as u,w as v,D as w,B as x,R as y,U as z};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{S as e,G as t}from"./SimpleGeometryCursor.js";import{c as s,b as n,t as i,d as r,i as o,G as m,j as a,f as h,e as c,h as u,k as l}from"./Geometry.js";import{Envelope2D as _}from"./Envelope2D.js";import{h as f,p as d,t as g,u as p,v as P,w as x,x as b,y,z as w,A as C,L as v,e as S,g as D,B as I,D as G,P as M,E as T,F as N,G as k,H as A,I as E,J as q,K as R,M as z,N as B}from"./ProjectionTransformation.js";import{b as X,c as Y}from"./tslib.es6.js";import{a as j,P as O,E as F}from"./QuadraticBezier.js";import{d as W,a as J,P as U,b as H,e as L,f as V,s as K}from"./Envelope.js";import{T as Q}from"./Transformation2D.js";import{d as Z,m as $,P as ee,S as te,k as se,l as ne}from"./Point2D.js";import{c as ie}from"./OperatorClip.js";import{c as re}from"./GeometryCleaner-BEJM7I4l.js";import{O as oe}from"./OperatorDensify.js";function me(e,t,s,n,a,h){n<Number.MAX_VALUE&&n>-Number.MAX_VALUE||i("Geodesic_bufferer.buffer - bad distance"),r(e);const c=re(e),u=c.getGeometryType();if(o(u)){const e=c.getPointCount(),i=8e6;if(Math.abs(n)>i&&(e>50||u!==m.enumMultiPoint&&4===s&&e>2)){let e=c;const r=n>0?1:-1,o=7e6;let m=n,u=1;do{u++,m=(Math.abs(m)-o)*r}while(Math.abs(m)>i);m=n;for(let n=0;n<u-1;n++)e=he(e,t,s,o*r,a,u,h),m=(Math.abs(m)-o)*r;return e=he(e,t,s,m,a,u,h),e}}return he(c,t,s,n,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new j,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new j;if(this.bufferPoint2D(t,!1,s)){const e=H(null,s,!0);s=y(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new P).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=w(C());let r=new v,o=(new f).executeMany(r,i,this.m_progressTracker,2);const m=Z(6,!1),a=$(_,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let l,d,g;for(;null!==(l=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=H(i,t,!0),r=W(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new v,o=(new f).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(l),s.needsSimplify()){const e=H(null,l,!0);l=y(l,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(be(l)),o.tock()}else this.putInGridCursors(e,l,i,!0,m,a,h,c,u)}let p=!1;for(let _=0;_<6;_++)if(null!=u[_]){p=!0;break}if(p){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const _=new v,d=(new f).executeMany(_,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=H(i,t,!0),l=W(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new S).execute(l[e],s,i,this.m_progressTracker));const n=H(i,s,!0),r=W(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new D).execute(s,this.m_gcs,!0,this.m_progressTracker),_.tick(be(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=H(null,e,!0);e=y(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(be(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new S).execute(t,a,i,this.m_progressTracker));const h=H(i,a,!0),c=W(h);g=n.unproject(a,c,this.m_progressTracker),g=(new D).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new P).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new v,a[c]=(new f).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(be(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=L(t,e),u=J(null,c,!1).total();let l=ie(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new ee;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new ee;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=H(null,l,!0);l=y(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=_.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=I(this.m_gcs,n,e,!0,this.m_progressTracker),r=new F,o=r.addGeometry(i);return G(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),G(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),G(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(G(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),G(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),G(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=g.q(this.m_a,this.m_eSquared,a),u=g.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-ne,_=n+ne,f=l-Math.PI,d=l+Math.PI,p=_+Math.PI,P=[Number.NaN],x=[Number.NaN],b=[Number.NaN],y=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,p,_,o,f,b,y),(_<P[0]&&P[0]<p||_<x[0]&&x[0]<p)&&(w=!0),w||(f<b[0]&&b[0]<l||f<y[0]&&y[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let g=e.length-1;g>=0;g--)C.push(e[g]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let v=0;v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,p,this.m_cornerStep,i,v,r,P[0],x[0]),v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,p,d,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,v,r,b[0],y[0]);let S=!1;return i||(S=this.checkAndPrepForPole(r)),w||S}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new _;return e.queryEnvelope(t),!(!M(t.ymax,this.m_gcs90)&&!M(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new j;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=M(t.y,this.m_gcs90),n=M(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=M(n.y,this.m_gcs90),h=M(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=ee.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=M(i.y,this.m_gcs90),o=M(i.y,-this.m_gcs90);r||o||(s=ee.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new j,s=new j,n=new Q,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new _;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new _;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,l;i.x>r.x?(u=-o,l=this.m_gcs90):(u=o,l=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new U;for(let _=0;_<c;_++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=l,g.y=l,t.lineTo(g);const p=new ee;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new _;t.queryEnvelope(x);let b=0;const y=x.getCenter().x;y-P>m?b=-Math.ceil((y-P-m)/o):P-y>m&&(b=Math.ceil((P-y-m)/o)),0!==b&&(n.setShiftCoords(b*o,0),t.applyTransformation(n));const w=new F,C=w.addGeometry(t);G(w,C,this.m_gcs,0,2,!0,a.xmin),G(w,C,this.m_gcs,0,2,!0,a.xmax);const v=w.getGeometry(C),S=L(v,a);S.inflateCoords(0,1);const D=J(null,S,!0).total(),I=ie(v,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(I,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new _;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new _;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new Q;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new _;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new ee;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new Q;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new F,o=r.addGeometry(c);G(r,o,this.m_gcs,0,2,!0,n.xmin),G(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=L(c,n);m.inflateCoords(0,1);const h=J(null,m,!0).total();c=ie(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new ee;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=X(e,new te(new T,new T),!1),m=X(e,new te(new T,new T),!1),a=X(e,new te(new T,new T),!1),h=X(e,new te(new T,new T),!1),c=new ee,u=new ee,l=new ee,_=new ee;for(N.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),N.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);N.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=X(e,new T,!1),f=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),N.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,N.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new ee,r=new ee;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=X(e,new T,!1),m=X(e,new T,!1),a=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=X(e,new te(new T,new T),!1),c=X(e,new te(new T,new T),!1),u=new ee,l=X(e,new T,!1),_=X(e,new te(new T,new T),!1),f=X(e,new te(new T,new T),!1),d=X(e,new te(new T,new T),!1),g=X(e,new te(new T,new T),!1),p=new ee,P=new ee,x=new ee,b=new ee,y=0;let w=1;const C=o.val,v=m.val,S=C-.5*Math.PI,D=v+.5*Math.PI,I=a.val;for(N.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,S,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),N.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(y+w);N.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),N.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;N.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=X(e,new T,!1),a=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),N.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),b.setCoords(g.at(0).val,g.at(1).val);const _=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,b.x,b.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,N.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;N.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{Y(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,o){if(e.isEmpty())return new j({vd:e.getDescription()});let f=e;if(a(f)){const e=10*t.getTolerance(0);f=(new oe).execute(f,0,e,0,o,12e3)}const y=new ae(o);y.m_sr=t,y.m_gcs=t.getGCS(),y.m_transform=d(t,y.m_gcs,null);const w=k();y.m_gcs.querySpheroidData(w);const C=new _;f.queryEnvelope(C),y.m_a=w.majorSemiAxis,y.m_eSquared=w.e2,y.m_rpu=y.m_gcs.getUnit().getUnitToBaseFactor(),y.m_gcs90=.5*Math.PI/y.m_rpu,y.m_gcs180=Math.PI/y.m_rpu,y.m_gcs360=2*Math.PI/y.m_rpu,y.m_gcs60=y.m_gcs360/6,y.m_q90=g.q90(y.m_a,y.m_eSquared),y.m_ellipticToGeodesicMaxRatio=.5*y.m_a*Math.PI/y.m_q90;const v=y.m_gcs.getTolerance(0);y.m_radTolerance=v*y.m_rpu,4===s?(y.m_curveType=2,y.m_bShapePreserving=!0):(y.m_curveType=s,y.m_bShapePreserving=!1),y.m_distance=n,y.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?y.setConvergenceOffset():y.m_convergenceOffset=Math.max(i,.001),y.m_convergenceOffset/=r;let S,D=f.getGeometryType();if(h(D)){const e=new O({vd:f.getDescription()});e.addSegment(f,!0),S=e,D=m.enumPolyline}else if(D===m.enumEnvelope){const e=f,t=new _;e.queryEnvelope(t);const s=W(J(y.m_sr,C,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new U({vd:f.getDescription()});e.getCenter(t),S=t,D=m.enumPoint}else{const t=new O({vd:f.getDescription()});t.addEnvelope(e,!1),S=t,D=m.enumPolyline}else{const t=new j({vd:f.getDescription()});t.addEnvelope(e,!1),S=t,D=m.enumPolygon}}else S=f;if(y.setMinCornerStep(),c(D)||y.setMinSegmentStep(),y.m_absDistance<=.5*y.m_convergenceOffset)return D!==m.enumPolygon?new j({vd:S.getDescription()}):y.m_bShapePreserving?S:p(S,y.m_sr,y.m_curveType,y.m_segmentStep,-1,o);if(y.m_distance<0&&D!==m.enumPolygon)return new j({vd:S.getDescription()});if(y.m_bShapePreserving&&u(D)){const e=p(S,t,4,Number.NaN,y.m_convergenceOffset,o);S=(new P).execute(e,y.m_transform,o)}else S=(new P).execute(S,y.m_transform,o);if(S=x(S,y.m_gcs),S.isEmpty())return new j({vd:S.getDescription()});!y.m_bShapePreserving&&u(D)&&(S=b(y.m_rpu,S)),S=fe(S,y.m_gcs);let I=new j;switch(D){case m.enumPolygon:I=y.bufferPolygon(S);break;case m.enumPolyline:I=y.bufferPolyline(S);break;case m.enumMultiPoint:I=y.bufferMultiPoint(S);break;case m.enumPoint:I=y.bufferPoint(S);break;default:l("")}const G=(new P).execute(I,y.m_transform.getInverse(),o);return G.mergeVertexDescription(S.getDescription()),G}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new ee;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=X(u,new T,!1),f=X(u,new te(new T,new T),!1),d=new ee,g=new ee,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(N.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),N.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=X(_,new te(new T,new T),!1),d=new ee,g=new ee,p=new ee;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let b=r;const y=1/s;for(;x<o+m&&(b<u&&u<x?(x=u,P--):b<l&&l<x&&(x=l,P--),!(x>=o));)N.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(y),c.insertPoint2D(0,-1,p),b=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{Y(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new ee,l=new ee,_=X(u,new te(new T,new T),!1);N.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),N.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=X(u,new T,!1);for(N.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,N.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=se;for(;h[0]>c[0];)h[0]-=se;for(;h[0]>=a;)h[0]-=se,c[0]-=se;for(;h[0]<a;)h[0]+=se,c[0]+=se}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=se;for(;e-(n+t)>Math.PI;)n+=se;return n}return n+t-s>Math.PI?n-=se:s-(n+t)>Math.PI&&(n+=se),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=u(s)?e.getPathCount():s===m.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let m=0;m<n;m++){i.push(m);const n=new ee;if(u(s)){const t=new _;e.queryPathEnvelope(m,t),n.assign(t.getCenter())}else n.assign(e.getXY(m));const o=t.toGeohash(n);r.push(o)}i.sort(((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0));const o=e.createInstance();for(let m=0;m<n;m++){const t=i[m];u(s)?o.addPath(e,t,!0):o.addPoints(e,t,t+1)}return o}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=X(o,new T,!1),c=X(o,new T,!1),u=X(o,new T,!1);N.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),N.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),N.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=X(o,new T,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];N.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=ee.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=E(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=X(o,new T,!1);N.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function Pe(e,t,s,n,i,r,o,m){const a=E(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new A(e,t)}function be(e){return V(e,0)||K(e,0),e}class ye{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new ee,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends ye{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new j,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new _;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=E(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new ee,r=new ee;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),q(i,r))i.x=r.x;else if(R(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),R(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),q(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=z(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||B(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new j,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(q(i,r))i.x=r.x;else if(R(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),R(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),q(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,z(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-ne;const i=this.m_endAzimuth[0]+ne;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+ne,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+ne,n=s+Math.PI-(se-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new ee;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=se:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=se)}n=.5*(n+s)}else if(r){const s=new ee;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends ye{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new _;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=E(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new j,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class ve{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new Se(e,t,s,n,i,!1,r,m);return(new f).executeMany(o,t,m)}return new Se(e,t,s,n,i,!1,r,m)}execute(t,n,i,r,o,m,a){const h=new e([t]),c=[r],u=this.executeMany(h,n,i,c,o,!1,m,a).next();return u||s("geodesic buffer null output"),u}}class Se extends t{constructor(e,t,s,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new _,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&n(""),t||i("");0===t.getCoordinateSystemType()&&i(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=s,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{ve as OperatorGeodesicBuffer};
5
+ import{S as e,G as t}from"./SimpleGeometryCursor.js";import{c as s,b as n,t as i,d as r,i as o,G as m,m as a,f as h,e as c,h as u,n as l}from"./Geometry.js";import{Envelope2D as _}from"./Envelope2D.js";import{h as f,v as d,w as g,x as p,y as P,z as x,A as b,p as y,B as w,D as C,L as v,e as S,g as D,E as I,F as G,P as M,G as T,H as N,I as k,J as A,K as E,M as q,N as R,Q as z,R as B}from"./ProjectionTransformation.js";import{b as X,c as Y}from"./tslib.es6.js";import{a as O,P as j,E as F}from"./QuadraticBezier.js";import{d as W,a as J,P as U,b as H,e as L,f as V,s as Q}from"./Envelope.js";import{T as K}from"./Transformation2D.js";import{d as Z,m as $,P as ee,S as te,k as se,l as ne}from"./Point2D.js";import{c as ie}from"./OperatorClip.js";import{c as re}from"./GeometryCleaner-BEJM7I4l.js";import{O as oe}from"./OperatorDensify.js";function me(e,t,s,n,a,h){n<Number.MAX_VALUE&&n>-Number.MAX_VALUE||i("Geodesic_bufferer.buffer - bad distance"),r(e);const c=re(e),u=c.getGeometryType();if(o(u)){const e=c.getPointCount(),i=8e6;if(Math.abs(n)>i&&(e>50||u!==m.enumMultiPoint&&4===s&&e>2)){let e=c;const r=n>0?1:-1,o=7e6;let m=n,u=1;do{u++,m=(Math.abs(m)-o)*r}while(Math.abs(m)>i);m=n;for(let n=0;n<u-1;n++)e=he(e,t,s,o*r,a,u,h),m=(Math.abs(m)-o)*r;return e=he(e,t,s,m,a,u,h),e}}return he(c,t,s,n,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new O,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new O;if(this.bufferPoint2D(t,!1,s)){const e=H(null,s,!0);s=y(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new P).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=w(C());let r=new v,o=(new f).executeMany(r,i,this.m_progressTracker,2);const m=Z(6,!1),a=$(_,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let l,d,g;for(;null!==(l=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=H(i,t,!0),r=W(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new v,o=(new f).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(l),s.needsSimplify()){const e=H(null,l,!0);l=y(l,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(be(l)),o.tock()}else this.putInGridCursors(e,l,i,!0,m,a,h,c,u)}let p=!1;for(let _=0;_<6;_++)if(null!=u[_]){p=!0;break}if(p){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new K;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const _=new v,d=(new f).executeMany(_,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=H(i,t,!0),l=W(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new S).execute(l[e],s,i,this.m_progressTracker));const n=H(i,s,!0),r=W(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new D).execute(s,this.m_gcs,!0,this.m_progressTracker),_.tick(be(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new K;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=H(null,e,!0);e=y(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(be(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new S).execute(t,a,i,this.m_progressTracker));const h=H(i,a,!0),c=W(h);g=n.unproject(a,c,this.m_progressTracker),g=(new D).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new P).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new v,a[c]=(new f).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(be(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=L(t,e),u=J(null,c,!1).total();let l=ie(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new ee;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new ee;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=H(null,l,!0);l=y(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=_.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=I(this.m_gcs,n,e,!0,this.m_progressTracker),r=new F,o=r.addGeometry(i);return G(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),G(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),G(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(G(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),G(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),G(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=g.q(this.m_a,this.m_eSquared,a),u=g.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-ne,_=n+ne,f=l-Math.PI,d=l+Math.PI,p=_+Math.PI,P=[Number.NaN],x=[Number.NaN],b=[Number.NaN],y=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,p,_,o,f,b,y),(_<P[0]&&P[0]<p||_<x[0]&&x[0]<p)&&(w=!0),w||(f<b[0]&&b[0]<l||f<y[0]&&y[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let g=e.length-1;g>=0;g--)C.push(e[g]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let v=0;v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,p,this.m_cornerStep,i,v,r,P[0],x[0]),v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,p,d,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,v,r,b[0],y[0]);let S=!1;return i||(S=this.checkAndPrepForPole(r)),w||S}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new _;return e.queryEnvelope(t),!(!M(t.ymax,this.m_gcs90)&&!M(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new O;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=M(t.y,this.m_gcs90),n=M(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=M(n.y,this.m_gcs90),h=M(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=ee.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=M(i.y,this.m_gcs90),o=M(i.y,-this.m_gcs90);r||o||(s=ee.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new O,s=new O,n=new K,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new _;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new _;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,l;i.x>r.x?(u=-o,l=this.m_gcs90):(u=o,l=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new U;for(let _=0;_<c;_++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=l,g.y=l,t.lineTo(g);const p=new ee;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new _;t.queryEnvelope(x);let b=0;const y=x.getCenter().x;y-P>m?b=-Math.ceil((y-P-m)/o):P-y>m&&(b=Math.ceil((P-y-m)/o)),0!==b&&(n.setShiftCoords(b*o,0),t.applyTransformation(n));const w=new F,C=w.addGeometry(t);G(w,C,this.m_gcs,0,2,!0,a.xmin),G(w,C,this.m_gcs,0,2,!0,a.xmax);const v=w.getGeometry(C),S=L(v,a);S.inflateCoords(0,1);const D=J(null,S,!0).total(),I=ie(v,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(I,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new _;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new _;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new K;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new _;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new ee;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new K;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new F,o=r.addGeometry(c);G(r,o,this.m_gcs,0,2,!0,n.xmin),G(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=L(c,n);m.inflateCoords(0,1);const h=J(null,m,!0).total();c=ie(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new ee;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=X(e,new te(new T,new T),!1),m=X(e,new te(new T,new T),!1),a=X(e,new te(new T,new T),!1),h=X(e,new te(new T,new T),!1),c=new ee,u=new ee,l=new ee,_=new ee;for(N.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),N.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);N.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=X(e,new T,!1),f=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),N.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,N.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new ee,r=new ee;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=X(e,new T,!1),m=X(e,new T,!1),a=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=X(e,new te(new T,new T),!1),c=X(e,new te(new T,new T),!1),u=new ee,l=X(e,new T,!1),_=X(e,new te(new T,new T),!1),f=X(e,new te(new T,new T),!1),d=X(e,new te(new T,new T),!1),g=X(e,new te(new T,new T),!1),p=new ee,P=new ee,x=new ee,b=new ee,y=0;let w=1;const C=o.val,v=m.val,S=C-.5*Math.PI,D=v+.5*Math.PI,I=a.val;for(N.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,S,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),N.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(y+w);N.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),N.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;N.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=X(e,new T,!1),a=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),N.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),b.setCoords(g.at(0).val,g.at(1).val);const _=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,b.x,b.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,N.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=X(e,new T,!1);N.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;N.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{Y(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,o){if(e.isEmpty())return new O({vd:e.getDescription()});let f=e;if(a(f)){const e=10*t.getTolerance(0);f=(new oe).execute(f,0,e,0,o,12e3)}const y=new ae(o);y.m_sr=t,y.m_gcs=t.getGCS(),y.m_transform=d(t,y.m_gcs,null);const w=k();y.m_gcs.querySpheroidData(w);const C=new _;f.queryEnvelope(C),y.m_a=w.majorSemiAxis,y.m_eSquared=w.e2,y.m_rpu=y.m_gcs.getUnit().getUnitToBaseFactor(),y.m_gcs90=.5*Math.PI/y.m_rpu,y.m_gcs180=Math.PI/y.m_rpu,y.m_gcs360=2*Math.PI/y.m_rpu,y.m_gcs60=y.m_gcs360/6,y.m_q90=g.q90(y.m_a,y.m_eSquared),y.m_ellipticToGeodesicMaxRatio=.5*y.m_a*Math.PI/y.m_q90;const v=y.m_gcs.getTolerance(0);y.m_radTolerance=v*y.m_rpu,4===s?(y.m_curveType=2,y.m_bShapePreserving=!0):(y.m_curveType=s,y.m_bShapePreserving=!1),y.m_distance=n,y.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?y.setConvergenceOffset():y.m_convergenceOffset=Math.max(i,.001),y.m_convergenceOffset/=r;let S,D=f.getGeometryType();if(h(D)){const e=new j({vd:f.getDescription()});e.addSegment(f,!0),S=e,D=m.enumPolyline}else if(D===m.enumEnvelope){const e=f,t=new _;e.queryEnvelope(t);const s=W(J(y.m_sr,C,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new U({vd:f.getDescription()});e.getCenter(t),S=t,D=m.enumPoint}else{const t=new j({vd:f.getDescription()});t.addEnvelope(e,!1),S=t,D=m.enumPolyline}else{const t=new O({vd:f.getDescription()});t.addEnvelope(e,!1),S=t,D=m.enumPolygon}}else S=f;if(y.setMinCornerStep(),c(D)||y.setMinSegmentStep(),y.m_absDistance<=.5*y.m_convergenceOffset)return D!==m.enumPolygon?new O({vd:S.getDescription()}):y.m_bShapePreserving?S:p(S,y.m_sr,y.m_curveType,y.m_segmentStep,-1,o);if(y.m_distance<0&&D!==m.enumPolygon)return new O({vd:S.getDescription()});if(y.m_bShapePreserving&&u(D)){const e=p(S,t,4,Number.NaN,y.m_convergenceOffset,o);S=(new P).execute(e,y.m_transform,o)}else S=(new P).execute(S,y.m_transform,o);if(S=x(S,y.m_gcs),S.isEmpty())return new O({vd:S.getDescription()});!y.m_bShapePreserving&&u(D)&&(S=b(y.m_rpu,S)),S=fe(S,y.m_gcs);let I=new O;switch(D){case m.enumPolygon:I=y.bufferPolygon(S);break;case m.enumPolyline:I=y.bufferPolyline(S);break;case m.enumMultiPoint:I=y.bufferMultiPoint(S);break;case m.enumPoint:I=y.bufferPoint(S);break;default:l("")}const G=(new P).execute(I,y.m_transform.getInverse(),o);return G.mergeVertexDescription(S.getDescription()),G}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new ee;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=X(u,new T,!1),f=X(u,new te(new T,new T),!1),d=new ee,g=new ee,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(N.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),N.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=X(_,new te(new T,new T),!1),d=new ee,g=new ee,p=new ee;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let b=r;const y=1/s;for(;x<o+m&&(b<u&&u<x?(x=u,P--):b<l&&l<x&&(x=l,P--),!(x>=o));)N.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(y),c.insertPoint2D(0,-1,p),b=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{Y(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new ee,l=new ee,_=X(u,new te(new T,new T),!1);N.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),N.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=X(u,new T,!1);for(N.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,N.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=se;for(;h[0]>c[0];)h[0]-=se;for(;h[0]>=a;)h[0]-=se,c[0]-=se;for(;h[0]<a;)h[0]+=se,c[0]+=se}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=se;for(;e-(n+t)>Math.PI;)n+=se;return n}return n+t-s>Math.PI?n-=se:s-(n+t)>Math.PI&&(n+=se),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=u(s)?e.getPathCount():s===m.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let m=0;m<n;m++){i.push(m);const n=new ee;if(u(s)){const t=new _;e.queryPathEnvelope(m,t),n.assign(t.getCenter())}else n.assign(e.getXY(m));const o=t.toGeohash(n);r.push(o)}i.sort(((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0));const o=e.createInstance();for(let m=0;m<n;m++){const t=i[m];u(s)?o.addPath(e,t,!0):o.addPoints(e,t,t+1)}return o}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=X(o,new T,!1),c=X(o,new T,!1),u=X(o,new T,!1);N.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),N.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),N.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=X(o,new T,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];N.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=ee.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=E(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=X(o,new T,!1);N.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function Pe(e,t,s,n,i,r,o,m){const a=E(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new A(e,t)}function be(e){return V(e,0)||Q(e,0),e}class ye{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new ee,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends ye{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new O,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new _;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=E(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new ee,r=new ee;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),q(i,r))i.x=r.x;else if(R(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),R(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),q(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=z(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||B(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new O,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(q(i,r))i.x=r.x;else if(R(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),R(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),q(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,z(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-ne;const i=this.m_endAzimuth[0]+ne;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+ne,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+ne,n=s+Math.PI-(se-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new ee;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=se:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=se)}n=.5*(n+s)}else if(r){const s=new ee;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends ye{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new _;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=E(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new O,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class ve{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new Se(e,t,s,n,i,!1,r,m);return(new f).executeMany(o,t,m)}return new Se(e,t,s,n,i,!1,r,m)}execute(t,n,i,r,o,m,a){const h=new e([t]),c=[r],u=this.executeMany(h,n,i,c,o,!1,m,a).next();return u||s("geodesic buffer null output"),u}}class Se extends t{constructor(e,t,s,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new _,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&n(""),t||i("");0===t.getCoordinateSystemType()&&i(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=s,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{ve as OperatorGeodesicBuffer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{t as e,d as t,G as i,c as s,g as n}from"./Geometry.js";import{a,v as _,L as r}from"./QuadraticBezier.js";import{O as h}from"./OperatorDensify.js";import{p as o,g as m,v as l,a4 as p,aw as u,b as c,Z as g,G as d,w as E,$ as f,ax as P,ay as S,E as A,F as x,Q as y,az as R,Y as M,U as C}from"./ProjectionTransformation.js";import{n as T,d as w,P as N,K as q,l as b,s as I,E as v,p as $,f as z,b as D,x as G,y as O,z as L}from"./Point2D.js";import{Envelope2D as k}from"./Envelope2D.js";import{a as F,h as J}from"./Envelope.js";import{O as Y}from"./OperatorClip.js";import{O as U}from"./OperatorShapePreservingLength.js";import{b as X,c as j}from"./tslib.es6.js";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-CcF1gMZX.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=w(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&g.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function Z(e,t,i){const s=new k;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new Y).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=d();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,l=new N(0,0),p=new N(0,0),u=new q(0),c=new Q(l,p,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();l.assign(e.getStartXY()),p.assign(e.getEndXY()),c.setSegmentEndPoints(l,p);const t=_(6,0,1,1e-12,1e-15,c.makeFunctor());u.pe((p.x-l.x)*t)}const g=h.majorSemiAxis;return m*g*g*(1-o)*Math.PI*u.getResult()/t.getPannableExtent().width()}function V(e,t,i,s,n){const a=se(e,t,n);let _=W(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=W(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function W(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new l).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new k;_.queryEnvelope(o);const m=new k,p=new k,u=new k;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),p.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),u.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),p.inflateCoords(.01*p.width(),0),u.inflateCoords(.01*u.width(),0);let c=0;return c+=K(_,m,i,n),c+=K(_,p,i,n),c+=K(_,u,i,n),c}function K(e,t,i,s){const n=(new Y).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new k;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new l).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new N;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(N.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,g=r.y,d=0,E=0;let f=0,P=-1;6!==h?P=p.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),f=0,P=p.PE_PRJ_CYLINDRICAL_EQAREA);const S=u("EqualAreaPCS");let A;P===p.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${d}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${g}],UNIT["Meter",1.0]]`:P===p.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${d}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${f}],PARAMETER["Latitude_of_Origin",${g}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=c(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return T(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,g=0,d=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?d=p.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,g=(t.ymin+2/3*t.height())*_,d=p.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,d=p.PE_PRJ_CYLINDRICAL_EQAREA);const E=u("EqualAreaPCS");let f;return d===p.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:d===p.PE_PRJ_ALBERS?f=`PROJCS["${E}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${g}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:d===p.PE_PRJ_CYLINDRICAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),T(c(f),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new U).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return T(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?Z(c,n,_):V(c,n,u,p,_))}}function ae(){return{m_p_PCS:new N,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(O(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(O(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new k;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?E(i,this.m_inputSR):(new l).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),f(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new l).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=d();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=d();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=X(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{j(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new k;e.queryEnvelope(n);const a=X(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=X(s,new A,!1),l=X(s,new A,!1),p=40,u=[0,0],c=$(ae,p),d=w(p,-1),E=ae(),f=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new q(0),T=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,D,G,O;const L=new N,F=new N,J=new N,Y=new N,U=new N,j=new N;let B,H;for(D=e.getPathStart(0),v=0;v<I;v++,D=G)for(G=e.getPathEnd(v),h.queryPoint2D(G-1<<1,J),o.queryPoint2D(G-1<<1,L),Math.abs(L.y)>T&&(L.y=z(T,L.y)),O=D;O<G;O++,J.assign(Y),L.assign(F)){if(h.queryPoint2D(O<<1,Y),o.queryPoint2D(O<<1,F),Math.abs(F.y)>T&&(F.y=z(T,F.y)),B=N.distance(J,Y),B<r||0===L.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,L.x,L.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(E.setValues(0,J),f.setValues(1,Y),y=i,c[0].assign(f),d[0]=i,P=0;P>=0;){H=.5*(E.m_factor+f.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,L.x,L.y,e*H,t,m,l,this.m_curveType),U.x=m.val,U.y=l.val,u[0]=U.x,u[1]=U.y,g.geogToProj(R,1,u),j.x=u[0],j.y=u[1];const i=-j.offset(E.m_p_PCS,f.m_p_PCS),s=.5*i*N.distance(E.m_p_PCS,f.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)f.setValues(H,j),P++,c[P].assign(f),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;E.assign(f),P--,f.assign(c[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{j(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new N,n=new N,a=y(1,this.m_eSquared,new N(0,.5*Math.PI)),_=new q(0),r=new q(0),h=new q(0),o=new J,m=new J,l=new k;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=D(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let E=c*(l-.5*d.length());E=z(E,i.x-e.x),h.pe(E)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=u("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(p.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`):P.fromString(p.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new N(0,b)),h=y(this.m_a,this.m_eSquared,new N(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new N,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new N,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=X(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new N(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),G(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new N(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),G(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{j(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,E,f,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),E=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*E:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+O(e.e*a.sin_phi))*E,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=L(_.one_m_sin_phi/e.one_p_e,e.e)-L(a.one_m_sin_phi/e.one_p_e,e.e),u=L(_.one_p_sin_phi/e.one_p_e,e.e)-L(a.one_p_sin_phi/e.one_p_e,e.e),c=L(a.one_m_sin_phi/-e.one_m_e,e.e)-L(_.one_m_sin_phi/-e.one_m_e,e.e),g=L(a.one_p_sin_phi/-e.one_m_e,e.e)-L(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,f=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+O(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+O(e.e*_.sin_phi)),P<f&&(S=f,f=P,P=S),d<f&&(d=f),d>P&&(d=P),d*=E,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=O(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new N,h=new N,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
5
+ import{t as e,d as t,G as i,c as s,g as n}from"./Geometry.js";import{a,v as _,L as r}from"./QuadraticBezier.js";import{O as h}from"./OperatorDensify.js";import{v as o,g as m,y as l,a6 as p,aw as u,b as c,$ as g,I as d,z as f,a1 as E,ax as P,ay as S,G as A,H as x,S as y,az as R,_ as M,W as C}from"./ProjectionTransformation.js";import{n as T,d as w,P as N,K as q,l as b,s as I,E as v,p as $,f as z,b as D,x as G,y as O,z as L}from"./Point2D.js";import{Envelope2D as k}from"./Envelope2D.js";import{a as F,h as J}from"./Envelope.js";import{O as Y}from"./OperatorClip.js";import{O as U}from"./OperatorShapePreservingLength.js";import{b as X,c as j}from"./tslib.es6.js";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-CcF1gMZX.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=w(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&g.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function V(e,t,i){const s=new k;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new Y).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=d();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,l=new N(0,0),p=new N(0,0),u=new q(0),c=new Q(l,p,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();l.assign(e.getStartXY()),p.assign(e.getEndXY()),c.setSegmentEndPoints(l,p);const t=_(6,0,1,1e-12,1e-15,c.makeFunctor());u.pe((p.x-l.x)*t)}const g=h.majorSemiAxis;return m*g*g*(1-o)*Math.PI*u.getResult()/t.getPannableExtent().width()}function Z(e,t,i,s,n){const a=se(e,t,n);let _=W(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=W(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function W(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new l).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new k;_.queryEnvelope(o);const m=new k,p=new k,u=new k;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),p.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),u.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),p.inflateCoords(.01*p.width(),0),u.inflateCoords(.01*u.width(),0);let c=0;return c+=K(_,m,i,n),c+=K(_,p,i,n),c+=K(_,u,i,n),c}function K(e,t,i,s){const n=(new Y).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new k;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new l).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new N;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(N.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,g=r.y,d=0,f=0;let E=0,P=-1;6!==h?P=p.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),E=0,P=p.PE_PRJ_CYLINDRICAL_EQAREA);const S=u("EqualAreaPCS");let A;P===p.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${d}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${g}],UNIT["Meter",1.0]]`:P===p.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${d}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${E}],PARAMETER["Latitude_of_Origin",${g}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=c(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return T(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,g=0,d=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?d=p.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,g=(t.ymin+2/3*t.height())*_,d=p.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,d=p.PE_PRJ_CYLINDRICAL_EQAREA);const f=u("EqualAreaPCS");let E;return d===p.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:d===p.PE_PRJ_ALBERS?E=`PROJCS["${f}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${g}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:d===p.PE_PRJ_CYLINDRICAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),T(c(E),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new U).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return T(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?V(c,n,_):Z(c,n,u,p,_))}}function ae(){return{m_p_PCS:new N,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(O(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(O(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new k;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?f(i,this.m_inputSR):(new l).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),E(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new l).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=d();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=d();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=X(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{j(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new k;e.queryEnvelope(n);const a=X(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=X(s,new A,!1),l=X(s,new A,!1),p=40,u=[0,0],c=$(ae,p),d=w(p,-1),f=ae(),E=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new q(0),T=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,D,G,O;const L=new N,F=new N,J=new N,Y=new N,U=new N,j=new N;let B,H;for(D=e.getPathStart(0),v=0;v<I;v++,D=G)for(G=e.getPathEnd(v),h.queryPoint2D(G-1<<1,J),o.queryPoint2D(G-1<<1,L),Math.abs(L.y)>T&&(L.y=z(T,L.y)),O=D;O<G;O++,J.assign(Y),L.assign(F)){if(h.queryPoint2D(O<<1,Y),o.queryPoint2D(O<<1,F),Math.abs(F.y)>T&&(F.y=z(T,F.y)),B=N.distance(J,Y),B<r||0===L.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,L.x,L.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(f.setValues(0,J),E.setValues(1,Y),y=i,c[0].assign(E),d[0]=i,P=0;P>=0;){H=.5*(f.m_factor+E.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,L.x,L.y,e*H,t,m,l,this.m_curveType),U.x=m.val,U.y=l.val,u[0]=U.x,u[1]=U.y,g.geogToProj(R,1,u),j.x=u[0],j.y=u[1];const i=-j.offset(f.m_p_PCS,E.m_p_PCS),s=.5*i*N.distance(f.m_p_PCS,E.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)E.setValues(H,j),P++,c[P].assign(E),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;f.assign(E),P--,E.assign(c[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{j(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new N,n=new N,a=y(1,this.m_eSquared,new N(0,.5*Math.PI)),_=new q(0),r=new q(0),h=new q(0),o=new J,m=new J,l=new k;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=D(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let f=c*(l-.5*d.length());f=z(f,i.x-e.x),h.pe(f)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=u("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(p.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`):P.fromString(p.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new N(0,b)),h=y(this.m_a,this.m_eSquared,new N(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new N,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new N,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=X(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new N(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),G(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new N(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),G(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{j(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,f,E,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),f=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*f:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+O(e.e*a.sin_phi))*f,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=L(_.one_m_sin_phi/e.one_p_e,e.e)-L(a.one_m_sin_phi/e.one_p_e,e.e),u=L(_.one_p_sin_phi/e.one_p_e,e.e)-L(a.one_p_sin_phi/e.one_p_e,e.e),c=L(a.one_m_sin_phi/-e.one_m_e,e.e)-L(_.one_m_sin_phi/-e.one_m_e,e.e),g=L(a.one_p_sin_phi/-e.one_m_e,e.e)-L(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,E=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+O(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+O(e.e*_.sin_phi)),P<E&&(S=E,E=P,P=S),d<E&&(d=E),d>P&&(d=P),d*=f,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=O(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new N,h=new N,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{S as e,G as t}from"./SimpleGeometryCursor.js";import{c as r,b as s,t as n,d as i}from"./Geometry.js";import{u as m}from"./ProjectionTransformation.js";class o{getOperatorType(){return 10310}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,r,s,n){return new a(e,r,s,t,-1,-1,n)}execute(t,s,n,i,m){const o=new e([t]),a=this.executeMany(o,s,n,i,m).next();return a||r("null output"),a}}class a extends t{constructor(e,t,r,i,m,o,a){super(),this.m_progressTracker=a,o>0&&s(""),4!==r&&m>0&&s(""),t||n("");0===t.getCoordinateSystemType()&&n(""),i>0||m>0||n(""),this.m_index=-1,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=r,this.m_maxLengthMeters=i,this.m_maxDeviationMeters=m,this.m_maxAngle=o}next(){{let e;for(;e=this.m_inputGeoms.next();)return i(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.geodeticDensify(e);return null}}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodeticDensify(e){return m(e,this.m_spatialReference,this.m_curveType,this.m_maxLengthMeters,this.m_maxDeviationMeters,this.m_progressTracker)}}export{o as OperatorGeodeticDensifyByLength,a as OperatorGeodeticDensifyCursor};
5
+ import{S as e,G as t}from"./SimpleGeometryCursor.js";import{c as r,b as s,t as n,d as i}from"./Geometry.js";import{x as m}from"./ProjectionTransformation.js";class o{getOperatorType(){return 10310}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,r,s,n){return new a(e,r,s,t,-1,-1,n)}execute(t,s,n,i,m){const o=new e([t]),a=this.executeMany(o,s,n,i,m).next();return a||r("null output"),a}}class a extends t{constructor(e,t,r,i,m,o,a){super(),this.m_progressTracker=a,o>0&&s(""),4!==r&&m>0&&s(""),t||n("");0===t.getCoordinateSystemType()&&n(""),i>0||m>0||n(""),this.m_index=-1,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=r,this.m_maxLengthMeters=i,this.m_maxDeviationMeters=m,this.m_maxAngle=o}next(){{let e;for(;e=this.m_inputGeoms.next();)return i(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.geodeticDensify(e);return null}}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodeticDensify(e){return m(e,this.m_spatialReference,this.m_curveType,this.m_maxLengthMeters,this.m_maxDeviationMeters,this.m_progressTracker)}}export{o as OperatorGeodeticDensifyByLength,a as OperatorGeodeticDensifyCursor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{b as e,c as t}from"./tslib.es6.js";import{t as r,d as n,G as o,f as s}from"./Geometry.js";import{O as a}from"./OperatorShapePreservingLength.js";import{c as i,P as c}from"./QuadraticBezier.js";import{E as m}from"./Point2D.js";import{w as u,_ as g,$ as l,v as p,E as f,F as y,G as x}from"./ProjectionTransformation.js";import{O as h}from"./OperatorDensify.js";class d{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,f,y){if(4===f)return(new a).execute(e,t,y);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const d=t.getGCS(),S=x();d.querySpheroidData(S);const P=S.majorSemiAxis,E=S.e2,G=d.getUnit().getUnitToBaseFactor();let j;const v=e.getGeometryType();if(v===o.enumPolygon?j=e.getBoundary():v===o.enumEnvelope?j=i(e):s(v)?(j=new c({vd:e.getDescription()}),j.addSegment(e,!0)):j=e,j.hasNonLinearSegments()){j=(new h).execute(j,0,t.getTolerance(0),0,y)}if(d!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){j=u(j,t),v===o.enumPolyline&&j===e&&(j=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=j.getPointCount();e<t;e++){const t=j.getXY(e);t.x=g(t.x,r),j.setXY(e,t)}}const n=j.createInstance();j=l(r,j,n,y)?n:(new p).execute(j,r,y)}return this._ExecuteMultiPathGeodeticLength(j,f,P,E,G)}_ExecuteMultiPathGeodeticLength(r,n,o,s,a){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,new f,!1);let c=0;const m=r.querySegmentIterator();for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),r=e.getStartXY(),i=e.getEndXY();r.scale(a),i.scale(a),y.geodeticDistance(o,s,r.x,r.y,i.x,i.y,t,null,null,n),c+=t.val}return c}catch(c){i.error=c,i.hasError=!0}finally{t(i)}}}export{d as OperatorGeodeticLength};
5
+ import{b as e,c as t}from"./tslib.es6.js";import{t as r,d as n,G as o,f as a}from"./Geometry.js";import{O as s}from"./OperatorShapePreservingLength.js";import{c as i,P as c}from"./QuadraticBezier.js";import{E as m}from"./Point2D.js";import{z as u,a0 as g,a1 as l,y as p,G as y,H as f,I as x}from"./ProjectionTransformation.js";import{O as h}from"./OperatorDensify.js";class d{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,y,f){if(4===y)return(new s).execute(e,t,f);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const d=t.getGCS(),S=x();d.querySpheroidData(S);const P=S.majorSemiAxis,G=S.e2,j=d.getUnit().getUnitToBaseFactor();let E;const T=e.getGeometryType();if(T===o.enumPolygon?E=e.getBoundary():T===o.enumEnvelope?E=i(e):a(T)?(E=new c({vd:e.getDescription()}),E.addSegment(e,!0)):E=e,E.hasNonLinearSegments()){E=(new h).execute(E,0,t.getTolerance(0),0,f)}if(d!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){E=u(E,t),T===o.enumPolyline&&E===e&&(E=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=E.getPointCount();e<t;e++){const t=E.getXY(e);t.x=g(t.x,r),E.setXY(e,t)}}const n=E.createInstance();E=l(r,E,n,f)?n:(new p).execute(E,r,f)}return this._ExecuteMultiPathGeodeticLength(E,y,P,G,j)}_ExecuteMultiPathGeodeticLength(r,n,o,a,s){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,new y,!1);let c=0;const m=r.querySegmentIterator();for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),r=e.getStartXY(),i=e.getEndXY();r.scale(s),i.scale(s),f.geodeticDistance(o,a,r.x,r.y,i.x,i.y,t,null,null,n),c+=t.val}return c}catch(c){i.error=c,i.hasError=!0}finally{t(i)}}}export{d as OperatorGeodeticLength};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{G as e}from"./SimpleGeometryCursor.js";import{E as t,n as s,a as r}from"./QuadraticBezier.js";import{d as n,G as o,g as a,t as i}from"./Geometry.js";import{Envelope2D as m}from"./Envelope2D.js";import{i as l,b as g,P as h}from"./Envelope.js";import{g as u,k as c,n as p,o as P,q as y,C as _}from"./ProjectionTransformation.js";class d{getOperatorType(){return 10700}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}executeMany(e,t,s,r=1){return new I(e,t,s,r)}}class I extends e{constructor(e,t,s,r){super(),this.m_progressTracker=s,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_currentGeometry=null,this.m_singlePartIndex=-1,this.m_singlePartCount=-1,this.m_polygonStart=-1,this.m_index=-1,this.m_options=r}tock(){return!0}getRank(){return 1}next(){if(this.m_singlePartIndex===this.m_singlePartCount){const e=this.m_inputGeoms.next();if(null===e)return null;if(n(e),e.getGeometryType()===o.enumPolygon)if(1===this.m_options)this.m_currentGeometry=(new u).execute(e,this.m_spatialReference,!1,this.m_progressTracker);else if(2===this.m_options)if(e.getPathCount()<2)this.m_currentGeometry=e;else{const n=[0],o=e.getImpl().getIsSimple(0,n);if(l(o))this.m_currentGeometry=e;else{const n=new t,o=n.addGeometry(e);let i=null;if(n.hasCurves()){i=new _;const t=new m;e.queryEnvelope(t);const s=g(null,e,!0),r=c(s.total(),t);p(n,r,s.total(),12e3,null,i,null,this.m_progressTracker)}const l=n.createPathUserIndex();{let e=0;for(let t=n.getFirstPath(o);t!==s;t=n.getNextPath(t))n.setPathUserIndex(t,l,e++)}const h=P(n,o,this.m_progressTracker);a(h>=0);const u=[];for(let e=n.getFirstPath(o);e!==s;e=n.getNextPath(e))u.push(e);u.sort(((e,t)=>Math.abs(n.getPathUserIndex(e,h))-Math.abs(n.getPathUserIndex(t,h))));const y=e,d=new r({vd:e.getDescription()});d.reserveParts(y.getPointCount(),y.getPathCount());for(let e=0,t=u.length;e<t;e++){const t=u[e],s=n.getPathUserIndex(t,l),r=y.calculateRingArea2D(s)>0,o=n.getPathUserIndex(t,h)>=0;d.addPath(y,s,r===o)}this.m_currentGeometry=d}}else i("");else this.m_currentGeometry=e;this.m_singlePartCount=f(this.m_currentGeometry),this.m_singlePartIndex=0,this.m_polygonStart=0,this.m_index=this.m_inputGeoms.getGeometryID()}const e=this.getSingleGeometry(this.m_singlePartIndex,this.m_singlePartCount,this.m_polygonStart,this.m_currentGeometry);return e.getGeometryType()===o.enumPolygon&&(this.m_polygonStart+=e.getPathCount()),this.m_singlePartIndex++,e}getGeometryID(){return this.m_index}getSingleGeometry(e,t,s,r){let n=null;switch(r.getGeometryType()){case o.enumMultiPoint:n=new h({vd:r.getDescription()}),r.isEmpty()||r.getPointByVal(e,n);break;case o.enumPolyline:if(1===t)n=r;else{n=r.createInstance(),n.getImpl().addPath(r.getImpl(),e,!0);const t=[0],s=r.getImpl().getIsSimple(0,t);n.getImpl().setIsSimple(s,t[0],!0)}break;case o.enumPolygon:if(1===t)n=r;else{n=r.createInstance();const e=n.getImpl(),t=r.getImpl(),o=t.getPathFlagsStreamRef();let a=s;const i=t.getPathCount();do{e.addPath(t,a,!0),a++}while(a<i&&!(8&o.read(a)));e.getPathFlagsStreamRef().setBits(0,8);const m=[0],l=t.getIsSimple(0,m);e.setIsSimple(l,m[0],!0)}break;default:n=r}return n}}function f(e){return e.isEmpty()?1:y(e)}export{d as O};
5
+ import{G as e}from"./SimpleGeometryCursor.js";import{E as t,n as s,a as r}from"./QuadraticBezier.js";import{d as n,G as o,g as a,t as i}from"./Geometry.js";import{Envelope2D as m}from"./Envelope2D.js";import{i as l,b as g,P as h}from"./Envelope.js";import{g as u,k as c,q as p,t as P,u as y,C as _}from"./ProjectionTransformation.js";class d{getOperatorType(){return 10700}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}executeMany(e,t,s,r=1){return new I(e,t,s,r)}}class I extends e{constructor(e,t,s,r){super(),this.m_progressTracker=s,this.m_inputGeoms=e,this.m_spatialReference=t,this.m_currentGeometry=null,this.m_singlePartIndex=-1,this.m_singlePartCount=-1,this.m_polygonStart=-1,this.m_index=-1,this.m_options=r}tock(){return!0}getRank(){return 1}next(){if(this.m_singlePartIndex===this.m_singlePartCount){const e=this.m_inputGeoms.next();if(null===e)return null;if(n(e),e.getGeometryType()===o.enumPolygon)if(1===this.m_options)this.m_currentGeometry=(new u).execute(e,this.m_spatialReference,!1,this.m_progressTracker);else if(2===this.m_options)if(e.getPathCount()<2)this.m_currentGeometry=e;else{const n=[0],o=e.getImpl().getIsSimple(0,n);if(l(o))this.m_currentGeometry=e;else{const n=new t,o=n.addGeometry(e);let i=null;if(n.hasCurves()){i=new _;const t=new m;e.queryEnvelope(t);const s=g(null,e,!0),r=c(s.total(),t);p(n,r,s.total(),12e3,null,i,null,this.m_progressTracker)}const l=n.createPathUserIndex();{let e=0;for(let t=n.getFirstPath(o);t!==s;t=n.getNextPath(t))n.setPathUserIndex(t,l,e++)}const h=P(n,o,this.m_progressTracker);a(h>=0);const u=[];for(let e=n.getFirstPath(o);e!==s;e=n.getNextPath(e))u.push(e);u.sort(((e,t)=>Math.abs(n.getPathUserIndex(e,h))-Math.abs(n.getPathUserIndex(t,h))));const y=e,d=new r({vd:e.getDescription()});d.reserveParts(y.getPointCount(),y.getPathCount());for(let e=0,t=u.length;e<t;e++){const t=u[e],s=n.getPathUserIndex(t,l),r=y.calculateRingArea2D(s)>0,o=n.getPathUserIndex(t,h)>=0;d.addPath(y,s,r===o)}this.m_currentGeometry=d}}else i("");else this.m_currentGeometry=e;this.m_singlePartCount=f(this.m_currentGeometry),this.m_singlePartIndex=0,this.m_polygonStart=0,this.m_index=this.m_inputGeoms.getGeometryID()}const e=this.getSingleGeometry(this.m_singlePartIndex,this.m_singlePartCount,this.m_polygonStart,this.m_currentGeometry);return e.getGeometryType()===o.enumPolygon&&(this.m_polygonStart+=e.getPathCount()),this.m_singlePartIndex++,e}getGeometryID(){return this.m_index}getSingleGeometry(e,t,s,r){let n=null;switch(r.getGeometryType()){case o.enumMultiPoint:n=new h({vd:r.getDescription()}),r.isEmpty()||r.getPointByVal(e,n);break;case o.enumPolyline:if(1===t)n=r;else{n=r.createInstance(),n.getImpl().addPath(r.getImpl(),e,!0);const t=[0],s=r.getImpl().getIsSimple(0,t);n.getImpl().setIsSimple(s,t[0],!0)}break;case o.enumPolygon:if(1===t)n=r;else{n=r.createInstance();const e=n.getImpl(),t=r.getImpl(),o=t.getPathFlagsStreamRef();let a=s;const i=t.getPathCount();do{e.addPath(t,a,!0),a++}while(a<i&&!(8&o.read(a)));e.getPathFlagsStreamRef().setBits(0,8);const m=[0],l=t.getIsSimple(0,m);e.setIsSimple(l,m[0],!0)}break;default:n=r}return n}}function f(e){return e.isEmpty()?1:y(e)}export{d as O};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{b as e,c as t}from"./tslib.es6.js";import{t as n,G as s,h as o,b as r,c as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{a as u,b as g,S as f,s as y}from"./QuadraticBezier.js";import{m as S,P as d,d as N,b as x}from"./Point2D.js";import{P as h,h as p}from"./Envelope.js";import{G as A}from"./SimpleGeometryCursor.js";import{v as C,O as P,V as w,Q as E,a0 as _,a1 as T,a2 as j,Y as G,a3 as I,G as D,E as b,F as v,a4 as R,a5 as U,a6 as q,a7 as B}from"./ProjectionTransformation.js";import{O as F}from"./OperatorShapePreservingDensify.js";class V{getOperatorType(){return 10501}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}getNearestCoordinate(e,t,y,S,N,x){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();if(Number.isNaN(S)&&(S=0),S>=0||n("maxDeviationMeters"),0===e.getDimension())return this.getNearestVertex(e,t,y);const A=e.getGeometryType();if(A===s.enumGeometryCollection){const n=e;let s=c();for(let e=0,o=n.getGeometryCount();e<o;++e){const o=n.getGeometry(e),r=this.getNearestCoordinate(o,t,y,S,N,x);if(!r.isEmpty()){if(0===r.m_distance)return r;r.m_distance>=s.m_distance||(s=r,s.m_geometryIndex=e)}}return s}if(A===s.enumEnvelope){const n=new u;return n.addEnvelope(e,!1),this.getNearestCoordinate(n,t,y,S,N,x)}o(A)||r("Operation is not implemented for this geometry type");const I=e;if((N||x)&&A===s.enumPolygon){const n=()=>{const e=m(t,-1,0);return e.m_bRightSide=!0,e};if(y.isPannable()){const s=(new C).foldInto360Range(new h(t),y);if(s.isEmpty())return c();const o=(new C).foldInto360Range(e,y);if(o.isEmpty())return c();if((new P).execute(o,s,y,null)&&N)return n()}else{const e=(new C).clipToSpatialReference(new h(t),y,null,1);if(e.isEmpty())return c();const s=w(I,y,0,null);if(s.isEmpty())return c();if((new P).execute(s,e,y,null)&&N)return n()}}const b=y!==y.getGCS()?y.getSRToGCSTransform():null,v=new d;if(b?(new C).transform(b,[t],1,[v],!1):v.assign(t),v.isNAN())return c();const R=O(I,t,y,1);let U=R.m_distance;if(0===U)return R;Number.isNaN(U)?U=Number.POSITIVE_INFINITY:U*=1+1e-7;const q=y.getGCS(),B=q.getUnit().getUnitToBaseFactor(),V=v.clone();V.scale(B);const Y=D();y.querySpheroidData(Y);const X=E(Y.majorSemiAxis,Y.e2,V),L=_(Y.majorSemiAxis,Y.e2),z=new M(I.querySegmentIterator());0===S&&(S=.01);const Q=Y.majorSemiAxis*g(45),H=(new F).executeMany(z,y,Q,S,0,null),J=[];let K=-1;const W=new p,Z=new f;for(let n=H.next();null!==n;n=H.next()){if(n.isEmpty())continue;const t=H.getGeometryID(),s=e.getPathIndexFromPointIndex(t);e.isClosedPath(s)&&I.getPathEnd(s);const o=n;for(let e=0,n=o.getPathCount();e<n;++e){J.length=0;for(let t=o.getPathStart(e),r=o.getPathEnd(e);t<r;++t)J.push(o.getXY(t));if(b&&(new C).transform(b,J,J.length,J,!1),J.length>3){const e=k(J,J.length,v,q,1);if(e.m_distance<U){U=e.m_distance,W.assign(E(Y.majorSemiAxis,Y.e2,e.m_coordinate.mul(B))),K=t;let n=e.m_vertexIndex;n+1===J.length&&(n-=1),o.getSegmentBuffer(n,Z,!0)}}J.forEach((e=>e.mulThis(B)));const n=E(Y.majorSemiAxis,Y.e2,J[0]),s=new p;for(let e=1,r=J.length;e<r;++e){const r=E(Y.majorSemiAxis,Y.e2,J[e]);if(T(L,X,n,r,s)<U){const{second:s}=j(Y.majorSemiAxis,Y.e2,X,n,r,2,null);if(s<=U){const s=new p,{second:i}=j(Y.majorSemiAxis,Y.e2,X,n,r,0,s);i<U&&(U=i,W.assign(s),K=t,o.getSegmentBuffer(e-1,Z,!0))}}n.assign(r)}}}if(!Number.isFinite(U))return c();-1===K&&n("");const $=G(Y.majorSemiAxis,Y.e2,W);$.divThis(B);const ee=$.clone(),te=y!==y.getGCS()?y.getGCSToSRTransform():null;te&&(new C).transform(te,[$],1,[ee],!1),ee.isNAN()&&i("closestPoint2DSr.isNAN()"),a(!Z.empty());const ne=Z.get().getClosestCoordinate(ee,!1);ee.assign(Z.get().getCoord2D(ne)),b?(new C).transform(b,[ee],1,[$],!1):$.assign(ee),a(!$.isNAN());const se=this.getNearestVertex(new h($),v,y.getGCS()),oe=m(ee,K,se.m_distance);if(x&&e.getDimension()>0){const n=l(e,t,-1,-1),s=0!==n&&3!==n;oe.m_bRightSide=s}return oe}getNearestVertex(e,t,o){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();switch(e.getGeometryType()){case s.enumPoint:return Y(e,t,o);case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return O(e,t,o);default:r("")}}getNearestVertexPoint2D(e,t,n,s){return k(e,t,n,s)}getNearestVertices(e,t,o,i,a){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case s.enumPoint:{const n=Y(e,t,o);if(!n.isEmpty()&&n.m_distance<i&&a>=1){const e=[];return e.push(n),e}return[]}case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return X(e,t,o,i,a);default:r("")}}}function Y(s,o,r){const i={stack:[],error:void 0,hasError:!1};try{if(0===r.getCoordinateSystemType()&&n("Cannot use local SR"),1!==r.getCoordinateSystemType()){const e=new Array(2);e[0]=s.getXY(),e[1]=o.clone();const t=S(d,2);2!==I(r,e,2,t)&&n("Point cannot be projected to GCS");const i=r.getGCS(),a=Y(new h(t[0]),t[1],i);return m(a.m_coordinate,0,a.m_distance)}const t=r.getUnit().getUnitToBaseFactor(),a=s.getXY();a.scale(t);const c=o.clone();c.scale(t);const l=D();r.querySpheroidData(l);const u=e(i,new b,!1);v.geodeticDistance(l.majorSemiAxis,l.e2,a.x,a.y,c.x,c.y,u,null,null,R.PE_LINETYPE_GEODESIC);const g=s.getXY();return m(g,0,u.val)}catch(a){i.error=a,i.hasError=!0}finally{t(i)}}function O(s,o,r,i=0){0===r.getCoordinateSystemType()&&n("Cannot use local SR");let a=s.getAttributeStreamRef(0),c=s.getPointCount();const l=r.getGCS(),u=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(U(e,[o],1,[u],null),u.isNAN())return m(d.getNAN(),-1,Number.NaN);const t=(new C).execute(s,e,null);a=t.getAttributeStreamRef(0),c=t.getPointCount()}const g=l.getUnit().getUnitToBaseFactor(),f=N(c,0);for(let e=0;e<c;++e)f[e]=e;y(c,f);const S=D();l.querySpheroidData(S);const h=u.clone();h.scale(g);const A=E(S.majorSemiAxis,S.e2,h);let P=-1,w=Number.MAX_VALUE;const _=q(S.majorSemiAxis,S.e2);let T=c;const j=new d,G=new d;for(let e=0;e<T;){if(a.queryPoint2D(2*f[e],j),j.isNAN())continue;G.assign(j),G.scale(g);const t=E(S.majorSemiAxis,S.e2,G);if(p.distance(t,A)>w){f[T-1]=x(f[e],f[e]=f[T-1]),T--;continue}const n=B(_,t,A);n<w&&(P=f[e],w=n),e++}if(0!==S.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new b,!1);for(let e=0;e<T;e++){if(a.queryPoint2D(2*f[e],j),j.isNAN())continue;G.assign(j),G.scale(g);const n=E(S.majorSemiAxis,S.e2,G);p.distance(n,A)>w||(v.geodeticDistance(S.majorSemiAxis,S.e2,h.x,h.y,G.x,G.y,t,null,null,i),t.val<w&&(P=f[e],w=t.val))}}catch(R){n.error=R,n.hasError=!0}finally{t(n)}}const I=new d;return-1!==P&&I.assign(s.getXY(P)),m(I,P,w)}function k(s,o,r,i,a=0){0===i.getCoordinateSystemType()&&n("Cannot use local SR");const l=i.getGCS(),u=r.clone();if(1!==i.getCoordinateSystemType()){const e=i.getSRToGCSTransform();if(U(e,[r],1,[u],null),u.isNAN())return c();const t=S(d,o);U(e,s,o,t,null);const n=k(t,o,r,l,a);return n.isEmpty()?n:m(s[n.m_vertexIndex],n.m_vertexIndex,n.m_distance)}const g=l.getUnit().getUnitToBaseFactor(),f=N(o,0);for(let e=0;e<o;++e)f[e]=e;y(o,f);const h=D();l.querySpheroidData(h);const A=u.clone();A.scale(g);const C=E(h.majorSemiAxis,h.e2,A);let P=-1,w=Number.MAX_VALUE;const _=q(h.majorSemiAxis,h.e2);let T=o;for(let e=0;e<T;){const t=s[f[e]];if(t.isNAN())continue;const n=t.clone();n.scale(g);const o=E(h.majorSemiAxis,h.e2,n);if(p.distance(o,C)>w){f[T-1]=x(f[e],f[e]=f[T-1]),T--;continue}const r=B(_,o,C);r<w&&(P=f[e],w=r),e++}if(0!==h.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new b,!1);for(let e=0;e<T;e++){const n=s[f[e]];if(n.isNAN())continue;const o=n.clone();o.scale(g);const r=E(h.majorSemiAxis,h.e2,o);p.distance(r,C)>w||(v.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,o.x,o.y,t,null,null,a),t.val<w&&(P=f[e],w=t.val))}}catch(G){n.error=G,n.hasError=!0}finally{t(n)}}const j=new d;return-1!==P&&j.assign(s[P]),m(j,P,w)}function X(s,o,r,i,a){const c={stack:[],error:void 0,hasError:!1};try{0===r.getCoordinateSystemType()&&n("Cannot use local SR");let t=s.getAttributeStreamRef(0),l=s.getPointCount();const u=r.getGCS(),g=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(U(e,[o],1,[g],null),g.isNAN())return[];const n=(new C).execute(s,e,null);t=n.getAttributeStreamRef(0),l=n.getPointCount()}const f=u.getUnit().getUnitToBaseFactor(),S=N(l,0);for(let e=0;e<l;++e)S[e]=e;y(l,S);const h=D();u.querySpheroidData(h);const A=g.clone();A.scale(f);const P=E(h.majorSemiAxis,h.e2,A),w=[];let _=l;const T=new d,j=new d;for(let e=0;e<_;){if(t.queryPoint2D(2*S[e],T),T.isNAN())continue;j.assign(T),j.scale(f);const n=E(h.majorSemiAxis,h.e2,j);p.distance(n,P)>i?(S[_-1]=x(S[e],S[e]=S[_-1]),_--):e++}const G=(e,t)=>e.m_distance-t.m_distance,I=e(c,new b,!1);for(let e=0;e<_;e++)t.queryPoint2D(2*S[e],T),T.isNAN()||(v.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,T.x*f,T.y*f,I,null,null,R.PE_LINETYPE_GEODESIC),I.val<i&&w.push(m(T,S[e],I.val)));return w.sort(G),w.slice(0,a)}catch(l){c.error=l,c.hasError=!0}finally{t(c)}}class M extends A{constructor(e){super(),this.m_first=!0,this.m_segIter=e,this.m_segIter.stripAttributes()}tock(){return!0}getRank(){return 1}next(){if(this.m_first){if(!this.m_segIter.nextPath())return null;this.m_first=!1}for(;;){if(this.m_segIter.hasNextSegment())return this.m_segIter.nextSegment().clone();if(!this.m_segIter.nextPath())break}return null}getGeometryID(){return this.m_segIter.getStartPointIndex()}}export{V as OperatorProximityGeodesic};
5
+ import{b as e,c as t}from"./tslib.es6.js";import{t as n,G as s,h as o,b as r,c as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{a as u,b as g,S as f,s as y}from"./QuadraticBezier.js";import{m as S,P as d,d as N,b as x}from"./Point2D.js";import{P as h,h as p}from"./Envelope.js";import{G as A}from"./SimpleGeometryCursor.js";import{y as C,O as P,X as w,S as E,a2 as _,a3 as T,a4 as j,_ as G,a5 as I,I as D,G as b,H as v,a6 as R,a7 as U,a8 as q,a9 as B}from"./ProjectionTransformation.js";import{O as F}from"./OperatorShapePreservingDensify.js";class O{getOperatorType(){return 10501}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}getNearestCoordinate(e,t,y,S,N,x){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();if(Number.isNaN(S)&&(S=0),S>=0||n("maxDeviationMeters"),0===e.getDimension())return this.getNearestVertex(e,t,y);const A=e.getGeometryType();if(A===s.enumGeometryCollection){const n=e;let s=c();for(let e=0,o=n.getGeometryCount();e<o;++e){const o=n.getGeometry(e),r=this.getNearestCoordinate(o,t,y,S,N,x);if(!r.isEmpty()){if(0===r.m_distance)return r;r.m_distance>=s.m_distance||(s=r,s.m_geometryIndex=e)}}return s}if(A===s.enumEnvelope){const n=new u;return n.addEnvelope(e,!1),this.getNearestCoordinate(n,t,y,S,N,x)}o(A)||r("Operation is not implemented for this geometry type");const I=e;if((N||x)&&A===s.enumPolygon){const n=()=>{const e=m(t,-1,0);return e.m_bRightSide=!0,e};if(y.isPannable()){const s=(new C).foldInto360Range(new h(t),y);if(s.isEmpty())return c();const o=(new C).foldInto360Range(e,y);if(o.isEmpty())return c();if((new P).execute(o,s,y,null)&&N)return n()}else{const e=(new C).clipToSpatialReference(new h(t),y,null,1);if(e.isEmpty())return c();const s=w(I,y,0,null);if(s.isEmpty())return c();if((new P).execute(s,e,y,null)&&N)return n()}}const b=y!==y.getGCS()?y.getSRToGCSTransform():null,v=new d;if(b?(new C).transform(b,[t],1,[v],!1):v.assign(t),v.isNAN())return c();const R=X(I,t,y,1);let U=R.m_distance;if(0===U)return R;Number.isNaN(U)?U=Number.POSITIVE_INFINITY:U*=1+1e-7;const q=y.getGCS(),B=q.getUnit().getUnitToBaseFactor(),O=v.clone();O.scale(B);const V=D();y.querySpheroidData(V);const k=E(V.majorSemiAxis,V.e2,O),L=_(V.majorSemiAxis,V.e2),z=new M(I.querySegmentIterator());0===S&&(S=.01);const H=V.majorSemiAxis*g(45),Q=(new F).executeMany(z,y,H,S,0,null),J=[];let K=-1;const W=new p,Z=new f;for(let n=Q.next();null!==n;n=Q.next()){if(n.isEmpty())continue;const t=Q.getGeometryID(),s=e.getPathIndexFromPointIndex(t);e.isClosedPath(s)&&I.getPathEnd(s);const o=n;for(let e=0,n=o.getPathCount();e<n;++e){J.length=0;for(let t=o.getPathStart(e),r=o.getPathEnd(e);t<r;++t)J.push(o.getXY(t));if(b&&(new C).transform(b,J,J.length,J,!1),J.length>3){const e=Y(J,J.length,v,q,1);if(e.m_distance<U){U=e.m_distance,W.assign(E(V.majorSemiAxis,V.e2,e.m_coordinate.mul(B))),K=t;let n=e.m_vertexIndex;n+1===J.length&&(n-=1),o.getSegmentBuffer(n,Z,!0)}}J.forEach((e=>e.mulThis(B)));const n=E(V.majorSemiAxis,V.e2,J[0]),s=new p;for(let e=1,r=J.length;e<r;++e){const r=E(V.majorSemiAxis,V.e2,J[e]);if(T(L,k,n,r,s)<U){const{second:s}=j(V.majorSemiAxis,V.e2,k,n,r,2,null);if(s<=U){const s=new p,{second:i}=j(V.majorSemiAxis,V.e2,k,n,r,0,s);i<U&&(U=i,W.assign(s),K=t,o.getSegmentBuffer(e-1,Z,!0))}}n.assign(r)}}}if(!Number.isFinite(U))return c();-1===K&&n("");const $=G(V.majorSemiAxis,V.e2,W);$.divThis(B);const ee=$.clone(),te=y!==y.getGCS()?y.getGCSToSRTransform():null;te&&(new C).transform(te,[$],1,[ee],!1),ee.isNAN()&&i("closestPoint2DSr.isNAN()"),a(!Z.empty());const ne=Z.get().getClosestCoordinate(ee,!1);ee.assign(Z.get().getCoord2D(ne)),b?(new C).transform(b,[ee],1,[$],!1):$.assign(ee),a(!$.isNAN());const se=this.getNearestVertex(new h($),v,y.getGCS()),oe=m(ee,K,se.m_distance);if(x&&e.getDimension()>0){const n=l(e,t,-1,-1),s=0!==n&&3!==n;oe.m_bRightSide=s}return oe}getNearestVertex(e,t,o){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();switch(e.getGeometryType()){case s.enumPoint:return V(e,t,o);case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return X(e,t,o);default:r("")}}getNearestVertexPoint2D(e,t,n,s){return Y(e,t,n,s)}getNearestVertices(e,t,o,i,a){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case s.enumPoint:{const n=V(e,t,o);if(!n.isEmpty()&&n.m_distance<i&&a>=1){const e=[];return e.push(n),e}return[]}case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return k(e,t,o,i,a);default:r("")}}}function V(s,o,r){const i={stack:[],error:void 0,hasError:!1};try{if(0===r.getCoordinateSystemType()&&n("Cannot use local SR"),1!==r.getCoordinateSystemType()){const e=new Array(2);e[0]=s.getXY(),e[1]=o.clone();const t=S(d,2);2!==I(r,e,2,t)&&n("Point cannot be projected to GCS");const i=r.getGCS(),a=V(new h(t[0]),t[1],i);return m(a.m_coordinate,0,a.m_distance)}const t=r.getUnit().getUnitToBaseFactor(),a=s.getXY();a.scale(t);const c=o.clone();c.scale(t);const l=D();r.querySpheroidData(l);const u=e(i,new b,!1);v.geodeticDistance(l.majorSemiAxis,l.e2,a.x,a.y,c.x,c.y,u,null,null,R.PE_LINETYPE_GEODESIC);const g=s.getXY();return m(g,0,u.val)}catch(a){i.error=a,i.hasError=!0}finally{t(i)}}function X(s,o,r,i=0){0===r.getCoordinateSystemType()&&n("Cannot use local SR");let a=s.getAttributeStreamRef(0),c=s.getPointCount();const l=r.getGCS(),u=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(U(e,[o],1,[u],null),u.isNAN())return m(d.getNAN(),-1,Number.NaN);const t=(new C).execute(s,e,null);a=t.getAttributeStreamRef(0),c=t.getPointCount()}const g=l.getUnit().getUnitToBaseFactor(),f=N(c,0);for(let e=0;e<c;++e)f[e]=e;y(c,f);const S=D();l.querySpheroidData(S);const h=u.clone();h.scale(g);const A=E(S.majorSemiAxis,S.e2,h);let P=-1,w=Number.MAX_VALUE;const _=q(S.majorSemiAxis,S.e2);let T=c;const j=new d,G=new d;for(let e=0;e<T;){if(a.queryPoint2D(2*f[e],j),j.isNAN())continue;G.assign(j),G.scale(g);const t=E(S.majorSemiAxis,S.e2,G);if(p.distance(t,A)>w){f[T-1]=x(f[e],f[e]=f[T-1]),T--;continue}const n=B(_,t,A);n<w&&(P=f[e],w=n),e++}if(0!==S.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new b,!1);for(let e=0;e<T;e++){if(a.queryPoint2D(2*f[e],j),j.isNAN())continue;G.assign(j),G.scale(g);const n=E(S.majorSemiAxis,S.e2,G);p.distance(n,A)>w||(v.geodeticDistance(S.majorSemiAxis,S.e2,h.x,h.y,G.x,G.y,t,null,null,i),t.val<w&&(P=f[e],w=t.val))}}catch(R){n.error=R,n.hasError=!0}finally{t(n)}}const I=new d;return-1!==P&&I.assign(s.getXY(P)),m(I,P,w)}function Y(s,o,r,i,a=0){0===i.getCoordinateSystemType()&&n("Cannot use local SR");const l=i.getGCS(),u=r.clone();if(1!==i.getCoordinateSystemType()){const e=i.getSRToGCSTransform();if(U(e,[r],1,[u],null),u.isNAN())return c();const t=S(d,o);U(e,s,o,t,null);const n=Y(t,o,r,l,a);return n.isEmpty()?n:m(s[n.m_vertexIndex],n.m_vertexIndex,n.m_distance)}const g=l.getUnit().getUnitToBaseFactor(),f=N(o,0);for(let e=0;e<o;++e)f[e]=e;y(o,f);const h=D();l.querySpheroidData(h);const A=u.clone();A.scale(g);const C=E(h.majorSemiAxis,h.e2,A);let P=-1,w=Number.MAX_VALUE;const _=q(h.majorSemiAxis,h.e2);let T=o;for(let e=0;e<T;){const t=s[f[e]];if(t.isNAN())continue;const n=t.clone();n.scale(g);const o=E(h.majorSemiAxis,h.e2,n);if(p.distance(o,C)>w){f[T-1]=x(f[e],f[e]=f[T-1]),T--;continue}const r=B(_,o,C);r<w&&(P=f[e],w=r),e++}if(0!==h.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new b,!1);for(let e=0;e<T;e++){const n=s[f[e]];if(n.isNAN())continue;const o=n.clone();o.scale(g);const r=E(h.majorSemiAxis,h.e2,o);p.distance(r,C)>w||(v.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,o.x,o.y,t,null,null,a),t.val<w&&(P=f[e],w=t.val))}}catch(G){n.error=G,n.hasError=!0}finally{t(n)}}const j=new d;return-1!==P&&j.assign(s[P]),m(j,P,w)}function k(s,o,r,i,a){const c={stack:[],error:void 0,hasError:!1};try{0===r.getCoordinateSystemType()&&n("Cannot use local SR");let t=s.getAttributeStreamRef(0),l=s.getPointCount();const u=r.getGCS(),g=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(U(e,[o],1,[g],null),g.isNAN())return[];const n=(new C).execute(s,e,null);t=n.getAttributeStreamRef(0),l=n.getPointCount()}const f=u.getUnit().getUnitToBaseFactor(),S=N(l,0);for(let e=0;e<l;++e)S[e]=e;y(l,S);const h=D();u.querySpheroidData(h);const A=g.clone();A.scale(f);const P=E(h.majorSemiAxis,h.e2,A),w=[];let _=l;const T=new d,j=new d;for(let e=0;e<_;){if(t.queryPoint2D(2*S[e],T),T.isNAN())continue;j.assign(T),j.scale(f);const n=E(h.majorSemiAxis,h.e2,j);p.distance(n,P)>i?(S[_-1]=x(S[e],S[e]=S[_-1]),_--):e++}const G=(e,t)=>e.m_distance-t.m_distance,I=e(c,new b,!1);for(let e=0;e<_;e++)t.queryPoint2D(2*S[e],T),T.isNAN()||(v.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,T.x*f,T.y*f,I,null,null,R.PE_LINETYPE_GEODESIC),I.val<i&&w.push(m(T,S[e],I.val)));return w.sort(G),w.slice(0,a)}catch(l){c.error=l,c.hasError=!0}finally{t(c)}}class M extends A{constructor(e){super(),this.m_first=!0,this.m_segIter=e,this.m_segIter.stripAttributes()}tock(){return!0}getRank(){return 1}next(){if(this.m_first){if(!this.m_segIter.nextPath())return null;this.m_first=!1}for(;;){if(this.m_segIter.hasNextSegment())return this.m_segIter.nextSegment().clone();if(!this.m_segIter.nextPath())break}return null}getGeometryID(){return this.m_segIter.getStartPointIndex()}}export{O as OperatorProximityGeodesic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{t as e,G as t,f as s,c as n}from"./Geometry.js";import{Z as o,f as r,p as a,Q as i,G as m}from"./ProjectionTransformation.js";import{a as c,P as g}from"./QuadraticBezier.js";import{p as u,d as p,P as h}from"./Point2D.js";import{h as y}from"./Envelope.js";import{Envelope2D as f}from"./Envelope2D.js";import{O as l}from"./OperatorDensify.js";import{O as _}from"./OperatorClip.js";function x(){return{m_pGcs:new h,m_xyz:new y,m_factor:Number.NaN,m_geoLength:Number.NaN,setValues:d,setLength:P,assign:S}}function d(e,t,s,n){this.m_factor=e,this.m_pGcs.assign(t),this.m_xyz.assign(n),this.m_geoLength=s}function P(e){this.m_geoLength=e}function S(e){this.m_pGcs.assign(e.m_pGcs),this.m_xyz.assign(e.m_xyz),this.m_factor=e.m_factor,this.m_geoLength=e.m_geoLength}class w{getOperatorType(){return 10315}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}_ExecuteShapePreservingLength(e,t,s,n,a){if(e.hasNonLinearSegments()){e=(new l).execute(e,0,t.getTolerance(0),0,a)}if(t.isPannable()){let n=90,r=-90;if(1===s.getUnit().getUnitToBaseFactor()&&(n*=Math.PI/180,r*=Math.PI/180),2===t.getCoordinateSystemType()){let e=null;const s=[0,0,0,0];e=t.getPECoordSys(),s[0]=0,s[1]=n,s[2]=0,s[3]=r,o.geogToProj(e,2,s),n=s[1],r=s[3]}const i=new f;e.queryEnvelope(i),i.ymin=r,i.ymax=n,e=(new _).execute(e,i,t,a)}else{const s=t.getPCSHorizon();if((e=(new r).execute(e,s,t,a))===s){const t=e.clone();e=t}}return e.isEmpty()?0:this._ExecuteIterativeApproach(e,t,s,n,1,a)}_ExecuteIterativeApproach(e,t,s,r,a,i){const c=m();s.querySpheroidData(c);const g=c.majorSemiAxis,f=c.e2,l=s.getUnit().getUnitToBaseFactor(),_=40,d=u(x,_),P=p(_,Number.NaN),S=x(),w=x();let E;const G=[0,0,0,0],j=t.getPECoordSys(),L=new h,T=new h,v=new h,D=new h,b=new h;let z=0;const O=e.querySegmentIterator();for(;O.nextPath();)for(;O.hasNextSegment();){const e=O.nextSegment();L.assign(e.getStartXY()),T.assign(e.getEndXY()),2===t.getCoordinateSystemType()?(G[0]=L.x,G[1]=L.y,G[2]=T.x,G[3]=T.y,o.projToGeog(j,2,G),v.x=G[0]*l,v.y=G[1]*l,D.x=G[2]*l,D.y=G[3]*l):(v.setCoordsPoint2D(L),D.setCoordsPoint2D(T),v.scale(l),D.scale(l));const s=new y,r=new y;N(g,f,v,s),N(g,f,D,r);let i=C(g,s,r);S.setValues(0,v,Number.NaN,s),w.setValues(1,D,i,r),E=a,d[0].assign(w),P[0]=a;let m=0;for(;;){m>128&&n("iterations exceeded");const s=.5*(S.m_factor+w.m_factor),r=e.getCoord2D(s);2===t.getCoordinateSystemType()?(G[0]=r.x,G[1]=r.y,o.projToGeog(j,1,G),b.x=G[0]*l,b.y=G[1]*l):(b.setCoordsPoint2D(r),b.scale(l)),v.setCoordsPoint2D(S.m_pGcs),D.setCoordsPoint2D(w.m_pGcs);const c=new y;N(g,f,b,c);const u=C(g,S.m_xyz,c),p=C(g,w.m_xyz,c);i=w.m_geoLength,Number.isNaN(i)&&(i=C(g,S.m_xyz,w.m_xyz));const h=u+p,x=E===a&&h>=20&&Math.abs(h-i)>1e-8*(i+h);if(m+2<_&&(x||Math.abs(h-i)>0&&E>0))w.setLength(p),d[m].assign(w),w.setValues(s,b,u,c),d[++m].assign(w),x?(E=a,P[m]=a):(E--,P[m-1]=E,P[m]=E);else{if(z+=h,0===m)break;S.assign(w),w.assign(d[--m]),E=P[m]}}}return z}execute(n,o,r){if(o&&0!==o.getCoordinateSystemType()||e(""),n.isEmpty()||n.getDimension()<1)return 0;let i=null;const m=o.getGCS();m!==o&&(i=a(o,m,null));const u=n.getGeometryType();if(u===t.enumEnvelope){const e=new c;return e.addEnvelope(n,!1),this._ExecuteShapePreservingLength(e,o,m,i,r)}if(s(u)){const e=new g;return e.addSegment(n,!0),this._ExecuteShapePreservingLength(e,o,m,i,r)}return this._ExecuteShapePreservingLength(n,o,m,i,r)}}function N(e,t,s,n){n.assign(i(e,t,s))}function C(e,t,s){const n=e,o=new y;o.setSub(t,s);const r=o.length();return 2*n*Math.asin(r/(2*n))}export{w as O};
5
+ import{t as e,G as t,f as s,c as n}from"./Geometry.js";import{$ as o,f as r,v as a,S as i,I as m}from"./ProjectionTransformation.js";import{a as c,P as g}from"./QuadraticBezier.js";import{p as u,d as p,P as h}from"./Point2D.js";import{h as y}from"./Envelope.js";import{Envelope2D as f}from"./Envelope2D.js";import{O as l}from"./OperatorDensify.js";import{O as _}from"./OperatorClip.js";function x(){return{m_pGcs:new h,m_xyz:new y,m_factor:Number.NaN,m_geoLength:Number.NaN,setValues:d,setLength:S,assign:P}}function d(e,t,s,n){this.m_factor=e,this.m_pGcs.assign(t),this.m_xyz.assign(n),this.m_geoLength=s}function S(e){this.m_geoLength=e}function P(e){this.m_pGcs.assign(e.m_pGcs),this.m_xyz.assign(e.m_xyz),this.m_factor=e.m_factor,this.m_geoLength=e.m_geoLength}class w{getOperatorType(){return 10315}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}_ExecuteShapePreservingLength(e,t,s,n,a){if(e.hasNonLinearSegments()){e=(new l).execute(e,0,t.getTolerance(0),0,a)}if(t.isPannable()){let n=90,r=-90;if(1===s.getUnit().getUnitToBaseFactor()&&(n*=Math.PI/180,r*=Math.PI/180),2===t.getCoordinateSystemType()){let e=null;const s=[0,0,0,0];e=t.getPECoordSys(),s[0]=0,s[1]=n,s[2]=0,s[3]=r,o.geogToProj(e,2,s),n=s[1],r=s[3]}const i=new f;e.queryEnvelope(i),i.ymin=r,i.ymax=n,e=(new _).execute(e,i,t,a)}else{const s=t.getPCSHorizon();if((e=(new r).execute(e,s,t,a))===s){const t=e.clone();e=t}}return e.isEmpty()?0:this._ExecuteIterativeApproach(e,t,s,n,1,a)}_ExecuteIterativeApproach(e,t,s,r,a,i){const c=m();s.querySpheroidData(c);const g=c.majorSemiAxis,f=c.e2,l=s.getUnit().getUnitToBaseFactor(),_=40,d=u(x,_),S=p(_,Number.NaN),P=x(),w=x();let E;const G=[0,0,0,0],j=t.getPECoordSys(),v=new h,L=new h,T=new h,D=new h,b=new h;let z=0;const I=e.querySegmentIterator();for(;I.nextPath();)for(;I.hasNextSegment();){const e=I.nextSegment();v.assign(e.getStartXY()),L.assign(e.getEndXY()),2===t.getCoordinateSystemType()?(G[0]=v.x,G[1]=v.y,G[2]=L.x,G[3]=L.y,o.projToGeog(j,2,G),T.x=G[0]*l,T.y=G[1]*l,D.x=G[2]*l,D.y=G[3]*l):(T.setCoordsPoint2D(v),D.setCoordsPoint2D(L),T.scale(l),D.scale(l));const s=new y,r=new y;N(g,f,T,s),N(g,f,D,r);let i=C(g,s,r);P.setValues(0,T,Number.NaN,s),w.setValues(1,D,i,r),E=a,d[0].assign(w),S[0]=a;let m=0;for(;;){m>128&&n("iterations exceeded");const s=.5*(P.m_factor+w.m_factor),r=e.getCoord2D(s);2===t.getCoordinateSystemType()?(G[0]=r.x,G[1]=r.y,o.projToGeog(j,1,G),b.x=G[0]*l,b.y=G[1]*l):(b.setCoordsPoint2D(r),b.scale(l)),T.setCoordsPoint2D(P.m_pGcs),D.setCoordsPoint2D(w.m_pGcs);const c=new y;N(g,f,b,c);const u=C(g,P.m_xyz,c),p=C(g,w.m_xyz,c);i=w.m_geoLength,Number.isNaN(i)&&(i=C(g,P.m_xyz,w.m_xyz));const h=u+p,x=E===a&&h>=20&&Math.abs(h-i)>1e-8*(i+h);if(m+2<_&&(x||Math.abs(h-i)>0&&E>0))w.setLength(p),d[m].assign(w),w.setValues(s,b,u,c),d[++m].assign(w),x?(E=a,S[m]=a):(E--,S[m-1]=E,S[m]=E);else{if(z+=h,0===m)break;P.assign(w),w.assign(d[--m]),E=S[m]}}}return z}execute(n,o,r){if(o&&0!==o.getCoordinateSystemType()||e(""),n.isEmpty()||n.getDimension()<1)return 0;let i=null;const m=o.getGCS();m!==o&&(i=a(o,m,null));const u=n.getGeometryType();if(u===t.enumEnvelope){const e=new c;return e.addEnvelope(n,!1),this._ExecuteShapePreservingLength(e,o,m,i,r)}if(s(u)){const e=new g;return e.addSegment(n,!0),this._ExecuteShapePreservingLength(e,o,m,i,r)}return this._ExecuteShapePreservingLength(n,o,m,i,r)}}function N(e,t,s,n){n.assign(i(e,t,s))}function C(e,t,s){const n=e,o=new y;o.setSub(t,s);const r=o.length();return 2*n*Math.asin(r/(2*n))}export{w as O};