@arcgis/core 4.33.0-next.20250501 → 4.33.0-next.20250502

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 (114) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{de16b771d2c8d816c738.js → 05c80002c37002ac99e8.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{5d40c4783f58af1ae0dc.js → 0e8181e7fc1386d08ffc.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{96e5d192c8d23c1e324f.js → 13e68c43acc8916520db.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{e6a5911ea21bef32834b.js → 1bc22af4cc4effcbcf2b.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{9b2ab27159500315fbc1.js → 26850ec0917ee355ddb7.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{1bd4fe77ba6fb25322e7.js → 29e2b105f55adafc3a6d.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{5d63dfa5a60c88e03b28.js → 2c77a543a174e5bc736a.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d0ddf4f1c6a351b447c7.js → 30d7d2c7d6e9e5e2ecb9.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{febae745a29a17ca130a.js → 4480e4b61affb3b2e9d6.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{4d4a271351fd288277d2.js → 49085a0b3a74e158f32f.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{392e64a573f67817db02.js → 4cb199b547e5b97e65fb.js} +1 -1
  13. package/assets/esri/core/workers/chunks/4df36ee2406861c7afa8.js +1 -0
  14. package/assets/esri/core/workers/chunks/{ba917175ca2a6681501e.js → 563594357f3648652a5c.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{abfc5f9ac16c3e885c5f.js → 56db71ea7eb8a5652d98.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{e56647e61296643c5f84.js → 5719471414810b6a9aec.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{235efd948ae470a6f238.js → 60b1365d25581ccf0485.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{3795793643f4db64af0e.js → 63c25455b9cf1b3df76a.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{909be86782af3deb448e.js → 654fe135d41af81daa13.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{cd9343c78a7c3acdbbcd.js → 681b2662f6ce936afd7e.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{65f2b22d8fc12e6d4a87.js → 7000d9158da929a16071.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{7551011117c3d36ff3db.js → 743cdbff5c4616ddc2b4.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{968956284f44187f0622.js → 8540fb31bd0b29ff1906.js} +1 -1
  24. package/assets/esri/core/workers/chunks/8c5cea49e48f8858f115.js +1 -0
  25. package/assets/esri/core/workers/chunks/{237a965bd41ba8903e03.js → 921c040d0497031fd8ff.js} +1 -1
  26. package/assets/esri/core/workers/chunks/{96d2a0777f5c418055fb.js → 92b48e3365d1cc933113.js} +1 -1
  27. package/assets/esri/core/workers/chunks/{5d485c07848164099859.js → 95a4da3150ad8e8e36d8.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{46fb6ba8900286d18b6f.js → 9d564f79b82d427fc1da.js} +1 -1
  29. package/assets/esri/core/workers/chunks/{00612d6e05b1c8647668.js → 9fff43ffcd5602ccc50f.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{1cc5c566e68f2255d035.js → a6ca68ef6311ffc365b2.js} +1 -1
  31. package/assets/esri/core/workers/chunks/{5a51c75a2932d9da001a.js → a8d043b73e087bee7c40.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{ebfa4a0334401f5e004a.js → c12765e0c8b44e349c2a.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{afddb94ff4e1a70022c7.js → c3b2b05996e2008adbe3.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{4fb4884d2de42792abe3.js → d1a9e8db5ba403abe721.js} +1 -1
  35. package/assets/esri/core/workers/chunks/d35cd309ba7bb8968a22.js +1 -0
  36. package/assets/esri/core/workers/chunks/{6e6422eda398774acbc7.js → d60da671aba70485050e.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{7a8df1225abd54ff68ed.js → db298b292a4e43cba72d.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{2bda2cfc6e81818d7d33.js → dcaeb57c69d432118604.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{fb455fd89b74b70a6a2b.js → e613df03ceb39e29befa.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{05d7d8ff3e4cbad32580.js → e8dcaa7837b6fe7bff20.js} +1 -1
  41. package/assets/esri/core/workers/chunks/ec1a4b82cbc44ba45f83.js +1 -0
  42. package/assets/esri/core/workers/chunks/ec778cc7a55068f51937.js +1 -0
  43. package/assets/esri/core/workers/chunks/{51339193abddfe37745d.js → f2b63597ae956db74eb3.js} +1 -1
  44. package/chunks/Bufferer-CicaNej1.js +1 -1
  45. package/chunks/Distance2DCalculator-C1KHhZwD.js +1 -1
  46. package/chunks/Envelope.js +1 -1
  47. package/chunks/Envelope2D.js +1 -1
  48. package/chunks/GeodeticDistanceCalculator-CcF1gMZX.js +1 -1
  49. package/chunks/Geometry.js +1 -1
  50. package/chunks/GeometryCleaner-BEJM7I4l.js +1 -1
  51. package/chunks/OperatorClip.js +1 -1
  52. package/chunks/OperatorCrosses.js +1 -1
  53. package/chunks/OperatorCut.js +1 -1
  54. package/chunks/OperatorGeneralize.js +1 -1
  55. package/chunks/OperatorGeodesicBuffer.js +1 -1
  56. package/chunks/OperatorGeodeticArea.js +1 -1
  57. package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
  58. package/chunks/OperatorGeodeticDistance.js +1 -1
  59. package/chunks/OperatorGeodeticLength.js +1 -1
  60. package/chunks/OperatorIntersects.js +1 -1
  61. package/chunks/OperatorMultiPartToSinglePart.js +1 -1
  62. package/chunks/OperatorOverlaps.js +1 -1
  63. package/chunks/OperatorProximity.js +1 -1
  64. package/chunks/OperatorProximityGeodesic.js +1 -1
  65. package/chunks/OperatorShapePreservingLength.js +1 -1
  66. package/chunks/OperatorShapePreservingProject.js +1 -1
  67. package/chunks/OperatorSimplifyOGC.js +1 -1
  68. package/chunks/OperatorTouches.js +1 -1
  69. package/chunks/OperatorWithin.js +1 -1
  70. package/chunks/Point2D.js +1 -1
  71. package/chunks/ProjectionTransformation.js +1 -1
  72. package/chunks/QuadraticBezier.js +1 -1
  73. package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
  74. package/chunks/Transformation2D.js +1 -1
  75. package/chunks/containsOperator.js +1 -1
  76. package/chunks/disjointOperator.js +1 -1
  77. package/chunks/equalsOperator.js +1 -1
  78. package/geometry/operators/extendOperator.js +1 -1
  79. package/geometry/operators/gx/operatorAlphaShape.js +1 -1
  80. package/geometry/operators/gx/operatorAutoComplete.js +1 -1
  81. package/geometry/operators/gx/operatorBuffer.js +1 -1
  82. package/geometry/operators/gx/operatorDifference.js +1 -1
  83. package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
  84. package/geometry/operators/gx/operatorIntegrate.js +1 -1
  85. package/geometry/operators/gx/operatorIntersection.js +1 -1
  86. package/geometry/operators/gx/operatorLabelPoint.js +1 -1
  87. package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
  88. package/geometry/operators/gx/operatorLocateBetween.js +1 -1
  89. package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
  90. package/geometry/operators/gx/operatorOffset.js +1 -1
  91. package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
  92. package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
  93. package/geometry/operators/gx/operatorSimplify.js +1 -1
  94. package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
  95. package/geometry/operators/gx/operatorUnion.js +1 -1
  96. package/geometry/operators/isNearOperator.js +1 -1
  97. package/geometry/operators/json/containsOperator.js +1 -1
  98. package/geometry/operators/json/disjointOperator.js +1 -1
  99. package/geometry/operators/reshapeOperator.js +1 -1
  100. package/geometry/operators/support/apiConverter.js +1 -1
  101. package/geometry/operators/support/initNoPeFactory.js +1 -1
  102. package/geometry/operators/support/jsonConverter.js +1 -1
  103. package/interfaces.d.ts +31 -0
  104. package/package.json +1 -1
  105. package/support/revision.js +1 -1
  106. package/views/2d/engine/webgl/shaderGraph/techniques/mesh/utils.js +1 -1
  107. package/widgets/Directions/css.js +5 -0
  108. package/widgets/Directions.js +1 -1
  109. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  110. package/assets/esri/core/workers/chunks/11b55e7e76e50fe11bbe.js +0 -1
  111. package/assets/esri/core/workers/chunks/7bfa18dd8771d4932533.js +0 -1
  112. package/assets/esri/core/workers/chunks/84d7ed2cf5fe23a0888f.js +0 -1
  113. package/assets/esri/core/workers/chunks/86931186095c23e47c0c.js +0 -1
  114. package/assets/esri/core/workers/chunks/a79511b926a2830bb160.js +0 -1
@@ -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{c as e,t,g as n,q as r,p as i,G as s,b as a}from"../../../chunks/Geometry.js";import{ao as o,i as u,P as m,d as l,a as c,ap as d,m as _}from"../../../chunks/Point2D.js";import{aA as h,b as f,aB as p,aC as k,c as b,B as y,aD as N,aE as T,aF as g}from"../../../chunks/ProjectionTransformation.js";import{F as v,I as x,P as A,E as S,z as w,D as C,J as D,K as F,t as j}from"../../../chunks/Envelope.js";import{C as z,w as O,a as I,P as E,S as B,M as P,x as V,y as M,z as R,A as U}from"../../../chunks/QuadraticBezier.js";import"./initNoPeFactory.js";function W(){if(-1===this.m_i)return this.m_i=0,{value:{m_token:1,m_value:null},done:!1};if(this.m_i<this.m_keys.length){const e=this.m_bReturnKey,t=Math.trunc(this.m_i);return this.m_bReturnKey=!this.m_bReturnKey,this.m_i+=.5,e?{value:{m_token:5,m_value:this.m_keys[t]},done:!1}:{value:{m_token:6,m_value:this.m_o[this.m_keys[t]]},done:!1}}return{value:{m_token:3,m_value:null},done:!0}}function X(){if(-1===this.m_i)return this.m_i=0,{value:{m_token:2,m_value:null},done:!1};if(this.m_i<this.m_a.length){const e={value:{m_token:6,m_value:this.m_a[this.m_i++]},done:!1};return this.m_strict||void 0===e.value.m_value&&(e.value.m_value=Number.NaN),e}return{value:{m_token:4,m_value:null},done:!0}}class L{createJSONObjectIterator(e){return{m_iteratorType:"object",m_o:e,m_keys:this.m_options.strict?Object.keys(e):Object.keys(e).filter((t=>void 0!==e[t])),m_i:-1,m_bReturnKey:!0,next:W}}createJSONArrayIterator(e){return{m_iteratorType:"array",m_strict:this.m_options.strict,m_i:-1,m_a:e,next:X}}constructor(e,t){this.m_currentToken=0,this.m_options=t?{...t}:{strict:!0};const n=e;this.m_iteratorStack=[n instanceof Array?this.createJSONArrayIterator(n):this.createJSONObjectIterator(n)],this.m_nextFlatToken={m_value:null,m_token:0}}nextToken(){if(0===this.m_iteratorStack.length)return this.m_currentToken=0;switch(this.m_nextFlatToken=this.m_iteratorStack.at(-1).next().value,this.m_currentValue=void 0,this.m_nextFlatToken.m_token){case 1:return this.m_currentToken=1;case 3:return this.m_iteratorStack.pop(),this.m_currentToken=3;case 2:return this.m_currentToken=2;case 4:return this.m_iteratorStack.pop(),this.m_currentToken=4;case 5:return this.m_currentValue=this.m_nextFlatToken.m_value,this.m_currentToken=5;case 6:if(this.m_nextFlatToken.m_value instanceof Array)return this.m_iteratorStack.push(this.createJSONArrayIterator(this.m_nextFlatToken.m_value)),this.nextToken();if(this.m_nextFlatToken.m_value instanceof Object)return this.m_iteratorStack.push(this.createJSONObjectIterator(this.m_nextFlatToken.m_value)),this.nextToken();if("number"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=this.m_nextFlatToken.m_value,Number.isSafeInteger(this.m_currentValue)&&this.m_currentValue>=o()&&this.m_currentValue<=u()?this.m_currentToken=8:this.m_currentToken=7;if("string"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=this.m_nextFlatToken.m_value,this.m_currentToken=6;if("boolean"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=this.m_nextFlatToken.m_value,this.m_currentToken=this.m_nextFlatToken.m_value?11:12;if("object"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=null,this.m_currentToken=10;e("unrecognized json element type")}return e("unrecognized json element type"),0}currentToken(){return this.m_currentToken}skipChildren(){if(0!==this.m_iteratorStack.length)switch(this.m_currentValue=void 0,this.m_nextFlatToken.m_token){case 1:return this.m_iteratorStack.pop(),this.m_nextFlatToken.m_token=3,void(this.m_currentToken=3);case 2:return this.m_iteratorStack.pop(),this.m_nextFlatToken.m_token=4,void(this.m_currentToken=4)}}currentString(){return 6!==this.m_currentToken&&5!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentDoubleValue(){return 7!==this.m_currentToken&&8!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentInt32Value(){return 8!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentInt64Value(){return n(0),0n}currentBoolValue(){return 12!==this.m_currentToken&&11!==this.m_currentToken&&t("invalid token"),this.m_currentValue}isError(){return 0}}class Y{constructor(){this.m_pendingKey=null,this.m_acceptedObject=null,this.m_currentObject=[]}reset(){this.m_pendingKey=null,this.m_acceptedObject=null,this.m_currentObject.length=0}startObject(){const e={};this.m_pendingKey?(this.m_currentObject.at(-1)[this.m_pendingKey]=e,this.m_pendingKey=null):Array.isArray(this.m_currentObject.at(-1))&&this.m_currentObject.at(-1).push(e),this.m_currentObject.push(e)}startArray(){const e=[];this.m_pendingKey?(this.m_currentObject.at(-1)[this.m_pendingKey]=e,this.m_pendingKey=null):Array.isArray(this.m_currentObject.at(-1))&&this.m_currentObject.at(-1).push(e),this.m_currentObject.push(e)}endObject(){this.m_acceptedObject=this.m_currentObject.at(-1),this.m_currentObject.pop()}endArray(){this.m_currentObject.pop()}addFieldName(e){this.m_pendingKey=e}addValue_(e){this.m_pendingKey?(this.m_currentObject.at(-1)[this.m_pendingKey]=e,this.m_pendingKey=null):this.m_currentObject.at(-1).push(e)}addString(e){this.addValue_(e)}addDouble(e,t){this.addValue_(e)}addInt64(e){n(0)}addInt32(e){this.addValue_(e)}addBool(e){this.addValue_(e)}addNull(){this.addValue_(null)}getObject(){return this.m_acceptedObject}}class G{constructor(t){return this.m_buffer=null,this.m_view=null,this.m_sz=0,this.m_offset=0,this.m_bOwnsBuffer=!0,this.m_bLittleEndian=!0,this.m_element=new ArrayBuffer(8),this.m_elementBytes=new Uint8Array(this.m_element),this.m_elementView=new DataView(this.m_element),this.m_elementDouble=new Float64Array(this.m_element),this.m_elementFloat=new Float32Array(this.m_element),this.m_elementInt64=new BigInt64Array(this.m_element),this.m_elementInt32=new Int32Array(this.m_element),this.m_elementInt16=new Int16Array(this.m_element),void 0!==t.sz?(this.m_sz=t.sz,t.buffer?(this.m_sz<0&&r("size out of range"),this.m_buffer=t.buffer,this.m_offset=void 0!==t.offset?t.offset:0,this.m_view=void 0!==t.offset?new DataView(t.buffer,t.offset,t.sz):new DataView(this.m_buffer),this.m_bOwnsBuffer=!1,void(this.m_bLittleEndian=!0)):(this.m_sz<0&&r("size out of range"),void(this.m_sz>0&&(this.m_buffer=new ArrayBuffer(this.m_sz),this.m_view=new DataView(this.m_buffer))))):t.move?(this.m_sz=t.move.m_sz,this.m_buffer=t.move.m_buffer,this.m_view=t.move.m_view,this.m_bOwnsBuffer=t.move.m_bOwnsBuffer,this.m_bLittleEndian=t.move.m_bLittleEndian,t.move.m_buffer=null,t.move.m_view=null,t.move.m_sz=0,void(t.move.m_bOwnsBuffer=!0)):void e("unrecognized constructor options")}swapBytesDouble(){this.doSwap()&&(this.m_elementDouble[0]=this.m_elementBytes[0]<<56|this.m_elementBytes[1]<<48|this.m_elementBytes[2]<<40|this.m_elementBytes[3]<<32|this.m_elementBytes[4]<<24|this.m_elementBytes[5]<<16|this.m_elementBytes[6]<<8|this.m_elementBytes[7])}swapBytesInt32(){this.doSwap()&&(this.m_elementInt32[0]=this.m_elementBytes[0]<<24|this.m_elementBytes[1]<<16|this.m_elementBytes[2]<<8|this.m_elementBytes[3])}getOffset(){return this.m_offset}assignMove(e){return this===e||(this.clear(),this.m_sz=e.m_sz,this.m_buffer=e.m_buffer,this.m_view=e.m_view,this.m_bOwnsBuffer=e.m_bOwnsBuffer,this.m_bLittleEndian=e.m_bLittleEndian,e.m_buffer=null,e.m_sz=0,e.m_bOwnsBuffer=!0),this}doSwap(){return this.m_bLittleEndian!==(1===G.getNativeByteOrder())}setNativeByteOrder(){this.m_bLittleEndian=1===G.getNativeByteOrder()}setOrder(e){this.m_bLittleEndian=1===e}getOrder(){return this.m_bLittleEndian?1:0}getView(){return this.m_view||i("buffer not defined"),this.m_view}static getNativeByteOrder(){return 1}clear(){this.m_buffer=null,this.m_sz=0,this.m_bOwnsBuffer=!0}size(){return this.m_sz}readDouble(e){return this.doSwap()?(this.m_elementDouble[0]=this.m_view.getFloat64(e,this.m_bLittleEndian),this.swapBytesDouble(),this.m_elementDouble[0]):this.m_view.getFloat64(e,this.m_bLittleEndian)}writeDouble(e,t){this.m_elementDouble[0]=t,this.swapBytesDouble(),this.m_view.setFloat64(e,this.m_elementDouble[0],this.m_bLittleEndian)}readInt32(e){return this.doSwap()?(this.m_elementInt32[0]=this.m_view.getInt32(e,this.m_bLittleEndian),this.swapBytesInt32(),this.m_elementInt32[0]):this.m_view.getInt32(e,this.m_bLittleEndian)}writeInt32(e,t){this.m_elementInt32[0]=t,this.swapBytesInt32(),this.m_view.setInt32(e,this.m_elementInt32[0],this.m_bLittleEndian)}getPtr(){return this.m_buffer}setSizeNoRealloc(e){n(e>=0&&e<=this.m_sz),this.m_sz=e}}function K(e,r,i,a,o,u){let m=!1,l=!1,c=!1,d=!1,_=!1,h=!1,f=!1,p=!1,k=!1,b=!1,y=!1,N=!1,T=!1,g=!1,w=!1,C=!1,D=!1,F=!1,j=!1,z=!1,O=!1,I=!1,E=!1,B=!1,P=Number.NaN,V=Number.NaN,M=Number.NaN,R=Number.NaN,U=0,W=Number.NaN,X=Number.NaN,L=Number.NaN,Y=Number.NaN,G=Number.NaN,K=Number.NaN,q=Number.NaN,ne=Number.NaN,re=0,ie=0,se=!1,ae=!1,oe=null,ue=null,me=null,le=null,ce=null;for(;3!==i.nextToken();){const u=i.currentString();if(i.nextToken(),"spatialReference"===u){if(o&&!m){m=!0,1===i.currentToken()?le=Q(i):10!==i.currentToken()&&t("failed to parse spatial reference: object or null is expected");continue}}else if(a)if("hasZ"===u){if(!l){l=!0,se=11===i.currentToken();continue}}else if("hasM"===u){if(!c){c=!0,ae=11===i.currentToken();continue}}else if("rings"===u){if(!(_||h||e!==s.enumUnknown&&e!==s.enumPolygon)){_=!0,({geometry:ce,as:oe,bs:ue}=J(!0,!1,r,i));continue}}else if("curveRings"===u){if(!h&&(e===s.enumUnknown||e===s.enumPolygon)){h=!0,({geometry:ce,as:oe,bs:ue}=J(!0,!0,r,i));continue}}else if("paths"===u){if(!(f||p||e!==s.enumUnknown&&e!==s.enumPolyline)){f=!0,({geometry:ce,as:oe,bs:ue}=J(!1,!1,r,i));continue}}else if("curvePaths"===u){if(!p&&(e===s.enumUnknown||e===s.enumPolyline)){p=!0,({geometry:ce,as:oe,bs:ue}=J(!1,!0,r,i));continue}}else if("points"===u){if(!k&&(e===s.enumUnknown||e===s.enumMultiPoint)){k=!0,({geometry:ce,as:oe,bs:ue}=Z(r,i));continue}}else if("ids"===u){if(!d){d=!0,me=H(r,i);continue}}else if("x"===u){if(!b&&(e===s.enumUnknown||e===s.enumPoint)){b=!0,P=$(i);continue}}else if("y"===u){if(!y&&(e===s.enumUnknown||e===s.enumPoint)){y=!0,V=$(i);continue}}else if("z"===u){if(!N&&(e===s.enumUnknown||e===s.enumPoint)){N=!0,M=$(i);continue}}else if("m"===u){if(!T&&(e===s.enumUnknown||e===s.enumPoint)){T=!0,R=$(i);continue}}else if("id"===u){if(!g&&(e===s.enumUnknown||e===s.enumPoint)){g=!0,U=ee(i);continue}}else if("xmin"===u){if(!w&&(e===s.enumUnknown||e===s.enumEnvelope)){w=!0,W=$(i);continue}}else if("ymin"===u){if(!C&&(e===s.enumUnknown||e===s.enumEnvelope)){C=!0,X=$(i);continue}}else if("mmin"===u){if(!O&&(e===s.enumUnknown||e===s.enumEnvelope)){O=!0,q=$(i);continue}}else if("zmin"===u){if(!j&&(e===s.enumUnknown||e===s.enumEnvelope)){j=!0,G=$(i);continue}}else if("idmin"===u){if(!E&&(e===s.enumUnknown||e===s.enumEnvelope)){E=!0,re=ee(i);continue}}else if("xmax"===u){if(!D&&(e===s.enumUnknown||e===s.enumEnvelope)){D=!0,L=$(i);continue}}else if("ymax"===u){if(!F&&(e===s.enumUnknown||e===s.enumEnvelope)){F=!0,Y=$(i);continue}}else if("mmax"===u){if(!I&&(e===s.enumUnknown||e===s.enumEnvelope)){I=!0,ne=$(i);continue}}else if("zmax"===u){if(!z&&(e===s.enumUnknown||e===s.enumEnvelope)){z=!0,K=$(i);continue}}else if("idmax"===u){if(!B&&(e===s.enumUnknown||e===s.enumEnvelope)){B=!0,ie=ee(i);continue}}else"materials"===u&&n(0);i.skipChildren()}if(_||h||f||p||k){let e=null,t=null;const n=ce;se&&(ce.addAttribute(1),e=oe,e||(e=v(n.getPointCount(),Number.NaN))),ae&&(ce.addAttribute(2),t=se?ue:oe),null!=me&&ce.addAttribute(3),se&&null!=e&&n.setAttributeStreamRef(1,e),ae&&null!=t&&n.setAttributeStreamRef(2,t),null!=me&&te(n,me)}else if(b||y||T||N||g){x(P,V)||t("failed to parse point: x and y must be finite or nan"),(Number.isNaN(V)||Number.isNaN(P))&&(P=Number.NaN,V=Number.NaN);const e=new A({x:P,y:V});N&&e.setZ(M),T&&e.setM(R),g&&e.setID(U),ce=e}else if(w||C||D||F||j||z||O||I||E||B){(Number.isNaN(X)||Number.isNaN(L)||Number.isNaN(Y))&&(W=Number.NaN);const e=new S({xmin:W,ymin:X,xmax:L,ymax:Y});j&&z&&e.setInterval(1,0,G,K),O&&I&&e.setInterval(2,0,q,ne),E&&B&&e.setInterval(3,0,re,ie),ce=e}return{...ce?{geom:ce}:{},...le?{sr:le}:{}}}function q(e){let t=!1;for(;3!==e.nextToken();){const n=e.currentString();e.nextToken(),"uwkid"===n?t||(t=!0,8===e.currentToken()&&e.currentInt32Value()):e.skipChildren()}return null}function Q(e){let t=!1,n=!1,r=!1,i=!1,s=!1,a=!1,o=!1,u=!1,m=!1,l=!1,c=!1,d=!1,_=!1,g=!1,v=!1,x=!1,A=!1,S=-1,w=-1,C=-1,D=-1,F=0,j=0,z=0,O=0,I=0,E=0,B=0,P=0,V=0,M=0,R="",U="",W=null;for(;3!==e.nextToken();){const h=e.currentString();e.nextToken(),"wkid"===h?t||(t=!0,8===e.currentToken()&&(S=e.currentInt32Value())):"latestWkid"===h?n||(n=!0,8===e.currentToken()&&(w=e.currentInt32Value())):"wkt"===h?s||(s=!0,6===e.currentToken()&&(R=e.currentString())):"wkt2"===h?s||6===e.currentToken()&&(U=e.currentString()):"vcsWkid"===h?r||(r=!0,8===e.currentToken()&&(C=e.currentInt32Value())):"latestVcsWkid"===h?i||(i=!0,8===e.currentToken()&&(D=e.currentInt32Value())):"xyTolerance"===h?o||(o=!0,a=!0,F=e.currentDoubleValue()):"zTolerance"===h?u||(u=!0,a=!0,j=e.currentDoubleValue()):"mTolerance"===h?m||(m=!0,a=!0,z=e.currentDoubleValue()):"falseX"===h?l||(l=!0,a=!0,B=e.currentDoubleValue()):"falseY"===h?c||(c=!0,a=!0,P=e.currentDoubleValue()):"falseZ"===h?d||(d=!0,a=!0,V=e.currentDoubleValue()):"falseM"===h?_||(_=!0,a=!0,M=e.currentDoubleValue()):"xyUnits"===h?g||(g=!0,a=!0,O=e.currentDoubleValue()):"zUnits"===h?v||(v=!0,a=!0,I=e.currentDoubleValue()):"mUnits"===h?x||(x=!0,a=!0,E=e.currentDoubleValue()):"unit"===h?A||(A=!0,W=q(e)):e.skipChildren()}D<=0&&C>0&&(D=C),C<=0&&D>0&&(C=D);let X=null,L=!0;if(0!==R.length&&(L=!1,h(R)&&(X=f(R))),X||0===U.length||(L=!1,h(U)&&(X=f(U))),!X&&w>0&&(L=!1,p(w)&&(D<=0||k())&&(X=b(w,D))),!X&&S>0&&(L=!1,p(S)&&(C<=0||k())&&(X=b(S,C))),L&&(X=y(W)),a&&X){const e=new T;X.queryPrecisionDescriptorWithoutFalseXY(e),o&&e.setTolerance(0,F),u&&e.setTolerance(1,j),m&&e.setTolerance(2,z),g&&l&&c&&e.setGridParams(B,P,O),v&&d&&e.setZParams(V,I),x&&_&&e.setMParams(M,E),X=N(X,e)}return X}function J(e,n,r,i){2!==i.currentToken()&&t("failed to parse multipath: array of array of vertices is expected");const s=e?new I:new E,a=s,o=w(0),u=v(2,0),_=C(0);let h=null,f=null,p=null,k=null,b=null,y=0,N=0,T=0;const g=new B,x=m.getNAN();let A=0,S=0;const F=e?1:0;for(;4!==i.nextToken();){2!==i.currentToken()&&t("failed to parse multipath: ring/path array is expected");let r=2,s=0,j=!0;const z=4;let O=0,I=0;const E=m.getNAN(),B=l(z,Number.NaN),P=l(z,Number.NaN);let V=!1;for(i.nextToken();4!==i.currentToken();){if(n&&1===i.currentToken())j&&t("failed to parse multipath: starting vertex array is expected"),p||(p=C(A-1,1),k=w(A-1,-1),b=v(0)),V=!0,r=1,({segFlag:T,toPointSz:O}=ue(g,B,x,i));else{for(V=!1,2!==i.currentToken()&&t("failed to parse multipath: array is expected, rings/paths vertices consist of arrays of coordinates"),O=0;4!==i.nextToken();)O===z&&t("failed to parse multipath: each vertex array has to have at most 4 elements"),B[O++]=$(i);O<2&&t("failed to parse multipath: each vertex array has to have at least 2 elements"),D(B[0],B[1])||t("failed to parse multipath: x and y must be finite")}i.nextToken();do{if(u.size()===2*A&&u.resize(ne(A)),u.writePoint2D(2*A,E.setCoords(B[0],B[1])),h&&h.size()===A&&h.resize(re(A)),O>2?(h||(h=v(A+1,Number.NaN)),h.write(A,B[2])):h&&h.write(A,Number.NaN),f&&f.size()===A&&f.resize(re(A)),O>3?(f||(f=v(A+1,Number.NaN)),f.write(A,B[3])):f&&f.write(A,Number.NaN),j)S++,o.add(A),_.add(F),j=!1,I=O,c(P,B,0,0,I);else if(null!==p)if(V){const e=U(T),t=b.size();b.resize(t+e),p.add(T),k.add(y),g.get().writeInBufferStream(b,y),y+=e,a.incCurveType(T,1),N++}else p.add(1),k.add(-1);A++,s++,x.setCoords(B[0],B[1])}while(s<r&&4===i.currentToken())}0!==s&&(e&&s>r&&O===I&&0===d(B,P,O)?(A--,s--):null!==p&&(p.add(1),k.add(-1)))}return A&&(o.resize(S),_.resize(S),A>0&&(o.add(A),_.add(0)),a.setAttributeStreamRef(0,u),a.setPathFlagsStreamRef(_),a.setPathStreamRef(o),null!==p&&(a.updateCurveCounter(N),a.setSegmentData(k,b,p,y)),a.notifyModifiedFlags(65535)),{geometry:s,as:h,bs:f}}function Z(e,n){2!==n.currentToken()&&t("failed to parse multipoint: array of vertices is expected");let r=0;const i=new P,s=v(2,0);let a=0;const o=4,u=l(o,Number.NaN),c=new m;let d=null,_=null;for(;4!==n.nextToken();){for(2!==n.currentToken()&&t("failed to parse multipoint: array is expected, multipoint vertices consist of arrays of cooridinates"),a=0;4!==n.nextToken();)a===o&&t("failed to parse multipoint: each vertex array has to have at most 4 elements"),u[a++]=$(n);a<2&&t("failed to parse multipoint: each vertex array has to have at least 2 elements"),D(u[0],u[1])||t("failed to parse multipoint: x and y must be finite"),s.size()===2*r&&s.resize(ne(r)),s.writePoint2D(2*r,c.setCoords(u[0],u[1])),d&&d.size()===r&&d.resize(re(r)),a>2?(d||(d=v(r+1,Number.NaN)),d.write(r,u[2])):d&&d.write(r,Number.NaN),_&&_.size()===r&&_.resize(re(r)),a>3?(_||(_=v(r+1,Number.NaN)),_.write(r,u[3])):_&&_.write(r,Number.NaN),r++}if(r){const e=i.getImpl();e.setAttributeStreamRef(0,s),e.resizeNoInit(r),e.notifyModifiedFlags(65535)}return{geometry:i,as:d,bs:_}}function H(e,n){2!==n.currentToken()&&t("failed to parse array of IDs: array of array of integers is expected");const r=F(2,0);let i=0,s=-1;for(;4!==n.nextToken();){const e=i;r.size()===i&&r.resize(re(i)),i++;let a=0;for(-1===s?s=2===n.currentToken()?1:0:1===s&&2!==n.currentToken()&&t("failed to parse array of IDs: array of array of integers is expected"),0===s&&(r.size()===i&&r.resize(re(i)),r.write(i,ee(n)),a++,i++);4!==n.nextToken();)r.size()===i&&r.resize(re(i)),r.write(i,ee(n)),a++,i++;if(r.write(e,a),0===s)break}return r.resize(i),r}function $(e){const t=e.currentToken();if(10===t||6===t&&"NaN"===e.currentString())return Number.NaN;{const t=e.currentDoubleValue();return Number.isNaN(t)?Number.NaN:t}}function ee(e){return e.currentInt32Value()}function te(t,n){if(t.isEmpty())return;const r=F(2,0),i=t.getGeometryType();let s=0;i===P.type?s=1:i===E.type||i===I.type?s=t.getPathCount():e("not implemented"),r.resize(t.getPointCount(),0);let a=0;for(let o=0;o<s;++o){const s=n.read(a);a++;const u=a+s;let m=0,l=0;i===P.type?m=t.getPointCount():i===E.type||i===I.type?(m=t.getPathSize(o),l=t.getPathStart(o)):e("not implemented");for(let e=0,t=Math.min(s,m);e<t;++e)r.write(l,n.read(a)),a++,l++;a=u}t.getImpl().setAttributeStreamRef(3,r)}function ne(e){let t=2*Math.trunc(3*(e+1)/2);return t<8?t=8:t<32&&(t=32),t}function re(e){let t=Math.trunc(3*(e+1)/2);return t<4?t=4:t<16&&(t=16),t}function ie(e,t,n,i,s){s>=i.size()&&r("Byte_buffer out of range access"),e.m_bits=0,e.m_rotation=0,e.m_cosr=1,e.m_sinr=0,e.setStartXY(t),e.setEndXY(n);const a=m.getNAN();a.x=i.readDouble(s),a.y=i.readDouble(s+8);const o=i.readInt32(s+16);if(!!(1&o))return e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.assign(a),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,V(e),!1;let u=!!(64&o);const l=!!(128&o);let c=!!(32&o);const d=!!(8&o),_=!!(16&o),h=t.equals(n);return u&&!h&&(u=!1,c=!0),c&&h&&(u=!0,c=!1,a.setCoords(0,0)),u||(l?c?(e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_interior.assign(a),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0):(e.constructCircularArcThreePoint(t,n,a),h&&d===e.isClockwise()&&e.reverse()):c?(e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,V(e),e.queryCoord2D(.5,e.m_interior)):M(e,t,n,a,d,_)),u&&(e.m_center.assign(t),e.m_startAngle=a.x,e.m_sweepAngle=a.y,R(e,Number.NaN,d,_),e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.setCoordsPoint2D(t)),e.setProjectionBehavior(0),V(e),!0}function se(e,t,n,r,i){e.m_bits=0,e.m_center.x=r.readDouble(i),e.m_center.y=r.readDouble(i+8),e.m_rotation=r.readDouble(i+16),e.m_semiMajorAxis=r.readDouble(i+24),e.m_minorMajorRatio=r.readDouble(i+32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y;const s=r.readInt32(i+40);if(1&s)return!1;let a=!!(64&s),o=!!(128&s);const u=!!(2048&s),m=!!(4096&s);return!!!(512&s)&&!!!(1024&s)||o||(a=!0),o&&!t.equals(n)?(o=!1,a=!0):a&&t.equals(n)&&(o=!0,a=!1),o?(e.m_center.assign(t),e.m_startAngle=e.m_center.x,e.m_sweepAngle=e.m_center.y,R(e,Number.NaN,u,m),e.m_semiMajorAxis=0,e.m_interior.setCoordsPoint2D(t)):a?(e.m_center.setNAN(),e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,V(e),e.queryCoord2D(.5,e.m_interior)):e.constructEllipticArcEndPointsCenter(t,n,e.m_semiMajorAxis,e.m_minorMajorRatio,e.m_rotation,!m,u,e.m_center),e.setProjectionBehavior(1),V(e),!0}function ae(e,t,r,i,s){return n(s+32<=i.size()),e.m_cp=_(m,2),e.m_cp[0].x=i.readDouble(s),e.m_cp[0].y=i.readDouble(s+8),e.m_cp[1].x=i.readDouble(s+16),e.m_cp[1].y=i.readDouble(s+24),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=r.x,e.m_YEnd=r.y,!0}function oe(e,t,n,r,i){return e.m_cp.x=r.readDouble(i),e.m_cp.y=r.readDouble(i+8),e.m_weights[0]=r.readDouble(i+16),e.m_weights[1]=r.readDouble(i+24),e.m_weights[2]=r.readDouble(i+32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y,!0}function ue(e,n,r,i,s){const a={segFlag:0,toPointSz:0};let o=i.currentToken();o=i.nextToken();const u=i.currentString(),l=u[0];for((1!==u.length||"a"!==l&&"b"!==l&&"c"!==l&&"n"!==l&&"q"!==l)&&t('failed to parse curve: expecting "a", "b", "n", "q", or "c"'),o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for curve parameters"),o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for to point"),a.toPointSz=0;4!==i.nextToken();)4===a.toPointSz&&t("failed to parse curve: vertex array cannot have more than 4 elements"),n[a.toPointSz++]=$(i);a.toPointSz<2&&t("failed to parse curve: vertex array must have at least 2 elements");const c=m.construct(n[0],n[1]),d=m.getNAN();let _=-1,h=-1,f=!1,p=Number.NaN,k=Number.NaN,b=Number.NaN;const y=[m.getNAN(),m.getNAN(),m.getNAN()],N=m.getNAN();if("a"===l){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for center point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for center point"),d.setCoords(e,n),o=i.nextToken(),_=i.currentInt32Value(),o=i.nextToken(),h=i.currentInt32Value(),o=i.nextToken(),4!==o?(f=!1,p=$(i),o=i.nextToken(),k=$(i),o=i.nextToken(),b=$(i),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters")):f=!0,a.segFlag=4}else if("b"===l){for(let e=0;e<2;e++){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[e].setCoords(n,r)}o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=2}else if("n"===l){{o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[0].setCoords(e,n)}o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);y[1].setCoords(e,n),y[2].setCoords(r,r),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=8}else if("q"===l){for(let e=0;e<1;e++){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[e].setCoords(n,r)}o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=16}else{o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for interior point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for interior point"),N.setCoords(e,n),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=4}if(o=i.nextToken(),3!==o&&t("failed to parse curve: end object is expected for curve"),"a"===l)if(e.createEllipticArc(),f){const t=!0;me(e.get(),r,c,d,t,_,h)}else le(e.get(),r,c,d,_,h,p,k,b);else if("b"===l)e.createCubicBezier(),ce(e.get(),r,c,y);else if("n"===l)e.createQuadraticRationalBezier(),de(e.get(),r,c,y[0],y[1].x,y[1].y,y[2].x);else if("q"===l)e.createQuadraticBezier(),e.get().construct(r,y[0],c);else{e.createEllipticArc();const t=!1;me(e.get(),r,c,N,t,-1,-1)}return a}function me(e,t,n,r,i,s,a){e.dropAllAttributes();const o=20,u=new ArrayBuffer(o),m=new G({sz:o,buffer:u});let l=0;m.writeDouble(l,r.x),l+=8,m.writeDouble(l,r.y),l+=8;let c=0;i?(a||(c|=8),s&&(c|=16)):c|=128,m.writeInt32(l,c),l+=4,ie(e,t,n,m,0)}function le(e,t,n,r,i,s,a,o,u){e.dropAllAttributes();const m=44,l=new ArrayBuffer(m),c=new G({sz:m,buffer:l});let d=0;c.writeDouble(d,r.x),d+=8,c.writeDouble(d,r.y),d+=8,c.writeDouble(d,a),d+=8,c.writeDouble(d,o),d+=8,c.writeDouble(d,u),d+=8;let _=0;s||(_|=2048),i&&(_|=4096),c.writeInt32(d,_),d+=4,se(e,t,n,c,0)}function ce(e,t,n,r){e.dropAllAttributes();const i=32,s=new ArrayBuffer(i),a=new G({sz:i,buffer:s});let o=0;a.writeDouble(o,r[0].x),o+=8,a.writeDouble(o,r[0].y),o+=8,a.writeDouble(o,r[1].x),o+=8,a.writeDouble(o,r[1].y),o+=8,ae(e,t,n,a,0)}function de(e,t,n,r,i,s,a){e.dropAllAttributes();const o=40,u=new ArrayBuffer(o),m=new G({sz:o,buffer:u});let l=0;m.writeDouble(l,r.x),l+=8,m.writeDouble(l,r.y),l+=8,m.writeDouble(l,i),l+=8,m.writeDouble(l,s),l+=8,m.writeDouble(l,a),l+=8,oe(e,t,n,m,0)}function _e(e,t,n,r,i){const o=e.getGeometryType();if(o===s.enumEllipticArc)return he(e,t,n,r,i);if(o===s.enumBezier)return fe(e,t,n,r,i);if(o===s.enumRationalBezier2)return pe(e,t,n,r,i);if(o===s.enumBezier2){const s=new z;return s.constructFromQuadraticSegment(e),fe(s,t,n,r,i)}a("")}function he(e,t,r,i,s){n(!O(e));const a=e.getEndXY(),o=e.hasAttribute(1)&&!t,u=e.hasAttribute(2)&&!r;let m=Number.NaN,l=Number.NaN;if(o&&(m=e.getEndAttributeAsDbl(1,0)),u&&(l=e.getEndAttributeAsDbl(2,0)),e.isDegenerateToLine()||e.isDegenerate(0))return ke(o,u,a.x,a.y,m,l,i,s),!0;const c=0===e.projectionBehavior(),d=!!c&&e.isClosed();if(c&&!d)s.startObject(),s.addFieldName("c"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s),be(e.m_interior.x,e.m_interior.y,17,s),s.endArray(),s.endObject();else if(c){s.startObject(),s.addFieldName("a"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s);const t=0,n=0;be(e.m_center.x+t,e.m_center.y+n,17,s);const r=!e.isMajor();s.addInt32(r?1:0);const c=e.isClockwise();s.addInt32(c?1:0),s.endArray(),s.endObject()}else{s.startObject(),s.addFieldName("a"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s);const t=e;be(t.m_center.x,t.m_center.y,17,s);const n=!t.isMajor();s.addInt32(n?1:0);const r=t.isClockwise();s.addInt32(r?1:0),s.addDouble(t.m_rotation,17),s.addDouble(t.m_semiMajorAxis,17),s.addDouble(t.m_minorMajorRatio,17),s.endArray(),s.endObject()}return!1}function fe(e,t,n,r,i){const s=e.getEndXY(),a=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;return a&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("b"),i.startArray(),ke(a,o,s.x,s.y,u,m,r,i),be(e.m_cp[0].x,e.m_cp[0].y,r,i),be(e.m_cp[1].x,e.m_cp[1].y,r,i),i.endArray(),i.endObject(),!1}function pe(e,t,n,r,i){const s=e.getEndXY(),a=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;a&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("n"),i.startArray(),ke(a,o,s.x,s.y,u,m,r,i),be(e.m_cp.x,e.m_cp.y,r,i);const l=r;return i.addDouble(e.m_weights[0],l),i.addDouble(e.m_weights[1],l),i.addDouble(e.m_weights[2],l),i.endArray(),i.endObject(),!1}function ke(e,t,n,r,i,s,a,o){o.startArray(),o.addDouble(n,a),o.addDouble(r,a),e&&o.addDouble(i,a),t&&o.addDouble(s,a),o.endArray()}function be(e,t,n,r){r.startArray(),r.addDouble(e,n),r.addDouble(t,n),r.endArray()}class ye{getOperatorType(){return 10405}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,t,n,r,i,s){Ne(e,t,n,r)}exportSpatialReference(e,t,r,i){n(0)}exportProjectionTransformation(e,t,r,i){n(0)}exportDatumTransformation(e,t,r,i){n(0)}static geometryTypeToString(e){return n(0),""}}function Ne(t,r,i,a,o){if(r||i){if(a.startObject(),null!==r){switch(r.getGeometryType()){case s.enumPolygon:Te(!0,t,r,a);break;case s.enumPolyline:Te(!1,t,r,a);break;case s.enumMultiPoint:ge(t,r,a);break;case s.enumPoint:ve(t,r,a);break;case s.enumEnvelope:xe(t,r,a);break;case s.enumMultipatch:n(0);break;default:e("exportToJSON")}}null!==i&&(a.addFieldName("spatialReference"),Se(t,i,a)),a.endObject()}}function Te(e,t,r,i){const s=r.getImpl(),o=!!(2&t),u=!!(4&t),m=!!(8&t),l=s.hasAttribute(1)&&!o,c=s.hasAttribute(2)&&!u,d=s.hasAttribute(3)&&!m,_=s.hasNonLinearSegments();l&&(i.addFieldName("hasZ"),i.addBool(!0)),c&&(i.addFieldName("hasM"),i.addBool(!0)),e?_?i.addFieldName("curveRings"):i.addFieldName("rings"):_?i.addFieldName("curvePaths"):i.addFieldName("paths");let h=null;const f=[];if(r.isEmpty())i.startArray(),i.endArray();else{const e=17-(31&t>>13);i.startArray();const n=r.getPathCount();let m=0;const p=s.getAttributeStreamRef(0);let k=null,b=null,y=null;const N=new B;let T=null,g=null,v=null;_&&(T=s.getSegmentFlagsStreamRef(),g=s.getSegmentIndexStreamRef(),v=s.getSegmentDataStreamRef()),l&&(k=s.getAttributeStreamRef(1)),c&&(b=s.getAttributeStreamRef(2)),d&&(y=s.getAttributeStreamRef(3),h=j(3,0));for(let t=0;t<n;t++){i.startArray(),d&&f.push(0);const n=r.getPathEnd(t);if(m===n){i.endArray();continue}const s=r.isClosedPath(t);let _=p.read(2*m),x=p.read(2*m+1),A=l?k.read(m):Number.NaN,S=c?b.read(m):Number.NaN,w=d?y.read(m):0;we(l,c,_,x,A,S,e,i);let C=1;d&&(h.add(w),f[f.length-1]++);const D=_,F=x,j=A,z=S,O=w;let I=!1,E=0,B=Number.NaN,P=Number.NaN,V=0;for(let t=m+1,r=m,M=s?n+1:n;t<M;t++,r++){const s=null!==T?31&T.read(r):1;let m,M;if(t<n?(m=p.read(2*t),M=p.read(2*t+1),l&&(B=k.read(t)),c&&(P=b.read(t)),d&&(V=y.read(t))):(m=D,M=F,B=j,P=z,V=O),1!==s){I=!0,4===s?N.createEllipticArc():2===s?N.createCubicBezier():16===s?N.createQuadraticBezier():8===s?N.createQuadraticRationalBezier():a("JSON export.unsupported curve");const t=N.get(),n=g.read(r);t.setStartXYCoords(_,x),t.setEndXYCoords(m,M),l&&(t.setStartAttribute(1,0,A),t.setEndAttribute(1,0,B)),c&&(t.setStartAttribute(2,0,S),t.setEndAttribute(2,0,P)),t.readFromBufferStream(v,n);_e(N.get(),o,u,e,i)&&E++}else we(l,c,m,M,B,P,e,i);d&&(h.add(V),f[f.length-1]++),C++,_=m,x=M,A=B,S=P,w=V}I&&0===E||(C<2&&E<1&&(we(l,c,_,x,A,S,e,i),C++,d&&(h.add(w),f[f.length-1]++)),s&&C<3&&E<2&&(we(l,c,D,F,j,z,e,i),C++,_=D,x=F,A=j,S=z,w=O,d&&(h.add(O),f[f.length-1]++))),i.endArray(),m=n}i.endArray()}if(d){i.addFieldName("ids"),i.startArray();let e=0;for(let t=0,r=f.length;t<r;++t){const r=f[t];n(0===r||null!==h&&e+r<=h.size()),i.startArray();for(let t=0;t<r;++t)i.addInt32(h.read(e)),e++;i.endArray()}i.endArray()}}function ge(e,t,r){const i=t.getImpl(),s=i.hasAttribute(1)&&!(2&e),a=i.hasAttribute(2)&&!(4&e),o=i.hasAttribute(3)&&!(8&e);s&&(r.addFieldName("hasZ"),r.addBool(!0)),a&&(r.addFieldName("hasM"),r.addBool(!0)),r.addFieldName("points");const u=t.getPointCount();if(t.isEmpty())r.startArray(),r.endArray();else{const t=17-(31&e>>13);r.startArray();const n=i.getAttributeStreamRef(0);let o=null,m=null;s&&(o=i.getAttributeStreamRef(1)),a&&(m=i.getAttributeStreamRef(2));for(let e=0;e<u;e++){const i=n.read(2*e),u=n.read(2*e+1);let l=Number.NaN,c=Number.NaN;s&&(l=o.read(e)),a&&(c=m.read(e)),we(s,a,i,u,l,c,t,r)}r.endArray()}if(o){let e=null;i.isEmpty()||(e=i.getAttributeStreamRef(3)),n(0===u||null!==e&&e.size()>=u),r.addFieldName("ids"),r.startArray();for(let t=0;t<u;t++)r.addInt32(e.read(t));r.endArray()}}function ve(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),s=t.hasAttribute(3)&&!(8&e);if(t.isEmpty())return n.addFieldName("x"),n.addNull(),n.addFieldName("y"),n.addNull(),r&&(n.addFieldName("z"),n.addNull()),i&&(n.addFieldName("m"),n.addNull()),void(s&&(n.addFieldName("id"),n.addInt32(0)));const a=17-(31&e>>13);n.addFieldName("x"),n.addDouble(t.getX(),a),n.addFieldName("y"),n.addDouble(t.getY(),a),r&&(n.addFieldName("z"),n.addDouble(t.getZ(),a)),i&&(n.addFieldName("m"),n.addDouble(t.getM(),a)),s&&(n.addFieldName("id"),n.addInt32(t.getID()))}function xe(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),s=t.hasAttribute(3)&&!(8&e);if(t.isEmpty())return n.addFieldName("xmin"),n.addNull(),n.addFieldName("ymin"),n.addNull(),n.addFieldName("xmax"),n.addNull(),n.addFieldName("ymax"),n.addNull(),r&&(n.addFieldName("zmin"),n.addNull(),n.addFieldName("zmax"),n.addNull()),i&&(n.addFieldName("mmin"),n.addNull(),n.addFieldName("mmax"),n.addNull()),void(s&&(n.addFieldName("idmin"),n.addInt32(0),n.addFieldName("idmax"),n.addInt32(0)));const a=17-(31&e>>13);if(n.addFieldName("xmin"),n.addDouble(t.getXMin(),a),n.addFieldName("ymin"),n.addDouble(t.getYMin(),a),n.addFieldName("xmax"),n.addDouble(t.getXMax(),a),n.addFieldName("ymax"),n.addDouble(t.getYMax(),a),r){const e=t.queryInterval(1,0);n.addFieldName("zmin"),n.addDouble(e.vmin,a),n.addFieldName("zmax"),n.addDouble(e.vmax,a)}if(i){const e=t.queryInterval(2,0);n.addFieldName("mmin"),n.addDouble(e.vmin,a),n.addFieldName("mmax"),n.addDouble(e.vmax,a)}if(s){const e=t.queryInterval(3,0);n.addFieldName("idmin"),n.addInt32(e.vmin),n.addFieldName("idmax"),n.addInt32(e.vmax)}}function Ae(e,n,r){r.startObject();const i=n.getID();i<=0&&t("cannot export unit that has no valid WKID"),r.addFieldName("uwkid"),r.addInt32(i),r.endObject()}function Se(e,t,n){n.startObject();let r=0;t.isCustomWkid()||(r=t.getOldID());let i=0;const s=t.getVCS();if(null!==s&&(s.isCustomWkid()||(i=s.getOldID()),i<=0&&(r=0)),r>0){n.addFieldName("wkid"),n.addInt32(r);const e=t.getLatestID();if(e>0&&e!==r&&(n.addFieldName("latestWkid"),n.addInt32(e)),i>0){n.addFieldName("vcsWkid"),n.addInt32(i);const e=t.getLatestVerticalID();e!==i&&(n.addFieldName("latestVcsWkid"),n.addInt32(e))}}if(0===t.getCoordinateSystemType())n.addFieldName("wkid"),n.addNull(),null!==t.getUnit()&&(n.addFieldName("unit"),Ae(e,t.getUnit(),n));else if(r<=0||1&e){let r="";64&e&&(r=t.getText2(),n.addFieldName("wkt2"),n.addString(r));const i=t.getText();i!==r&&(n.addFieldName("wkt"),n.addString(i))}if(16&e){const e=new T;t.queryPrecisionDescriptor(e),n.addFieldName("xyTolerance"),n.addDouble(e.getTolerance(0)),n.addFieldName("zTolerance"),n.addDouble(e.getTolerance(1)),n.addFieldName("mTolerance"),n.addDouble(e.getTolerance(2)),n.addFieldName("falseX"),n.addDouble(e.getFalseX()),n.addFieldName("falseY"),n.addDouble(e.getFalseY()),n.addFieldName("xyUnits"),n.addDouble(e.getGridUnitsXY()),n.addFieldName("falseZ"),n.addDouble(e.getFalseZ()),n.addFieldName("zUnits"),n.addDouble(e.getGridUnitsZ()),n.addFieldName("falseM"),n.addDouble(e.getFalseM()),n.addFieldName("mUnits"),n.addDouble(e.getGridUnitsM())}n.endObject()}function we(e,t,n,r,i,s,a,o){o.startArray(),o.addDouble(n,a),o.addDouble(r,a),e&&o.addDouble(i,a),t&&o.addDouble(s,a),o.endArray()}const Ce={s_a:"a".charCodeAt(0),s_A:"A".charCodeAt(0),s_asterisk:"*".charCodeAt(0),s_b:"b".charCodeAt(0),s_backspace:"\b".charCodeAt(0),s_backslash:"\\".charCodeAt(0),s_beginArray:"[".charCodeAt(0),s_beginObject:"{".charCodeAt(0),s_colon:":".charCodeAt(0),s_period:".".charCodeAt(0),s_comma:",".charCodeAt(0),s_doubleQuote:'"'.charCodeAt(0),s_endArray:"]".charCodeAt(0),s_endObject:"}".charCodeAt(0),s_e:"e".charCodeAt(0),s_E:"E".charCodeAt(0),s_f:"f".charCodeAt(0),s_formfeed:"\f".charCodeAt(0),s_F:"F".charCodeAt(0),s_forwardslash:"/".charCodeAt(0),s_lt:"<".charCodeAt(0),s_minus:"-".charCodeAt(0),s_plus:"+".charCodeAt(0),s_n:"n".charCodeAt(0),s_N:"N".charCodeAt(0),s_newline:"\n".charCodeAt(0),s_r:"r".charCodeAt(0),s_carriageReturn:"\r".charCodeAt(0),s_t:"t".charCodeAt(0),s_tab:"\t".charCodeAt(0),s_u:"u".charCodeAt(0),s_zero:"0".charCodeAt(0),s_nine:"9".charCodeAt(0)};class De{constructor(t){this.m_functionStack=[],this.m_pushPositions=[],this.m_utf8Decoder=new TextDecoder("utf-8",{fatal:!0}),void 0===t?(this.m_startToken=Number.MAX_SAFE_INTEGER,this.m_endToken=0,this.m_currentTokenType=0,this.m_functionStack.push((()=>this.accept_())),this.m_jsonString=null,this.m_bHasEscapes=!1):t.jsonString?this.resetParserFromString(t.jsonString):t.jsonStream?a("streaming json parsing not yet impl"):e("invalid constructor parameter")}prepSubstrString_(){}getCurrentSubstrString_(){return this.m_jsonString.slice(this.m_startToken,this.m_endToken)}stepOverCharString_(){this.m_endToken++}peekCharString_(){return this.m_jsonString.charCodeAt(this.m_endToken)}getString_(e){const t=this.m_jsonString?.slice(this.m_startToken,this.m_startToken+e-1);this.m_endToken+=e-1;return{s:t,bDone:this.m_endToken>=this.m_jsonString.length}}incrementString_(){this.m_endToken++}eofString_(){return this.m_endToken>=this.m_jsonString.length}setStringFunctions_(){this.m_prepSubstr=this.prepSubstrString_,this.m_getCurrentSubstr=this.getCurrentSubstrString_,this.m_stepOverChar=this.stepOverCharString_,this.m_peekChar=this.peekCharString_,this.m_get=this.getString_,this.m_increment=this.incrementString_,this.m_eof=this.eofString_}setStreamFunctions_(){a("streaming json parsing not yet impl")}reset_(){this.m_jsonString=null,this.m_endToken=0,this.m_startToken=Number.MAX_SAFE_INTEGER,this.m_currentTokenType=0,this.m_bHasEscapes=!1,this.m_functionStack.length=0,this.m_functionStack.push((()=>this.start_())),this.m_pushPositions.length=0}resetParserFromString(e){this.reset_(),this.setStringFunctions_(),this.m_jsonString=e}resetParserFromStream(e){a("streaming json parsing not yet impl")}resetToPosition(e){return!!this.m_jsonString&&(this.m_endToken=e,this.m_startToken=Number.MAX_VALUE,this.m_currentTokenType=0,this.m_functionStack.length=0,e>=this.m_jsonString.length?(this.m_functionStack.push((()=>this.accept_())),!1):(this.m_functionStack.push((()=>this.start_())),!0))}nextToken(){return this.m_functionStack.at(-1)(),this.m_currentTokenType}currentToken(){return this.m_currentTokenType}currentTokenStartIndex(){return this.m_startToken}currentTokenEndIndex(){return this.m_endToken}currentText(){return n(0),""}childrenAsString(){return n(0),""}skipChildren(){this.skipChildren_()}skipChildren_(){if(1!==this.m_currentTokenType)if(2!==this.m_currentTokenType);else{let e=1;do{this.m_currentTokenType=this.nextToken(),2===this.m_currentTokenType?e++:4===this.m_currentTokenType&&e--}while(4!==this.m_currentTokenType||0!==e)}else{let e=1;do{this.m_currentTokenType=this.nextToken(),1===this.m_currentTokenType?e++:3===this.m_currentTokenType&&e--}while(3!==this.m_currentTokenType||0!==e)}}currentTerminalAsString_(){switch(this.m_currentTokenType){case 7:case 8:case 9:return this.m_getCurrentSubstr().slice(0,this.m_endToken-this.m_startToken);case 10:return"null";case 11:return"true";case 12:return"false"}t("invalid token")}toUTF8_(e,t){let n=0,r=e;for(;t.charCodeAt(r)===Ce.s_backslash&&t.charCodeAt(r+1)===Ce.s_u;)n++,r+=6;r=e;const i=new Uint8Array(n);let s=0;for(;t.charCodeAt(r)===Ce.s_backslash&&t.charCodeAt(r+1)===Ce.s_u;)i[s++]=Number.parseInt(t.slice(r+2,r+6),16),r+=6;return{u8s:this.m_utf8Decoder.decode(i),end:r}}unquoteCurrentString_(){let e="",t=1;const n=this.m_endToken-this.m_startToken-1;let r=0;const i=this.m_getCurrentSubstr();for(let s=t;s<n;s++)if(i.charCodeAt(s)!==Ce.s_backslash)r++;else{switch(r>0&&(e+=i.slice(t,t+r)),i.charCodeAt(++s)){case Ce.s_doubleQuote:e+='"';break;case Ce.s_u:{const{u8s:t,end:n}=this.toUTF8_(s-1,i);s=n-1,e+=t;break}case Ce.s_backslash:e+="\\";break;case Ce.s_forwardslash:e+="/";break;case Ce.s_b:e+="\b";break;case Ce.s_f:e+="\f";break;case Ce.s_n:e+="\n";break;case Ce.s_r:e+="\r";break;case Ce.s_t:e+="\t"}t=s+1,r=0}return r>0&&(e+=i.slice(t,t+r)),e}currentString(){if(5!==this.m_currentTokenType&&6!==this.m_currentTokenType)return this.currentTerminalAsString_();if(this.m_bHasEscapes)return this.unquoteCurrentString_();return this.m_getCurrentSubstr().slice(1,this.m_endToken-this.m_startToken-2+1)}currentDoubleValue(){if(7!==this.m_currentTokenType&&8!==this.m_currentTokenType&&9!==this.m_currentTokenType&&6!==this.m_currentTokenType&&10!==this.m_currentTokenType&&t("invalid token"),10===this.m_currentTokenType)return Number.NaN;let e=this.m_getCurrentSubstr(),n=this.m_endToken-this.m_startToken;if(6===this.m_currentTokenType){if("NaN"===this.currentString())return Number.NaN;e=e.slice(1),n-=2,0===n&&t("invalid token")}const r=Number.parseFloat(e);if(6===this.m_currentTokenType)Number.isNaN(r)&&t("invalid token");else if(Number.isNaN(r))return Number.NaN;return r}currentInt32Value(){8!==this.m_currentTokenType&&6!==this.m_currentTokenType&&t("invalid token");let e=this.m_getCurrentSubstr(),n=this.m_endToken-this.m_startToken;6===this.m_currentTokenType&&(e=e.slice(1),n-=2,0===n&&t("invalid token"));const r=parseInt(e);return Number.isNaN(r)&&t("invalid token"),r}currentInt64Value(){return n(0),0n}currentBoolValue(){return n(0),!1}isError(){return 0}JSONString(){return n(0),""}pushPosition(){return n(0),!1}popPosition(){return n(0),!1}skipCStyleComments_(){n(0)}skipCppStyleComments_(){n(0)}skipComments_(){this.m_prepSubstr();let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e===Ce.s_asterisk?this.skipCStyleComments_():e===Ce.s_forwardslash?this.skipCppStyleComments_():t("invalid token")}skipWhiteSpace_(){let e;do{this.m_eof()&&t("invalid token");let n=this.m_peekChar();for(;n>=9&&n<=13||32===n;)this.m_increment(),this.m_eof()&&t("invalid token"),n=this.m_peekChar();n===Ce.s_forwardslash?(this.m_startToken=this.m_endToken,e=!0,this.skipComments_()):e=!1}while(e)}rightBracket_(){return this.m_peekChar()===Ce.s_endArray&&(this.m_startToken=this.m_endToken,this.m_increment(),this.m_currentTokenType=4,!0)}rightBrace_(){return this.m_peekChar()===Ce.s_endObject&&(this.m_startToken=this.m_endToken,this.m_increment(),this.m_currentTokenType=3,!0)}string_(){this.m_prepSubstr(),this.m_bHasEscapes=!1,this.m_stepOverChar(),this.m_eof()&&t("invalid token");let e=this.m_peekChar();for(;e!==Ce.s_doubleQuote;){const n=e===Ce.s_backslash;if(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),n)if(this.m_bHasEscapes=!0,e===Ce.s_doubleQuote||e===Ce.s_backslash||e===Ce.s_forwardslash||e===Ce.s_b||e===Ce.s_f||e===Ce.s_n||e===Ce.s_r||e===Ce.s_t)this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar();else if(e===Ce.s_u)for(let r=0;r<4;r++)this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e>=Ce.s_zero&&e<=Ce.s_nine||e>=Ce.s_a&&e<=Ce.s_f||e>=Ce.s_A&&e<=Ce.s_F||t("invalid token");else t("invalid token")}this.m_stepOverChar()}comma_(){return this.m_peekChar()===Ce.s_comma&&(this.m_increment(),!0)}colon_(){return this.m_peekChar()===Ce.s_colon&&(this.m_increment(),!0)}fieldNameEnd_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.colon_()?(this.skipWhiteSpace_(),this.value_()):t("invalid token")}fieldNameStart_(){this.m_startToken=this.m_endToken;this.m_peekChar()!==Ce.s_doubleQuote&&t("invalid token"),this.string_(),this.m_currentTokenType=5,this.m_functionStack.push((()=>this.fieldNameEnd_()))}pairEnd_(){this.skipWhiteSpace_(),this.comma_()?(this.skipWhiteSpace_(),this.fieldNameStart_()):this.rightBrace_()?this.m_functionStack.pop():t("invalid token")}arrayStart_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.rightBracket_()||(this.m_functionStack.push((()=>this.elementEnd_())),this.value_())}elementEnd_(){this.skipWhiteSpace_(),this.comma_()?(this.skipWhiteSpace_(),this.value_()):this.rightBracket_()?this.m_functionStack.pop():t("invalid token")}objectStart_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.rightBrace_()||(this.m_functionStack.push((()=>this.pairEnd_())),this.fieldNameStart_())}valueStartObject_(){this.m_increment(),this.m_currentTokenType=1,this.m_functionStack.push((()=>this.objectStart_()))}valueStartArray_(){this.m_increment(),this.m_currentTokenType=2,this.m_functionStack.push((()=>this.arrayStart_()))}valueString_(){this.string_(),this.m_currentTokenType=6}int_(){this.m_peekChar()!==Ce.s_zero?this.digits_():this.m_stepOverChar()}digits_(){let e=this.m_peekChar();do{this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar()}while(e>=Ce.s_zero&&e<=Ce.s_nine)}frac_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e>=Ce.s_zero&&e<=Ce.s_nine||t("invalid token"),this.digits_()}exp_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e!==Ce.s_plus&&e!==Ce.s_minus||(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar()),e>=Ce.s_zero&&e<=Ce.s_nine||t("invalid token"),this.digits_()}valueNumber_(){this.m_prepSubstr();let e=!1,n=this.m_peekChar();if(n===Ce.s_minus?(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),n=this.m_peekChar(),e=!0,n>=Ce.s_zero&&n<=Ce.s_nine||t("invalid token"),this.int_()):this.int_(),n=this.m_peekChar(),n===Ce.s_period)this.m_currentTokenType=7,this.frac_(),n=this.m_peekChar(),n!==Ce.s_e&&n!==Ce.s_E||this.exp_();else if(n===Ce.s_e||n===Ce.s_E)this.m_currentTokenType=7,this.exp_();else{let t=0;e&&t++;const n=this.m_endToken-this.m_startToken-t;if(n<10)this.m_currentTokenType=8;else if(10===n){const n=this.m_getCurrentSubstr();e?n.slice(t)<="2147483648"?this.m_currentTokenType=8:this.m_currentTokenType=9:n.slice(t)<="2147483647"?this.m_currentTokenType=8:this.m_currentTokenType=9}else if(n<19)this.m_currentTokenType=9;else if(19===n){const n=this.m_getCurrentSubstr();e?n.slice(t)<="9223372036854775808"?this.m_currentTokenType=9:this.m_currentTokenType=7:n.slice(t)<="9223372036854775807"?this.m_currentTokenType=9:this.m_currentTokenType=7}else this.m_currentTokenType=7}}valueNull_(){const{s:e,bDone:n}=this.m_get(5);n&&t("invalid token"),"null"!==e&&t("invalid token"),this.m_currentTokenType=10}valueTrue_(){const{s:e,bDone:n}=this.m_get(5);n&&t("invalid token"),"true"!==e&&t("invalid token"),this.m_currentTokenType=11}valueFalse_(){const{s:e,bDone:n}=this.m_get(6);n&&t("invalid token"),"false"!==e&&t("invalid token"),this.m_currentTokenType=12}valueNan_(){const{s:e,bDone:n}=this.m_get(4);n&&t("invalid token"),"NaN"!==e&&t("invalid token"),this.m_currentTokenType=7}value_(){this.m_startToken=this.m_endToken;const e=this.m_peekChar();e===Ce.s_beginObject?this.valueStartObject_():e===Ce.s_beginArray?this.valueStartArray_():e===Ce.s_doubleQuote?this.valueString_():e===Ce.s_minus||e>=Ce.s_zero&&e<=Ce.s_zero+9?this.valueNumber_():e===Ce.s_n?this.valueNull_():e===Ce.s_t?this.valueTrue_():e===Ce.s_f?this.valueFalse_():e===Ce.s_N?this.valueNan_():t("invalid token")}start_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.m_functionStack.push((()=>this.accept_()));const e=this.m_peekChar();e!==Ce.s_beginObject&&e!==Ce.s_beginArray&&t("invalid token"),this.value_()}accept_(){this.m_startToken=this.m_endToken,this.m_currentTokenType=0}}class Fe{getOperatorType(){return 10404}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,n,r,i,s,a,o){let u;"string"==typeof r?(u=new De({jsonString:r}),u.nextToken()):u=r,1!==u.currentToken()&&t("failed to import map geometry: start of object is expected");const m=K(n,e,u,i,s);return new g(m)}importProjectionTransformation(e,t){return n(0),{}}importDatumTransformation(e,t){return n(0),{}}static stringToGeometryType(e){return(e=e.toLowerCase()).startsWith("esrigeometry")||t("string_to_geometry_type"),e.endsWith("point")?s.enumPoint:e.endsWith("envelope")?s.enumEnvelope:e.endsWith("multipoint")?s.enumMultiPoint:e.endsWith("polyline")?s.enumPolyline:e.endsWith("polygon")?s.enumPolygon:void t("string_to_geometry_type")}}const je=new Y,ze=new ye,Oe=new Fe;function Ie(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function Ee(e,t){const n=new L(e,{strict:!1});return n.nextToken(),Oe.execute(0,s.enumUnknown,n,!0,t)}function Be(e){let t=null;return[e.map((e=>{if(null==t){const n=Pe(e);return t=n.getSpatialReference(),n.getGeometry()}return Ve(e)})),t]}function Pe(e){return Ee(e,!0)}function Ve(e){return Ee(e,!1).getGeometry()}function Me(e,t){return e instanceof g&&(t=e.getSpatialReference(),e=e.getGeometry()),e?.isEmpty()?null:(je.reset(),ze.execute(0,e,t,je),je.getObject())}export{Be as fromGeometries,Pe as fromGeometry,Ve as fromGeometryToGXGeometry,Ie as getSpatialReference,Me as toGeometry};
5
+ import{c as e,a as t,g as n,q as r,p as i,G as s,t as a}from"../../../chunks/Geometry.js";import{ao as o,i as u,P as m,d as l,b as c,ap as d,m as _}from"../../../chunks/Point2D.js";import{aA as h,a as f,aB as p,aC as k,c as b,R as y,aD as N,aE as T,aF as g}from"../../../chunks/ProjectionTransformation.js";import{F as v,I as x,P as A,E as S,z as w,D as C,J as D,K as F,t as j}from"../../../chunks/Envelope.js";import{C as z,w as O,a as I,P as E,S as B,M as P,x as V,y as M,z as R,A as U}from"../../../chunks/QuadraticBezier.js";import"./initNoPeFactory.js";function W(){if(-1===this.m_i)return this.m_i=0,{value:{m_token:1,m_value:null},done:!1};if(this.m_i<this.m_keys.length){const e=this.m_bReturnKey,t=Math.trunc(this.m_i);return this.m_bReturnKey=!this.m_bReturnKey,this.m_i+=.5,e?{value:{m_token:5,m_value:this.m_keys[t]},done:!1}:{value:{m_token:6,m_value:this.m_o[this.m_keys[t]]},done:!1}}return{value:{m_token:3,m_value:null},done:!0}}function X(){if(-1===this.m_i)return this.m_i=0,{value:{m_token:2,m_value:null},done:!1};if(this.m_i<this.m_a.length){const e={value:{m_token:6,m_value:this.m_a[this.m_i++]},done:!1};return this.m_strict||void 0===e.value.m_value&&(e.value.m_value=Number.NaN),e}return{value:{m_token:4,m_value:null},done:!0}}class L{createJSONObjectIterator(e){return{m_iteratorType:"object",m_o:e,m_keys:this.m_options.strict?Object.keys(e):Object.keys(e).filter((t=>void 0!==e[t])),m_i:-1,m_bReturnKey:!0,next:W}}createJSONArrayIterator(e){return{m_iteratorType:"array",m_strict:this.m_options.strict,m_i:-1,m_a:e,next:X}}constructor(e,t){this.m_currentToken=0,this.m_options=t?{...t}:{strict:!0};const n=e;this.m_iteratorStack=[n instanceof Array?this.createJSONArrayIterator(n):this.createJSONObjectIterator(n)],this.m_nextFlatToken={m_value:null,m_token:0}}nextToken(){if(0===this.m_iteratorStack.length)return this.m_currentToken=0;switch(this.m_nextFlatToken=this.m_iteratorStack.at(-1).next().value,this.m_currentValue=void 0,this.m_nextFlatToken.m_token){case 1:return this.m_currentToken=1;case 3:return this.m_iteratorStack.pop(),this.m_currentToken=3;case 2:return this.m_currentToken=2;case 4:return this.m_iteratorStack.pop(),this.m_currentToken=4;case 5:return this.m_currentValue=this.m_nextFlatToken.m_value,this.m_currentToken=5;case 6:if(this.m_nextFlatToken.m_value instanceof Array)return this.m_iteratorStack.push(this.createJSONArrayIterator(this.m_nextFlatToken.m_value)),this.nextToken();if(this.m_nextFlatToken.m_value instanceof Object)return this.m_iteratorStack.push(this.createJSONObjectIterator(this.m_nextFlatToken.m_value)),this.nextToken();if("number"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=this.m_nextFlatToken.m_value,Number.isSafeInteger(this.m_currentValue)&&this.m_currentValue>=o()&&this.m_currentValue<=u()?this.m_currentToken=8:this.m_currentToken=7;if("string"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=this.m_nextFlatToken.m_value,this.m_currentToken=6;if("boolean"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=this.m_nextFlatToken.m_value,this.m_currentToken=this.m_nextFlatToken.m_value?11:12;if("object"==typeof this.m_nextFlatToken.m_value)return this.m_currentValue=null,this.m_currentToken=10;e("unrecognized json element type")}return e("unrecognized json element type"),0}currentToken(){return this.m_currentToken}skipChildren(){if(0!==this.m_iteratorStack.length)switch(this.m_currentValue=void 0,this.m_nextFlatToken.m_token){case 1:return this.m_iteratorStack.pop(),this.m_nextFlatToken.m_token=3,void(this.m_currentToken=3);case 2:return this.m_iteratorStack.pop(),this.m_nextFlatToken.m_token=4,void(this.m_currentToken=4)}}currentString(){return 6!==this.m_currentToken&&5!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentDoubleValue(){return 7!==this.m_currentToken&&8!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentInt32Value(){return 8!==this.m_currentToken&&t("invalid token"),this.m_currentValue}currentInt64Value(){return n(0),0n}currentBoolValue(){return 12!==this.m_currentToken&&11!==this.m_currentToken&&t("invalid token"),this.m_currentValue}isError(){return 0}}class Y{constructor(){this.m_pendingKey=null,this.m_acceptedObject=null,this.m_currentObject=[]}reset(){this.m_pendingKey=null,this.m_acceptedObject=null,this.m_currentObject.length=0}startObject(){const e={};this.m_pendingKey?(this.m_currentObject.at(-1)[this.m_pendingKey]=e,this.m_pendingKey=null):Array.isArray(this.m_currentObject.at(-1))&&this.m_currentObject.at(-1).push(e),this.m_currentObject.push(e)}startArray(){const e=[];this.m_pendingKey?(this.m_currentObject.at(-1)[this.m_pendingKey]=e,this.m_pendingKey=null):Array.isArray(this.m_currentObject.at(-1))&&this.m_currentObject.at(-1).push(e),this.m_currentObject.push(e)}endObject(){this.m_acceptedObject=this.m_currentObject.at(-1),this.m_currentObject.pop()}endArray(){this.m_currentObject.pop()}addFieldName(e){this.m_pendingKey=e}addValue_(e){this.m_pendingKey?(this.m_currentObject.at(-1)[this.m_pendingKey]=e,this.m_pendingKey=null):this.m_currentObject.at(-1).push(e)}addString(e){this.addValue_(e)}addDouble(e,t){this.addValue_(e)}addInt64(e){n(0)}addInt32(e){this.addValue_(e)}addBool(e){this.addValue_(e)}addNull(){this.addValue_(null)}getObject(){return this.m_acceptedObject}}class G{constructor(t){return this.m_buffer=null,this.m_view=null,this.m_sz=0,this.m_offset=0,this.m_bOwnsBuffer=!0,this.m_bLittleEndian=!0,this.m_element=new ArrayBuffer(8),this.m_elementBytes=new Uint8Array(this.m_element),this.m_elementView=new DataView(this.m_element),this.m_elementDouble=new Float64Array(this.m_element),this.m_elementFloat=new Float32Array(this.m_element),this.m_elementInt64=new BigInt64Array(this.m_element),this.m_elementInt32=new Int32Array(this.m_element),this.m_elementInt16=new Int16Array(this.m_element),void 0!==t.sz?(this.m_sz=t.sz,t.buffer?(this.m_sz<0&&r("size out of range"),this.m_buffer=t.buffer,this.m_offset=void 0!==t.offset?t.offset:0,this.m_view=void 0!==t.offset?new DataView(t.buffer,t.offset,t.sz):new DataView(this.m_buffer),this.m_bOwnsBuffer=!1,void(this.m_bLittleEndian=!0)):(this.m_sz<0&&r("size out of range"),void(this.m_sz>0&&(this.m_buffer=new ArrayBuffer(this.m_sz),this.m_view=new DataView(this.m_buffer))))):t.move?(this.m_sz=t.move.m_sz,this.m_buffer=t.move.m_buffer,this.m_view=t.move.m_view,this.m_bOwnsBuffer=t.move.m_bOwnsBuffer,this.m_bLittleEndian=t.move.m_bLittleEndian,t.move.m_buffer=null,t.move.m_view=null,t.move.m_sz=0,void(t.move.m_bOwnsBuffer=!0)):void e("unrecognized constructor options")}swapBytesDouble(){this.doSwap()&&(this.m_elementDouble[0]=this.m_elementBytes[0]<<56|this.m_elementBytes[1]<<48|this.m_elementBytes[2]<<40|this.m_elementBytes[3]<<32|this.m_elementBytes[4]<<24|this.m_elementBytes[5]<<16|this.m_elementBytes[6]<<8|this.m_elementBytes[7])}swapBytesInt32(){this.doSwap()&&(this.m_elementInt32[0]=this.m_elementBytes[0]<<24|this.m_elementBytes[1]<<16|this.m_elementBytes[2]<<8|this.m_elementBytes[3])}getOffset(){return this.m_offset}assignMove(e){return this===e||(this.clear(),this.m_sz=e.m_sz,this.m_buffer=e.m_buffer,this.m_view=e.m_view,this.m_bOwnsBuffer=e.m_bOwnsBuffer,this.m_bLittleEndian=e.m_bLittleEndian,e.m_buffer=null,e.m_sz=0,e.m_bOwnsBuffer=!0),this}doSwap(){return this.m_bLittleEndian!==(1===G.getNativeByteOrder())}setNativeByteOrder(){this.m_bLittleEndian=1===G.getNativeByteOrder()}setOrder(e){this.m_bLittleEndian=1===e}getOrder(){return this.m_bLittleEndian?1:0}getView(){return this.m_view||i("buffer not defined"),this.m_view}static getNativeByteOrder(){return 1}clear(){this.m_buffer=null,this.m_sz=0,this.m_bOwnsBuffer=!0}size(){return this.m_sz}readDouble(e){return this.doSwap()?(this.m_elementDouble[0]=this.m_view.getFloat64(e,this.m_bLittleEndian),this.swapBytesDouble(),this.m_elementDouble[0]):this.m_view.getFloat64(e,this.m_bLittleEndian)}writeDouble(e,t){this.m_elementDouble[0]=t,this.swapBytesDouble(),this.m_view.setFloat64(e,this.m_elementDouble[0],this.m_bLittleEndian)}readInt32(e){return this.doSwap()?(this.m_elementInt32[0]=this.m_view.getInt32(e,this.m_bLittleEndian),this.swapBytesInt32(),this.m_elementInt32[0]):this.m_view.getInt32(e,this.m_bLittleEndian)}writeInt32(e,t){this.m_elementInt32[0]=t,this.swapBytesInt32(),this.m_view.setInt32(e,this.m_elementInt32[0],this.m_bLittleEndian)}getPtr(){return this.m_buffer}setSizeNoRealloc(e){n(e>=0&&e<=this.m_sz),this.m_sz=e}}function K(e,r,i,a,o,u){let m=!1,l=!1,c=!1,d=!1,_=!1,h=!1,f=!1,p=!1,k=!1,b=!1,y=!1,N=!1,T=!1,g=!1,w=!1,C=!1,D=!1,F=!1,j=!1,z=!1,O=!1,I=!1,E=!1,B=!1,P=Number.NaN,V=Number.NaN,M=Number.NaN,R=Number.NaN,U=0,W=Number.NaN,X=Number.NaN,L=Number.NaN,Y=Number.NaN,G=Number.NaN,K=Number.NaN,q=Number.NaN,ne=Number.NaN,re=0,ie=0,se=!1,ae=!1,oe=null,ue=null,me=null,le=null,ce=null;for(;3!==i.nextToken();){const u=i.currentString();if(i.nextToken(),"spatialReference"===u){if(o&&!m){m=!0,1===i.currentToken()?le=Q(i):10!==i.currentToken()&&t("failed to parse spatial reference: object or null is expected");continue}}else if(a)if("hasZ"===u){if(!l){l=!0,se=11===i.currentToken();continue}}else if("hasM"===u){if(!c){c=!0,ae=11===i.currentToken();continue}}else if("rings"===u){if(!(_||h||e!==s.enumUnknown&&e!==s.enumPolygon)){_=!0,({geometry:ce,as:oe,bs:ue}=J(!0,!1,r,i));continue}}else if("curveRings"===u){if(!h&&(e===s.enumUnknown||e===s.enumPolygon)){h=!0,({geometry:ce,as:oe,bs:ue}=J(!0,!0,r,i));continue}}else if("paths"===u){if(!(f||p||e!==s.enumUnknown&&e!==s.enumPolyline)){f=!0,({geometry:ce,as:oe,bs:ue}=J(!1,!1,r,i));continue}}else if("curvePaths"===u){if(!p&&(e===s.enumUnknown||e===s.enumPolyline)){p=!0,({geometry:ce,as:oe,bs:ue}=J(!1,!0,r,i));continue}}else if("points"===u){if(!k&&(e===s.enumUnknown||e===s.enumMultiPoint)){k=!0,({geometry:ce,as:oe,bs:ue}=Z(r,i));continue}}else if("ids"===u){if(!d){d=!0,me=H(r,i);continue}}else if("x"===u){if(!b&&(e===s.enumUnknown||e===s.enumPoint)){b=!0,P=$(i);continue}}else if("y"===u){if(!y&&(e===s.enumUnknown||e===s.enumPoint)){y=!0,V=$(i);continue}}else if("z"===u){if(!N&&(e===s.enumUnknown||e===s.enumPoint)){N=!0,M=$(i);continue}}else if("m"===u){if(!T&&(e===s.enumUnknown||e===s.enumPoint)){T=!0,R=$(i);continue}}else if("id"===u){if(!g&&(e===s.enumUnknown||e===s.enumPoint)){g=!0,U=ee(i);continue}}else if("xmin"===u){if(!w&&(e===s.enumUnknown||e===s.enumEnvelope)){w=!0,W=$(i);continue}}else if("ymin"===u){if(!C&&(e===s.enumUnknown||e===s.enumEnvelope)){C=!0,X=$(i);continue}}else if("mmin"===u){if(!O&&(e===s.enumUnknown||e===s.enumEnvelope)){O=!0,q=$(i);continue}}else if("zmin"===u){if(!j&&(e===s.enumUnknown||e===s.enumEnvelope)){j=!0,G=$(i);continue}}else if("idmin"===u){if(!E&&(e===s.enumUnknown||e===s.enumEnvelope)){E=!0,re=ee(i);continue}}else if("xmax"===u){if(!D&&(e===s.enumUnknown||e===s.enumEnvelope)){D=!0,L=$(i);continue}}else if("ymax"===u){if(!F&&(e===s.enumUnknown||e===s.enumEnvelope)){F=!0,Y=$(i);continue}}else if("mmax"===u){if(!I&&(e===s.enumUnknown||e===s.enumEnvelope)){I=!0,ne=$(i);continue}}else if("zmax"===u){if(!z&&(e===s.enumUnknown||e===s.enumEnvelope)){z=!0,K=$(i);continue}}else if("idmax"===u){if(!B&&(e===s.enumUnknown||e===s.enumEnvelope)){B=!0,ie=ee(i);continue}}else"materials"===u&&n(0);i.skipChildren()}if(_||h||f||p||k){let e=null,t=null;const n=ce;se&&(ce.addAttribute(1),e=oe,e||(e=v(n.getPointCount(),Number.NaN))),ae&&(ce.addAttribute(2),t=se?ue:oe),null!=me&&ce.addAttribute(3),se&&null!=e&&n.setAttributeStreamRef(1,e),ae&&null!=t&&n.setAttributeStreamRef(2,t),null!=me&&te(n,me)}else if(b||y||T||N||g){x(P,V)||t("failed to parse point: x and y must be finite or nan"),(Number.isNaN(V)||Number.isNaN(P))&&(P=Number.NaN,V=Number.NaN);const e=new A({x:P,y:V});N&&e.setZ(M),T&&e.setM(R),g&&e.setID(U),ce=e}else if(w||C||D||F||j||z||O||I||E||B){(Number.isNaN(X)||Number.isNaN(L)||Number.isNaN(Y))&&(W=Number.NaN);const e=new S({xmin:W,ymin:X,xmax:L,ymax:Y});j&&z&&e.setInterval(1,0,G,K),O&&I&&e.setInterval(2,0,q,ne),E&&B&&e.setInterval(3,0,re,ie),ce=e}return{...ce?{geom:ce}:{},...le?{sr:le}:{}}}function q(e){let t=!1;for(;3!==e.nextToken();){const n=e.currentString();e.nextToken(),"uwkid"===n?t||(t=!0,8===e.currentToken()&&e.currentInt32Value()):e.skipChildren()}return null}function Q(e){let t=!1,n=!1,r=!1,i=!1,s=!1,a=!1,o=!1,u=!1,m=!1,l=!1,c=!1,d=!1,_=!1,g=!1,v=!1,x=!1,A=!1,S=-1,w=-1,C=-1,D=-1,F=0,j=0,z=0,O=0,I=0,E=0,B=0,P=0,V=0,M=0,R="",U="",W=null;for(;3!==e.nextToken();){const h=e.currentString();e.nextToken(),"wkid"===h?t||(t=!0,8===e.currentToken()&&(S=e.currentInt32Value())):"latestWkid"===h?n||(n=!0,8===e.currentToken()&&(w=e.currentInt32Value())):"wkt"===h?s||(s=!0,6===e.currentToken()&&(R=e.currentString())):"wkt2"===h?s||6===e.currentToken()&&(U=e.currentString()):"vcsWkid"===h?r||(r=!0,8===e.currentToken()&&(C=e.currentInt32Value())):"latestVcsWkid"===h?i||(i=!0,8===e.currentToken()&&(D=e.currentInt32Value())):"xyTolerance"===h?o||(o=!0,a=!0,F=e.currentDoubleValue()):"zTolerance"===h?u||(u=!0,a=!0,j=e.currentDoubleValue()):"mTolerance"===h?m||(m=!0,a=!0,z=e.currentDoubleValue()):"falseX"===h?l||(l=!0,a=!0,B=e.currentDoubleValue()):"falseY"===h?c||(c=!0,a=!0,P=e.currentDoubleValue()):"falseZ"===h?d||(d=!0,a=!0,V=e.currentDoubleValue()):"falseM"===h?_||(_=!0,a=!0,M=e.currentDoubleValue()):"xyUnits"===h?g||(g=!0,a=!0,O=e.currentDoubleValue()):"zUnits"===h?v||(v=!0,a=!0,I=e.currentDoubleValue()):"mUnits"===h?x||(x=!0,a=!0,E=e.currentDoubleValue()):"unit"===h?A||(A=!0,W=q(e)):e.skipChildren()}D<=0&&C>0&&(D=C),C<=0&&D>0&&(C=D);let X=null,L=!0;if(0!==R.length&&(L=!1,h(R)&&(X=f(R))),X||0===U.length||(L=!1,h(U)&&(X=f(U))),!X&&w>0&&(L=!1,p(w)&&(D<=0||k())&&(X=b(w,D))),!X&&S>0&&(L=!1,p(S)&&(C<=0||k())&&(X=b(S,C))),L&&(X=y(W)),a&&X){const e=new T;X.queryPrecisionDescriptorWithoutFalseXY(e),o&&e.setTolerance(0,F),u&&e.setTolerance(1,j),m&&e.setTolerance(2,z),g&&l&&c&&e.setGridParams(B,P,O),v&&d&&e.setZParams(V,I),x&&_&&e.setMParams(M,E),X=N(X,e)}return X}function J(e,n,r,i){2!==i.currentToken()&&t("failed to parse multipath: array of array of vertices is expected");const s=e?new I:new E,a=s,o=w(0),u=v(2,0),_=C(0);let h=null,f=null,p=null,k=null,b=null,y=0,N=0,T=0;const g=new B,x=m.getNAN();let A=0,S=0;const F=e?1:0;for(;4!==i.nextToken();){2!==i.currentToken()&&t("failed to parse multipath: ring/path array is expected");let r=2,s=0,j=!0;const z=4;let O=0,I=0;const E=m.getNAN(),B=l(z,Number.NaN),P=l(z,Number.NaN);let V=!1;for(i.nextToken();4!==i.currentToken();){if(n&&1===i.currentToken())j&&t("failed to parse multipath: starting vertex array is expected"),p||(p=C(A-1,1),k=w(A-1,-1),b=v(0)),V=!0,r=1,({segFlag:T,toPointSz:O}=ue(g,B,x,i));else{for(V=!1,2!==i.currentToken()&&t("failed to parse multipath: array is expected, rings/paths vertices consist of arrays of coordinates"),O=0;4!==i.nextToken();)O===z&&t("failed to parse multipath: each vertex array has to have at most 4 elements"),B[O++]=$(i);O<2&&t("failed to parse multipath: each vertex array has to have at least 2 elements"),D(B[0],B[1])||t("failed to parse multipath: x and y must be finite")}i.nextToken();do{if(u.size()===2*A&&u.resize(ne(A)),u.writePoint2D(2*A,E.setCoords(B[0],B[1])),h&&h.size()===A&&h.resize(re(A)),O>2?(h||(h=v(A+1,Number.NaN)),h.write(A,B[2])):h&&h.write(A,Number.NaN),f&&f.size()===A&&f.resize(re(A)),O>3?(f||(f=v(A+1,Number.NaN)),f.write(A,B[3])):f&&f.write(A,Number.NaN),j)S++,o.add(A),_.add(F),j=!1,I=O,c(P,B,0,0,I);else if(null!==p)if(V){const e=U(T),t=b.size();b.resize(t+e),p.add(T),k.add(y),g.get().writeInBufferStream(b,y),y+=e,a.incCurveType(T,1),N++}else p.add(1),k.add(-1);A++,s++,x.setCoords(B[0],B[1])}while(s<r&&4===i.currentToken())}0!==s&&(e&&s>r&&O===I&&0===d(B,P,O)?(A--,s--):null!==p&&(p.add(1),k.add(-1)))}return A&&(o.resize(S),_.resize(S),A>0&&(o.add(A),_.add(0)),a.setAttributeStreamRef(0,u),a.setPathFlagsStreamRef(_),a.setPathStreamRef(o),null!==p&&(a.updateCurveCounter(N),a.setSegmentData(k,b,p,y)),a.notifyModifiedFlags(65535)),{geometry:s,as:h,bs:f}}function Z(e,n){2!==n.currentToken()&&t("failed to parse multipoint: array of vertices is expected");let r=0;const i=new P,s=v(2,0);let a=0;const o=4,u=l(o,Number.NaN),c=new m;let d=null,_=null;for(;4!==n.nextToken();){for(2!==n.currentToken()&&t("failed to parse multipoint: array is expected, multipoint vertices consist of arrays of cooridinates"),a=0;4!==n.nextToken();)a===o&&t("failed to parse multipoint: each vertex array has to have at most 4 elements"),u[a++]=$(n);a<2&&t("failed to parse multipoint: each vertex array has to have at least 2 elements"),D(u[0],u[1])||t("failed to parse multipoint: x and y must be finite"),s.size()===2*r&&s.resize(ne(r)),s.writePoint2D(2*r,c.setCoords(u[0],u[1])),d&&d.size()===r&&d.resize(re(r)),a>2?(d||(d=v(r+1,Number.NaN)),d.write(r,u[2])):d&&d.write(r,Number.NaN),_&&_.size()===r&&_.resize(re(r)),a>3?(_||(_=v(r+1,Number.NaN)),_.write(r,u[3])):_&&_.write(r,Number.NaN),r++}if(r){const e=i.getImpl();e.setAttributeStreamRef(0,s),e.resizeNoInit(r),e.notifyModifiedFlags(65535)}return{geometry:i,as:d,bs:_}}function H(e,n){2!==n.currentToken()&&t("failed to parse array of IDs: array of array of integers is expected");const r=F(2,0);let i=0,s=-1;for(;4!==n.nextToken();){const e=i;r.size()===i&&r.resize(re(i)),i++;let a=0;for(-1===s?s=2===n.currentToken()?1:0:1===s&&2!==n.currentToken()&&t("failed to parse array of IDs: array of array of integers is expected"),0===s&&(r.size()===i&&r.resize(re(i)),r.write(i,ee(n)),a++,i++);4!==n.nextToken();)r.size()===i&&r.resize(re(i)),r.write(i,ee(n)),a++,i++;if(r.write(e,a),0===s)break}return r.resize(i),r}function $(e){const t=e.currentToken();if(10===t||6===t&&"NaN"===e.currentString())return Number.NaN;{const t=e.currentDoubleValue();return Number.isNaN(t)?Number.NaN:t}}function ee(e){return e.currentInt32Value()}function te(t,n){if(t.isEmpty())return;const r=F(2,0),i=t.getGeometryType();let s=0;i===P.type?s=1:i===E.type||i===I.type?s=t.getPathCount():e("not implemented"),r.resize(t.getPointCount(),0);let a=0;for(let o=0;o<s;++o){const s=n.read(a);a++;const u=a+s;let m=0,l=0;i===P.type?m=t.getPointCount():i===E.type||i===I.type?(m=t.getPathSize(o),l=t.getPathStart(o)):e("not implemented");for(let e=0,t=Math.min(s,m);e<t;++e)r.write(l,n.read(a)),a++,l++;a=u}t.getImpl().setAttributeStreamRef(3,r)}function ne(e){let t=2*Math.trunc(3*(e+1)/2);return t<8?t=8:t<32&&(t=32),t}function re(e){let t=Math.trunc(3*(e+1)/2);return t<4?t=4:t<16&&(t=16),t}function ie(e,t,n,i,s){s>=i.size()&&r("Byte_buffer out of range access"),e.m_bits=0,e.m_rotation=0,e.m_cosr=1,e.m_sinr=0,e.setStartXY(t),e.setEndXY(n);const a=m.getNAN();a.x=i.readDouble(s),a.y=i.readDouble(s+8);const o=i.readInt32(s+16);if(!!(1&o))return e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.assign(a),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,V(e),!1;let u=!!(64&o);const l=!!(128&o);let c=!!(32&o);const d=!!(8&o),_=!!(16&o),h=t.equals(n);return u&&!h&&(u=!1,c=!0),c&&h&&(u=!0,c=!1,a.setCoords(0,0)),u||(l?c?(e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_interior.assign(a),e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0):(e.constructCircularArcThreePoint(t,n,a),h&&d===e.isClockwise()&&e.reverse()):c?(e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,V(e),e.queryCoord2D(.5,e.m_interior)):M(e,t,n,a,d,_)),u&&(e.m_center.assign(t),e.m_startAngle=a.x,e.m_sweepAngle=a.y,R(e,Number.NaN,d,_),e.m_semiMajorAxis=0,e.m_minorMajorRatio=1,e.m_interior.setCoordsPoint2D(t)),e.setProjectionBehavior(0),V(e),!0}function se(e,t,n,r,i){e.m_bits=0,e.m_center.x=r.readDouble(i),e.m_center.y=r.readDouble(i+8),e.m_rotation=r.readDouble(i+16),e.m_semiMajorAxis=r.readDouble(i+24),e.m_minorMajorRatio=r.readDouble(i+32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y;const s=r.readInt32(i+40);if(1&s)return!1;let a=!!(64&s),o=!!(128&s);const u=!!(2048&s),m=!!(4096&s);return!!!(512&s)&&!!!(1024&s)||o||(a=!0),o&&!t.equals(n)?(o=!1,a=!0):a&&t.equals(n)&&(o=!0,a=!1),o?(e.m_center.assign(t),e.m_startAngle=e.m_center.x,e.m_sweepAngle=e.m_center.y,R(e,Number.NaN,u,m),e.m_semiMajorAxis=0,e.m_interior.setCoordsPoint2D(t)):a?(e.m_center.setNAN(),e.m_semiMajorAxis=1,e.m_minorMajorRatio=0,e.m_center.setNAN(),e.m_sweepAngle=0,e.m_startAngle=0,V(e),e.queryCoord2D(.5,e.m_interior)):e.constructEllipticArcEndPointsCenter(t,n,e.m_semiMajorAxis,e.m_minorMajorRatio,e.m_rotation,!m,u,e.m_center),e.setProjectionBehavior(1),V(e),!0}function ae(e,t,r,i,s){return n(s+32<=i.size()),e.m_cp=_(m,2),e.m_cp[0].x=i.readDouble(s),e.m_cp[0].y=i.readDouble(s+8),e.m_cp[1].x=i.readDouble(s+16),e.m_cp[1].y=i.readDouble(s+24),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=r.x,e.m_YEnd=r.y,!0}function oe(e,t,n,r,i){return e.m_cp.x=r.readDouble(i),e.m_cp.y=r.readDouble(i+8),e.m_weights[0]=r.readDouble(i+16),e.m_weights[1]=r.readDouble(i+24),e.m_weights[2]=r.readDouble(i+32),e.m_XStart=t.x,e.m_YStart=t.y,e.m_XEnd=n.x,e.m_YEnd=n.y,!0}function ue(e,n,r,i,s){const a={segFlag:0,toPointSz:0};let o=i.currentToken();o=i.nextToken();const u=i.currentString(),l=u[0];for((1!==u.length||"a"!==l&&"b"!==l&&"c"!==l&&"n"!==l&&"q"!==l)&&t('failed to parse curve: expecting "a", "b", "n", "q", or "c"'),o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for curve parameters"),o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for to point"),a.toPointSz=0;4!==i.nextToken();)4===a.toPointSz&&t("failed to parse curve: vertex array cannot have more than 4 elements"),n[a.toPointSz++]=$(i);a.toPointSz<2&&t("failed to parse curve: vertex array must have at least 2 elements");const c=m.construct(n[0],n[1]),d=m.getNAN();let _=-1,h=-1,f=!1,p=Number.NaN,k=Number.NaN,b=Number.NaN;const y=[m.getNAN(),m.getNAN(),m.getNAN()],N=m.getNAN();if("a"===l){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for center point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for center point"),d.setCoords(e,n),o=i.nextToken(),_=i.currentInt32Value(),o=i.nextToken(),h=i.currentInt32Value(),o=i.nextToken(),4!==o?(f=!1,p=$(i),o=i.nextToken(),k=$(i),o=i.nextToken(),b=$(i),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters")):f=!0,a.segFlag=4}else if("b"===l){for(let e=0;e<2;e++){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[e].setCoords(n,r)}o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=2}else if("n"===l){{o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[0].setCoords(e,n)}o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);y[1].setCoords(e,n),y[2].setCoords(r,r),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=8}else if("q"===l){for(let e=0;e<1;e++){o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for control point"),o=i.nextToken();const n=$(i);o=i.nextToken();const r=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for control point"),y[e].setCoords(n,r)}o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=16}else{o=i.nextToken(),2!==o&&t("failed to parse curve: start array is expected for interior point"),o=i.nextToken();const e=$(i);o=i.nextToken();const n=$(i);o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for interior point"),N.setCoords(e,n),o=i.nextToken(),4!==o&&t("failed to parse curve: end array is expected for curve parameters"),a.segFlag=4}if(o=i.nextToken(),3!==o&&t("failed to parse curve: end object is expected for curve"),"a"===l)if(e.createEllipticArc(),f){const t=!0;me(e.get(),r,c,d,t,_,h)}else le(e.get(),r,c,d,_,h,p,k,b);else if("b"===l)e.createCubicBezier(),ce(e.get(),r,c,y);else if("n"===l)e.createQuadraticRationalBezier(),de(e.get(),r,c,y[0],y[1].x,y[1].y,y[2].x);else if("q"===l)e.createQuadraticBezier(),e.get().construct(r,y[0],c);else{e.createEllipticArc();const t=!1;me(e.get(),r,c,N,t,-1,-1)}return a}function me(e,t,n,r,i,s,a){e.dropAllAttributes();const o=20,u=new ArrayBuffer(o),m=new G({sz:o,buffer:u});let l=0;m.writeDouble(l,r.x),l+=8,m.writeDouble(l,r.y),l+=8;let c=0;i?(a||(c|=8),s&&(c|=16)):c|=128,m.writeInt32(l,c),l+=4,ie(e,t,n,m,0)}function le(e,t,n,r,i,s,a,o,u){e.dropAllAttributes();const m=44,l=new ArrayBuffer(m),c=new G({sz:m,buffer:l});let d=0;c.writeDouble(d,r.x),d+=8,c.writeDouble(d,r.y),d+=8,c.writeDouble(d,a),d+=8,c.writeDouble(d,o),d+=8,c.writeDouble(d,u),d+=8;let _=0;s||(_|=2048),i&&(_|=4096),c.writeInt32(d,_),d+=4,se(e,t,n,c,0)}function ce(e,t,n,r){e.dropAllAttributes();const i=32,s=new ArrayBuffer(i),a=new G({sz:i,buffer:s});let o=0;a.writeDouble(o,r[0].x),o+=8,a.writeDouble(o,r[0].y),o+=8,a.writeDouble(o,r[1].x),o+=8,a.writeDouble(o,r[1].y),o+=8,ae(e,t,n,a,0)}function de(e,t,n,r,i,s,a){e.dropAllAttributes();const o=40,u=new ArrayBuffer(o),m=new G({sz:o,buffer:u});let l=0;m.writeDouble(l,r.x),l+=8,m.writeDouble(l,r.y),l+=8,m.writeDouble(l,i),l+=8,m.writeDouble(l,s),l+=8,m.writeDouble(l,a),l+=8,oe(e,t,n,m,0)}function _e(e,t,n,r,i){const o=e.getGeometryType();if(o===s.enumEllipticArc)return he(e,t,n,r,i);if(o===s.enumBezier)return fe(e,t,n,r,i);if(o===s.enumRationalBezier2)return pe(e,t,n,r,i);if(o===s.enumBezier2){const s=new z;return s.constructFromQuadraticSegment(e),fe(s,t,n,r,i)}a("")}function he(e,t,r,i,s){n(!O(e));const a=e.getEndXY(),o=e.hasAttribute(1)&&!t,u=e.hasAttribute(2)&&!r;let m=Number.NaN,l=Number.NaN;if(o&&(m=e.getEndAttributeAsDbl(1,0)),u&&(l=e.getEndAttributeAsDbl(2,0)),e.isDegenerateToLine()||e.isDegenerate(0))return ke(o,u,a.x,a.y,m,l,i,s),!0;const c=0===e.projectionBehavior(),d=!!c&&e.isClosed();if(c&&!d)s.startObject(),s.addFieldName("c"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s),be(e.m_interior.x,e.m_interior.y,17,s),s.endArray(),s.endObject();else if(c){s.startObject(),s.addFieldName("a"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s);const t=0,n=0;be(e.m_center.x+t,e.m_center.y+n,17,s);const r=!e.isMajor();s.addInt32(r?1:0);const c=e.isClockwise();s.addInt32(c?1:0),s.endArray(),s.endObject()}else{s.startObject(),s.addFieldName("a"),s.startArray(),ke(o,u,a.x,a.y,m,l,i,s);const t=e;be(t.m_center.x,t.m_center.y,17,s);const n=!t.isMajor();s.addInt32(n?1:0);const r=t.isClockwise();s.addInt32(r?1:0),s.addDouble(t.m_rotation,17),s.addDouble(t.m_semiMajorAxis,17),s.addDouble(t.m_minorMajorRatio,17),s.endArray(),s.endObject()}return!1}function fe(e,t,n,r,i){const s=e.getEndXY(),a=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;return a&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("b"),i.startArray(),ke(a,o,s.x,s.y,u,m,r,i),be(e.m_cp[0].x,e.m_cp[0].y,r,i),be(e.m_cp[1].x,e.m_cp[1].y,r,i),i.endArray(),i.endObject(),!1}function pe(e,t,n,r,i){const s=e.getEndXY(),a=e.hasAttribute(1)&&!t,o=e.hasAttribute(2)&&!n;let u=Number.NaN,m=Number.NaN;a&&(u=e.getEndAttributeAsDbl(1,0)),o&&(m=e.getEndAttributeAsDbl(2,0)),i.startObject(),i.addFieldName("n"),i.startArray(),ke(a,o,s.x,s.y,u,m,r,i),be(e.m_cp.x,e.m_cp.y,r,i);const l=r;return i.addDouble(e.m_weights[0],l),i.addDouble(e.m_weights[1],l),i.addDouble(e.m_weights[2],l),i.endArray(),i.endObject(),!1}function ke(e,t,n,r,i,s,a,o){o.startArray(),o.addDouble(n,a),o.addDouble(r,a),e&&o.addDouble(i,a),t&&o.addDouble(s,a),o.endArray()}function be(e,t,n,r){r.startArray(),r.addDouble(e,n),r.addDouble(t,n),r.endArray()}class ye{getOperatorType(){return 10405}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,t,n,r,i,s){Ne(e,t,n,r)}exportSpatialReference(e,t,r,i){n(0)}exportProjectionTransformation(e,t,r,i){n(0)}exportDatumTransformation(e,t,r,i){n(0)}static geometryTypeToString(e){return n(0),""}}function Ne(t,r,i,a,o){if(r||i){if(a.startObject(),null!==r){switch(r.getGeometryType()){case s.enumPolygon:Te(!0,t,r,a);break;case s.enumPolyline:Te(!1,t,r,a);break;case s.enumMultiPoint:ge(t,r,a);break;case s.enumPoint:ve(t,r,a);break;case s.enumEnvelope:xe(t,r,a);break;case s.enumMultipatch:n(0);break;default:e("exportToJSON")}}null!==i&&(a.addFieldName("spatialReference"),Se(t,i,a)),a.endObject()}}function Te(e,t,r,i){const s=r.getImpl(),o=!!(2&t),u=!!(4&t),m=!!(8&t),l=s.hasAttribute(1)&&!o,c=s.hasAttribute(2)&&!u,d=s.hasAttribute(3)&&!m,_=s.hasNonLinearSegments();l&&(i.addFieldName("hasZ"),i.addBool(!0)),c&&(i.addFieldName("hasM"),i.addBool(!0)),e?_?i.addFieldName("curveRings"):i.addFieldName("rings"):_?i.addFieldName("curvePaths"):i.addFieldName("paths");let h=null;const f=[];if(r.isEmpty())i.startArray(),i.endArray();else{const e=17-(31&t>>13);i.startArray();const n=r.getPathCount();let m=0;const p=s.getAttributeStreamRef(0);let k=null,b=null,y=null;const N=new B;let T=null,g=null,v=null;_&&(T=s.getSegmentFlagsStreamRef(),g=s.getSegmentIndexStreamRef(),v=s.getSegmentDataStreamRef()),l&&(k=s.getAttributeStreamRef(1)),c&&(b=s.getAttributeStreamRef(2)),d&&(y=s.getAttributeStreamRef(3),h=j(3,0));for(let t=0;t<n;t++){i.startArray(),d&&f.push(0);const n=r.getPathEnd(t);if(m===n){i.endArray();continue}const s=r.isClosedPath(t);let _=p.read(2*m),x=p.read(2*m+1),A=l?k.read(m):Number.NaN,S=c?b.read(m):Number.NaN,w=d?y.read(m):0;we(l,c,_,x,A,S,e,i);let C=1;d&&(h.add(w),f[f.length-1]++);const D=_,F=x,j=A,z=S,O=w;let I=!1,E=0,B=Number.NaN,P=Number.NaN,V=0;for(let t=m+1,r=m,M=s?n+1:n;t<M;t++,r++){const s=null!==T?31&T.read(r):1;let m,M;if(t<n?(m=p.read(2*t),M=p.read(2*t+1),l&&(B=k.read(t)),c&&(P=b.read(t)),d&&(V=y.read(t))):(m=D,M=F,B=j,P=z,V=O),1!==s){I=!0,4===s?N.createEllipticArc():2===s?N.createCubicBezier():16===s?N.createQuadraticBezier():8===s?N.createQuadraticRationalBezier():a("JSON export.unsupported curve");const t=N.get(),n=g.read(r);t.setStartXYCoords(_,x),t.setEndXYCoords(m,M),l&&(t.setStartAttribute(1,0,A),t.setEndAttribute(1,0,B)),c&&(t.setStartAttribute(2,0,S),t.setEndAttribute(2,0,P)),t.readFromBufferStream(v,n);_e(N.get(),o,u,e,i)&&E++}else we(l,c,m,M,B,P,e,i);d&&(h.add(V),f[f.length-1]++),C++,_=m,x=M,A=B,S=P,w=V}I&&0===E||(C<2&&E<1&&(we(l,c,_,x,A,S,e,i),C++,d&&(h.add(w),f[f.length-1]++)),s&&C<3&&E<2&&(we(l,c,D,F,j,z,e,i),C++,_=D,x=F,A=j,S=z,w=O,d&&(h.add(O),f[f.length-1]++))),i.endArray(),m=n}i.endArray()}if(d){i.addFieldName("ids"),i.startArray();let e=0;for(let t=0,r=f.length;t<r;++t){const r=f[t];n(0===r||null!==h&&e+r<=h.size()),i.startArray();for(let t=0;t<r;++t)i.addInt32(h.read(e)),e++;i.endArray()}i.endArray()}}function ge(e,t,r){const i=t.getImpl(),s=i.hasAttribute(1)&&!(2&e),a=i.hasAttribute(2)&&!(4&e),o=i.hasAttribute(3)&&!(8&e);s&&(r.addFieldName("hasZ"),r.addBool(!0)),a&&(r.addFieldName("hasM"),r.addBool(!0)),r.addFieldName("points");const u=t.getPointCount();if(t.isEmpty())r.startArray(),r.endArray();else{const t=17-(31&e>>13);r.startArray();const n=i.getAttributeStreamRef(0);let o=null,m=null;s&&(o=i.getAttributeStreamRef(1)),a&&(m=i.getAttributeStreamRef(2));for(let e=0;e<u;e++){const i=n.read(2*e),u=n.read(2*e+1);let l=Number.NaN,c=Number.NaN;s&&(l=o.read(e)),a&&(c=m.read(e)),we(s,a,i,u,l,c,t,r)}r.endArray()}if(o){let e=null;i.isEmpty()||(e=i.getAttributeStreamRef(3)),n(0===u||null!==e&&e.size()>=u),r.addFieldName("ids"),r.startArray();for(let t=0;t<u;t++)r.addInt32(e.read(t));r.endArray()}}function ve(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),s=t.hasAttribute(3)&&!(8&e);if(t.isEmpty())return n.addFieldName("x"),n.addNull(),n.addFieldName("y"),n.addNull(),r&&(n.addFieldName("z"),n.addNull()),i&&(n.addFieldName("m"),n.addNull()),void(s&&(n.addFieldName("id"),n.addInt32(0)));const a=17-(31&e>>13);n.addFieldName("x"),n.addDouble(t.getX(),a),n.addFieldName("y"),n.addDouble(t.getY(),a),r&&(n.addFieldName("z"),n.addDouble(t.getZ(),a)),i&&(n.addFieldName("m"),n.addDouble(t.getM(),a)),s&&(n.addFieldName("id"),n.addInt32(t.getID()))}function xe(e,t,n){const r=t.hasAttribute(1)&&!(2&e),i=t.hasAttribute(2)&&!(4&e),s=t.hasAttribute(3)&&!(8&e);if(t.isEmpty())return n.addFieldName("xmin"),n.addNull(),n.addFieldName("ymin"),n.addNull(),n.addFieldName("xmax"),n.addNull(),n.addFieldName("ymax"),n.addNull(),r&&(n.addFieldName("zmin"),n.addNull(),n.addFieldName("zmax"),n.addNull()),i&&(n.addFieldName("mmin"),n.addNull(),n.addFieldName("mmax"),n.addNull()),void(s&&(n.addFieldName("idmin"),n.addInt32(0),n.addFieldName("idmax"),n.addInt32(0)));const a=17-(31&e>>13);if(n.addFieldName("xmin"),n.addDouble(t.getXMin(),a),n.addFieldName("ymin"),n.addDouble(t.getYMin(),a),n.addFieldName("xmax"),n.addDouble(t.getXMax(),a),n.addFieldName("ymax"),n.addDouble(t.getYMax(),a),r){const e=t.queryInterval(1,0);n.addFieldName("zmin"),n.addDouble(e.vmin,a),n.addFieldName("zmax"),n.addDouble(e.vmax,a)}if(i){const e=t.queryInterval(2,0);n.addFieldName("mmin"),n.addDouble(e.vmin,a),n.addFieldName("mmax"),n.addDouble(e.vmax,a)}if(s){const e=t.queryInterval(3,0);n.addFieldName("idmin"),n.addInt32(e.vmin),n.addFieldName("idmax"),n.addInt32(e.vmax)}}function Ae(e,n,r){r.startObject();const i=n.getID();i<=0&&t("cannot export unit that has no valid WKID"),r.addFieldName("uwkid"),r.addInt32(i),r.endObject()}function Se(e,t,n){n.startObject();let r=0;t.isCustomWkid()||(r=t.getOldID());let i=0;const s=t.getVCS();if(null!==s&&(s.isCustomWkid()||(i=s.getOldID()),i<=0&&(r=0)),r>0){n.addFieldName("wkid"),n.addInt32(r);const e=t.getLatestID();if(e>0&&e!==r&&(n.addFieldName("latestWkid"),n.addInt32(e)),i>0){n.addFieldName("vcsWkid"),n.addInt32(i);const e=t.getLatestVerticalID();e!==i&&(n.addFieldName("latestVcsWkid"),n.addInt32(e))}}if(0===t.getCoordinateSystemType())n.addFieldName("wkid"),n.addNull(),null!==t.getUnit()&&(n.addFieldName("unit"),Ae(e,t.getUnit(),n));else if(r<=0||1&e){let r="";64&e&&(r=t.getText2(),n.addFieldName("wkt2"),n.addString(r));const i=t.getText();i!==r&&(n.addFieldName("wkt"),n.addString(i))}if(16&e){const e=new T;t.queryPrecisionDescriptor(e),n.addFieldName("xyTolerance"),n.addDouble(e.getTolerance(0)),n.addFieldName("zTolerance"),n.addDouble(e.getTolerance(1)),n.addFieldName("mTolerance"),n.addDouble(e.getTolerance(2)),n.addFieldName("falseX"),n.addDouble(e.getFalseX()),n.addFieldName("falseY"),n.addDouble(e.getFalseY()),n.addFieldName("xyUnits"),n.addDouble(e.getGridUnitsXY()),n.addFieldName("falseZ"),n.addDouble(e.getFalseZ()),n.addFieldName("zUnits"),n.addDouble(e.getGridUnitsZ()),n.addFieldName("falseM"),n.addDouble(e.getFalseM()),n.addFieldName("mUnits"),n.addDouble(e.getGridUnitsM())}n.endObject()}function we(e,t,n,r,i,s,a,o){o.startArray(),o.addDouble(n,a),o.addDouble(r,a),e&&o.addDouble(i,a),t&&o.addDouble(s,a),o.endArray()}const Ce={s_a:"a".charCodeAt(0),s_A:"A".charCodeAt(0),s_asterisk:"*".charCodeAt(0),s_b:"b".charCodeAt(0),s_backspace:"\b".charCodeAt(0),s_backslash:"\\".charCodeAt(0),s_beginArray:"[".charCodeAt(0),s_beginObject:"{".charCodeAt(0),s_colon:":".charCodeAt(0),s_period:".".charCodeAt(0),s_comma:",".charCodeAt(0),s_doubleQuote:'"'.charCodeAt(0),s_endArray:"]".charCodeAt(0),s_endObject:"}".charCodeAt(0),s_e:"e".charCodeAt(0),s_E:"E".charCodeAt(0),s_f:"f".charCodeAt(0),s_formfeed:"\f".charCodeAt(0),s_F:"F".charCodeAt(0),s_forwardslash:"/".charCodeAt(0),s_lt:"<".charCodeAt(0),s_minus:"-".charCodeAt(0),s_plus:"+".charCodeAt(0),s_n:"n".charCodeAt(0),s_N:"N".charCodeAt(0),s_newline:"\n".charCodeAt(0),s_r:"r".charCodeAt(0),s_carriageReturn:"\r".charCodeAt(0),s_t:"t".charCodeAt(0),s_tab:"\t".charCodeAt(0),s_u:"u".charCodeAt(0),s_zero:"0".charCodeAt(0),s_nine:"9".charCodeAt(0)};class De{constructor(t){this.m_functionStack=[],this.m_pushPositions=[],this.m_utf8Decoder=new TextDecoder("utf-8",{fatal:!0}),void 0===t?(this.m_startToken=Number.MAX_SAFE_INTEGER,this.m_endToken=0,this.m_currentTokenType=0,this.m_functionStack.push((()=>this.accept_())),this.m_jsonString=null,this.m_bHasEscapes=!1):t.jsonString?this.resetParserFromString(t.jsonString):t.jsonStream?a("streaming json parsing not yet impl"):e("invalid constructor parameter")}prepSubstrString_(){}getCurrentSubstrString_(){return this.m_jsonString.slice(this.m_startToken,this.m_endToken)}stepOverCharString_(){this.m_endToken++}peekCharString_(){return this.m_jsonString.charCodeAt(this.m_endToken)}getString_(e){const t=this.m_jsonString?.slice(this.m_startToken,this.m_startToken+e-1);this.m_endToken+=e-1;return{s:t,bDone:this.m_endToken>=this.m_jsonString.length}}incrementString_(){this.m_endToken++}eofString_(){return this.m_endToken>=this.m_jsonString.length}setStringFunctions_(){this.m_prepSubstr=this.prepSubstrString_,this.m_getCurrentSubstr=this.getCurrentSubstrString_,this.m_stepOverChar=this.stepOverCharString_,this.m_peekChar=this.peekCharString_,this.m_get=this.getString_,this.m_increment=this.incrementString_,this.m_eof=this.eofString_}setStreamFunctions_(){a("streaming json parsing not yet impl")}reset_(){this.m_jsonString=null,this.m_endToken=0,this.m_startToken=Number.MAX_SAFE_INTEGER,this.m_currentTokenType=0,this.m_bHasEscapes=!1,this.m_functionStack.length=0,this.m_functionStack.push((()=>this.start_())),this.m_pushPositions.length=0}resetParserFromString(e){this.reset_(),this.setStringFunctions_(),this.m_jsonString=e}resetParserFromStream(e){a("streaming json parsing not yet impl")}resetToPosition(e){return!!this.m_jsonString&&(this.m_endToken=e,this.m_startToken=Number.MAX_VALUE,this.m_currentTokenType=0,this.m_functionStack.length=0,e>=this.m_jsonString.length?(this.m_functionStack.push((()=>this.accept_())),!1):(this.m_functionStack.push((()=>this.start_())),!0))}nextToken(){return this.m_functionStack.at(-1)(),this.m_currentTokenType}currentToken(){return this.m_currentTokenType}currentTokenStartIndex(){return this.m_startToken}currentTokenEndIndex(){return this.m_endToken}currentText(){return n(0),""}childrenAsString(){return n(0),""}skipChildren(){this.skipChildren_()}skipChildren_(){if(1!==this.m_currentTokenType)if(2!==this.m_currentTokenType);else{let e=1;do{this.m_currentTokenType=this.nextToken(),2===this.m_currentTokenType?e++:4===this.m_currentTokenType&&e--}while(4!==this.m_currentTokenType||0!==e)}else{let e=1;do{this.m_currentTokenType=this.nextToken(),1===this.m_currentTokenType?e++:3===this.m_currentTokenType&&e--}while(3!==this.m_currentTokenType||0!==e)}}currentTerminalAsString_(){switch(this.m_currentTokenType){case 7:case 8:case 9:return this.m_getCurrentSubstr().slice(0,this.m_endToken-this.m_startToken);case 10:return"null";case 11:return"true";case 12:return"false"}t("invalid token")}toUTF8_(e,t){let n=0,r=e;for(;t.charCodeAt(r)===Ce.s_backslash&&t.charCodeAt(r+1)===Ce.s_u;)n++,r+=6;r=e;const i=new Uint8Array(n);let s=0;for(;t.charCodeAt(r)===Ce.s_backslash&&t.charCodeAt(r+1)===Ce.s_u;)i[s++]=Number.parseInt(t.slice(r+2,r+6),16),r+=6;return{u8s:this.m_utf8Decoder.decode(i),end:r}}unquoteCurrentString_(){let e="",t=1;const n=this.m_endToken-this.m_startToken-1;let r=0;const i=this.m_getCurrentSubstr();for(let s=t;s<n;s++)if(i.charCodeAt(s)!==Ce.s_backslash)r++;else{switch(r>0&&(e+=i.slice(t,t+r)),i.charCodeAt(++s)){case Ce.s_doubleQuote:e+='"';break;case Ce.s_u:{const{u8s:t,end:n}=this.toUTF8_(s-1,i);s=n-1,e+=t;break}case Ce.s_backslash:e+="\\";break;case Ce.s_forwardslash:e+="/";break;case Ce.s_b:e+="\b";break;case Ce.s_f:e+="\f";break;case Ce.s_n:e+="\n";break;case Ce.s_r:e+="\r";break;case Ce.s_t:e+="\t"}t=s+1,r=0}return r>0&&(e+=i.slice(t,t+r)),e}currentString(){if(5!==this.m_currentTokenType&&6!==this.m_currentTokenType)return this.currentTerminalAsString_();if(this.m_bHasEscapes)return this.unquoteCurrentString_();return this.m_getCurrentSubstr().slice(1,this.m_endToken-this.m_startToken-2+1)}currentDoubleValue(){if(7!==this.m_currentTokenType&&8!==this.m_currentTokenType&&9!==this.m_currentTokenType&&6!==this.m_currentTokenType&&10!==this.m_currentTokenType&&t("invalid token"),10===this.m_currentTokenType)return Number.NaN;let e=this.m_getCurrentSubstr(),n=this.m_endToken-this.m_startToken;if(6===this.m_currentTokenType){if("NaN"===this.currentString())return Number.NaN;e=e.slice(1),n-=2,0===n&&t("invalid token")}const r=Number.parseFloat(e);if(6===this.m_currentTokenType)Number.isNaN(r)&&t("invalid token");else if(Number.isNaN(r))return Number.NaN;return r}currentInt32Value(){8!==this.m_currentTokenType&&6!==this.m_currentTokenType&&t("invalid token");let e=this.m_getCurrentSubstr(),n=this.m_endToken-this.m_startToken;6===this.m_currentTokenType&&(e=e.slice(1),n-=2,0===n&&t("invalid token"));const r=parseInt(e);return Number.isNaN(r)&&t("invalid token"),r}currentInt64Value(){return n(0),0n}currentBoolValue(){return n(0),!1}isError(){return 0}JSONString(){return n(0),""}pushPosition(){return n(0),!1}popPosition(){return n(0),!1}skipCStyleComments_(){n(0)}skipCppStyleComments_(){n(0)}skipComments_(){this.m_prepSubstr();let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e===Ce.s_asterisk?this.skipCStyleComments_():e===Ce.s_forwardslash?this.skipCppStyleComments_():t("invalid token")}skipWhiteSpace_(){let e;do{this.m_eof()&&t("invalid token");let n=this.m_peekChar();for(;n>=9&&n<=13||32===n;)this.m_increment(),this.m_eof()&&t("invalid token"),n=this.m_peekChar();n===Ce.s_forwardslash?(this.m_startToken=this.m_endToken,e=!0,this.skipComments_()):e=!1}while(e)}rightBracket_(){return this.m_peekChar()===Ce.s_endArray&&(this.m_startToken=this.m_endToken,this.m_increment(),this.m_currentTokenType=4,!0)}rightBrace_(){return this.m_peekChar()===Ce.s_endObject&&(this.m_startToken=this.m_endToken,this.m_increment(),this.m_currentTokenType=3,!0)}string_(){this.m_prepSubstr(),this.m_bHasEscapes=!1,this.m_stepOverChar(),this.m_eof()&&t("invalid token");let e=this.m_peekChar();for(;e!==Ce.s_doubleQuote;){const n=e===Ce.s_backslash;if(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),n)if(this.m_bHasEscapes=!0,e===Ce.s_doubleQuote||e===Ce.s_backslash||e===Ce.s_forwardslash||e===Ce.s_b||e===Ce.s_f||e===Ce.s_n||e===Ce.s_r||e===Ce.s_t)this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar();else if(e===Ce.s_u)for(let r=0;r<4;r++)this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e>=Ce.s_zero&&e<=Ce.s_nine||e>=Ce.s_a&&e<=Ce.s_f||e>=Ce.s_A&&e<=Ce.s_F||t("invalid token");else t("invalid token")}this.m_stepOverChar()}comma_(){return this.m_peekChar()===Ce.s_comma&&(this.m_increment(),!0)}colon_(){return this.m_peekChar()===Ce.s_colon&&(this.m_increment(),!0)}fieldNameEnd_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.colon_()?(this.skipWhiteSpace_(),this.value_()):t("invalid token")}fieldNameStart_(){this.m_startToken=this.m_endToken;this.m_peekChar()!==Ce.s_doubleQuote&&t("invalid token"),this.string_(),this.m_currentTokenType=5,this.m_functionStack.push((()=>this.fieldNameEnd_()))}pairEnd_(){this.skipWhiteSpace_(),this.comma_()?(this.skipWhiteSpace_(),this.fieldNameStart_()):this.rightBrace_()?this.m_functionStack.pop():t("invalid token")}arrayStart_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.rightBracket_()||(this.m_functionStack.push((()=>this.elementEnd_())),this.value_())}elementEnd_(){this.skipWhiteSpace_(),this.comma_()?(this.skipWhiteSpace_(),this.value_()):this.rightBracket_()?this.m_functionStack.pop():t("invalid token")}objectStart_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.rightBrace_()||(this.m_functionStack.push((()=>this.pairEnd_())),this.fieldNameStart_())}valueStartObject_(){this.m_increment(),this.m_currentTokenType=1,this.m_functionStack.push((()=>this.objectStart_()))}valueStartArray_(){this.m_increment(),this.m_currentTokenType=2,this.m_functionStack.push((()=>this.arrayStart_()))}valueString_(){this.string_(),this.m_currentTokenType=6}int_(){this.m_peekChar()!==Ce.s_zero?this.digits_():this.m_stepOverChar()}digits_(){let e=this.m_peekChar();do{this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar()}while(e>=Ce.s_zero&&e<=Ce.s_nine)}frac_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e>=Ce.s_zero&&e<=Ce.s_nine||t("invalid token"),this.digits_()}exp_(){let e=this.m_peekChar();this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar(),e!==Ce.s_plus&&e!==Ce.s_minus||(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),e=this.m_peekChar()),e>=Ce.s_zero&&e<=Ce.s_nine||t("invalid token"),this.digits_()}valueNumber_(){this.m_prepSubstr();let e=!1,n=this.m_peekChar();if(n===Ce.s_minus?(this.m_stepOverChar(),this.m_eof()&&t("invalid token"),n=this.m_peekChar(),e=!0,n>=Ce.s_zero&&n<=Ce.s_nine||t("invalid token"),this.int_()):this.int_(),n=this.m_peekChar(),n===Ce.s_period)this.m_currentTokenType=7,this.frac_(),n=this.m_peekChar(),n!==Ce.s_e&&n!==Ce.s_E||this.exp_();else if(n===Ce.s_e||n===Ce.s_E)this.m_currentTokenType=7,this.exp_();else{let t=0;e&&t++;const n=this.m_endToken-this.m_startToken-t;if(n<10)this.m_currentTokenType=8;else if(10===n){const n=this.m_getCurrentSubstr();e?n.slice(t)<="2147483648"?this.m_currentTokenType=8:this.m_currentTokenType=9:n.slice(t)<="2147483647"?this.m_currentTokenType=8:this.m_currentTokenType=9}else if(n<19)this.m_currentTokenType=9;else if(19===n){const n=this.m_getCurrentSubstr();e?n.slice(t)<="9223372036854775808"?this.m_currentTokenType=9:this.m_currentTokenType=7:n.slice(t)<="9223372036854775807"?this.m_currentTokenType=9:this.m_currentTokenType=7}else this.m_currentTokenType=7}}valueNull_(){const{s:e,bDone:n}=this.m_get(5);n&&t("invalid token"),"null"!==e&&t("invalid token"),this.m_currentTokenType=10}valueTrue_(){const{s:e,bDone:n}=this.m_get(5);n&&t("invalid token"),"true"!==e&&t("invalid token"),this.m_currentTokenType=11}valueFalse_(){const{s:e,bDone:n}=this.m_get(6);n&&t("invalid token"),"false"!==e&&t("invalid token"),this.m_currentTokenType=12}valueNan_(){const{s:e,bDone:n}=this.m_get(4);n&&t("invalid token"),"NaN"!==e&&t("invalid token"),this.m_currentTokenType=7}value_(){this.m_startToken=this.m_endToken;const e=this.m_peekChar();e===Ce.s_beginObject?this.valueStartObject_():e===Ce.s_beginArray?this.valueStartArray_():e===Ce.s_doubleQuote?this.valueString_():e===Ce.s_minus||e>=Ce.s_zero&&e<=Ce.s_zero+9?this.valueNumber_():e===Ce.s_n?this.valueNull_():e===Ce.s_t?this.valueTrue_():e===Ce.s_f?this.valueFalse_():e===Ce.s_N?this.valueNan_():t("invalid token")}start_(){this.skipWhiteSpace_(),this.m_functionStack.pop(),this.m_functionStack.push((()=>this.accept_()));const e=this.m_peekChar();e!==Ce.s_beginObject&&e!==Ce.s_beginArray&&t("invalid token"),this.value_()}accept_(){this.m_startToken=this.m_endToken,this.m_currentTokenType=0}}class Fe{getOperatorType(){return 10404}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}supportsCurves(){return!0}execute(e,n,r,i,s,a,o){let u;"string"==typeof r?(u=new De({jsonString:r}),u.nextToken()):u=r,1!==u.currentToken()&&t("failed to import map geometry: start of object is expected");const m=K(n,e,u,i,s);return new g(m)}importProjectionTransformation(e,t){return n(0),{}}importDatumTransformation(e,t){return n(0),{}}static stringToGeometryType(e){return(e=e.toLowerCase()).startsWith("esrigeometry")||t("string_to_geometry_type"),e.endsWith("point")?s.enumPoint:e.endsWith("envelope")?s.enumEnvelope:e.endsWith("multipoint")?s.enumMultiPoint:e.endsWith("polyline")?s.enumPolyline:e.endsWith("polygon")?s.enumPolygon:void t("string_to_geometry_type")}}const je=new Y,ze=new ye,Oe=new Fe;function Ie(e){return Array.isArray(e)?e[0].spatialReference:e.spatialReference}function Ee(e,t){const n=new L(e,{strict:!1});return n.nextToken(),Oe.execute(0,s.enumUnknown,n,!0,t)}function Be(e){let t=null;return[e.map((e=>{if(null==t){const n=Pe(e);return t=n.getSpatialReference(),n.getGeometry()}return Ve(e)})),t]}function Pe(e){return Ee(e,!0)}function Ve(e){return Ee(e,!1).getGeometry()}function Me(e,t){return e instanceof g&&(t=e.getSpatialReference(),e=e.getGeometry()),e?.isEmpty()?null:(je.reset(),ze.execute(0,e,t,je),je.getObject())}export{Be as fromGeometries,Pe as fromGeometry,Ve as fromGeometryToGXGeometry,Ie as getSpatialReference,Me as toGeometry};
package/interfaces.d.ts CHANGED
@@ -24978,6 +24978,28 @@ declare namespace __esri {
24978
24978
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#refresh Read more...}
24979
24979
  */
24980
24980
  refresh(): void;
24981
+ /**
24982
+ * Saves the layer to its existing portal item in the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html Portal}
24983
+ * authenticated within the user's current session.
24984
+ *
24985
+ * @param options Various options for saving the layer.
24986
+ * @param options.ignoreUnsupported Indicates whether to ignore saving unsupported layers or layers with unsupported content, such as unsupported symbology.
24987
+ *
24988
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#save Read more...}
24989
+ */
24990
+ save(options?: MapImageLayerSaveOptions): Promise<PortalItem>;
24991
+ /**
24992
+ * Saves the layer to a new portal item in the {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-portal-Portal.html Portal}
24993
+ * authenticated within the user's current session.
24994
+ *
24995
+ * @param portalItem The portal item to which the layer will be saved.
24996
+ * @param options Various options for saving the layer.
24997
+ * @param options.folder The portal folder where the layer's portal item will be saved.
24998
+ * @param options.ignoreUnsupported Indicates whether to ignore saving unsupported layers or layers with unsupported content, such as unsupported symbology.
24999
+ *
25000
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#saveAs Read more...}
25001
+ */
25002
+ saveAs(portalItem: PortalItemProperties, options?: MapImageLayerSaveAsOptions): Promise<PortalItem>;
24981
25003
  on(name: "refresh", eventHandler: MapImageLayerRefreshEventHandler): IHandle;
24982
25004
  on(name: "layerview-create", eventHandler: MapImageLayerLayerviewCreateEventHandler): IHandle;
24983
25005
  on(name: "layerview-create-error", eventHandler: MapImageLayerLayerviewCreateErrorEventHandler): IHandle;
@@ -25176,6 +25198,15 @@ declare namespace __esri {
25176
25198
  signal?: AbortSignal | nullish;
25177
25199
  }
25178
25200
 
25201
+ export interface MapImageLayerSaveAsOptions {
25202
+ folder?: PortalFolder;
25203
+ ignoreUnsupported?: boolean;
25204
+ }
25205
+
25206
+ export interface MapImageLayerSaveOptions {
25207
+ ignoreUnsupported?: boolean;
25208
+ }
25209
+
25179
25210
  export interface MapImageLayerRefreshEvent {
25180
25211
  dataChanged: boolean;
25181
25212
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.33.0-next.20250501",
3
+ "version": "4.33.0-next.20250502",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -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
- const d="20250501",e="222ee23bb2dda269dadc0d53f5ae7b25ce628788";export{d as buildDate,e as commitHash};
5
+ const b="20250502",e="6d80a9b55a6bf9e6864a4e0cadb7b07b55e1c3ec";export{b as buildDate,e as commitHash};
@@ -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{numericHash as e}from"../../../../../../../core/string.js";function r(r){const t=r.map((({name:e,count:r,type:t})=>`${e}.${r}.${t}`)).join(",");return e(t)}function t(e,r,o,a,c,n,s){if(e.primitiveName===r){let r=a?.readWithDefault(c,n,e[o]&&s);return"text"===e.type&&(r=r.toString()),void(e[o]=r)}if("type"in e&&null!=e.type){if(e.effects)for(const i of e.effects)t(i,r,o,a,c,n,s);switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.symbolLayers)for(const i of e.symbolLayers)t(i,r,o,a,c,n,s);break;case"CIMTextSymbol":e.symbol&&t(e.symbol,r,o,a,c,n,s);break;case"CIMHatchFill":e.lineSymbol&&t(e.lineSymbol,r,o,a,c,n,s);break;case"CIMPictureMarker":case"CIMCharacterMarker":case"CIMVectorMarker":if(e.markerPlacement&&t(e.markerPlacement,r,o,a,c,n,s),"CIMVectorMarker"===e.type&&e.markerGraphics)for(const i of e.markerGraphics)t(i,r,o,a,c,n,s),t(i.symbol,r,o,a,c,n,s)}}}const o=400;function a(e){const r=Math.max(1.25*e.width,20);return null!=e.effects?o:r}export{t as applyComputedValue,a as getLineClippingMargin,r as vertexLayoutHash};
5
+ import{numericHash as e}from"../../../../../../../core/string.js";function t(t){const r=t.map((({name:e,count:t,type:r})=>`${e}.${t}.${r}`)).join(",");return e(r)}function r(e,t,o,a,c,n,s){if(e.primitiveName===t){let t=a?.readWithDefault(c,n,e[o]&&s);return"text"===e.type&&(t=t.toString()),void(e[o]=t)}if("type"in e&&null!=e.type){if(e.effects)for(const i of e.effects)r(i,t,o,a,c,n,s);switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.symbolLayers)for(const i of e.symbolLayers)r(i,t,o,a,c,n,s);break;case"CIMTextSymbol":e.symbol&&r(e.symbol,t,o,a,c,n,s);break;case"CIMHatchFill":e.lineSymbol&&r(e.lineSymbol,t,o,a,c,n,s);break;case"CIMPictureMarker":case"CIMCharacterMarker":case"CIMVectorMarker":if(e.markerPlacement&&r(e.markerPlacement,t,o,a,c,n,s),"CIMVectorMarker"===e.type&&e.markerGraphics)for(const i of e.markerGraphics)r(i,t,o,a,c,n,s),r(i.symbol,t,o,a,c,n,s)}}}const o=400;function a(e){const t=Math.max(1.25*e.width,20);return null!=e.effects&&e.effects.length>0?o:t}export{r as applyComputedValue,a as getLineClippingMargin,t as vertexLayoutHash};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ const e="esri-directions",o={base:e,accordion:`${e}__accordion`,actionContainer:`${e}__action-container`,addStopButton:`${e}__add-stop-button`,departureTime:`${e}__departure-time`,departureTimeOptions:`${e}__departure-time-options`,directionsHeader:`${e}__directions-header`,directionsHeaderStopName:`${e}__directions-header-stop-name`,editRouteButton:`${e}__edit-route-button`,editFooter:`${e}__edit-footer`,editToolbar:`${e}__edit-toolbar`,editToolbarContainer:`${e}__edit-toolbar-container`,flexColumn:`${e}__flex-column`,flexRow:`${e}__flex-row`,folder:`${e}__folder`,folderHome:`${e}__folder-home`,headerStops:`${e}__header-stops`,labelEmphasize:`${e}__label-emphasize`,labelNoBottomMargin:`${e}__label-no-bottom-margin`,marginInlineMedium:`${e}__margin-inline-medium`,optimizeSection:`${e}__optimize-section`,optimizeSwitches:`${e}__optimize-switches`,paddingMedium:`${e}__padding-medium`,primaryFlowItem:`${e}__primary-flow-item`,primaryFooter:`${e}__primary-footer`,primaryFooterCentered:`${e}__primary-footer-centered`,primaryFooterLoader:`${e}__primary-footer-loader`,routeItem:`${e}__route-item`,routeItemButton:`${e}__route-item-button`,routeItemButtonContent:`${e}__route-item-button-content`,routeItemLabel:`${e}__route-item-label`,routeItemDescription:`${e}__route-item-description`,saveError:`${e}__save-error`,saveErrorIcon:`${e}__save-error-icon`,saveErrorLabel:`${e}__save-error-label`,saveProcessLoader:`${e}__save-process-loader`,selectedFeatureContainer:`${e}__selected-feature-container`,separator:`${e}__separator`,solveRoute:`${e}__solve-route`,stopContainer:`${e}__stop-container`,stopList:`${e}__stop-list`,stopItem:`${e}__stop-item`};export{o as css};
@@ -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{_ as e}from"../chunks/tslib.es6.js";import{isSome as t}from"../core/arrayUtils.js";import i from"../core/Collection.js";import{makeHandle as s}from"../core/handleUtils.js";import{destroyMaybe as o}from"../core/maybe.js";import{debounce as r,isAbortError as a}from"../core/promiseUtils.js";import{watch as n,initial as l,on as c}from"../core/reactiveUtils.js";import{escapeRegExpString as d}from"../core/string.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import h from"../portal/Portal.js";import{defaultUnitPropertyMetadata as u}from"../properties/defaultUnit.js";import v from"../rest/support/Stop.js";import _ from"../symbols/SimpleMarkerSymbol.js";import g from"./Search.js";import w from"./Widget.js";import{DirectionsSearchTool as y}from"./Directions/DirectionsSearchTool.js";import b from"./Directions/DirectionsViewModel.js";import f from"./Directions/DirectionsVisibleElements.js";import{formatDistance as S,formatDuration as M,DepartureTimeOption as k,getIconName as I}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as F,meteredArcGISLocatorUrl as T}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as D}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as E}from"./support/decorators/messageBundle.js";import{tsx as $}from"./support/jsxFactory.js";function C(e){const{branchName:i,displayText:s,exitName:o,intersectingName:r,name:a,towardName:n}=e;if(null==s)return null;const l=[i,o,r,a,n].filter(t).sort(((e,t)=>t.length-e.length)).map((e=>d(e)));if(!l.length)return s;const c=new RegExp(l.join("|"),"g"),m=s.matchAll(c);let p=0;const h=[];for(const{0:t,index:d}of m)h.push(s.slice(p,d),$("span",{class:R.labelEmphasize,key:`maneuver-${d}`},t)),p=d+t.length;return h.push(s.slice(p)),$("span",null,h)}const L="esri-directions",R={base:L,accordion:`${L}__accordion`,actionContainer:`${L}__action-container`,addStopButton:`${L}__add-stop-button`,departureTime:`${L}__departure-time`,departureTimeOptions:`${L}__departure-time-options`,directionsHeader:`${L}__directions-header`,directionsHeaderStopName:`${L}__directions-header-stop-name`,editFooter:`${L}__edit-footer`,editToolbar:`${L}__edit-toolbar`,editToolbarContainer:`${L}__edit-toolbar-container`,flexColumn:`${L}__flex-column`,flexRow:`${L}__flex-row`,headerStops:`${L}__header-stops`,labelEmphasize:`${L}__label-emphasize`,labelNoBottomMargin:`${L}__label-no-bottom-margin`,marginInlineMedium:`${L}__margin-inline-medium`,optimizeSection:`${L}__optimize-section`,optimizeSwitches:`${L}__optimize-switches`,paddingMedium:`${L}__padding-medium`,primaryFlowItem:`${L}__primary-flow-item`,primaryFooter:`${L}__primary-footer`,primaryFooterCentered:`${L}__primary-footer-centered`,primaryFooterLoader:`${L}__primary-footer-loader`,routeItem:`${L}__route-item`,routeItemButton:`${L}__route-item-button`,routeItemButtonContent:`${L}__route-item-button-content`,routeItemLabel:`${L}__route-item-label`,routeItemDescription:`${L}__route-item-description`,saveError:`${L}__save-error`,saveErrorIcon:`${L}__save-error-icon`,saveErrorLabel:`${L}__save-error-label`,saveProcessLoader:`${L}__save-process-loader`,selectedFeatureContainer:`${L}__selected-feature-container`,separator:`${L}__separator`,solveRoute:`${L}__solve-route`,stopContainer:`${L}__stop-container`,stopList:`${L}__stop-list`,stopItem:`${L}__stop-item`};let A=class extends w{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new i([new v,new v]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._sections=null,this._stopsToSearches=new Map,this._currentFlowItem="primary",this._parentFlowItem="primary",this._saveState="initialized",this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties=null,this.viewModel=new b,this.visibleElements=new f,this._solveRouteDebounced=r((()=>this._solveRoute()))}initialize(){this.addHandles([n((()=>this.viewModel.layer),(()=>{try{this.viewModel.load()}catch{}}),l),n((()=>this.viewModel.layer?.routeInfo),(()=>{this._sections=this._getStopSections()}),l),n((()=>this.viewModel.layer?.stops.toArray()),(e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)}))])}loadDependencies(){return x({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}destroy(){this._stopsToSearches.forEach(o)}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"right"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){const{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e);return i.view=t,this._overrideDefaultSources(i),i}const i=new g({icon:!1,popupEnabled:!1,resultGraphicEnabled:!1,view:t,...this.searchProperties});return this._normalizeSearchSources(i),this.addHandles([c((()=>i.allSources),"change",(()=>this._normalizeSearchSources(i))),i.on("search-clear",(()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()})),i.on("select-result",(()=>{const t=i.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()})),n((()=>i.searchTerm),(t=>{e.name=t}))],i),this._stopsToSearches.set(e,i),i}getDirections(){return this.viewModel.getDirections()}render(){return $("div",{class:this.classes(R.base,D.widget,D.panel)},$("calcite-flow",null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()))}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_applyLocatorSourceOverrides({allSources:e}){for(const t of e)"url"in t&&t.url&&(t.locationType??="street",F(t.url)&&this.apiKey&&null==t.apiKey&&(t.apiKey=this.apiKey,t.url=T))}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;const t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getEffectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}_getErrorDescription(){switch(this.viewModel.lastError?.name){case"directions-view-model:unable-to-route":return this.messages.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case"stop":switch(e.locationType){case"stop":default:return this.messages.networkFeatures.stops.stop;case"waypoint":return this.messages.networkFeatures.stops.waypoint;case"break":return this.messages.networkFeatures.stops.break}case"point-barrier":return this.messages.networkFeatures.pointBarrier;case"polyline-barrier":return this.messages.networkFeatures.polylineBarrier;case"polygon-barrier":return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){const e=this.viewModel.layer?.routeInfo;if(!e)return null;const t=e.totalDistance??0,i=e.totalDuration??0,{messagesUnits:s,unit:o}=this;return{distance:S(s,t,o),duration:M(i)}}_getStopSections(){if(!this.viewModel.layer)return null;const{directionPoints:e,directionLines:t,stops:i}=this.viewModel.layer;if(!e||!t)return null;const s=[];let o=null;for(const r of e){const{objectId:e,stopId:a}=r;if(null!=a){const e=i.find((({objectId:e})=>e===a));o&&o.stop===e||(o={stop:e,directions:[]},s.push(o));continue}if(null==o)continue;const n=t.find((({directionPointId:t})=>t===e));null!=n&&o.directions.push({directionPoint:r,directionLine:n})}return s}_handleLocateStopAction(e){const{view:t}=this;if(!t)return;const i="directions-search-tool";this.removeHandles(i),this._searchTool=new y({stop:e,view:t}),this.addHandles([this._searchTool.on("click",(async t=>{if(t.mapPoint&&this._stopsToSearches.has(e)){const i=this._stopsToSearches.get(e),s=await i.search(t.mapPoint),o=s?.results?.[0].results?.[0];if(o){const{feature:t,name:s}=o;i.searchTerm=s,e.geometry=t.geometry}}this.removeHandles(i)})),s((()=>{this._searchTool&&(this.view?.tools.remove(this._searchTool),this._searchTool=null)}))],i),t.addAndActivateTool(this._searchTool)}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem="primary"}async _handleSaveLayerAsAction(){const e=h.getDefault();try{await e.signIn()}catch(t){if(a(t)||"identity-manager:user-aborted"===t.name)return;return this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",void(this._saveState="connect-to-portal-error")}this._saveState="fetch-portal-information",this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",this._portalUserName=e.user?.username;try{this._portalFolders=await(e.user?.fetchFolders())}catch{return void(this._saveState="fetch-portal-information-error")}this._saveState="save-layer"}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(const t of e.viewModel.defaultSources)t.autoNavigate=!1}_renderClearRouteAction(e){return $("calcite-action",{icon:"trash",key:"clear-route",onclick:()=>{this._currentFlowItem="primary",this.viewModel.reset()},...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){const t=this._getEffectiveStops();return $("calcite-action",{icon:"trash",onclick:()=>{t.remove(e),this._disposeSearch(e),this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.deleteStop,title:this.messages.deleteStop})}_renderDepartureTime(){const{DEPART_AT:e,NOW:t,UNSPECIFIED:i}=k;return $("calcite-label",{class:R.departureTime,key:"departure-time"},this.messages.departureTime,$("calcite-combobox",{clearDisabled:!0,label:this.messages.departureTime,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}},$("calcite-combobox-item",{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),$("calcite-combobox-item",{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),$("calcite-combobox-item",{heading:this.messages.timeUnspecified,key:i,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===i,value:i})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption!==k.DEPART_AT?null:$("div",{class:R.departureTimeOptions},$("calcite-input-date-picker",{scale:"s",value:this.viewModel.departureIsoDate,onCalciteInputDatePickerChange:({currentTarget:{value:e}})=>{Array.isArray(e)||(this.viewModel.departureIsoDate=e,this._solveRouteDebounced())}}),$("calcite-input-time-picker",{scale:"s",value:this.viewModel.departureIsoTime,onCalciteInputTimePickerClose:({currentTarget:{value:e}})=>{this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}}))}_renderDirectionsFlowItem(){if("directions"!==this._currentFlowItem)return null;const e=this._getRouteCostSummary();if(!this._sections||!e)return null;const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel,o=this._sections.at(0)?.stop.name??"",r=this._sections.at(-1)?.stop.name??"";return $("calcite-flow-item",{key:"directions-flow-item",overlayPositioning:"fixed",selected:"directions"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem="primary"}},$("div",{class:R.directionsHeader,slot:"header-content"},$("div",{class:R.headerStops},$("span",null,this.messages.from)," ",$("span",{class:R.directionsHeaderStopName},o),$("span",null,this.messages.to)," ",$("span",{class:R.directionsHeaderStopName},r)),$("div",{class:R.flexColumn},$("span",null,`${i} (${t})`),s?$("span",null,s):null)),this._renderRouteLayerActions({slot:"header-menu-actions"}),$("calcite-accordion",{class:R.accordion,iconPosition:"start",selectionMode:"single"},this._sections.map(((e,t)=>{const{stop:i,directions:s}=e,{name:o}=i;return $("calcite-accordion-item",{expanded:0===t,heading:o??"",key:`stop-${t}`},$("calcite-action",{icon:"zoom-to-object",onclick:()=>{this.viewModel.centerAt(i)},slot:"actions-end",text:this.messages.panToStop}),this._renderDirectionTurns(s))}))))}_renderDirectionTurns(e){return $("calcite-list",{label:this.messages.drivingDirections,selectionMode:"none"},e.map(((e,t)=>{const{directionPoint:i,directionLine:s}=e,{distance:o,duration:r}=s,a=S(this.messagesUnits,o??0,this.unit),n=M(r??0),l=a&&n?`${a} | ${n}`:`${a||n}`,c=C(i),d=I(i.directionPointType);return $("calcite-list-item",{class:R.labelNoBottomMargin,key:`driving-direction-${t}`,onpointerenter:()=>{this.viewModel.highlight(s)},onpointerleave:()=>{this.viewModel.clearHighlights()},onCalciteListItemSelect:()=>{this._activeManeuver===s?this.zoomToRoute():(this._activeManeuver=s,this.viewModel.centerAt(s.geometry))}},$("calcite-icon",{icon:d,slot:"content-start"}),$("div",{slot:"content"},$("calcite-label",{layout:"inline",scale:"s"},c),$("calcite-label",{layout:"inline",scale:"s"},l)))})))}_renderEditFlowItem(){return"edit"!==this._currentFlowItem?null:$("calcite-flow-item",{heading:this.messages.editRoute,headingLevel:this.headingLevel,key:"edit-flow-item",loading:"routing"===this.viewModel.state,selected:"edit"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem="primary"}},$("div",{class:R.flexColumn,key:"edit-container"},$("div",{class:R.editToolbarContainer},$("calcite-label",{layout:"inline",scale:"s"},this.messages.automaticallySolve,$("calcite-switch",{checked:this.viewModel.autoSolve,scale:"s",onCalciteSwitchChange:e=>{this.viewModel.autoSolve=e.target.checked}})),$("div",{class:R.editToolbar},$("calcite-action",{icon:"flag",onclick:()=>{this.viewModel.create("stop")},scale:"s",text:this.messages.networkFeatures.stops.stop,textEnabled:!0}),$("calcite-action",{icon:"line",onclick:()=>{this.viewModel.create("polyline-barrier")},scale:"s",text:this.messages.barrier,textEnabled:!0}),$("calcite-action",{class:R.solveRoute,disabled:this.viewModel.autoSolve,icon:"refresh",onclick:()=>{this._solveRouteDebounced()},scale:"s",text:this.messages.solve,textEnabled:!0}))),$("div",{class:R.selectedFeatureContainer},$("calcite-list",{label:this.messages.selectedNetworkFeatures,scale:"s",selectionMode:"none"},this.viewModel.selectedNetworkFeatures?.toArray().map(((e,t)=>$("calcite-list-item",{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},$("calcite-action",{icon:"trash",onclick:()=>{this.viewModel.remove(e)},scale:"s",slot:"actions-end",text:this.messages.common.delete})))))),$("div",{class:R.editFooter},this._renderEditFooterContent())))}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():$("calcite-button",{appearance:"outline-fill",bind:this,onclick:this._handleEditingDoneClick,width:"full"},this.messages.common.done)}_renderErrorNotice(){return $("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0},$("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return $("div",{class:R.primaryFooter,key:"footer-missing-layer"},$("calcite-notice",{icon:"information",open:!0},$("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this.messages.missingLayer)));if("unauthenticated"===this.viewModel.state)return $("div",{class:R.primaryFooterCentered,key:"footer-sign-in"},$("calcite-label",null,this.messages.signInRequired),$("calcite-button",{onclick:()=>{this.viewModel.load().catch((()=>{}))}},this.messages.common.auth.signIn));if("routing"===this.viewModel.state)return $("div",{class:this.classes(R.primaryFooter,R.primaryFooterLoader),key:"footer-routing"},$("calcite-loader",{label:this.messages.solve,scale:"s"}));if("error"===this.viewModel.state)return $("div",{class:R.primaryFooter,key:"footer-service-error"},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return $("div",{class:R.primaryFooter,key:"footer-unsolved-route"},$("calcite-notice",{icon:"information",open:!0},$("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this.messages.directionsPlaceholder)));const e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return $("div",{class:R.primaryFooter,key:"footer-invalid-route"},$("calcite-notice",{icon:"exclamation-mark-triangle",kind:"danger",open:!0},$("calcite-label",{class:R.labelNoBottomMargin,slot:"message"},this.messages.invalidRoute)));const{distance:t,duration:i}=e,{formattedEta:s}=this.viewModel;return $("div",{class:R.routeItem,key:"footer-directions-summary"},$("button",{"aria-busy":"false","aria-label":this.messages.viewDrivingDirections,"aria-live":"polite",class:R.routeItemButton,onclick:()=>{this._currentFlowItem="directions"},type:"button"},$("div",{class:R.routeItemButtonContent},$("span",{class:R.routeItemLabel},`${i} (${t})`),$("span",{class:R.routeItemDescription},s)),$("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s"})),$("calcite-dropdown",null,$("calcite-action",{icon:"ellipsis",slot:"trigger",text:"Route actions"}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return $("div",{class:R.actionContainer,key:"interactive-route-action-container"},$("calcite-button",{appearance:"outline",class:R.addStopButton,disabled:this._getEffectiveStops().length>=this.maxStops,iconStart:"plus",kind:"neutral",label:this.messages.addStop,onclick:()=>{const e=new _;this.viewModel.layer?.stops.add(new v({symbol:e}))},width:"half"},this.messages.addStop),$("calcite-button",{appearance:"outline",disabled:"2d"!==this.viewModel.view?.type,iconStart:"pencil",kind:"neutral",label:this.messages.editRoute,onclick:()=>{this._currentFlowItem="edit",this.viewModel.startEditing()},width:"half"},this.messages.editRoute))}_renderLocateStopAction(e){if(null!=e.name||null!=e.geometry)return null;const t=this._getEffectiveStops().indexOf(e),i=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return $("calcite-action",{active:i,icon:"crosshair",key:`stop-location-action-${t}`,onclick:()=>this._handleLocateStopAction(e),scale:"s",slot:"actions-end",text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap})}_renderOptimizeStopOrder(){const{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:i,preserveLastStop:s}=e;return $("calcite-block-section",{class:R.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:"switch",onCalciteBlockSectionToggle:({target:t})=>{e.findBestSequence=t.open,this._solveRouteDebounced()}},t?[$("calcite-label",{class:R.optimizeSwitches,key:"preserve-first-stop",layout:"inline-space-between"},this.messages.preserveFirstStop,$("calcite-switch",{checked:i,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveFirstStop=t,this._solveRouteDebounced()}})),$("calcite-label",{class:R.optimizeSwitches,key:"preserve-last-stop",layout:"inline-space-between"},this.messages.preserveLastStop,$("calcite-switch",{checked:s,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveLastStop=t,this._solveRouteDebounced()}}))]:null)}_renderPrimaryFlowItem(){return $("calcite-flow-item",{key:"primary-flow-item",loading:"initializing"===this.viewModel.state,selected:"primary"===this._currentFlowItem},$("calcite-panel",{class:R.primaryFlowItem,disabled:!this.viewModel.layer||"unauthenticated"===this.viewModel.state||"error"===this.viewModel.state&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return $("div",{class:R.marginInlineMedium,key:"route-solve-options"},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case"initialized":return this._renderSaveInitialized();case"connect-to-portal":return this._renderSaveProcessing(this.messages.identity.lblSigning);case"connect-to-portal-error":return this._renderSaveError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderSaveProcessing(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderSaveError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayerSettings();case"saving":return this._renderSaveProcessing(this.messages.processing.saving);case"saving-error":return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return $("calcite-panel",{class:R.paddingMedium,key:"save-layer-error"},$("div",{class:R.saveError},$("calcite-icon",{class:R.saveErrorIcon,icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messages.common.errorMessage}),$("calcite-label",{class:R.saveErrorLabel},e)),$("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.close))}_renderSaveInitialized(){return $("calcite-panel",{class:R.paddingMedium,key:"save-layer-initialized"})}_renderSaveFlowItem(){return"save"!==this._currentFlowItem?null:$("calcite-flow-item",{heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:"save-layer-flow-item",selected:"save"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}},this._renderSaveContent())}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;const t=this.viewModel.layer,i=t?.routeInfo,s=t?.portalItem?.itemControl;return $("calcite-action",{disabled:!(!!i&&("admin"===s||"update"===s)),icon:"save",key:"save-route",onclick:()=>{this.viewModel.layer?.save()},...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;const t=!this.viewModel.layer?.routeInfo;return $("calcite-action",{disabled:t,icon:"save-as",key:"save-as-route",onclick:()=>{this._handleSaveLayerAsAction()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(null==this.layer||null==this._portalFolders||null==this._portalUserName)return this._renderSaveInitialized();const{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,i=[$("calcite-combobox-item",{heading:`${this._portalUserName} (${this.messages.common.home})`,key:`${L}-folder-home`,selected:!0,value:`${L}-folder-home`}),...this._portalFolders.map((e=>$("calcite-combobox-item",{heading:e.title??"",key:`${L}-folder-${e.id}`,value:e.id})))];return $("calcite-panel",{key:"save-layer-panel"},$("div",{class:R.paddingMedium},$("calcite-label",null,this.messages.laverName,$("calcite-input",{afterCreate:e=>{this._portalItemNameInput=e},label:this.messages.laverName,value:t})),$("calcite-label",null,this.messages.saveInFolder,$("calcite-combobox",{afterCreate:e=>{this._portalFolderCombobox=e},clearDisabled:!0,label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},i))),$("calcite-button",{onclick:()=>{if(this._saveState="saving",null==this.layer||null==this._portalFolders)return;const e=this._portalItemNameInput?.value,t=this._portalFolderCombobox?.value,i=this._portalFolders.find((({id:e})=>e===t));this.layer.saveAs({title:e},{folder:i}).then((()=>{this._currentFlowItem=this._parentFlowItem})).catch((()=>{this._saveState="saving-error"}))},slot:"footer-actions",width:"full"},this.messages.common.save),$("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.cancel))}_renderSaveProcessing(e){return $("calcite-panel",{class:R.marginInlineMedium,key:"save-layer-processing"},$("calcite-loader",{class:R.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return $("div",{class:R.separator})}_renderStop(e){const t=this.acquireSearch(e);null!=e.name&&(t.searchTerm=e.name);const i=this._getEffectiveStops(),s=this._renderLocateStopAction(e),o=i.length>2&&this._renderDeleteStopAction(e);return $("calcite-list-item",{key:e,value:e},s,o,$("div",{class:R.stopItem,slot:"content"},t.render()))}_renderStops(){const e=this._getEffectiveStops();for(const t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return $("div",{class:R.stopContainer,key:R.stopContainer},$("calcite-list",{class:R.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:"s",onCalciteListOrderChange:({detail:t})=>{e.reorder(t.dragEl.value,t.newIndex),this._solveRouteDebounced()}},e.toArray().map((e=>this._renderStop(e)))),2===e.length&&$("calcite-action",{icon:"arrow-up-down",onclick:()=>{e.reverse(),this._solveRouteDebounced()},scale:"s",text:this.messages.reverseStops}))}_renderTravelModes(){return this.viewModel.travelModes.length?$("calcite-label",{key:"travel-modes"},this.messages.mode,$("calcite-combobox",{clearDisabled:!0,label:this.messages.mode,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.selectedTravelMode=t[0].value,this._solveRouteDebounced())}},this.viewModel.travelModes.map((e=>$("calcite-combobox-item",{heading:e.name,key:e.id,label:e.name,selected:this.viewModel.selectedTravelMode?.id===e.id,value:e}))))):null}_renderViewItemDetailsAction(e){if(!this.visibleElements.layerDetails)return null;const t=this.viewModel.layer?.portalItem;return $("calcite-action",{disabled:!t,icon:"launch",key:"open-route-details-link",onclick:()=>{t&&window.open(`${t.portal.url}/home/item.html?id=${t.id}`,"_blank")},...e,text:this.messages.viewLayerDetails,textEnabled:!0})}async _solveRoute(){this.viewModel.updateDepartureTime();if(!((this.viewModel.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2))try{await this.viewModel.getDirections()}catch{}}};e([m()],A.prototype,"_currentFlowItem",void 0),e([m()],A.prototype,"_saveState",void 0),e([m()],A.prototype,"_searchTool",void 0),e([m()],A.prototype,"apiKey",null),e([m(u)],A.prototype,"defaultUnit",void 0),e([m()],A.prototype,"goToOverride",null),e([m()],A.prototype,"headingLevel",void 0),e([m()],A.prototype,"icon",null),e([m()],A.prototype,"label",null),e([m({readOnly:!0})],A.prototype,"lastRoute",null),e([m()],A.prototype,"layer",null),e([m()],A.prototype,"maxStops",null),e([m(),E("esri/widgets/Directions/t9n/Directions")],A.prototype,"messages",void 0),e([m(),E("esri/core/t9n/Units")],A.prototype,"messagesUnits",void 0),e([m()],A.prototype,"searchProperties",void 0),e([m()],A.prototype,"unit",null),e([m()],A.prototype,"view",null),e([m({type:b})],A.prototype,"viewModel",void 0),e([m({type:f,nonNullable:!0})],A.prototype,"visibleElements",void 0),A=e([p("esri.widgets.Directions")],A);const N=A;export{N as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{isSome as t}from"../core/arrayUtils.js";import s from"../core/Collection.js";import{makeHandle as i}from"../core/handleUtils.js";import{destroyMaybe as o}from"../core/maybe.js";import{debounce as r,isAbortError as a}from"../core/promiseUtils.js";import{watch as n,initial as l,on as c}from"../core/reactiveUtils.js";import{escapeRegExpString as d}from"../core/string.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as m}from"../core/accessorSupport/decorators/subclass.js";import p from"../portal/Portal.js";import{defaultUnitPropertyMetadata as u}from"../properties/defaultUnit.js";import v from"../rest/support/Stop.js";import g from"../symbols/SimpleMarkerSymbol.js";import w from"./Search.js";import _ from"./Widget.js";import{css as y}from"./Directions/css.js";import{DirectionsSearchTool as b}from"./Directions/DirectionsSearchTool.js";import f from"./Directions/DirectionsViewModel.js";import S from"./Directions/DirectionsVisibleElements.js";import{formatDistance as M,formatDuration as k,DepartureTimeOption as I,getIconName as F}from"./Directions/support/directionsUtils.js";import{isArcGISWorldGeocoder as T,meteredArcGISLocatorUrl as D}from"./Search/support/locatorUtils.js";import{loadCalciteComponents as x}from"./support/componentsUtils.js";import{globalCss as E}from"./support/globalCss.js";import"./support/widgetUtils.js";import{messageBundle as C}from"./support/decorators/messageBundle.js";import{tsx as R}from"./support/jsxFactory.js";function A(e){const{branchName:s,displayText:i,exitName:o,intersectingName:r,name:a,towardName:n}=e;if(null==i)return null;const l=[s,o,r,a,n].filter(t).sort(((e,t)=>t.length-e.length)).map((e=>d(e)));if(!l.length)return i;const c=new RegExp(l.join("|"),"g"),h=i.matchAll(c);let m=0;const p=[];for(const{0:t,index:d}of h)p.push(i.slice(m,d),R("span",{class:y.labelEmphasize,key:`maneuver-${d}`},t)),m=d+t.length;return p.push(i.slice(m)),R("span",null,p)}let L=class extends _{constructor(e,t){super(e,t),this._activeManeuver=null,this._placeholderStops=new s([new v,new v]),this._portalFolderCombobox=null,this._portalFolders=null,this._portalItemNameInput=null,this._portalUserName=null,this._sections=null,this._stopsToSearches=new Map,this._currentFlowItem="primary",this._parentFlowItem="primary",this._saveState="initialized",this._searchTool=null,this.headingLevel=2,this.messages=null,this.messagesUnits=null,this.searchProperties=null,this.viewModel=new f,this.visibleElements=new S,this._solveRouteDebounced=r((()=>this._solveRoute()))}initialize(){this.addHandles([n((()=>this.viewModel.layer),(()=>{try{this.viewModel.load()}catch{}}),l),n((()=>this.viewModel.layer?.routeInfo),(()=>{this._sections=this._getStopSections()}),l),n((()=>this.viewModel.layer?.stops.toArray()),(e=>{e&&this.view?.activeTool&&this._searchTool&&this.view.activeTool===this._searchTool&&!e.includes(this._searchTool.stop)&&(this.view.tools.remove(this._searchTool),this._searchTool=null)}))])}loadDependencies(){return x({accordion:()=>import("@esri/calcite-components/dist/components/calcite-accordion"),"accordion-item":()=>import("@esri/calcite-components/dist/components/calcite-accordion-item"),action:()=>import("@esri/calcite-components/dist/components/calcite-action"),"block-section":()=>import("@esri/calcite-components/dist/components/calcite-block-section"),button:()=>import("@esri/calcite-components/dist/components/calcite-button"),combobox:()=>import("@esri/calcite-components/dist/components/calcite-combobox"),"combobox-item":()=>import("@esri/calcite-components/dist/components/calcite-combobox-item"),dropdown:()=>import("@esri/calcite-components/dist/components/calcite-dropdown"),flow:()=>import("@esri/calcite-components/dist/components/calcite-flow"),"flow-item":()=>import("@esri/calcite-components/dist/components/calcite-flow-item"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-date-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-date-picker"),"input-time-picker":()=>import("@esri/calcite-components/dist/components/calcite-input-time-picker"),label:()=>import("@esri/calcite-components/dist/components/calcite-label"),list:()=>import("@esri/calcite-components/dist/components/calcite-list"),"list-item":()=>import("@esri/calcite-components/dist/components/calcite-list-item"),loader:()=>import("@esri/calcite-components/dist/components/calcite-loader"),notice:()=>import("@esri/calcite-components/dist/components/calcite-notice"),panel:()=>import("@esri/calcite-components/dist/components/calcite-panel"),switch:()=>import("@esri/calcite-components/dist/components/calcite-switch")})}destroy(){this._stopsToSearches.forEach(o)}get apiKey(){return this.viewModel.apiKey}set apiKey(e){this.viewModel.apiKey=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return"right"}set icon(e){this._overrideIfSome("icon",e)}get label(){return this.messages?.widgetLabel??""}set label(e){this._overrideIfSome("label",e)}get lastRoute(){return this.viewModel.lastRoute}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get maxStops(){return this.viewModel.maxStops}set maxStops(e){this.viewModel.maxStops=e}get unit(){return this.defaultUnit}set unit(e){this._overrideIfSome("unit",e)}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}acquireSearch(e){const{view:t}=this.viewModel;if(this._stopsToSearches.has(e)){const s=this._stopsToSearches.get(e);return s.view=t,this._overrideDefaultSources(s),s}const s=new w({icon:!1,popupEnabled:!1,resultGraphicEnabled:!1,view:t,...this.searchProperties});return this._normalizeSearchSources(s),this.addHandles([c((()=>s.allSources),"change",(()=>this._normalizeSearchSources(s))),s.on("search-clear",(()=>{e.geometry=null,e.name=null,this.viewModel.layer?.removeResult()})),s.on("select-result",(()=>{const t=s.selectedResult;e.geometry=t?.feature.geometry,e.name=t?.name,this._solveRouteDebounced()})),n((()=>s.searchTerm),(t=>{e.name=t}))],s),this._stopsToSearches.set(e,s),s}getDirections(){return this.viewModel.getDirections()}render(){return R("div",{class:this.classes(y.base,E.widget,E.panel)},R("calcite-flow",null,this._renderPrimaryFlowItem(),this._renderDirectionsFlowItem(),this._renderEditFlowItem(),this._renderSaveFlowItem()))}save(){return this.viewModel.save()}saveAs(e,t={}){return this.viewModel.saveAs(e,t)}zoomToRoute(){return this.viewModel.zoomToRoute()}_applyLocatorSourceOverrides({allSources:e}){for(const t of e)"url"in t&&t.url&&(t.locationType??="street",T(t.url)&&this.apiKey&&null==t.apiKey&&(t.apiKey=this.apiKey,t.url=D))}_disposeSearch(e){if(!e||!this._stopsToSearches.has(e))return;const t=this._stopsToSearches.get(e);this.removeHandles(t),t.destroy(),this._stopsToSearches.delete(e)}_getEffectiveStops(){return this.viewModel.layer?.stops??this._placeholderStops}_getErrorDescription(){switch(this.viewModel.lastError?.name){case"directions-view-model:unable-to-route":return this.messages.errors.unableToRoute;case"directions-view-model:service-metadata-unavailable":return this.messages.errors.unableToLoadServiceMetadata;default:return this.messages.errors.unknownError}}_getNetworkFeatureName(e){switch(e.type){case"stop":switch(e.locationType){case"stop":default:return this.messages.networkFeatures.stops.stop;case"waypoint":return this.messages.networkFeatures.stops.waypoint;case"break":return this.messages.networkFeatures.stops.break}case"point-barrier":return this.messages.networkFeatures.pointBarrier;case"polyline-barrier":return this.messages.networkFeatures.polylineBarrier;case"polygon-barrier":return this.messages.networkFeatures.polygonBarrier}}_getRouteCostSummary(){const e=this.viewModel.layer?.routeInfo;if(!e)return null;const t=e.totalDistance??0,s=e.totalDuration??0,{messagesUnits:i,unit:o}=this;return{distance:M(i,t,o),duration:k(s)}}_getStopSections(){if(!this.viewModel.layer)return null;const{directionPoints:e,directionLines:t,stops:s}=this.viewModel.layer;if(!e||!t)return null;const i=[];let o=null;for(const r of e){const{objectId:e,stopId:a}=r;if(null!=a){const e=s.find((({objectId:e})=>e===a));o&&o.stop===e||(o={stop:e,directions:[]},i.push(o));continue}if(null==o)continue;const n=t.find((({directionPointId:t})=>t===e));null!=n&&o.directions.push({directionPoint:r,directionLine:n})}return i}_handleLocateStopAction(e){const{view:t}=this;if(!t)return;const s="directions-search-tool";this.removeHandles(s),this._searchTool=new b({stop:e,view:t}),this.addHandles([this._searchTool.on("click",(async t=>{if(t.mapPoint&&this._stopsToSearches.has(e)){const s=this._stopsToSearches.get(e),i=await s.search(t.mapPoint),o=i?.results?.[0].results?.[0];if(o){const{feature:t,name:i}=o;s.searchTerm=i,e.geometry=t.geometry}}this.removeHandles(s)})),i((()=>{this._searchTool&&(this.view?.tools.remove(this._searchTool),this._searchTool=null)}))],s),t.addAndActivateTool(this._searchTool)}_handleEditingDoneClick(){this.viewModel.stopEditing(),this._currentFlowItem="primary"}async _handleSaveLayerAsAction(){const e=p.getDefault();try{await e.signIn()}catch(t){if(a(t)||"identity-manager:user-aborted"===t.name)return;return this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",void(this._saveState="connect-to-portal-error")}this._saveState="fetch-portal-information",this._parentFlowItem=this._currentFlowItem,this._currentFlowItem="save",this._portalUserName=e.user?.username;try{this._portalFolders=await(e.user?.fetchFolders())}catch{return void(this._saveState="fetch-portal-information-error")}this._saveState="save-layer"}_normalizeSearchSources(e){this._overrideDefaultSources(e),this._applyLocatorSourceOverrides(e)}_overrideDefaultSources(e){for(const t of e.viewModel.defaultSources)t.autoNavigate=!1}_renderClearRouteAction(e){return R("calcite-action",{icon:"trash",key:"clear-route",onclick:()=>{this._currentFlowItem="primary",this.viewModel.reset()},...e,text:this.messages.common.clear,textEnabled:!0})}_renderDeleteStopAction(e){const t=this._getEffectiveStops();return R("calcite-action",{icon:"trash",onclick:()=>{t.remove(e),this._disposeSearch(e),this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.deleteStop,title:this.messages.deleteStop})}_renderDepartureTime(){const{DEPART_AT:e,NOW:t,UNSPECIFIED:s}=I;return R("calcite-label",{class:y.departureTime,key:"departure-time"},this.messages.departureTime,R("calcite-combobox",{clearDisabled:!0,label:this.messages.departureTime,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.departureOption=t[0].value,this._solveRouteDebounced())}},R("calcite-combobox-item",{heading:this.messages.leaveNow,key:t,label:this.messages.leaveNow,selected:this.viewModel.departureOption===t,value:t}),R("calcite-combobox-item",{heading:this.messages.departAt,key:e,label:this.messages.departAt,selected:this.viewModel.departureOption===e,value:e}),R("calcite-combobox-item",{heading:this.messages.timeUnspecified,key:s,label:this.messages.timeUnspecified,selected:this.viewModel.departureOption===s,value:s})))}_renderDepartureTimeOptions(){return this.viewModel.departureOption!==I.DEPART_AT?null:R("div",{class:y.departureTimeOptions},R("calcite-input-date-picker",{scale:"s",value:this.viewModel.departureIsoDate,onCalciteInputDatePickerChange:({currentTarget:{value:e}})=>{Array.isArray(e)||(this.viewModel.departureIsoDate=e,this._solveRouteDebounced())}}),R("calcite-input-time-picker",{scale:"s",value:this.viewModel.departureIsoTime,onCalciteInputTimePickerClose:({currentTarget:{value:e}})=>{this.viewModel.departureIsoTime=e,this._solveRouteDebounced()}}))}_renderDirectionsFlowItem(){if("directions"!==this._currentFlowItem)return null;const e=this._getRouteCostSummary();if(!this._sections||!e)return null;const{distance:t,duration:s}=e,{formattedEta:i}=this.viewModel,o=this._sections.at(0)?.stop.name??"",r=this._sections.at(-1)?.stop.name??"";return R("calcite-flow-item",{key:"directions-flow-item",overlayPositioning:"fixed",selected:"directions"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem="primary"}},R("div",{class:y.directionsHeader,slot:"header-content"},R("div",{class:y.headerStops},R("span",null,this.messages.from)," ",R("span",{class:y.directionsHeaderStopName},o),R("span",null,this.messages.to)," ",R("span",{class:y.directionsHeaderStopName},r)),R("div",{class:y.flexColumn},R("span",null,`${s} (${t})`),i?R("span",null,i):null)),this._renderRouteLayerActions({slot:"header-menu-actions"}),R("calcite-accordion",{class:y.accordion,iconPosition:"start",selectionMode:"single"},this._sections.map(((e,t)=>{const{stop:s,directions:i}=e,{name:o}=s;return R("calcite-accordion-item",{expanded:0===t,heading:o??"",key:`stop-${t}`},R("calcite-action",{icon:"zoom-to-object",onclick:()=>{this.viewModel.centerAt(s)},slot:"actions-end",text:this.messages.panToStop}),this._renderDirectionTurns(i))}))))}_renderDirectionTurns(e){return R("calcite-list",{label:this.messages.drivingDirections,selectionMode:"none"},e.map(((e,t)=>{const{directionPoint:s,directionLine:i}=e,{distance:o,duration:r}=i,a=M(this.messagesUnits,o??0,this.unit),n=k(r??0),l=a&&n?`${a} | ${n}`:`${a||n}`,c=A(s),d=F(s.directionPointType);return R("calcite-list-item",{class:y.labelNoBottomMargin,key:`driving-direction-${t}`,onpointerenter:()=>{this.viewModel.highlight(i)},onpointerleave:()=>{this.viewModel.clearHighlights()},onCalciteListItemSelect:()=>{this._activeManeuver===i?this.zoomToRoute():(this._activeManeuver=i,this.viewModel.centerAt(i.geometry))}},R("calcite-icon",{icon:d,slot:"content-start"}),R("div",{slot:"content"},R("calcite-label",{layout:"inline",scale:"s"},c),R("calcite-label",{layout:"inline",scale:"s"},l)))})))}_renderEditFlowItem(){return"edit"!==this._currentFlowItem?null:R("calcite-flow-item",{heading:this.messages.editRoute,headingLevel:this.headingLevel,key:"edit-flow-item",loading:"routing"===this.viewModel.state,selected:"edit"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this.viewModel.stopEditing(),this._currentFlowItem="primary"}},R("div",{class:y.flexColumn,key:"edit-container"},R("div",{class:y.editToolbarContainer},R("calcite-label",{layout:"inline",scale:"s"},this.messages.automaticallySolve,R("calcite-switch",{checked:this.viewModel.autoSolve,scale:"s",onCalciteSwitchChange:e=>{this.viewModel.autoSolve=e.target.checked}})),R("div",{class:y.editToolbar},R("calcite-action",{disabled:!this.viewModel.layer||this.viewModel.layer.stops.length>=this.maxStops,icon:"flag",onclick:()=>{this.viewModel.create("stop")},scale:"s",text:this.messages.networkFeatures.stops.stop,textEnabled:!0}),R("calcite-action",{icon:"line",onclick:()=>{this.viewModel.create("polyline-barrier")},scale:"s",text:this.messages.barrier,textEnabled:!0}),R("calcite-action",{class:y.solveRoute,disabled:this.viewModel.autoSolve,icon:"refresh",onclick:()=>{this._solveRouteDebounced()},scale:"s",text:this.messages.solve,textEnabled:!0}))),R("div",{class:y.selectedFeatureContainer},R("calcite-list",{label:this.messages.selectedNetworkFeatures,scale:"s",selectionMode:"none"},this.viewModel.selectedNetworkFeatures?.toArray().map(((e,t)=>R("calcite-list-item",{description:this._getNetworkFeatureName(e),key:`network-feature-${t}`,label:e.name??e.objectId?.toString()??this.messages.unnamed},R("calcite-action",{icon:"trash",onclick:()=>{this.viewModel.remove(e),this.viewModel.autoSolve&&this._solveRouteDebounced()},scale:"s",slot:"actions-end",text:this.messages.common.delete})))))),R("div",{class:y.editFooter},this._renderEditFooterContent())))}_renderEditFooterContent(){return this.viewModel.lastError?this._renderErrorNotice():R("calcite-button",{appearance:"outline-fill",bind:this,onclick:this._handleEditingDoneClick,width:"full"},this.messages.common.done)}_renderErrorNotice(){return R("calcite-notice",{icon:"exclamation-mark-circle",kind:"danger",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this._getErrorDescription()))}_renderFooter(){if(!this.viewModel.layer)return R("div",{class:y.primaryFooter,key:"footer-missing-layer"},R("calcite-notice",{icon:"information",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this.messages.missingLayer)));if("unauthenticated"===this.viewModel.state)return R("div",{class:y.primaryFooterCentered,key:"footer-sign-in"},R("calcite-label",null,this.messages.signInRequired),R("calcite-button",{onclick:()=>{this.viewModel.load().catch((()=>{}))}},this.messages.common.auth.signIn));if("routing"===this.viewModel.state)return R("div",{class:this.classes(y.primaryFooter,y.primaryFooterLoader),key:"footer-routing"},R("calcite-loader",{label:this.messages.solve,scale:"s"}));if("error"===this.viewModel.state)return R("div",{class:y.primaryFooter,key:"footer-service-error"},this._renderErrorNotice());if(!this.viewModel.layer?.routeInfo)return R("div",{class:y.primaryFooter,key:"footer-unsolved-route"},R("calcite-notice",{icon:"information",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this.messages.directionsPlaceholder)));const e=this._getRouteCostSummary();if(!e||!this.viewModel.layer?.directionPoints)return R("div",{class:y.primaryFooter,key:"footer-invalid-route"},R("calcite-notice",{icon:"exclamation-mark-triangle",kind:"danger",open:!0},R("calcite-label",{class:y.labelNoBottomMargin,slot:"message"},this.messages.invalidRoute)));const{distance:t,duration:s}=e,{formattedEta:i}=this.viewModel;return R("div",{class:y.routeItem,key:"footer-directions-summary"},R("button",{"aria-busy":"false","aria-label":this.messages.viewDrivingDirections,"aria-live":"polite",class:y.routeItemButton,onclick:()=>{this._currentFlowItem="directions"},type:"button"},R("div",{class:y.routeItemButtonContent},R("span",{class:y.routeItemLabel},`${s} (${t})`),R("span",{class:y.routeItemDescription},i)),R("calcite-icon",{flipRtl:!0,icon:"chevron-right",scale:"s"})),R("calcite-dropdown",null,R("calcite-action",{icon:"ellipsis",slot:"trigger",text:"Route actions"}),this._renderRouteLayerActions()))}_renderInteractiveRouteActions(){return R("div",{class:y.actionContainer,key:"interactive-route-action-container"},R("calcite-button",{appearance:"outline",class:y.addStopButton,disabled:this._getEffectiveStops().length>=this.maxStops,iconStart:"plus",kind:"neutral",label:this.messages.addStop,onclick:()=>{const e=new g;this.viewModel.layer?.stops.add(new v({symbol:e}))},width:"half"},this.messages.addStop),R("calcite-button",{appearance:"outline",class:y.editRouteButton,disabled:"2d"!==this.viewModel.view?.type,iconStart:"pencil",kind:"neutral",label:this.messages.editRoute,onclick:()=>{this._currentFlowItem="edit",this.viewModel.startEditing()},width:"half"},this.messages.editRoute))}_renderLocateStopAction(e){if(null!=e.name||null!=e.geometry)return null;const t=this._getEffectiveStops().indexOf(e),s=!!this.view?.activeTool&&this.view.activeTool===this._searchTool&&this._searchTool.stop===e;return R("calcite-action",{active:s,icon:"crosshair",key:`stop-location-action-${t}`,onclick:()=>this._handleLocateStopAction(e),scale:"s",slot:"actions-end",text:this.messages.pickALocationOnTheMap,title:this.messages.pickALocationOnTheMap})}_renderOptimizeStopOrder(){const{routeParameters:e}=this.viewModel,{findBestSequence:t,preserveFirstStop:s,preserveLastStop:i}=e;return R("calcite-block-section",{class:y.optimizeSection,text:this.messages.optimizeOrder,toggleDisplay:"switch",onCalciteBlockSectionToggle:({target:t})=>{e.findBestSequence=t.open,this._solveRouteDebounced()}},t?[R("calcite-label",{class:y.optimizeSwitches,key:"preserve-first-stop",layout:"inline-space-between"},this.messages.preserveFirstStop,R("calcite-switch",{checked:s,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveFirstStop=t,this._solveRouteDebounced()}})),R("calcite-label",{class:y.optimizeSwitches,key:"preserve-last-stop",layout:"inline-space-between"},this.messages.preserveLastStop,R("calcite-switch",{checked:i,scale:"s",onCalciteSwitchChange:({target:{checked:t}})=>{e.preserveLastStop=t,this._solveRouteDebounced()}}))]:null)}_renderPrimaryFlowItem(){return R("calcite-flow-item",{key:"primary-flow-item",loading:"initializing"===this.viewModel.state,selected:"primary"===this._currentFlowItem},R("calcite-panel",{class:y.primaryFlowItem,disabled:!this.viewModel.layer||"unauthenticated"===this.viewModel.state||"error"===this.viewModel.state&&!this.viewModel.serviceDescription},this._renderStops(),this._renderInteractiveRouteActions(),this._renderSeparator(),this._renderRouteSolveOptions()),this._renderFooter())}_renderRouteLayerActions(e){return[this._renderClearRouteAction(e),this._renderSaveLayerAction(e),this._renderSaveLayerAsAction(e),this._renderViewItemDetailsAction(e)]}_renderRouteSolveOptions(){return R("div",{class:y.marginInlineMedium,key:"route-solve-options"},this._renderTravelModes(),this._renderDepartureTime(),this._renderDepartureTimeOptions(),this._renderOptimizeStopOrder())}_renderSaveContent(){switch(this._saveState){case"initialized":return this._renderSaveInitialized();case"connect-to-portal":return this._renderSaveProcessing(this.messages.identity.lblSigning);case"connect-to-portal-error":return this._renderSaveError(this.messages.errors.authenticating);case"fetch-portal-information":return this._renderSaveProcessing(this.messages.processing.fetching);case"fetch-portal-information-error":return this._renderSaveError(this.messages.errors.fetching);case"save-layer":return this._renderSaveLayerSettings();case"saving":return this._renderSaveProcessing(this.messages.processing.saving);case"saving-error":return this._renderSaveError(this.messages.errors.saving)}}_renderSaveError(e){return R("calcite-panel",{class:y.paddingMedium,key:"save-layer-error"},R("div",{class:y.saveError},R("calcite-icon",{class:y.saveErrorIcon,icon:"exclamation-mark-triangle",scale:"l",textLabel:this.messages.common.errorMessage}),R("calcite-label",{class:y.saveErrorLabel},e)),R("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.close))}_renderSaveInitialized(){return R("calcite-panel",{class:y.paddingMedium,key:"save-layer-initialized"})}_renderSaveFlowItem(){return"save"!==this._currentFlowItem?null:R("calcite-flow-item",{heading:this.messages.saveLayer,headingLevel:this.headingLevel,key:"save-layer-flow-item",selected:"save"===this._currentFlowItem,onCalciteFlowItemBack:e=>{e.stopPropagation(),this._currentFlowItem=this._parentFlowItem}},this._renderSaveContent())}_renderSaveLayerAction(e){if(!this.visibleElements.saveButton)return null;const t=this.viewModel.layer,s=t?.routeInfo,i=t?.portalItem?.itemControl;return R("calcite-action",{disabled:!(!!s&&("admin"===i||"update"===i)),icon:"save",key:"save-route",onclick:()=>{this.viewModel.layer?.save()},...e,text:this.messages.common.save,textEnabled:!0})}_renderSaveLayerAsAction(e){if(!this.visibleElements.saveAsButton)return null;const t=!this.viewModel.layer?.routeInfo;return R("calcite-action",{disabled:t,icon:"save-as",key:"save-as-route",onclick:()=>{this._handleSaveLayerAsAction()},...e,text:this.messages.common.saveAs,textEnabled:!0})}_renderSaveLayerSettings(){if(null==this.layer||null==this._portalFolders||null==this._portalUserName)return this._renderSaveInitialized();const{stops:e}=this.layer,t=`${e.at(0).name} - ${e.at(-1).name}`,s=[R("calcite-combobox-item",{heading:`${this._portalUserName} (${this.messages.common.home})`,key:y.folderHome,selected:!0,value:y.folderHome}),...this._portalFolders.map((e=>R("calcite-combobox-item",{heading:e.title??"",key:`${y.folder}-${e.id}`,value:e.id})))];return R("calcite-panel",{key:"save-layer-panel"},R("div",{class:y.paddingMedium},R("calcite-label",null,this.messages.laverName,R("calcite-input",{afterCreate:e=>{this._portalItemNameInput=e},label:this.messages.laverName,value:t})),R("calcite-label",null,this.messages.saveInFolder,R("calcite-combobox",{afterCreate:e=>{this._portalFolderCombobox=e},clearDisabled:!0,label:this.messages.saveInFolder,overlayPositioning:"fixed",selectionMode:"single"},s))),R("calcite-button",{onclick:()=>{if(this._saveState="saving",null==this.layer||null==this._portalFolders)return;const e=this._portalItemNameInput?.value,t=this._portalFolderCombobox?.value,s=this._portalFolders.find((({id:e})=>e===t));this.layer.saveAs({title:e},{folder:s}).then((()=>{this._currentFlowItem=this._parentFlowItem})).catch((()=>{this._saveState="saving-error"}))},slot:"footer-actions",width:"full"},this.messages.common.save),R("calcite-button",{appearance:"outline",onclick:()=>{this._currentFlowItem=this._parentFlowItem},slot:"footer-actions",width:"full"},this.messages.common.cancel))}_renderSaveProcessing(e){return R("calcite-panel",{class:y.marginInlineMedium,key:"save-layer-processing"},R("calcite-loader",{class:y.saveProcessLoader,label:e,text:e}))}_renderSeparator(){return R("div",{class:y.separator})}_renderStop(e){const t=this.acquireSearch(e);null!=e.name&&(t.searchTerm=e.name);const s=this._getEffectiveStops(),i=this._renderLocateStopAction(e),o=s.length>2&&this._renderDeleteStopAction(e);return R("calcite-list-item",{key:e,value:e},i,o,R("div",{class:y.stopItem,slot:"content"},t.render()))}_renderStops(){const e=this._getEffectiveStops();for(const t of this._stopsToSearches.keys())e.includes(t)||this._disposeSearch(t);return R("div",{class:y.stopContainer,key:y.stopContainer},R("calcite-list",{class:y.stopList,dragEnabled:!0,label:this.messages.widgetLabel,scale:"s",onCalciteListOrderChange:({detail:t})=>{e.reorder(t.dragEl.value,t.newIndex),this._solveRouteDebounced()}},e.toArray().map((e=>this._renderStop(e)))),2===e.length&&R("calcite-action",{icon:"arrow-up-down",onclick:()=>{e.reverse(),this._solveRouteDebounced()},scale:"s",text:this.messages.reverseStops}))}_renderTravelModes(){return this.viewModel.travelModes.length?R("calcite-label",{key:"travel-modes"},this.messages.mode,R("calcite-combobox",{clearDisabled:!0,label:this.messages.mode,overlayPositioning:"fixed",selectionMode:"single",onCalciteComboboxChange:({currentTarget:e})=>{const{selectedItems:t}=e;t.length&&(this.viewModel.selectedTravelMode=t[0].value,this._solveRouteDebounced())}},this.viewModel.travelModes.map((e=>R("calcite-combobox-item",{heading:e.name,key:e.id,label:e.name,selected:this.viewModel.selectedTravelMode?.id===e.id,value:e}))))):null}_renderViewItemDetailsAction(e){if(!this.visibleElements.layerDetails)return null;const t=this.viewModel.layer?.portalItem;return R("calcite-action",{disabled:!t,icon:"launch",key:"open-route-details-link",onclick:()=>{t&&window.open(`${t.portal.url}/home/item.html?id=${t.id}`,"_blank")},...e,text:this.messages.viewLayerDetails,textEnabled:!0})}async _solveRoute(){this.viewModel.updateDepartureTime();if(!((this.viewModel.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2))try{await this.viewModel.getDirections()}catch{}}};e([h()],L.prototype,"_currentFlowItem",void 0),e([h()],L.prototype,"_saveState",void 0),e([h()],L.prototype,"_searchTool",void 0),e([h()],L.prototype,"apiKey",null),e([h(u)],L.prototype,"defaultUnit",void 0),e([h()],L.prototype,"goToOverride",null),e([h()],L.prototype,"headingLevel",void 0),e([h()],L.prototype,"icon",null),e([h()],L.prototype,"label",null),e([h({readOnly:!0})],L.prototype,"lastRoute",null),e([h()],L.prototype,"layer",null),e([h()],L.prototype,"maxStops",null),e([h(),C("esri/widgets/Directions/t9n/Directions")],L.prototype,"messages",void 0),e([h(),C("esri/core/t9n/Units")],L.prototype,"messagesUnits",void 0),e([h()],L.prototype,"searchProperties",void 0),e([h()],L.prototype,"unit",null),e([h()],L.prototype,"view",null),e([h({type:f})],L.prototype,"viewModel",void 0),e([h({type:S,nonNullable:!0})],L.prototype,"visibleElements",void 0),L=e([m("esri.widgets.Directions")],L);const j=L;export{j as default};
@@ -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{throwIfAborted as t}from"../../core/promiseUtils.js";import{formatLength as e,formatArea as r}from"../../core/quantityFormatUtils.js";import{createLength as n,createArea as a}from"../../core/quantityUtils.js";import{distance as o}from"../../core/libs/gl-matrix-2/math/vec2.js";import{geodesicDensify as i,simplify as s,geodesicLength as c,planarLength as u,planarArea as l,geodesicArea as f}from"../../geometry/geometryEngine.js";import m from"../../geometry/Point.js";import p from"../../geometry/Polygon.js";import y from"../../geometry/Polyline.js";import{projectWithZConversion as h,project as g}from"../../geometry/projection.js";import x from"../../geometry/SpatialReference.js";import{isSupported as w,geodesicLengths as d,geodesicAreas as v}from"../../geometry/support/geodesicUtils.js";import{imageToWorld as R,imageToWorldPanoramic as z}from"../../layers/orientedImagery/transformations/imageToWorld.js";import{convertSphereVertexToPixelLocation as M}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as P,worldToImagePanoramic as j}from"../../layers/orientedImagery/transformations/worldToImage.js";const E=1e5;function b(t,e){let r=180*Math.atan2(-t.y+e.y,t.x-e.x)/Math.PI;return r<0&&(r+=180),r*Math.PI/180}function I(t,e){let r=180*Math.atan2(-t.y+e.y,t.x-e.x)/Math.PI;return r<0&&(r+=180),r*Math.PI/180}function q(t,e,r){if(!t?.length||!e?.length||!r)return;const[n,a]=t,[,o]=e,i=o-a;return[n+i*Math.cos(r),a+i*Math.sin(r)]}function L(t,e,r){if(w(t)){const t=d([e],"meters")[0];return{area:v([r],"square-meters")[0],perimeter:t}}const n=x.WGS84,a=g(e,n),o=g(r,n);let c=i(o,E);if(c=s(c),!c)return null;const u=d([a],"meters")[0];return{area:v([c],"square-meters")[0],perimeter:u}}async function W(e,r,n,a,o=!1,i){if(r.length<2||!a||!n||!e)return null;const s=Q(n,e);if(!s)return null;const c=r.map((t=>[t.x,t.y])),u=c.at(0),l=c.at(-1);if(!u||!l)return null;const f=s.map((t=>tt([u,l],t,e,o,!1))),m=await Promise.all(f);t(i);let p=0;for(const t of m){if(!t)return null;const e=Math.abs(t-a);p=Math.max(e,p)}return p}async function G(e,r,n,a,o,i=!1,s){if(r.length<2||!a||!n||!e)throw new Error("Missing parameters");const c=X(n,e),u=r.map((t=>[t.x,t.y])),l=u.at(0),f=u.at(-1),m=c.map((t=>et([l,f],t,e,o,i,!1))),p=await Promise.all(m);t(s);let y=0;for(const t of p){if(!t)return 0;const e=Math.abs(t-a);y=Math.max(e,y)}return y}function k(t,e){const r=K(t,!1);if(!r?.length)return;return 20*o([r[0].x,r[0].y],[r.at(-1).x,r.at(-1).y])/e}function D(t){const e=t.spatialReference;if(e.isGeographic){if(w(e))return d([t],"meters")[0];const r=g(t,x.WGS84);return d([r],"meters")[0]}return e.isWebMercator?c(t,"meters"):u(t,"meters")}function U(t){if(!t?.length)throw new Error("Invalid deviations array");const[e,r,n]=[0,1,2].map((e=>t.map((t=>t[e])).filter((t=>null!==t)))).map((t=>t.length?$(t):0));return[e,r,n]}function F(t,e){const r=s(e);if(!r)return null;const n=u(t,"meters");return{area:l(r,"square-meters"),perimeter:n}}function S(t,e){let r=i(e,E,"meters");if(r=s(r),!r)return null;const n=c(t,"meters");return{area:f(r,"square-meters"),perimeter:n}}async function T(e,r,n){if(!r||!e)throw new Error("Missing required parameters");const a=await R(e,r);t(n);const o=a.clone();o.z?o.z+=20:o.z=20;const{averageElevation:i,cameraPitch:s,cameraRoll:c,farDistance:u,...l}=r;return P(o,l)}async function H(e,r,n,a){const{attributes:o}=n,{location:i}=o,{updateElevationProps:s,...c}=r;if(!e||!r)throw new Error("Missing parameters");let u=i.clone();u.spatialReference.isGeographic&&(u=await h(u,x.WebMercator));const l=await z(e,{...c,cameraLocation:u},s);t(a);const f=l.clone();return f.z?f.z+=20:f.z=20,j(f,c)}function O(t,e,r,n,a=0,i=1,s){const{averageElevation:c,cameraPitch:u,cameraRoll:l,farDistance:f,...p}=n;if(a>=5||i<=.1)return{value:t};const y=new m({x:e.x,y:e.y,z:e.z?e.z+t:t,spatialReference:n.cameraLocation.spatialReference}),h=P(y,p),g=o([r[0].x,r[0].y],[h.x,h.y]),x=r.at(0),w=r.at(-1);if(!x||!w)return null;const d=o([x.x,x.y],[w.x,w.y])*t/g;return O(d,e,r,n,a+1,Math.abs(t-d))}function V(t,e,r,n,a=0,i=1,s){const{averageElevation:c,horizontalFieldOfView:u,verticalFieldOfView:l,farDistance:f,...p}=n;if(a>=5||i<=.1)return{value:t};const y=new m({x:e.x,y:e.y,z:e.z?e.z+t:t,spatialReference:n.cameraLocation.spatialReference}),h=j(y,p),g=o([r[0].x,r[0].y],[h.x,h.y]),x=r.at(0),w=r.at(-1);if(!x||!w)return null;const d=o([x.x,x.y],[w.x,w.y])*t/g;return V(d,e,r,n,a+1,Math.abs(t-d))}async function A(t,e){const{updateElevationProps:r,...n}=e;return await R(t,n,r)}async function B(t,e){const{updateElevationProps:r,...n}=e;return z(t,n,r)}function C(t){navigator.clipboard.writeText(t).catch((t=>{throw t}))}function J(t){const e=t.map((t=>[t.x,t.y])),r=t[0].spatialReference;return new y({paths:[e],spatialReference:r})}function K(t,e){return t.map((t=>({x:e?.5+t[0]:t[0],y:e?.5-t[1]:t[1]})))}function N(t,r,a,o,i){const s="measurement"===t?r:a;if(i&&s)return e(o,n(s,"meters"),i,3)||null}function Q(t,e){const{cameraPitch:r,cameraRoll:n,cameraLocation:a}=t,{x:o,y:i,z:s,spatialReference:c}=a;if(e.every((t=>0===t))||!e||!e.length)return null;const[u,l,,f,p]=e,y=[-f,0,f],h=[-p,0,p],g=[-u,0,u],x=[-l,0,l],w=[];for(const d of y)for(const e of h)for(const a of g)for(const u of g)for(const l of x){const f={...t};f.cameraPitch=r+d,f.cameraRoll=n+e,f.cameraLocation=new m({x:o+a,y:i+u,z:s?s+l:0,spatialReference:{wkid:c.wkid}}),w.push(f)}return w}function X(t,e){const{cameraHeading:r,cameraLocation:n}=t,{x:a,y:o,z:i,spatialReference:s}=n;if(e.every((t=>0===t))||!e||!e.length)throw new Error("Invalid parameters");const[c,u,l]=e,f=l>0?[-l,0,l]:[],p=c>0?[-c,0,c]:[],y=u>0?[-u,0,u]:[],h=[];for(const g of f)for(const e of p)for(const n of p)for(const c of y){const u={...t};u.cameraHeading=r+g,u.cameraLocation=new m({x:a+e,y:o+n,z:i?i+c:0,spatialReference:{wkid:s.wkid}}),h.push(u)}return h}function Y(t,r,a,o,i){const s="measurement"===t?r:$(a);if(i&&s)return e(o,n(s,"meters"),i,3)||null}function Z(t,e,n,o,i){const s="measurement"===t?e:n;if(i&&s)return r(o,a(s,"square-meters"),i,3)||null}function $(t){return Math.sqrt(t.reduce(((t,e)=>t+e**2),0))}function _(t,e,r){if("default"===e)return t;const n={x:t[0],y:t[1],z:t[2]},a=M(n,r[0],r[1]);return[a.x,a.y]}async function tt(e,r,n,a=!1,i=!1,s){if(!e||!r||e.length<2)return null;const c=K(e,a);if(!c||c.length<2)return null;const[u,l]=[c[0],c.at(-1)];if(!l)return null;const f=[u],m=await R(u,r);t(s);const p=m.clone();p.z?p.z+=20:p.z=20;const{averageElevation:y,cameraPitch:h,cameraRoll:g,farDistance:x,...w}=r,d=P(p,w),v=o([u.x,u.y],[d.x,d.y]),z=b(u,d);if(!z)return;const M=q([u.x,u.y],[l.x,l.y],z);if(!M?.length)return;f.push({x:M[0],y:M[1]});const j=20*o([f[0].x,f[0].y],[f[1].x,f[1].y])/v;if(!i)return j;const E=O(j,m,f,r,0,1);return E?.value}async function et(e,r,n,a,i=!1,s=!1,c){const{attributes:u}=a,{location:l}=u,{updateElevationProps:f,...m}=r;if(!e||!r||e.length<2)throw new Error("Invalid parameters");const p=K(e,i),[y,g]=[p[0],p.at(-1)],w=[y];let d=l.clone();d.spatialReference.isGeographic&&(d=await h(d,x.WebMercator));const v=await z(y,{...m,cameraLocation:d},f);t(c);const R=v.clone();R.z?R.z+=20:R.z=20;const M=j(R,m),P=o([y.x,y.y],[M.x,M.y]),E=b(y,M);if(!E)return;const I=q([y.x,y.y],[g.x,g.y],E);if(!I?.length)return;w.push({x:I[0],y:I[1]});const L=20*o([w[0].x,w[0].y],[w[1].x,w[1].y])/P;if(!s)return L;const W=V(L,v,w,r,0,1);return W?.value}async function rt(t,e,r=!1){if(t.length<3)return null;const n=K(t,r),a=await A(n,e),o=a.map((({x:t,y:e})=>[t,e]));t.push(t[0]),o.push(o[0]);const i=a[0].spatialReference,s=new y({paths:[o],spatialReference:i}),c=new p({rings:[o],spatialReference:i});return i.isGeographic?L(i,s,c):i.isWebMercator?S(s,c):F(s,c)}async function nt(e,r,n=!1,a){if(e.length<3)return null;const o=K(e,n),i=await B(o,r);t(a);const s=i.map((({x:t,y:e})=>[t,e]));e.push(e[0]),s.push(s[0]);const c=i[0].spatialReference,u=new y({paths:[s],spatialReference:c}),l=new p({rings:[s],spatialReference:c});return c.isGeographic?L(c,u,l):c.isWebMercator?S(u,l):F(u,l)}async function at(t,e,r=!1){const n=K(t,r);return D(J(await A(n,e)))}async function ot(e,r,n=!1,a){const o=K(e,n),i=await B(o,r);t(a);return D(J(i))}export{b as calculateAngle,I as calculateAnglePano,q as calculateCorrectedPixel,W as calculateHeightAccuracy,G as calculateHeightAccuracyPanoramic,k as calculateHeightFromTemporaryDistance,U as calculateLocationAccuracyFromDeviations,H as calculateReferenceImagePointPanoramic,T as calculateTempImagePoint,O as computeHeightIteratively,V as computeHeightIterativelyPanoramic,C as copyToClipboard,K as formatPixels,Q as generateCombinations,X as generateCombinationsPanoramic,Z as getConvertedArea,Y as getConvertedDistance,N as getConvertedHeight,_ as getModeCorrectedPoint,$ as getRootOfSumOfSquaredErrors,tt as heightMeasurement2D,et as heightMeasurementPanoramic,rt as pixelAreaMeasurement2D,nt as pixelAreaMeasurementPanoramic,at as pixelDistanceMeasurement2D,ot as pixelDistanceMeasurementPanoramic};
5
+ import{throwIfAborted as t}from"../../core/promiseUtils.js";import{formatLength as e,formatArea as r}from"../../core/quantityFormatUtils.js";import{createLength as n,createArea as a}from"../../core/quantityUtils.js";import{distance as o}from"../../core/libs/gl-matrix-2/math/vec2.js";import i from"../../geometry/Point.js";import s from"../../geometry/Polygon.js";import c from"../../geometry/Polyline.js";import{projectWithZConversion as u,project as l}from"../../geometry/projection.js";import f from"../../geometry/SpatialReference.js";import{e as m}from"../../chunks/areaOperator.js";import{l as p,e as y}from"../../chunks/geodeticAreaOperator.js";import{l as h,e as g}from"../../chunks/geodeticDensifyOperator.js";import{l as x,e as w}from"../../chunks/geodeticLengthOperator.js";import{e as d}from"../../chunks/lengthOperator.js";import{e as v}from"../../chunks/simplifyOperator.js";import{isSupported as R,geodesicLengths as z,geodesicAreas as M}from"../../geometry/support/geodesicUtils.js";import{imageToWorld as j,imageToWorldPanoramic as P}from"../../layers/orientedImagery/transformations/imageToWorld.js";import{convertSphereVertexToPixelLocation as E}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as b,worldToImagePanoramic as I}from"../../layers/orientedImagery/transformations/worldToImage.js";const k=1e5;function L(t,e){let r=180*Math.atan2(-t.y+e.y,t.x-e.x)/Math.PI;return r<0&&(r+=180),r*Math.PI/180}function O(t,e){let r=180*Math.atan2(-t.y+e.y,t.x-e.x)/Math.PI;return r<0&&(r+=180),r*Math.PI/180}function W(t,e,r){if(!t?.length||!e?.length||!r)return;const[n,a]=t,[,o]=e,i=o-a;return[n+i*Math.cos(r),a+i*Math.sin(r)]}async function q(t,e,r){if(await h(),R(t)){const t=z([e],"meters")[0];return{area:M([r],"square-meters")[0],perimeter:t}}const n=f.WGS84,a=l(e,n),o=l(r,n);let i=g(o,k);if(i=v(i),!i)return null;const s=z([a],"meters")[0];return{area:M([i],"square-meters")[0],perimeter:s}}async function G(e,r,n,a,o=!1,i){if(r.length<2||!a||!n||!e)return null;const s=Z(n,e);if(!s)return null;const c=r.map((t=>[t.x,t.y])),u=c.at(0),l=c.at(-1);if(!u||!l)return null;const f=s.map((t=>nt([u,l],t,e,o,!1))),m=await Promise.all(f);t(i);let p=0;for(const t of m){if(!t)return null;const e=Math.abs(t-a);p=Math.max(e,p)}return p}async function D(e,r,n,a,o,i=!1,s){if(r.length<2||!a||!n||!e)throw new Error("Missing parameters");const c=$(n,e),u=r.map((t=>[t.x,t.y])),l=u.at(0),f=u.at(-1),m=c.map((t=>at([l,f],t,e,o,i,!1))),p=await Promise.all(m);t(s);let y=0;for(const t of p){if(!t)return 0;const e=Math.abs(t-a);y=Math.max(e,y)}return y}function U(t,e){const r=X(t,!1);if(!r?.length)return;return 20*o([r[0].x,r[0].y],[r.at(-1).x,r.at(-1).y])/e}async function F(t){await x();const e=t.spatialReference;if(e.isGeographic){if(R(e))return z([t],"meters")[0];const r=l(t,f.WGS84);return z([r],"meters")[0]}return e.isWebMercator?w(t):d(t)}function S(t){if(!t?.length)throw new Error("Invalid deviations array");const[e,r,n]=[0,1,2].map((e=>t.map((t=>t[e])).filter((t=>null!==t)))).map((t=>t.length?et(t):0));return[e,r,n]}function T(t,e){const r=v(e);if(!r)return null;const n=d(t);return{area:m(r),perimeter:n}}async function H(t,e){await Promise.all([p(),h(),x()]);let r=g(e,k);if(r=v(r),!r)return null;const n=w(t);return{area:y(r),perimeter:n}}async function V(e,r,n){if(!r||!e)throw new Error("Missing required parameters");const a=await j(e,r);t(n);const o=a.clone();o.z?o.z+=20:o.z=20;const{averageElevation:i,cameraPitch:s,cameraRoll:c,farDistance:u,...l}=r;return b(o,l)}async function A(e,r,n,a){const{attributes:o}=n,{location:i}=o,{updateElevationProps:s,...c}=r;if(!e||!r)throw new Error("Missing parameters");let l=i.clone();l.spatialReference.isGeographic&&(l=await u(l,f.WebMercator));const m=await P(e,{...c,cameraLocation:l},s);t(a);const p=m.clone();return p.z?p.z+=20:p.z=20,I(p,c)}function B(t,e,r,n,a=0,s=1,c){const{averageElevation:u,cameraPitch:l,cameraRoll:f,farDistance:m,...p}=n;if(a>=5||s<=.1)return{value:t};const y=new i({x:e.x,y:e.y,z:e.z?e.z+t:t,spatialReference:n.cameraLocation.spatialReference}),h=b(y,p),g=o([r[0].x,r[0].y],[h.x,h.y]),x=r.at(0),w=r.at(-1);if(!x||!w)return null;const d=o([x.x,x.y],[w.x,w.y])*t/g;return B(d,e,r,n,a+1,Math.abs(t-d))}function C(t,e,r,n,a=0,s=1,c){const{averageElevation:u,horizontalFieldOfView:l,verticalFieldOfView:f,farDistance:m,...p}=n;if(a>=5||s<=.1)return{value:t};const y=new i({x:e.x,y:e.y,z:e.z?e.z+t:t,spatialReference:n.cameraLocation.spatialReference}),h=I(y,p),g=o([r[0].x,r[0].y],[h.x,h.y]),x=r.at(0),w=r.at(-1);if(!x||!w)return null;const d=o([x.x,x.y],[w.x,w.y])*t/g;return C(d,e,r,n,a+1,Math.abs(t-d))}async function J(t,e){const{updateElevationProps:r,...n}=e;return await j(t,n,r)}async function K(t,e){const{updateElevationProps:r,...n}=e;return P(t,n,r)}function N(t){navigator.clipboard.writeText(t).catch((t=>{throw t}))}function Q(t){const e=t.map((t=>[t.x,t.y])),r=t[0].spatialReference;return new c({paths:[e],spatialReference:r})}function X(t,e){return t.map((t=>({x:e?.5+t[0]:t[0],y:e?.5-t[1]:t[1]})))}function Y(t,r,a,o,i){const s="measurement"===t?r:a;if(i&&s)return e(o,n(s,"meters"),i,3)||null}function Z(t,e){const{cameraPitch:r,cameraRoll:n,cameraLocation:a}=t,{x:o,y:s,z:c,spatialReference:u}=a;if(e.every((t=>0===t))||!e||!e.length)return null;const[l,f,,m,p]=e,y=[-m,0,m],h=[-p,0,p],g=[-l,0,l],x=[-f,0,f],w=[];for(const d of y)for(const e of h)for(const a of g)for(const l of g)for(const f of x){const m={...t};m.cameraPitch=r+d,m.cameraRoll=n+e,m.cameraLocation=new i({x:o+a,y:s+l,z:c?c+f:0,spatialReference:{wkid:u.wkid}}),w.push(m)}return w}function $(t,e){const{cameraHeading:r,cameraLocation:n}=t,{x:a,y:o,z:s,spatialReference:c}=n;if(e.every((t=>0===t))||!e||!e.length)throw new Error("Invalid parameters");const[u,l,f]=e,m=f>0?[-f,0,f]:[],p=u>0?[-u,0,u]:[],y=l>0?[-l,0,l]:[],h=[];for(const g of m)for(const e of p)for(const n of p)for(const u of y){const l={...t};l.cameraHeading=r+g,l.cameraLocation=new i({x:a+e,y:o+n,z:s?s+u:0,spatialReference:{wkid:c.wkid}}),h.push(l)}return h}function _(t,r,a,o,i){const s="measurement"===t?r:et(a);if(i&&s)return e(o,n(s,"meters"),i,3)||null}function tt(t,e,n,o,i){const s="measurement"===t?e:n;if(i&&s)return r(o,a(s,"square-meters"),i,3)||null}function et(t){return Math.sqrt(t.reduce(((t,e)=>t+e**2),0))}function rt(t,e,r){if("default"===e)return t;const n={x:t[0],y:t[1],z:t[2]},a=E(n,r[0],r[1]);return[a.x,a.y]}async function nt(e,r,n,a=!1,i=!1,s){if(!e||!r||e.length<2)return null;const c=X(e,a);if(!c||c.length<2)return null;const[u,l]=[c[0],c.at(-1)];if(!l)return null;const f=[u],m=await j(u,r);t(s);const p=m.clone();p.z?p.z+=20:p.z=20;const{averageElevation:y,cameraPitch:h,cameraRoll:g,farDistance:x,...w}=r,d=b(p,w),v=o([u.x,u.y],[d.x,d.y]),R=L(u,d);if(!R)return;const z=W([u.x,u.y],[l.x,l.y],R);if(!z?.length)return;f.push({x:z[0],y:z[1]});const M=20*o([f[0].x,f[0].y],[f[1].x,f[1].y])/v;if(!i)return M;const P=B(M,m,f,r,0,1);return P?.value}async function at(e,r,n,a,i=!1,s=!1,c){const{attributes:l}=a,{location:m}=l,{updateElevationProps:p,...y}=r;if(!e||!r||e.length<2)throw new Error("Invalid parameters");const h=X(e,i),[g,x]=[h[0],h.at(-1)],w=[g];let d=m.clone();d.spatialReference.isGeographic&&(d=await u(d,f.WebMercator));const v=await P(g,{...y,cameraLocation:d},p);t(c);const R=v.clone();R.z?R.z+=20:R.z=20;const z=I(R,y),M=o([g.x,g.y],[z.x,z.y]),j=L(g,z);if(!j)return;const E=W([g.x,g.y],[x.x,x.y],j);if(!E?.length)return;w.push({x:E[0],y:E[1]});const b=20*o([w[0].x,w[0].y],[w[1].x,w[1].y])/M;if(!s)return b;const k=C(b,v,w,r,0,1);return k?.value}async function ot(t,e,r=!1){if(t.length<3)return null;const n=X(t,r),a=await J(n,e),o=a.map((({x:t,y:e})=>[t,e]));t.push(t[0]),o.push(o[0]);const i=a[0].spatialReference,u=new c({paths:[o],spatialReference:i}),l=new s({rings:[o],spatialReference:i});return i.isGeographic?q(i,u,l):i.isWebMercator?H(u,l):T(u,l)}async function it(e,r,n=!1,a){if(e.length<3)return null;const o=X(e,n),i=await K(o,r);t(a);const u=i.map((({x:t,y:e})=>[t,e]));e.push(e[0]),u.push(u[0]);const l=i[0].spatialReference,f=new c({paths:[u],spatialReference:l}),m=new s({rings:[u],spatialReference:l});return l.isGeographic?q(l,f,m):l.isWebMercator?H(f,m):T(f,m)}async function st(t,e,r=!1){const n=X(t,r);return F(Q(await J(n,e)))}async function ct(e,r,n=!1,a){const o=X(e,n),i=await K(o,r);t(a);return F(Q(i))}export{L as calculateAngle,O as calculateAnglePano,W as calculateCorrectedPixel,G as calculateHeightAccuracy,D as calculateHeightAccuracyPanoramic,U as calculateHeightFromTemporaryDistance,S as calculateLocationAccuracyFromDeviations,A as calculateReferenceImagePointPanoramic,V as calculateTempImagePoint,B as computeHeightIteratively,C as computeHeightIterativelyPanoramic,N as copyToClipboard,X as formatPixels,Z as generateCombinations,$ as generateCombinationsPanoramic,tt as getConvertedArea,_ as getConvertedDistance,Y as getConvertedHeight,rt as getModeCorrectedPoint,et as getRootOfSumOfSquaredErrors,nt as heightMeasurement2D,at as heightMeasurementPanoramic,ot as pixelAreaMeasurement2D,it as pixelAreaMeasurementPanoramic,st as pixelDistanceMeasurement2D,ct as pixelDistanceMeasurementPanoramic};